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