ttml demux: Fix potential memory leak
[vlc.git] / configure.ac
blob8e9123376dfb9efe04e015fc4673cb1b3a6f8008
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, optional)
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     ;;
122   openbsd*)
123     SYS=openbsd
124     CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/X11R6/include"
125     LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/X11R6/lib/"
126     ;;
127   netbsd*)
128     SYS=netbsd
129     ;;
130   dragonfly*)
131     SYS=dragonfly
132     ;;
133   darwin*)
135     dnl Force gcc "-arch" flag
136     ARCH_flag=""
137     case "${host}" in
138       i?86*)
139         ARCH_flag="-arch i386"
140       ;;
141       ppc64*)
142         ARCH_flag="-arch ppc64"
143       ;;
144       ppc*)
145         ARCH_flag="-arch ppc"
146       ;;
147       x86_64*)
148         ARCH_flag="-arch x86_64"
149       ;;
150       arm*)
151         ac_cv_c_bigendian="no"
152         ac_cv_c_attribute_packed="no"
153       ;;
154     esac
156     SYS=darwin
157     CFLAGS="${CFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu11 ${ARCH_flag}"
158     CXX="${CXX} -stdlib=libc++ -std=c++11"
159     CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
160     CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
161     OBJCFLAGS="${OBJCFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu11 ${ARCH_flag}"
162     LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
163     VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup,-framework,AppKit])
164     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,CoreServices])
166     AC_EGREP_CPP(yes,
167             [#import <TargetConditionals.h>
168              #if TARGET_OS_IPHONE
169              yes
170              #endif],
171              [HAVE_IOS="1"],
172              [HAVE_OSX="1"])
174     AC_EGREP_CPP(yes,
175             [#import <TargetConditionals.h>
176              #if TARGET_OS_TV
177              yes
178              #endif],
179              [HAVE_TVOS="1"
180              HAVE_IOS="0"
181              HAVE_OSX="0"
182              ],)
184     dnl Allow binaries created on Lion to run on earlier releases
185     AC_EGREP_CPP(yes,
186            [#import <Cocoa/Cocoa.h>
187             #ifdef MAC_OS_X_VERSION_10_7
188             yes
189             #endif],
190             [AC_MSG_RESULT([yes])
191             AC_LIBOBJ([getdelim])
192             AC_LIBOBJ([strndup])
193             AC_LIBOBJ([strnlen])],)
195     dnl
196     dnl  Handle Mac OS X SDK flags
197     dnl
198     AC_ARG_WITH(macosx-sdk,
199       [AS_HELP_STRING([--with-macosx-sdk=DIR],
200         [compile using the SDK in DIR])])
201     if test "${with_macosx_sdk}" != "" ; then
202         test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
203         CPP="${CPP} -isysroot ${with_macosx_sdk}"
204         CC="${CC} -isysroot ${with_macosx_sdk}"
205         CXX="${CXX} -isysroot ${with_macosx_sdk}"
206         OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
207         LD="${LD} -syslibroot ${with_macosx_sdk}"
208     fi
209     AC_ARG_WITH(macosx-version-min,
210       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
211         [compile for Mac OS X VERSION and above])])
212     if test "${with_macosx_version_min}" != "" ; then
213         CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
214         CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
215         CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
216         OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
217         LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
218     fi
219     ;;
220   *mingw32* | *cygwin* | *wince* | *mingwce*)
221     dnl Force libtool to not link to (shared) libgcc_s when detecting C++ dependencies
222     dnl When doing this test with -static-libgcc it will link on (static) libgcc_eh
223     CXXFLAGS="${CXXFLAGS} -static-libgcc"
224     AC_CHECK_TOOL(WINDRES, windres, :)
225     AC_CHECK_TOOL(OBJCOPY, objcopy, :)
226     AH_TOP([#if defined(_WIN32) && !defined(_WIN32_WINNT)])
227     AH_TOP([# define _WIN32_WINNT 0x0502 /* Windows XP SP2 */])
228     AH_TOP([#endif])
229     AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE 6.0 (and shell) APIs.])
230     AC_DEFINE([_UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
231     AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
232     AC_DEFINE([_ISOC99_SOURCE], [1], [Extensions to ISO C89 from ISO C99.])
233     AC_DEFINE([_ISOC11_SOURCE], [1], [Extensions to ISO C99 from ISO C11.])
234     AC_DEFINE([_POSIX_SOURCE], [1], [IEEE Std 1003.1.])
235     AC_DEFINE([_POSIX_C_SOURCE], [200809L], [IEEE Std 1003.1.])
236     AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition])
237     AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [XPG things and X/Open Unix extensions.])
238     AC_DEFINE([_BSD_SOURCE], [1], [ISO C, POSIX, and 4.3BSD things.])
239     AC_DEFINE([_SVID_SOURCE], [1], [ISO C, POSIX, and SVID things.])
241     case "${host_os}" in
242       *mingw32*)
243         SYS=mingw32
244         ;;
245       *cygwin*)
246         dnl Check if we are using the mno-cygwin mode in which case we are
247         dnl actually dealing with a mingw32 compiler.
248         AC_EGREP_CPP(yes,
249             [#ifdef _WIN32
250              yes
251              #endif],
252             SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
253         ;;
254     esac
256     if test "${SYS}" = "mingw32"; then
257         # DEP, ASLR, NO SEH
258         LDFLAGS="${LDFLAGS} -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase"
260         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
261         ac_default_prefix="`pwd`/_win32"
262         DESTDIR="`pwd`/_win32/"
264         dnl
265         dnl NSIS/MSI Installer prefix and WIN64
266         dnl
267         case "${host}" in
268             amd64*|x86_64*)
269                 HAVE_WIN64="1"
270                 WINDOWS_ARCH="x64"
271                 PROGRAMFILES="PROGRAMFILES64"
272                 LDFLAGS="${LDFLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x140000000"
273             ;;
274             *)
275                 WINDOWS_ARCH="x86"
276                 PROGRAMFILES="PROGRAMFILES"
277             ;;
278         esac
279         AC_SUBST(WINDOWS_ARCH)
280         AC_SUBST(PROGRAMFILES)
282     fi
283     ;;
284   *nto*)
285     SYS=nto
286     ;;
287   solaris*)
288     SYS=solaris
289     ;;
290   hpux*)
291     SYS=hpux
292     ;;
293   *os2*)
294     SYS=os2
295     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild -Zhigh-mem"
296     AC_LIBOBJ([freeaddrinfo])
297     AC_LIBOBJ([gai_strerror])
298     ;;
299   *)
300     SYS="${host_os}"
301     ;;
302 esac
304 dnl WinRT
305 AC_ARG_ENABLE(winstore_app,
306      AS_HELP_STRING([--enable-winstore-app],
307                     [Build targetted for Windows Store apps (default disabled)]))
309 vlc_winstore_app=0
310 AS_IF([test "${SYS}" = "mingw32"],[
311   LIBCOM="-lole32"
312   AS_IF([test "${enable_winstore_app}" = "yes"], [
313     vlc_winstore_app=1
314     LIBCOM=""
315      VLC_ADD_LIBS([libvlccore], [-lruntimeobject])
316      AC_LIBOBJ([gai_strerror])
317     ],[
318      VLC_ADD_LIBS([libvlccore],[-lwinmm])
319     ])
320   AC_SUBST(LIBCOM)
321   ])
322 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
324 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
325 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
327 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
328 AM_CONDITIONAL(HAVE_IOS,     test "${HAVE_IOS}" = "1")
329 AM_CONDITIONAL(HAVE_OSX,     test "${HAVE_OSX}" = "1")
330 AM_CONDITIONAL(HAVE_TVOS,    test "${HAVE_TVOS}" = "1")
332 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
333 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1") dnl Only used for the packaging
334 AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])
335 AM_CONDITIONAL([HAVE_WIN32_DESKTOP], [test "${SYS}" = "mingw32" -a "$vlc_winstore_app" = "0"])
338 dnl Sadly autoconf does not think about testing foo.exe when ask to test
339 dnl for program foo on win32
340 case "${build_os}" in
341     cygwin|msys|mingw32)
342         ac_executable_extensions=".exe"
343     ;;
344     os2*)
345         BUILDEXEEXT=".exe"
346     ;;
347     *)
348     ;;
349 esac
350 AC_SUBST(BUILDEXEEXT)
352 dnl Android is linux, but a bit different
353 AS_IF([test "$SYS" = linux],[
354     AC_MSG_CHECKING([for an Android system])
355     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
356         [[#ifndef __ANDROID__
357          # error Not Android
358          #endif
359         ]],[[;]])
360     ],[
361       HAVE_ANDROID="1"
362       AC_MSG_RESULT([yes])
363     ],[
364       AC_MSG_RESULT([no])
365     ])
367 AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
369 dnl Tizen (minimum SDK version: 2.3)
370 AS_IF([test "$SYS" = linux],[
371     AC_MSG_CHECKING([for Tizen])
372     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
373         [[#include <tizen.h>
374         ]],[[;]])
375     ],[
376       HAVE_TIZEN="1"
377       AC_DEFINE([HAVE_TIZEN_SDK], [1], [Define to 1 if vlc is built against Tizen SDK])
378       AC_MSG_RESULT([yes])
379     ],[
380       AC_MSG_RESULT([no])
381     ])
383 AM_CONDITIONAL(HAVE_TIZEN, test "${HAVE_TIZEN}" = "1")
386 dnl  Check for the contrib directory
388 AC_ARG_WITH(contrib,
389   [AS_HELP_STRING([--with-contrib[=DIR]],
390     [search for 3rd party libraries in DIR/include and DIR/lib])
392 AC_MSG_CHECKING([for 3rd party libraries path])
393 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
394   CONTRIB_DIR="${srcdir}/contrib/${host}"
395   AS_IF([test ! -d "${CONTRIB_DIR}"], [
396     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
397     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
398     AS_IF([test ! -d "${CONTRIB_DIR}"], [
399       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
400       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
401       AS_IF([test ! -d "${CONTRIB_DIR}"], [
402         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
403         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
404         AS_IF([test ! -d "${CONTRIB_DIR}"], [
405           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
406           CONTRIB_DIR=""
407           AC_MSG_RESULT([not found])
408         ])
409       ])
410     ])
411   ])
412 ], [
413   AS_IF([test "${with_contrib}" != "no"], [
414     CONTRIB_DIR="${with_contrib}"
415   ], [
416     CONTRIB_DIR=""
417     AC_MSG_RESULT([disabled])
418   ])
420 AS_IF([test -n "${CONTRIB_DIR}"], [
421   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
422     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
423   ], [
424     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
425     CONTRIB_DIR=""
426     AC_MSG_RESULT([not usable])
427   ])
430 AS_IF([test -n "${CONTRIB_DIR}"], [
431   AC_MSG_RESULT([${CONTRIB_DIR}])
432   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
433   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
434   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
435   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
436   export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
437   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
439   AS_IF([test -z "$LUAC"], [
440     dnl Old contribs mixed cross-tools and cross-compiled executables
441     AS_IF([test -x "${CONTRIB_DIR}/bin/luac"], [
442       LUAC="${CONTRIB_DIR}/bin/luac"
443     ])
445     dnl Newer contribs follow usual name space rules
446     AS_IF([test -x "${CONTRIB_DIR}/../bin/${host_alias}-luac"], [
447       LUAC="${CONTRIB_DIR}/../bin/${host_alias}-luac"
448     ])
449   ])
451   AS_IF([test "${SYS}" = "darwin"], [
452     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
453     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
454   ])
455 ], [
456   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
457     AC_MSG_ERROR([Third party libraries not found!])
458   ])
460 AC_SUBST(CONTRIB_DIR)
462 dnl Add extras/tools to the PATH
463 TOOLS_DIR="${srcdir}/extras/tools/build/bin"
464 AS_IF([test -d "${TOOLS_DIR}"], [
465     TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
466     export PATH="${TOOLS_DIR}":$PATH
470 dnl  Libtool
471 dnl  It's very bad, but our former custom system was worst
472 dnl  -- Courmisch
475 dnl override platform specific check for dependent libraries
476 dnl otherwise libtool linking of shared libraries will
477 dnl fail on anything other than pass_all.
478 AC_CACHE_VAL(lt_cv_deplibs_check_method,
479     [lt_cv_deplibs_check_method=pass_all])
481 LT_INIT([dlopen win32-dll shared disable-static])
482 LT_LANG([C++])
483 LT_LANG([Windows Resource])
485 DOLT
487 lt_cv_deplibs_check_method=pass_all
489 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
490   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
494 dnl Gettext stuff
496 AM_GNU_GETTEXT_VERSION([0.19.7])
497 AM_GNU_GETTEXT([external], [need-formatstring-macros])
500 dnl Iconv stuff
502 AM_ICONV
505 dnl checks for mingw
506 AS_IF([test "${SYS}" = "mingw32"], [
508 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
509 #if !defined(__MINGW32__)
510 # error Not compiling with mingw
511 #endif
512     ])], [
514 dnl Check for broken versions of mingw-runtime compatability library
515     AC_MSG_CHECKING(for broken mingw-runtime)
516     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
517 #include <_mingw.h>
518 #if defined(__MINGW64_VERSION_MAJOR)
519 # if __MINGW64_VERSION_MAJOR < 3
520 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
521 # endif
522 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
523 # error Attempting to use mingw-runtime with broken vsnprintf support
524 #endif
525     ])], [
526         AC_MSG_RESULT([ok])
527     ], [
528         AC_MSG_RESULT([present])
529         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
530     ])
532     dnl force use of mingw provided c99 *printf over msvcrt
533     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
535     dnl Add WinMainCRTStartup entry point to show it's a WinMain application
536     VLC_ADD_LDFLAGS([vlc],[-mwindows])
538     dnl Check for the need to include the mingwex lib for mingw32
539     VLC_SAVE_FLAGS
540     AC_CHECK_LIB(mingwex,opendir,
541         AC_CHECK_LIB(mingw32,opendir,,
542             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
543     )
544     VLC_RESTORE_FLAGS
545     ], [
546         AC_MSG_RESULT([Not compiling with mingw])
547     ])
549     dnl Check for fnative-struct or mms-bitfields support for mingw32
550     VLC_SAVE_FLAGS
551     CFLAGS="${CFLAGS} -mms-bitfields"
552     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
553     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
554         [ac_cv_c_mms_bitfields],
555         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
556     if test "${ac_cv_c_mms_bitfields}" = "no"; then
557         VLC_RESTORE_FLAGS
558         CFLAGS="${CFLAGS} -fnative-struct"
559         CXXFLAGS="${CXXFLAGS} -fnative-struct"
560         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
561             [ac_cv_c_fnative_struct],
562             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
563         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
564     fi
569 dnl Buggy glibc prevention. Purposedly not cached.
570 dnl See sourceware.org bugs 5058 and 5443.
571 dnl Ubuntu alone has 20 bug numbers for this...
573 AC_MSG_CHECKING(for buggy GNU/libc versions)
574 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
575 #include <limits.h>
576 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
577   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
578 # error GNU/libc with dcgettext killer bug!
579 #endif
580 ])], [
581   AC_MSG_RESULT([not present])
582 ], [
583   AC_MSG_RESULT([found])
584   AS_IF([test "x${enable_nls}" != "xno"], [
585     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
586 work-around for this. Check with your distribution vendor on how to update the
587 glibc run-time. Alternatively, build with --disable-nls.])
588   ])
591 dnl Plugin compilation stuff
593 VLC_LIBRARY_SUFFIX
595 dnl Check for system libs needed
596 need_libc=false
598 dnl Check for usual libc functions
599 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
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 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 tdestroy timegm timespec_get strverscmp])
602 AC_REPLACE_FUNCS([gettimeofday])
603 AC_CHECK_FUNCS(fdatasync,,
604   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
607 dnl mingw64 implements those as static inline, not functions with C linkage
608 VLC_REPLACE_DECL([asprintf], [#include <stdio.h>])
609 VLC_REPLACE_DECL([vasprintf], [#include <stdio.h>])
610 VLC_REPLACE_DECL([gmtime_r], [#include <time.h>])
611 VLC_REPLACE_DECL([localtime_r], [#include <time.h>])
613 dnl C11 static_assert()
614 AC_MSG_CHECKING([for static_assert in assert.h])
615 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
616 static_assert(1, "The impossible happened.");
617 ])], [
618   AC_MSG_RESULT([yes])
619   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
620 ], [
621   AC_MSG_RESULT([no])
624 # Windows CE does not have strcoll()
625 AC_FUNC_STRCOLL
627 dnl Check for non-standard system calls
628 case "$SYS" in
629   "linux")
630     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity recvmmsg])
631     ;;
632   "mingw32")
633     AC_CHECK_FUNCS([_lock_file])
634     ;;
635 esac
637 AH_BOTTOM([#include <vlc_fixups.h>])
639 dnl Check for struct pollfd
640 AC_CHECK_TYPES([struct pollfd],,,
641 [#include <sys/types.h>
642 #if HAVE_POLL
643 # include <poll.h>
644 #elif defined (_WIN32)
645 # include <winsock2.h>
646 #endif
649 dnl Check for struct timespec
650 AC_CHECK_TYPES([struct timespec],,,
651 [#include <time.h>])
653 dnl Check for max_align_t
654 AC_CHECK_TYPES([max_align_t],,,
655 [#include <stddef.h>])
657 dnl Checks for socket stuff
658 VLC_SAVE_FLAGS
659 SOCKET_LIBS=""
660 AC_SEARCH_LIBS(connect, [socket], [
661   AS_IF([test "$ac_cv_search_connect" != "none required"], [
662     SOCKET_LIBS="$ac_cv_search_connect"
663   ])
664 ], [
665   AS_IF([test "${SYS}" = "mingw32"], [
666     SOCKET_LIBS="-lws2_32"
667   ])
670 AC_SEARCH_LIBS([inet_pton], [nsl], [
671  AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [
672     SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS"
673   ])
674 ],, [${SOCKET_LIBS}])
676 LIBS="${LIBS} ${SOCKET_LIBS}"
677 AC_LINK_IFELSE([
678     AC_LANG_PROGRAM([#ifdef _WIN32
679         # if _WIN32_WINNT < 0x600
680         #  error Needs vista+
681         # endif
682         #include <ws2tcpip.h>
683         #else
684         #include <sys/socket.h>
685         #include <arpa/inet.h>
686         #endif], [
687         char dst[[sizeof(struct in_addr)]];
688         inet_pton(AF_INET, "127.0.0.1", dst);
689     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
690 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
691 VLC_RESTORE_FLAGS
692 AC_SUBST(SOCKET_LIBS)
694 dnl Check for socklen_t
695 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
696 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
697 ac_cv_type_socklen_t,
698 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
699 [#include <sys/types.h>
700 #ifdef _WIN32
701 # include <winsock2.h>
702 # include <ws2tcpip.h>
703 #else
704 # include <sys/socket.h>
705 #endif]], [[socklen_t len; len = 0;]])],
706 ac_cv_type_socklen_t=yes,
707 ac_cv_type_socklen_t=no)])
708 AS_IF([test "$ac_cv_type_socklen_t" = no],
709  [AC_DEFINE(socklen_t, int)])
711 dnl Check for struct sockaddr_storage
712 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
713 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
714 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
715   [AC_TRY_COMPILE(
716     [#include <sys/types.h>
717      #if defined( _WIN32 )
718      # include <winsock2.h>
719      #else
720      # include <sys/socket.h>
721      #endif], [struct sockaddr_storage addr;],
722      ac_cv_struct_sockaddr_storage=yes,
723      ac_cv_struct_sockaddr_storage=no)])
724 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
725   AC_DEFINE(sockaddr_storage, sockaddr)
726   AC_DEFINE(ss_family, sa_family)
729 dnl FreeBSD has a gnugetopt library for this:
730 GNUGETOPT_LIBS=""
731 AC_CHECK_FUNC(getopt_long,, [
732   AC_CHECK_LIB([gnugetopt],[getopt_long], [
733     GNUGETOPT_LIBS="-lgnugetopt"
734   ])
736 AC_SUBST(GNUGETOPT_LIBS)
738 AC_CHECK_LIB(m,cos,[
739   LIBM="-lm"
740 ], [
741   LIBM=""
743 AC_SUBST(LIBM)
745 AC_CHECK_LIB(m,lrintf, [
746   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
747   VLC_ADD_LIBS([skins2],[-lm])
749 AC_CHECK_LIB(m,nanf,
750   AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
753 dnl Check for dynamic plugins
754 LIBDL=""
755 have_dynamic_objects="no"
756 VLC_SAVE_FLAGS
757 AC_SEARCH_LIBS(dlsym, [dl svld], [
758   AS_IF([test "$ac_cv_search_dlsym" != "none required"], [
759     LIBDL="$ac_cv_search_dlsym"
760   ])
761   have_dynamic_objects="yes"
763 VLC_RESTORE_FLAGS
765 # Windows
766 AS_IF([test "${SYS}" = "mingw32"], [
767   LIBDL=""
768   have_dynamic_objects="yes" #assume we can use shared objects
771 AS_IF([test "${enable_shared}" = "no"], [
772   have_dynamic_objects=no
774 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
776 AC_SUBST(LIBDL)
778 dnl Check for thread library
779 LIBPTHREAD=""
780 AS_IF([test "${SYS}" != "mingw32"], [
781   VLC_SAVE_FLAGS
782   LIBS=""
783   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
784     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
785       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
786     ])
787   ])
788   VLC_RESTORE_FLAGS
790 AC_SUBST(LIBPTHREAD)
792 AC_SEARCH_LIBS([clock_nanosleep], [rt pthread], [
793   AS_IF([test "$ac_cv_search_clock_nanosleep" != "none required"], [
794     LIBRT="$ac_cv_search_clock_nanosleep"
795   ])
796 ], [
797   AC_SEARCH_LIBS([nanosleep], [rt pthread posix4], [
798     AS_IF([test "$ac_cv_search_nanosleep" != "none required"], [
799       LIBRT="$ac_cv_search_nanosleep"
800     ])
801   ])
803 AC_SUBST(LIBRT)
806 dnl Check for headers
809 dnl  POSIX
810 AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/shm.h sys/socket.h sys/uio.h])
811 AC_CHECK_HEADERS([net/if.h], [], [],
813 #include <sys/types.h>
814 #include <sys/socket.h>
816 AC_CHECK_HEADER([syslog.h], [have_syslog="yes"], [have_syslog="no"])
817 AM_CONDITIONAL([HAVE_SYSLOG], [test "$have_syslog" = "yes"])
819 dnl  BSD
820 AC_CHECK_HEADERS([netinet/udplite.h sys/param.h sys/mount.h])
822 dnl  GNU/Linux
823 AC_CHECK_HEADERS([features.h getopt.h linux/dccp.h linux/magic.h mntent.h sys/eventfd.h])
825 dnl  MacOS
826 AC_CHECK_HEADERS([xlocale.h])
828 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
829 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
830 AC_CHECK_TYPE(ssize_t,, [
831   AC_DEFINE(ssize_t, int)
834 dnl It seems that autoconf detects pkg-config only during the first
835 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
836 dnl it is nested within a conditional block, so it was not working right.
837 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
838 AC_ARG_VAR(PKG_CONFIG_PATH,
839        [Paths where to find .pc not at the default location])
840 PKG_PROG_PKG_CONFIG()
842 dnl On some OS we need static linking
843 AS_IF([test -n "${PKG_CONFIG}" ],[
844     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
845         PKG_CONFIG="${PKG_CONFIG} --static"
846     ])
851 dnl Check for zlib.h and -lz along with system -lminizip if available
853 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
854 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
855 if test "${have_zlib}" = "yes"
856 then
857   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
858   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
859     AC_CHECK_HEADERS([unzip.h], [
860       have_minizip=yes
861       MINIZIP_LIBS="-lminizip -lz"
862     ], [
863       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
864       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
865       have_minizip=no
866     ])
867   ])
868   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
869   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
871 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
875 dnl Domain name i18n support via GNU libidn
877 PKG_CHECK_MODULES([IDN], [libidn], [
878   have_libidn="yes"
879   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
880 ], [
881   have_libidn="no"
885 dnl Check for dbus
886 AC_ARG_ENABLE(dbus,
887   [AS_HELP_STRING([--enable-dbus],
888     [compile D-Bus message bus support (default enabled)])])
889 have_dbus="no"
890 AS_IF([test "${enable_dbus}" != "no"], [
891   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
892     have_dbus="yes"
893   ], [
894     AS_IF([test -n "${enable_dbus}"], [
895       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
896     ], [
897       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
898     ])
899   ])
901 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
904 dnl Check for systemd
905 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
906   have_systemd="yes"
907 ], [
908   AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
910 AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
913 dnl Check for ntohl, etc.
914 VLC_SAVE_FLAGS
915 CFLAGS="${CFLAGS} -Wall -Werror"
916 AC_CACHE_CHECK([for ntohl in sys/param.h],
917     [ac_cv_c_ntohl_sys_param_h],
918     [     AC_TRY_COMPILE([#include <sys/param.h>],
919         [int meuh; ntohl(meuh);],
920         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
921 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
922     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
924 VLC_RESTORE_FLAGS
926 EXTEND_HELP_STRING([Optimization options:])
928 dnl  Compiler warnings
931 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])
932 RDC_PROG_CC_FLAGS([-pipe])
933 AC_LANG_PUSH([C++])
934 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var format-security])
935 AC_LANG_POP([C++])
938 dnl  Debugging mode
940 AC_ARG_ENABLE(debug,
941   [AS_HELP_STRING([--enable-debug],
942     [build with run-time assertions (default disabled)])],,
943   [enable_debug="no"])
944 AH_TEMPLATE(NDEBUG,
945             [Define to 1 if debug code should NOT be compiled])
946 AS_IF([test "${enable_debug}" != "no"], [
947   AC_CHECK_HEADERS([valgrind/valgrind.h])
948 ], [
949   AC_DEFINE(NDEBUG)
953 dnl  Profiling
955 AC_ARG_ENABLE(gprof,
956   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
957   [enable_gprof="no"])
958 AS_IF([test "${enable_gprof}" != "no"], [
959   CFLAGS="${CFLAGS} -pg"
960   CXXFLAGS="${CXXFLAGS} -pg"
961   OBJCFLAGS="${OBJCFLAGS} -pg"
962   LDFLAGS="${LDFLAGS} -pg"
965 AC_ARG_ENABLE(cprof,
966   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
967   [enable_cprof="no"])
968 AS_IF([test "${enable_gprof}" != "no"], [
969   CFLAGS="${CFLAGS} -finstrument-functions"
970   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
971   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
972   LDFLAGS="${LDFLAGS} -finstrument-functions"
976 dnl  Test coverage
978 AC_ARG_ENABLE(coverage,
979   [AS_HELP_STRING([--enable-coverage],
980     [build for test coverage (default disabled)])],,
981   [enable_coverage="no"])
982 AS_IF([test "${enable_coverage}" != "no"], [
983   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
984   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
985   LDFLAGS="-lgcov ${LDFLAGS}"
988 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
989   VLC_SAVE_FLAGS
990   CFLAGS="${CFLAGS} -fvisibility=hidden"
991   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
992   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
993   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
994                  [ac_cv_c_visibility_hidden], [
995     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
996       ac_cv_c_visibility_hidden=yes
997     ], [
998       ac_cv_c_visibility_hidden=no
999     ])
1000   ])
1001   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
1006 dnl  Enable/disable optimizations
1008 AC_ARG_ENABLE(optimizations,
1009   [AS_HELP_STRING([--disable-optimizations],
1010     [disable compiler optimizations (default enabled)])],,
1011   [enable_optimizations="yes"])
1013 dnl Check for various optimization flags
1014 AS_IF([test "${enable_optimizations}" != "no"], [
1016   dnl -O3 only in production builds
1017   AS_IF([test "${enable_debug}" = "no"], [
1018     VLC_SAVE_FLAGS
1019     CFLAGS="${CFLAGS} -O3"
1020     CXXFLAGS="${CXXFLAGS} -O3"
1021     OBJCFLAGS="${OBJCFLAGS} -O3"
1022     AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
1023       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1024         ac_cv_c_o3=yes
1025       ], [
1026         ac_cv_c_o3=no
1027       ])
1028     ])
1029     AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
1030   ])
1032   dnl Check for fast maths
1033   RDC_PROG_CC_FFLAGS([no-math-errno unsafe-math-optimizations no-rounding-math no-signaling-nans cx-limited-range])
1034   AC_LANG_PUSH(C++)
1035   RDC_PROG_CXX_FFLAGS([no-math-errno unsafe-math-optimizations no-rounding-math no-signaling-nans cx-limited-range])
1036   AC_LANG_POP
1038 AH_BOTTOM([
1039 #if defined(_MSC_VER) && !defined(__clang__)
1040 # pragma fenv_access(off)
1041 # pragma fp_contract(on)
1042 #elif defined(__GNUC__)
1043 /* Not supported so far */
1044 #else
1045 # pragma STDC FENV_ACCESS OFF
1046 # pragma STDC FP_CONTRACT ON
1047 #endif
1050   dnl Check for -funroll-loops
1051   VLC_SAVE_FLAGS
1052   CFLAGS="${CFLAGS} -funroll-loops"
1053   CXXFLAGS="${CXXFLAGS} -funroll-loops"
1054   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
1055   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
1056     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1057       ac_cv_c_unroll_loops=yes
1058     ], [
1059       ac_cv_c_unroll_loops=no
1060     ])
1061   ])
1062   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
1064   AS_IF([test "$enable_debug" = "no"], [
1065     dnl Check for -fomit-frame-pointer
1066     VLC_SAVE_FLAGS
1067     CFLAGS="${CFLAGS} -fomit-frame-pointer"
1068     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
1069     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
1070     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
1071       [ac_cv_c_omit_frame_pointer], [
1072       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1073         ac_cv_c_omit_frame_pointer=yes
1074       ], [
1075         ac_cv_c_omit_frame_pointer=no
1076       ])
1077     ])
1078     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1079   ])
1082 VLC_SAVE_FLAGS
1083 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1084 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1085   AC_TRY_LINK([],, [
1086     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1087   ], [
1088     ac_cv_ld_bsymbolic=""
1089   ])
1091 VLC_RESTORE_FLAGS
1092 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1093 AC_SUBST(SYMBOLIC_LDFLAGS)
1095 VLC_SAVE_FLAGS
1096 LDFLAGS="${LDFLAGS} -Wl,-z,defs"
1097 AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
1098   AC_TRY_LINK([],, [
1099     ac_cv_ld_z_defs="yes"
1100   ], [
1101     ac_cv_ld_z_defs="no"
1102   ])
1104 AS_IF([test "${ac_cv_ld_z_defs}" = "no"], [VLC_RESTORE_FLAGS])
1106 dnl Checks for __attribute__(aligned()) directive
1107 VLC_SAVE_FLAGS
1108 CFLAGS="${CFLAGS} -Werror"
1109 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1110     [ac_cv_c_attribute_aligned],
1111     [ac_cv_c_attribute_aligned=0
1112     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1113         AC_TRY_COMPILE([],
1114         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1115         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1116     done])
1117 VLC_RESTORE_FLAGS
1118 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1119     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1120         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1123 dnl Check for __attribute__((packed))
1124 AC_CACHE_CHECK([for __attribute__((packed))],
1125   [ac_cv_c_attribute_packed],
1126   [ac_cv_c_attribute_packed=no
1127    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1128                     [ac_cv_c_attribute_packed=yes])])
1129 if test "${ac_cv_c_attribute_packed}" != "no"; then
1130   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1134 dnl  Check the CPU
1136 case "${host_cpu}" in
1137   "")
1138     ARCH=unknown
1139     ;;
1140   *)
1141     ARCH="${host_cpu}"
1142     ;;
1143 esac
1145 dnl Check for backtrace() support
1146 AC_CHECK_HEADERS(execinfo.h)
1147 AC_CHECK_FUNCS(backtrace)
1150 dnl  default modules
1152 ALIASES="${ALIASES} cvlc rvlc"
1155 dnl  Accelerated modules
1158 dnl  Check for fully working MMX intrinsics
1159 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1160 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1161 AC_ARG_ENABLE(mmx,
1162   [AS_HELP_STRING([--disable-mmx],
1163     [disable MMX optimizations (default auto)])],,[
1164   case "${host_cpu}" in
1165     i?86|x86_64)
1166       enable_mmx="yes"
1167       ;;
1168     *)
1169       enable_mmx="no"
1170       ;;
1171   esac
1173 have_mmx="no"
1174 have_mmxext="no"
1175 AS_IF([test "${enable_mmx}" != "no"], [
1176   ARCH="${ARCH} mmx"
1177   VLC_SAVE_FLAGS
1178   CFLAGS="${CFLAGS} -mmmx"
1179   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1180     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1181 [#include <mmintrin.h>
1182 #include <stdint.h>
1183 uint64_t frobzor;]], [
1184 [__m64 a, b, c;
1185 a = b = c = (__m64)frobzor;
1186 a = _mm_slli_pi16(a, 3);
1187 a = _mm_adds_pi16(a, b);
1188 c = _mm_srli_pi16(c, 8);
1189 c = _mm_slli_pi16(c, 3);
1190 b = _mm_adds_pi16(b, c);
1191 a = _mm_unpacklo_pi8(a, b);
1192 frobzor = (uint64_t)a;]])], [
1193       ac_cv_c_mmx_intrinsics=yes
1194     ], [
1195       ac_cv_c_mmx_intrinsics=no
1196     ])
1197   ])
1198   VLC_RESTORE_FLAGS
1199   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1200     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1201   ])
1203   VLC_SAVE_FLAGS
1204   CFLAGS="${CFLAGS} -mmmx"
1205   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1206     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1207 void *p;
1208 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1210     ], [
1211       ac_cv_mmx_inline=yes
1212     ], [
1213       ac_cv_mmx_inline=no
1214     ])
1215   ])
1216   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1217     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1218     have_mmx="yes"
1219   ])
1221   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1222                  [ac_cv_mmxext_inline], [
1223     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1224 void *p;
1225 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1227     ], [
1228       ac_cv_mmxext_inline=yes
1229     ], [
1230       ac_cv_mmxext_inline=no
1231     ])
1232   ])
1233   VLC_RESTORE_FLAGS
1234   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1235     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1236     have_mmxext="yes"
1237   ])
1239 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1240 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1242 dnl  Check for fully workin SSE2 intrinsics
1243 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1244 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1245 AC_ARG_ENABLE(sse,
1246   [AS_HELP_STRING([--disable-sse],
1247     [disable SSE (1-4) optimizations (default auto)])],, [
1248   case "${host_cpu}" in
1249     i?86|x86_64)
1250       enable_sse=yes
1251       ;;
1252     *)
1253       enable_sse=no
1254       ;;
1255   esac
1257 have_sse2="no"
1258 AS_IF([test "${enable_sse}" != "no"], [
1259   ARCH="${ARCH} sse sse2"
1261   VLC_SAVE_FLAGS
1262   CFLAGS="${CFLAGS} -msse2"
1263   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1264     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1265 [#include <emmintrin.h>
1266 #include <stdint.h>
1267 uint64_t frobzor;]], [
1268 [__m128i a, b, c;
1269 a = b = c = _mm_set1_epi64((__m64)frobzor);
1270 a = _mm_slli_epi16(a, 3);
1271 a = _mm_adds_epi16(a, b);
1272 c = _mm_srli_epi16(c, 8);
1273 c = _mm_slli_epi16(c, 3);
1274 b = _mm_adds_epi16(b, c);
1275 a = _mm_unpacklo_epi8(a, b);
1276 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1277       ac_cv_c_sse2_intrinsics=yes
1278     ], [
1279       ac_cv_c_sse2_intrinsics=no
1280     ])
1281   ])
1282   VLC_RESTORE_FLAGS
1283   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1284     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1285   ])
1287   VLC_SAVE_FLAGS
1288   CFLAGS="${CFLAGS} -msse"
1289   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1290     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1291 void *p;
1292 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1294     ], [
1295       ac_cv_sse_inline=yes
1296     ], [
1297       ac_cv_sse_inline=no
1298     ])
1299   ])
1301   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1302     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1303   ])
1305   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1306     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1307 void *p;
1308 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1310     ], [
1311       ac_cv_sse2_inline=yes
1312     ], [
1313       ac_cv_sse2_inline=no
1314     ])
1315   ])
1316   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1317     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1318     have_sse2="yes"
1319   ])
1321   # SSE3
1322   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1323     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1324 void *p;
1325 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1327     ], [
1328       ac_cv_sse3_inline=yes
1329     ], [
1330       ac_cv_sse3_inline=no
1331     ])
1332   ])
1334   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1335     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1336   # SSSE3
1337   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1338     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1339 void *p;
1340 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1342     ], [
1343       ac_cv_ssse3_inline=yes
1344     ], [
1345       ac_cv_ssse3_inline=no
1346     ])
1347   ])
1349   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1350     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1352   # SSE4.1
1353   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1354                  [ac_cv_sse4_1_inline], [
1355     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1356 void *p;
1357 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1359     ], [
1360       ac_cv_sse4_1_inline=yes
1361     ], [
1362       ac_cv_sse4_1_inline=no
1363     ])
1364   ])
1366   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1367     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1369   # SSE4.2
1370   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1371                  [ac_cv_sse4_2_inline], [
1372     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1373 void *p;
1374 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1376     ], [
1377       ac_cv_sse4_2_inline=yes
1378     ], [
1379       ac_cv_sse4_2_inline=no
1380     ])
1381   ])
1383   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1384     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1386   # SSE4A
1387   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1388     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1389 void *p;
1390 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1392     ], [
1393       ac_cv_sse4a_inline=yes
1394     ], [
1395       ac_cv_sse4a_inline=no
1396     ])
1397   ])
1398   VLC_RESTORE_FLAGS
1399   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1400     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1402 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1404 VLC_SAVE_FLAGS
1405 CFLAGS="${CFLAGS} -mmmx"
1406 have_3dnow="no"
1407 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1408   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1409 void *p;
1410 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1412   ], [
1413     ac_cv_3dnow_inline=yes
1414   ], [
1415     ac_cv_3dnow_inline=no
1416   ])
1418 VLC_RESTORE_FLAGS
1419 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1420   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1421             [Define to 1 if 3D Now! inline assembly is available.])
1422   have_3dnow="yes"
1424 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1427 AC_ARG_ENABLE(neon,
1428   [AS_HELP_STRING([--disable-neon],
1429     [disable NEON optimizations (default auto)])],, [
1430   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1432 AS_IF([test "${enable_neon}" != "no"], [
1433   VLC_SAVE_FLAGS
1434   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1435   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1436     AC_COMPILE_IFELSE([
1437       AC_LANG_PROGRAM(,[[
1438 asm volatile("vqmovun.s64 d0, q1":::"d0");
1440     ], [
1441       ac_cv_arm_neon="yes"
1442     ], [
1443       ac_cv_arm_neon="no"
1444     ])
1445   ])
1446   VLC_RESTORE_FLAGS
1448 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1450 AC_ARG_ENABLE(arm64,
1451   [AS_HELP_STRING([--disable-arm64],
1452     [disable arm 64-bit optimizations (default auto)])],, [
1453   AS_IF([test "${host_cpu}" = "aarch64"], [enable_arm64="yes"] ,[enable_arm64="no"])
1455 AS_IF([test "${enable_arm64}" != "no"], [
1456   AC_CACHE_CHECK([if $CCAS groks ARM 64 SIMD assembly], [ac_cv_arm64], [
1457     AC_COMPILE_IFELSE([
1458       AC_LANG_PROGRAM(,[[
1459 asm volatile("uhadd v0.8b, v0.8b, v1.8b":::"v0");
1461     ], [
1462       ac_cv_arm64="yes"
1463     ], [
1464       ac_cv_arm64="no"
1465     ])
1466   ])
1468 AM_CONDITIONAL(HAVE_ARM64, [test "${ac_cv_arm64}" = "yes"])
1471 AC_ARG_ENABLE(altivec,
1472   [AS_HELP_STRING([--disable-altivec],
1473     [disable AltiVec optimizations (default auto)])],, [
1474   AS_CASE("${host_cpu}", [powerpc*],
1475         [enable_altivec=yes], [enable_altivec=no])
1477 have_altivec="no"
1478 ALTIVEC_CFLAGS=""
1479 AS_IF([test "${enable_altivec}" = "yes"], [
1480   ARCH="${ARCH} altivec";
1481   VLC_SAVE_FLAGS
1482   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1483     [ac_cv_altivec_inline],
1484     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1485          ac_cv_altivec_inline="yes",
1486          [CFLAGS="${CFLAGS} -Wa,-maltivec"
1487           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1488             [ac_cv_altivec_inline="-Wa,-maltivec"],
1489             ac_cv_altivec_inline=no)
1490          ])])
1491   VLC_RESTORE_FLAGS
1492   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1493     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1494               [Define to 1 if AltiVec inline assembly is available.])
1495     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1496       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1497       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1498     ])
1499     have_altivec="yes"
1500   ])
1502   VLC_SAVE_FLAGS
1503   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1504   [ac_cv_c_altivec], [
1505     CFLAGS="${CFLAGS} -maltivec"
1506     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1507 [#include <altivec.h>]], [
1508 [vec_ld(0, (unsigned char *)0);]])], [
1509       ac_cv_c_altivec="-maltivec"
1510     ], [
1511       ac_cv_c_altivec="no"
1512     ])
1513   ])
1514   VLC_RESTORE_FLAGS
1515   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1516     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1517     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1518     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1519     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1520     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1521     have_altivec="yes"
1522   ])
1523   AC_CHECK_HEADERS(altivec.h)
1525   VLC_SAVE_FLAGS
1526   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1527   AC_CACHE_CHECK([if linker needs -framework vecLib],
1528     [ac_cv_ld_altivec],
1529     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1530   VLC_RESTORE_FLAGS
1531   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1532     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1533   ])
1535 AC_SUBST(ALTIVEC_CFLAGS)
1536 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1539 dnl  Memory usage
1541 AC_ARG_ENABLE(optimize-memory,
1542   [AS_HELP_STRING([--enable-optimize-memory],
1543     [optimize memory usage over performance])])
1544 if test "${enable_optimize_memory}" = "yes"; then
1545   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1549 dnl Allow running as root (useful for people running on embedded platforms)
1551 AC_ARG_ENABLE(run-as-root,
1552   [AS_HELP_STRING([--enable-run-as-root],
1553     [allow running VLC as root (default disabled)])])
1554 AS_IF([test "${enable_run_as_root}" = "yes"],[
1555     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1556               [Define to 1 to allow running VLC as root (uid 0).])
1560 dnl Stream output
1562 AC_ARG_ENABLE(sout,
1563   [AS_HELP_STRING([--disable-sout],
1564     [disable streaming output (default enabled)])])
1565 AS_IF([test "${enable_sout}" != "no"], [
1566   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1568 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1570 dnl Lua modules
1571 AC_ARG_ENABLE(lua,
1572   [AS_HELP_STRING([--disable-lua],
1573     [disable LUA scripting support (default enabled)])])
1574 if test "${enable_lua}" != "no"
1575 then
1576   PKG_CHECK_MODULES(LUA, lua5.2,
1577     [ have_lua=yes ],
1578     [
1579     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1581     PKG_CHECK_MODULES(LUA, lua5.1,
1582       [ have_lua=yes ],
1583       [
1584       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1585       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1586         [ have_lua=yes ],
1587         [
1588           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1589           have_lua=yes
1590           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1591             [],
1592             [ have_lua=no ] )
1593           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1594             [LUA_LIBS="-llua5.2"],
1595           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1596             [LUA_LIBS="-llua5.1"],
1597             AC_CHECK_LIB( lua51 , luaL_newstate,
1598               [LUA_LIBS="-llua51"],
1599               AC_CHECK_LIB( lua , luaL_newstate,
1600                 [LUA_LIBS="-llua"],
1601                 [ have_lua=no
1602                 ], [-lm])
1603             )))
1604         ])
1605       ])
1606     ])
1607   if test "x${have_lua}" != "xyes" ;  then
1608       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.])
1609   fi
1610   AC_ARG_VAR([LUAC], [LUA byte compiler])
1611   AS_IF([test -z "$LUAC"], [
1612      AC_CHECK_TOOL(LUAC, [luac], [false])
1613   ])
1614   AS_IF([test "${LUAC}" = "false"], [
1615     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1616   ])
1617   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], [
1618     AC_MSG_ERROR([You need 32-bits luac when using lua from contrib.])
1619   ])
1621 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1625 dnl HTTP daemon
1627 AC_ARG_ENABLE(httpd,
1628   [AS_HELP_STRING([--disable-httpd],
1629     [disable the built-in HTTP server (default enabled)])])
1630 if test "${enable_httpd}" != "no"
1631 then
1632   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1634 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1638 dnl VideoLAN manager
1640 AC_ARG_ENABLE(vlm,
1641   [AS_HELP_STRING([--disable-vlm],
1642     [disable the stream manager (default enabled)])],,
1643   [enable_vlm="${enable_sout}"])
1644 AS_IF([test "${enable_vlm}" != "no"], [
1645   AS_IF([test "${enable_sout}" = "no"], [
1646     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1647   ])
1648   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1650 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1654 dnl Addons manager storage and repositories modules
1656 AC_ARG_ENABLE(addonmanagermodules,
1657   [AS_HELP_STRING([--disable-addonmanagermodules],
1658     [disable the addons manager modules (default enabled)])])
1659 if test "${enable_addonmanagermodules}" != "no"
1660 then
1661   AC_DEFINE(ENABLE_ADDONMANAGERMODULES, 1, [Define if you want the addons manager modules])
1663 AM_CONDITIONAL([ENABLE_ADDONMANAGERMODULES], [test "${enable_addonmanagermodules}" != "no"])
1667 dnl  Input plugins
1670 EXTEND_HELP_STRING([Input plugins:])
1673 dnl  libarchive access module
1675 PKG_ENABLE_MODULES_VLC([ARCHIVE], [access_archive], [libarchive >= 3.1.0], (libarchive support), [auto])
1678 dnl  live555 input
1680 AC_ARG_ENABLE(live555,
1681   [AS_HELP_STRING([--enable-live555],
1682     [enable RTSP input through live555 (default enabled)])])
1684 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1685   PKG_CHECK_MODULES(LIVE555, live555, [
1686     VLC_ADD_PLUGIN([live555])
1687     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1688     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1689   ], [
1690     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1692     AC_LANG_PUSH(C++)
1693     VLC_SAVE_FLAGS
1695     dnl detect include paths
1696     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1697       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1698     ], [
1699       AS_IF([test "${SYS}" != "os2"], [
1700         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1701         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1702       ], [
1703         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1704         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1705         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1706       ])
1707     ])
1709     dnl CPP Flags
1710     AS_IF([test "${SYS}" = "solaris"], [
1711       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1712     ])
1713     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1714     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1716     dnl version check
1717     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1718       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1719 [#include <liveMedia_version.hh>
1720 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1721 # error BOOM
1722 #endif]])
1723       ], [
1724         ac_cv_live555="yes"
1725       ], [
1726         ac_cv_live555="no"
1727       ])
1728     ])
1730     AS_IF([test "$ac_cv_live555" = "no"], [
1731       AC_MSG_WARN([live555 is missing or its installed version is too old:
1732 Version 2011.12.23 or later is required to proceed.
1733 You can get an updated one from http://www.live555.com/liveMedia .])
1734       AS_IF([test -n "${enable_live555}"], [
1735         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1736       ])
1737     ], [
1738       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1739       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1740       AS_IF([test "${SYS}" = "mingw32"], [
1741         # add ws2_32 for closesocket, select, recv
1742         other_libs="$other_libs -lws2_32"
1743       ])
1745       dnl We need to check for pic because live555 don't provide shared libs
1746       dnl and we want to build a plugins so we need -fPIC on some arch.
1747       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1748       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1749       AC_CHECK_LIB(liveMedia_pic, main, [
1750         VLC_ADD_PLUGIN([live555])
1751         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1752       ],[
1753         AC_CHECK_LIB(liveMedia, main, [
1754           VLC_ADD_PLUGIN([live555])
1755           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1756         ],[],[${other_libs}])
1757       ],[${other_libs_pic}])
1758     ])
1759     VLC_RESTORE_FLAGS
1760     AC_LANG_POP(C++)
1761   ])
1765 dnl IIDC and DV FireWire input modules
1767 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1768 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1771 dnl - linsys modules: access module check for libzvbi
1773 AC_ARG_ENABLE(linsys,
1774   [AS_HELP_STRING([--enable-linsys],
1775     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1776 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1777   VLC_ADD_PLUGIN([linsys_hdsdi])
1778   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1779     VLC_ADD_PLUGIN([linsys_sdi])
1780   ], [
1781     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1782   ])
1786 dnl dvdread module: check for libdvdread
1788 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread > 4.9.0], [dvdread input module], [auto])
1791 dnl libdvdnav plugin
1793 PKG_ENABLE_MODULES_VLC([DVDNAV], [], [dvdnav > 4.9.0], [DVD with navigation input module (dvdnav)], [auto])
1794 AS_IF([test "${enable_dvdnav}" != "no"], [
1795   AC_MSG_CHECKING(for dvdnav_stream_cb in dvdnav/dvdnav.h)
1796     AC_EGREP_HEADER(dvdnav_stream_cb,dvdnav/dvdnav.h,[
1797       AC_MSG_RESULT(yes)
1798       AC_DEFINE(HAVE_STREAM_CB_IN_DVDNAV_H, 1, For dvdnav demux support)
1799       ],[
1800       AC_MSG_RESULT(no)
1801     ])
1805 dnl  Blu-ray Disc Support with libbluray
1807 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray for Blu-ray disc support ) )
1810 dnl  OpenCV wrapper and example filters
1812 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1816 dnl  libsmbclient plugin
1818 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1819 AS_IF([test "${SYS}" = "mingw32" -a "${enable_smbclient}" != "no"], [ VLC_ADD_PLUGIN([smb]) ])
1822 dnl  liBDSM access module
1824 PKG_ENABLE_MODULES_VLC([DSM], [dsm], [libdsm >= 0.2.0], [libdsm SMB/CIFS access/sd module], [auto])
1827 dnl sftp access support
1829 PKG_ENABLE_MODULES_VLC([SFTP], [sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1832 dnl nfs access support
1834 PKG_ENABLE_MODULES_VLC([NFS], [nfs], [libnfs >= 1.10.0], (support nfs protocol via libnfs), [auto])
1837 dnl  Video4Linux 2
1839 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1840   [disable Video4Linux version 2 (default auto)])])
1841 have_v4l2="no"
1842 AS_IF([test "$enable_v4l2" != "no"], [
1843   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1844     have_v4l2="yes"
1845   ])
1847 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1850 dnl special access module for Blackmagic SDI cards
1852 AC_ARG_ENABLE(decklink,
1853   [AS_HELP_STRING([--disable-decklink],
1854     [disable Blackmagic DeckLink SDI input (default auto)])])
1855 AC_ARG_WITH(decklink_sdk,
1856   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1857     [                        location of Blackmagic DeckLink SDI SDK])])
1858 have_decklink=no
1859 if test "${enable_decklink}" != "no"
1860 then
1861   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1862   then
1863     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1864   fi
1865   VLC_SAVE_FLAGS
1866   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1867   AC_LANG_PUSH(C++)
1868   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1869       have_decklink=yes
1870   ], [
1871       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1872   ])
1873   AC_LANG_POP(C++)
1874   VLC_RESTORE_FLAGS
1876 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1880 dnl  Built-in CD-DA and VCD module
1882 AC_ARG_ENABLE(vcd,
1883   [AS_HELP_STRING([--disable-vcd],
1884     [disable built-in VCD and CD-DA support (default enabled)])])
1886 AC_ARG_ENABLE(libcddb,
1887   [AS_HELP_STRING([--disable-libcddb],
1888     [disable CDDB for Audio CD (default enabled)])])
1890 if test "${enable_vcd}" != "no"
1891 then
1892   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1893   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1894     AC_MSG_RESULT(yes)
1895     VLC_ADD_PLUGIN([vcd cdda])
1896   ],[
1897     AC_MSG_RESULT(no)
1898   ])
1900   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1901   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1902     AC_MSG_RESULT(yes)
1903     VLC_ADD_PLUGIN([vcd cdda])
1904     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1905   ],[
1906     AC_MSG_RESULT(no)
1907   ])
1909   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1910   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1911     AC_MSG_RESULT(yes)
1912     VLC_ADD_PLUGIN([vcd cdda])
1913     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1914   ],[
1915     AC_MSG_RESULT(no)
1916   ])
1918   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2" -o "${SYS}" = "darwin"
1919   then
1920     VLC_ADD_PLUGIN([vcd cdda])
1921   fi
1923   if test "$enable_libcddb" != "no"; then
1924     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1925       HAVE_LIBCDDB=yes
1926       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1927       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1928       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1929       ],:
1930       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1931       HAVE_LIBCDDB=no])
1932   fi
1936 dnl Linux DVB
1938 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1939   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1940 [#include <linux/dvb/version.h>
1941 #if (DVB_API_VERSION < 5)
1942 # error Linux DVB API v3.2 and older are not supported.
1943 #endif
1944 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1945 # error Linux DVB API v5.0 is unsupported. Please update.
1946 #endif
1947 ]])], [
1948   ac_cv_linux_dvb_5_1=yes
1949 ], [
1950   ac_cv_linux_dvb_5_1=no
1951 ])])
1952 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1955 dnl  Screen capture module
1957 AC_ARG_ENABLE(screen,
1958   [AS_HELP_STRING([--enable-screen],
1959     [disable screen capture (default enabled)])])
1960 if test "${enable_screen}" != "no"; then
1961   if test "${SYS}" = "darwin"; then
1962     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1963       VLC_ADD_PLUGIN([screen])
1964     ])
1965   fi
1967 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1970 dnl  VNC/RFB access module
1972 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1974 dnl  RDP/Remote Desktop access module
1976 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1979 dnl  Real RTSP plugin
1981 AC_ARG_ENABLE(realrtsp,
1982   [  --enable-realrtsp       Real RTSP module (default disabled)])
1983 if test "${enable_realrtsp}" = "yes"; then
1984   VLC_ADD_PLUGIN([access_realrtsp])
1988 dnl MacOS eyeTV
1989 AC_ARG_ENABLE(macosx-eyetv,
1990   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1991 if test "x${enable_macosx_eyetv}" != "xno" &&
1992   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1993 then
1994   VLC_ADD_PLUGIN([access_eyetv])
1998 dnl QTKit
1999 AC_ARG_ENABLE(macosx-qtkit,
2000   [  --enable-macosx-qtkit Mac OS X qtsound (audio) module (default enabled on Mac OS X <= v10.11)])
2001 if test "x${enable_macosx_qtkit}" != "xno" &&
2002   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
2003 then
2004   AC_CHECK_HEADERS(QTKit/QTKit.h, [
2005       VLC_ADD_PLUGIN([qtsound])
2006     ])
2010 dnl AVFoundation
2011 AC_SUBST(have_avfoundation, ["no"])
2012 AC_ARG_ENABLE(macosx-avfoundation,
2013   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
2014 if test "x${enable_macosx_avfoundation}" != "xno" &&
2015   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
2016 then
2017   SAVED_LIBS="${LIBS}"
2018   LIBS="-framework AVFoundation"
2019   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
2020   LIBS="${SAVED_LIBS}"
2021   if test "${have_avfoundation}" != "no"
2022   then
2023     VLC_ADD_PLUGIN([avcapture])
2024   fi
2026 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
2029 dnl  DCP plugin (using asdcplib)
2031 PKG_WITH_MODULES([ASDCP], [asdcplib], [have_asdcp="yes"])
2032 AM_CONDITIONAL(HAVE_ASDCP, [test "${have_asdcp}" = "yes"])
2035 dnl  Demux plugins
2038 EXTEND_HELP_STRING([Mux/Demux plugins:])
2041 dnl  libdvbpsi check for ts mux/demux
2043 have_dvbpsi="no"
2044 PKG_WITH_MODULES([DVBPSI], [libdvbpsi >= 1.2.0], [have_dvbpsi="yes"])
2045 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
2049 dnl  GME demux plugin
2051 AC_ARG_ENABLE(gme,
2052   [AS_HELP_STRING([--enable-gme],
2053     [use Game Music Emu (default auto)])])
2054 AS_IF([test "${enable_gme}" != "no"], [
2055   AC_CHECK_HEADER([gme/gme.h], [
2056     VLC_ADD_LIBS([gme], [-lgme])
2057     VLC_ADD_PLUGIN([gme])
2058   ], [
2059     AS_IF([test "x${enable_gme}" != "x"], [
2060       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
2061     ])
2062   ])
2067 dnl  SIDPlay plugin
2069 AC_ARG_ENABLE(sid,
2070     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2071 AS_IF([test "${enable_sid}" != "no"], [
2072     PKG_CHECK_MODULES(SID, [libsidplay2], [
2073         AC_LANG_PUSH(C++)
2074         oldCPPFLAGS="$CPPFLAGS"
2075         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2076         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2077             VLC_ADD_PLUGIN([sid])
2078             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2079             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2080         ], [
2081             AS_IF([test -n "${enable_sid}"],
2082                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2083                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2084                 )
2085         ])
2086         CPPFLAGS="$oldCPPFLAGS"
2087         AC_LANG_POP(C++)
2088     ], [
2089         AS_IF([test "x${enable_sid}" = "xyes"],
2090             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2091             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2092             )
2093     ])
2098 dnl  ogg demux plugin
2100 PKG_ENABLE_MODULES_VLC([OGG], [mux_ogg], [ogg >= 1.0], [Ogg demux support], [auto])
2101 PKG_CHECK_MODULES(LIBVORBIS, [vorbis >= 1.1], [
2102     AC_DEFINE(HAVE_LIBVORBIS, 1, [Define to 1 if you have the libvorbis])
2103 ],[true])
2104 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto], [${LIBVORBIS_CFLAGS}], [${LIBVORBIS_LIBS}])
2105 if test "${enable_sout}" != "no"; then
2106 dnl Check for libshout
2107     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2111 dnl  matroska demux plugin
2113 PKG_ENABLE_MODULES_VLC([MATROSKA], [mkv], [libebml libmatroska], [MKV format support], [auto])
2116 dnl  modplug demux plugin
2118 AC_ARG_ENABLE(mod,
2119   [AS_HELP_STRING([--disable-mod],
2120     [do not use libmodplug (default auto)])])
2121 if test "${enable_mod}" != "no" ; then
2122     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2123           VLC_ADD_PLUGIN([mod])
2124           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2125           VLC_ADD_CFLAGS([mod],[$LIBMODPLUG_CFLAGS]) #modules/demux/mod.c needs CFLAGS_mod, not CXXFLAGS_mod
2126           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2127     ],[
2128        AS_IF([test -n "${enable_mod}"],
2129          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2130          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2131     ])
2135 dnl  mpc demux plugin
2137 AC_ARG_ENABLE(mpc,
2138   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2139 if test "${enable_mpc}" != "no"
2140 then
2141   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2142     VLC_ADD_PLUGIN([mpc])
2143     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2144     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2145     VLC_ADD_PLUGIN([mpc])
2146     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2150 dnl  Codec plugins
2153 EXTEND_HELP_STRING([Codec plugins:])
2156 dnl wmafixed plugin
2158 AC_ARG_ENABLE(wma-fixed,
2159   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2160 if test "${enable_wma_fixed}" = "yes"
2161 then
2162   VLC_ADD_PLUGIN([wma_fixed])
2166 dnl shine encoder plugin
2168 PKG_ENABLE_MODULES_VLC([SHINE], [], [shine >= 3.0.0], [MPEG Audio Layer 3 encoder], [auto], [], [], [])
2172 dnl openmax il codec plugin
2174 AC_ARG_ENABLE(omxil,
2175   [  --enable-omxil          openmax il codec module (default disabled)])
2176 if test "${enable_omxil}" = "yes"
2177 then
2178   VLC_ADD_PLUGIN([omxil])
2182 dnl openmax il vout plugin
2184 AC_ARG_ENABLE(omxil-vout,
2185   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2186 if test "${enable_omxil_vout}" = "yes"
2187 then
2188   VLC_ADD_PLUGIN([omxil_vout])
2192 dnl raspberry pi openmax il configuration
2194 AC_ARG_ENABLE(rpi-omxil,
2195   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2196 if test "${enable_rpi_omxil}" = "yes"
2197 then
2198   VLC_ADD_PLUGIN([omxil omxil_vout])
2199   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2203 dnl CrystalHD codec plugin
2205 AC_ARG_ENABLE(crystalhd,
2206   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2207 if test "${enable_crystalhd}" != "no"; then
2208     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2209       VLC_ADD_PLUGIN([crystalhd])
2210       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2211     ],[
2212       if test "${SYS}" = "mingw32" ; then
2213         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2214           VLC_ADD_PLUGIN([crystalhd])
2215           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2216             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2217             ])
2218         ],[
2219           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2220                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2221                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2222         ],[#define __LINUX_USER__
2223                #include <libcrystalhd/bc_dts_types.h>
2224         ])
2225       fi
2226     ],[
2227        #include <libcrystalhd/bc_dts_types.h>
2228       ])
2232 dnl  mad plugin
2234 have_mad="no"
2235 MAD_CFLAGS=""
2236 MAD_LIBS=""
2238 AC_ARG_WITH(mad, [  --with-mad=PATH         path to libmad], [
2239   enable_mad="yes"
2240 ], [
2241   with_mad="no"
2243 AS_IF([test "${with_mad}" != "no"], [
2244   MAD_CFLAGS="-I${with_mad}/include"
2245   MAD_LIBS="-L${with_mad}/lib"
2248 AC_ARG_ENABLE(mad,
2249   [  --enable-mad            libmad module (default enabled)])
2250 AS_IF([test "${enable_mad}" != "no"], [
2251   VLC_SAVE_FLAGS
2252   CPPFLAGS="${CPPFLAGS} ${MAD_CFLAGS}"
2253   LDFLAGS="${LDFLAGS} ${MAD_LIBS}"
2254   AC_CHECK_HEADERS(mad.h, [
2255     AC_CHECK_LIB(mad, mad_bit_init, [
2256       have_mad="yes"
2257       MAD_LIBS="${MAD_LIBS} -lmad"
2258     ])
2259   ])
2260   VLC_RESTORE_FLAGS
2261   AS_IF([test -n "$enable_mad" -a "${have_mad}" = "no"], [
2262     AC_MSG_ERROR([Could not find libmad. Install it or pass --disable-mad to disable it.])
2263   ])
2265 AC_SUBST(MAD_CFLAGS)
2266 AC_SUBST(MAD_LIBS)
2267 AM_CONDITIONAL([HAVE_MAD], [test "${have_mad}" = "yes"])
2269 dnl  mpg123 plugin
2272 PKG_ENABLE_MODULES_VLC([MPG123], [mpg123], [libmpg123], [libmpg123 decoder support], [auto])
2275 AC_ARG_ENABLE(merge-ffmpeg,
2276 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2277   enable_merge_ffmpeg="no"
2279 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2281 AC_MSG_CHECKING([for libavutil variant])
2282 PKG_CHECK_EXISTS([libavutil], [
2283   libavutil_version="$(${PKG_CONFIG} --modversion libavutil)"
2284   libavutil_micro="${libavutil_version##*.}"
2285   AS_IF([test ${libavutil_micro} -le 99], [
2286     avfork="libav"
2287   ], [
2288     avfork="ffmpeg"
2289   ])
2290 ], [
2291   avfork="none"
2293 AC_MSG_RESULT([${avfork}])
2296 dnl gstreamer stuff
2298 AC_ARG_ENABLE(gst-decode,
2299   [  --enable-gst-decode     GStreamer based decoding support (currently supports only video decoding) (default auto)])
2301 have_gst_decode="no"
2302 AS_IF([test "${enable_gst_decode}" != "no"], [
2303   PKG_CHECK_MODULES([GST_APP], [gstreamer-app-1.0], [
2304     PKG_CHECK_MODULES([GST_VIDEO], [gstreamer-video-1.0], [
2305       have_gst_decode="yes"
2306     ], [
2307       AC_MSG_WARN([${GST_VIDEO_PKG_ERRORS}. GStreamer decoder module will not be built.])
2308     ])
2309   ], [
2310     AC_MSG_WARN([${GST_APP_PKG_ERRORS}. GStreamer modules will not be built.])
2311   ])
2313 AM_CONDITIONAL([HAVE_GST_DECODE], [test "${have_gst_decode}" = "yes"])
2316 dnl  avcodec decoder/encoder plugin
2318 AC_ARG_ENABLE(avcodec,
2319 [  --enable-avcodec        libavcodec codec (default enabled)])
2320 AS_IF([test "${enable_avcodec}" != "no"], [
2321   dnl We need >=57.16.0 from libav or >=57.37.100 from ffmpeg
2322   case "${avfork}" in
2323     libav) av_codec_ver="57.16.0" ;;
2324     ffmpeg) av_codec_ver="57.37.100" ;;
2325     *) AC_MSG_ERROR([Missing libav or FFmpeg])
2326   esac
2327   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= ${av_codec_ver} libavutil >= 52.0.0], [
2328     VLC_SAVE_FLAGS
2329     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2330     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2331     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2332     AC_CHECK_HEADERS(libavutil/avutil.h)
2333     VLC_RESTORE_FLAGS
2334     have_avcodec="yes"
2335   ],[
2336     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2337   ])
2338 ], [
2339   have_avcodec="no"
2341 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2344 dnl libva needs avcodec
2346 AC_ARG_ENABLE(libva,
2347   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2349 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2350   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2353 have_vaapi="no"
2354 have_vaapi_drm="no"
2355 have_vaapi_x11="no"
2356 AS_IF([test "${enable_libva}" != "no"], [
2357   PKG_CHECK_MODULES([LIBVA], [libva], [
2358     have_vaapi="yes"
2359   ], [
2360     AS_IF([test -n "${enable_libva}"], [
2361       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2362     ], [
2363       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2364     ])
2365   ])
2366   PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm], [
2367     have_vaapi_drm="yes"
2368   ], [
2369     AC_MSG_WARN([${LIBVA_DRM_PKG_ERRORS}.])
2370   ])
2371   PKG_CHECK_MODULES(LIBVA_X11, [libva-x11], [
2372     have_vaapi_x11="yes"
2373   ], [
2374     AC_MSG_WARN([${LIBVA_X11_PKG_ERRORS}.])
2375   ])
2377 AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
2378 AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
2380 have_avcodec_vaapi="no"
2381 AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
2382   VLC_SAVE_FLAGS
2383   CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2384   CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2385   AC_CHECK_HEADERS([libavcodec/vaapi.h], [
2386     AC_MSG_NOTICE([VA API acceleration activated])
2387     have_avcodec_vaapi="yes"
2388   ],[
2389     AS_IF([test -n "${enable_libva}"], [
2390       AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2391     ], [
2392       AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2393     ])
2394   ])
2395   VLC_RESTORE_FLAGS
2397 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2400 dnl dxva2 needs avcodec
2402 AC_ARG_ENABLE(dxva2,
2403   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2405 have_avcodec_dxva2="no"
2406 AS_IF([test "${enable_dxva2}" != "no"], [
2407   if test "${SYS}" = "mingw32"; then
2408   AS_IF([test "x${have_avcodec}" = "xyes"], [
2409     AC_CHECK_HEADERS(dxva2api.h,
2410       [
2411         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2412            AC_MSG_NOTICE([DxVA2 acceleration activated])
2413            have_avcodec_dxva2="yes"
2414         ],[
2415     AS_IF([test "${enable_dxva2}" = "yes"],
2416           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2417               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2418         ], [#undef _WIN32_WINNT
2419             /* DXVA2 is only available in Vista and above */
2420             #define _WIN32_WINNT 0x600])
2421       ],[
2422     AS_IF([test "${enable_dxva2}" = "yes"],
2423               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2424               [AC_MSG_WARN([dxva2api.h not found])])
2425       ],[#include <d3d9.h>])
2426   ],[
2427     AS_IF([test "x${enable_dxva2}" != "x"], [
2428       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2429     ])
2430   ])
2431   fi
2433 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2436 dnl d3d11va needs avcodec
2438 AC_ARG_ENABLE(d3d11va,
2439   [  --enable-d3d11va          D3D11 GPU decoding support (default auto)])
2441 have_avcodec_d3d11va="no"
2442 AS_IF([test "${enable_d3d11va}" != "no"], [
2443   if test "${SYS}" = "mingw32"; then
2444   AS_IF([test "x${have_avcodec}" = "xyes"], [
2445         AC_CHECK_TYPES([ID3D11VideoDecoder],
2446           [
2447             AC_CHECK_HEADERS(dxva2api.h,
2448               [
2449                 AC_CHECK_HEADERS(libavcodec/d3d11va.h, [
2450                    AC_MSG_NOTICE([D3D11 acceleration activated])
2451                    AC_DEFINE(HAVE_AVCODEC_D3D11VA, 1, [Define if the d3d11va module is built])
2452                    have_avcodec_d3d11va="yes"
2453                 ],[
2454                   AS_IF([test "${enable_d3d11va}" = "yes"],
2455                     [AC_MSG_ERROR([d3d11va is present but libavcodec/d3d11va.h is missing])],
2456                         [AC_MSG_WARN([d3d11va is present but libavcodec/d3d11va.h is missing ])])
2457                   ], [#undef _WIN32_WINNT
2458                       /* D3D11 is only available in Vista and above */
2459                       #define _WIN32_WINNT 0x600])
2460                   ],[
2461                     AS_IF([test "${enable_d3d11va}" = "yes"],
2462                           [AC_MSG_ERROR([Could not find required dxva2api.h])],
2463                           [AC_MSG_WARN([dxva2api.h not found])])
2464                   ],[#include <d3d9.h>])
2465           ],[
2466             AS_IF([test "${enable_d3d11va}" = "yes"],
2467                   [AC_MSG_ERROR([Could not find required ID3D11VideoDecoder in d3d11.h])],
2468                   [AC_MSG_WARN([ID3D11VideoDecoder not found])])
2469           ], [#include <d3d11.h>])
2470   ],[
2471     AS_IF([test "x${enable_d3d11va}" != "x"], [
2472       AC_MSG_ERROR([--enable-d3d11va and --disable-avcodec options are mutually exclusive.])
2473     ])
2474   ])
2475   fi
2477 AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
2480 dnl DXGI debug
2482 AC_CHECK_HEADERS(dxgidebug.h)
2485 dnl vda needs avcodec
2487 AC_ARG_ENABLE(vda,
2488   [  --enable-vda          VDA  support (default auto)])
2490 have_avcodec_vda="no"
2491 AS_IF([test "${enable_vda}" != "no"], [
2492   if test "${SYS}" = "darwin"; then
2493   AS_IF([test "x${have_avcodec}" = "xyes"], [
2494     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2495       [
2496         AC_CHECK_HEADERS(libavcodec/vda.h, [
2497            have_avcodec_vda="yes"
2498         ],[
2499         AS_IF([test "${enable_vda}" = "yes"],
2500               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2501               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2502         ])
2503   ],[
2504         AS_IF([test "${enable_vda}" = "yes"],
2505               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2506               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2507       ])
2508   ],[
2509     AS_IF([test "x${enable_vda}" != "x"], [
2510       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2511     ])
2512  ])
2513  AS_IF([test "${have_avcodec_vda}" = "yes"], [
2514      SAVE_LIBS=$LIBS
2515      LIBS="$LIBS $AVCODEC_LIBS"
2516      AC_CHECK_FUNCS([av_vda_alloc_context])
2517      LIBS=$SAVE_LIBS
2518  ])
2519  fi
2521 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2524 dnl  avformat demuxer/muxer plugin
2527 AC_ARG_ENABLE(avformat,
2528 [  --enable-avformat       libavformat containers (default enabled)],, [
2529   enable_avformat="${have_avcodec}"
2531 have_avformat="no"
2532 AS_IF([test "${enable_avformat}" != "no"], [
2533   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2534       have_avformat="yes"
2535       VLC_SAVE_FLAGS
2536       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2537       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2538       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2539       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2540       AC_CHECK_HEADERS(libavutil/avutil.h)
2541       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2542         have_avformat="no"
2543       ])
2544       VLC_RESTORE_FLAGS
2545     ],[
2546       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2547   ])
2549 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2552 dnl  swscale image scaling and conversion plugin
2555 AC_ARG_ENABLE(swscale,
2556   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2557           (default enabled)]))
2558 if test "${enable_swscale}" != "no"
2559 then
2560   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2561     [
2562       VLC_SAVE_FLAGS
2563       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2564       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2565       AC_CHECK_HEADERS(libswscale/swscale.h)
2566       AC_CHECK_HEADERS(libavutil/avutil.h)
2567       VLC_ADD_PLUGIN([swscale])
2568       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2569       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2570       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2571         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2572       ])
2573       VLC_RESTORE_FLAGS
2574     ],[
2575       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2576   ])
2580 dnl  postproc plugin
2583 AC_ARG_ENABLE(postproc,
2584 [  --enable-postproc       libpostproc image post-processing (default auto)])
2585 if test "${enable_postproc}" != "no"
2586 then
2587   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2588     [
2589       VLC_SAVE_FLAGS
2590       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2591       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2592       AC_CHECK_HEADERS(postproc/postprocess.h)
2593       VLC_ADD_PLUGIN([postproc])
2594       VLC_RESTORE_FLAGS
2595     ],[
2596       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2597   ])
2601 dnl  faad decoder plugin
2603 AC_ARG_ENABLE(faad,
2604 [  --enable-faad           faad codec (default auto)])
2605 have_faad="no"
2606 AS_IF([test "${enable_faad}" != "no"], [
2607   AC_CHECK_HEADERS([neaacdec.h], [
2608     AC_CHECK_LIB(faad, NeAACDecOpen, [have_faad="yes"],, [$LIBM])
2610     AS_IF([test "${have_faad}" = "yes"], [
2611       VLC_ADD_PLUGIN([faad])
2612       VLC_ADD_LIBS([faad],[-lfaad])
2613     ], [
2614       AS_IF([test "${enable_faad}" = "yes"], [
2615         AC_MSG_ERROR([cannot find FAAD library])
2616       ], [
2617         AC_MSG_WARN([cannot find FAAD library])
2618       ])
2619     ])
2620   ])
2624 dnl  AOM decoder plugin
2626 PKG_ENABLE_MODULES_VLC([AOM], [], [aom], [experimental AV1 codec], [disabled])
2629 dnl libvpx decoder plugin
2631 AC_ARG_ENABLE(vpx,
2632     AS_HELP_STRING([--enable-vpx],[libvpx VP8/VP9 encoder and decoder (default auto)]))
2633 AS_IF([test "${enable_vpx}" != "no"],[
2634     PKG_CHECK_MODULES([VPX], [vpx] , [
2635         VLC_ADD_PLUGIN([vpx])
2636         VLC_ADD_CPPFLAGS([vpx], [${VPX_CFLAGS}])
2637         VLC_ADD_LIBS([vpx], [${VPX_LIBS}])
2638         AC_CHECK_LIB([vpx],[vpx_codec_vp8_dx], [
2639             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_DECODER])
2640         ], [], [${VPX_LIBS}])
2641         AC_CHECK_LIB([vpx],[vpx_codec_vp9_dx], [
2642             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_DECODER])
2643         ], [], [${VPX_LIBS}])
2644         AC_CHECK_LIB([vpx],[vpx_codec_vp8_cx], [
2645             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_ENCODER])
2646         ], [], [${VPX_LIBS}])
2647         AC_CHECK_LIB([vpx],[vpx_codec_vp9_cx], [
2648             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_ENCODER])
2649         ], [], [${VPX_LIBS}])
2650     ], [
2651     AS_IF([test "${enable_vpx}" = "yes"],[
2652         AC_MSG_ERROR([libvpx was not found])
2653     ])])
2657 dnl twolame encoder plugin
2659 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2662 dnl fdk-aac encoder plugin
2664 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2668 dnl A52/AC3 decoder plugin
2670 AC_ARG_ENABLE(a52,
2671   [  --enable-a52            A/52 support with liba52 (default enabled)])
2672 if test "${enable_a52}" != "no"
2673 then
2674   AC_ARG_WITH(a52,
2675     [  --with-a52=PATH         a52 headers and libraries])
2676     if test -z "${with_a52}"
2677     then
2678       LDFLAGS_test=""
2679       CPPFLAGS_test=""
2680     else
2681       LDFLAGS_test="-L${with_a52}/lib"
2682       CPPFLAGS_test="-I${with_a52}/include"
2683     fi
2684     VLC_SAVE_FLAGS
2685     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_liba52}"
2686     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_liba52}"
2687     AC_CHECK_HEADERS(a52dec/a52.h, [
2688       AC_CHECK_LIB(a52, a52_free, [
2689         VLC_ADD_PLUGIN([liba52])
2690         VLC_ADD_LIBS([liba52],[${LDFLAGS_test} -la52])
2691         VLC_ADD_CPPFLAGS([liba52],[${CPPFLAGS_test}])
2692       ],[
2693         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.])
2694         ], [$LIBM])
2695     ],[
2696       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.])
2697     ])
2698     VLC_RESTORE_FLAGS
2702 dnl DTS Coherent Acoustics decoder plugin
2704 PKG_ENABLE_MODULES_VLC([DCA], [dca], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2707 dnl  Flac plugin
2709 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2712 dnl  Libmpeg2 plugin
2714 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2717 dnl  Vorbis plugin
2719 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2722 dnl  Tremor plugin
2724 AC_ARG_ENABLE(tremor,
2725   [  --enable-tremor         Tremor decoder support (default disabled)])
2726 if test "${enable_tremor}" = "yes"
2727 then
2728   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2729     VLC_ADD_PLUGIN([tremor])
2730    ],[])
2734 dnl  Speex plugins
2736 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2737 have_speexdsp="no"
2738 AS_IF([test "${enable_speex}" != "no"], [
2739   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2740     have_speexdsp="yes"
2741   ], [
2742     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2743   ])
2745 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2748 dnl  Opus plugin
2750 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus >= 1.0.3], [Opus support], [auto])
2753 dnl  theora decoder plugin
2755 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2758 dnl  OggSpots decoder plugin
2760 PKG_ENABLE_MODULES_VLC([OGGSPOTS], [], [ogg], [experimental OggSpots codec], [auto])
2763 dnl  Daala decoder plugin
2765 PKG_ENABLE_MODULES_VLC([DAALA], [], [daaladec daalaenc], [experimental daala codec], [disabled])
2768 dnl  schroedinger decoder plugin (for dirac format video)
2770 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2773 dnl  PNG decoder module
2775 AC_ARG_ENABLE(png,
2776   [  --enable-png            PNG support (default enabled)])
2777 AS_IF([test "${enable_png}" != "no"], [
2778 AC_CHECK_HEADERS(png.h, [
2779   VLC_SAVE_FLAGS
2780   LDFLAGS="${LDFLAGS} -lz $LIBM"
2781   AC_CHECK_LIB(png, png_set_rows, [
2782     VLC_ADD_PLUGIN([png])
2783   ], [], [-lz $LIBM])
2784   VLC_RESTORE_FLAGS
2785   ])
2789 dnl  JPEG decoder module
2791 AC_ARG_ENABLE(jpeg,
2792   [  --enable-jpeg           JPEG support (default enabled)])
2793 AS_IF([test "${enable_jpeg}" != "no"], [
2794 AC_CHECK_HEADERS(jpeglib.h, [
2795   VLC_ADD_PLUGIN([jpeg])
2796   ])
2800 dnl  BPG decoder module
2802 AC_ARG_ENABLE(bpg,
2803   [  --enable-bpg           BPG support (default disabled)])
2804 AS_IF([test "${enable_bpg}" != "no"], [
2805 AC_CHECK_HEADERS(libbpg.h, [
2806   VLC_ADD_PLUGIN([bpg])
2807   ])
2811 dnl H262 encoder plugin (lib262)
2813 AC_ARG_ENABLE(x262,
2814   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2815 if test "${enable_x262}" != "no"; then
2816     PKG_CHECK_MODULES(X262, x262, [
2817         VLC_ADD_PLUGIN([x262])
2818         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2819         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2820           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2821         ])
2822         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2823         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2824           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2825         fi
2826     ], [
2827        if test "${enable_x262}" = "yes"; then
2828         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2829        fi
2830     ])
2833 dnl x265 encoder
2834 PKG_ENABLE_MODULES_VLC([X265],, [x265], [HEVC/H.265 encoder], [auto])
2837 dnl H264 encoder plugin (10-bit lib264)
2839 AC_ARG_ENABLE(x26410b,
2840   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2841 if test "${enable_x26410b}" != "no"; then
2842     PKG_CHECK_MODULES(X26410B, x26410b, [
2843         VLC_ADD_PLUGIN([x26410b])
2844         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2845         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2846           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2847         ])
2848         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2849         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2850           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2851         fi
2852     ], [
2853        if test "${enable_x26410b}" = "yes"; then
2854         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2855        fi
2856     ])
2861 dnl H264 encoder plugin (using libx264)
2863 AC_ARG_ENABLE(x264,
2864   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2865 if test "${enable_x264}" != "no"; then
2866       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2867         VLC_ADD_PLUGIN([x264])
2868         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2870         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2871           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2872         ])
2874         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2875         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2876           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2877         fi
2878       ],[
2879         if test "${enable_x264}" = "yes"; then
2880             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2881           fi
2882       ])
2886 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2888 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2891 dnl libfluidsynth (MIDI synthetizer) plugin
2893 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2894 PKG_ENABLE_MODULES_VLC([FLUIDLITE], [fluidsynth], [fluidlite], [MIDI synthetiser with libfluidsynth], [auto])
2895 AC_CHECK_HEADERS(fluidlite.h, [AC_SUBST([FLUIDSYNTH_LIBS], ${FLUIDLITE_LIBS})])
2898 dnl Teletext Modules
2899 dnl vbi decoder plugin (using libzbvi)
2900 dnl telx module
2901 dnl uncompatible
2903 AC_ARG_ENABLE(zvbi,
2904   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2905                   libzvbi (default enabled)]))
2906 AC_ARG_ENABLE(telx,
2907   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2908                   zvbi) (default enabled if zvbi is absent)]))
2910 AS_IF( [test "${enable_zvbi}" != "no"],[
2911     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2912         [
2913           VLC_ADD_PLUGIN([zvbi])
2914           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2915           AS_IF( [test "${enable_telx}" = "yes"],[
2916                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2917                   ])
2918         ],[
2919           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2920         ])
2921     ])
2922 AS_IF( [test "${enable_telx}" != "no" ],[
2923   VLC_ADD_PLUGIN([telx])
2924   ])
2927 dnl libass subtitle rendering module
2929 AC_ARG_ENABLE(libass,
2930   [  --enable-libass         Subtitle support using libass (default enabled)])
2931 AS_IF( [test "${enable_libass}" != "no"], [
2932   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2933       [
2934         VLC_ADD_PLUGIN([libass])
2936         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2937           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2938            VLC_ADD_LIBS([libass],[-lfontconfig])
2939        ])
2940       ],[
2941         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2942       ])
2943   ])
2946 dnl ARIB subtitles rendering module
2948 AC_ARG_ENABLE(aribsub,
2949   [  --enable-aribsub        ARIB Subtitles support (default enabled)])
2950 AS_IF( [test "${enable_aribsub}" != "no" ],[
2951   PKG_CHECK_MODULES(ARIBB24, [aribb24 >= 1.0.1], [
2952       have_aribb24="yes"
2953       VLC_ADD_PLUGIN([aribsub])
2954       VLC_ADD_LIBS([aribsub],[-laribb24])
2955       AC_DEFINE(HAVE_ARIBB24, 1, [Define if libaribb24 is available.])
2956     ],[
2957       AC_MSG_WARN(Library [aribb24] needed for [aribsub] was not found)
2958       have_aribb24="no"
2959   ])
2961 AM_CONDITIONAL([HAVE_ARIBB24], [test x"${have_aribb24}" = x"yes"])
2964 dnl ARIB B25
2966 PKG_ENABLE_MODULES_VLC([ARIBB25], [aribcam], [aribb25 >= 0.2.6], [ARIB STD-B25], [auto])
2969 dnl  kate decoder plugin
2971 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2974 dnl  tiger rendering for kate decoder plugin
2976 AC_ARG_ENABLE(tiger,
2977 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2978 AS_IF([test "${enable_tiger}" != "no"], [
2979   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2980       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2981         AS_IF([test -n "${enable_tiger}"], [
2982           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2983         ])
2984   ])
2989 dnl  Video plugins
2992 EXTEND_HELP_STRING([Video plugins:])
2995 dnl  OpenGL
2997 PKG_CHECK_MODULES([EGL], [egl], [
2998   have_egl="yes"
2999 ], [
3000   have_egl="no"
3002 AM_CONDITIONAL([HAVE_EGL], [test "${have_egl}" = "yes"])
3004 have_gl="no"
3005 PKG_CHECK_MODULES([GL], [gl], [
3006   have_gl="yes"
3007 ], [
3008   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3009 #ifdef _WIN32
3010 # include <GL/glew.h>
3011 #endif
3012 #include <GL/gl.h>
3013 ]], [
3014     [int t0 = GL_TEXTURE0;]])
3015   ], [
3016     GL_CFLAGS=""
3017     have_gl="yes"
3018     AS_IF([test "${SYS}" != "mingw32"], [
3019       GL_LIBS="-lGL"
3020     ], [
3021       GL_LIBS="-lopengl32"
3022     ])
3023   ])
3025 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
3027 dnl OpenGL ES 2: depends on EGL 1.1
3028 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
3029 dnl OpenGL ES 1: depends on EGL 1.0
3030 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
3033 dnl  Xlib
3036 AC_PATH_XTRA()
3037 AC_CHECK_HEADERS(X11/Xlib.h)
3040 dnl  X C Bindings modules
3042 AC_ARG_ENABLE(xcb,
3043   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3044   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"], [
3045     enable_xcb="yes"
3046   ], [
3047     enable_xcb="no"
3048   ])
3050 AC_ARG_ENABLE(xvideo,
3051   [  --enable-xvideo         XVideo support (default enabled)],, [
3052     enable_xvideo="$enable_xcb"
3055 have_xcb="no"
3056 have_xcb_keysyms="no"
3057 have_xcb_randr="no"
3058 have_xcb_xvideo="no"
3059 AS_IF([test "${enable_xcb}" != "no"], [
3060   dnl libxcb
3061   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3062   have_xcb="yes"
3063   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3064   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3065   PKG_CHECK_MODULES(XPROTO, [xproto])
3067   AS_IF([test "${enable_xvideo}" != "no"], [
3068     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3069   ])
3071   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3073   dnl xcb-utils
3074   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3075     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3076   ])
3078 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3079 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3080 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3081 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3085 dnl VDPAU needs X11
3087 AC_ARG_ENABLE(vdpau,
3088   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3089 have_vdpau="no"
3090 AS_IF([test "${enable_vdpau}" != "no"], [
3091   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3092     have_vdpau="yes"
3093     AS_IF([test "${no_x}" = "yes"], [
3094       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3095     ])
3096   ], [
3097     AS_IF([test -n "${enable_vdpau}"], [
3098       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3099     ])
3100   ])
3102 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3104 have_avcodec_vdpau="no"
3105 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3106   case "${avfork}" in
3107     libav) av_vdpau_ver="55.26.0" ;;
3108     ffmpeg) av_vdpau_ver="55.42.100" ;;
3109   esac
3110   PKG_CHECK_EXISTS([libavutil >= 52.4.0 libavcodec >= ${av_vdpau_ver}], [
3111     have_avcodec_vdpau="yes"
3112     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3113   ], [
3114     AS_IF([test -n "${enable_vdpau}"], [
3115       AC_MSG_ERROR([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3116     ], [
3117       AC_MSG_WARN([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3118     ])
3119   ])
3121 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3125 dnl  Wayland
3127 AC_ARG_ENABLE(wayland,
3128   [AS_HELP_STRING([--enable-wayland], [Wayland support (default auto)])])
3129 have_wayland="no"
3130 AC_ARG_VAR([WAYLAND_SCANNER], [Wayland scanner utility])
3132 AS_IF([test "${enable_wayland}" != "no"], [
3133   AC_MSG_CHECKING([for the Wayland scanner])
3134   AS_IF([test -z "$WAYLAND_SCANNER"], [
3135     PKG_CHECK_EXISTS([wayland-scanner], [
3136       WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
3137     ], [
3138       WAYLAND_SCANNER="wayland-scanner"
3139     ])
3140   ])
3141   AC_MSG_RESULT([$WAYLAND_SCANNER])
3143   PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91], [
3144     have_wayland="yes"
3145   ], [
3146     AS_IF([test -n "${enable_wayland}"], [
3147       AC_MSG_ERROR([${WAYLAND_CLIENT_PKG_ERRORS}.])
3148     ])
3149   ])
3151   AS_IF([test "${have_egl}" = "yes"], [
3152     PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [
3153       have_wayland_egl="yes"
3154     ], [
3155       AS_IF([test -n "${enable_wayland}"], [
3156         AC_MSG_ERROR([${WAYLAND_EGL_PKG_ERRORS}.])
3157       ])
3158     ])
3159   ])
3161 AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
3162 AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "${have_wayland_egl}" = "yes"])
3166 dnl  SDL module
3168 AC_ARG_ENABLE(sdl,
3169   [  --enable-sdl            SDL support (default enabled)])
3170 AC_ARG_ENABLE(sdl-image,
3171   [  --enable-sdl-image      SDL image support (default enabled)])
3172 if test "${enable_sdl}" != "no"
3173 then
3174    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3175       # SDL on Darwin is heavily patched and can only run SDL_image
3176       if test "${SYS}" != "darwin"; then
3177         VLC_ADD_PLUGIN([vout_sdl])
3178       fi
3180       # SDL_image
3181       AS_IF([ test "${enable_sdl_image}" != "no"],[
3182         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3183           VLC_ADD_PLUGIN([sdl_image])],
3184           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3185           ])
3186       ])
3187    ],[
3188      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3189    ])
3193 dnl  freetype module
3195 AC_ARG_ENABLE(freetype,
3196   [  --enable-freetype       freetype support   (default auto)])
3197 AC_ARG_ENABLE(fribidi,
3198   [  --enable-fribidi        fribidi support    (default auto)])
3199 AC_ARG_ENABLE(harfbuzz,
3200   [  --enable-harfbuzz       harfbuzz support   (default auto)])
3201 AC_ARG_ENABLE(fontconfig,
3202   [  --enable-fontconfig     fontconfig support (default auto)])
3204 AC_ARG_WITH([default-font],
3205     AS_HELP_STRING([--with-default-font=PATH],
3206         [Path to the default font]),
3207         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3208             "$withval", [Default font])])
3209 AC_ARG_WITH([default-monospace-font],
3210     AS_HELP_STRING([--with-default-monospace-font=PATH],
3211         [Path to the default font]),
3212         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3213             "$withval", [Default monospace font])])
3215 AC_ARG_WITH([default-font-family],
3216     AS_HELP_STRING([--with-default-font-family=NAME],
3217         [Path to the default font family]),
3218         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3219             "$withval", [Default font family])])
3220 AC_ARG_WITH([default-monospace-font-family],
3221     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3222         [Path to the default font family]),
3223         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3224             "$withval", [Default monospace font family])])
3226 have_freetype="no"
3227 have_fontconfig="no"
3228 have_fribidi="no"
3229 have_harfbuzz="no"
3231 if test "${enable_freetype}" != "no"; then
3232    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3233       have_freetype="yes"
3234       VLC_ADD_CPPFLAGS([skins2],[${FREETYPE_CFLAGS}])
3235       VLC_ADD_LIBS([skins2],[${FREETYPE_LIBS}])
3237       dnl fontconfig support
3238       if test "${SYS}" != "mingw32"; then
3239           if test "${enable_fontconfig}" != "no"; then
3240             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3241               have_fontconfig="yes"
3242             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3243           fi
3244       fi
3246       dnl fribidi support
3247       if test "${enable_fribidi}" != "no"; then
3248         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3249           have_fribidi="yes"
3250           VLC_ADD_CPPFLAGS([skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3251           VLC_ADD_LIBS([skins2], [${FRIBIDI_LIBS}])
3252         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional text and complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3253       fi
3255       dnl harfbuzz support
3256       if test "${have_fribidi}" != "no"; then
3257         if test "${enable_harfbuzz}" != "no"; then
3258           PKG_CHECK_MODULES(HARFBUZZ, harfbuzz, [
3259             have_harfbuzz="yes"
3260             VLC_ADD_CPPFLAGS([skins2], [${HARFBUZZ_CFLAGS} -DHAVE_HARFBUZZ])
3261             VLC_ADD_LIBS([skins2], [${HARFBUZZ_LIBS}])
3262           ],[AC_MSG_WARN([${HARFBUZZ_PKG_ERRORS}. Support for complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3263         fi
3264       fi
3265   ],[
3266   AS_IF([test -n "${enable_freetype}"],[
3267     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3268     ])
3269   ])
3272 AM_CONDITIONAL([HAVE_FREETYPE], [test "${have_freetype}" = "yes"])
3273 AM_CONDITIONAL([HAVE_FONTCONFIG], [test "${have_fontconfig}" = "yes"])
3274 AM_CONDITIONAL([HAVE_FRIBIDI], [test "${have_fribidi}" = "yes"])
3275 AM_CONDITIONAL([HAVE_HARFBUZZ], [test "${have_harfbuzz}" = "yes"])
3278 dnl SAPI (text to Speech renderer for Windows)
3280 AC_LANG_PUSH([C++])
3281 AC_CHECK_TYPES([ISpObjectToken],[
3282               have_sapi="yes"
3283             ],[AC_MSG_WARN([sapi.h not found. Text to Speech renderer for Windows disabled])],
3284               [#include <windows.h>
3285                #include <sapi.h>
3286                #include <sphelper.h>])
3287 AM_CONDITIONAL([HAVE_SAPI], [test "${have_sapi}" = "yes"])
3288 AC_LANG_POP([C++])
3291 dnl  SVG module (text rendering and image decoding)
3293 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3294 PKG_ENABLE_MODULES_VLC([SVGDEC], [], [librsvg-2.0 >= 2.9.0 cairo >= 1.13.1], [SVG image decoder library],[auto])
3297 dnl  Windows DirectX module
3300 AC_ARG_ENABLE(directx,
3301   [AS_HELP_STRING([--enable-directx],
3302     [Microsoft DirectX support (default enabled on Windows)])],, [
3303   AS_IF([test "${SYS}" = "mingw32"], [
3304     enable_directx="yes"
3305   ], [
3306     enable_directx="no"
3307   ])
3309 AS_IF([test "${enable_directx}" != "no"], [
3310   dnl DirectDraw
3311   AC_CHECK_HEADERS(ddraw.h, [
3312     VLC_ADD_PLUGIN([directdraw])
3313   ])
3315   dnl OpenGL
3316   AC_CHECK_HEADERS(GL/wglew.h, [
3317     VLC_ADD_PLUGIN([glwin32, wgl])
3318   ],, [
3319     #include <windows.h>
3320     #include <GL/gl.h>
3321   ])
3323   dnl Direct3D11
3324   AC_CHECK_HEADERS(d3d11.h, [
3325     VLC_ADD_PLUGIN([direct3d11])
3326   ])
3328   dnl Direct3D9
3329   AC_CHECK_HEADERS(d3d9.h, [
3330     VLC_ADD_PLUGIN([direct3d9])
3331   ])
3333   dnl Direct2D
3334   AC_CHECK_HEADERS(d2d1.h, [
3335     VLC_ADD_PLUGIN([direct2d])
3336   ])
3340 dnl  Linux framebuffer module
3342 AC_CHECK_HEADER([linux/fb.h], [
3343   VLC_ADD_PLUGIN([fb])
3348 dnl  DirectFB module
3349 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3350 dnl  TODO: support for static linking
3352 AC_ARG_ENABLE(directfb,
3353   [  --enable-directfb       DirectFB support (default disabled)])
3354 AC_ARG_WITH(directfb,
3355   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3357 if test "${enable_directfb}" = "yes"; then
3358     have_directfb="false"
3359     CPPFLAGS_mydirectfb=
3360     LIBS_mydirectfb=
3361     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3362         dnl Trying the given location
3363         VLC_SAVE_FLAGS
3365         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3366         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3368         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3369         LIBS="${LIBS} ${LIBS_new}"
3371         dnl FIXME: too obscure
3372         AC_CHECK_HEADER([directfb.h], [
3373             AC_CHECK_LIB([direct],[direct_initialize], [
3374                 AC_CHECK_LIB([fusion], [fusion_enter], [
3375                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3376                 ], have_directfb="false")
3377             ], have_directfb="false")
3378         ], have_directfb="false")
3380         VLC_RESTORE_FLAGS
3382         if test "${have_directfb}" = "true"; then
3383             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3384             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3385         fi
3386     else
3387         dnl Look for directfb-config
3388         AC_CHECK_PROG(DIRECTFB_CONFIG, [directfb-config], [false])
3389         AS_IF(["${DIRECTFB_CONFIG}" != "false"], [
3390             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3391             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3392             have_directfb="true"
3393         ], [
3394             dnl Trying with pkg-config
3395             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3396                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3397                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3398                 have_directfb="true"
3399                 ], [have_directfb="false"])
3400         ])
3401     fi
3402     if test "${have_directfb}" = "true"; then
3403         VLC_ADD_PLUGIN([directfb])
3404         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3405         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3406     else
3407         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3408     fi
3412 dnl  AA plugin
3414 AC_ARG_ENABLE(aa,
3415   [  --enable-aa             aalib output (default disabled)])
3416 if test "${enable_aa}" = "yes"
3417 then
3418   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3419   if test "${have_aa}" = "true"
3420   then
3421     VLC_ADD_PLUGIN([aa])
3422   fi
3426 dnl  libcaca plugin
3428 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3431 dnl  OS/2 KVA plugin
3433 AC_ARG_ENABLE(kva,
3434   [AS_HELP_STRING([--enable-kva],
3435     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3436   AS_IF([test "$SYS" = "os2"], [
3437     enable_kva="yes"
3438   ])
3440 have_kva="no"
3441 KVA_LIBS=""
3442 AS_IF([test "$enable_kva" != "no"], [
3443   AC_CHECK_HEADERS([kva.h], [
3444     have_kva="yes"
3445     AC_CHECK_LIB(kva, main, [
3446       KVA_LIBS="-lkva"
3447     ])
3448   ])
3450 AC_SUBST(KVA_LIBS)
3451 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3454 dnl MMAL plugin
3456 AC_ARG_ENABLE(mmal,
3457   AS_HELP_STRING([--enable-mmal],
3458     [Multi-Media Abstraction Layer (MMAL) hardware plugin (default enable)]))
3459 if test "${enable_mmal}" != "no"; then
3460   VLC_SAVE_FLAGS
3461   LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
3462   CPPFLAGS="${CPPFLAGS} -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
3463   AC_CHECK_HEADERS(interface/mmal/mmal.h,
3464     [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
3465         have_mmal="yes"
3466         VLC_ADD_PLUGIN([mmal])
3467         VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
3468         VLC_ADD_CFLAGS([mmal],[ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux ])
3469         VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lvchostif ]) ], [
3470           AS_IF([test "${enable_mmal}" = "yes"],
3471             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
3472             [ AC_MSG_WARN([Cannot find bcm library...]) ])
3473           ],
3474         [])
3475     ] , [ AS_IF([test "${enable_mmal}" = "yes"],
3476       [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
3477       [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
3478   VLC_RESTORE_FLAGS
3480 AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
3483 dnl evas plugin
3485 AC_ARG_ENABLE(evas,
3486   [AS_HELP_STRING([--enable-evas],
3487     [use evas output module (default disabled)])])
3488 have_evas="no"
3489 AS_IF([test "${enable_evas}" = "yes"], [
3490   PKG_CHECK_MODULES(EVAS, [evas >= 1.15.99 ecore >= 1.15.99], [
3491       have_evas="yes"
3492       AC_DEFINE([HAVE_EVAS], [1], [Define to 1 if evas is enabled.])
3493     ],[
3494     AS_IF([test "x${enable_evas}" != "x"], [
3495       AC_MSG_ERROR([$EVAS_PKG_ERRORS. libevas and libecore 1.15.99 or later required.])
3496     ])
3497   ])
3499 AM_CONDITIONAL([HAVE_EVAS], [test "${have_evas}" = "yes"])
3502 dnl  Audio plugins
3505 EXTEND_HELP_STRING([Audio plugins:])
3508 dnl  Pulseaudio module
3510 AC_ARG_ENABLE(pulse,
3511   [AS_HELP_STRING([--enable-pulse],
3512     [use the PulseAudio client library (default auto)])])
3513 have_pulse="no"
3514 AS_IF([test "${enable_pulse}" != "no"], [
3515   PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0], [
3516     have_pulse="yes"
3517   ], [
3518     AS_IF([test "x${enable_pulse}" != "x"], [
3519       AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 1.0 or later required.])
3520     ])
3521   ])
3523 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3526 dnl  ALSA module
3528 AC_ARG_ENABLE(alsa,
3529   [AS_HELP_STRING([--enable-alsa],
3530     [support the Advanced Linux Sound Architecture (default auto)])],, [
3531   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3532     enable_alsa="yes"
3533   ])
3535 have_alsa="no"
3536 AS_IF([test "${enable_alsa}" != "no"], [
3537   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3538     have_alsa="yes"
3539   ], [
3540     AS_IF([test "x${enable_alsa}" != "x"], [
3541       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3542     ])
3543   ])
3545 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3548 dnl  Open Sound System module
3550 AC_ARG_ENABLE(oss,
3551   [AS_HELP_STRING([--enable-oss],
3552     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3553   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3554     enable_oss="no"
3555   ])
3557 have_oss="no"
3558 OSS_LIBS=""
3559 AS_IF([test "$enable_oss" != "no"], [
3560   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3561     have_oss="yes"
3562     AC_CHECK_LIB(ossaudio, main, [
3563       OSS_LIBS="-lossaudio"
3564     ])
3565   ])
3567 AC_SUBST(OSS_LIBS)
3568 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3571 dnl  OpenBSD sndio module
3573 AC_ARG_ENABLE([sndio],
3574   [AS_HELP_STRING([--disable-sndio],
3575     [support the OpenBSD sndio (default auto)])],, [
3576   AS_IF([test "$SYS" = "openbsd"], [
3577     enable_sndio="yes"
3578   ])
3580 have_sndio="no"
3581 AS_IF([test "$enable_sndio" != "no"], [
3582   AC_CHECK_HEADER([sndio.h], [
3583     have_sndio="yes"
3584   ])
3586 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3589 dnl  Windows Audio Session plugin
3591 AC_ARG_ENABLE([wasapi],
3592   [AS_HELP_STRING([--enable-wasapi],
3593     [use the Windows Audio Session API (default auto)])
3595 have_wasapi="no"
3596 AS_IF([test "$enable_wasapi" != "no"], [
3597   AC_CHECK_HEADER([audioclient.h], [
3598     have_wasapi="yes"
3599   ], [
3600     AS_IF([test "x${enable_wasapi}" != "x"], [
3601       AC_MSG_ERROR([Windows Audio Session API not found.])
3602     ])
3603   ])
3605 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3608 dnl  AudioQueue plugin
3610 AC_ARG_ENABLE(audioqueue,
3611   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3612 if test "${enable_audioqueue}" = "yes"
3613 then
3614   VLC_ADD_PLUGIN([audioqueue])
3618 dnl  JACK modules
3620 AC_ARG_ENABLE(jack,
3621   [AS_HELP_STRING([--disable-jack],
3622     [do not use jack (default auto)])])
3623 have_jack="no"
3624 AS_IF([test "${enable_jack}" != "no"], [
3625     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3626       [ have_jack=yes ],
3627       [
3628       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3630       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3631       [ have_jack=yes ],
3632       [
3633       AS_IF([test -n "${enable_jack}"],
3634          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3635          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3636       ])
3637     ])
3639 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3642 dnl  OpenSLES Android
3644 AC_ARG_ENABLE(opensles,
3645   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3646 if test "${HAVE_ANDROID}" = "1"; then
3647   if test "${enable_opensles}" = "yes"; then
3648       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3649         [ VLC_ADD_PLUGIN([opensles_android]) ],
3650         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3651   fi
3655 dnl  Tizen audio
3657 AC_ARG_ENABLE(tizen_audio,
3658   [AS_HELP_STRING([--enable-tizen-audio],
3659     [Tizen audio module (default enabled on Tizen)])],, [
3660   AS_IF([test "$HAVE_TIZEN" = "1"], [
3661     enable_tizen_audio="yes"
3662   ])
3664 if test "${enable_tizen_audio}" = "yes"; then
3665   AC_CHECK_HEADERS(audio_io.h,
3666     [ VLC_ADD_PLUGIN([tizen_audio]) ],
3667     [ AC_MSG_ERROR([cannot find Tizen audio_io headers])] )
3671 dnl libsamplerate plugin
3673 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3676 dnl  soxr module
3678 PKG_ENABLE_MODULES_VLC([SOXR], [], [soxr >= 0.1.2], [SoX Resampler library], [auto])
3681 dnl  OS/2 KAI plugin
3683 AC_ARG_ENABLE(kai,
3684   [AS_HELP_STRING([--enable-kai],
3685     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3686   AS_IF([test "$SYS" = "os2"], [
3687     enable_kai="yes"
3688   ])
3690 have_kai="no"
3691 KAI_LIBS=""
3692 AS_IF([test "$enable_kai" != "no"], [
3693   AC_CHECK_HEADERS([kai.h], [
3694     have_kai="yes"
3695     AC_CHECK_LIB(kai, main, [
3696       KAI_LIBS="-lkai"
3697     ])
3698   ])
3700 AC_SUBST(KAI_LIBS)
3701 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3704 dnl  chromaprint audio track fingerprinter
3706 m4_pushdef([libchromaprint_version], 0.6.0)
3707 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3708     VLC_ADD_PLUGIN([stream_out_chromaprint]),
3709     AS_IF([test "${enable_chromaprint}" = "yes"],
3710         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3711         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3712          ),
3713     [(Chromaprint based audio fingerprinter)],[auto])
3714 m4_popdef([libchromaprint_version])
3717 dnl  Chromecast streaming support
3719 m4_pushdef([protobuf_lite_version], 2.5.0)
3720 AC_ARG_VAR(PROTOC, [protobuf compiler])
3721 AC_CHECK_PROGS(PROTOC, protoc, no)
3722 PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
3723     AS_IF([test "x${PROTOC}" != "xno"], [
3724         build_chromecast="yes"
3725     ], [
3726     AC_MSG_ERROR(protoc compiler needed for [chromecast] was not found)
3727     ])
3728 ], [
3729     AS_IF([test "${enable_chromecast}" = "yes"],
3730         AC_MSG_ERROR(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found),
3731         AC_MSG_WARN(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found)
3732     )
3733     enable_chromecast="no"
3734 ], [(Chromecast streaming support)], [auto])
3735 AM_CONDITIONAL([BUILD_CHROMECAST], [test "${build_chromecast}" = "yes"])
3736 m4_popdef([protobuf_lite_version])
3739 dnl  Interface plugins
3742 EXTEND_HELP_STRING([Interface plugins:])
3745 dnl QT
3747 AC_ARG_ENABLE(qt, [
3748   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3749   AS_IF([test "${SYS}" = "darwin"], [
3750     enable_qt="no"
3751   ])
3753 AS_IF([test "${enable_qt}" != "no"], [
3754   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.2.0 Qt5Widgets Qt5Gui], [
3755       PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
3756           VLC_ADD_LIBS([qt],[${QTX11_LIBS}])
3757           VLC_ADD_CXXFLAGS([qt],[${QTX11_CFLAGS} -DQT5_HAS_X11])
3758           PKG_CHECK_MODULES([XI], [xi], [
3759             VLC_ADD_LIBS([qt], [${XI_LIBS}])
3760             VLC_ADD_CXXFLAGS([qt], [${XI_CFLAGS} -DHAVE_XI])
3761           ], [
3762             PKG_CHECK_EXISTS([Qt5Gui >= 5.5], [
3763               AC_MSG_ERROR([${XI_PKG_ERRORS}.])
3764             ], [
3765               AC_MSG_WARN([${XI_PKG_ERRORS}.])
3766             ])
3767           ])
3768       ],[
3769           AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
3770       ])
3771       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3772       QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
3773       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3774       AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3775       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3776     ], [
3777       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.8.0],, [
3778         AS_IF([test -n "${enable_qt}"],[
3779           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3780         ],[
3781           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3782         ])
3783         enable_qt="no"
3784       ])
3785       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3786       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin"])
3787       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin])
3788       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin"])
3789     ])
3791 AS_IF([test "${enable_qt}" != "no"], [
3792   VLC_ADD_PLUGIN([qt])
3793   ALIASES="${ALIASES} qvlc"
3795 AM_CONDITIONAL(ENABLE_QT, [test "$enable_qt" != "no"])
3798 dnl detect kde4-config patch (used for kde solids and kwallet).
3800 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
3801 AS_IF([test "x$KDE4_CONFIG" = "x"], [
3802   KDE4_CONFIG="kde4-config"
3806 dnl Simple test for skins2 dependency
3808 AS_IF([test "$enable_qt" = "no"], [
3809   AS_IF([test "${enable_skins2}" = "yes"], [
3810     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.])
3811   ], [
3812     enable_skins2="no"
3813     AC_MSG_WARN([The skins2 module depends on the Qt interface, Qt is not built so skins2 is disabled.])
3814   ])
3818 dnl Skins2 module
3820 AC_ARG_ENABLE(skins2,
3821   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3822 AS_IF([test "${enable_skins2}" != "no"], [
3823   have_skins_deps="yes"
3825   dnl Win32
3826   AS_IF([test "${SYS}" = "mingw32"], [
3827     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3828     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3829   dnl MacOS
3830   ], [test "${SYS}" = "darwin"], [
3831     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3832     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3833   dnl OS/2
3834   ], [test "${SYS}" = "os2"], [
3835     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3836   dnl Linux/Unix
3837   ], [
3838     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3839     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3840     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3841     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3842     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3843   ])
3845   dnl for All OSes
3846   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3848   dnl we need freetype
3849   AS_IF([test "${have_freetype}" != "yes"], [
3850     have_skins_deps="no"
3851   ])
3853   AS_IF([test "${have_skins_deps}" = "no"], [
3854     AS_IF([test "x${enable_skins2}" = "x"], [
3855       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3856     ], [
3857       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3858     ])
3859     enable_skins2="no"
3860   ], [
3861     VLC_ADD_PLUGIN([skins2])
3862     ALIASES="${ALIASES} svlc"
3863     enable_skins2="yes"
3864   ])
3866 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3868 AC_ARG_ENABLE(libtar,
3869   [  --enable-libtar         libtar support for skins2 (default auto)])
3870 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3871   AC_CHECK_HEADERS(libtar.h, [
3872     VLC_ADD_LIBS([skins2],[-ltar])
3873   ])
3877 dnl  MacOS X gui module
3879 AC_ARG_ENABLE(macosx,
3880   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3881 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3882 then
3883   VLC_ADD_PLUGIN([macosx])
3885   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3886   then
3887     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3888   fi
3890 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3893 dnl  MacOS X sparkle update support
3895 AC_ARG_ENABLE(sparkle,
3896   [  --enable-sparkle        Sparkle update support for OS X (default enabled on Mac OS X)])
3897 if test "x${enable_sparkle}" != "xno" -a "${HAVE_OSX}" = "1"
3898 then
3899   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3900   then
3901     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3902   fi
3904   AC_DEFINE([HAVE_SPARKLE], [1], [Define to 1 if sparkle is enabled.])
3906 AM_CONDITIONAL(HAVE_SPARKLE, [test "$enable_sparkle" != "no"])
3910 dnl  Minimal Mac OS X module
3912 AC_ARG_ENABLE(minimal-macosx,
3913   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3914 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3915 then
3916   VLC_ADD_PLUGIN([minimal_macosx])
3920 dnl  VideoToolbox plugins
3921 AC_CHECK_HEADERS(VideoToolbox/VideoToolbox.h, [
3922     VLC_ADD_PLUGIN([videotoolbox])
3923     VLC_ADD_PLUGIN([cvpx_i420])
3924   ])
3927 dnl  ncurses module
3929 AC_ARG_ENABLE(ncurses,
3930 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3931 have_ncurses="no"
3932 AS_IF([test "${enable_ncurses}" != "no"] ,[
3933   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3934     have_ncurses="yes"
3935     ALIASES="${ALIASES} nvlc"
3936   ], [
3937     AS_IF([test -n "${enable_ncurses}"], [
3938       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3939     ])
3940   ])
3942 AM_CONDITIONAL([HAVE_NCURSES], [test "${have_ncurses}" = "yes"])
3945 dnl  Lirc plugin
3947 AC_ARG_ENABLE(lirc,
3948   [  --enable-lirc           lirc support (default disabled)])
3949 have_lirc="no"
3950 AS_IF([test "${enable_lirc}" = "yes"], [
3951   AC_CHECK_HEADER(lirc/lirc_client.h, [
3952     AC_CHECK_LIB(lirc_client, lirc_init, [
3953       have_lirc="true"
3954     ])
3955   ])
3957 AM_CONDITIONAL([HAVE_LIRC], [test "${have_lirc}" = "yes"])
3959 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3961 dnl  goom visualization plugin
3963 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3966 dnl libprojectM visualization plugin
3968 AC_ARG_ENABLE(projectm,
3969   [  --enable-projectm       projectM visualization plugin (default enabled)])
3970 AS_IF([test "${enable_projectm}" != "no"],
3971   [
3972     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3973     [
3974       VLC_ADD_PLUGIN([projectm])
3975       PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
3976         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3977         [ AC_MSG_WARN( [Using libprojectM version 1] )
3978       ])
3979     ],[
3980       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3981     ])
3982   ])
3985 dnl Vovoid VSXu visualization plugin
3987 AC_ARG_ENABLE(vsxu,
3988   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3989 AS_IF([test "${enable_vsxu}" != "no"],
3990   [
3991     PKG_CHECK_MODULES(VSXU, libvsxu,
3992     [
3993       VLC_ADD_PLUGIN([vsxu])
3994     ],[
3995       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3996     ])
3997   ])
3999 EXTEND_HELP_STRING([Service Discovery plugins:])
4001 dnl  Avahi-Zeroconf services discovery
4002 PKG_ENABLE_MODULES_VLC([AVAHI], [], [avahi-client >= 0.6], [Zeroconf services discovery], [auto])
4005 dnl  libudev services discovery
4006 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
4009 dnl MTP devices services discovery
4010 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
4013 dnl UPnP Plugin (Intel SDK)
4015 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
4018 dnl mDNS using libmicrodns
4020 PKG_ENABLE_MODULES_VLC([MICRODNS], [], [microdns], [mDNS services discovery], [auto])
4023 EXTEND_HELP_STRING([Misc options:])
4026 dnl  libxml2 module
4028 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
4032 dnl libgcrypt
4034 AC_ARG_ENABLE(libgcrypt,
4035   [  --disable-libgcrypt     gcrypt support (default enabled)])
4036 AC_ARG_VAR([GCRYPT_CFLAGS], [C compiler flags for gcrypt])
4037 AC_ARG_VAR([GCRYPT_LIBS], [linker flags flags for gcrypt])
4039 # require libgcrypt >= 1.6.0
4040 AS_IF([test "${enable_libgcrypt}" != "no"], [
4041   AC_CACHE_CHECK([for gcrypt 1.6.0 or later], [ac_cv_lib_gcrypt], [
4042     VLC_SAVE_FLAGS
4043     CFLAGS="${CFLAGS} ${GCRYPT_CFLAGS}"
4044     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
4045 [#include <gcrypt.h>
4046 #if GCRYPT_VERSION_NUMBER < 0x010600
4047 #error
4048 #endif]])], [
4049       ac_cv_lib_gcrypt=yes
4050     ], [
4051       ac_cv_lib_gcrypt=no
4052     ])
4053     VLC_RESTORE_FLAGS
4054   ])
4056   AS_IF([test "${ac_cv_lib_gcrypt}" = "yes"], [
4057     AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
4058   ], [
4059     AS_IF([test "${enable_libgcrypt}" = "yes"], [
4060       AC_MSG_ERROR([libgcrypt version 1.6.0 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
4061     ])
4062   ])
4065 AS_IF([test -z "$GCRYPT_LIBS"], [
4066   GCRYPT_LIBS="-lgcrypt -lgpg-error"
4069 AC_SUBST(GCRYPT_CFLAGS)
4070 AC_SUBST(GCRYPT_LIBS)
4071 AM_CONDITIONAL([HAVE_GCRYPT], [test "${ac_cv_lib_gcrypt}" = "yes"])
4074 dnl TLS/SSL
4076 AC_ARG_ENABLE(gnutls,
4077   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4078 AS_IF([test "${enable_gnutls}" != "no"], [
4079   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.2.0], [
4080     VLC_ADD_PLUGIN([gnutls])
4081   ], [
4082     AS_IF([test -n "${enable_gnutls}"], [
4083       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4084     ])
4085   ])
4090 dnl Taglib plugin
4092 AC_ARG_ENABLE(taglib,
4093   [AS_HELP_STRING([--disable-taglib],
4094     [do not use TagLib (default enabled)])])
4095 AS_IF([test "${enable_taglib}" != "no"], [
4096   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.9, [
4097     VLC_ADD_PLUGIN([taglib])
4098   ], [
4099     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4103 dnl  libsecret
4105 PKG_ENABLE_MODULES_VLC([SECRET], [], [libsecret-1 >= 0.18], [use libsecret for keystore], [auto])
4108 dnl  Developers helper modules (should be hidden from configure help)
4110 AC_ARG_ENABLE(devtools, [], [], [enable_devtools="no"])
4111 AS_IF([test "${enable_devtools}" != "no"], [
4112   VLC_ADD_PLUGIN([accesstweaks])
4116 dnl update checking system
4118 AC_ARG_ENABLE(update-check,
4119   [  --enable-update-check   update checking system (default disabled)])
4120 if test "${enable_update_check}" = "yes"
4121 then
4122  AS_IF([test "${ac_cv_lib_gcrypt}" != "yes"],[
4123     AC_MSG_ERROR([libgcrypt is required for update checking system]) ])
4124   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4125   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4126   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4130 dnl OS X notification plugin
4132 AC_ARG_ENABLE(osx_notifications,
4133   [  --enable-osx-notifications          osx notification plugin (default disabled)],,
4134   [enable_osx_notifications=no])
4135 AS_IF([test "${enable_osx_notifications}" != "no"], [
4136     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4137       VLC_ADD_PLUGIN([osx_notifications])
4138       VLC_ADD_LIBS([osx_notifications], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4139       VLC_ADD_OBJCFLAGS([osx_notifications], [-F${CONTRIB_DIR}])
4140       VLC_ADD_OBJCFLAGS([osx_notifications], [-fobjc-exceptions] )
4141     ])
4142   ]
4146 dnl Libnotify notification plugin
4148 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4151 dnl  Endianness check
4153 AC_C_BIGENDIAN
4154 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4155   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4156 ], [
4157   DEFS_BIGENDIAN=""
4159 AC_SUBST(DEFS_BIGENDIAN)
4162 dnl Where to install KDE solid .desktop
4164 AC_ARG_WITH(kde-solid,
4165   AS_HELP_STRING([--with-kde-solid=PATH],
4166                  [KDE Solid actions directory (auto)]),, [
4168 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4169   with_kde_solid="yes"
4172 soliddatadir=""
4173 AS_IF([test "${with_kde_solid}" != "no"], [
4174   AS_IF([test "${with_kde_solid}" = "yes"], [
4175     kde4datadir="`${KDE4_CONFIG} --install data`"
4176     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4177     soliddatadir="${kde4datadir}/solid/actions"
4178   ], [
4179     soliddatadir="${with_kde_solid}"
4180   ])
4182 AC_SUBST(soliddatadir)
4183 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4185 EXTEND_HELP_STRING([Components:])
4188 dnl  the VLC binary
4190 AC_ARG_ENABLE(vlc,
4191   [  --enable-vlc            build the VLC media player (default enabled)])
4192 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4194 AC_ARG_ENABLE(macosx-vlc-app,
4195   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4196 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4197     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4200 dnl  Stuff used by the program
4202 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4203 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4204 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4205 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4206 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4207 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4208 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4209 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4210 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4211 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4212 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4213 AC_SUBST(COPYRIGHT_MESSAGE)
4214 AC_SUBST(VERSION_MESSAGE)
4215 AC_SUBST(VERSION_MAJOR)
4216 AC_SUBST(VERSION_MINOR)
4217 AC_SUBST(VERSION_REVISION)
4218 AC_SUBST(VERSION_EXTRA)
4219 AC_SUBST(COPYRIGHT_YEARS)
4220 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4221 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4222 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4224 dnl  Handle substvars that use $(top_srcdir)
4226 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4229 dnl  Configuration is finished
4231 AC_SUBST(SYS)
4232 AC_SUBST(ARCH)
4233 AC_SUBST(ALIASES)
4234 AC_SUBST(ASM)
4235 AC_SUBST(MOC)
4236 AC_SUBST(RCC)
4237 AC_SUBST(UIC)
4238 AC_SUBST(WINDRES)
4239 AC_SUBST(WINE_SDK_PATH)
4240 AC_SUBST(LIBEXT)
4241 AC_SUBST(AM_CPPFLAGS)
4242 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4243 AC_SUBST(FILE_LIBVLCCORE_DLL)
4244 AC_SUBST(FILE_LIBVLC_DLL)
4246 AC_CONFIG_FILES([
4247   Makefile
4248   doc/Makefile
4249   modules/Makefile
4250   m4/Makefile
4251   po/Makefile.in
4252   share/Makefile
4253   compat/Makefile
4254   src/Makefile
4255   lib/Makefile
4256   bin/Makefile
4257   test/Makefile
4258   modules/gui/macosx/Makefile
4259   modules/gui/qt/Makefile
4260   modules/gui/skins2/Makefile
4261   modules/hw/mmal/Makefile
4262   share/vlc.appdata.xml.in
4265 AM_COND_IF([HAVE_WIN32], [
4266   AC_CONFIG_FILES([
4267     extras/package/win32/NSIS/spad.nsi
4268     extras/package/win32/NSIS/vlc.win32.nsi
4269     extras/package/win32/msi/config.wxi
4270   ])
4273 AM_COND_IF([HAVE_DARWIN], [
4274   AC_CONFIG_FILES([
4275     extras/package/macosx/Info.plist
4276     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4277   ])
4280 dnl Generate makefiles
4281 AC_OUTPUT
4283 dnl Do we have to use make or gmake ?
4284 if make --version 2>&1|grep -q GNU
4285 then
4286     # GNU make, all seems good
4287     MAKE=make
4288 else
4289     # Known GNU make alias (on BSD)
4290     MAKE=gmake
4292 dnl Shortcut to nice compile message
4293 if test -n $SHELL; then
4294   SHELL=${CONFIG_SHELL-/bin/sh}
4296 rm -f compile
4297 compile_top_srcdir=`sed -ne "s/^top_srcdir *= *//p" < Makefile`
4298 echo "#! $SHELL
4299 rm -f .error\$\$
4300 ERROR=0
4301 export PATH=\"$PATH\" LANG=C
4302 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| $compile_top_srcdir/extras/buildsystem/make.pl
4303 test -f .error\$\$ && ERROR=1
4304 rm -f .error\$\$
4305 exit \$ERROR" >compile
4306 chmod a+x compile
4308 echo "
4309 libvlc configuration
4310 --------------------
4311 version               : ${VERSION}
4312 system                : ${SYS}
4313 architecture          : ${ARCH}
4314 optimizations         : ${enable_optimizations}"
4315 if test "${enable_vlc}" != "no"; then
4316 echo "vlc aliases           :${ALIASES}"
4317 else
4318 echo "build vlc executable  : no"
4320 echo "
4321 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."