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