]> git.sesse.net Git - vlc/blob - configure.ac
Configure: regroup the host/build sections
[vlc] / configure.ac
1 dnl Autoconf settings for vlc
2
3 AC_COPYRIGHT([Copyright 2002-2012 VLC authors and VideoLAN])
4
5 AC_INIT(vlc, 2.1.0-git)
6 VERSION_MAJOR=2
7 VERSION_MINOR=1
8 VERSION_REVISION=0
9 VERSION_EXTRA=0
10 VERSION_DEV=git
11
12 PKGDIR="vlc"
13 AC_SUBST(PKGDIR)
14
15 CONFIGURE_LINE="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`"
16 CODENAME="Rincewind"
17 COPYRIGHT_YEARS="1996-2012"
18
19 AC_CONFIG_SRCDIR(src/libvlc.c)
20 AC_CONFIG_AUX_DIR(autotools)
21 AC_CONFIG_MACRO_DIR(m4)
22 AC_CONFIG_LIBOBJ_DIR(compat)
23 AC_CANONICAL_BUILD
24 AC_CANONICAL_HOST
25 AC_PRESERVE_HELP_ORDER
26
27 AM_INIT_AUTOMAKE(tar-ustar color-tests foreign)
28 AM_CONFIG_HEADER(config.h)
29
30 # Disable with "./configure --disable-silent-rules" or "make V=1"
31 AM_SILENT_RULES([yes])
32
33 dnl Too many people are not aware of maintainer mode:
34 dnl If you want to use it, you definitely know what you are doing, so
35 dnl you can specify "--disable-maintainer-mode". But if you want the default
36 dnl automake behavior, you've likely never heard of maintainer mode, so we
37 dnl can't expect you to enable it manually.
38 AS_IF([test "x${enable_maintainer_mode}" != "xno"],
39     [enable_maintainer_mode="yes"])
40 AM_MAINTAINER_MODE
41
42 dnl
43 dnl Directories
44 dnl
45 dnl vlcincludedir="\${includedir}/\${PKGDIR}"
46 dnl AC_SUBST(vlcincludedir)
47 vlcdatadir="\${datadir}/\${PKGDIR}"
48 AC_SUBST(vlcdatadir)
49 vlclibdir="\${libdir}/\${PKGDIR}"
50 AC_SUBST(vlclibdir)
51
52 dnl
53 dnl Check for tools
54 dnl
55 AC_PROG_CC_C99
56 AC_USE_SYSTEM_EXTENSIONS
57 AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.])
58 AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
59 AC_DEFINE([_REENTRANT],, [Define to expose reentrant functions.])
60 AC_DEFINE([_THREAD_SAFE],, [Same as _REENTANT for some other OSes.])
61 AC_DEFINE([__LIBVLC__],, [Define within the LibVLC source code tree.])
62 AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])
63
64 AM_PROG_CC_C_O
65 AC_PROG_CXX
66 AC_PROG_CPP
67 AC_PROG_OBJC
68 _AM_DEPENDENCIES([OBJC])
69 AC_PROG_EGREP
70 AC_PROG_MAKE_SET
71 AC_PROG_INSTALL
72 AM_PROG_AS
73
74 AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
75 AC_CHECK_PROGS(DESKTOP_FILE_VALIDATE, [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
76
77 dnl Check for compiler properties
78 AC_C_CONST
79 AC_C_INLINE
80 AC_C_RESTRICT
81
82 dnl Extend the --help string at the current spot.
83 AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
84
85 dnl Allow binary package maintainer to pass a custom string to avoid
86 dnl cache problem
87 AC_ARG_WITH(binary-version,
88     AS_HELP_STRING([--with-binary-version=STRING],
89          [To avoid plugins cache problem between binary version]),[],[])
90 AS_IF([test -n "${with_binary_version}"],[
91     AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
92          [Binary specific version])
93 ])
94
95 dnl
96 dnl  Check the operating system
97 dnl
98 HAVE_WIN64="0"
99 case "${host_os}" in
100   "")
101     SYS=unknown
102     ;;
103   linux*)
104     SYS=linux
105     ;;
106   bsdi*)
107     SYS=bsdi
108     CFLAGS="${CFLAGS} -pthread"
109     VLC_ADD_LIBS([vcd cdda vcdx],[-ldvd])
110     ;;
111   freebsd*)
112     SYS=freebsd
113     CFLAGS="${CFLAGS} -pthread"
114     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
115     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
116     ;;
117   openbsd*)
118     SYS=openbsd
119     CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/X11R6/include"
120     LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/X11R6/lib/"
121     ;;
122   netbsd*)
123     SYS=netbsd
124     ;;
125   dragonfly*)
126     SYS=dragonfly
127     ;;
128   darwin*)
129
130     dnl Force gcc "-arch" flag
131     ARCH_flag=""
132     case "${host}" in
133       i?86*)
134         ARCH_flag="-arch i386"
135       ;;
136       ppc64*)
137         ARCH_flag="-arch ppc64"
138       ;;
139       ppc*)
140         ARCH_flag="-arch ppc"
141       ;;
142       x86_64*)
143         ARCH_flag="-arch x86_64"
144       ;;
145       arm*)
146         ARCH_flag="-arch armv7"
147         ac_cv_c_bigendian="no"
148         ac_cv_c_attribute_packed="no"
149       ;;
150     esac
151
152     SYS=darwin
153     CFLAGS="${CFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
154     CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
155     CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
156     OBJCFLAGS="${OBJCFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu99 ${ARCH_flag}"
157     LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
158     VLC_ADD_LIBS([motion], [-Wl,-framework,IOKit,-framework,CoreFoundation])
159     VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup,-framework,Appkit])
160     VLC_ADD_LIBS([avcodec access_avio swscale postproc i420_rgb_mmx x264 x26410b],[-Wl,-read_only_relocs,suppress])
161     VLC_ADD_CFLAGS([motion],[-fconstant-cfstrings])
162     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation])
163
164     dnl Allow binaries created on Lion to run on earlier releases
165     AC_EGREP_CPP(yes,
166            [#import <Cocoa/Cocoa.h>
167             #ifdef MAC_OS_X_VERSION_10_7
168             yes
169             #endif],
170             [AC_MSG_RESULT([yes])
171             AC_LIBOBJ([getdelim])
172             AC_LIBOBJ([strndup])
173             AC_LIBOBJ([strnlen])],)
174
175     dnl
176     dnl  Handle Mac OS X SDK flags
177     dnl
178     AC_ARG_WITH(macosx-sdk,
179       [AS_HELP_STRING([--with-macosx-sdk=DIR],
180         [compile using the SDK in DIR])])
181     if test "${with_macosx_sdk}" != "" ; then
182         test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
183         CPP="${CPP} -isysroot ${with_macosx_sdk}"
184         CC="${CC} -isysroot ${with_macosx_sdk}"
185         CXX="${CXX} -isysroot ${with_macosx_sdk}"
186         OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
187         LD="${LD} -syslibroot ${with_macosx_sdk}"
188     fi
189     AC_ARG_WITH(macosx-version-min,
190       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
191         [compile for Mac OS X VERSION and above])])
192     if test "${with_macosx_version_min}" != "" ; then
193         MACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}
194         CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
195         CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
196         CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
197         OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
198         LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
199         CFLAGS="${CFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
200         CXXFLAGS="${CXXFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
201         OBJCFLAGS="${OBJCFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
202         export MACOSX_DEPLOYMENT_TARGET
203     fi
204     ;;
205   *mingw32* | *cygwin* | *wince* | *mingwce*)
206     AC_CHECK_TOOL(WINDRES, windres, :)
207     AC_CHECK_TOOL(OBJCOPY, objcopy, :)
208     AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows XP SP2 APIs.])
209     AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE 6.0 (and shell) APIs.])
210
211     case "${host_os}" in
212       *mingw32*)
213         SYS=mingw32
214         ;;
215       *cygwin*)
216         dnl Check if we are using the mno-cygwin mode in which case we are
217         dnl actually dealing with a mingw32 compiler.
218         AC_EGREP_CPP(yes,
219             [#ifdef WIN32
220              yes
221              #endif],
222             SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
223         ;;
224     esac
225
226     if test "${SYS}" = "mingw32"; then
227         VLC_ADD_LIBS([libvlccore],[-lwinmm])
228         VLC_ADD_LDFLAGS([vlc],[-mwindows])
229         VLC_ADD_LIBS([win32text],[-lgdi32])
230         VLC_ADD_LIBS([vcdx],[-lwinmm])
231         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
232         ac_default_prefix="`pwd`/_win32"
233         DESTDIR="`pwd`/_win32/"
234
235         dnl
236         dnl NSIS Installer prefix and WIN64
237         dnl
238         case "${host}" in
239             amd64*|x86_64*)
240                 HAVE_WIN64="1"
241                 PROGRAMFILES="PROGRAMFILES64"
242             ;;
243             *)
244                 PROGRAMFILES="PROGRAMFILES"
245             ;;
246         esac
247         AC_SUBST(PROGRAMFILES)
248
249     fi
250     ;;
251   *nto*)
252     SYS=nto
253     ;;
254   solaris*)
255     SYS=solaris
256     ;;
257   hpux*)
258     SYS=hpux
259     ;;
260   symbian*)
261     SYS=symbian
262     ;;
263   *os2*)
264     SYS=os2
265     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild"
266     ;;
267   *)
268     SYS="${host_os}"
269     ;;
270 esac
271 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
272 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
273 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
274 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
275 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1")
276 AM_CONDITIONAL(HAVE_SYMBIAN, test "${SYS}" = "symbian")
277
278 dnl
279 dnl Sadly autoconf does not think about testing foo.exe when ask to test
280 dnl for program foo on win32
281 case "${build_os}" in
282     cygwin|msys)
283         ac_executable_extensions=".exe"
284     ;;
285     *)
286     ;;
287 esac
288
289 dnl Android is linux, but a bit different
290 AS_IF([test "$SYS" = linux],[
291     AC_MSG_CHECKING([for an Android system])
292     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
293         [[#ifndef __ANDROID__
294          # error Not Android
295          #endif
296         ]],[[;]])
297     ],[
298       HAVE_ANDROID="1"
299       AC_MSG_RESULT([yes])
300     ],[
301       AC_MSG_RESULT([no])
302     ])
303 ])
304 AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
305
306
307 dnl
308 dnl  Check for the contrib directory
309 dnl
310 AC_ARG_WITH(contrib,
311   [AS_HELP_STRING([--with-contrib[=DIR]],
312     [search for 3rd party libraries in DIR/include and DIR/lib])
313 ])
314 AC_MSG_CHECKING([for 3rd party libraries path])
315 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
316   CONTRIB_DIR="${srcdir}/contrib/${host}"
317   AS_IF([test ! -d "${CONTRIB_DIR}"], [
318     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
319     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
320     AS_IF([test ! -d "${CONTRIB_DIR}"], [
321       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
322       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
323       AS_IF([test ! -d "${CONTRIB_DIR}"], [
324         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
325         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
326         AS_IF([test ! -d "${CONTRIB_DIR}"], [
327           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
328           CONTRIB_DIR=""
329           AC_MSG_RESULT([not found])
330         ])
331       ])
332     ])
333   ])
334 ], [
335   AS_IF([test "${with_contrib}" != "no"], [
336     CONTRIB_DIR="${with_contrib}"
337   ], [
338     CONTRIB_DIR=""
339     AC_MSG_RESULT([disabled])
340   ])
341 ])
342 AS_IF([test -n "${CONTRIB_DIR}"], [
343   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
344     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
345   ], [
346     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
347     CONTRIB_DIR=""
348     AC_MSG_RESULT([not usable])
349   ])
350
351 ])
352 AS_IF([test -n "${CONTRIB_DIR}"], [
353   AC_MSG_RESULT([${CONTRIB_DIR}])
354   export PATH=${CONTRIB_DIR}/bin:$PATH
355   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
356   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
357   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
358   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
359   AS_IF([test "$build" = "$host" -o "$PKG_CONFIG_LIBDIR"], [
360     export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
361   ], [
362     export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig"
363   ])
364   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
365
366   AS_IF([test "${SYS}" = "darwin"], [
367     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
368     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
369   ])
370 ], [
371   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
372     AC_MSG_ERROR([Third party libraries not found!])
373   ])
374 ])
375 AC_SUBST(CONTRIB_DIR)
376
377 dnl
378 dnl  Libtool
379 dnl  It's very bad, but our former custom system was worst
380 dnl  -- Courmisch
381 dnl
382
383 dnl override platform specific check for dependent libraries
384 dnl otherwise libtool linking of shared libraries will
385 dnl fail on anything other than pass_all.
386 AC_CACHE_VAL(lt_cv_deplibs_check_method,
387     [lt_cv_deplibs_check_method=pass_all])
388
389 LT_INIT([dlopen win32-dll shared disable-static])
390 LT_LANG([C++])
391 LT_LANG([Windows Resource])
392
393 DOLT
394
395 m4_undefine([AC_DEPLIBS_CHECK_METHOD])
396 m4_defun([AC_DEPLIBS_CHECK_METHOD],[])
397
398 lt_cv_deplibs_check_method=pass_all
399
400 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
401   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
402 ])
403
404 dnl
405 dnl Gettext stuff
406 dnl
407 AM_GNU_GETTEXT_VERSION([0.18.1])
408 AM_GNU_GETTEXT([external], [need-ngettext])
409
410 dnl
411 dnl Iconv stuff
412 dnl
413 AM_ICONV
414
415 dnl Check for broken versions of mingw-runtime compatability library
416 AS_IF([test "${SYS}" = "mingw32"], [
417     AC_MSG_CHECKING(for broken mingw-runtime)
418     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
419 #include <_mingw.h>
420 #if defined(__MINGW64_VERSION_MAJOR)
421 # if __MINGW64_VERSION_MAJOR < 3
422 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
423 # endif
424 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
425 # error Attempting to use mingw-runtime with broken vsnprintf support
426 #endif
427     ])], [
428         AC_MSG_RESULT([ok])
429     ], [
430         AC_MSG_RESULT([present])
431         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
432     ])
433     dnl force use of mingw provided c99 *printf over msvcrt
434     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
435 ])
436
437 dnl Check for the need to include the mingwex lib for mingw32
438 if test "${SYS}" = "mingw32" ; then
439     AC_CHECK_LIB(mingwex,opendir,
440         AC_CHECK_LIB(mingw32,opendir,,
441             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
442     )
443 fi
444
445 dnl Check for fnative-struct or mms-bitfields support for mingw32
446 if test "${SYS}" = "mingw32" ; then
447     VLC_SAVE_FLAGS
448     CFLAGS="${CFLAGS} -mms-bitfields"
449     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
450     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
451         [ac_cv_c_mms_bitfields],
452         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
453     if test "${ac_cv_c_mms_bitfields}" = "no"; then
454         VLC_RESTORE_FLAGS
455         CFLAGS="${CFLAGS} -fnative-struct"
456         CXXFLAGS="${CXXFLAGS} -fnative-struct"
457         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
458             [ac_cv_c_fnative_struct],
459             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
460         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
461     fi
462 fi
463
464 dnl
465 dnl Buggy glibc prevention. Purposedly not cached.
466 dnl See sourceware.org bugs 5058 and 5443.
467 dnl Ubuntu alone has 20 bug numbers for this...
468 dnl
469 AC_MSG_CHECKING(for buggy GNU/libc versions)
470 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
471 #include <limits.h>
472 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
473   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
474 # error GNU/libc with dcgettext killer bug!
475 #endif
476 ])], [
477   AC_MSG_RESULT([not present])
478 ], [
479   AC_MSG_RESULT([found])
480   AS_IF([test "x${enable_nls}" != "xno"], [
481     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
482 work-around for this. Check with your distribution vendor on how to update the
483 glibc run-time. Alternatively, build with --disable-nls.])
484   ])
485 ])
486
487 dnl Plugin compilation stuff
488
489 VLC_LIBRARY_SUFFIX
490
491 dnl Check for system libs needed
492 need_libc=false
493
494 dnl Check for usual libc functions
495 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
496 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale])
497 AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r inet_pton lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
498 AC_CHECK_FUNCS(fdatasync,,
499   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
500 ])
501
502 dnl mingw64 implements those as static inline, not functions with C linkage
503 AC_LINK_IFELSE([
504     AC_LANG_PROGRAM([#include <stdio.h>], [
505         char *c;
506         if (asprintf(&c, "%s %d", "string", 1) == -1)
507             c = NULL;
508     ])],[AC_DEFINE([HAVE_ASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([asprintf])])
509 AC_LINK_IFELSE([
510     AC_LANG_PROGRAM([#include <stdio.h>
511                      #include <stdarg.h>], [
512         char *c;
513         va_list ap;
514         if (vasprintf(&c, "%s %d", ap) == -1)
515             c = NULL;
516     ])],[AC_DEFINE([HAVE_VASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([vasprintf])])
517
518 dnl C11 static_assert()
519 AC_MSG_CHECKING([for static_assert in assert.h])
520 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
521 #include <assert.h>
522 #ifndef static_assert
523 # error BOOM!
524 #endif
525 ])], [
526   AC_MSG_RESULT([yes])
527   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
528 ], [
529   AC_MSG_RESULT([no])
530 ])
531
532 # Windows CE does not have strcoll()
533 AC_FUNC_STRCOLL
534
535 dnl Check for non-standard system calls
536 AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
537
538 AH_BOTTOM([#include <vlc_fixups.h>])
539
540 dnl Check for struct pollfd
541 AC_CHECK_TYPES([struct pollfd],,,
542 [#include <sys/types.h>
543 #if HAVE_POLL
544 # include <poll.h>
545 #elif defined (WIN32)
546 # include <winsock2.h>
547 #endif
548 ])
549
550 dnl Checks for socket stuff
551 VLC_SAVE_FLAGS
552 SOCKET_LIBS=""
553 AC_SEARCH_LIBS(connect, [socket], [
554   AS_IF([test "$ac_cv_search_connect" != "none required"], [
555     SOCKET_LIBS="$ac_cv_search_connect"
556   ])
557 ], [
558   AS_IF([test "${SYS}" = "mingw32"], [
559     SOCKET_LIBS="-lws2_32"
560   ])
561 ])
562
563 AC_SEARCH_LIBS([getaddrinfo], [nsl], [
564  AS_IF([test "$ac_cv_search_getaddrinfo" != "none required"], [
565     SOCKET_LIBS="$ac_cv_search_getaddrinfo $SOCKET_LIBS"
566   ])
567 ],, [${SOCKET_LIBS}])
568
569 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
570 VLC_RESTORE_FLAGS
571
572 AS_IF([test -n "$SOCKET_LIBS"], [
573   VLC_ADD_LIBS([access_http access_udp access_tcp access_ftp access_rtmp access_output_udp access_output_shout sap stream_out_select stream_out_standard stream_out_rtp stream_out_raop vod_rtsp rtp oldrc netsync gnutls flac ts audioscrobbler lua remoteosd zvbi audiobargraph_a netsync],[${SOCKET_LIBS}])
574 ])
575 AC_SUBST(SOCKET_LIBS)
576
577 dnl Check for socklen_t
578 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
579 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
580 ac_cv_type_socklen_t,
581 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
582 [#include <sys/types.h>
583 #ifdef WIN32
584 # include <winsock2.h>
585 # include <ws2tcpip.h>
586 #else
587 # include <sys/socket.h>
588 #endif]], [[socklen_t len; len = 0;]])],
589 ac_cv_type_socklen_t=yes,
590 ac_cv_type_socklen_t=no)])
591 AS_IF([test "$ac_cv_type_socklen_t" = no],
592  [AC_DEFINE(socklen_t, int)])
593
594 dnl Check for struct sockaddr_storage
595 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
596 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
597 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
598   [AC_TRY_COMPILE(
599     [#include <sys/types.h>
600      #if defined( WIN32 )
601      # include <winsock2.h>
602      #else
603      # include <sys/socket.h>
604      #endif], [struct sockaddr_storage addr;],
605      ac_cv_struct_sockaddr_storage=yes,
606      ac_cv_struct_sockaddr_storage=no)])
607 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
608   AC_DEFINE(sockaddr_storage, sockaddr)
609   AC_DEFINE(ss_family, sa_family)
610 ])
611
612 dnl FreeBSD has a gnugetopt library for this:
613 GNUGETOPT_LIBS=""
614 AC_CHECK_FUNC(getopt_long,, [
615   AC_CHECK_LIB([gnugetopt],[getopt_long], [
616     GNUGETOPT_LIBS="-lgnugetopt"
617   ])
618 ])
619 AC_SUBST(GNUGETOPT_LIBS)
620
621 AC_CHECK_LIB(m,cos,[
622   VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom panoramix rotate noise grain scene kate flac lua chorus_flanger freetype avcodec access_avio swscale postproc i420_rgb faad twolame equalizer spatializer param_eq samplerate freetype mpc dmo quicktime qt4 compressor headphone_channel_mixer normvol audiobargraph_a speex opus mono colorthres extract ball access_imem hotkeys mosaic gaussianblur x26410b hqdn3d anaglyph oldrc ncurses],[-lm])
623   LIBM="-lm"
624 ], [
625   LIBM=""
626 ])
627 AC_SUBST(LIBM)
628
629 AC_CHECK_LIB(m,lrintf, [
630   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
631   VLC_ADD_LIBS([skins2],[-lm])
632 ])
633
634 dnl Check for dynamic plugins
635 LIBDL=""
636 have_dynamic_objects="no"
637 VLC_SAVE_FLAGS
638 AC_SEARCH_LIBS(dlopen, [dl svld], [
639   AS_IF([test "$ac_cv_search_dlopen" != "none required"], [
640     LIBDL="$ac_cv_search_dlopen"
641   ])
642   have_dynamic_objects="yes"
643 ])
644 VLC_RESTORE_FLAGS
645
646 # Windows
647 AS_IF([test "${SYS}" = "mingw32"], [
648   LIBDL=""
649   have_dynamic_objects="yes" #assume we can use shared objects
650 ])
651
652 AS_IF([test "${enable_shared}" = "no"], [
653   have_dynamic_objects=no
654 ])
655 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
656
657 AC_SUBST(LIBDL)
658 VLC_ADD_LIBS([lua],[$LIBDL])
659
660 dnl Check for thread library
661 LIBPTHREAD=""
662 AS_IF([test "${SYS}" != "mingw32"], [
663   VLC_SAVE_FLAGS
664   LIBS=""
665   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
666     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
667       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
668     ])
669   ])
670   VLC_RESTORE_FLAGS
671
672   AC_CHECK_LIB(rt, clock_nanosleep, [
673     VLC_ADD_LIBS([libvlccore],[-lrt])
674   ], [
675     AC_CHECK_FUNC(nanosleep,,[
676       AC_CHECK_LIB(rt,nanosleep, [
677         VLC_ADD_LIBS([libvlccore],[-lrt])
678       ], [
679         AC_CHECK_LIB(posix4,nanosleep, [
680           VLC_ADD_LIBS([libvlccore],[-lposix4])
681         ])
682       ])
683     ])
684     dnl HP/UX port
685     AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlccore],[-lrt])])
686   ])
687 ])
688 AC_SUBST(LIBPTHREAD)
689
690 dnl Check for headers
691 AC_CHECK_HEADERS([search.h])
692 AC_CHECK_HEADERS(getopt.h locale.h xlocale.h)
693 AC_CHECK_HEADERS([sys/time.h sys/ioctl.h])
694 AC_CHECK_HEADERS([arpa/inet.h netinet/udplite.h sys/eventfd.h])
695 AC_CHECK_HEADERS([net/if.h], [], [],
696   [
697     #include <sys/types.h>
698     #include <sys/socket.h>
699   ])
700 AC_CHECK_HEADERS([sys/mount.h], [], [],
701   [
702     #include <sys/param.h>
703   ])
704
705 if test "${SYS}" != "mingw32"; then
706   AC_CHECK_HEADERS(machine/param.h sys/shm.h)
707   AC_CHECK_HEADERS([linux/version.h linux/dccp.h scsi/scsi.h linux/magic.h])
708   AC_CHECK_HEADERS(syslog.h mntent.h)
709 fi # end "${SYS}" != "mingw32"
710
711 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
712 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
713 AC_CHECK_TYPE(ssize_t,, [
714   AC_DEFINE(ssize_t, int)
715 ])
716
717 dnl Check for threads library
718 if test "${SYS}" != "mingw32"; then
719   AC_CHECK_HEADERS(pthread.h)
720 fi # end "${SYS}" != "mingw32"
721
722 dnl It seems that autoconf detects pkg-config only during the first
723 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
724 dnl it is nested within a conditional block, so it was not working right.
725 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
726 AC_ARG_VAR(PKG_CONFIG_PATH,
727        [Paths where to find .pc not at the default location])
728 PKG_PROG_PKG_CONFIG()
729
730 dnl On some OS we need static linking
731 AS_IF([test -n "${PKG_CONFIG}" ],[
732     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
733         PKG_CONFIG="${PKG_CONFIG} --static"
734     ])
735 ])
736
737
738 dnl
739 dnl Check for zlib.h and -lz along with system -lminizip if available
740 dnl
741 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
742 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
743 if test "${have_zlib}" = "yes"
744 then
745   VLC_ADD_LIBS([access_http skins2 sap unzip zip],[-lz])
746   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
747     AC_CHECK_HEADERS([unzip.h], [
748       have_minizip=yes
749       MINIZIP_LIBS="-lminizip -lz"
750     ], [
751       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
752       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/access/libunzip.la])
753       have_minizip=no
754     ])
755   ])
756   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
757   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
758 fi
759 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
760
761
762 dnl
763 dnl Domain name i18n support via GNU libidn
764 dnl
765 PKG_CHECK_MODULES([IDN], [libidn], [
766   have_libidn="yes"
767   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
768 ], [
769   have_libidn="no"
770 ])
771
772
773 dnl Check for dbus
774 AC_ARG_ENABLE(dbus,
775   [AS_HELP_STRING([--enable-dbus],
776     [compile D-Bus message bus support (default enabled)])])
777 have_dbus="no"
778 AS_IF([test "${enable_dbus}" != "no"], [
779   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0.0], [
780     have_dbus="yes"
781   ], [
782     AS_IF([test -n "${enable_dbus}"], [
783       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
784     ], [
785       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
786     ])
787   ])
788 ])
789 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
790
791 dnl Check for ntohl, etc.
792 VLC_SAVE_FLAGS
793 CFLAGS="${CFLAGS} -Wall -Werror"
794 AC_CACHE_CHECK([for ntohl in sys/param.h],
795     [ac_cv_c_ntohl_sys_param_h],
796     [     AC_TRY_COMPILE([#include <sys/param.h>],
797         [int meuh; ntohl(meuh);],
798         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
799 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
800     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
801 fi
802 VLC_RESTORE_FLAGS
803
804 EXTEND_HELP_STRING([Optimization options:])
805 dnl
806 dnl  Compiler warnings
807 dnl
808
809 RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
810 RDC_PROG_CC_FLAGS([-pipe])
811 AC_LANG_PUSH([C++])
812 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
813 AC_LANG_POP([C++])
814
815 dnl
816 dnl  Debugging mode
817 dnl
818 AC_ARG_ENABLE(debug,
819   [AS_HELP_STRING([--enable-debug],
820     [build with run-time assertions (default disabled)])],,
821   [enable_debug="no"])
822 AH_TEMPLATE(NDEBUG,
823             [Define to 1 if debug code should NOT be compiled])
824 AS_IF([test "${enable_debug}" != "no"], [
825   AC_CHECK_HEADERS([valgrind/valgrind.h])
826 ], [
827   AC_DEFINE(NDEBUG)
828 ])
829
830 dnl
831 dnl  Profiling
832 dnl
833 AC_ARG_ENABLE(gprof,
834   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
835   [enable_gprof="no"])
836 AS_IF([test "${enable_gprof}" != "no"], [
837   CFLAGS="${CFLAGS} -pg"
838   CXXFLAGS="${CXXFLAGS} -pg"
839   OBJCFLAGS="${OBJCFLAGS} -pg"
840   LDFLAGS="${LDFLAGS} -pg"
841 ])
842
843 AC_ARG_ENABLE(cprof,
844   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
845   [enable_cprof="no"])
846 AS_IF([test "${enable_gprof}" != "no"], [
847   CFLAGS="${CFLAGS} -finstrument-functions"
848   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
849   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
850   LDFLAGS="${LDFLAGS} -finstrument-functions"
851 ])
852
853 dnl
854 dnl  Test coverage
855 dnl
856 AC_ARG_ENABLE(coverage,
857   [AS_HELP_STRING([--enable-coverage],
858     [build for test coverage (default disabled)])],,
859   [enable_coverage="no"])
860 AS_IF([test "${enable_coverage}" != "no"], [
861   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
862   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
863   LDFLAGS="-lgcov ${LDFLAGS}"
864 ])
865
866 AS_IF([test "${SYS}" != "mingw32"], [
867   VLC_SAVE_FLAGS
868   CFLAGS="${CFLAGS} -fvisibility=hidden"
869   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
870   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
871   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
872                  [ac_cv_c_visibility_hidden], [
873     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
874       ac_cv_c_visibility_hidden=yes
875     ], [
876       ac_cv_c_visibility_hidden=no
877     ])
878   ])
879   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
880 ])
881
882
883 dnl
884 dnl  Enable/disable optimizations
885 dnl
886 AC_ARG_ENABLE(optimizations,
887   [AS_HELP_STRING([--disable-optimizations],
888     [disable compiler optimizations (default enabled)])],,
889   [enable_optimizations="yes"])
890
891 dnl Check for various optimization flags
892 AS_IF([test "${enable_optimizations}" != "no"], [
893
894   dnl -O4 and -O3 only in production builds
895   AS_IF([test "{enable_debug}" = "no"], [
896     VLC_SAVE_FLAGS
897     CFLAGS="${CFLAGS} -O4"
898     CXXFLAGS="${CXXFLAGS} -O4"
899     OBJCFLAGS="${OBJCFLAGS} -O4"
900     AC_CACHE_CHECK([if $CC accepts -O4], [ac_cv_c_o4], [
901       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
902         ac_cv_c_o4=yes
903       ], [
904         ac_cv_c_o4=no
905       ])
906     ])
907     AS_IF([test "${ac_cv_c_o4}" = "no"], [
908       VLC_RESTORE_FLAGS
909       CFLAGS="${CFLAGS} -O3"
910       CXXFLAGS="${CXXFLAGS} -O3"
911       OBJCFLAGS="${OBJCFLAGS} -O3"
912       AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
913         AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
914           ac_cv_c_o3=yes
915         ], [
916           ac_cv_c_o3=no
917         ])
918       ])
919       AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
920     ])
921   ])
922
923   dnl Check for -ffast-math
924   VLC_SAVE_FLAGS
925   CFLAGS="${CFLAGS} -ffast-math"
926   CXXFLAGS="${CXXFLAGS} -ffast-math"
927   OBJCFLAGS="${OBJCFLAGS} -ffast-math"
928   AC_CACHE_CHECK([if $CC accepts -ffast-math], [ac_cv_c_fast_math], [
929     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
930       ac_cv_c_fast_math=yes
931     ], [
932       ac_cv_c_fast_math=no
933     ])
934   ])
935   AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
936   AH_BOTTOM([
937 #ifndef __FAST_MATH__
938 # pragma STDC FENV_ACCESS OFF
939 # pragma STDC FP_CONTRACT ON
940 #endif
941 ])
942
943   dnl Check for -funroll-loops
944   VLC_SAVE_FLAGS
945   CFLAGS="${CFLAGS} -funroll-loops"
946   CXXFLAGS="${CXXFLAGS} -funroll-loops"
947   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
948   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
949     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
950       ac_cv_c_unroll_loops=yes
951     ], [
952       ac_cv_c_unroll_loops=no
953     ])
954   ])
955   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
956
957   AS_IF([test "$enable_debug" = "no"], [
958     dnl Check for -fomit-frame-pointer
959     VLC_SAVE_FLAGS
960     CFLAGS="${CFLAGS} -fomit-frame-pointer"
961     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
962     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
963     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
964       [ac_cv_c_omit_frame_pointer], [
965       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
966         ac_cv_c_omit_frame_pointer=yes
967       ], [
968         ac_cv_c_omit_frame_pointer=no
969       ])
970     ])
971     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
972   ])
973 ])
974
975 dnl Check for Darwin plugin linking flags
976 AS_IF([test "${SYS}" = "darwin"], [
977   VLC_SAVE_FLAGS
978   CFLAGS="${CFLAGS} -bundle -undefined error"
979   AC_CACHE_CHECK([if $CC accepts -bundle -undefined error],
980     [ac_cv_ld_darwin], [
981     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
982       ac_cv_ld_darwin=yes
983     ], [
984       ac_cv_ld_darwin=no
985     ])
986   ])
987   AS_IF([test "${ac_cv_ld_darwin}" != "no"], [
988     VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
989   ])
990   VLC_RESTORE_FLAGS
991 ])
992
993 dnl Checks for __attribute__(aligned()) directive
994 VLC_SAVE_FLAGS
995 CFLAGS="${CFLAGS} -Werror"
996 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
997     [ac_cv_c_attribute_aligned],
998     [ac_cv_c_attribute_aligned=0
999     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1000         AC_TRY_COMPILE([],
1001         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1002         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1003     done])
1004 VLC_RESTORE_FLAGS
1005 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1006     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1007         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1008 fi
1009
1010 dnl Check for __attribute__((packed))
1011 AC_CACHE_CHECK([for __attribute__((packed))],
1012   [ac_cv_c_attribute_packed],
1013   [ac_cv_c_attribute_packed=no
1014    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1015                     [ac_cv_c_attribute_packed=yes])])
1016 if test "${ac_cv_c_attribute_packed}" != "no"; then
1017   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1018 fi
1019
1020 dnl
1021 dnl  Check the CPU
1022 dnl
1023 case "${host_cpu}" in
1024   "")
1025     ARCH=unknown
1026     ;;
1027   *)
1028     ARCH="${host_cpu}"
1029     ;;
1030 esac
1031
1032 dnl Check for backtrace() support
1033 AC_CHECK_HEADERS(execinfo.h)
1034 AC_CHECK_FUNCS(backtrace)
1035
1036 dnl
1037 dnl  default modules
1038 dnl
1039 ALIASES="${ALIASES} cvlc rvlc"
1040
1041 dnl
1042 dnl  Accelerated modules
1043 dnl
1044
1045 dnl  Check for fully working MMX intrinsics
1046 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1047 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1048 AC_ARG_ENABLE(mmx,
1049   [AS_HELP_STRING([--disable-mmx],
1050     [disable MMX optimizations (default auto)])],,[
1051   case "${host_cpu}" in
1052     i?86|x86_64)
1053       enable_mmx="yes"
1054       ;;
1055     *)
1056       enable_mmx="no"
1057       ;;
1058   esac
1059 ])
1060 have_mmx="no"
1061 have_mmxext="no"
1062 AS_IF([test "${enable_mmx}" != "no"], [
1063   ARCH="${ARCH} mmx"
1064   VLC_SAVE_FLAGS
1065   CFLAGS="${CFLAGS} -mmmx"
1066   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1067     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1068 [#include <mmintrin.h>
1069 #include <stdint.h>
1070 uint64_t frobzor;]], [
1071 [__m64 a, b, c;
1072 a = b = c = (__m64)frobzor;
1073 a = _mm_slli_pi16(a, 3);
1074 a = _mm_adds_pi16(a, b);
1075 c = _mm_srli_pi16(c, 8);
1076 c = _mm_slli_pi16(c, 3);
1077 b = _mm_adds_pi16(b, c);
1078 a = _mm_unpacklo_pi8(a, b);
1079 frobzor = (uint64_t)a;]])], [
1080       ac_cv_c_mmx_intrinsics=yes
1081     ], [
1082       ac_cv_c_mmx_intrinsics=no
1083     ])
1084   ])
1085   VLC_RESTORE_FLAGS
1086   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1087     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1088   ])
1089
1090   VLC_SAVE_FLAGS
1091   CFLAGS="${CFLAGS} -mmmx"
1092   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1093     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1094 void *p;
1095 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1096 ]])
1097     ], [
1098       ac_cv_mmx_inline=yes
1099     ], [
1100       ac_cv_mmx_inline=no
1101     ])
1102   ])
1103   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1104     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1105     have_mmx="yes"
1106   ])
1107
1108   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1109                  [ac_cv_mmxext_inline], [
1110     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1111 void *p;
1112 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1113 ]])
1114     ], [
1115       ac_cv_mmxext_inline=yes
1116     ], [
1117       ac_cv_mmxext_inline=no
1118     ])
1119   ])
1120   VLC_RESTORE_FLAGS
1121   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1122     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1123     have_mmxext="yes"
1124   ])
1125 ])
1126 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1127 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1128
1129 dnl  Check for fully workin SSE2 intrinsics
1130 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1131 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1132 AC_ARG_ENABLE(sse,
1133   [AS_HELP_STRING([--disable-sse],
1134     [disable SSE (1-4) optimizations (default auto)])],, [
1135   case "${host_cpu}" in
1136     i?86|x86_64)
1137       enable_sse=yes
1138       ;;
1139     *)
1140       enable_sse=no
1141       ;;
1142   esac
1143 ])
1144 have_sse2="no"
1145 AS_IF([test "${enable_sse}" != "no"], [
1146   ARCH="${ARCH} sse sse2"
1147
1148   VLC_SAVE_FLAGS
1149   CFLAGS="${CFLAGS} -msse2"
1150   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1151     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1152 [#include <emmintrin.h>
1153 #include <stdint.h>
1154 uint64_t frobzor;]], [
1155 [__m128i a, b, c;
1156 a = b = c = _mm_set1_epi64((__m64)frobzor);
1157 a = _mm_slli_epi16(a, 3);
1158 a = _mm_adds_epi16(a, b);
1159 c = _mm_srli_epi16(c, 8);
1160 c = _mm_slli_epi16(c, 3);
1161 b = _mm_adds_epi16(b, c);
1162 a = _mm_unpacklo_epi8(a, b);
1163 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1164       ac_cv_c_sse2_intrinsics=yes
1165     ], [
1166       ac_cv_c_sse2_intrinsics=no
1167     ])
1168   ])
1169   VLC_RESTORE_FLAGS
1170   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1171     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1172   ])
1173
1174   VLC_SAVE_FLAGS
1175   CFLAGS="${CFLAGS} -msse"
1176   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1177     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1178 void *p;
1179 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1180 ]])
1181     ], [
1182       ac_cv_sse_inline=yes
1183     ], [
1184       ac_cv_sse_inline=no
1185     ])
1186   ])
1187
1188   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1189     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1190   ])
1191
1192   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1193     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1194 void *p;
1195 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1196 ]])
1197     ], [
1198       ac_cv_sse2_inline=yes
1199     ], [
1200       ac_cv_sse2_inline=no
1201     ])
1202   ])
1203   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1204     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1205     have_sse2="yes"
1206   ])
1207
1208   # SSE3
1209   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1210     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1211 void *p;
1212 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1213 ]])
1214     ], [
1215       ac_cv_sse3_inline=yes
1216     ], [
1217       ac_cv_sse3_inline=no
1218     ])
1219   ])
1220
1221   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1222     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1223   # SSSE3
1224   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1225     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1226 void *p;
1227 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1228 ]])
1229     ], [
1230       ac_cv_ssse3_inline=yes
1231     ], [
1232       ac_cv_ssse3_inline=no
1233     ])
1234   ])
1235
1236   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1237     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1238
1239   # SSE4.1
1240   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1241                  [ac_cv_sse4_1_inline], [
1242     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1243 void *p;
1244 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1245 ]])
1246     ], [
1247       ac_cv_sse4_1_inline=yes
1248     ], [
1249       ac_cv_sse4_1_inline=no
1250     ])
1251   ])
1252
1253   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1254     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1255
1256   # SSE4.2
1257   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1258                  [ac_cv_sse4_2_inline], [
1259     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1260 void *p;
1261 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1262 ]])
1263     ], [
1264       ac_cv_sse4_2_inline=yes
1265     ], [
1266       ac_cv_sse4_2_inline=no
1267     ])
1268   ])
1269
1270   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1271     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1272
1273   # SSE4A
1274   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1275     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1276 void *p;
1277 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1278 ]])
1279     ], [
1280       ac_cv_sse4a_inline=yes
1281     ], [
1282       ac_cv_sse4a_inline=no
1283     ])
1284   ])
1285   VLC_RESTORE_FLAGS
1286   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1287     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1288 ])
1289 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1290
1291 VLC_SAVE_FLAGS
1292 CFLAGS="${CFLAGS} -mmmx"
1293 have_3dnow="no"
1294 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1295   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1296 void *p;
1297 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1298 ]])
1299   ], [
1300     ac_cv_3dnow_inline=yes
1301   ], [
1302     ac_cv_3dnow_inline=no
1303   ])
1304 ])
1305 VLC_RESTORE_FLAGS
1306 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1307   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1308             [Define to 1 if 3D Now! inline assembly is available.])
1309   have_3dnow="yes"
1310 ])
1311 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1312
1313
1314 AC_ARG_ENABLE(neon,
1315   [AS_HELP_STRING([--disable-neon],
1316     [disable NEON optimizations (default auto)])],, [
1317   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1318 ])
1319 AS_IF([test "${enable_neon}" != "no"], [
1320   VLC_SAVE_FLAGS
1321   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1322   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1323     AC_COMPILE_IFELSE([
1324       AC_LANG_PROGRAM(,[[
1325 asm volatile("vqmovun.s64 d0, q1":::"d0");
1326 ]])
1327     ], [
1328       ac_cv_arm_neon="yes"
1329     ], [
1330       ac_cv_arm_neon="no"
1331     ])
1332   ])
1333   VLC_RESTORE_FLAGS
1334 ])
1335 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1336
1337
1338 AC_ARG_ENABLE(altivec,
1339   [AS_HELP_STRING([--disable-altivec],
1340     [disable AltiVec optimizations (default auto)])],, [
1341   AS_IF([test "${host_cpu}" = "powerpc"],
1342         [enable_altivec=yes], [enable_altivec=no])
1343 ])
1344 have_altivec="no"
1345 AS_IF([test "${enable_altivec}" = "yes"], [
1346   ARCH="${ARCH} altivec";
1347   VLC_SAVE_FLAGS
1348   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1349     [ac_cv_altivec_inline],
1350     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1351          ac_cv_altivec_inline="yes",
1352          [CFLAGS="${CFLAGS} -Wa,-m7400"
1353           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1354             [ac_cv_altivec_inline="-Wa,-m7400"],
1355             ac_cv_altivec_inline=no)
1356          ])])
1357   VLC_RESTORE_FLAGS
1358   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1359     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1360               [Define to 1 if AltiVec inline assembly is available.])
1361     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1362       VLC_ADD_CFLAGS([memcpyaltivec],[${ac_cv_altivec_inline}])
1363       VLC_ADD_CFLAGS([i420_yuy2_altivec],[${ac_cv_altivec_inline}])
1364       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1365     ])
1366     have_altivec="yes"
1367   ])
1368
1369 dnl The AltiVec C extensions
1370 dnl
1371 dnl There are several possible cases:
1372 dnl - OS X PPC, gcc 4.x: use -mpim-altivec -force_cpusubtype_ALL, don't
1373 dnl                      need <altivec.h>
1374 dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
1375 dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
1376 dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
1377 dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
1378 dnl - Others: test should fail
1379   VLC_SAVE_FLAGS
1380   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1381   [ac_cv_c_altivec],
1382   [# OS X/PPC test (gcc 4.x)
1383    CFLAGS="${CFLAGS} -mpim-altivec -force_cpusubtype_ALL"
1384    AC_TRY_COMPILE([vector unsigned char foo;],
1385      [vec_ld(0, (unsigned char *)0);],
1386      [ac_cv_c_altivec="-mpim-altivec -force_cpusubtype_ALL"],
1387      [# OS X/PPC test (gcc 3.x)
1388       CFLAGS="${CFLAGS} -faltivec"
1389       AC_TRY_COMPILE([vector unsigned char foo;],
1390         [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
1391         [ac_cv_c_altivec="-faltivec"],
1392         dnl Below this are the Linux tests
1393         [# Linux/PPC test (gcc 4.x)
1394          CFLAGS="${CFLAGS} -maltivec"
1395          AC_TRY_COMPILE([#include <altivec.h>],
1396            [vec_ld(0, (unsigned char *)0);],
1397            [ac_cv_c_altivec="-maltivec"],
1398            [# Linux/PPC test (gcc 3.3)
1399             CFLAGS="${CFLAGS} -maltivec -mabi=altivec"
1400             AC_TRY_COMPILE([#include <altivec.h>],
1401               [vec_ld(0, (unsigned char *)0);],
1402               [ac_cv_c_altivec=""
1403                ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
1404               [# Linux/PPC test (gcc 3.3)
1405                CFLAGS="${CFLAGS} -fvec"
1406                AC_TRY_COMPILE([#include <altivec.h>],
1407                  [vec_ld(0, (unsigned char *)0);],
1408                  [ac_cv_c_altivec="-fvec"],
1409                  [ac_cv_c_altivec=no])
1410               ])
1411            ])
1412         ])
1413      ])
1414   ])
1415
1416   VLC_RESTORE_FLAGS
1417   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1418     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1419     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1420     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1421     VLC_ADD_CFLAGS([i420_yuy2_altivec memcpyaltivec deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1422     have_altivec="yes"
1423   ])
1424   AC_CHECK_HEADERS(altivec.h)
1425
1426   VLC_SAVE_FLAGS
1427   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1428   AC_CACHE_CHECK([if linker needs -framework vecLib],
1429     [ac_cv_ld_altivec],
1430     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1431   VLC_RESTORE_FLAGS
1432   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1433     VLC_ADD_LIBS([libvlccore memcpyaltivec],[-Wl,-framework,vecLib])
1434   ])
1435 ])
1436 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1437
1438 dnl
1439 dnl  Memory usage
1440 dnl
1441 AC_ARG_ENABLE(optimize-memory,
1442   [AS_HELP_STRING([--enable-optimize-memory],
1443     [optimize memory usage over performance])])
1444 if test "${enable_optimize_memory}" = "yes"; then
1445   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1446 fi
1447
1448 dnl
1449 dnl Allow running as root (useful for people running on embedded platforms)
1450 dnl
1451 AC_ARG_ENABLE(run-as-root,
1452   [AS_HELP_STRING([--enable-run-as-root],
1453     [allow running VLC as root (default disabled)])])
1454 AS_IF([test "${enable_run_as_root}" = "yes"],[
1455     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1456               [Define to 1 to allow running VLC as root (uid 0).])
1457 ])
1458
1459 dnl
1460 dnl Stream output
1461 dnl
1462 AC_ARG_ENABLE(sout,
1463   [AS_HELP_STRING([--disable-sout],
1464     [disable streaming output (default enabled)])])
1465 AS_IF([test "${enable_sout}" != "no"], [
1466   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1467 ])
1468 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1469
1470 dnl Lua modules
1471 AC_ARG_ENABLE(lua,
1472   [AS_HELP_STRING([--disable-lua],
1473     [disable LUA scripting support (default enabled)])])
1474 if test "${enable_lua}" != "no"
1475 then
1476   PKG_CHECK_MODULES(LUA, lua5.1,
1477     [ have_lua=yes ],
1478     [
1479     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1480     PKG_CHECK_MODULES(LUA, lua >= 5.1,
1481       [ have_lua=yes ],
1482       [
1483         AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1484         have_lua=yes
1485         AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1486           [],
1487           [ have_lua=no ] )
1488         AC_CHECK_LIB(  lua5.1 , luaL_newstate,
1489           [LUA_LIBS="-llua5.1"],
1490           AC_CHECK_LIB( lua51 , luaL_newstate,
1491             [LUA_LIBS="-llua51"],
1492             AC_CHECK_LIB( lua , luaL_newstate,
1493               [LUA_LIBS="-llua"],
1494               [ have_lua=no
1495               ], [-lm])
1496           )
1497         )
1498       ])
1499     ])
1500   if test "x${have_lua}" = "xyes" ;  then
1501      VLC_ADD_LIBS([lua],[$LUA_LIBS])
1502      VLC_ADD_CFLAGS([lua],[$LUA_CFLAGS])
1503   else
1504       AC_MSG_ERROR([Could not find lua. Lua is needed for some interfaces (rc, telnet, http) as well as many other custom scripts. Use --disable-lua to ignore this error.])
1505   fi
1506   AC_ARG_VAR([LUAC], [LUA byte compiler])
1507   AC_PATH_PROGS(LUAC,[${LUAC} luac], [false])
1508   AS_IF([test "${LUAC}" = "false"], [
1509     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1510   ])
1511 fi
1512 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1513
1514
1515 dnl
1516 dnl HTTP daemon
1517 dnl
1518 AC_ARG_ENABLE(httpd,
1519   [AS_HELP_STRING([--disable-httpd],
1520     [disable the built-in HTTP server (default enabled)])])
1521 if test "${enable_httpd}" != "no"
1522 then
1523   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1524 fi
1525 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1526
1527
1528 dnl
1529 dnl VideoLAN manager
1530 dnl
1531 AC_ARG_ENABLE(vlm,
1532   [AS_HELP_STRING([--disable-vlm],
1533     [disable the stream manager (default enabled)])],,
1534   [enable_vlm="${enable_sout}"])
1535 AS_IF([test "${enable_vlm}" != "no"], [
1536   AS_IF([test "${enable_sout}" = "no"], [
1537     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1538   ])
1539   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1540 ])
1541 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1542
1543
1544 dnl
1545 dnl  Input plugins
1546 dnl
1547
1548 EXTEND_HELP_STRING([Input plugins:])
1549
1550 dnl
1551 dnl libproxy support
1552 dnl
1553 AC_ARG_ENABLE(libproxy,
1554   [AS_HELP_STRING([--enable-libproxy],[support libproxy (default auto)])])
1555 AS_IF([test "${enable_libproxy}" != "no"], [
1556   PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, [
1557     AC_DEFINE(HAVE_LIBPROXY, 1, [Define if libproxy is available])
1558     VLC_ADD_CFLAGS([access_http],[$LIBPROXY_CFLAGS])
1559     VLC_ADD_LIBS([access_http],[$LIBPROXY_LIBS])
1560   ], [
1561     AS_IF([test -n "${enable_libproxy}"], [
1562       AC_MSG_ERROR([${LIBPROXY_PKG_ERRORS}.])
1563     ])
1564   ])
1565 ])
1566
1567 dnl
1568 dnl  live555 input
1569 dnl
1570 AC_ARG_ENABLE(live555,
1571   [AS_HELP_STRING([--enable-live555],
1572     [enable RTSP input through live555 (default enabled)])])
1573 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1574   AC_LANG_PUSH(C++)
1575   VLC_SAVE_FLAGS
1576   AS_IF([test -z "${CONTRIB_DIR}"], [
1577     AS_IF([test ${SYS} != "os2"], [
1578       LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1579       CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1580     ], [
1581       LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1582       CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1583       LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1584     ])
1585   ], [
1586     CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1587   ])
1588   AS_IF([test "${SYS}" = "solaris"], [
1589     CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1590   ])
1591   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1592   LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1593
1594   AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1595     AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1596 [#include <liveMedia_version.hh>
1597 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1598 # error BOOM
1599 #endif]])
1600     ], [
1601       ac_cv_live555="yes"
1602     ], [
1603       ac_cv_live555="no"
1604     ])
1605   ])
1606   AS_IF([test "$ac_cv_live555" = "no"], [
1607     AC_MSG_WARN([liveMedia is missing or its installed version is too old:
1608 Version 2011.12.23 or later is required to proceed.
1609 You can get an updated one from http://www.live555.com/liveMedia .])
1610     AS_IF([test -n "${enable_live555}"], [
1611       AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1612     ])
1613   ], [
1614     other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1615     other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1616     AS_IF([test "${SYS}" = "mingw32"], [
1617       # add ws2_32 for closesocket, select, recv
1618       other_libs="$other_libs -lws2_32"
1619     ])
1620
1621     dnl We need to check for pic because live555 don't provide shared libs
1622     dnl and we want to build a plugins so we need -fPIC on some arch.
1623     VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1624     VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1625     AC_CHECK_LIB(liveMedia_pic, main, [
1626       VLC_ADD_PLUGIN([live555])
1627       VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1628     ],[
1629       AC_CHECK_LIB(liveMedia, main, [
1630         VLC_ADD_PLUGIN([live555])
1631         VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1632       ],[],[${other_libs}])],[${other_libs_pic}])
1633   ])
1634   VLC_RESTORE_FLAGS
1635   AC_LANG_POP(C++)
1636 ])
1637
1638 dnl
1639 dnl - special access module for dc1394 input
1640 dnl - dv module: digital video module check for libraw1394
1641 dnl - linsys modules: access module check for libzvbi
1642 dnl
1643 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1644 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1645
1646 AC_ARG_ENABLE(linsys,
1647   [AS_HELP_STRING([--enable-linsys],
1648     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1649 if test "$SYS" = "linux" -a "${enable_linsys}" != "no"; then
1650   VLC_ADD_PLUGIN([linsys_hdsdi])
1651   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28],
1652     [ VLC_ADD_LIBS([linsys_sdi],[$LINSYS_SDI_LIBS])
1653       VLC_ADD_CFLAGS([linsys_sdi],[$LINSYS_SDI_CFLAGS])
1654       VLC_ADD_PLUGIN([linsys_sdi]) ],
1655     [AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])]
1656   )
1657 fi
1658
1659 dnl
1660 dnl dvdread module: check for libdvdread
1661 dnl
1662 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread], [dvdread input module], [auto])
1663
1664 dnl
1665 dnl libdvdnav plugin
1666 dnl
1667 AC_ARG_ENABLE(dvdnav,
1668   [AS_HELP_STRING([--disable-dvdnav],
1669     [disable DVD navigation with libdvdnav (default auto)])])
1670 if test "${enable_dvdnav}" != "no"
1671 then
1672   PKG_CHECK_MODULES(DVDNAV, dvdnav, [
1673     VLC_ADD_PLUGIN([dvdnav])
1674     VLC_ADD_CFLAGS([dvdnav],[${DVDNAV_CFLAGS}])
1675     VLC_ADD_LIBS([dvdnav],[${DVDNAV_LIBS}])
1676     AC_CHECK_LIB(dvdnav, dvdnav_get_video_resolution,
1677       AC_DEFINE(HAVE_DVDNAV_GET_VIDEO_RESOLUTION, 1, [Define if you have dvdnav_get_video_resolution.]),
1678         [], [${LIBS_dvdnav}])
1679     AC_CHECK_LIB(dvdnav, dvdnav_describe_title_chapters,
1680       AC_DEFINE(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS, 1, [Define if you have dvdnav_describe_title_chapters.]),
1681         [], [${LIBS_dvdnav}])],
1682       [AC_MSG_WARN([${DVDNAV_PKG_ERRORS}.])])
1683 fi
1684
1685 dnl
1686 dnl  Blu-ray Disc Support with libbluray
1687 dnl
1688 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2.1], (libbluray for Blu-ray disc support ) )
1689
1690 dnl
1691 dnl  OpenCV wrapper and example filters
1692 dnl
1693 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1694
1695
1696 dnl
1697 dnl  libsmbclient plugin
1698 dnl
1699 AC_ARG_ENABLE(smb,
1700   [AS_HELP_STRING([--disable-smb], [disable SMB/CIFS support (default auto)])])
1701 if test "${enable_smb}" != "no"; then
1702   AC_CHECK_HEADERS(libsmbclient.h,
1703     [ VLC_ADD_PLUGIN([access_smb])
1704       VLC_ADD_LIBS([access_smb],[-lsmbclient]) ],
1705     [ if test -n "${enable_smb}"; then
1706         AC_MSG_ERROR([cannot find libsmbclient headers])
1707      fi ])
1708 fi
1709
1710
1711 dnl
1712 dnl sftp access support
1713 dnl
1714 AC_ARG_ENABLE(sftp,
1715   [AS_HELP_STRING([--enable-sftp],
1716     [support SFTP file transfer via libssh2 (default disabled)])])
1717 if test "${enable_sftp}" = "yes"; then
1718   AC_CHECK_HEADERS(libssh2.h, [
1719     VLC_ADD_PLUGIN([access_sftp])
1720     VLC_ADD_LIBS([access_sftp], [-lssh2])
1721   ])
1722 fi
1723
1724 dnl
1725 dnl  Video4Linux 2
1726 dnl
1727 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1728   [disable Video4Linux version 2 (default auto)])])
1729 have_v4l2="no"
1730 AS_IF([test "$enable_v4l2" != "no"], [
1731   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1732     have_v4l2="yes"
1733   ])
1734 ])
1735 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1736
1737 dnl
1738 dnl special access module for Blackmagic SDI cards
1739 dnl
1740 AC_ARG_ENABLE(decklink,
1741   [AS_HELP_STRING([--disable-decklink],
1742     [disable Blackmagic DeckLink SDI input (default auto)])])
1743 AC_ARG_WITH(decklink_sdk,
1744   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1745     [                        location of Blackmagic DeckLink SDI SDK])])
1746 if test "${enable_decklink}" != "no"
1747 then
1748   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1749   then
1750     VLC_ADD_CPPFLAGS([decklink],[-I${with_decklink_sdk}/include])
1751   fi
1752   VLC_SAVE_FLAGS
1753   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1754   AC_LANG_PUSH(C++)
1755   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1756     VLC_ADD_PLUGIN([decklink])
1757   ],[AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)])
1758   AC_LANG_POP(C++)
1759   VLC_RESTORE_FLAGS
1760 fi
1761
1762
1763 dnl
1764 dnl  gnomeVFS access module
1765 dnl
1766 PKG_ENABLE_MODULES_VLC([GNOMEVFS], [access_gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
1767
1768 dnl
1769 dnl  VCDX modules
1770 dnl
1771 AC_ARG_ENABLE(vcdx,
1772   [AS_HELP_STRING([--enable-vcdx],
1773     [navigate VCD with libvcdinfo (default disabled)])])
1774 if test "${enable_vcdx}" = "yes"
1775 then
1776     PKG_CHECK_MODULES(LIBCDIO, [libcdio >= 0.78.2 libiso9660 >= 0.72],
1777       [VLC_ADD_LIBS([vcdx],[$LIBCDIO_LIBS])
1778          VLC_ADD_CFLAGS([vcdx],[$LIBCDIO_CFLAGS])],
1779         [AC_MSG_ERROR([${LIBCDIO_PKG_ERRORS} (required for vcdx plugin).])])
1780     PKG_CHECK_MODULES(LIBVCDINFO, libvcdinfo >= 0.7.22,
1781         [VLC_ADD_LIBS([vcdx],[$LIBVCDINFO_LIBS])
1782          VLC_ADD_CFLAGS([vcdx],[$LIBVCDINFO_CFLAGS])],
1783       [AC_MSG_ERROR([${LIBVCDINFO_PKG_ERRORS} (required for vcdx plugin).])])
1784     VLC_ADD_PLUGIN([vcdx])
1785 fi
1786
1787 dnl
1788 dnl  Built-in CD-DA and VCD module
1789 dnl
1790 AC_ARG_ENABLE(vcd,
1791   [AS_HELP_STRING([--disable-vcd],
1792     [disable built-in VCD and CD-DA support (default enabled)])])
1793
1794 AC_ARG_ENABLE(libcddb,
1795   [AS_HELP_STRING([--disable-libcddb],
1796     [disable CDDB for Audio CD (default enabled)])])
1797
1798 if test "${enable_vcd}" != "no"
1799 then
1800   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1801   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1802     AC_MSG_RESULT(yes)
1803     VLC_ADD_PLUGIN([vcd cdda])
1804   ],[
1805     AC_MSG_RESULT(no)
1806   ])
1807
1808   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1809   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1810     AC_MSG_RESULT(yes)
1811     VLC_ADD_PLUGIN([vcd cdda])
1812     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1813   ],[
1814     AC_MSG_RESULT(no)
1815   ])
1816
1817   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1818   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1819     AC_MSG_RESULT(yes)
1820     VLC_ADD_PLUGIN([vcd cdda])
1821     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1822   ],[
1823     AC_MSG_RESULT(no)
1824   ])
1825
1826   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2"
1827   then
1828     VLC_ADD_PLUGIN([vcd cdda])
1829   fi
1830
1831   if test "${SYS}" = "darwin"
1832   then
1833     VLC_ADD_PLUGIN([vcd cdda])
1834     VLC_ADD_LIBS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
1835     VLC_ADD_LIBS([vcdx cdda],[-liconv])
1836   fi
1837
1838   if test "$enable_libcddb" != "no"; then
1839     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1840       HAVE_LIBCDDB=yes
1841       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1842       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1843       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1844       ],:
1845       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1846       HAVE_LIBCDDB=no])
1847   fi
1848 fi
1849
1850 dnl
1851 dnl Linux DVB
1852 dnl
1853 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1854   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1855 [#include <linux/dvb/version.h>
1856 #if (DVB_API_VERSION < 5)
1857 # error Linux DVB API v3.2 and older are not supported.
1858 #endif
1859 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1860 # error Linux DVB API v5.0 is unsupported. Please update.
1861 #endif
1862 ]])], [
1863   ac_cv_linux_dvb_5_1=yes
1864 ], [
1865   ac_cv_linux_dvb_5_1=no
1866 ])])
1867 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1868
1869 dnl
1870 dnl  Screen capture module
1871 dnl
1872 AC_ARG_ENABLE(screen,
1873   [AS_HELP_STRING([--enable-screen],
1874     [disable screen capture (default enabled)])])
1875 if test "${enable_screen}" != "no"; then
1876   if test "${SYS}" = "darwin"; then
1877     AC_CHECK_HEADERS(OpenGL/gl.h, [
1878       AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1879         VLC_ADD_PLUGIN([screen])
1880         VLC_ADD_LIBS([screen],[-Wl,-framework,OpenGL,-framework,ApplicationServices])
1881       ])
1882     ])
1883   fi
1884 fi
1885
1886 dnl
1887 dnl  Real RTSP plugin
1888 dnl
1889 AC_ARG_ENABLE(realrtsp,
1890   [  --enable-realrtsp       Real RTSP module (default disabled)])
1891 if test "${enable_realrtsp}" = "yes"; then
1892   VLC_ADD_PLUGIN([realrtsp])
1893 fi
1894
1895 dnl
1896 dnl MacOS eyeTV
1897 AC_ARG_ENABLE(macosx-eyetv,
1898   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1899 if test "x${enable_macosx_eyetv}" != "xno" &&
1900   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1901 then
1902   VLC_ADD_LIBS([access_eyetv], [-Wl,-framework,Foundation])
1903   VLC_ADD_PLUGIN([access_eyetv])
1904 fi
1905
1906 dnl
1907 dnl QTKit
1908 AC_ARG_ENABLE(macosx-qtkit,
1909   [  --enable-macosx-qtkit Mac OS X qtcapture (video) and qtsound (audio) module (default enabled on Mac OS X)])
1910 if test "x${enable_macosx_qtkit}" != "xno" &&
1911   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1912 then
1913   VLC_ADD_PLUGIN([qtcapture])
1914   VLC_ADD_PLUGIN([qtsound])
1915 fi
1916 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1917
1918
1919 dnl
1920 dnl  Demux plugins
1921 dnl
1922
1923 EXTEND_HELP_STRING([Mux/Demux plugins:])
1924
1925 dnl
1926 dnl  libdvbpsi check for ts mux/demux
1927 dnl
1928 have_dvbpsi="no"
1929 PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
1930 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1931
1932
1933 dnl
1934 dnl  GME demux plugin
1935 dnl
1936 AC_ARG_ENABLE(gme,
1937   [AS_HELP_STRING([--enable-gme],
1938     [use Game Music Emu (default auto)])])
1939 AS_IF([test "${enable_gme}" != "no"], [
1940   AC_CHECK_HEADER([gme/gme.h], [
1941     VLC_ADD_LIBS([gme], [-lgme])
1942     VLC_ADD_PLUGIN([gme])
1943   ], [
1944     AS_IF([test "x${enable_gme}" != "x"], [
1945       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
1946     ])
1947   ])
1948 ])
1949
1950
1951 dnl
1952 dnl  SIDPlay plugin
1953 dnl
1954 AC_ARG_ENABLE(sid,
1955     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
1956 AS_IF([test "${enable_sid}" != "no"], [
1957     PKG_CHECK_MODULES(SID, [libsidplay2], [
1958         AC_LANG_PUSH(C++)
1959         oldCPPFLAGS="$CPPFLAGS"
1960         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
1961         AC_CHECK_HEADER([sidplay/builders/resid.h], [
1962             VLC_ADD_PLUGIN([sid])
1963             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
1964             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
1965         ], [
1966             AS_IF([test -n "${enable_sid}"],
1967                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
1968                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
1969                 )
1970         ])
1971         CPPFLAGS="$oldCPPFLAGS"
1972         AC_LANG_POP(C++)
1973     ], [
1974         AS_IF([test "x${enable_sid}" = "xyes"],
1975             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
1976             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
1977             )
1978     ])
1979 ])
1980
1981
1982 dnl
1983 dnl  ogg demux plugin
1984 dnl
1985 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
1986 if test "${enable_sout}" != "no"; then
1987     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg mux support], [auto])
1988 dnl Check for libshout
1989     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
1990 fi
1991
1992 dnl
1993 dnl  matroska demux plugin
1994 dnl
1995 AC_ARG_ENABLE(mkv,
1996   [AS_HELP_STRING([--disable-mkv],
1997     [do not use libmatroska (default auto)])])
1998 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
1999   AC_LANG_PUSH(C++)
2000   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2001     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2002     AC_EGREP_CPP(yes,
2003       [#include <ebml/EbmlVersion.h>
2004        #ifdef LIBEBML_VERSION
2005        #if LIBEBML_VERSION >= 0x010000
2006        yes
2007        #endif
2008        #endif],
2009       [AC_MSG_RESULT([yes])
2010         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2011           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2012           AC_EGREP_CPP(yes,
2013             [#include <matroska/KaxVersion.h>
2014              #ifdef LIBMATROSKA_VERSION
2015              #if LIBMATROSKA_VERSION >= 0x010000
2016              yes
2017              #endif
2018              #endif],
2019             [AC_MSG_RESULT([yes])
2020               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2021               VLC_ADD_CXXFLAGS([mkv],[])
2022               AC_CHECK_LIB(ebml_pic, main, [
2023                 VLC_ADD_PLUGIN([mkv])
2024                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2025               ],[
2026                 AC_CHECK_LIB(ebml, main, [
2027                   VLC_ADD_PLUGIN([mkv])
2028                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2029                 ])
2030               ])
2031             ], [
2032               AC_MSG_RESULT([no])
2033               AC_MSG_ERROR([Your libmatroska is too old: you may get a more recent one from http://dl.matroska.org/downloads/libmatroska/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2034           ])
2035         ])
2036       ],
2037       [AC_MSG_RESULT([no])
2038         AC_MSG_ERROR([Your libebml is too old: you may get a more recent one from http://dl.matroska.org/downloads/libebml/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2039     ])
2040   ])
2041   AC_LANG_POP(C++)
2042 fi
2043
2044 dnl
2045 dnl  modplug demux plugin
2046 dnl
2047 AC_ARG_ENABLE(mod,
2048   [AS_HELP_STRING([--disable-mod],
2049     [do not use libmodplug (default auto)])])
2050 if test "${enable_mod}" != "no" ; then
2051     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2052           VLC_ADD_PLUGIN([mod])
2053           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2054           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2055     ],[
2056        AS_IF([test -n "${enable_mod}"],
2057          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2058          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2059     ])
2060 fi
2061
2062 dnl
2063 dnl  mpc demux plugin
2064 dnl
2065 AC_ARG_ENABLE(mpc,
2066   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2067 if test "${enable_mpc}" != "no"
2068 then
2069   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2070     VLC_ADD_PLUGIN([mpc])
2071     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2072     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2073     VLC_ADD_PLUGIN([mpc])
2074     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2075 fi
2076
2077 dnl
2078 dnl  Codec plugins
2079 dnl
2080
2081 EXTEND_HELP_STRING([Codec plugins:])
2082
2083 dnl
2084 dnl wmafixed plugin
2085 dnl
2086 AC_ARG_ENABLE(wma-fixed,
2087   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2088 if test "${enable_wma_fixed}" = "yes"
2089 then
2090   VLC_ADD_PLUGIN([wma_fixed])
2091 fi
2092
2093 dnl
2094 dnl shine fixed point mp3 encoder
2095 dnl
2096 AC_ARG_ENABLE(shine,
2097   [  --enable-shine          shine mp3 encoding module (default disabled)])
2098 if test "${enable_shine}" = "yes"
2099 then
2100   VLC_ADD_PLUGIN([shine])
2101 fi
2102
2103 dnl
2104 dnl openmax il codec plugin
2105 dnl
2106 AC_ARG_ENABLE(omxil,
2107   [  --enable-omxil          openmax il codec module (default disabled)])
2108 if test "${enable_omxil}" = "yes"
2109 then
2110   VLC_ADD_PLUGIN([omxil])
2111 fi
2112
2113 dnl
2114 dnl iomx codec plugin
2115 dnl
2116 AC_ARG_ENABLE(iomx,
2117   [  --enable-iomx           iomx codec module (default disabled)])
2118 if test "${enable_iomx}" = "yes"
2119 then
2120   VLC_ADD_PLUGIN([iomx])
2121 fi
2122
2123 dnl
2124 dnl CrystalHD codec plugin
2125 dnl
2126 AC_ARG_ENABLE(crystalhd,
2127   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2128 if test "${enable_crystalhd}" != "no"; then
2129     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2130       VLC_ADD_PLUGIN([crystalhd])
2131       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2132     ],[
2133       if test "${SYS}" = "mingw32" ; then
2134         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2135           VLC_ADD_PLUGIN([crystalhd])
2136           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2137             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2138             ])
2139         ],[
2140           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2141                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2142                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2143         ],[#define __LINUX_USER__
2144                #include <libcrystalhd/bc_dts_types.h>
2145         ])
2146       fi
2147     ],[
2148        #include <libcrystalhd/bc_dts_types.h>
2149       ])
2150 fi
2151
2152 dnl
2153 dnl  mad plugin
2154 dnl
2155 AC_ARG_ENABLE(mad,
2156   [  --enable-mad            libmad module (default enabled)])
2157 if test "${enable_mad}" != "no"
2158 then
2159   AC_ARG_WITH(mad,
2160     [  --with-mad=PATH         path to libmad],[],[])
2161   if test "${with_mad}" != "no" -a -n "${with_mad}"
2162   then
2163     VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
2164     VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib])
2165   fi
2166
2167   AC_ARG_WITH(mad-tree,
2168     [  --with-mad-tree=PATH    mad tree for static linking],[],[])
2169   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
2170   then
2171     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
2172     if test -z "${real_mad_tree}"
2173     then
2174       dnl  The given directory can't be found
2175       AC_MSG_RESULT(no)
2176       AC_MSG_ERROR([${with_mad_tree} directory does not exist])
2177     fi
2178     dnl  Use a custom libmad
2179     AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
2180     if test -f ${real_mad_tree}/mad.h
2181     then
2182       AC_MSG_RESULT(yes)
2183       VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
2184       VLC_ADD_LIBS([mpgatofixed32],[-L${real_mad_tree}/.libs])
2185       VLC_SAVE_FLAGS
2186       LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2187       AC_CHECK_LIB(mad, mad_bit_init, [
2188         VLC_ADD_PLUGIN([mpgatofixed32])
2189         VLC_ADD_LIBS([mpgatofixed32],[-lmad])
2190         ],[ AC_MSG_ERROR([the specified tree has not been compiled ])
2191       ],[])
2192       VLC_RESTORE_FLAGS
2193     else
2194       AC_MSG_RESULT(no)
2195       AC_MSG_ERROR([the specified tree does not have mad.h])
2196     fi
2197   else
2198     VLC_SAVE_FLAGS
2199     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_mpgatofixed32}"
2200     LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2201     AC_CHECK_HEADERS(mad.h, ,
2202       [ AC_MSG_ERROR([Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.]) ])
2203     AC_CHECK_LIB(mad, mad_bit_init, [
2204       VLC_ADD_PLUGIN([mpgatofixed32])
2205       VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
2206       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
2207     VLC_RESTORE_FLAGS
2208   fi
2209 fi
2210
2211
2212 AC_ARG_ENABLE(merge-ffmpeg,
2213 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2214   enable_merge_ffmpeg="no"
2215 ])
2216 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2217
2218 VLC_SAVE_FLAGS
2219 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
2220 AC_CACHE_CHECK([if linker supports -Bsymbolic],
2221   [ac_cv_ld_bsymbolic],
2222   [AC_TRY_LINK([],,ac_cv_ld_bsymbolic=yes,ac_cv_ld_bsymbolic=no)])
2223 VLC_RESTORE_FLAGS
2224
2225 dnl
2226 dnl  avcodec decoder/encoder plugin
2227 dnl
2228 AC_ARG_ENABLE(avcodec,
2229 [  --enable-avcodec        libavcodec codec (default enabled)])
2230 AS_IF([test "${enable_avcodec}" != "no"], [
2231   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 52.25.0 libavutil >= 49.5.0],
2232     [
2233       VLC_SAVE_FLAGS
2234       CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2235       CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2236       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2237       AC_CHECK_HEADERS(libavutil/avutil.h)
2238       VLC_ADD_PLUGIN([avcodec])
2239       VLC_ADD_LIBS([avcodec],[$AVCODEC_LIBS])
2240       AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2241         VLC_ADD_LIBS([avcodec],[-Wl,-Bsymbolic])
2242       ])
2243       VLC_ADD_CFLAGS([avcodec],[$AVCODEC_CFLAGS])
2244       VLC_RESTORE_FLAGS
2245       have_avcodec="yes"
2246     ],[
2247       AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2248   ])
2249 ], [
2250   have_avcodec="no"
2251 ])
2252
2253 dnl
2254 dnl libva needs avcodec
2255 dnl
2256 AC_ARG_ENABLE(libva,
2257   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2258
2259 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2260   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2261 ])
2262 AS_IF([test "${enable_libva}" != "no"], [
2263   PKG_CHECK_MODULES(LIBVA, [libva libva-x11], [
2264     VLC_SAVE_FLAGS
2265     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2266     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2267     AC_CHECK_HEADERS(libavcodec/vaapi.h, [
2268       VLC_ADD_LIBS([avcodec],[$LIBVA_LIBS ${X_LIBS} ${X_PRE_LIBS} -lX11])
2269       VLC_ADD_CFLAGS([avcodec],[$LIBVA_CFLAGS ${X_CFLAGS}])
2270       AC_DEFINE(HAVE_AVCODEC_VAAPI, 1, [Define if avcodec has to be built with VAAPI support.])
2271       AC_MSG_NOTICE([VAAPI acceleration activated])
2272     ],[
2273       AS_IF([test -n "${enable_libva}"], [
2274         AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2275       ], [
2276         AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2277       ])
2278     ])
2279     VLC_RESTORE_FLAGS
2280   ],[
2281     AS_IF([test -n "${enable_libva}"], [
2282       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2283     ], [
2284       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2285     ])
2286   ])
2287 ])
2288
2289 dnl
2290 dnl dxva2 needs avcodec
2291 dnl
2292 AC_ARG_ENABLE(dxva2,
2293   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2294
2295 AS_IF([test "${enable_dxva2}" != "no"], [
2296   if test "${SYS}" = "mingw32"; then
2297   AS_IF([test "x${have_avcodec}" = "xyes"], [
2298     AC_CHECK_HEADERS(dxva2api.h,
2299       [
2300         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2301            VLC_ADD_LIBS([avcodec],[-lole32 -lshlwapi -luuid])
2302            AC_DEFINE(HAVE_AVCODEC_DXVA2, 1, [Define if avcodec has to be built with DxVA2 support.])
2303            echo "DxVA2 acceleration activated"
2304         ],[
2305     AS_IF([test "${enable_dxva2}" = "yes"],
2306           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2307               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2308         ], [#undef _WIN32_WINNT
2309             /* DXVA2 is only available in Vista and above */
2310             #define _WIN32_WINNT 0x600])
2311       ],[
2312     AS_IF([test "${enable_dxva2}" = "yes"],
2313               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2314               [AC_MSG_WARN([dxva2api.h not found])])
2315       ])
2316   ],[
2317     AS_IF([test "x${enable_dxva2}" != "x"], [
2318       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2319     ])
2320   ])
2321   fi
2322 ])
2323
2324 dnl
2325 dnl vda needs avcodec
2326 dnl
2327 AC_ARG_ENABLE(vda,
2328   [  --enable-vda          VDA  support (default auto)])
2329
2330 AS_IF([test "${enable_vda}" != "no"], [
2331   if test "${SYS}" = "darwin"; then
2332   AS_IF([test "x${have_avcodec}" = "xyes"], [
2333     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2334       [
2335         AC_CHECK_HEADERS(libavcodec/vda.h, [
2336            VLC_ADD_LIBS([avcodec],[-Wl,-framework,CoreFoundation,-framework,VideoDecodeAcceleration,-framework,QuartzCore])
2337            VLC_ADD_LDFLAGS([vda],[-Wl,-framework,CoreFoundation,-framework,VideoDecodeAcceleration,-framework,QuartzCore])
2338            AC_DEFINE(HAVE_AVCODEC_VDA, 1, [Define if avcodec has to be built with VDA support.])
2339         ],[
2340         AS_IF([test "${enable_vda}" == "yes"],
2341               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2342               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2343         ])
2344   ],[
2345         AS_IF([test "${enable_vda}" == "yes"],
2346               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2347               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2348       ])
2349   ],[
2350     AS_IF([test "x${enable_vda}" != "x"], [
2351       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2352     ])
2353  ])
2354   fi
2355 ])
2356
2357 dnl
2358 dnl stream_out switcher needs libavcodec
2359 dnl
2360 AC_ARG_ENABLE(switcher,
2361   [  --enable-switcher       Stream-out switcher plugin (default disabled)])
2362 AS_IF([test "${enable_switcher}" = "yes"], [
2363   AS_IF([test "x${have_avcodec}" = "xyes"], [
2364     VLC_ADD_PLUGIN([stream_out_switcher])
2365     VLC_ADD_LIBS([stream_out_switcher],[$AVCODEC_LIBS $AVUTIL_LIBS $LIBM])
2366     VLC_ADD_CFLAGS([stream_out_switcher],[$AVCODEC_CFLAGS $AVUTIL_CFLAGS])
2367   ],[AC_MSG_ERROR([Stream_out switcher depends on avcodec])
2368   ])
2369 ])
2370
2371
2372 dnl
2373 dnl  avformat demuxer/muxer plugin
2374 dnl
2375
2376 AC_ARG_ENABLE(avformat,
2377 [  --enable-avformat       libavformat containers (default enabled)],, [
2378   enable_avformat="${have_avcodec}"
2379 ])
2380 if test "${enable_avformat}" != "no"
2381 then
2382   PKG_CHECK_MODULES(AVFORMAT,[libavformat > 52.30.0 libavcodec libavutil],
2383     [
2384       VLC_SAVE_FLAGS
2385       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2386       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2387       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2388       AC_CHECK_HEADERS(libavutil/avutil.h)
2389       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2390         VLC_ADD_PLUGIN([avformat access_avio])
2391         VLC_ADD_LIBS([access_avio],[$AVFORMAT_LIBS $AVUTIL_LIBS])
2392         VLC_ADD_CFLAGS([access_avio],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
2393         AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2394           VLC_ADD_LDFLAGS([avformat access_avio],[-Wl,-Bsymbolic])
2395         ])
2396       ], [
2397         VLC_ADD_LIBS([avcodec],[$AVFORMAT_LIBS $AVUTIL_LIBS])
2398         VLC_ADD_CFLAGS([avcodec],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
2399       ])
2400       VLC_RESTORE_FLAGS
2401     ],[
2402       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2403   ])
2404 fi
2405
2406 dnl
2407 dnl  swscale image scaling and conversion plugin
2408 dnl
2409
2410 AC_ARG_ENABLE(swscale,
2411   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2412           (default enabled)]))
2413 if test "${enable_swscale}" != "no"
2414 then
2415   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2416     [
2417       VLC_SAVE_FLAGS
2418       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2419       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2420       AC_CHECK_HEADERS(libswscale/swscale.h)
2421       VLC_ADD_PLUGIN([swscale])
2422       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2423       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2424       AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2425         VLC_ADD_LIBS([swscale],[-Wl,-Bsymbolic])
2426       ])
2427       VLC_RESTORE_FLAGS
2428     ],[
2429       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2430   ])
2431 fi
2432
2433 dnl
2434 dnl  postproc plugin
2435 dnl
2436
2437 AC_ARG_ENABLE(postproc,
2438 [  --enable-postproc       libpostproc image post-processing (default enabled)])
2439 if test "${enable_postproc}" != "no"
2440 then
2441   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2442     [
2443       VLC_SAVE_FLAGS
2444       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2445       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2446       AC_CHECK_HEADERS(postproc/postprocess.h)
2447       VLC_ADD_PLUGIN([postproc])
2448       VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS])
2449       VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS])
2450       VLC_RESTORE_FLAGS
2451     ],[
2452       AC_MSG_ERROR([${POSTPROC_PKG_ERRORS}. Pass --disable-postproc to ignore this error.])
2453   ])
2454 fi
2455
2456 dnl
2457 dnl  faad decoder plugin
2458 dnl
2459 AC_ARG_ENABLE(faad,
2460 [  --enable-faad           faad codec (default auto)])
2461 if test "${enable_faad}" != "no"; then
2462   AC_ARG_WITH(faad-tree,  [  --with-faad-tree=PATH   faad tree for static linking])
2463   if test -n "${with_faad_tree}"; then
2464     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
2465     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
2466     if test -z "${real_faad_tree}"; then
2467       dnl  The given directory can't be found
2468       AC_MSG_RESULT(no)
2469       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
2470     fi
2471     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"; then
2472       dnl  Use the custom faad
2473       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
2474       VLC_ADD_PLUGIN([faad])
2475       VLC_ADD_LIBS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
2476       VLC_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
2477     else
2478       dnl  The given libfaad wasn't built
2479       AC_MSG_RESULT(no)
2480       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
2481     fi
2482   else
2483     VLC_SAVE_FLAGS
2484     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_faad}"
2485     LDFLAGS="${LDFLAGS} ${LIBS_faad}"
2486     AC_CHECK_HEADERS(faad.h,
2487       [ AC_CHECK_LIB(faad, faacDecOpen, [
2488           VLC_ADD_PLUGIN([faad])
2489           VLC_ADD_LIBS([faad],[-lfaad]) ], [
2490             AC_CHECK_LIB(faad, NeAACDecOpen, [
2491               VLC_ADD_PLUGIN([faad])
2492               VLC_ADD_LIBS([faad],[-lfaad]) ], [
2493                 AS_IF([test "${enable_faad}" = "yes"],
2494                 [ AC_MSG_ERROR([Cannot find libfaad library...]) ],
2495                 [ AC_MSG_WARN([Cannot find libfaad library...]) ]) ]) ])
2496       ] , [ AS_IF([test "${enable_faad}" = "yes"],
2497         [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ],
2498         [ AC_MSG_WARN([Cannot find development headers for libfaad...]) ]) ])
2499     VLC_RESTORE_FLAGS
2500   fi
2501 fi
2502
2503 dnl
2504 dnl twolame encoder plugin
2505 dnl
2506 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2507
2508 dnl
2509 dnl  QuickTime plugin
2510 dnl
2511 AC_ARG_ENABLE(quicktime,
2512   [  --enable-quicktime      QuickTime module (deprecated)])
2513 if test "${enable_quicktime}" = "yes"; then
2514   if test "${SYS}" = "mingw32"; then
2515     VLC_ADD_PLUGIN([quicktime])
2516   else
2517   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2518     [ VLC_ADD_PLUGIN([quicktime])
2519       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2520     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2521   fi
2522 fi
2523
2524 dnl
2525 dnl A52/AC3 decoder plugin
2526 dnl
2527 AC_ARG_ENABLE(a52,
2528   [  --enable-a52            A/52 support with liba52 (default enabled)])
2529 if test "${enable_a52}" != "no"
2530 then
2531   AC_ARG_WITH(a52,
2532     [  --with-a52=PATH         a52 headers and libraries])
2533   AC_ARG_WITH(a52-tree,
2534     [  --with-a52-tree=PATH    a52dec tree for static linking ],[],[])
2535   if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
2536   then
2537     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
2538     if test -z "${real_a52_tree}"
2539     then
2540       dnl  The given directory can't be found
2541       AC_MSG_RESULT(no)
2542       AC_MSG_ERROR([${with_a52_tree} directory does not exist])
2543     fi
2544     dnl  Use a custom a52dec
2545     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
2546     if test -f ${real_a52_tree}/include/a52.h
2547     then
2548       AC_MSG_RESULT(yes)
2549       VLC_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
2550       VLC_ADD_LIBS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
2551       VLC_SAVE_FLAGS
2552       LDFLAGS="${LDFLAGS} ${LIBS_a52tofloat32}"
2553       AC_CHECK_LIB(a52, a52_free, [
2554         VLC_ADD_PLUGIN([a52tofloat32])
2555         VLC_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
2556         VLC_ADD_LIBS([a52tofloat32],[-la52])
2557         ],[
2558         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
2559         then
2560           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3 ($real_a52_tree)])
2561         else
2562           AC_MSG_ERROR([the specified tree has not been compiled])
2563         fi
2564       ])
2565     else
2566       AC_MSG_RESULT(no)
2567       AC_MSG_ERROR([the specified tree does not have a52.h])
2568     fi
2569   else
2570     if test -z "${with_a52}"
2571     then
2572       LDFLAGS_test=""
2573       CPPFLAGS_test=""
2574     else
2575       LDFLAGS_test="-L${with_a52}/lib"
2576       CPPFLAGS_test="-I${with_a52}/include"
2577     fi
2578     VLC_SAVE_FLAGS
2579     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2580     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2581     AC_CHECK_HEADERS(a52dec/a52.h, [
2582       AC_CHECK_LIB(a52, a52_free, [
2583         VLC_ADD_PLUGIN([a52tofloat32])
2584         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2585         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2586       ],[
2587         AC_MSG_ERROR([Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.])
2588         ], [$LIBM])
2589     ],[
2590       AC_MSG_ERROR([Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.])
2591     ])
2592     VLC_RESTORE_FLAGS
2593   fi
2594 fi
2595
2596 AC_ARG_WITH(a52-fixed,
2597       [  --with-a52-fixed        specify if liba52 has been compiled with fixed point support],
2598       [
2599         VLC_ADD_CPPFLAGS([a52tofloat32],[-DLIBA52_FIXED]) ])
2600
2601 dnl
2602 dnl DTS Coherent Acoustics decoder plugin
2603 dnl
2604 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2605
2606 dnl
2607 dnl  Flac plugin
2608 dnl
2609 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2610
2611 dnl
2612 dnl  Libmpeg2 plugin
2613 dnl
2614 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2615
2616 dnl
2617 dnl  Vorbis plugin
2618 dnl
2619 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2620
2621 dnl
2622 dnl  Tremor plugin
2623 dnl
2624 AC_ARG_ENABLE(tremor,
2625   [  --enable-tremor         Tremor decoder support (default disabled)])
2626 if test "${enable_tremor}" = "yes"
2627 then
2628   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2629     VLC_ADD_PLUGIN([tremor])
2630     VLC_ADD_LIBS([tremor],[-lvorbisidec -logg])
2631    ],[])
2632 fi
2633
2634 dnl
2635 dnl  Speex plugins
2636 dnl
2637 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2638 have_speexdsp="no"
2639 AS_IF([test "${enable_speex}" != "no"], [
2640   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2641     have_speexdsp="yes"
2642   ], [
2643     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2644   ])
2645 ])
2646 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2647
2648 dnl
2649 dnl  Opus plugin
2650 dnl
2651 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus], [Opus support], [auto])
2652
2653 dnl
2654 dnl  theora decoder plugin
2655 dnl
2656 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2657
2658 dnl
2659 dnl  dirac encoder plugin
2660 dnl
2661 PKG_ENABLE_MODULES_VLC([DIRAC], [], [dirac >= 0.10.0], [dirac encoder], [auto])
2662
2663 dnl
2664 dnl  schroedinger decoder plugin (for dirac format video)
2665 dnl
2666 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2667
2668 dnl
2669 dnl  PNG decoder module
2670 dnl
2671 AC_ARG_ENABLE(png,
2672   [  --enable-png            PNG support (default enabled)])
2673 if test "${enable_png}" != "no"; then
2674 AC_CHECK_HEADERS(png.h, [
2675   VLC_SAVE_FLAGS
2676   LDFLAGS="${LDFLAGS} -lz $LIBM"
2677   AC_CHECK_LIB(png, png_set_rows, [
2678     VLC_ADD_LIBS([png],[-lpng -lz $LIBM])
2679     VLC_ADD_PLUGIN([png osdmenu osd_parser])],
2680     [],[-lz $LIBM] )
2681   VLC_RESTORE_FLAGS
2682   ])
2683 fi
2684 AM_CONDITIONAL(BUILD_OSDMENU, [test "${enable_png}" != "no"])
2685
2686 dnl
2687 dnl H264 encoder plugin (10-bit lib264)
2688 dnl
2689 AC_ARG_ENABLE(x26410b,
2690   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2691 if test "${enable_x26410b}" != "no"; then
2692 AC_ARG_WITH(x26410b-tree,
2693   [ --with-x26410b-tree=PATH      H264 10-bit encoding module with libx264 (static linking)],[],[])
2694   if test "${with_x26410b_tree}" != "no" -a -n "${with_x26410b_tree}"
2695   then
2696     real_x26410b_tree="̧`cd ${with_x26410b_tree} 2>/dev/null && pwd`"
2697     if test -z "${real_x26410b_tree}"
2698     then
2699       AC_MSG_RESULT(no)
2700       AC_MSG_ERROR([${with_x26410b_tree} directory does not exist])
2701     fi
2702     AC_MSG_CHECKING(for x264.h in ${real_x26410b_tree})
2703     if test -f ${with_x26410b_tree}/x264_config.h
2704     then
2705       AC_MSG_RESULT(yes)
2706       AC_MSG_CHECKING(for 10-bit build of x264)
2707       if grep -q "BIT_DEPTH.*10"  ${with_x26410b_tree}/x264_config.h ;then
2708         AC_MSG_RESULT(yes)
2709         VLC_ADD_PLUGIN([x26410b])
2710         VLC_ADD_CFLAGS([x26410b],[-I${with_x26410b_tree}])
2711         VLC_ADD_LIBS([x26410b],[-L${with_x26410b_tree} -lm -lpthread -lx264])
2712       else
2713         AC_MSG_RESULT(no)
2714         AC_MSG_ERROR([${with_x26410b_tree} isnt build 10-bit])
2715       fi
2716     else
2717       AC_MSG_RESULT(no)
2718       AC_MSG_ERROR([${with_x26410b_tree} doesnt have x264_config.h])
2719     fi
2720   else
2721     PKG_CHECK_MODULES(X26410B, x26410b, [
2722         VLC_ADD_PLUGIN([x26410b])
2723         VLC_ADD_LDFLAGS([x26410b],[${X26410B_LIBS}])
2724         AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2725           VLC_ADD_LIBS([x26410b],[-Wl,-Bsymbolic])
2726         ])
2727         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2728         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2729           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2730         fi
2731     ], [
2732        if test "${enable_x26410b}" = "yes"; then
2733         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2734        fi
2735     ])
2736   fi
2737 fi
2738
2739
2740 dnl
2741 dnl H264 encoder plugin (using libx264)
2742 dnl
2743 AC_ARG_ENABLE(x264,
2744   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2745 if test "${enable_x264}" != "no"; then
2746   AC_ARG_WITH(x264-tree,
2747     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
2748   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
2749   then
2750     real_x264_tree="`cd ${with_x264_tree} 2>/dev/null && pwd`"
2751     if test -z "${real_x264_tree}"
2752     then
2753       dnl  The given directory can't be found
2754       AC_MSG_RESULT(no)
2755       AC_MSG_ERROR([${with_x264_tree} directory does not exist])
2756     fi
2757     dnl  Use a custom libx264
2758     AC_MSG_CHECKING(for x264.h in ${real_x264_tree})
2759     if test -f ${real_x264_tree}/x264.h
2760     then
2761       AC_MSG_RESULT(yes)
2762       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
2763       VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
2764       PKG_CHECK_MODULES(X264,x264, [
2765         VLC_ADD_PLUGIN([x264])
2766         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2767         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2768         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2769           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2770         fi
2771       ],[
2772         AC_MSG_ERROR([the specified tree has not been compiled])
2773       ])
2774     else
2775       AC_MSG_RESULT(no)
2776       AC_MSG_ERROR([the specified tree does not have x264.h])
2777     fi
2778   else
2779       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2780         VLC_ADD_PLUGIN([x264])
2781         VLC_ADD_LDFLAGS([x264],[${X264_LIBS}])
2782
2783         AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2784           VLC_ADD_LIBS([x264],[-Wl,-Bsymbolic])
2785         ])
2786
2787         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2788         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2789           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2790         fi
2791       ],[
2792         if test "${enable_x264}" = "yes"; then
2793             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2794           fi
2795       ])
2796   fi
2797 fi
2798
2799 dnl
2800 dnl libfluidsynth (MIDI synthetizer) plugin
2801 dnl
2802 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2803
2804 dnl
2805 dnl Teletext Modules
2806 dnl vbi decoder plugin (using libzbvi)
2807 dnl telx module
2808 dnl uncompatible
2809 dnl
2810 AC_ARG_ENABLE(zvbi,
2811   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2812                   libzvbi (default enabled)]))
2813 AC_ARG_ENABLE(telx,
2814   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2815                   zvbi) (default enabled if zvbi is absent)]))
2816
2817 AS_IF( [test "${enable_zvbi}" != "no"],[
2818     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2819         [
2820           VLC_ADD_LIBS([zvbi],[$ZVBI_LIBS])
2821           if test "${SYS}" = "mingw32"; then
2822               VLC_ADD_LIBS([zvbi],[ -lpthreadGC2])
2823           fi
2824           VLC_ADD_CFLAGS([zvbi],[$ZVBI_CFLAGS])
2825           VLC_ADD_PLUGIN([zvbi])
2826           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2827           AS_IF( [test "${enable_telx}" = "yes"],[
2828                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2829                   ])
2830         ],[
2831           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2832         ])
2833     ])
2834 AS_IF( [test "${enable_telx}" != "no" ],[
2835   VLC_ADD_PLUGIN([telx])
2836   ])
2837
2838 dnl
2839 dnl libass subtitle rendering module
2840 dnl
2841 AC_ARG_ENABLE(libass,
2842   [  --enable-libass         Subtitle support using libass (default enabled)])
2843 AS_IF( [test "${enable_libass}" != "no"], [
2844   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2845       [
2846         VLC_ADD_LIBS([libass],[$LIBASS_LIBS])
2847         VLC_ADD_CFLAGS([libass],[$LIBASS_CFLAGS])
2848         VLC_ADD_PLUGIN([libass])
2849
2850         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2851           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2852            VLC_ADD_LIBS([libass],[-lfontconfig])
2853        ])
2854       ],[
2855         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2856       ])
2857   ])
2858
2859 dnl
2860 dnl  kate decoder plugin
2861 dnl
2862 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2863
2864 dnl
2865 dnl  tiger rendering for kate decoder plugin
2866 dnl
2867 AC_ARG_ENABLE(tiger,
2868 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2869 AS_IF([test "${enable_tiger}" != "no"], [
2870   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2871       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])
2872       VLC_ADD_CFLAGS([kate],[$TIGER_CFLAGS])
2873       VLC_ADD_LIBS([kate],[$TIGER_LIBS]) ],[
2874         AS_IF([test -n "${enable_tiger}"], [
2875           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2876         ])
2877   ])
2878 ])
2879
2880
2881 dnl
2882 dnl  Video plugins
2883 dnl
2884
2885 EXTEND_HELP_STRING([Video plugins:])
2886
2887 dnl
2888 dnl  OpenGL
2889 dnl
2890 PKG_CHECK_MODULES([GL], [gl], [
2891   have_gl="yes"
2892 ], [
2893   AC_CHECK_HEADER([GL/gl.h], [
2894     have_gl="yes"
2895     GL_CFLAGS=""
2896     GL_LIBS="-lGL"
2897   ], [
2898     have_gl="no"
2899   ])
2900 ])
2901
2902 dnl OpenGL ES 2: depends on EGL 1.1 and is currently unfinished
2903 dnl PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [auto])
2904 dnl OpenGL ES 1: depends on EGL 1.0 and is currently broken
2905 dnl PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [auto])
2906
2907 AC_ARG_ENABLE(egl,
2908   [  --enable-egl            OpenGL support through EGL (default disabled)],, [
2909   enable_egl="no"
2910 ])
2911 AS_IF([test "$enable_egl" != "no"], [
2912   PKG_CHECK_MODULES([EGL], [egl], [
2913     VLC_ADD_PLUGIN([gl])
2914     VLC_ADD_PLUGIN([egl])
2915   ])
2916 ])
2917
2918 dnl
2919 dnl  Xlib
2920 dnl
2921
2922 AC_PATH_XTRA()
2923 AC_CHECK_HEADERS(X11/Xlib.h)
2924
2925 dnl
2926 dnl  X C Bindings modules
2927 dnl
2928 AC_ARG_ENABLE(xcb,
2929   [  --enable-xcb            X11 support with XCB (default enabled)],, [
2930   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [
2931     enable_xcb="yes"
2932   ], [
2933     enable_xcb="no"
2934   ])
2935 ])
2936 AC_ARG_ENABLE(xvideo,
2937   [  --enable-xvideo         XVideo support (default enabled)],, [
2938     enable_xvideo="$enable_xcb"
2939 ])
2940 AC_ARG_ENABLE(glx,
2941   [  --enable-glx            OpenGL support through GLX (default enabled)],, [
2942   enable_glx="$enable_xcb"
2943 ])
2944
2945 have_xcb="no"
2946 AS_IF([test "${enable_xcb}" != "no"], [
2947   dnl libxcb
2948   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
2949   have_xcb="yes"
2950   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
2951   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
2952
2953   AS_IF([test "${enable_xvideo}" != "no"], [
2954     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
2955       VLC_ADD_PLUGIN([xcb_xv])
2956     ])
2957   ])
2958
2959   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [
2960     VLC_ADD_PLUGIN([panoramix])
2961     VLC_ADD_LIBS([panoramix],[${XCB_RANDR_LIBS} ${XCB_LIBS}])
2962     VLC_ADD_CFLAGS([panoramix],[${XCB_RANDR_CFLAGS} ${XCB_CFLAGS}])
2963   ], [
2964     AC_MSG_WARN([${XCB_RANDR_PKG_ERRORS}. Panoramix filter will not be supported.])
2965   ])
2966
2967   dnl xcb-utils
2968   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [
2969     PKG_CHECK_MODULES(XPROTO, [xproto])
2970     VLC_ADD_PLUGIN([globalhotkeys])
2971     VLC_ADD_CFLAGS([xcb_window], [-DHAVE_XCB_KEYSYMS])
2972   ], [
2973     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
2974   ])
2975
2976   AS_IF([test "${enable_glx}" != "no"], [
2977     AS_IF([test "${have_gl}" != "yes"], [
2978       AC_MSG_ERROR([${GL_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.])
2979     ])
2980     VLC_ADD_PLUGIN([xcb_glx])
2981   ])
2982 ])
2983 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
2984
2985 dnl
2986 dnl  SDL module
2987 dnl
2988 AC_ARG_ENABLE(sdl,
2989   [  --enable-sdl            SDL support (default enabled)])
2990 AC_ARG_ENABLE(sdl-image,
2991   [  --enable-sdl-image      SDL image support (default enabled)])
2992 if test "${enable_sdl}" != "no"
2993 then
2994    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
2995       # SDL on Darwin is heavily patched and can only run SDL_image
2996       if test "${SYS}" != "darwin"; then
2997         VLC_ADD_PLUGIN([vout_sdl])
2998       fi
2999       if test "${SYS}" != "mingw32" -a "${SYS}" != "os2"; then
3000         VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3001       fi
3002       VLC_ADD_CFLAGS([vout_sdl],[${SDL_CFLAGS}])
3003       VLC_ADD_LIBS([vout_sdl],[${SDL_LIBS}])
3004
3005       # SDL_image
3006       AS_IF([ test "${enable_sdl_image}" != "no"],[
3007         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3008           VLC_ADD_PLUGIN([sdl_image])
3009           VLC_ADD_LIBS([sdl_image],[${SDL_IMAGE_LIBS}])
3010           VLC_ADD_CFLAGS([sdl_image], [${SDL_IMAGE_CFLAGS}])],
3011           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3012           ])
3013       ])
3014    ],[
3015      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3016    ])
3017 fi
3018
3019
3020 dnl
3021 dnl Mac Vout
3022 AC_ARG_ENABLE(macosx-vout,
3023   [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
3024 if test "x${enable_macosx_vout}" != "xno" &&
3025   (test "${SYS}" = "darwin" || test "${enable_macosx_vout}" = "yes")
3026 then
3027   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,Cocoa])
3028   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,OpenGL])
3029   VLC_ADD_PLUGIN([vout_macosx])
3030 fi
3031
3032
3033 dnl
3034 dnl  freetype module
3035 dnl
3036 AC_ARG_ENABLE(freetype,
3037   [  --enable-freetype       freetype support   (default auto)])
3038 AC_ARG_ENABLE(fribidi,
3039   [  --enable-fribidi        fribidi support    (default auto)])
3040 AC_ARG_ENABLE(fontconfig,
3041   [  --enable-fontconfig     fontconfig support (default auto)])
3042
3043 if test "${enable_freetype}" != "no"; then
3044    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3045       have_freetype=yes
3046       VLC_ADD_PLUGIN([freetype])
3047       VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
3048       if test "${SYS}" = "mingw32"; then
3049         VLC_ADD_LIBS([freetype],[-liconv -lz])
3050       fi
3051       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
3052
3053       AC_CHECK_HEADERS(Carbon/Carbon.h,
3054                        [VLC_ADD_LIBS([freetype],[-Wl,-framework,Carbon])])
3055
3056       dnl fontconfig support
3057       if test "${SYS}" != "mingw32"; then
3058           if test "${enable_fontconfig}" != "no"; then
3059             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3060               VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
3061               VLC_ADD_LIBS([freetype],[-lfontconfig])
3062             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3063           fi
3064       else
3065           VLC_ADD_LIBS([freetype],[-lgdi32])
3066       fi
3067
3068       dnl fribidi support
3069       if test "${enable_fribidi}" != "no"; then
3070         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3071           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3072           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
3073         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional support will be disabled in FreeType.])])
3074       fi
3075
3076   ],[
3077   have_freetype=no
3078   AS_IF([test -n "${enable_freetype}"],[
3079     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3080     ])
3081   ])
3082 fi
3083
3084
3085 dnl
3086 dnl  QuartzText vout module (iOS/Mac OS)
3087 dnl
3088 AC_ARG_ENABLE(macosx-quartztext,
3089   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3090 if test "x${enable_macosx_quartztext}" != "xno" &&
3091   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3092 then
3093   VLC_ADD_PLUGIN([quartztext])
3094   VLC_ADD_LIBS([quartztext],[-Wl,-framework,ApplicationServices])
3095 fi
3096
3097 dnl
3098 dnl  SVG module
3099 dnl
3100 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3101
3102 dnl
3103 dnl  android surface module
3104 dnl
3105 AC_ARG_ENABLE(android-surface,
3106   [  --enable-android-surface   Android Surface video output module (default disabled)])
3107 if test "${enable_android_surface}" = "yes"; then
3108   if test "${HAVE_ANDROID}" = "1"; then
3109      VLC_ADD_PLUGIN([android_surface])
3110      VLC_ADD_LDFLAGS([android_surface], [-ldl])
3111   fi
3112 fi
3113
3114
3115 dnl
3116 dnl  iOS vout module
3117 dnl
3118 AC_ARG_ENABLE(ios-vout,
3119   [  --enable-ios-vout    iOS video output module (default disabled)])
3120 if test "${enable_ios_vout}" = "yes"
3121 then
3122   VLC_ADD_PLUGIN([vout_ios])
3123   VLC_ADD_CFLAGS([vout_ios], [-DUSE_OPENGL_ES=1])
3124   VLC_ADD_LIBS([vout_ios], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit,-framework,Foundation])
3125 fi
3126
3127 dnl
3128 dnl  Windows DirectX module
3129 dnl
3130
3131 if test "${SYS}" = "mingw32"
3132 then
3133   VLC_ADD_PLUGIN([panoramix])
3134 fi
3135
3136 AC_ARG_ENABLE(directx,
3137   [AS_HELP_STRING([--enable-directx],
3138     [Microsoft DirectX support (default enabled on Windows)])],, [
3139   AS_IF([test "${SYS}" = "mingw32"], [
3140     enable_directx="yes"
3141   ], [
3142     enable_directx="no"
3143   ])
3144 ])
3145 have_directx="no"
3146 AS_IF([test "${enable_directx}" != "no"], [
3147   dnl DirectDraw
3148   AC_CHECK_HEADERS(ddraw.h, [
3149     have_directx="yes"
3150   ], [
3151     AC_MSG_ERROR([Cannot find DirectX headers!])
3152   ])
3153
3154   dnl OpenGL
3155   AC_CHECK_HEADERS(GL/wglew.h, [
3156     VLC_ADD_PLUGIN([glwin32])
3157   ],, [
3158     #include <windows.h>
3159     #include <GL/gl.h>
3160   ])
3161
3162   dnl Direct3D
3163   AC_CHECK_HEADERS(d3d9.h, [
3164     VLC_ADD_PLUGIN([direct3d])
3165   ])
3166
3167   dnl Direct2D
3168   AC_CHECK_HEADERS(d2d1.h, [
3169     VLC_ADD_PLUGIN([direct2d])
3170   ])
3171 ])
3172 AM_CONDITIONAL([HAVE_DIRECTX], [test "$have_directx" = "yes"])
3173
3174 dnl
3175 dnl  Linux framebuffer module
3176 dnl
3177 AC_CHECK_HEADER([linux/fb.h], [
3178   VLC_ADD_PLUGIN([fb])
3179 ])
3180
3181
3182 dnl
3183 dnl  DirectFB module
3184 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3185 dnl  TODO: support for static linking
3186 dnl
3187 AC_ARG_ENABLE(directfb,
3188   [  --enable-directfb       DirectFB support (default disabled)])
3189 AC_ARG_WITH(directfb,
3190   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3191
3192 if test "${enable_directfb}" = "yes"; then
3193     have_directfb="false"
3194     CPPFLAGS_mydirectfb=
3195     LIBS_mydirectfb=
3196     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3197         dnl Trying the given location
3198         VLC_SAVE_FLAGS
3199
3200         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3201         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3202
3203         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3204         LIBS="${LIBS} ${LIBS_new}"
3205
3206         dnl FIXME: too obscure
3207         AC_CHECK_HEADER([directfb.h], [
3208             AC_CHECK_LIB([direct],[direct_initialize], [
3209                 AC_CHECK_LIB([fusion], [fusion_enter], [
3210                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3211                 ], have_directfb="false")
3212             ], have_directfb="false")
3213         ], have_directfb="false")
3214
3215         VLC_RESTORE_FLAGS
3216
3217         if test "${have_directfb}" = "true"; then
3218             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3219             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3220         fi
3221     else
3222         dnl Look for directfb-config
3223         AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
3224         if test "${DIRECTFB_CONFIG}" != "no"; then
3225             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3226             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3227             have_directfb="true"
3228         else
3229             dnl Trying with pkg-config
3230             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3231                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3232                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3233                 have_directfb="true"
3234                 ], [have_directfb="false"])
3235         fi
3236     fi
3237     if test "${have_directfb}" = "true"; then
3238         VLC_ADD_PLUGIN([directfb])
3239         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3240         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3241     else
3242         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3243     fi
3244 fi
3245
3246 dnl
3247 dnl  AA plugin
3248 dnl
3249 AC_ARG_ENABLE(aa,
3250   [  --enable-aa             aalib output (default disabled)])
3251 if test "${enable_aa}" = "yes"
3252 then
3253   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3254   if test "${have_aa}" = "true"
3255   then
3256     VLC_ADD_PLUGIN([aa])
3257     VLC_ADD_LIBS([aa],[-laa])
3258     if test "${SYS}" != "mingw32"; then
3259       VLC_ADD_LIBS([aa],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3260     fi
3261   fi
3262 fi
3263
3264 dnl
3265 dnl  libcaca plugin
3266 dnl
3267 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3268
3269 dnl
3270 dnl  OS/2 KVA plugin
3271 dnl
3272 AC_ARG_ENABLE(kva,
3273   [AS_HELP_STRING([--enable-kva],
3274     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3275   AS_IF([test "$SYS" = "os2"], [
3276     enable_kva="yes"
3277   ])
3278 ])
3279 have_kva="no"
3280 KVA_LIBS=""
3281 AS_IF([test "$enable_kva" != "no"], [
3282   AC_CHECK_HEADERS([kva.h], [
3283     have_kva="yes"
3284     AC_CHECK_LIB(kva, main, [
3285       KVA_LIBS="-lkva"
3286     ])
3287   ])
3288 ])
3289 AC_SUBST(KVA_LIBS)
3290 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3291
3292 dnl
3293 dnl  Audio plugins
3294 dnl
3295
3296 EXTEND_HELP_STRING([Audio plugins:])
3297
3298 dnl
3299 dnl  Pulseaudio module
3300 dnl
3301 AC_ARG_ENABLE(pulse,
3302   [AS_HELP_STRING([--enable-pulse],
3303     [use the PulseAudio client library (default auto)])])
3304 have_pulse="no"
3305 AS_IF([test "${enable_pulse}" != "no"], [
3306   PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.22], [
3307     have_pulse="yes"
3308   ], [
3309     PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.16], [
3310       AS_IF([test "${no_x}" != "yes"], [
3311         have_pulse="yes"
3312         PULSE_LIBS="$PULSE_LIBS ${X_LIBS} ${X_PRE_LIBS} -lX11"
3313       ], [
3314         AS_IF([test "${enable_pulse}" = "yes"], [
3315           AC_MSG_ERROR([Xlib is required with PulseAudio pre-0.9.22 versions
3316 (see http://www.pulseaudio.org/ticket/799 for further reference).])
3317         ])
3318       ])
3319     ], [
3320       AS_IF([test "x${enable_pulse}" != "x"], [
3321         AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 0.9.22 or later required.])
3322       ])
3323     ])
3324   ])
3325 ])
3326 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3327
3328 dnl
3329 dnl  ALSA module
3330 dnl
3331 AC_ARG_ENABLE(alsa,
3332   [AS_HELP_STRING([--enable-alsa],
3333     [support the Advanced Linux Sound Architecture (default auto)])],, [
3334   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3335     enable_alsa="yes"
3336   ])
3337 ])
3338 have_alsa="no"
3339 AS_IF([test "${enable_alsa}" != "no"], [
3340   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.16], [
3341     have_alsa="yes"
3342   ], [
3343     AS_IF([test "x${enable_alsa}" != "x"], [
3344       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.16 or later required.])
3345     ])
3346   ])
3347 ])
3348 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3349
3350 dnl
3351 dnl  Open Sound System module
3352 dnl
3353 AC_ARG_ENABLE(oss,
3354   [AS_HELP_STRING([--enable-oss],
3355     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3356   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3357     enable_oss="no"
3358   ])
3359 ])
3360 have_oss="no"
3361 OSS_LIBS=""
3362 AS_IF([test "$enable_oss" != "no"], [
3363   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3364     have_oss="yes"
3365     AC_CHECK_LIB(ossaudio, main, [
3366       OSS_LIBS="-lossaudio"
3367     ])
3368   ])
3369 ])
3370 AC_SUBST(OSS_LIBS)
3371 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3372
3373 dnl
3374 dnl  OpenBSD sndio module
3375 dnl
3376 AC_ARG_ENABLE([sndio],
3377   [AS_HELP_STRING([--disable-sndio],
3378     [support the OpenBSD sndio (default auto)])],, [
3379   AS_IF([test "$SYS" = "opensd"], [
3380     enable_sndio="yes"
3381   ])
3382 ])
3383 have_sndio="no"
3384 AS_IF([test "$enable_sndio" != "no"], [
3385   AC_CHECK_HEADER([sndio.h], [
3386     have_sndio="yes"
3387   ])
3388 ])
3389 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3390
3391 dnl
3392 dnl  Windows Audio Session plugin
3393 dnl
3394 AC_ARG_ENABLE([wasapi],
3395   [AS_HELP_STRING([--enable-wasapi],
3396     [use the Windows Audio Session API (default auto)])
3397 ])
3398 have_wasapi="no"
3399 AS_IF([test "$enable_wasapi" != "no"], [
3400   AC_CHECK_HEADER([audioclient.h], [
3401     have_wasapi="yes"
3402   ], [
3403     AS_IF([test "x${enable_wasapi}" != "x"], [
3404       AC_MSG_ERROR([Windows Audio Session API not found.])
3405     ])
3406   ])
3407 ])
3408 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3409
3410 dnl
3411 dnl  win32 waveOut plugin
3412 dnl
3413 AC_ARG_ENABLE(waveout,
3414   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
3415 if test "${enable_waveout}" != "no"; then
3416   if test "${SYS}" = "mingw32"; then
3417     VLC_ADD_PLUGIN([waveout])
3418     VLC_ADD_LIBS([waveout],[-lwinmm])
3419   fi
3420 fi
3421
3422 dnl
3423 dnl  CoreAudio plugin
3424 dnl
3425 AC_ARG_ENABLE(macosx-audio,
3426   [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
3427 if test "x${enable_macosx_audio}" != "xno" &&
3428   (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
3429 then
3430   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
3431     [ VLC_ADD_PLUGIN([auhal])
3432       VLC_ADD_LIBS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
3433     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
3434 fi
3435
3436 dnl
3437 dnl  AudioQueue plugin
3438 dnl
3439 AC_ARG_ENABLE(audioqueue,
3440   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3441 if test "${enable_audioqueue}" = "yes"
3442 then
3443   VLC_ADD_PLUGIN([audioqueue])
3444   VLC_ADD_LIBS([audioqueue], [-Wl,-framework,AudioToolbox,-framework,CoreFoundation])
3445 fi
3446
3447 dnl
3448 dnl  JACK modules
3449 dnl
3450 PKG_ENABLE_MODULES_VLC([JACK], [jack access_jack], [jack], [JACK audio I/O modules],[auto])
3451
3452 dnl
3453 dnl  OpenSLES Android
3454 dnl
3455 AC_ARG_ENABLE(opensles,
3456   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3457 if test "${HAVE_ANDROID}" = "1"; then
3458   if test "${enable_opensles}" = "yes"; then
3459       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3460         [ VLC_ADD_PLUGIN([opensles_android]) ],
3461         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3462   fi
3463 fi
3464
3465 dnl
3466 dnl libsamplerate plugin
3467 dnl
3468 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3469
3470 dnl
3471 dnl  OS/2 KAI plugin
3472 dnl
3473 AC_ARG_ENABLE(kai,
3474   [AS_HELP_STRING([--enable-kai],
3475     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3476   AS_IF([test "$SYS" = "os2"], [
3477     enable_kai="yes"
3478   ])
3479 ])
3480 have_kai="no"
3481 KAI_LIBS=""
3482 AS_IF([test "$enable_kai" != "no"], [
3483   AC_CHECK_HEADERS([kai.h], [
3484     have_kai="yes"
3485     AC_CHECK_LIB(kai, main, [
3486       KAI_LIBS="-lkai"
3487     ])
3488   ])
3489 ])
3490 AC_SUBST(KAI_LIBS)
3491 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3492
3493 dnl
3494 dnl  Interface plugins
3495 dnl
3496
3497 EXTEND_HELP_STRING([Interface plugins:])
3498
3499 dnl
3500 dnl QT
3501 dnl
3502 AC_ARG_ENABLE(qt, [
3503   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3504   AS_IF([test "${SYS}" = "darwin"], [
3505     enable_qt="no"
3506   ])
3507 ])
3508 AS_IF([test "${enable_qt}" != "no"], [
3509   PKG_CHECK_MODULES([QT], [QtCore >= 5 QtWidgets QtGui],, [
3510     PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3511       AS_IF([test -n "${enable_qt}"],[
3512         AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3513       ],[
3514         AC_MSG_WARN([${QT_PKG_ERRORS}.])
3515       ])
3516       enable_qt="no"
3517     ])
3518   ])
3519 ])
3520 AS_IF([test "${enable_qt}" != "no"], [
3521   VLC_ADD_PLUGIN([qt4])
3522   VLC_ADD_LIBS([qt4],[${QT_LIBS}])
3523   VLC_ADD_CXXFLAGS([qt4],[${QT_CFLAGS}])
3524   ALIASES="${ALIASES} qvlc"
3525
3526   AC_LANG_PUSH([C++])
3527   VLC_SAVE_FLAGS
3528
3529   AC_MSG_CHECKING([whether Qt uses Xlib])
3530   CPPFLAGS="${CPPFLAGS} ${QT_CFLAGS}"
3531   AC_PREPROC_IFELSE([AC_LANG_SOURCE([
3532 #include <QWidget>
3533 #if !defined (Q_WS_X11)
3534 # error Fail
3535 #endif
3536   ])], [
3537     AC_MSG_RESULT([yes])
3538     VLC_ADD_LIBS([qt4],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3539     VLC_ADD_CXXFLAGS([qt4],[${X_CFLAGS}])
3540   ], [
3541     AC_MSG_RESULT([no])
3542   ])
3543
3544   VLC_RESTORE_FLAGS
3545   AC_LANG_POP([C++])
3546
3547   AS_IF([test "${SYS}" = "mingw32"], [
3548       VLC_ADD_LIBS([qt4],[-lole32])
3549   ])
3550   AS_IF([test "${SYS}" = "darwin" ],[
3551        VLC_ADD_LIBS([qt4], [-Wl,-framework,Cocoa])
3552   ])
3553
3554   QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3555   AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, [${QT_PATH}/bin])
3556   AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin])
3557   AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, [${QT_PATH}/bin])
3558 ])
3559 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3560
3561 dnl
3562 dnl Simple test for skins2 dependency
3563 dnl
3564 AS_IF([test "$enable_qt" = "no"], [
3565   AS_IF([test "${enable_skins2}" = "yes"], [
3566     AC_MSG_ERROR([The skins2 module depends on the Qt4 interface. Without it you will not be able to open any dialog box from the interface, which makes the skins2 interface rather useless. Install the Qt4 development package or alternatively you can also configure with: --disable-qt4 --disable-skins2.])
3567   ], [
3568     enable_skins2="no"
3569     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3570   ])
3571 ])
3572
3573 dnl
3574 dnl Skins2 module
3575 dnl
3576 AC_ARG_ENABLE(skins2,
3577   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3578 AS_IF([test "${enable_skins2}" != "no"], [
3579   have_skins_deps="yes"
3580
3581   dnl Win32
3582   AS_IF([test "${SYS}" = "mingw32"], [
3583     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3584     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3585   dnl MacOS
3586   ], [test "${SYS}" = "darwin"], [
3587     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3588     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3589   dnl Linux/Unix
3590   ], [
3591     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3592     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3593     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3594     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3595     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3596   ])
3597
3598   dnl for All OSes
3599   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3600
3601   dnl we need freetype
3602   AS_IF([test "${have_freetype}" != "yes"], [
3603     have_skins_deps="no"
3604   ])
3605
3606   AS_IF([test "${have_skins_deps}" = "no"], [
3607     AS_IF([test "x${enable_skins2}" = "x"], [
3608       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3609     ], [
3610       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3611     ])
3612     enable_skins2="no"
3613   ], [
3614     VLC_ADD_PLUGIN([skins2])
3615     ALIASES="${ALIASES} svlc"
3616     enable_skins2="yes"
3617   ])
3618 ])
3619 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3620
3621 AC_ARG_ENABLE(libtar,
3622   [  --enable-libtar         libtar support for skins2 (default auto)])
3623 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3624   AC_CHECK_HEADERS(libtar.h, [
3625     VLC_ADD_LIBS([skins2],[-ltar])
3626   ])
3627 ])
3628
3629 dnl
3630 dnl  MacOS X gui module
3631 dnl
3632 AC_ARG_ENABLE(macosx,
3633   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3634 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3635 then
3636   VLC_ADD_LIBS([macosx minimal_macosx], [-Wl,-framework,Cocoa -Wl,-framework,OpenGL -Wl,-framework,Carbon -Wl,-framework,CoreServices -Wl,-framework,AGL])
3637   VLC_ADD_OBJCFLAGS([macosx minimal_macosx], [-fobjc-exceptions] )
3638   VLC_ADD_PLUGIN([macosx minimal_macosx])
3639
3640   VLC_ADD_LIBS([macosx], [-Wl,-framework,QTKit -Wl,-framework,IOKit -Wl,-framework,AddressBook -Wl,-framework,WebKit -Wl,-framework,CoreAudio -Wl,-framework,SystemConfiguration])
3641
3642   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3643   then
3644     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3645   fi
3646   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,Sparkle])
3647   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3648
3649   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3650   then
3651     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3652   fi
3653   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit])
3654   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3655
3656 fi
3657
3658 dnl
3659 dnl  MacOS X dialor provider
3660 dnl
3661 AC_ARG_ENABLE(macosx-dialog-provider,
3662   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3663 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3664   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3665 then
3666   VLC_ADD_LIBS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
3667   VLC_ADD_PLUGIN([macosx_dialog_provider])
3668 fi
3669
3670 dnl
3671 dnl  ncurses module
3672 dnl
3673 AC_ARG_ENABLE(ncurses,
3674 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3675 AS_IF([test "${enable_ncurses}" != "no"] ,[
3676   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3677     VLC_ADD_PLUGIN([ncurses])
3678     VLC_ADD_CFLAGS([ncurses],[${NCURSES_CFLAGS}])
3679     VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS}])
3680     ALIASES="${ALIASES} nvlc"
3681   ], [
3682     AS_IF([test -n "${enable_ncurses}"], [
3683       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3684     ])
3685   ])
3686 ])
3687
3688 dnl
3689 dnl  Lirc plugin
3690 dnl
3691 AC_ARG_ENABLE(lirc,
3692   [  --enable-lirc           lirc support (default disabled)])
3693 if test "${enable_lirc}" = "yes"
3694 then
3695   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
3696   if test "${have_lirc}" = "true"
3697   then
3698     VLC_ADD_PLUGIN([lirc])
3699     VLC_ADD_LIBS([lirc],[-llirc_client])
3700   fi
3701 fi
3702
3703 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3704 dnl
3705 dnl  goom visualization plugin
3706 dnl
3707 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3708
3709 dnl
3710 dnl libprojectM visualization plugin
3711 dnl
3712 AC_ARG_ENABLE(projectm,
3713   [  --enable-projectm       projectM visualization plugin (default enabled)])
3714 AS_IF([test "${enable_projectm}" != "no"],
3715   [
3716     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3717     [
3718       VLC_ADD_PLUGIN([projectm])
3719       VLC_ADD_CXXFLAGS([projectm],[$PROJECTM_CFLAGS])
3720       VLC_ADD_LIBS([projectm],[$PROJECTM_LIBS])
3721       PKG_CHECK_MODULES(PROJECTM2, [libprojectM >= 2.0.0],
3722         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3723         [ AC_MSG_WARN( [Using libprojectM version 1] )
3724       ])
3725     ],[
3726       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3727     ])
3728   ])
3729
3730 dnl
3731 dnl Vovoid VSXu visualization plugin
3732 dnl
3733 AC_ARG_ENABLE(vsxu,
3734   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3735 AS_IF([test "${enable_vsxu}" != "no"],
3736   [
3737     PKG_CHECK_MODULES(VSXU, libvsxu,
3738     [
3739       VLC_ADD_PLUGIN([vsxu])
3740       VLC_ADD_CXXFLAGS([vsxu],[$VSXU_CFLAGS])
3741       VLC_ADD_LIBS([vsxu],[$VSXU_LIBS])
3742     ],[
3743       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3744     ])
3745   ])
3746
3747 dnl
3748 dnl  AtmoLight (homemade Philips Ambilight clone)
3749 dnl
3750 AC_ARG_ENABLE(atmo,
3751 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
3752                 (default enabled)]),, [enable_atmo="yes"])
3753 AS_IF([test "${enable_atmo}" != no], [
3754   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
3755     AC_LANG_PUSH(C++)
3756     VLC_ADD_PLUGIN([atmo])
3757     AC_LANG_POP(C++)
3758   ])
3759 ])
3760
3761 EXTEND_HELP_STRING([Service Discovery plugins:])
3762 dnl
3763 dnl  Bonjour services discovery
3764 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3765
3766 dnl
3767 dnl  libudev services discovery
3768 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3769
3770 dnl
3771 dnl MTP devices services discovery
3772 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3773
3774 dnl
3775 dnl UPnP Plugin (Intel SDK)
3776 dnl
3777 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
3778 VLC_ADD_CXXFLAGS([upnp],[${UPNP_CFLAGS}])
3779
3780 EXTEND_HELP_STRING([Misc options:])
3781
3782 dnl
3783 dnl  libxml2 module
3784 dnl
3785 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
3786
3787
3788 dnl
3789 dnl libgcrypt
3790 dnl
3791 AC_ARG_ENABLE(libgcrypt,
3792   [  --disable-libgcrypt     gcrypt support (default enabled)])
3793 AS_IF([test "${enable_libgcrypt}" != "no"], [
3794   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
3795     libgcrypt-config --version >/dev/null || \
3796         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
3797     AC_CHECK_LIB(gcrypt, gcry_control, [
3798       have_libgcrypt="yes"
3799       GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
3800       GCRYPT_LIBS="`libgcrypt-config --libs`"
3801     ], [
3802       AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
3803     ], [`libgcrypt-config --libs`])
3804   ], [
3805     AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
3806   ], [#include <gcrypt.h>]
3807   )
3808 ])
3809
3810 AC_SUBST(GCRYPT_CFLAGS)
3811 AC_SUBST(GCRYPT_LIBS)
3812 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
3813
3814 dnl
3815 dnl TLS/SSL
3816 dnl
3817 AC_ARG_ENABLE(gnutls,
3818   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
3819
3820 AS_IF([test "${have_libgcrypt}" != "yes"], [
3821   AS_IF([test "${enable_gnutls}" = "yes"], [
3822     AC_MSG_ERROR([--enable-gnutls and --disable-libgcrypt are mutually exclusive.])
3823   ])
3824   enable_gnutls="no"
3825 ])
3826 AS_IF([test "${enable_gnutls}" != "no"], [
3827   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 2.6.6], [
3828     VLC_ADD_PLUGIN([gnutls])
3829   ], [
3830     AS_IF([test -n "${enable_gnutls}"], [
3831       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
3832     ])
3833   ])
3834 ])
3835
3836
3837 dnl
3838 dnl Nokia MCE plugin (Maemo screen unblanking)
3839 dnl
3840 PKG_CHECK_MODULES([MCE], [dbus-1 mce], [VLC_ADD_PLUGIN([mce])], [true])
3841
3842
3843 AS_IF([test -f "/etc/maemo_version"], [
3844   AC_DEFINE([HAVE_MAEMO], 1, [Define to 1 if building for the Maemo platform.])
3845 ])
3846
3847
3848 dnl
3849 dnl Taglib plugin
3850 dnl
3851 AC_ARG_ENABLE(taglib,
3852   [AS_HELP_STRING([--disable-taglib],
3853     [do not use TagLib (default enabled)])])
3854 AS_IF([test "${enable_taglib}" != "no"], [
3855   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.6.1, [
3856     VLC_ADD_PLUGIN([taglib])
3857     VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
3858     VLC_ADD_CXXFLAGS([taglib],[$TAGLIB_CFLAGS])
3859   ], [
3860     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
3861 ])
3862
3863
3864 dnl
3865 dnl update checking system
3866 dnl
3867 AC_ARG_ENABLE(update-check,
3868   [  --enable-update-check   update checking system (default disabled)])
3869 if test "${enable_update_check}" = "yes"
3870 then
3871   if test "${have_libgcrypt}" != "yes"
3872   then
3873     AC_MSG_ERROR([libgcrypt is required for update checking system])
3874   fi
3875   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
3876   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
3877   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
3878 fi
3879
3880 dnl
3881 dnl Growl notification plugin
3882 dnl
3883 AC_ARG_ENABLE(growl,
3884   [  --enable-growl          growl notification plugin (default disabled)],,
3885   [enable_growl=no])
3886 AS_IF([test "${enable_growl}" != "no"], [
3887     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
3888       VLC_ADD_PLUGIN([growl])
3889       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
3890       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
3891       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
3892     ])
3893   ]
3894 )
3895
3896 dnl
3897 dnl Libnotify notification plugin
3898 dnl
3899 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
3900
3901 dnl
3902 dnl media library
3903 dnl
3904 AC_ARG_ENABLE(media-library,
3905     [  --enable-media-library  media library (default disabled)])
3906 AS_IF([test "${enable_media_library}" = "yes"], [
3907   AC_DEFINE([MEDIA_LIBRARY], 1, [Define if you want to use the VLC media library])
3908   VLC_ADD_CPPFLAGS([qt4],"-DMEDIA_LIBRARY")
3909   VLC_ADD_PLUGIN([media_library])
3910
3911 dnl
3912 dnl SQLite
3913 dnl
3914   AS_IF([test "${SYS}" != "darwin"], [
3915     PKG_ENABLE_MODULES_VLC([SQLITE], [], [sqlite3 >= 3.6.0], [sqlite3], [auto])
3916   ], [
3917     AS_IF([test "${enable_sqlite}" != "no"], [
3918       AC_CHECK_HEADERS(sqlite3.h, [
3919         VLC_ADD_PLUGIN([sqlite])
3920         VLC_ADD_LIBS([sqlite], [-lsqlite3])
3921       ], [
3922         AC_MSG_ERROR([sqlite3 is required for the media library])
3923       ])
3924     ])
3925   ])
3926 ])
3927
3928
3929 dnl
3930 dnl  Endianness check
3931 dnl
3932 AC_C_BIGENDIAN
3933 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
3934   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
3935 ], [
3936   DEFS_BIGENDIAN=""
3937 ])
3938 AC_SUBST(DEFS_BIGENDIAN)
3939
3940 dnl
3941 dnl Where to install KDE solid .desktop
3942 dnl
3943 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
3944 AS_IF([test "x$KDE4_CONFIG" = "x"], [
3945   KDE4_CONFIG="kde4-config"
3946 ])
3947
3948 AC_ARG_WITH(kde-solid,
3949   AS_HELP_STRING([--with-kde-solid=PATH],
3950                  [KDE Solid actions directory (auto)]),, [
3951
3952 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
3953   with_kde_solid="yes"
3954 fi
3955 ])
3956 soliddatadir=""
3957 AS_IF([test "${with_kde_solid}" != "no"], [
3958   AS_IF([test "${with_kde_solid}" = "yes"], [
3959     kde4datadir="`${KDE4_CONFIG} --install data`"
3960     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
3961     soliddatadir="${kde4datadir}/solid/actions"
3962   ], [
3963     soliddatadir="${with_kde_solid}"
3964   ])
3965 ])
3966 AC_SUBST(soliddatadir)
3967 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
3968
3969 dnl
3970 dnl  DLL loader copied from MPlayer copied from somewhere else (WINE ?)
3971 dnl
3972 loader=false
3973 AC_ARG_ENABLE(loader,
3974   AS_HELP_STRING([--enable-loader],[build DLL loader for ELF i386 platforms
3975           (default disabled)]))
3976 AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
3977 AS_IF([test "${enable_loader}" = "yes"],
3978   [ VLC_ADD_PLUGIN([dmo])
3979     VLC_ADD_CPPFLAGS([dmo quicktime ],[-I\\\$(srcdir)/loader])
3980     VLC_ADD_LIBS([dmo quicktime ],[libloader.la])
3981     VLC_ADD_LIBS([dmo quicktime], [-lpthread])
3982   ])
3983
3984 EXTEND_HELP_STRING([Components:])
3985
3986 dnl
3987 dnl  the VLC binary
3988 dnl
3989 AC_ARG_ENABLE(vlc,
3990   [  --enable-vlc            build the VLC media player (default enabled)])
3991 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
3992
3993 AC_ARG_ENABLE(macosx-vlc-app,
3994   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
3995 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
3996     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
3997
3998 dnl
3999 dnl  Stuff used by the program
4000 dnl
4001 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4002 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4003 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4004 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4005 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4006 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4007 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4008 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4009 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4010 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4011 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4012 AC_SUBST(COPYRIGHT_MESSAGE)
4013 AC_SUBST(VERSION_MESSAGE)
4014 AC_SUBST(VERSION_MAJOR)
4015 AC_SUBST(VERSION_MINOR)
4016 AC_SUBST(VERSION_REVISION)
4017 AC_SUBST(VERSION_EXTRA)
4018 AC_SUBST(COPYRIGHT_YEARS)
4019 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4020 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4021 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4022 dnl
4023 dnl  Handle substvars that use $(top_srcdir)
4024 dnl
4025 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4026
4027 dnl
4028 dnl  Configuration is finished
4029 dnl
4030 AC_SUBST(SYS)
4031 AC_SUBST(ARCH)
4032 AC_SUBST(ALIASES)
4033 AC_SUBST(ASM)
4034 AC_SUBST(MOC)
4035 AC_SUBST(RCC)
4036 AC_SUBST(UIC)
4037 AC_SUBST(WINDRES)
4038 AC_SUBST(WINE_SDK_PATH)
4039 AC_SUBST(LIBEXT)
4040 AC_SUBST(AM_CPPFLAGS)
4041 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4042 AC_SUBST(FILE_LIBVLCCORE_DLL)
4043 AC_SUBST(FILE_LIBVLC_DLL)
4044
4045 AC_CONFIG_FILES([
4046   Makefile
4047   doc/Makefile
4048   modules/Makefile
4049   m4/Makefile
4050   po/Makefile.in
4051   share/Makefile
4052   compat/Makefile
4053   src/Makefile
4054   lib/Makefile
4055   bin/Makefile
4056   test/Makefile
4057   modules/access/Makefile
4058   modules/access/rtp/Makefile
4059   modules/access_output/Makefile
4060   modules/audio_filter/Makefile
4061   modules/audio_mixer/Makefile
4062   modules/audio_output/Makefile
4063   modules/codec/Makefile
4064   modules/control/Makefile
4065   modules/demux/Makefile
4066   modules/gui/Makefile
4067   modules/gui/macosx/Makefile
4068   modules/gui/minimal_macosx/Makefile
4069   modules/gui/macosx_dialog_provider/Makefile
4070   modules/gui/qt4/Makefile
4071   modules/gui/skins2/Makefile
4072   modules/lua/Makefile
4073   modules/meta_engine/Makefile
4074   modules/misc/Makefile
4075   modules/media_library/Makefile
4076   modules/mux/Makefile
4077   modules/notify/Makefile
4078   modules/packetizer/Makefile
4079   modules/services_discovery/Makefile
4080   modules/stream_filter/Makefile
4081   modules/stream_out/Makefile
4082   modules/text_renderer/Makefile
4083   modules/video_chroma/Makefile
4084   modules/video_filter/Makefile
4085   modules/video_output/Makefile
4086   modules/visualization/Makefile
4087   modules/mmx/Makefile
4088   modules/sse2/Makefile
4089   modules/altivec/Makefile
4090   modules/arm_neon/Makefile
4091 ])
4092
4093 AM_COND_IF([HAVE_WIN32], [
4094   AC_CONFIG_FILES([
4095     extras/package/win32/spad.nsi
4096     extras/package/win32/vlc.win32.nsi
4097   ])
4098 ])
4099
4100 AM_COND_IF([HAVE_DARWIN], [
4101   AC_CONFIG_FILES([
4102     extras/package/macosx/Info.plist
4103     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4104   ])
4105 ])
4106
4107 dnl Generate makefiles
4108 AC_OUTPUT
4109
4110 dnl Do we have to use make or gmake ?
4111 if make --version 2>&1|grep -q GNU
4112 then
4113     # GNU make, all seems good
4114     MAKE=make
4115 else
4116     # Known GNU make alias (on BSD)
4117     MAKE=gmake
4118 fi
4119 dnl Shortcut to nice compile message
4120 if test -n $SHELL; then
4121   SHELL=${CONFIG_SHELL-/bin/sh}
4122 fi
4123 rm -f compile
4124 echo "#! $SHELL
4125 rm -f .error\$\$
4126 ERROR=0
4127 export PATH=\"$PATH\" LANG=C
4128 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| `sed -ne \"s/^top_srcdir *= *//p\" < Makefile`/extras/buildsystem/make.pl
4129 test -f .error\$\$ && ERROR=1
4130 rm -f .error\$\$
4131 exit \$ERROR" >compile
4132 chmod a+x compile
4133
4134 echo "
4135 libvlc configuration
4136 --------------------
4137 version               : ${VERSION}
4138 system                : ${SYS}
4139 architecture          : ${ARCH}
4140 optimizations         : ${enable_optimizations}"
4141 if test "${enable_vlc}" != "no"; then
4142 echo "vlc aliases           :${ALIASES}"
4143 else
4144 echo "build vlc executable  : no"
4145 fi
4146 echo "
4147 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."