codec: avcodec: keep the projection mode information from the demux
[vlc.git] / configure.ac
blobc8900d216540816224e872bef46fbcc93d83ca41
1 dnl Autoconf settings for vlc
3 AC_COPYRIGHT([Copyright 1999-2016 VLC authors and VideoLAN])
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
12 PKGDIR="vlc"
13 AC_SUBST(PKGDIR)
15 CONFIGURE_LINE="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`"
16 CODENAME="Vetinari"
17 COPYRIGHT_YEARS="1996-2016"
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
27 AM_INIT_AUTOMAKE(tar-ustar color-tests foreign)
28 AC_CONFIG_HEADERS([config.h])
30 AM_SILENT_RULES([yes])
31 AM_MAINTAINER_MODE([enable])
33 dnl
34 dnl Directories
35 dnl
36 dnl vlcincludedir="\${includedir}/\${PKGDIR}"
37 dnl AC_SUBST(vlcincludedir)
38 vlcdatadir="\${datadir}/\${PKGDIR}"
39 AC_SUBST(vlcdatadir)
40 vlclibdir="\${libdir}/\${PKGDIR}"
41 AC_SUBST(vlclibdir)
43 dnl
44 dnl Check for tools
45 dnl
46 AC_PROG_CC_C99
47 AC_USE_SYSTEM_EXTENSIONS
48 VLC_PROG_CC_C11
49 AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.])
50 AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
51 AH_TOP([
52 #ifndef _REENTRANT
53 # define _REENTRANT
54 #endif
56 AC_DEFINE([_THREAD_SAFE],, [Same as _REENTANT for some other OSes.])
57 AC_DEFINE([__LIBVLC__],, [Define within the LibVLC source code tree.])
58 AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])
60 AM_PROG_CC_C_O
61 AC_PROG_CXX
62 AC_PROG_CPP
63 AC_PROG_OBJC
64 _AM_DEPENDENCIES([OBJC])
65 AC_PROG_EGREP
66 AC_PROG_MAKE_SET
67 AC_PROG_INSTALL
68 AM_PROG_AS
70 AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
71 AC_CHECK_PROGS(DESKTOP_FILE_VALIDATE, [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
72 AC_ARG_VAR([BUILDCC], [Build system C11 or C99 compiler command])
73 AC_CHECK_PROGS(BUILDCC, [c11-gcc c11 c99-gcc c99], [false])
74 AS_IF([test "$BUILDCC" = "false"], [
75   AC_MSG_ERROR([Cannot find native C99 compiler: please define BUILDCC.])
78 dnl Check for compiler properties
79 AC_C_CONST
80 AC_C_INLINE
81 AC_C_RESTRICT
82 AX_CXX_COMPILE_STDCXX_11(noext, mandatory)
84 dnl Extend the --help string at the current spot.
85 AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
87 dnl Allow binary package maintainer to pass a custom string to avoid
88 dnl cache problem
89 AC_ARG_WITH(binary-version,
90     AS_HELP_STRING([--with-binary-version=STRING],
91          [To avoid plugins cache problem between binary version]),[],[])
92 AS_IF([test -n "${with_binary_version}"],[
93     AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
94          [Binary specific version])
97 dnl
98 dnl  Check the operating system
99 dnl
100 HAVE_WIN64="0"
101 HAVE_IOS="0"
102 HAVE_OSX="0"
103 HAVE_TVOS="0"
105 case "${host_os}" in
106   "")
107     SYS=unknown
108     ;;
109   linux*)
110     SYS=linux
111     ;;
112   bsdi*)
113     SYS=bsdi
114     CFLAGS="${CFLAGS} -pthread"
115     ;;
116   freebsd*)
117     SYS=freebsd
118     CFLAGS="${CFLAGS} -pthread"
119     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
120     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
121     ac_cv_ld_z_defs=no
122     ;;
123   openbsd*)
124     SYS=openbsd
125     CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/X11R6/include"
126     LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/X11R6/lib/"
127     ;;
128   netbsd*)
129     SYS=netbsd
130     ;;
131   dragonfly*)
132     SYS=dragonfly
133     ;;
134   darwin*)
136     dnl Force gcc "-arch" flag
137     ARCH_flag=""
138     case "${host}" in
139       i?86*)
140         ARCH_flag="-arch i386"
141       ;;
142       ppc64*)
143         ARCH_flag="-arch ppc64"
144       ;;
145       ppc*)
146         ARCH_flag="-arch ppc"
147       ;;
148       x86_64*)
149         ARCH_flag="-arch x86_64"
150       ;;
151       arm*)
152         ac_cv_c_bigendian="no"
153         ac_cv_c_attribute_packed="no"
154       ;;
155     esac
157     SYS=darwin
158     CFLAGS="${CFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu11 ${ARCH_flag}"
159     CXX="${CXX} -stdlib=libc++ -std=c++11"
160     CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
161     CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
162     OBJCFLAGS="${OBJCFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu11 ${ARCH_flag}"
163     LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
164     VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup,-framework,AppKit])
165     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,CoreServices])
167     AC_EGREP_CPP(yes,
168             [#import <TargetConditionals.h>
169              #if TARGET_OS_IPHONE
170              yes
171              #endif],
172              [HAVE_IOS="1"],
173              [HAVE_OSX="1"])
175     AC_EGREP_CPP(yes,
176             [#import <TargetConditionals.h>
177              #if TARGET_OS_TV
178              yes
179              #endif],
180              [HAVE_TVOS="1"
181              HAVE_IOS="0"
182              HAVE_OSX="0"
183              ],)
185     dnl Allow binaries created on Lion to run on earlier releases
186     AC_EGREP_CPP(yes,
187            [#import <Cocoa/Cocoa.h>
188             #ifdef MAC_OS_X_VERSION_10_7
189             yes
190             #endif],
191             [AC_MSG_RESULT([yes])
192             AC_LIBOBJ([getdelim])
193             AC_LIBOBJ([strndup])
194             AC_LIBOBJ([strnlen])],)
196     dnl
197     dnl  Handle Mac OS X SDK flags
198     dnl
199     AC_ARG_WITH(macosx-sdk,
200       [AS_HELP_STRING([--with-macosx-sdk=DIR],
201         [compile using the SDK in DIR])])
202     if test "${with_macosx_sdk}" != "" ; then
203         test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
204         CPP="${CPP} -isysroot ${with_macosx_sdk}"
205         CC="${CC} -isysroot ${with_macosx_sdk}"
206         CXX="${CXX} -isysroot ${with_macosx_sdk}"
207         OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
208         LD="${LD} -syslibroot ${with_macosx_sdk}"
209     fi
210     AC_ARG_WITH(macosx-version-min,
211       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
212         [compile for Mac OS X VERSION and above])])
213     if test "${with_macosx_version_min}" != "" ; then
214         CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
215         CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
216         CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
217         OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
218         LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
219     fi
220     ;;
221   *mingw32* | *cygwin* | *wince* | *mingwce*)
222     dnl Force libtool to not link to (shared) libgcc_s when detecting C++ dependencies
223     dnl When doing this test with -static-libgcc it will link on (static) libgcc_eh
224     CXXFLAGS="${CXXFLAGS} -static-libgcc"
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.])
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
257     if test "${SYS}" = "mingw32"; then
258         # DEP, ASLR, NO SEH
259         LDFLAGS="${LDFLAGS} -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase"
261         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
262         ac_default_prefix="`pwd`/_win32"
263         DESTDIR="`pwd`/_win32/"
265         dnl
266         dnl NSIS/MSI Installer prefix and WIN64
267         dnl
268         case "${host}" in
269             amd64*|x86_64*)
270                 HAVE_WIN64="1"
271                 WINDOWS_ARCH="x64"
272                 PROGRAMFILES="PROGRAMFILES64"
273                 LDFLAGS="${LDFLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x140000000"
274             ;;
275             *)
276                 WINDOWS_ARCH="x86"
277                 PROGRAMFILES="PROGRAMFILES"
278             ;;
279         esac
280         AC_SUBST(WINDOWS_ARCH)
281         AC_SUBST(PROGRAMFILES)
283     fi
284     ;;
285   *nto*)
286     SYS=nto
287     ;;
288   solaris*)
289     SYS=solaris
290     ;;
291   hpux*)
292     SYS=hpux
293     ;;
294   *os2*)
295     SYS=os2
296     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild -Zhigh-mem"
297     AC_LIBOBJ([freeaddrinfo])
298     AC_LIBOBJ([gai_strerror])
299     ;;
300   *)
301     SYS="${host_os}"
302     ;;
303 esac
305 dnl WinRT
306 AC_ARG_ENABLE(winstore_app,
307      AS_HELP_STRING([--enable-winstore-app],
308                     [Build targetted for Windows Store apps (default disabled)]))
310 vlc_winstore_app=0
311 AS_IF([test "${SYS}" = "mingw32"],[
312   LIBCOM="-lole32"
313   AS_IF([test "${enable_winstore_app}" = "yes"], [
314     vlc_winstore_app=1
315     LIBCOM=""
316      VLC_ADD_LIBS([libvlccore], [-lruntimeobject])
317      AC_LIBOBJ([gai_strerror])
318     ],[
319      VLC_ADD_LIBS([libvlccore],[-lwinmm])
320     ])
321   AC_SUBST(LIBCOM)
322   ])
323 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
325 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
326 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
328 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
329 AM_CONDITIONAL(HAVE_IOS,     test "${HAVE_IOS}" = "1")
330 AM_CONDITIONAL(HAVE_OSX,     test "${HAVE_OSX}" = "1")
331 AM_CONDITIONAL(HAVE_TVOS,    test "${HAVE_TVOS}" = "1")
333 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
334 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1") dnl Only used for the packaging
335 AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])
336 AM_CONDITIONAL([HAVE_WIN32_DESKTOP], [test "${SYS}" = "mingw32" -a "$vlc_winstore_app" = "0"])
339 dnl Sadly autoconf does not think about testing foo.exe when ask to test
340 dnl for program foo on win32
341 case "${build_os}" in
342     cygwin|msys|mingw32)
343         ac_executable_extensions=".exe"
344     ;;
345     os2*)
346         BUILDEXEEXT=".exe"
347     ;;
348     *)
349     ;;
350 esac
351 AC_SUBST(BUILDEXEEXT)
353 dnl Android is linux, but a bit different
354 AS_IF([test "$SYS" = linux],[
355     AC_MSG_CHECKING([for an Android system])
356     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
357         [[#ifndef __ANDROID__
358          # error Not Android
359          #endif
360         ]],[[;]])
361     ],[
362       HAVE_ANDROID="1"
363       AC_MSG_RESULT([yes])
364     ],[
365       AC_MSG_RESULT([no])
366     ])
368 AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
370 dnl Tizen (minimum SDK version: 2.3)
371 AS_IF([test "$SYS" = linux],[
372     AC_MSG_CHECKING([for Tizen])
373     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
374         [[#include <tizen.h>
375         ]],[[;]])
376     ],[
377       HAVE_TIZEN="1"
378       AC_DEFINE([HAVE_TIZEN_SDK], [1], [Define to 1 if vlc is built against Tizen SDK])
379       AC_MSG_RESULT([yes])
380     ],[
381       AC_MSG_RESULT([no])
382     ])
384 AM_CONDITIONAL(HAVE_TIZEN, test "${HAVE_TIZEN}" = "1")
387 dnl  Check for the contrib directory
389 AC_ARG_WITH(contrib,
390   [AS_HELP_STRING([--with-contrib[=DIR]],
391     [search for 3rd party libraries in DIR/include and DIR/lib])
393 AC_MSG_CHECKING([for 3rd party libraries path])
394 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
395   CONTRIB_DIR="${srcdir}/contrib/${host}"
396   AS_IF([test ! -d "${CONTRIB_DIR}"], [
397     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
398     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
399     AS_IF([test ! -d "${CONTRIB_DIR}"], [
400       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
401       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
402       AS_IF([test ! -d "${CONTRIB_DIR}"], [
403         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
404         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
405         AS_IF([test ! -d "${CONTRIB_DIR}"], [
406           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
407           CONTRIB_DIR=""
408           AC_MSG_RESULT([not found])
409         ])
410       ])
411     ])
412   ])
413 ], [
414   AS_IF([test "${with_contrib}" != "no"], [
415     CONTRIB_DIR="${with_contrib}"
416   ], [
417     CONTRIB_DIR=""
418     AC_MSG_RESULT([disabled])
419   ])
421 AS_IF([test -n "${CONTRIB_DIR}"], [
422   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
423     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
424   ], [
425     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
426     CONTRIB_DIR=""
427     AC_MSG_RESULT([not usable])
428   ])
431 AS_IF([test -n "${CONTRIB_DIR}"], [
432   AC_MSG_RESULT([${CONTRIB_DIR}])
433   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
434   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
435   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
436   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
437   export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
438   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
440   AS_IF([test -z "$LUAC"], [
441     dnl Old contribs mixed cross-tools and cross-compiled executables
442     AS_IF([test -x "${CONTRIB_DIR}/bin/luac"], [
443       LUAC="${CONTRIB_DIR}/bin/luac"
444     ])
446     dnl Newer contribs follow usual name space rules
447     AS_IF([test -x "${CONTRIB_DIR}/../bin/${host_alias}-luac"], [
448       LUAC="${CONTRIB_DIR}/../bin/${host_alias}-luac"
449     ])
450   ])
452   AS_IF([test "${SYS}" = "darwin"], [
453     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
454     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
455   ])
456 ], [
457   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
458     AC_MSG_ERROR([Third party libraries not found!])
459   ])
461 AC_SUBST(CONTRIB_DIR)
463 dnl Add extras/tools to the PATH
464 TOOLS_DIR="${srcdir}/extras/tools/build/bin"
465 AS_IF([test -d "${TOOLS_DIR}"], [
466     TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
467     export PATH="${TOOLS_DIR}":$PATH
471 dnl  Libtool
472 dnl  It's very bad, but our former custom system was worst
473 dnl  -- Courmisch
476 dnl override platform specific check for dependent libraries
477 dnl otherwise libtool linking of shared libraries will
478 dnl fail on anything other than pass_all.
479 AC_CACHE_VAL(lt_cv_deplibs_check_method,
480     [lt_cv_deplibs_check_method=pass_all])
482 LT_INIT([dlopen win32-dll shared disable-static])
483 LT_LANG([C++])
484 LT_LANG([Windows Resource])
486 DOLT
488 lt_cv_deplibs_check_method=pass_all
490 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
491   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
495 dnl Gettext stuff
497 AM_GNU_GETTEXT_VERSION([0.19.8])
498 AM_GNU_GETTEXT([external], [need-formatstring-macros])
501 dnl Iconv stuff
503 AM_ICONV
506 dnl checks for mingw
507 AS_IF([test "${SYS}" = "mingw32"], [
509 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
510 #if !defined(__MINGW32__)
511 # error Not compiling with mingw
512 #endif
513     ])], [
515 dnl Check for broken versions of mingw-runtime compatability library
516     AC_MSG_CHECKING(for broken mingw-runtime)
517     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
518 #include <_mingw.h>
519 #if defined(__MINGW64_VERSION_MAJOR)
520 # if __MINGW64_VERSION_MAJOR < 3
521 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
522 # endif
523 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
524 # error Attempting to use mingw-runtime with broken vsnprintf support
525 #endif
526     ])], [
527         AC_MSG_RESULT([ok])
528     ], [
529         AC_MSG_RESULT([present])
530         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
531     ])
533     dnl force use of mingw provided c99 *printf over msvcrt
534     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
536     dnl Add WinMainCRTStartup entry point to show it's a WinMain application
537     VLC_ADD_LDFLAGS([vlc],[-mwindows])
539     dnl Check for the need to include the mingwex lib for mingw32
540     VLC_SAVE_FLAGS
541     AC_CHECK_LIB(mingwex,opendir,
542         AC_CHECK_LIB(mingw32,opendir,,
543             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
544     )
545     VLC_RESTORE_FLAGS
546     ], [
547         AC_MSG_RESULT([Not compiling with mingw])
548     ])
550     dnl Check for fnative-struct or mms-bitfields support for mingw32
551     VLC_SAVE_FLAGS
552     CFLAGS="${CFLAGS} -mms-bitfields"
553     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
554     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
555         [ac_cv_c_mms_bitfields],
556         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
557     if test "${ac_cv_c_mms_bitfields}" = "no"; then
558         VLC_RESTORE_FLAGS
559         CFLAGS="${CFLAGS} -fnative-struct"
560         CXXFLAGS="${CXXFLAGS} -fnative-struct"
561         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
562             [ac_cv_c_fnative_struct],
563             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
564         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
565     fi
570 dnl Buggy glibc prevention. Purposedly not cached.
571 dnl See sourceware.org bugs 5058 and 5443.
572 dnl Ubuntu alone has 20 bug numbers for this...
574 AC_MSG_CHECKING(for buggy GNU/libc versions)
575 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
576 #include <limits.h>
577 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
578   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
579 # error GNU/libc with dcgettext killer bug!
580 #endif
581 ])], [
582   AC_MSG_RESULT([not present])
583 ], [
584   AC_MSG_RESULT([found])
585   AS_IF([test "x${enable_nls}" != "xno"], [
586     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
587 work-around for this. Check with your distribution vendor on how to update the
588 glibc run-time. Alternatively, build with --disable-nls.])
589   ])
592 dnl Plugin compilation stuff
594 VLC_LIBRARY_SUFFIX
596 dnl Check for system libs needed
597 need_libc=false
599 dnl Check for usual libc functions
600 AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime tdestroy uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock])
601 AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp])
602 AC_REPLACE_FUNCS([gettimeofday])
603 AC_CHECK_FUNC(fdatasync,,
604   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
607 VLC_REPLACE_DECL([realpath], [#include <stdlib.h>])
609 dnl mingw64 implements those as static inline, not functions with C linkage
610 VLC_REPLACE_DECL([asprintf], [#include <stdio.h>])
611 VLC_REPLACE_DECL([vasprintf], [#include <stdio.h>])
612 VLC_REPLACE_DECL([gmtime_r], [#include <time.h>])
613 VLC_REPLACE_DECL([localtime_r], [#include <time.h>])
615 dnl C11 static_assert()
616 AC_MSG_CHECKING([for static_assert in assert.h])
617 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
618 static_assert(1, "The impossible happened.");
619 ])], [
620   AC_MSG_RESULT([yes])
621   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
622 ], [
623   AC_MSG_RESULT([no])
626 # Windows CE does not have strcoll()
627 AC_FUNC_STRCOLL
629 dnl Check for non-standard system calls
630 case "$SYS" in
631   "linux")
632     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity recvmmsg])
633     ;;
634   "mingw32")
635     AC_CHECK_FUNCS([_lock_file])
636     ;;
637 esac
639 AH_BOTTOM([#include <vlc_fixups.h>])
641 dnl Check for struct pollfd
642 AC_CHECK_TYPES([struct pollfd],,,
643 [#include <sys/types.h>
644 #if HAVE_POLL
645 # include <poll.h>
646 #elif defined (_WIN32)
647 # include <winsock2.h>
648 #endif
651 dnl Check for struct timespec
652 AC_CHECK_TYPES([struct timespec],,,
653 [#include <time.h>])
655 dnl Check for max_align_t
656 AC_CHECK_TYPES([max_align_t],,,
657 [#include <stddef.h>])
659 dnl Checks for socket stuff
660 VLC_SAVE_FLAGS
661 SOCKET_LIBS=""
662 AC_SEARCH_LIBS(connect, [socket], [
663   AS_IF([test "$ac_cv_search_connect" != "none required"], [
664     SOCKET_LIBS="$ac_cv_search_connect"
665   ])
666 ], [
667   AS_IF([test "${SYS}" = "mingw32"], [
668     SOCKET_LIBS="-lws2_32"
669   ])
672 AC_SEARCH_LIBS([inet_pton], [nsl], [
673  AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [
674     SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS"
675   ])
676 ],, [${SOCKET_LIBS}])
678 LIBS="${LIBS} ${SOCKET_LIBS}"
679 AC_LINK_IFELSE([
680     AC_LANG_PROGRAM([#ifdef _WIN32
681         # if _WIN32_WINNT < 0x600
682         #  error Needs vista+
683         # endif
684         #include <ws2tcpip.h>
685         #else
686         #include <sys/socket.h>
687         #include <arpa/inet.h>
688         #endif], [
689         char dst[[sizeof(struct in_addr)]];
690         inet_pton(AF_INET, "127.0.0.1", dst);
691     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
692 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
693 VLC_RESTORE_FLAGS
694 AC_SUBST(SOCKET_LIBS)
696 dnl Check for socklen_t
697 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
698 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
699 ac_cv_type_socklen_t,
700 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
701 [#include <sys/types.h>
702 #ifdef _WIN32
703 # include <winsock2.h>
704 # include <ws2tcpip.h>
705 #else
706 # include <sys/socket.h>
707 #endif]], [[socklen_t len; len = 0;]])],
708 ac_cv_type_socklen_t=yes,
709 ac_cv_type_socklen_t=no)])
710 AS_IF([test "$ac_cv_type_socklen_t" = no],
711  [AC_DEFINE(socklen_t, int)])
713 dnl Check for struct sockaddr_storage
714 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
715 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
716 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
717   [AC_TRY_COMPILE(
718     [#include <sys/types.h>
719      #if defined( _WIN32 )
720      # include <winsock2.h>
721      #else
722      # include <sys/socket.h>
723      #endif], [struct sockaddr_storage addr;],
724      ac_cv_struct_sockaddr_storage=yes,
725      ac_cv_struct_sockaddr_storage=no)])
726 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
727   AC_DEFINE(sockaddr_storage, sockaddr)
728   AC_DEFINE(ss_family, sa_family)
731 dnl FreeBSD has a gnugetopt library for this:
732 GNUGETOPT_LIBS=""
733 AC_CHECK_FUNC(getopt_long,, [
734   AC_CHECK_LIB([gnugetopt],[getopt_long], [
735     GNUGETOPT_LIBS="-lgnugetopt"
736   ])
738 AC_SUBST(GNUGETOPT_LIBS)
740 AC_CHECK_LIB(m,cos,[
741   LIBM="-lm"
742 ], [
743   LIBM=""
745 AC_SUBST(LIBM)
747 AC_CHECK_LIB(m,lrintf, [
748   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
749   VLC_ADD_LIBS([skins2],[-lm])
751 AC_CHECK_LIB(m,nanf,
752   AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
755 dnl Check for dynamic plugins
756 LIBDL=""
757 have_dynamic_objects="no"
758 VLC_SAVE_FLAGS
759 AC_SEARCH_LIBS(dlsym, [dl svld], [
760   AS_IF([test "$ac_cv_search_dlsym" != "none required"], [
761     LIBDL="$ac_cv_search_dlsym"
762   ])
763   have_dynamic_objects="yes"
765 VLC_RESTORE_FLAGS
767 # Windows
768 AS_IF([test "${SYS}" = "mingw32"], [
769   LIBDL=""
770   have_dynamic_objects="yes" #assume we can use shared objects
773 AS_IF([test "${enable_shared}" = "no"], [
774   have_dynamic_objects=no
776 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
778 AC_SUBST(LIBDL)
780 dnl Check for thread library
781 LIBPTHREAD=""
782 AS_IF([test "${SYS}" != "mingw32"], [
783   VLC_SAVE_FLAGS
784   LIBS=""
785   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
786     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
787       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
788     ])
789   ])
790   VLC_RESTORE_FLAGS
792 AC_SUBST(LIBPTHREAD)
794 AC_SEARCH_LIBS([clock_nanosleep], [rt pthread], [
795   AS_IF([test "$ac_cv_search_clock_nanosleep" != "none required"], [
796     LIBRT="$ac_cv_search_clock_nanosleep"
797   ])
798 ], [
799   AC_SEARCH_LIBS([nanosleep], [rt pthread posix4], [
800     AS_IF([test "$ac_cv_search_nanosleep" != "none required"], [
801       LIBRT="$ac_cv_search_nanosleep"
802     ])
803   ])
805 AC_SUBST(LIBRT)
808 dnl Check for headers
811 dnl  POSIX
812 AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/shm.h sys/socket.h sys/uio.h])
813 AC_CHECK_HEADERS([net/if.h], [], [],
815 #include <sys/types.h>
816 #include <sys/socket.h>
818 AC_CHECK_HEADER([syslog.h], [have_syslog="yes"], [have_syslog="no"])
819 AM_CONDITIONAL([HAVE_SYSLOG], [test "$have_syslog" = "yes"])
821 dnl  BSD
822 AC_CHECK_HEADERS([netinet/udplite.h sys/param.h sys/mount.h])
824 dnl  GNU/Linux
825 AC_CHECK_HEADERS([features.h getopt.h linux/dccp.h linux/magic.h mntent.h sys/eventfd.h])
827 dnl  MacOS
828 AC_CHECK_HEADERS([xlocale.h])
830 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
831 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
832 AC_CHECK_TYPE(ssize_t,, [
833   AC_DEFINE(ssize_t, int)
836 dnl It seems that autoconf detects pkg-config only during the first
837 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
838 dnl it is nested within a conditional block, so it was not working right.
839 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
840 AC_ARG_VAR(PKG_CONFIG_PATH,
841        [Paths where to find .pc not at the default location])
842 PKG_PROG_PKG_CONFIG()
844 dnl On some OS we need static linking
845 AS_IF([test -n "${PKG_CONFIG}" ],[
846     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
847         PKG_CONFIG="${PKG_CONFIG} --static"
848     ])
853 dnl Check for zlib.h and -lz along with system -lminizip if available
855 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
856 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
857 if test "${have_zlib}" = "yes"
858 then
859   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
860   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
861     AC_CHECK_HEADERS([unzip.h], [
862       have_minizip=yes
863       MINIZIP_LIBS="-lminizip -lz"
864     ], [
865       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
866       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
867       have_minizip=no
868     ])
869   ])
870   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
871   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
873 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
877 dnl Domain name i18n support via GNU libidn
879 PKG_CHECK_MODULES([IDN], [libidn], [
880   have_libidn="yes"
881   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
882 ], [
883   have_libidn="no"
887 dnl Check for dbus
888 AC_ARG_ENABLE(dbus,
889   [AS_HELP_STRING([--enable-dbus],
890     [compile D-Bus message bus support (default enabled)])])
891 have_dbus="no"
892 AS_IF([test "${enable_dbus}" != "no"], [
893   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
894     have_dbus="yes"
895   ], [
896     AS_IF([test -n "${enable_dbus}"], [
897       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
898     ], [
899       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
900     ])
901   ])
903 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
906 dnl Check for systemd
907 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
908   have_systemd="yes"
909 ], [
910   AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
912 AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
915 dnl Check for ntohl, etc.
916 VLC_SAVE_FLAGS
917 CFLAGS="${CFLAGS} -Wall -Werror"
918 AC_CACHE_CHECK([for ntohl in sys/param.h],
919     [ac_cv_c_ntohl_sys_param_h],
920     [     AC_TRY_COMPILE([#include <sys/param.h>],
921         [int meuh; ntohl(meuh);],
922         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
923 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
924     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
926 VLC_RESTORE_FLAGS
928 EXTEND_HELP_STRING([Optimization options:])
930 dnl  Compiler warnings
933 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 init-self logical-op format-security])
934 RDC_PROG_CC_FLAGS([-pipe])
935 AC_LANG_PUSH([C++])
936 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var format-security])
937 AC_LANG_POP([C++])
940 dnl  Debugging mode
942 AC_ARG_ENABLE(debug,
943   [AS_HELP_STRING([--enable-debug],
944     [build with run-time assertions (default disabled)])],,
945   [enable_debug="no"])
946 AH_TEMPLATE(NDEBUG,
947             [Define to 1 if debug code should NOT be compiled])
948 AS_IF([test "${enable_debug}" != "no"], [
949   AC_CHECK_HEADERS([valgrind/valgrind.h])
950 ], [
951   AC_DEFINE(NDEBUG)
955 dnl  Profiling
957 AC_ARG_ENABLE(gprof,
958   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
959   [enable_gprof="no"])
960 AS_IF([test "${enable_gprof}" != "no"], [
961   CFLAGS="${CFLAGS} -pg"
962   CXXFLAGS="${CXXFLAGS} -pg"
963   OBJCFLAGS="${OBJCFLAGS} -pg"
964   LDFLAGS="${LDFLAGS} -pg"
967 AC_ARG_ENABLE(cprof,
968   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
969   [enable_cprof="no"])
970 AS_IF([test "${enable_gprof}" != "no"], [
971   CFLAGS="${CFLAGS} -finstrument-functions"
972   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
973   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
974   LDFLAGS="${LDFLAGS} -finstrument-functions"
978 dnl  Test coverage
980 AC_ARG_ENABLE(coverage,
981   [AS_HELP_STRING([--enable-coverage],
982     [build for test coverage (default disabled)])],,
983   [enable_coverage="no"])
984 AS_IF([test "${enable_coverage}" != "no"], [
985   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
986   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
987   LDFLAGS="-lgcov ${LDFLAGS}"
990 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
991   VLC_SAVE_FLAGS
992   CFLAGS="${CFLAGS} -fvisibility=hidden"
993   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
994   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
995   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
996                  [ac_cv_c_visibility_hidden], [
997     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
998       ac_cv_c_visibility_hidden=yes
999     ], [
1000       ac_cv_c_visibility_hidden=no
1001     ])
1002   ])
1003   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
1008 dnl  Enable/disable optimizations
1010 AC_ARG_ENABLE(optimizations,
1011   [AS_HELP_STRING([--disable-optimizations],
1012     [disable compiler optimizations (default enabled)])],,
1013   [enable_optimizations="yes"])
1015 dnl Check for various optimization flags
1016 AS_IF([test "${enable_optimizations}" != "no"], [
1018   dnl -O3 only in production builds
1019   AS_IF([test "${enable_debug}" = "no"], [
1020     VLC_SAVE_FLAGS
1021     CFLAGS="${CFLAGS} -O3"
1022     CXXFLAGS="${CXXFLAGS} -O3"
1023     OBJCFLAGS="${OBJCFLAGS} -O3"
1024     AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
1025       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1026         ac_cv_c_o3=yes
1027       ], [
1028         ac_cv_c_o3=no
1029       ])
1030     ])
1031     AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
1032   ])
1034   dnl Check for fast maths
1035   RDC_PROG_CC_FFLAGS([no-math-errno unsafe-math-optimizations no-rounding-math no-signaling-nans cx-limited-range])
1036   AC_LANG_PUSH(C++)
1037   RDC_PROG_CXX_FFLAGS([no-math-errno unsafe-math-optimizations no-rounding-math no-signaling-nans cx-limited-range])
1038   AC_LANG_POP
1040 AH_BOTTOM([
1041 #if defined(_MSC_VER) && !defined(__clang__)
1042 # pragma fenv_access(off)
1043 # pragma fp_contract(on)
1044 #elif defined(__GNUC__)
1045 /* Not supported so far */
1046 #else
1047 # pragma STDC FENV_ACCESS OFF
1048 # pragma STDC FP_CONTRACT ON
1049 #endif
1052   dnl Check for -funroll-loops
1053   VLC_SAVE_FLAGS
1054   CFLAGS="${CFLAGS} -funroll-loops"
1055   CXXFLAGS="${CXXFLAGS} -funroll-loops"
1056   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
1057   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
1058     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1059       ac_cv_c_unroll_loops=yes
1060     ], [
1061       ac_cv_c_unroll_loops=no
1062     ])
1063   ])
1064   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
1066   AS_IF([test "$enable_debug" = "no"], [
1067     dnl Check for -fomit-frame-pointer
1068     VLC_SAVE_FLAGS
1069     CFLAGS="${CFLAGS} -fomit-frame-pointer"
1070     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
1071     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
1072     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
1073       [ac_cv_c_omit_frame_pointer], [
1074       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1075         ac_cv_c_omit_frame_pointer=yes
1076       ], [
1077         ac_cv_c_omit_frame_pointer=no
1078       ])
1079     ])
1080     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1081   ])
1084 VLC_SAVE_FLAGS
1085 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1086 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1087   AC_TRY_LINK([],, [
1088     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1089   ], [
1090     ac_cv_ld_bsymbolic=""
1091   ])
1093 VLC_RESTORE_FLAGS
1094 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1095 AC_SUBST(SYMBOLIC_LDFLAGS)
1097 VLC_SAVE_FLAGS
1098 LDFLAGS="${LDFLAGS} -Wl,-z,defs"
1099 AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
1100   AC_TRY_LINK([],, [
1101     ac_cv_ld_z_defs="yes"
1102   ], [
1103     ac_cv_ld_z_defs="no"
1104   ])
1106 AS_IF([test "${ac_cv_ld_z_defs}" = "no"], [VLC_RESTORE_FLAGS])
1108 dnl Checks for __attribute__(aligned()) directive
1109 VLC_SAVE_FLAGS
1110 CFLAGS="${CFLAGS} -Werror"
1111 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1112     [ac_cv_c_attribute_aligned],
1113     [ac_cv_c_attribute_aligned=0
1114     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1115         AC_TRY_COMPILE([],
1116         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1117         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1118     done])
1119 VLC_RESTORE_FLAGS
1120 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1121     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1122         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1125 dnl Check for __attribute__((packed))
1126 AC_CACHE_CHECK([for __attribute__((packed))],
1127   [ac_cv_c_attribute_packed],
1128   [ac_cv_c_attribute_packed=no
1129    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1130                     [ac_cv_c_attribute_packed=yes])])
1131 if test "${ac_cv_c_attribute_packed}" != "no"; then
1132   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1136 dnl  Check the CPU
1138 case "${host_cpu}" in
1139   "")
1140     ARCH=unknown
1141     ;;
1142   *)
1143     ARCH="${host_cpu}"
1144     ;;
1145 esac
1147 dnl Check for backtrace() support
1148 AC_CHECK_HEADERS(execinfo.h)
1149 AC_CHECK_FUNCS(backtrace)
1152 dnl  default modules
1154 ALIASES="${ALIASES} cvlc rvlc"
1157 dnl  Accelerated modules
1160 dnl  Check for fully working MMX intrinsics
1161 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1162 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1163 AC_ARG_ENABLE(mmx,
1164   [AS_HELP_STRING([--disable-mmx],
1165     [disable MMX optimizations (default auto)])],,[
1166   case "${host_cpu}" in
1167     i?86|x86_64)
1168       enable_mmx="yes"
1169       ;;
1170     *)
1171       enable_mmx="no"
1172       ;;
1173   esac
1175 have_mmx="no"
1176 have_mmxext="no"
1177 AS_IF([test "${enable_mmx}" != "no"], [
1178   ARCH="${ARCH} mmx"
1179   VLC_SAVE_FLAGS
1180   CFLAGS="${CFLAGS} -mmmx"
1181   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1182     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1183 [#include <mmintrin.h>
1184 #include <stdint.h>
1185 uint64_t frobzor;]], [
1186 [__m64 a, b, c;
1187 a = b = c = (__m64)frobzor;
1188 a = _mm_slli_pi16(a, 3);
1189 a = _mm_adds_pi16(a, b);
1190 c = _mm_srli_pi16(c, 8);
1191 c = _mm_slli_pi16(c, 3);
1192 b = _mm_adds_pi16(b, c);
1193 a = _mm_unpacklo_pi8(a, b);
1194 frobzor = (uint64_t)a;]])], [
1195       ac_cv_c_mmx_intrinsics=yes
1196     ], [
1197       ac_cv_c_mmx_intrinsics=no
1198     ])
1199   ])
1200   VLC_RESTORE_FLAGS
1201   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1202     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1203   ])
1205   VLC_SAVE_FLAGS
1206   CFLAGS="${CFLAGS} -mmmx"
1207   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1208     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1209 void *p;
1210 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1212     ], [
1213       ac_cv_mmx_inline=yes
1214     ], [
1215       ac_cv_mmx_inline=no
1216     ])
1217   ])
1218   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1219     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1220     have_mmx="yes"
1221   ])
1223   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1224                  [ac_cv_mmxext_inline], [
1225     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1226 void *p;
1227 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1229     ], [
1230       ac_cv_mmxext_inline=yes
1231     ], [
1232       ac_cv_mmxext_inline=no
1233     ])
1234   ])
1235   VLC_RESTORE_FLAGS
1236   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1237     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1238     have_mmxext="yes"
1239   ])
1241 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1242 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1244 dnl  Check for fully workin SSE2 intrinsics
1245 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1246 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1247 AC_ARG_ENABLE(sse,
1248   [AS_HELP_STRING([--disable-sse],
1249     [disable SSE (1-4) optimizations (default auto)])],, [
1250   case "${host_cpu}" in
1251     i?86|x86_64)
1252       enable_sse=yes
1253       ;;
1254     *)
1255       enable_sse=no
1256       ;;
1257   esac
1259 have_sse2="no"
1260 AS_IF([test "${enable_sse}" != "no"], [
1261   ARCH="${ARCH} sse sse2"
1263   VLC_SAVE_FLAGS
1264   CFLAGS="${CFLAGS} -msse2"
1265   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1266     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1267 [#include <emmintrin.h>
1268 #include <stdint.h>
1269 uint64_t frobzor;]], [
1270 [__m128i a, b, c;
1271 a = b = c = _mm_set1_epi64((__m64)frobzor);
1272 a = _mm_slli_epi16(a, 3);
1273 a = _mm_adds_epi16(a, b);
1274 c = _mm_srli_epi16(c, 8);
1275 c = _mm_slli_epi16(c, 3);
1276 b = _mm_adds_epi16(b, c);
1277 a = _mm_unpacklo_epi8(a, b);
1278 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1279       ac_cv_c_sse2_intrinsics=yes
1280     ], [
1281       ac_cv_c_sse2_intrinsics=no
1282     ])
1283   ])
1284   VLC_RESTORE_FLAGS
1285   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1286     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1287   ])
1289   VLC_SAVE_FLAGS
1290   CFLAGS="${CFLAGS} -msse"
1291   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1292     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1293 void *p;
1294 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1296     ], [
1297       ac_cv_sse_inline=yes
1298     ], [
1299       ac_cv_sse_inline=no
1300     ])
1301   ])
1303   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1304     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1305   ])
1307   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1308     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1309 void *p;
1310 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1312     ], [
1313       ac_cv_sse2_inline=yes
1314     ], [
1315       ac_cv_sse2_inline=no
1316     ])
1317   ])
1318   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1319     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1320     have_sse2="yes"
1321   ])
1323   # SSE3
1324   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1325     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1326 void *p;
1327 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1329     ], [
1330       ac_cv_sse3_inline=yes
1331     ], [
1332       ac_cv_sse3_inline=no
1333     ])
1334   ])
1336   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1337     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1338   # SSSE3
1339   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1340     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1341 void *p;
1342 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1344     ], [
1345       ac_cv_ssse3_inline=yes
1346     ], [
1347       ac_cv_ssse3_inline=no
1348     ])
1349   ])
1351   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1352     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1354   # SSE4.1
1355   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1356                  [ac_cv_sse4_1_inline], [
1357     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1358 void *p;
1359 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1361     ], [
1362       ac_cv_sse4_1_inline=yes
1363     ], [
1364       ac_cv_sse4_1_inline=no
1365     ])
1366   ])
1368   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1369     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1371   # SSE4.2
1372   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1373                  [ac_cv_sse4_2_inline], [
1374     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1375 void *p;
1376 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1378     ], [
1379       ac_cv_sse4_2_inline=yes
1380     ], [
1381       ac_cv_sse4_2_inline=no
1382     ])
1383   ])
1385   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1386     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1388   # SSE4A
1389   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1390     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1391 void *p;
1392 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1394     ], [
1395       ac_cv_sse4a_inline=yes
1396     ], [
1397       ac_cv_sse4a_inline=no
1398     ])
1399   ])
1400   VLC_RESTORE_FLAGS
1401   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1402     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1404 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1406 VLC_SAVE_FLAGS
1407 CFLAGS="${CFLAGS} -mmmx"
1408 have_3dnow="no"
1409 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1410   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1411 void *p;
1412 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1414   ], [
1415     ac_cv_3dnow_inline=yes
1416   ], [
1417     ac_cv_3dnow_inline=no
1418   ])
1420 VLC_RESTORE_FLAGS
1421 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1422   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1423             [Define to 1 if 3D Now! inline assembly is available.])
1424   have_3dnow="yes"
1426 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1429 AC_ARG_ENABLE(neon,
1430   [AS_HELP_STRING([--disable-neon],
1431     [disable NEON optimizations (default auto)])],, [
1432   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1434 AS_IF([test "${enable_neon}" != "no"], [
1435   VLC_SAVE_FLAGS
1436   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1437   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1438     AC_COMPILE_IFELSE([
1439       AC_LANG_PROGRAM(,[[
1440 asm volatile("vqmovun.s64 d0, q1":::"d0");
1442     ], [
1443       ac_cv_arm_neon="yes"
1444     ], [
1445       ac_cv_arm_neon="no"
1446     ])
1447   ])
1448   VLC_RESTORE_FLAGS
1450 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1452 AC_ARG_ENABLE(arm64,
1453   [AS_HELP_STRING([--disable-arm64],
1454     [disable arm 64-bit optimizations (default auto)])],, [
1455   AS_IF([test "${host_cpu}" = "aarch64"], [enable_arm64="yes"] ,[enable_arm64="no"])
1457 AS_IF([test "${enable_arm64}" != "no"], [
1458   AC_CACHE_CHECK([if $CCAS groks ARM 64 SIMD assembly], [ac_cv_arm64], [
1459     AC_COMPILE_IFELSE([
1460       AC_LANG_PROGRAM(,[[
1461 asm volatile("uhadd v0.8b, v0.8b, v1.8b":::"v0");
1463     ], [
1464       ac_cv_arm64="yes"
1465     ], [
1466       ac_cv_arm64="no"
1467     ])
1468   ])
1470 AM_CONDITIONAL(HAVE_ARM64, [test "${ac_cv_arm64}" = "yes"])
1473 AC_ARG_ENABLE(altivec,
1474   [AS_HELP_STRING([--disable-altivec],
1475     [disable AltiVec optimizations (default auto)])],, [
1476   AS_CASE("${host_cpu}", [powerpc*],
1477         [enable_altivec=yes], [enable_altivec=no])
1479 have_altivec="no"
1480 ALTIVEC_CFLAGS=""
1481 AS_IF([test "${enable_altivec}" = "yes"], [
1482   ARCH="${ARCH} altivec";
1483   VLC_SAVE_FLAGS
1484   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1485     [ac_cv_altivec_inline],
1486     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1487          ac_cv_altivec_inline="yes",
1488          [CFLAGS="${CFLAGS} -Wa,-maltivec"
1489           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1490             [ac_cv_altivec_inline="-Wa,-maltivec"],
1491             ac_cv_altivec_inline=no)
1492          ])])
1493   VLC_RESTORE_FLAGS
1494   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1495     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1496               [Define to 1 if AltiVec inline assembly is available.])
1497     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1498       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1499       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1500     ])
1501     have_altivec="yes"
1502   ])
1504   VLC_SAVE_FLAGS
1505   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1506   [ac_cv_c_altivec], [
1507     CFLAGS="${CFLAGS} -maltivec"
1508     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1509 [#include <altivec.h>]], [
1510 [vec_ld(0, (unsigned char *)0);]])], [
1511       ac_cv_c_altivec="-maltivec"
1512     ], [
1513       ac_cv_c_altivec="no"
1514     ])
1515   ])
1516   VLC_RESTORE_FLAGS
1517   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1518     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1519     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1520     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1521     ALTIVEC_CFLAGS="$ALTIVEC_CFLAGS ${ac_cv_c_altivec}"
1522     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec}])
1523     have_altivec="yes"
1524   ])
1525   AC_CHECK_HEADERS(altivec.h)
1527   VLC_SAVE_FLAGS
1528   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1529   AC_CACHE_CHECK([if linker needs -framework vecLib],
1530     [ac_cv_ld_altivec],
1531     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1532   VLC_RESTORE_FLAGS
1533   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1534     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1535   ])
1537 AC_SUBST(ALTIVEC_CFLAGS)
1538 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1541 dnl  Memory usage
1543 AC_ARG_ENABLE(optimize-memory,
1544   [AS_HELP_STRING([--enable-optimize-memory],
1545     [optimize memory usage over performance])])
1546 if test "${enable_optimize_memory}" = "yes"; then
1547   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1551 dnl Allow running as root (useful for people running on embedded platforms)
1553 AC_ARG_ENABLE(run-as-root,
1554   [AS_HELP_STRING([--enable-run-as-root],
1555     [allow running VLC as root (default disabled)])])
1556 AS_IF([test "${enable_run_as_root}" = "yes"],[
1557     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1558               [Define to 1 to allow running VLC as root (uid 0).])
1562 dnl Stream output
1564 AC_ARG_ENABLE(sout,
1565   [AS_HELP_STRING([--disable-sout],
1566     [disable streaming output (default enabled)])])
1567 AS_IF([test "${enable_sout}" != "no"], [
1568   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1570 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1572 dnl Lua modules
1573 AC_ARG_ENABLE(lua,
1574   [AS_HELP_STRING([--disable-lua],
1575     [disable LUA scripting support (default enabled)])])
1576 if test "${enable_lua}" != "no"
1577 then
1578   PKG_CHECK_MODULES(LUA, lua5.2,
1579     [ have_lua=yes ],
1580     [
1581     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1583     PKG_CHECK_MODULES(LUA, lua5.1,
1584       [ have_lua=yes ],
1585       [
1586       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1587       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1588         [ have_lua=yes ],
1589         [
1590           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1591           have_lua=yes
1592           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1593             [],
1594             [ have_lua=no ] )
1595           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1596             [LUA_LIBS="-llua5.2"],
1597           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1598             [LUA_LIBS="-llua5.1"],
1599             AC_CHECK_LIB( lua51 , luaL_newstate,
1600               [LUA_LIBS="-llua51"],
1601               AC_CHECK_LIB( lua , luaL_newstate,
1602                 [LUA_LIBS="-llua"],
1603                 [ have_lua=no
1604                 ], [-lm])
1605             )))
1606         ])
1607       ])
1608     ])
1609   if test "x${have_lua}" != "xyes" ;  then
1610       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.])
1611   fi
1612   AC_ARG_VAR([LUAC], [LUA byte compiler])
1613   AS_IF([test -z "$LUAC"], [
1614      AC_CHECK_TOOL(LUAC, [luac], [false])
1615   ])
1616   AS_IF([test "${LUAC}" = "false"], [
1617     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1618   ])
1619   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], [
1620     AC_MSG_ERROR([You need 32-bits luac when using lua from contrib.])
1621   ])
1623 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1627 dnl HTTP daemon
1629 AC_ARG_ENABLE(httpd,
1630   [AS_HELP_STRING([--disable-httpd],
1631     [disable the built-in HTTP server (default enabled)])])
1632 if test "${enable_httpd}" != "no"
1633 then
1634   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1636 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1640 dnl VideoLAN manager
1642 AC_ARG_ENABLE(vlm,
1643   [AS_HELP_STRING([--disable-vlm],
1644     [disable the stream manager (default enabled)])],,
1645   [enable_vlm="${enable_sout}"])
1646 AS_IF([test "${enable_vlm}" != "no"], [
1647   AS_IF([test "${enable_sout}" = "no"], [
1648     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1649   ])
1650   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1652 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1656 dnl Addons manager storage and repositories modules
1658 AC_ARG_ENABLE(addonmanagermodules,
1659   [AS_HELP_STRING([--disable-addonmanagermodules],
1660     [disable the addons manager modules (default enabled)])])
1661 if test "${enable_addonmanagermodules}" != "no"
1662 then
1663   AC_DEFINE(ENABLE_ADDONMANAGERMODULES, 1, [Define if you want the addons manager modules])
1665 AM_CONDITIONAL([ENABLE_ADDONMANAGERMODULES], [test "${enable_addonmanagermodules}" != "no"])
1669 dnl  Input plugins
1672 EXTEND_HELP_STRING([Input plugins:])
1675 dnl  libarchive access module
1677 PKG_ENABLE_MODULES_VLC([ARCHIVE], [access_archive], [libarchive >= 3.1.0], (libarchive support), [auto])
1680 dnl  live555 input
1682 AC_ARG_ENABLE(live555,
1683   [AS_HELP_STRING([--enable-live555],
1684     [enable RTSP input through live555 (default enabled)])])
1686 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1687   PKG_CHECK_MODULES(LIVE555, live555, [
1688     VLC_ADD_PLUGIN([live555])
1689     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1690     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1691   ], [
1692     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1694     AC_LANG_PUSH(C++)
1695     VLC_SAVE_FLAGS
1697     dnl detect include paths
1698     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1699       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1700     ], [
1701       AS_IF([test "${SYS}" != "os2"], [
1702         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1703         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1704       ], [
1705         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1706         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1707         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1708       ])
1709     ])
1711     dnl CPP Flags
1712     AS_IF([test "${SYS}" = "solaris"], [
1713       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1714     ])
1715     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1716     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1718     dnl version check
1719     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1720       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1721 [#include <liveMedia_version.hh>
1722 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1723 # error BOOM
1724 #endif]])
1725       ], [
1726         ac_cv_live555="yes"
1727       ], [
1728         ac_cv_live555="no"
1729       ])
1730     ])
1732     AS_IF([test "$ac_cv_live555" = "no"], [
1733       AC_MSG_WARN([live555 is missing or its installed version is too old:
1734 Version 2011.12.23 or later is required to proceed.
1735 You can get an updated one from http://www.live555.com/liveMedia .])
1736       AS_IF([test -n "${enable_live555}"], [
1737         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1738       ])
1739     ], [
1740       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1741       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1742       AS_IF([test "${SYS}" = "mingw32"], [
1743         # add ws2_32 for closesocket, select, recv
1744         other_libs="$other_libs -lws2_32"
1745       ])
1747       dnl We need to check for pic because live555 don't provide shared libs
1748       dnl and we want to build a plugins so we need -fPIC on some arch.
1749       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1750       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1751       AC_CHECK_LIB(liveMedia_pic, main, [
1752         VLC_ADD_PLUGIN([live555])
1753         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1754       ],[
1755         AC_CHECK_LIB(liveMedia, main, [
1756           VLC_ADD_PLUGIN([live555])
1757           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1758         ],[],[${other_libs}])
1759       ],[${other_libs_pic}])
1760     ])
1761     VLC_RESTORE_FLAGS
1762     AC_LANG_POP(C++)
1763   ])
1767 dnl IIDC and DV FireWire input modules
1769 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1770 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1773 dnl - linsys modules: access module check for libzvbi
1775 AC_ARG_ENABLE(linsys,
1776   [AS_HELP_STRING([--enable-linsys],
1777     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1778 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1779   VLC_ADD_PLUGIN([linsys_hdsdi])
1780   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1781     VLC_ADD_PLUGIN([linsys_sdi])
1782   ], [
1783     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1784   ])
1788 dnl dvdread module: check for libdvdread
1790 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread > 4.9.0], [dvdread input module], [auto])
1793 dnl libdvdnav plugin
1795 PKG_ENABLE_MODULES_VLC([DVDNAV], [], [dvdnav > 4.9.0], [DVD with navigation input module (dvdnav)], [auto])
1796 AS_IF([test "${enable_dvdnav}" != "no"], [
1797   AC_MSG_CHECKING(for dvdnav_stream_cb in dvdnav/dvdnav.h)
1798     AC_EGREP_HEADER(dvdnav_stream_cb,dvdnav/dvdnav.h,[
1799       AC_MSG_RESULT(yes)
1800       AC_DEFINE(HAVE_STREAM_CB_IN_DVDNAV_H, 1, For dvdnav demux support)
1801       ],[
1802       AC_MSG_RESULT(no)
1803     ])
1807 dnl  Blu-ray Disc Support with libbluray
1809 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray for Blu-ray disc support ) )
1812 dnl  OpenCV wrapper and example filters
1814 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1818 dnl  libsmbclient plugin
1820 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1821 AS_IF([test "${SYS}" = "mingw32" -a "${enable_smbclient}" != "no"], [ VLC_ADD_PLUGIN([smb]) ])
1824 dnl  liBDSM access module
1826 PKG_ENABLE_MODULES_VLC([DSM], [dsm], [libdsm >= 0.2.0], [libdsm SMB/CIFS access/sd module], [auto])
1829 dnl sftp access support
1831 PKG_ENABLE_MODULES_VLC([SFTP], [sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1834 dnl nfs access support
1836 PKG_ENABLE_MODULES_VLC([NFS], [nfs], [libnfs >= 1.10.0], (support nfs protocol via libnfs), [auto])
1839 dnl  Video4Linux 2
1841 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1842   [disable Video4Linux version 2 (default auto)])])
1843 have_v4l2="no"
1844 AS_IF([test "$enable_v4l2" != "no"], [
1845   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1846     have_v4l2="yes"
1847   ])
1849 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1852 dnl special access module for Blackmagic SDI cards
1854 AC_ARG_ENABLE(decklink,
1855   [AS_HELP_STRING([--disable-decklink],
1856     [disable Blackmagic DeckLink SDI input (default auto)])])
1857 AC_ARG_WITH(decklink_sdk,
1858   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1859     [                        location of Blackmagic DeckLink SDI SDK])])
1860 have_decklink=no
1861 if test "${enable_decklink}" != "no"
1862 then
1863   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1864   then
1865     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1866   fi
1867   VLC_SAVE_FLAGS
1868   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1869   AC_LANG_PUSH(C++)
1870   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1871       have_decklink=yes
1872   ], [
1873       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1874   ])
1875   AC_LANG_POP(C++)
1876   VLC_RESTORE_FLAGS
1878 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1882 dnl  Built-in CD-DA and VCD module
1884 AC_ARG_ENABLE(vcd,
1885   [AS_HELP_STRING([--disable-vcd],
1886     [disable built-in VCD and CD-DA support (default enabled)])])
1888 AC_ARG_ENABLE(libcddb,
1889   [AS_HELP_STRING([--disable-libcddb],
1890     [disable CDDB for Audio CD (default enabled)])])
1892 if test "${enable_vcd}" != "no"
1893 then
1894   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1895   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1896     AC_MSG_RESULT(yes)
1897     VLC_ADD_PLUGIN([vcd cdda])
1898   ],[
1899     AC_MSG_RESULT(no)
1900   ])
1902   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1903   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1904     AC_MSG_RESULT(yes)
1905     VLC_ADD_PLUGIN([vcd cdda])
1906     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1907   ],[
1908     AC_MSG_RESULT(no)
1909   ])
1911   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1912   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1913     AC_MSG_RESULT(yes)
1914     VLC_ADD_PLUGIN([vcd cdda])
1915     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1916   ],[
1917     AC_MSG_RESULT(no)
1918   ])
1920   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2" -o "${SYS}" = "darwin"
1921   then
1922     VLC_ADD_PLUGIN([vcd cdda])
1923   fi
1925   if test "$enable_libcddb" != "no"; then
1926     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1927       HAVE_LIBCDDB=yes
1928       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1929       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1930       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1931       ],:
1932       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1933       HAVE_LIBCDDB=no])
1934   fi
1938 dnl Linux DVB
1940 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1941   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1942 [#include <linux/dvb/version.h>
1943 #if (DVB_API_VERSION < 5)
1944 # error Linux DVB API v3.2 and older are not supported.
1945 #endif
1946 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1947 # error Linux DVB API v5.0 is unsupported. Please update.
1948 #endif
1949 ]])], [
1950   ac_cv_linux_dvb_5_1=yes
1951 ], [
1952   ac_cv_linux_dvb_5_1=no
1953 ])])
1954 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1957 dnl  Screen capture module
1959 AC_ARG_ENABLE(screen,
1960   [AS_HELP_STRING([--enable-screen],
1961     [disable screen capture (default enabled)])])
1962 if test "${enable_screen}" != "no"; then
1963   if test "${SYS}" = "darwin"; then
1964     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1965       VLC_ADD_PLUGIN([screen])
1966     ])
1967   fi
1969 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1972 dnl  VNC/RFB access module
1974 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1976 dnl  RDP/Remote Desktop access module
1978 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1981 dnl  Real RTSP plugin
1983 AC_ARG_ENABLE(realrtsp,
1984   [  --enable-realrtsp       Real RTSP module (default disabled)])
1985 if test "${enable_realrtsp}" = "yes"; then
1986   VLC_ADD_PLUGIN([access_realrtsp])
1990 dnl MacOS eyeTV
1991 AC_ARG_ENABLE(macosx-eyetv,
1992   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1993 if test "x${enable_macosx_eyetv}" != "xno" &&
1994   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1995 then
1996   VLC_ADD_PLUGIN([access_eyetv])
2000 dnl QTKit
2001 AC_ARG_ENABLE(macosx-qtkit,
2002   [  --enable-macosx-qtkit Mac OS X qtsound (audio) module (default enabled on Mac OS X <= v10.11)])
2003 if test "x${enable_macosx_qtkit}" != "xno" &&
2004   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
2005 then
2006   AC_CHECK_HEADERS(QTKit/QTKit.h, [
2007       VLC_ADD_PLUGIN([qtsound])
2008     ])
2012 dnl AVFoundation
2013 AC_SUBST(have_avfoundation, ["no"])
2014 AC_ARG_ENABLE(macosx-avfoundation,
2015   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
2016 if test "x${enable_macosx_avfoundation}" != "xno" &&
2017   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
2018 then
2019   SAVED_LIBS="${LIBS}"
2020   LIBS="-framework AVFoundation"
2021   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
2022   LIBS="${SAVED_LIBS}"
2023   if test "${have_avfoundation}" != "no"
2024   then
2025     VLC_ADD_PLUGIN([avcapture])
2026   fi
2028 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
2031 dnl  DCP plugin (using asdcplib)
2033 PKG_WITH_MODULES([ASDCP], [asdcplib], [have_asdcp="yes"])
2034 AM_CONDITIONAL(HAVE_ASDCP, [test "${have_asdcp}" = "yes"])
2037 dnl  Demux plugins
2040 EXTEND_HELP_STRING([Mux/Demux plugins:])
2043 dnl  libdvbpsi check for ts mux/demux
2045 have_dvbpsi="no"
2046 PKG_WITH_MODULES([DVBPSI], [libdvbpsi >= 1.2.0], [have_dvbpsi="yes"])
2047 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
2051 dnl  GME demux plugin
2053 AC_ARG_ENABLE(gme,
2054   [AS_HELP_STRING([--enable-gme],
2055     [use Game Music Emu (default auto)])])
2056 AS_IF([test "${enable_gme}" != "no"], [
2057   AC_CHECK_HEADER([gme/gme.h], [
2058     VLC_ADD_LIBS([gme], [-lgme])
2059     VLC_ADD_PLUGIN([gme])
2060   ], [
2061     AS_IF([test "x${enable_gme}" != "x"], [
2062       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
2063     ])
2064   ])
2069 dnl  SIDPlay plugin
2071 AC_ARG_ENABLE(sid,
2072     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2073 AS_IF([test "${enable_sid}" != "no"], [
2074     PKG_CHECK_MODULES(SID, [libsidplay2], [
2075         AC_LANG_PUSH(C++)
2076         oldCPPFLAGS="$CPPFLAGS"
2077         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2078         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2079             VLC_ADD_PLUGIN([sid])
2080             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2081             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2082         ], [
2083             AS_IF([test -n "${enable_sid}"],
2084                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2085                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2086                 )
2087         ])
2088         CPPFLAGS="$oldCPPFLAGS"
2089         AC_LANG_POP(C++)
2090     ], [
2091         AS_IF([test "x${enable_sid}" = "xyes"],
2092             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2093             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2094             )
2095     ])
2100 dnl  ogg demux plugin
2102 PKG_ENABLE_MODULES_VLC([OGG], [mux_ogg], [ogg >= 1.0], [Ogg demux support], [auto])
2103 PKG_CHECK_MODULES(LIBVORBIS, [vorbis >= 1.1], [
2104     AC_DEFINE(HAVE_LIBVORBIS, 1, [Define to 1 if you have the libvorbis])
2105 ],[true])
2106 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto], [${LIBVORBIS_CFLAGS}], [${LIBVORBIS_LIBS}])
2107 if test "${enable_sout}" != "no"; then
2108 dnl Check for libshout
2109     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2113 dnl  matroska demux plugin
2115 PKG_ENABLE_MODULES_VLC([MATROSKA], [mkv], [libebml libmatroska], [MKV format support], [auto])
2118 dnl  modplug demux plugin
2120 AC_ARG_ENABLE(mod,
2121   [AS_HELP_STRING([--disable-mod],
2122     [do not use libmodplug (default auto)])])
2123 if test "${enable_mod}" != "no" ; then
2124     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2125           VLC_ADD_PLUGIN([mod])
2126           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2127           VLC_ADD_CFLAGS([mod],[$LIBMODPLUG_CFLAGS]) #modules/demux/mod.c needs CFLAGS_mod, not CXXFLAGS_mod
2128           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2129     ],[
2130        AS_IF([test -n "${enable_mod}"],
2131          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2132          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2133     ])
2137 dnl  mpc demux plugin
2139 AC_ARG_ENABLE(mpc,
2140   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2141 if test "${enable_mpc}" != "no"
2142 then
2143   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2144     VLC_ADD_PLUGIN([mpc])
2145     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2146     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2147     VLC_ADD_PLUGIN([mpc])
2148     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2152 dnl  Codec plugins
2155 EXTEND_HELP_STRING([Codec plugins:])
2158 dnl wmafixed plugin
2160 AC_ARG_ENABLE(wma-fixed,
2161   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2162 if test "${enable_wma_fixed}" = "yes"
2163 then
2164   VLC_ADD_PLUGIN([wma_fixed])
2168 dnl shine encoder plugin
2170 PKG_ENABLE_MODULES_VLC([SHINE], [], [shine >= 3.0.0], [MPEG Audio Layer 3 encoder], [auto], [], [], [])
2174 dnl openmax il codec plugin
2176 AC_ARG_ENABLE(omxil,
2177   [  --enable-omxil          openmax il codec module (default disabled)])
2178 if test "${enable_omxil}" = "yes"
2179 then
2180   VLC_ADD_PLUGIN([omxil])
2184 dnl openmax il vout plugin
2186 AC_ARG_ENABLE(omxil-vout,
2187   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2188 if test "${enable_omxil_vout}" = "yes"
2189 then
2190   VLC_ADD_PLUGIN([omxil_vout])
2194 dnl raspberry pi openmax il configuration
2196 AC_ARG_ENABLE(rpi-omxil,
2197   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2198 if test "${enable_rpi_omxil}" = "yes"
2199 then
2200   VLC_ADD_PLUGIN([omxil omxil_vout])
2201   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2205 dnl CrystalHD codec plugin
2207 AC_ARG_ENABLE(crystalhd,
2208   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2209 if test "${enable_crystalhd}" != "no"; then
2210     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2211       VLC_ADD_PLUGIN([crystalhd])
2212       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2213     ],[
2214       if test "${SYS}" = "mingw32" ; then
2215         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2216           VLC_ADD_PLUGIN([crystalhd])
2217           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2218             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2219             ])
2220         ],[
2221           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2222                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2223                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2224         ],[#define __LINUX_USER__
2225                #include <libcrystalhd/bc_dts_types.h>
2226         ])
2227       fi
2228     ],[
2229        #include <libcrystalhd/bc_dts_types.h>
2230       ])
2234 dnl  mad plugin
2236 have_mad="no"
2237 MAD_CFLAGS=""
2238 MAD_LIBS=""
2240 AC_ARG_WITH(mad, [  --with-mad=PATH         path to libmad], [
2241   enable_mad="yes"
2242 ], [
2243   with_mad="no"
2245 AS_IF([test "${with_mad}" != "no"], [
2246   MAD_CFLAGS="-I${with_mad}/include"
2247   MAD_LIBS="-L${with_mad}/lib"
2250 AC_ARG_ENABLE(mad,
2251   [  --enable-mad            libmad module (default enabled)])
2252 AS_IF([test "${enable_mad}" != "no"], [
2253   VLC_SAVE_FLAGS
2254   CPPFLAGS="${CPPFLAGS} ${MAD_CFLAGS}"
2255   LDFLAGS="${LDFLAGS} ${MAD_LIBS}"
2256   AC_CHECK_HEADERS(mad.h, [
2257     AC_CHECK_LIB(mad, mad_bit_init, [
2258       have_mad="yes"
2259       MAD_LIBS="${MAD_LIBS} -lmad"
2260     ])
2261   ])
2262   VLC_RESTORE_FLAGS
2263   AS_IF([test -n "$enable_mad" -a "${have_mad}" = "no"], [
2264     AC_MSG_ERROR([Could not find libmad. Install it or pass --disable-mad to disable it.])
2265   ])
2267 AC_SUBST(MAD_CFLAGS)
2268 AC_SUBST(MAD_LIBS)
2269 AM_CONDITIONAL([HAVE_MAD], [test "${have_mad}" = "yes"])
2271 dnl  mpg123 plugin
2274 PKG_ENABLE_MODULES_VLC([MPG123], [mpg123], [libmpg123], [libmpg123 decoder support], [auto])
2277 AC_ARG_ENABLE(merge-ffmpeg,
2278 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2279   enable_merge_ffmpeg="no"
2281 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2283 AC_MSG_CHECKING([for libavutil variant])
2284 PKG_CHECK_EXISTS([libavutil], [
2285   libavutil_version="$(${PKG_CONFIG} --modversion libavutil)"
2286   libavutil_micro="${libavutil_version##*.}"
2287   AS_IF([test ${libavutil_micro} -le 99], [
2288     avfork="libav"
2289   ], [
2290     avfork="ffmpeg"
2291   ])
2292 ], [
2293   avfork="none"
2295 AC_MSG_RESULT([${avfork}])
2298 dnl gstreamer stuff
2300 AC_ARG_ENABLE(gst-decode,
2301   [  --enable-gst-decode     GStreamer based decoding support (currently supports only video decoding) (default auto)])
2303 have_gst_decode="no"
2304 AS_IF([test "${enable_gst_decode}" != "no"], [
2305   PKG_CHECK_MODULES([GST_APP], [gstreamer-app-1.0], [
2306     PKG_CHECK_MODULES([GST_VIDEO], [gstreamer-video-1.0], [
2307       have_gst_decode="yes"
2308     ], [
2309       AC_MSG_WARN([${GST_VIDEO_PKG_ERRORS}. GStreamer decoder module will not be built.])
2310     ])
2311   ], [
2312     AC_MSG_WARN([${GST_APP_PKG_ERRORS}. GStreamer modules will not be built.])
2313   ])
2315 AM_CONDITIONAL([HAVE_GST_DECODE], [test "${have_gst_decode}" = "yes"])
2318 dnl  avcodec decoder/encoder plugin
2320 AC_ARG_ENABLE(avcodec,
2321 [  --enable-avcodec        libavcodec codec (default enabled)])
2322 AS_IF([test "${enable_avcodec}" != "no"], [
2323   dnl We need >=57.16.0 from libav or >=57.37.100 from ffmpeg
2324   case "${avfork}" in
2325     libav) av_codec_ver="57.16.0" ;;
2326     ffmpeg) av_codec_ver="57.37.100" ;;
2327     *) AC_MSG_ERROR([Missing libav or FFmpeg])
2328   esac
2329   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= ${av_codec_ver} libavutil >= 52.0.0], [
2330     VLC_SAVE_FLAGS
2331     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2332     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2333     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2334     AC_CHECK_HEADERS(libavutil/avutil.h)
2335     VLC_RESTORE_FLAGS
2336     have_avcodec="yes"
2337   ],[
2338     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2339   ])
2340 ], [
2341   have_avcodec="no"
2343 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2346 dnl libva needs avcodec
2348 AC_ARG_ENABLE(libva,
2349   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2351 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2352   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2355 have_vaapi="no"
2356 have_vaapi_drm="no"
2357 have_vaapi_x11="no"
2358 AS_IF([test "${enable_libva}" != "no"], [
2359   PKG_CHECK_MODULES([LIBVA], [libva], [
2360     have_vaapi="yes"
2361   ], [
2362     AS_IF([test -n "${enable_libva}"], [
2363       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2364     ], [
2365       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2366     ])
2367   ])
2368   PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm], [
2369     have_vaapi_drm="yes"
2370   ], [
2371     AC_MSG_WARN([${LIBVA_DRM_PKG_ERRORS}.])
2372   ])
2373   PKG_CHECK_MODULES(LIBVA_X11, [libva-x11], [
2374     have_vaapi_x11="yes"
2375   ], [
2376     AC_MSG_WARN([${LIBVA_X11_PKG_ERRORS}.])
2377   ])
2379 AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
2380 AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
2382 have_avcodec_vaapi="no"
2383 AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
2384   VLC_SAVE_FLAGS
2385   CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2386   CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2387   AC_CHECK_HEADERS([libavcodec/vaapi.h], [
2388     AC_MSG_NOTICE([VA API acceleration activated])
2389     have_avcodec_vaapi="yes"
2390   ],[
2391     AS_IF([test -n "${enable_libva}"], [
2392       AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2393     ], [
2394       AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2395     ])
2396   ])
2397   VLC_RESTORE_FLAGS
2399 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2402 dnl dxva2 needs avcodec
2404 AC_ARG_ENABLE(dxva2,
2405   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2407 have_avcodec_dxva2="no"
2408 AS_IF([test "${enable_dxva2}" != "no"], [
2409   if test "${SYS}" = "mingw32"; then
2410   AS_IF([test "x${have_avcodec}" = "xyes"], [
2411     AC_CHECK_HEADERS(dxva2api.h,
2412       [
2413         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2414            AC_MSG_NOTICE([DxVA2 acceleration activated])
2415            have_avcodec_dxva2="yes"
2416         ],[
2417     AS_IF([test "${enable_dxva2}" = "yes"],
2418           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2419               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2420         ], [#undef _WIN32_WINNT
2421             /* DXVA2 is only available in Vista and above */
2422             #define _WIN32_WINNT 0x600])
2423       ],[
2424     AS_IF([test "${enable_dxva2}" = "yes"],
2425               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2426               [AC_MSG_WARN([dxva2api.h not found])])
2427       ],[#include <d3d9.h>])
2428   ],[
2429     AS_IF([test "x${enable_dxva2}" != "x"], [
2430       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2431     ])
2432   ])
2433   fi
2435 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2438 dnl d3d11va needs avcodec
2440 AC_ARG_ENABLE(d3d11va,
2441   [  --enable-d3d11va          D3D11 GPU decoding support (default auto)])
2443 have_avcodec_d3d11va="no"
2444 AS_IF([test "${enable_d3d11va}" != "no"], [
2445   if test "${SYS}" = "mingw32"; then
2446   AS_IF([test "x${have_avcodec}" = "xyes"], [
2447         AC_CHECK_TYPES([ID3D11VideoDecoder],
2448           [
2449             AC_CHECK_HEADERS(dxva2api.h,
2450               [
2451                 AC_CHECK_HEADERS(libavcodec/d3d11va.h, [
2452                    AC_MSG_NOTICE([D3D11 acceleration activated])
2453                    AC_DEFINE(HAVE_AVCODEC_D3D11VA, 1, [Define if the d3d11va module is built])
2454                    have_avcodec_d3d11va="yes"
2455                 ],[
2456                   AS_IF([test "${enable_d3d11va}" = "yes"],
2457                     [AC_MSG_ERROR([d3d11va is present but libavcodec/d3d11va.h is missing])],
2458                         [AC_MSG_WARN([d3d11va is present but libavcodec/d3d11va.h is missing ])])
2459                   ], [#undef _WIN32_WINNT
2460                       /* D3D11 is only available in Vista and above */
2461                       #define _WIN32_WINNT 0x600])
2462                   ],[
2463                     AS_IF([test "${enable_d3d11va}" = "yes"],
2464                           [AC_MSG_ERROR([Could not find required dxva2api.h])],
2465                           [AC_MSG_WARN([dxva2api.h not found])])
2466                   ],[#include <d3d9.h>])
2467           ],[
2468             AS_IF([test "${enable_d3d11va}" = "yes"],
2469                   [AC_MSG_ERROR([Could not find required ID3D11VideoDecoder in d3d11.h])],
2470                   [AC_MSG_WARN([ID3D11VideoDecoder not found])])
2471           ], [#include <d3d11.h>])
2472   ],[
2473     AS_IF([test "x${enable_d3d11va}" != "x"], [
2474       AC_MSG_ERROR([--enable-d3d11va and --disable-avcodec options are mutually exclusive.])
2475     ])
2476   ])
2477   fi
2479 AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
2482 dnl DXGI debug
2484 AC_CHECK_HEADERS(dxgidebug.h)
2487 dnl vda needs avcodec
2489 AC_ARG_ENABLE(vda,
2490   [  --enable-vda          VDA  support (default auto)])
2492 have_avcodec_vda="no"
2493 AS_IF([test "${enable_vda}" != "no"], [
2494   if test "${SYS}" = "darwin"; then
2495   AS_IF([test "x${have_avcodec}" = "xyes"], [
2496     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2497       [
2498         AC_CHECK_HEADERS(libavcodec/vda.h, [
2499            have_avcodec_vda="yes"
2500         ],[
2501         AS_IF([test "${enable_vda}" = "yes"],
2502               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2503               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2504         ])
2505   ],[
2506         AS_IF([test "${enable_vda}" = "yes"],
2507               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2508               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2509       ])
2510   ],[
2511     AS_IF([test "x${enable_vda}" != "x"], [
2512       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2513     ])
2514  ])
2515  AS_IF([test "${have_avcodec_vda}" = "yes"], [
2516      SAVE_LIBS=$LIBS
2517      LIBS="$LIBS $AVCODEC_LIBS"
2518      AC_CHECK_FUNCS([av_vda_alloc_context])
2519      LIBS=$SAVE_LIBS
2520  ])
2521  fi
2523 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2526 dnl  avformat demuxer/muxer plugin
2529 AC_ARG_ENABLE(avformat,
2530 [  --enable-avformat       libavformat containers (default enabled)],, [
2531   enable_avformat="${have_avcodec}"
2533 have_avformat="no"
2534 AS_IF([test "${enable_avformat}" != "no"], [
2535   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2536       have_avformat="yes"
2537       VLC_SAVE_FLAGS
2538       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2539       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2540       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2541       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2542       AC_CHECK_HEADERS(libavutil/avutil.h)
2543       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2544         have_avformat="no"
2545       ])
2546       VLC_RESTORE_FLAGS
2547     ],[
2548       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2549   ])
2551 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2554 dnl  swscale image scaling and conversion plugin
2557 AC_ARG_ENABLE(swscale,
2558   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2559           (default enabled)]))
2560 if test "${enable_swscale}" != "no"
2561 then
2562   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2563     [
2564       VLC_SAVE_FLAGS
2565       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2566       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2567       AC_CHECK_HEADERS(libswscale/swscale.h)
2568       AC_CHECK_HEADERS(libavutil/avutil.h)
2569       VLC_ADD_PLUGIN([swscale])
2570       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2571       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2572       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2573         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2574       ])
2575       VLC_RESTORE_FLAGS
2576     ],[
2577       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2578   ])
2582 dnl  postproc plugin
2585 AC_ARG_ENABLE(postproc,
2586 [  --enable-postproc       libpostproc image post-processing (default auto)])
2587 if test "${enable_postproc}" != "no"
2588 then
2589   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2590     [
2591       VLC_SAVE_FLAGS
2592       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2593       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2594       AC_CHECK_HEADERS(postproc/postprocess.h)
2595       VLC_ADD_PLUGIN([postproc])
2596       VLC_RESTORE_FLAGS
2597     ],[
2598       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2599   ])
2603 dnl  faad decoder plugin
2605 AC_ARG_ENABLE(faad,
2606 [  --enable-faad           faad codec (default auto)])
2607 have_faad="no"
2608 AS_IF([test "${enable_faad}" != "no"], [
2609   AC_CHECK_HEADERS([neaacdec.h], [
2610     AC_CHECK_LIB(faad, NeAACDecOpen, [have_faad="yes"],, [$LIBM])
2612     AS_IF([test "${have_faad}" = "yes"], [
2613       VLC_ADD_PLUGIN([faad])
2614       VLC_ADD_LIBS([faad],[-lfaad])
2615     ], [
2616       AS_IF([test "${enable_faad}" = "yes"], [
2617         AC_MSG_ERROR([cannot find FAAD library])
2618       ], [
2619         AC_MSG_WARN([cannot find FAAD library])
2620       ])
2621     ])
2622   ])
2626 dnl  AOM decoder plugin
2628 PKG_ENABLE_MODULES_VLC([AOM], [], [aom], [experimental AV1 codec], [disabled])
2631 dnl libvpx decoder plugin
2633 AC_ARG_ENABLE(vpx,
2634     AS_HELP_STRING([--enable-vpx],[libvpx VP8/VP9 encoder and decoder (default auto)]))
2635 AS_IF([test "${enable_vpx}" != "no"],[
2636     PKG_CHECK_MODULES([VPX], [vpx >= 1.5.0], [
2637         VLC_ADD_PLUGIN([vpx])
2638         VLC_ADD_CPPFLAGS([vpx], [${VPX_CFLAGS}])
2639         VLC_ADD_LIBS([vpx], [${VPX_LIBS}])
2640         AC_CHECK_LIB([vpx],[vpx_codec_vp8_dx], [
2641             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_DECODER])
2642         ], [], [${VPX_LIBS}])
2643         AC_CHECK_LIB([vpx],[vpx_codec_vp9_dx], [
2644             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_DECODER])
2645         ], [], [${VPX_LIBS}])
2646         AC_CHECK_LIB([vpx],[vpx_codec_vp8_cx], [
2647             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_ENCODER])
2648         ], [], [${VPX_LIBS}])
2649         AC_CHECK_LIB([vpx],[vpx_codec_vp9_cx], [
2650             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_ENCODER])
2651         ], [], [${VPX_LIBS}])
2652     ], [
2653     AS_IF([test "${enable_vpx}" = "yes"],[
2654         AC_MSG_ERROR([libvpx 1.5.0 or higher was not found])
2655     ])])
2659 dnl twolame encoder plugin
2661 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2664 dnl fdk-aac encoder plugin
2666 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2670 dnl A52/AC3 decoder plugin
2672 AC_ARG_ENABLE(a52,
2673   [  --enable-a52            A/52 support with liba52 (default enabled)])
2674 if test "${enable_a52}" != "no"
2675 then
2676   AC_ARG_WITH(a52,
2677     [  --with-a52=PATH         a52 headers and libraries])
2678     if test -z "${with_a52}"
2679     then
2680       LDFLAGS_test=""
2681       CPPFLAGS_test=""
2682     else
2683       LDFLAGS_test="-L${with_a52}/lib"
2684       CPPFLAGS_test="-I${with_a52}/include"
2685     fi
2686     VLC_SAVE_FLAGS
2687     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52}"
2688     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52}"
2689     AC_CHECK_HEADERS(a52dec/a52.h, [
2690       AC_CHECK_LIB(a52, a52_free, [
2691         VLC_ADD_PLUGIN([a52])
2692         VLC_ADD_LIBS([a52],[${LDFLAGS_test} -la52])
2693         VLC_ADD_CPPFLAGS([a52],[${CPPFLAGS_test}])
2694       ],[
2695         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.])
2696         ], [$LIBM])
2697     ],[
2698       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.])
2699     ])
2700     VLC_RESTORE_FLAGS
2704 dnl DTS Coherent Acoustics decoder plugin
2706 PKG_ENABLE_MODULES_VLC([DCA], [dca], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2709 dnl  Flac plugin
2711 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2714 dnl  Libmpeg2 plugin
2716 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2719 dnl  Vorbis plugin
2721 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2724 dnl  Tremor plugin
2726 AC_ARG_ENABLE(tremor,
2727   [  --enable-tremor         Tremor decoder support (default disabled)])
2728 if test "${enable_tremor}" = "yes"
2729 then
2730   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2731     VLC_ADD_PLUGIN([tremor])
2732    ],[])
2736 dnl  Speex plugins
2738 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2739 have_speexdsp="no"
2740 AS_IF([test "${enable_speex}" != "no"], [
2741   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2742     have_speexdsp="yes"
2743   ], [
2744     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2745   ])
2747 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2750 dnl  Opus plugin
2752 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus >= 1.0.3], [Opus support], [auto])
2755 dnl  theora decoder plugin
2757 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2760 dnl  OggSpots decoder plugin
2762 PKG_ENABLE_MODULES_VLC([OGGSPOTS], [], [ogg], [experimental OggSpots codec], [auto])
2765 dnl  Daala decoder plugin
2767 PKG_ENABLE_MODULES_VLC([DAALA], [], [daaladec daalaenc], [experimental daala codec], [disabled])
2770 dnl  schroedinger decoder plugin (for dirac format video)
2772 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2775 dnl  PNG decoder module
2777 AC_ARG_ENABLE(png,
2778   [  --enable-png            PNG support (default enabled)])
2779 AS_IF([test "${enable_png}" != "no"], [
2780 AC_CHECK_HEADERS(png.h, [
2781   VLC_SAVE_FLAGS
2782   LDFLAGS="${LDFLAGS} -lz $LIBM"
2783   AC_CHECK_LIB(png, png_set_rows, [
2784     VLC_ADD_PLUGIN([png])
2785   ], [], [-lz $LIBM])
2786   VLC_RESTORE_FLAGS
2787   ])
2791 dnl  JPEG decoder module
2793 AC_ARG_ENABLE(jpeg,
2794   [  --enable-jpeg           JPEG support (default enabled)])
2795 AS_IF([test "${enable_jpeg}" != "no"], [
2796 AC_CHECK_HEADERS(jpeglib.h, [
2797   VLC_ADD_PLUGIN([jpeg])
2798   ])
2802 dnl  BPG decoder module
2804 AC_ARG_ENABLE(bpg,
2805   [  --enable-bpg           BPG support (default disabled)])
2806 AS_IF([test "${enable_bpg}" != "no"], [
2807 AC_CHECK_HEADERS(libbpg.h, [
2808   VLC_ADD_PLUGIN([bpg])
2809   ])
2813 dnl H262 encoder plugin (lib262)
2815 AC_ARG_ENABLE(x262,
2816   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2817 if test "${enable_x262}" != "no"; then
2818     PKG_CHECK_MODULES(X262, x262, [
2819         VLC_ADD_PLUGIN([x262])
2820         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2821         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2822           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2823         ])
2824         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2825         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2826           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2827         fi
2828     ], [
2829        if test "${enable_x262}" = "yes"; then
2830         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2831        fi
2832     ])
2835 dnl x265 encoder
2836 PKG_ENABLE_MODULES_VLC([X265],, [x265], [HEVC/H.265 encoder], [auto])
2839 dnl H264 encoder plugin (10-bit lib264)
2841 AC_ARG_ENABLE(x26410b,
2842   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2843 if test "${enable_x26410b}" != "no"; then
2844     PKG_CHECK_MODULES(X26410B, x26410b, [
2845         VLC_ADD_PLUGIN([x26410b])
2846         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2847         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2848           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2849         ])
2850         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2851         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2852           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2853         fi
2854     ], [
2855        if test "${enable_x26410b}" = "yes"; then
2856         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2857        fi
2858     ])
2863 dnl H264 encoder plugin (using libx264)
2865 AC_ARG_ENABLE(x264,
2866   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2867 if test "${enable_x264}" != "no"; then
2868       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2869         VLC_ADD_PLUGIN([x264])
2870         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2872         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2873           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2874         ])
2876         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2877         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2878           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2879         fi
2880       ],[
2881         if test "${enable_x264}" = "yes"; then
2882             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2883           fi
2884       ])
2888 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2890 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2893 dnl libfluidsynth (MIDI synthetizer) plugin
2895 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2896 PKG_ENABLE_MODULES_VLC([FLUIDLITE], [fluidsynth], [fluidlite], [MIDI synthetiser with libfluidsynth], [auto])
2897 AC_CHECK_HEADERS(fluidlite.h, [AC_SUBST([FLUIDSYNTH_LIBS], ${FLUIDLITE_LIBS})])
2900 dnl Teletext Modules
2901 dnl vbi decoder plugin (using libzbvi)
2902 dnl telx module
2903 dnl uncompatible
2905 AC_ARG_ENABLE(zvbi,
2906   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2907                   libzvbi (default enabled)]))
2908 AC_ARG_ENABLE(telx,
2909   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2910                   zvbi) (default enabled if zvbi is absent)]))
2912 AS_IF( [test "${enable_zvbi}" != "no"],[
2913     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2914         [
2915           VLC_ADD_PLUGIN([zvbi])
2916           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2917           AS_IF( [test "${enable_telx}" = "yes"],[
2918                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2919                   ])
2920         ],[
2921           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2922         ])
2923     ])
2924 AS_IF( [test "${enable_telx}" != "no" ],[
2925   VLC_ADD_PLUGIN([telx])
2926   ])
2929 dnl libass subtitle rendering module
2931 AC_ARG_ENABLE(libass,
2932   [  --enable-libass         Subtitle support using libass (default enabled)])
2933 AS_IF( [test "${enable_libass}" != "no"], [
2934   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2935       [
2936         VLC_ADD_PLUGIN([libass])
2938         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2939           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2940            VLC_ADD_LIBS([libass],[-lfontconfig])
2941        ])
2942       ],[
2943         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2944       ])
2945   ])
2948 dnl ARIB subtitles rendering module
2950 AC_ARG_ENABLE(aribsub,
2951   [  --enable-aribsub        ARIB Subtitles support (default enabled)])
2952 AS_IF( [test "${enable_aribsub}" != "no" ],[
2953   PKG_CHECK_MODULES(ARIBB24, [aribb24 >= 1.0.1], [
2954       have_aribb24="yes"
2955       VLC_ADD_PLUGIN([aribsub])
2956       VLC_ADD_LIBS([aribsub],[-laribb24])
2957       AC_DEFINE(HAVE_ARIBB24, 1, [Define if libaribb24 is available.])
2958     ],[
2959       AC_MSG_WARN(Library [aribb24] needed for [aribsub] was not found)
2960       have_aribb24="no"
2961   ])
2963 AM_CONDITIONAL([HAVE_ARIBB24], [test x"${have_aribb24}" = x"yes"])
2966 dnl ARIB B25
2968 PKG_ENABLE_MODULES_VLC([ARIBB25], [aribcam], [aribb25 >= 0.2.6], [ARIB STD-B25], [auto])
2971 dnl  kate decoder plugin
2973 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2976 dnl  tiger rendering for kate decoder plugin
2978 AC_ARG_ENABLE(tiger,
2979 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2980 AS_IF([test "${enable_tiger}" != "no"], [
2981   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2982       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2983         AS_IF([test -n "${enable_tiger}"], [
2984           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2985         ])
2986   ])
2991 dnl  Video plugins
2994 EXTEND_HELP_STRING([Video plugins:])
2997 dnl  OpenGL
2999 PKG_CHECK_MODULES([EGL], [egl], [
3000   have_egl="yes"
3001 ], [
3002   have_egl="no"
3004 AM_CONDITIONAL([HAVE_EGL], [test "${have_egl}" = "yes"])
3006 have_gl="no"
3007 PKG_CHECK_MODULES([GL], [gl], [
3008   have_gl="yes"
3009 ], [
3010   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3011 #ifdef _WIN32
3012 # include <GL/glew.h>
3013 #endif
3014 #include <GL/gl.h>
3015 ]], [
3016     [int t0 = GL_TEXTURE0;]])
3017   ], [
3018     GL_CFLAGS=""
3019     have_gl="yes"
3020     AS_IF([test "${SYS}" != "mingw32"], [
3021       GL_LIBS="-lGL"
3022     ], [
3023       GL_LIBS="-lopengl32"
3024     ])
3025   ])
3027 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
3029 dnl OpenGL ES 2: depends on EGL 1.1
3030 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
3031 dnl OpenGL ES 1: depends on EGL 1.0
3032 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
3035 dnl  Xlib
3038 AC_PATH_XTRA()
3039 AC_CHECK_HEADERS(X11/Xlib.h)
3042 dnl  X C Bindings modules
3044 AC_ARG_ENABLE(xcb,
3045   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3046   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"], [
3047     enable_xcb="yes"
3048   ], [
3049     enable_xcb="no"
3050   ])
3052 AC_ARG_ENABLE(xvideo,
3053   [  --enable-xvideo         XVideo support (default enabled)],, [
3054     enable_xvideo="$enable_xcb"
3057 have_xcb="no"
3058 have_xcb_keysyms="no"
3059 have_xcb_randr="no"
3060 have_xcb_xvideo="no"
3061 AS_IF([test "${enable_xcb}" != "no"], [
3062   dnl libxcb
3063   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3064   have_xcb="yes"
3065   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3066   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3067   PKG_CHECK_MODULES(XPROTO, [xproto])
3069   AS_IF([test "${enable_xvideo}" != "no"], [
3070     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3071   ])
3073   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3075   dnl xcb-utils
3076   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3077     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3078   ])
3080 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3081 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3082 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3083 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3087 dnl VDPAU needs X11
3089 AC_ARG_ENABLE(vdpau,
3090   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3091 have_vdpau="no"
3092 AS_IF([test "${enable_vdpau}" != "no"], [
3093   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3094     have_vdpau="yes"
3095     AS_IF([test "${no_x}" = "yes"], [
3096       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3097     ])
3098   ], [
3099     AS_IF([test -n "${enable_vdpau}"], [
3100       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3101     ])
3102   ])
3104 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3106 have_avcodec_vdpau="no"
3107 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3108   case "${avfork}" in
3109     libav) av_vdpau_ver="55.26.0" ;;
3110     ffmpeg) av_vdpau_ver="55.42.100" ;;
3111   esac
3112   PKG_CHECK_EXISTS([libavutil >= 52.4.0 libavcodec >= ${av_vdpau_ver}], [
3113     have_avcodec_vdpau="yes"
3114     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3115   ], [
3116     AS_IF([test -n "${enable_vdpau}"], [
3117       AC_MSG_ERROR([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3118     ], [
3119       AC_MSG_WARN([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3120     ])
3121   ])
3123 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3127 dnl  Wayland
3129 AC_ARG_ENABLE(wayland,
3130   [AS_HELP_STRING([--enable-wayland], [Wayland support (default auto)])])
3131 have_wayland="no"
3132 AC_ARG_VAR([WAYLAND_SCANNER], [Wayland scanner utility])
3134 AS_IF([test "${enable_wayland}" != "no"], [
3135   AC_MSG_CHECKING([for the Wayland scanner])
3136   AS_IF([test -z "$WAYLAND_SCANNER"], [
3137     PKG_CHECK_EXISTS([wayland-scanner], [
3138       WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
3139     ], [
3140       WAYLAND_SCANNER="wayland-scanner"
3141     ])
3142   ])
3143   AC_MSG_RESULT([$WAYLAND_SCANNER])
3145   PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91], [
3146     have_wayland="yes"
3147   ], [
3148     AS_IF([test -n "${enable_wayland}"], [
3149       AC_MSG_ERROR([${WAYLAND_CLIENT_PKG_ERRORS}.])
3150     ])
3151   ])
3153   AS_IF([test "${have_egl}" = "yes"], [
3154     PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [
3155       have_wayland_egl="yes"
3156     ], [
3157       AS_IF([test -n "${enable_wayland}"], [
3158         AC_MSG_ERROR([${WAYLAND_EGL_PKG_ERRORS}.])
3159       ])
3160     ])
3161   ])
3163 AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
3164 AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "${have_wayland_egl}" = "yes"])
3168 dnl  SDL module
3170 AC_ARG_ENABLE(sdl,
3171   [  --enable-sdl            SDL support (default enabled)])
3172 AC_ARG_ENABLE(sdl-image,
3173   [  --enable-sdl-image      SDL image support (default enabled)])
3174 if test "${enable_sdl}" != "no"
3175 then
3176    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3177       # SDL on Darwin is heavily patched and can only run SDL_image
3178       if test "${SYS}" != "darwin"; then
3179         VLC_ADD_PLUGIN([vout_sdl])
3180       fi
3182       # SDL_image
3183       AS_IF([ test "${enable_sdl_image}" != "no"],[
3184         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3185           VLC_ADD_PLUGIN([sdl_image])],
3186           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3187           ])
3188       ])
3189    ],[
3190      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3191    ])
3195 dnl  freetype module
3197 AC_ARG_ENABLE(freetype,
3198   [  --enable-freetype       freetype support   (default auto)])
3199 AC_ARG_ENABLE(fribidi,
3200   [  --enable-fribidi        fribidi support    (default auto)])
3201 AC_ARG_ENABLE(harfbuzz,
3202   [  --enable-harfbuzz       harfbuzz support   (default auto)])
3203 AC_ARG_ENABLE(fontconfig,
3204   [  --enable-fontconfig     fontconfig support (default auto)])
3206 AC_ARG_WITH([default-font],
3207     AS_HELP_STRING([--with-default-font=PATH],
3208         [Path to the default font]),
3209         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3210             "$withval", [Default font])])
3211 AC_ARG_WITH([default-monospace-font],
3212     AS_HELP_STRING([--with-default-monospace-font=PATH],
3213         [Path to the default font]),
3214         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3215             "$withval", [Default monospace font])])
3217 AC_ARG_WITH([default-font-family],
3218     AS_HELP_STRING([--with-default-font-family=NAME],
3219         [Path to the default font family]),
3220         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3221             "$withval", [Default font family])])
3222 AC_ARG_WITH([default-monospace-font-family],
3223     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3224         [Path to the default font family]),
3225         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3226             "$withval", [Default monospace font family])])
3228 have_freetype="no"
3229 have_fontconfig="no"
3230 have_fribidi="no"
3231 have_harfbuzz="no"
3233 if test "${enable_freetype}" != "no"; then
3234    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3235       have_freetype="yes"
3236       VLC_ADD_CPPFLAGS([skins2],[${FREETYPE_CFLAGS}])
3237       VLC_ADD_LIBS([skins2],[${FREETYPE_LIBS}])
3239       dnl fontconfig support
3240       if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
3241           if test "${enable_fontconfig}" != "no"; then
3242             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3243               have_fontconfig="yes"
3244             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3245           fi
3246       fi
3248       dnl fribidi support
3249       if test "${enable_fribidi}" != "no"; then
3250         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3251           have_fribidi="yes"
3252           VLC_ADD_CPPFLAGS([skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3253           VLC_ADD_LIBS([skins2], [${FRIBIDI_LIBS}])
3254         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional text and complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3255       fi
3257       dnl harfbuzz support
3258       if test "${have_fribidi}" != "no"; then
3259         if test "${enable_harfbuzz}" != "no"; then
3260           PKG_CHECK_MODULES(HARFBUZZ, harfbuzz, [
3261             have_harfbuzz="yes"
3262             VLC_ADD_CPPFLAGS([skins2], [${HARFBUZZ_CFLAGS} -DHAVE_HARFBUZZ])
3263             VLC_ADD_LIBS([skins2], [${HARFBUZZ_LIBS}])
3264           ],[AC_MSG_WARN([${HARFBUZZ_PKG_ERRORS}. Support for complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3265         fi
3266       fi
3267   ],[
3268   AS_IF([test -n "${enable_freetype}"],[
3269     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3270     ])
3271   ])
3274 AM_CONDITIONAL([HAVE_FREETYPE], [test "${have_freetype}" = "yes"])
3275 AM_CONDITIONAL([HAVE_FONTCONFIG], [test "${have_fontconfig}" = "yes"])
3276 AM_CONDITIONAL([HAVE_FRIBIDI], [test "${have_fribidi}" = "yes"])
3277 AM_CONDITIONAL([HAVE_HARFBUZZ], [test "${have_harfbuzz}" = "yes"])
3280 dnl SAPI (text to Speech renderer for Windows)
3282 AC_LANG_PUSH([C++])
3283 AC_CHECK_TYPES([ISpObjectToken],[
3284               have_sapi="yes"
3285             ],[AC_MSG_WARN([sapi.h not found. Text to Speech renderer for Windows disabled])],
3286               [#include <windows.h>
3287                #include <sapi.h>
3288                #include <sphelper.h>])
3289 AM_CONDITIONAL([HAVE_SAPI], [test "${have_sapi}" = "yes"])
3290 AC_LANG_POP([C++])
3293 dnl  SVG module (text rendering and image decoding)
3295 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3296 PKG_ENABLE_MODULES_VLC([SVGDEC], [], [librsvg-2.0 >= 2.9.0 cairo >= 1.13.1], [SVG image decoder library],[auto])
3299 dnl  Windows DirectX module
3302 AC_ARG_ENABLE(directx,
3303   [AS_HELP_STRING([--enable-directx],
3304     [Microsoft DirectX support (default enabled on Windows)])],, [
3305   AS_IF([test "${SYS}" = "mingw32"], [
3306     enable_directx="yes"
3307   ], [
3308     enable_directx="no"
3309   ])
3311 AS_IF([test "${enable_directx}" != "no"], [
3312   dnl DirectDraw
3313   AC_CHECK_HEADERS(ddraw.h, [
3314     VLC_ADD_PLUGIN([directdraw])
3315   ])
3317   dnl OpenGL
3318   AC_CHECK_HEADERS(GL/wglew.h, [
3319     VLC_ADD_PLUGIN([glwin32 wgl])
3320   ],, [
3321     #include <windows.h>
3322     #include <GL/gl.h>
3323   ])
3325   dnl Direct3D11
3326   AC_CHECK_HEADERS(d3d11.h, [
3327     VLC_ADD_PLUGIN([direct3d11])
3328   ])
3330   dnl Direct3D9
3331   AC_CHECK_HEADERS(d3d9.h, [
3332     VLC_ADD_PLUGIN([direct3d9])
3333   ])
3335   dnl Direct2D
3336   AC_CHECK_HEADERS(d2d1.h, [
3337     VLC_ADD_PLUGIN([direct2d])
3338   ])
3342 dnl  Linux framebuffer module
3344 AC_CHECK_HEADER([linux/fb.h], [
3345   VLC_ADD_PLUGIN([fb])
3350 dnl  DirectFB module
3351 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3352 dnl  TODO: support for static linking
3354 AC_ARG_ENABLE(directfb,
3355   [  --enable-directfb       DirectFB support (default disabled)])
3356 AC_ARG_WITH(directfb,
3357   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3359 if test "${enable_directfb}" = "yes"; then
3360     have_directfb="false"
3361     CPPFLAGS_mydirectfb=
3362     LIBS_mydirectfb=
3363     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3364         dnl Trying the given location
3365         VLC_SAVE_FLAGS
3367         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3368         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3370         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3371         LIBS="${LIBS} ${LIBS_new}"
3373         dnl FIXME: too obscure
3374         AC_CHECK_HEADER([directfb.h], [
3375             AC_CHECK_LIB([direct],[direct_initialize], [
3376                 AC_CHECK_LIB([fusion], [fusion_enter], [
3377                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3378                 ], have_directfb="false")
3379             ], have_directfb="false")
3380         ], have_directfb="false")
3382         VLC_RESTORE_FLAGS
3384         if test "${have_directfb}" = "true"; then
3385             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3386             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3387         fi
3388     else
3389         dnl Look for directfb-config
3390         AC_CHECK_PROG(DIRECTFB_CONFIG, [directfb-config], [false])
3391         AS_IF(["${DIRECTFB_CONFIG}" != "false"], [
3392             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3393             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3394             have_directfb="true"
3395         ], [
3396             dnl Trying with pkg-config
3397             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3398                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3399                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3400                 have_directfb="true"
3401                 ], [have_directfb="false"])
3402         ])
3403     fi
3404     if test "${have_directfb}" = "true"; then
3405         VLC_ADD_PLUGIN([directfb])
3406         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3407         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3408     else
3409         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3410     fi
3414 dnl  AA plugin
3416 AC_ARG_ENABLE(aa,
3417   [  --enable-aa             aalib output (default disabled)])
3418 if test "${enable_aa}" = "yes"
3419 then
3420   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3421   if test "${have_aa}" = "true"
3422   then
3423     VLC_ADD_PLUGIN([aa])
3424   fi
3428 dnl  libcaca plugin
3430 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3433 dnl  OS/2 KVA plugin
3435 AC_ARG_ENABLE(kva,
3436   [AS_HELP_STRING([--enable-kva],
3437     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3438   AS_IF([test "$SYS" = "os2"], [
3439     enable_kva="yes"
3440   ])
3442 have_kva="no"
3443 KVA_LIBS=""
3444 AS_IF([test "$enable_kva" != "no"], [
3445   AC_CHECK_HEADERS([kva.h], [
3446     have_kva="yes"
3447     AC_CHECK_LIB(kva, main, [
3448       KVA_LIBS="-lkva"
3449     ])
3450   ])
3452 AC_SUBST(KVA_LIBS)
3453 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3456 dnl MMAL plugin
3458 AC_ARG_ENABLE(mmal,
3459   AS_HELP_STRING([--enable-mmal],
3460     [Multi-Media Abstraction Layer (MMAL) hardware plugin (default enable)]))
3461 if test "${enable_mmal}" != "no"; then
3462   VLC_SAVE_FLAGS
3463   LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
3464   CPPFLAGS="${CPPFLAGS} -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
3465   AC_CHECK_HEADERS(interface/mmal/mmal.h,
3466     [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
3467         have_mmal="yes"
3468         VLC_ADD_PLUGIN([mmal])
3469         VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
3470         VLC_ADD_CFLAGS([mmal],[ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux ])
3471         VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lvchostif ]) ], [
3472           AS_IF([test "${enable_mmal}" = "yes"],
3473             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
3474             [ AC_MSG_WARN([Cannot find bcm library...]) ])
3475           ],
3476         [])
3477     ] , [ AS_IF([test "${enable_mmal}" = "yes"],
3478       [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
3479       [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
3480   VLC_RESTORE_FLAGS
3482 AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
3485 dnl evas plugin
3487 AC_ARG_ENABLE(evas,
3488   [AS_HELP_STRING([--enable-evas],
3489     [use evas output module (default disabled)])])
3490 have_evas="no"
3491 AS_IF([test "${enable_evas}" = "yes"], [
3492   PKG_CHECK_MODULES(EVAS, [evas >= 1.15.99 ecore >= 1.15.99], [
3493       have_evas="yes"
3494       AC_DEFINE([HAVE_EVAS], [1], [Define to 1 if evas is enabled.])
3495     ],[
3496     AS_IF([test "x${enable_evas}" != "x"], [
3497       AC_MSG_ERROR([$EVAS_PKG_ERRORS. libevas and libecore 1.15.99 or later required.])
3498     ])
3499   ])
3501 AM_CONDITIONAL([HAVE_EVAS], [test "${have_evas}" = "yes"])
3504 dnl  Audio plugins
3507 EXTEND_HELP_STRING([Audio plugins:])
3510 dnl  Pulseaudio module
3512 AC_ARG_ENABLE(pulse,
3513   [AS_HELP_STRING([--enable-pulse],
3514     [use the PulseAudio client library (default auto)])])
3515 have_pulse="no"
3516 AS_IF([test "${enable_pulse}" != "no"], [
3517   PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0], [
3518     have_pulse="yes"
3519   ], [
3520     AS_IF([test "x${enable_pulse}" != "x"], [
3521       AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 1.0 or later required.])
3522     ])
3523   ])
3525 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3528 dnl  ALSA module
3530 AC_ARG_ENABLE(alsa,
3531   [AS_HELP_STRING([--enable-alsa],
3532     [support the Advanced Linux Sound Architecture (default auto)])],, [
3533   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3534     enable_alsa="yes"
3535   ])
3537 have_alsa="no"
3538 AS_IF([test "${enable_alsa}" != "no"], [
3539   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3540     have_alsa="yes"
3541   ], [
3542     AS_IF([test "x${enable_alsa}" != "x"], [
3543       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3544     ])
3545   ])
3547 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3550 dnl  Open Sound System module
3552 AC_ARG_ENABLE(oss,
3553   [AS_HELP_STRING([--enable-oss],
3554     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3555   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3556     enable_oss="no"
3557   ])
3559 have_oss="no"
3560 OSS_LIBS=""
3561 AS_IF([test "$enable_oss" != "no"], [
3562   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3563     have_oss="yes"
3564     AC_CHECK_LIB(ossaudio, main, [
3565       OSS_LIBS="-lossaudio"
3566     ])
3567   ])
3569 AC_SUBST(OSS_LIBS)
3570 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3573 dnl  OpenBSD sndio module
3575 AC_ARG_ENABLE([sndio],
3576   [AS_HELP_STRING([--disable-sndio],
3577     [support the OpenBSD sndio (default auto)])],, [
3578   AS_IF([test "$SYS" = "openbsd"], [
3579     enable_sndio="yes"
3580   ])
3582 have_sndio="no"
3583 AS_IF([test "$enable_sndio" != "no"], [
3584   AC_CHECK_HEADER([sndio.h], [
3585     have_sndio="yes"
3586   ])
3588 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3591 dnl  Windows Audio Session plugin
3593 AC_ARG_ENABLE([wasapi],
3594   [AS_HELP_STRING([--enable-wasapi],
3595     [use the Windows Audio Session API (default auto)])
3597 have_wasapi="no"
3598 AS_IF([test "$enable_wasapi" != "no"], [
3599   AC_CHECK_HEADER([audioclient.h], [
3600     have_wasapi="yes"
3601   ], [
3602     AS_IF([test "x${enable_wasapi}" != "x"], [
3603       AC_MSG_ERROR([Windows Audio Session API not found.])
3604     ])
3605   ])
3607 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3610 dnl  AudioQueue plugin
3612 AC_ARG_ENABLE(audioqueue,
3613   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3614 if test "${enable_audioqueue}" = "yes"
3615 then
3616   VLC_ADD_PLUGIN([audioqueue])
3620 dnl  JACK modules
3622 AC_ARG_ENABLE(jack,
3623   [AS_HELP_STRING([--disable-jack],
3624     [do not use jack (default auto)])])
3625 have_jack="no"
3626 AS_IF([test "${enable_jack}" != "no"], [
3627     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3628       [ have_jack=yes ],
3629       [
3630       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3632       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3633       [ have_jack=yes ],
3634       [
3635       AS_IF([test -n "${enable_jack}"],
3636          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3637          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3638       ])
3639     ])
3641 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3644 dnl  OpenSLES Android
3646 AC_ARG_ENABLE(opensles,
3647   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3648 if test "${HAVE_ANDROID}" = "1"; then
3649   if test "${enable_opensles}" = "yes"; then
3650       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3651         [ VLC_ADD_PLUGIN([opensles_android]) ],
3652         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3653   fi
3657 dnl  Tizen audio
3659 AC_ARG_ENABLE(tizen_audio,
3660   [AS_HELP_STRING([--enable-tizen-audio],
3661     [Tizen audio module (default enabled on Tizen)])],, [
3662   AS_IF([test "$HAVE_TIZEN" = "1"], [
3663     enable_tizen_audio="yes"
3664   ])
3666 if test "${enable_tizen_audio}" = "yes"; then
3667   AC_CHECK_HEADERS(audio_io.h,
3668     [ VLC_ADD_PLUGIN([tizen_audio]) ],
3669     [ AC_MSG_ERROR([cannot find Tizen audio_io headers])] )
3673 dnl libsamplerate plugin
3675 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3678 dnl  soxr module
3680 PKG_ENABLE_MODULES_VLC([SOXR], [], [soxr >= 0.1.2], [SoX Resampler library], [auto])
3683 dnl  OS/2 KAI plugin
3685 AC_ARG_ENABLE(kai,
3686   [AS_HELP_STRING([--enable-kai],
3687     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3688   AS_IF([test "$SYS" = "os2"], [
3689     enable_kai="yes"
3690   ])
3692 have_kai="no"
3693 KAI_LIBS=""
3694 AS_IF([test "$enable_kai" != "no"], [
3695   AC_CHECK_HEADERS([kai.h], [
3696     have_kai="yes"
3697     AC_CHECK_LIB(kai, main, [
3698       KAI_LIBS="-lkai"
3699     ])
3700   ])
3702 AC_SUBST(KAI_LIBS)
3703 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3706 dnl  chromaprint audio track fingerprinter
3708 m4_pushdef([libchromaprint_version], 0.6.0)
3709 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3710     VLC_ADD_PLUGIN([stream_out_chromaprint]),
3711     AS_IF([test "${enable_chromaprint}" = "yes"],
3712         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3713         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3714          ),
3715     [(Chromaprint based audio fingerprinter)],[auto])
3716 m4_popdef([libchromaprint_version])
3719 dnl  Chromecast streaming support
3721 m4_pushdef([protobuf_lite_version], 2.5.0)
3722 AC_ARG_VAR(PROTOC, [protobuf compiler])
3723 AC_CHECK_PROGS(PROTOC, protoc, no)
3724 PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
3725     AS_IF([test "x${PROTOC}" != "xno"], [
3726         build_chromecast="yes"
3727     ], [
3728     AC_MSG_ERROR(protoc compiler needed for [chromecast] was not found)
3729     ])
3730 ], [
3731     AS_IF([test "${enable_chromecast}" = "yes"],
3732         AC_MSG_ERROR(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found),
3733         AC_MSG_WARN(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found)
3734     )
3735     enable_chromecast="no"
3736 ], [(Chromecast streaming support)], [auto])
3737 AM_CONDITIONAL([BUILD_CHROMECAST], [test "${build_chromecast}" = "yes"])
3738 m4_popdef([protobuf_lite_version])
3741 dnl  Interface plugins
3744 EXTEND_HELP_STRING([Interface plugins:])
3747 dnl QT
3749 AC_ARG_ENABLE(qt, [
3750   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3751   AS_IF([test "${SYS}" = "darwin"], [
3752     enable_qt="no"
3753   ])
3755 AS_IF([test "${enable_qt}" != "no"], [
3756   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.2.0 Qt5Widgets Qt5Gui], [
3757       PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
3758           VLC_ADD_LIBS([qt],[${QTX11_LIBS}])
3759           VLC_ADD_CXXFLAGS([qt],[${QTX11_CFLAGS} -DQT5_HAS_X11])
3760           PKG_CHECK_MODULES([XI], [xi], [
3761             VLC_ADD_LIBS([qt], [${XI_LIBS}])
3762             VLC_ADD_CXXFLAGS([qt], [${XI_CFLAGS} -DHAVE_XI])
3763           ], [
3764             PKG_CHECK_EXISTS([Qt5Gui >= 5.5], [
3765               AC_MSG_ERROR([${XI_PKG_ERRORS}.])
3766             ], [
3767               AC_MSG_WARN([${XI_PKG_ERRORS}.])
3768             ])
3769           ])
3770       ],[
3771           AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
3772       ])
3773       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3774       QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
3775       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3776       AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3777       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3778     ], [
3779       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.8.0],, [
3780         AS_IF([test -n "${enable_qt}"],[
3781           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3782         ],[
3783           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3784         ])
3785         enable_qt="no"
3786       ])
3787       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3788       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin"])
3789       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin])
3790       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin"])
3791     ])
3793 AS_IF([test "${enable_qt}" != "no"], [
3794   VLC_ADD_PLUGIN([qt])
3795   ALIASES="${ALIASES} qvlc"
3797 AM_CONDITIONAL(ENABLE_QT, [test "$enable_qt" != "no"])
3800 dnl detect kde4-config patch (used for kde solids).
3802 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
3803 AS_IF([test "x$KDE4_CONFIG" = "x"], [
3804   KDE4_CONFIG="kde4-config"
3808 dnl Simple test for skins2 dependency
3810 AS_IF([test "$enable_qt" = "no"], [
3811   AS_IF([test "${enable_skins2}" = "yes"], [
3812     AC_MSG_ERROR([The skins2 module depends on the Qt 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 Qt development package or alternatively you can also configure with: --disable-qt --disable-skins2.])
3813   ], [
3814     enable_skins2="no"
3815     AC_MSG_WARN([The skins2 module depends on the Qt interface, Qt is not built so skins2 is disabled.])
3816   ])
3820 dnl Skins2 module
3822 AC_ARG_ENABLE(skins2,
3823   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3824 AS_IF([test "${enable_skins2}" != "no"], [
3825   have_skins_deps="yes"
3827   dnl Win32
3828   AS_IF([test "${SYS}" = "mingw32"], [
3829     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3830     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3831   dnl MacOS
3832   ], [test "${SYS}" = "darwin"], [
3833     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3834     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3835   dnl OS/2
3836   ], [test "${SYS}" = "os2"], [
3837     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3838   dnl Linux/Unix
3839   ], [
3840     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3841     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3842     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3843     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3844     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3845   ])
3847   dnl for All OSes
3848   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3850   dnl we need freetype
3851   AS_IF([test "${have_freetype}" != "yes"], [
3852     have_skins_deps="no"
3853   ])
3855   AS_IF([test "${have_skins_deps}" = "no"], [
3856     AS_IF([test "x${enable_skins2}" = "x"], [
3857       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3858     ], [
3859       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3860     ])
3861     enable_skins2="no"
3862   ], [
3863     VLC_ADD_PLUGIN([skins2])
3864     ALIASES="${ALIASES} svlc"
3865     enable_skins2="yes"
3866   ])
3868 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3870 AC_ARG_ENABLE(libtar,
3871   [  --enable-libtar         libtar support for skins2 (default auto)])
3872 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3873   AC_CHECK_HEADERS(libtar.h, [
3874     VLC_ADD_LIBS([skins2],[-ltar])
3875   ])
3879 dnl  MacOS X gui module
3881 AC_ARG_ENABLE(macosx,
3882   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3883 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3884 then
3885   VLC_ADD_PLUGIN([macosx])
3887   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3888   then
3889     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3890   fi
3892 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3895 dnl  MacOS X sparkle update support
3897 AC_ARG_ENABLE(sparkle,
3898   [  --enable-sparkle        Sparkle update support for OS X (default enabled on Mac OS X)])
3899 if test "x${enable_sparkle}" != "xno" -a "${HAVE_OSX}" = "1"
3900 then
3901   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3902   then
3903     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3904   fi
3906   AC_DEFINE([HAVE_SPARKLE], [1], [Define to 1 if sparkle is enabled.])
3908 AM_CONDITIONAL(HAVE_SPARKLE, [test "$enable_sparkle" != "no"])
3912 dnl  Minimal Mac OS X module
3914 AC_ARG_ENABLE(minimal-macosx,
3915   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3916 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3917 then
3918   VLC_ADD_PLUGIN([minimal_macosx])
3922 dnl  VideoToolbox plugins
3923 AC_CHECK_HEADERS(VideoToolbox/VideoToolbox.h, [
3924     VLC_ADD_PLUGIN([videotoolbox])
3925     VLC_ADD_PLUGIN([cvpx_i420])
3926   ])
3929 dnl  ncurses module
3931 AC_ARG_ENABLE(ncurses,
3932 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3933 have_ncurses="no"
3934 AS_IF([test "${enable_ncurses}" != "no"] ,[
3935   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3936     have_ncurses="yes"
3937     ALIASES="${ALIASES} nvlc"
3938   ], [
3939     AS_IF([test -n "${enable_ncurses}"], [
3940       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3941     ])
3942   ])
3944 AM_CONDITIONAL([HAVE_NCURSES], [test "${have_ncurses}" = "yes"])
3947 dnl  Lirc plugin
3949 AC_ARG_ENABLE(lirc,
3950   [  --enable-lirc           lirc support (default disabled)])
3951 have_lirc="no"
3952 AS_IF([test "${enable_lirc}" = "yes"], [
3953   AC_CHECK_HEADER(lirc/lirc_client.h, [
3954     AC_CHECK_LIB(lirc_client, lirc_init, [
3955       have_lirc="true"
3956     ])
3957   ])
3959 AM_CONDITIONAL([HAVE_LIRC], [test "${have_lirc}" = "yes"])
3961 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3963 dnl  goom visualization plugin
3965 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3968 dnl libprojectM visualization plugin
3970 AC_ARG_ENABLE(projectm,
3971   [  --enable-projectm       projectM visualization plugin (default enabled)])
3972 AS_IF([test "${enable_projectm}" != "no"],
3973   [
3974     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3975     [
3976       VLC_ADD_PLUGIN([projectm])
3977       PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
3978         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3979         [ AC_MSG_WARN( [Using libprojectM version 1] )
3980       ])
3981     ],[
3982       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3983     ])
3984   ])
3987 dnl Vovoid VSXu visualization plugin
3989 AC_ARG_ENABLE(vsxu,
3990   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3991 AS_IF([test "${enable_vsxu}" != "no"],
3992   [
3993     PKG_CHECK_MODULES(VSXU, libvsxu,
3994     [
3995       VLC_ADD_PLUGIN([vsxu])
3996     ],[
3997       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3998     ])
3999   ])
4001 EXTEND_HELP_STRING([Service Discovery plugins:])
4003 dnl  Avahi-Zeroconf services discovery
4004 PKG_ENABLE_MODULES_VLC([AVAHI], [], [avahi-client >= 0.6], [Zeroconf services discovery], [auto])
4007 dnl  libudev services discovery
4008 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
4011 dnl MTP devices services discovery
4012 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
4015 dnl UPnP Plugin (Intel SDK)
4017 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
4020 dnl mDNS using libmicrodns
4022 PKG_ENABLE_MODULES_VLC([MICRODNS], [], [microdns], [mDNS services discovery], [auto])
4025 EXTEND_HELP_STRING([Misc options:])
4028 dnl  libxml2 module
4030 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
4034 dnl libgcrypt
4036 AC_ARG_ENABLE(libgcrypt,
4037   [  --disable-libgcrypt     gcrypt support (default enabled)])
4038 AC_ARG_VAR([GCRYPT_CFLAGS], [C compiler flags for gcrypt])
4039 AC_ARG_VAR([GCRYPT_LIBS], [linker flags flags for gcrypt])
4041 # require libgcrypt >= 1.6.0
4042 AS_IF([test "${enable_libgcrypt}" != "no"], [
4043   AC_CACHE_CHECK([for gcrypt 1.6.0 or later], [ac_cv_lib_gcrypt], [
4044     VLC_SAVE_FLAGS
4045     CFLAGS="${CFLAGS} ${GCRYPT_CFLAGS}"
4046     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
4047 [#include <gcrypt.h>
4048 #if GCRYPT_VERSION_NUMBER < 0x010600
4049 #error
4050 #endif]])], [
4051       ac_cv_lib_gcrypt=yes
4052     ], [
4053       ac_cv_lib_gcrypt=no
4054     ])
4055     VLC_RESTORE_FLAGS
4056   ])
4058   AS_IF([test "${ac_cv_lib_gcrypt}" = "yes"], [
4059     AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
4060   ], [
4061     AS_IF([test "${enable_libgcrypt}" = "yes"], [
4062       AC_MSG_ERROR([libgcrypt version 1.6.0 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
4063     ])
4064   ])
4067 AS_IF([test -z "$GCRYPT_LIBS"], [
4068   GCRYPT_LIBS="-lgcrypt -lgpg-error"
4071 AC_SUBST(GCRYPT_CFLAGS)
4072 AC_SUBST(GCRYPT_LIBS)
4073 AM_CONDITIONAL([HAVE_GCRYPT], [test "${ac_cv_lib_gcrypt}" = "yes"])
4076 dnl TLS/SSL
4078 AC_ARG_ENABLE(gnutls,
4079   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4080 AS_IF([test "${enable_gnutls}" != "no"], [
4081   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.2.0], [
4082     VLC_ADD_PLUGIN([gnutls])
4083   ], [
4084     AS_IF([test -n "${enable_gnutls}"], [
4085       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4086     ])
4087   ])
4092 dnl Taglib plugin
4094 AC_ARG_ENABLE(taglib,
4095   [AS_HELP_STRING([--disable-taglib],
4096     [do not use TagLib (default enabled)])])
4097 AS_IF([test "${enable_taglib}" != "no"], [
4098   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.9, [
4099     VLC_ADD_PLUGIN([taglib])
4100   ], [
4101     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4105 dnl  libsecret
4107 PKG_ENABLE_MODULES_VLC([SECRET], [], [libsecret-1 >= 0.18], [use libsecret for keystore], [auto])
4110 dnl  kwallet
4112 AC_ARG_ENABLE(kwallet,
4113   [AS_HELP_STRING([--enable-kwallet],
4114     [use kwallet (via D-Bus) for keystore (default enabled)])])
4115 AS_IF([test "${enable_kwallet}" != "no" -a "${have_dbus}" = "yes"], [
4116   VLC_ADD_PLUGIN([kwallet])
4120 dnl  Developers helper modules (should be hidden from configure help)
4122 AC_ARG_ENABLE(devtools, [], [], [enable_devtools="no"])
4123 AS_IF([test "${enable_devtools}" != "no"], [
4124   VLC_ADD_PLUGIN([accesstweaks])
4128 dnl update checking system
4130 AC_ARG_ENABLE(update-check,
4131   [  --enable-update-check   update checking system (default disabled)])
4132 if test "${enable_update_check}" = "yes"
4133 then
4134  AS_IF([test "${ac_cv_lib_gcrypt}" != "yes"],[
4135     AC_MSG_ERROR([libgcrypt is required for update checking system]) ])
4136   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4137   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4138   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4142 dnl OS X notification plugin
4144 AC_ARG_ENABLE(osx_notifications,
4145   [  --enable-osx-notifications          osx notification plugin (default disabled)],,
4146   [enable_osx_notifications=no])
4147 AS_IF([test "${enable_osx_notifications}" != "no"], [
4148     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4149       VLC_ADD_PLUGIN([osx_notifications])
4150       VLC_ADD_LIBS([osx_notifications], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4151       VLC_ADD_OBJCFLAGS([osx_notifications], [-F${CONTRIB_DIR}])
4152       VLC_ADD_OBJCFLAGS([osx_notifications], [-fobjc-exceptions] )
4153     ])
4154   ]
4158 dnl Libnotify notification plugin
4160 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4163 dnl  Endianness check
4165 AC_C_BIGENDIAN
4166 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4167   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4168 ], [
4169   DEFS_BIGENDIAN=""
4171 AC_SUBST(DEFS_BIGENDIAN)
4174 dnl Where to install KDE solid .desktop
4176 AC_ARG_WITH(kde-solid,
4177   AS_HELP_STRING([--with-kde-solid=PATH],
4178                  [KDE Solid actions directory (auto)]),, [
4180 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4181   with_kde_solid="yes"
4184 soliddatadir=""
4185 AS_IF([test "${with_kde_solid}" != "no"], [
4186   AS_IF([test "${with_kde_solid}" = "yes"], [
4187     kde4datadir="`${KDE4_CONFIG} --install data`"
4188     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4189     soliddatadir="${kde4datadir}/solid/actions"
4190   ], [
4191     soliddatadir="${with_kde_solid}"
4192   ])
4194 AC_SUBST(soliddatadir)
4195 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4197 EXTEND_HELP_STRING([Components:])
4200 dnl  the VLC binary
4202 AC_ARG_ENABLE(vlc,
4203   [  --enable-vlc            build the VLC media player (default enabled)])
4204 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4206 AC_ARG_ENABLE(macosx-vlc-app,
4207   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4208 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4209     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4212 dnl  Stuff used by the program
4214 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4215 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4216 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4217 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4218 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4219 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4220 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4221 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4222 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4223 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4224 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4225 AC_SUBST(COPYRIGHT_MESSAGE)
4226 AC_SUBST(VERSION_MESSAGE)
4227 AC_SUBST(VERSION_MAJOR)
4228 AC_SUBST(VERSION_MINOR)
4229 AC_SUBST(VERSION_REVISION)
4230 AC_SUBST(VERSION_EXTRA)
4231 AC_SUBST(COPYRIGHT_YEARS)
4232 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4233 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4234 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4236 dnl  Handle substvars that use $(top_srcdir)
4238 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4241 dnl  Configuration is finished
4243 AC_SUBST(SYS)
4244 AC_SUBST(ARCH)
4245 AC_SUBST(ALIASES)
4246 AC_SUBST(ASM)
4247 AC_SUBST(MOC)
4248 AC_SUBST(RCC)
4249 AC_SUBST(UIC)
4250 AC_SUBST(WINDRES)
4251 AC_SUBST(WINE_SDK_PATH)
4252 AC_SUBST(LIBEXT)
4253 AC_SUBST(AM_CPPFLAGS)
4254 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4255 AC_SUBST(FILE_LIBVLCCORE_DLL)
4256 AC_SUBST(FILE_LIBVLC_DLL)
4258 AC_CONFIG_FILES([
4259   Makefile
4260   doc/Makefile
4261   modules/Makefile
4262   m4/Makefile
4263   po/Makefile.in
4264   share/Makefile
4265   compat/Makefile
4266   src/Makefile
4267   lib/Makefile
4268   bin/Makefile
4269   test/Makefile
4270   modules/gui/macosx/Makefile
4271   modules/gui/qt/Makefile
4272   modules/gui/skins2/Makefile
4273   modules/hw/mmal/Makefile
4274   share/vlc.appdata.xml.in
4277 AM_COND_IF([HAVE_WIN32], [
4278   AC_CONFIG_FILES([
4279     extras/package/win32/NSIS/spad.nsi
4280     extras/package/win32/NSIS/vlc.win32.nsi
4281     extras/package/win32/msi/config.wxi
4282   ])
4285 AM_COND_IF([HAVE_DARWIN], [
4286   AC_CONFIG_FILES([
4287     extras/package/macosx/Info.plist
4288     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4289   ])
4292 dnl Generate makefiles
4293 AC_OUTPUT
4295 dnl Do we have to use make or gmake ?
4296 if make --version 2>&1|grep -q GNU
4297 then
4298     # GNU make, all seems good
4299     MAKE=make
4300 else
4301     # Known GNU make alias (on BSD)
4302     MAKE=gmake
4304 dnl Shortcut to nice compile message
4305 if test -n $SHELL; then
4306   SHELL=${CONFIG_SHELL-/bin/sh}
4308 rm -f compile
4309 compile_top_srcdir=`sed -ne "s/^top_srcdir *= *//p" < Makefile`
4310 echo "#! $SHELL
4311 rm -f .error\$\$
4312 ERROR=0
4313 export PATH=\"$PATH\" LANG=C
4314 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| $compile_top_srcdir/extras/buildsystem/make.pl
4315 test -f .error\$\$ && ERROR=1
4316 rm -f .error\$\$
4317 exit \$ERROR" >compile
4318 chmod a+x compile
4320 echo "
4321 libvlc configuration
4322 --------------------
4323 version               : ${VERSION}
4324 system                : ${SYS}
4325 architecture          : ${ARCH}
4326 optimizations         : ${enable_optimizations}"
4327 if test "${enable_vlc}" != "no"; then
4328 echo "vlc aliases           :${ALIASES}"
4329 else
4330 echo "build vlc executable  : no"
4332 echo "
4333 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."