configure: fix gcrypt test
[vlc.git] / configure.ac
blob8d10cc64b66b032af5286a4c08feee51bb1d0250
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)
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 "${SYS}" = "darwin"], [
440     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
441     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
442   ])
443 ], [
444   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
445     AC_MSG_ERROR([Third party libraries not found!])
446   ])
448 AC_SUBST(CONTRIB_DIR)
450 dnl Add extras/tools to the PATH
451 TOOLS_DIR="${srcdir}/extras/tools/build/bin"
452 AS_IF([test -d "${TOOLS_DIR}"], [
453     TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
454     export PATH="${TOOLS_DIR}":$PATH
458 dnl  Libtool
459 dnl  It's very bad, but our former custom system was worst
460 dnl  -- Courmisch
463 dnl override platform specific check for dependent libraries
464 dnl otherwise libtool linking of shared libraries will
465 dnl fail on anything other than pass_all.
466 AC_CACHE_VAL(lt_cv_deplibs_check_method,
467     [lt_cv_deplibs_check_method=pass_all])
469 LT_INIT([dlopen win32-dll shared disable-static])
470 LT_LANG([C++])
471 LT_LANG([Windows Resource])
473 DOLT
475 lt_cv_deplibs_check_method=pass_all
477 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
478   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
482 dnl Gettext stuff
484 AM_GNU_GETTEXT_VERSION([0.19.6])
485 AM_GNU_GETTEXT([external], [need-formatstring-macros])
488 dnl Iconv stuff
490 AM_ICONV
493 dnl checks for mingw
494 AS_IF([test "${SYS}" = "mingw32"], [
496 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
497 #if !defined(__MINGW32__)
498 # error Not compiling with mingw
499 #endif
500     ])], [
502 dnl Check for broken versions of mingw-runtime compatability library
503     AC_MSG_CHECKING(for broken mingw-runtime)
504     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
505 #include <_mingw.h>
506 #if defined(__MINGW64_VERSION_MAJOR)
507 # if __MINGW64_VERSION_MAJOR < 3
508 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
509 # endif
510 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
511 # error Attempting to use mingw-runtime with broken vsnprintf support
512 #endif
513     ])], [
514         AC_MSG_RESULT([ok])
515     ], [
516         AC_MSG_RESULT([present])
517         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
518     ])
520     dnl force use of mingw provided c99 *printf over msvcrt
521     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
523     dnl Add WinMainCRTStartup entry point to show it's a WinMain application
524     VLC_ADD_LDFLAGS([vlc],[-mwindows])
526     dnl Check for the need to include the mingwex lib for mingw32
527     VLC_SAVE_FLAGS
528     AC_CHECK_LIB(mingwex,opendir,
529         AC_CHECK_LIB(mingw32,opendir,,
530             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
531     )
532     VLC_RESTORE_FLAGS
533     ], [
534         AC_MSG_RESULT([Not compiling with mingw])
535     ])
537     dnl Check for fnative-struct or mms-bitfields support for mingw32
538     VLC_SAVE_FLAGS
539     CFLAGS="${CFLAGS} -mms-bitfields"
540     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
541     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
542         [ac_cv_c_mms_bitfields],
543         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
544     if test "${ac_cv_c_mms_bitfields}" = "no"; then
545         VLC_RESTORE_FLAGS
546         CFLAGS="${CFLAGS} -fnative-struct"
547         CXXFLAGS="${CXXFLAGS} -fnative-struct"
548         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
549             [ac_cv_c_fnative_struct],
550             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
551         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
552     fi
557 dnl Buggy glibc prevention. Purposedly not cached.
558 dnl See sourceware.org bugs 5058 and 5443.
559 dnl Ubuntu alone has 20 bug numbers for this...
561 AC_MSG_CHECKING(for buggy GNU/libc versions)
562 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
563 #include <limits.h>
564 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
565   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
566 # error GNU/libc with dcgettext killer bug!
567 #endif
568 ])], [
569   AC_MSG_RESULT([not present])
570 ], [
571   AC_MSG_RESULT([found])
572   AS_IF([test "x${enable_nls}" != "xno"], [
573     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
574 work-around for this. Check with your distribution vendor on how to update the
575 glibc run-time. Alternatively, build with --disable-nls.])
576   ])
579 dnl Plugin compilation stuff
581 VLC_LIBRARY_SUFFIX
583 dnl Check for system libs needed
584 need_libc=false
586 dnl Check for usual libc functions
587 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
588 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])
589 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])
590 AC_REPLACE_FUNCS([gettimeofday])
591 AC_CHECK_FUNCS(fdatasync,,
592   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
595 dnl mingw64 implements those as static inline, not functions with C linkage
596 VLC_REPLACE_DECL([asprintf], [#include <stdio.h>])
597 VLC_REPLACE_DECL([vasprintf], [#include <stdio.h>])
598 VLC_REPLACE_DECL([gmtime_r], [#include <time.h>])
599 VLC_REPLACE_DECL([localtime_r], [#include <time.h>])
601 dnl C11 static_assert()
602 AC_MSG_CHECKING([for static_assert in assert.h])
603 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
604 static_assert(1, "The impossible happened.");
605 ])], [
606   AC_MSG_RESULT([yes])
607   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
608 ], [
609   AC_MSG_RESULT([no])
612 # Windows CE does not have strcoll()
613 AC_FUNC_STRCOLL
615 dnl Check for non-standard system calls
616 case "$SYS" in
617   "linux")
618     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity recvmmsg])
619     ;;
620   "mingw32")
621     AC_CHECK_FUNCS([_lock_file])
622     ;;
623 esac
625 AH_BOTTOM([#include <vlc_fixups.h>])
627 dnl Check for struct pollfd
628 AC_CHECK_TYPES([struct pollfd],,,
629 [#include <sys/types.h>
630 #if HAVE_POLL
631 # include <poll.h>
632 #elif defined (_WIN32)
633 # include <winsock2.h>
634 #endif
637 dnl Check for struct timespec
638 AC_CHECK_TYPES([struct timespec],,,
639 [#include <time.h>])
641 dnl Checks for socket stuff
642 VLC_SAVE_FLAGS
643 SOCKET_LIBS=""
644 AC_SEARCH_LIBS(connect, [socket], [
645   AS_IF([test "$ac_cv_search_connect" != "none required"], [
646     SOCKET_LIBS="$ac_cv_search_connect"
647   ])
648 ], [
649   AS_IF([test "${SYS}" = "mingw32"], [
650     SOCKET_LIBS="-lws2_32"
651   ])
654 AC_SEARCH_LIBS([inet_pton], [nsl], [
655  AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [
656     SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS"
657   ])
658 ],, [${SOCKET_LIBS}])
660 LIBS="${LIBS} ${SOCKET_LIBS}"
661 AC_LINK_IFELSE([
662     AC_LANG_PROGRAM([#ifdef _WIN32
663         # if _WIN32_WINNT < 0x600
664         #  error Needs vista+
665         # endif
666         #include <ws2tcpip.h>
667         #else
668         #include <sys/socket.h>
669         #include <arpa/inet.h>
670         #endif], [
671         char dst[[sizeof(struct in_addr)]];
672         inet_pton(AF_INET, "127.0.0.1", dst);
673     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
674 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
675 VLC_RESTORE_FLAGS
676 AC_SUBST(SOCKET_LIBS)
678 dnl Check for socklen_t
679 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
680 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
681 ac_cv_type_socklen_t,
682 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
683 [#include <sys/types.h>
684 #ifdef _WIN32
685 # include <winsock2.h>
686 # include <ws2tcpip.h>
687 #else
688 # include <sys/socket.h>
689 #endif]], [[socklen_t len; len = 0;]])],
690 ac_cv_type_socklen_t=yes,
691 ac_cv_type_socklen_t=no)])
692 AS_IF([test "$ac_cv_type_socklen_t" = no],
693  [AC_DEFINE(socklen_t, int)])
695 dnl Check for struct sockaddr_storage
696 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
697 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
698 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
699   [AC_TRY_COMPILE(
700     [#include <sys/types.h>
701      #if defined( _WIN32 )
702      # include <winsock2.h>
703      #else
704      # include <sys/socket.h>
705      #endif], [struct sockaddr_storage addr;],
706      ac_cv_struct_sockaddr_storage=yes,
707      ac_cv_struct_sockaddr_storage=no)])
708 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
709   AC_DEFINE(sockaddr_storage, sockaddr)
710   AC_DEFINE(ss_family, sa_family)
713 dnl FreeBSD has a gnugetopt library for this:
714 GNUGETOPT_LIBS=""
715 AC_CHECK_FUNC(getopt_long,, [
716   AC_CHECK_LIB([gnugetopt],[getopt_long], [
717     GNUGETOPT_LIBS="-lgnugetopt"
718   ])
720 AC_SUBST(GNUGETOPT_LIBS)
722 AC_CHECK_LIB(m,cos,[
723   LIBM="-lm"
724 ], [
725   LIBM=""
727 AC_SUBST(LIBM)
729 AC_CHECK_LIB(m,lrintf, [
730   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
731   VLC_ADD_LIBS([skins2],[-lm])
733 AC_CHECK_LIB(m,nanf,
734   AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
737 dnl Check for dynamic plugins
738 LIBDL=""
739 have_dynamic_objects="no"
740 VLC_SAVE_FLAGS
741 AC_SEARCH_LIBS(dlsym, [dl svld], [
742   AS_IF([test "$ac_cv_search_dlsym" != "none required"], [
743     LIBDL="$ac_cv_search_dlsym"
744   ])
745   have_dynamic_objects="yes"
747 VLC_RESTORE_FLAGS
749 # Windows
750 AS_IF([test "${SYS}" = "mingw32"], [
751   LIBDL=""
752   have_dynamic_objects="yes" #assume we can use shared objects
755 AS_IF([test "${enable_shared}" = "no"], [
756   have_dynamic_objects=no
758 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
760 AC_SUBST(LIBDL)
762 dnl Check for thread library
763 LIBPTHREAD=""
764 AS_IF([test "${SYS}" != "mingw32"], [
765   VLC_SAVE_FLAGS
766   LIBS=""
767   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
768     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
769       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
770     ])
771   ])
772   VLC_RESTORE_FLAGS
774 AC_SUBST(LIBPTHREAD)
776 AC_SEARCH_LIBS([clock_nanosleep], [rt pthread], [
777   AS_IF([test "$ac_cv_search_clock_nanosleep" != "none required"], [
778     LIBRT="$ac_cv_search_clock_nanosleep"
779   ])
780 ], [
781   AC_SEARCH_LIBS([nanosleep], [rt pthread posix4], [
782     AS_IF([test "$ac_cv_search_nanosleep" != "none required"], [
783       LIBRT="$ac_cv_search_nanosleep"
784     ])
785   ])
787 AC_SUBST(LIBRT)
790 dnl Check for headers
793 dnl  POSIX
794 AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/shm.h sys/socket.h sys/uio.h])
795 AC_CHECK_HEADERS([net/if.h], [], [],
797 #include <sys/types.h>
798 #include <sys/socket.h>
800 AC_CHECK_HEADER([syslog.h], [have_syslog="yes"], [have_syslog="no"])
801 AM_CONDITIONAL([HAVE_SYSLOG], [test "$have_syslog" = "yes"])
803 dnl  BSD
804 AC_CHECK_HEADERS([netinet/udplite.h sys/param.h sys/mount.h])
806 dnl  GNU/Linux
807 AC_CHECK_HEADERS([features.h getopt.h linux/dccp.h linux/magic.h mntent.h sys/eventfd.h])
809 dnl  MacOS
810 AC_CHECK_HEADERS([xlocale.h])
812 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
813 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
814 AC_CHECK_TYPE(ssize_t,, [
815   AC_DEFINE(ssize_t, int)
818 dnl It seems that autoconf detects pkg-config only during the first
819 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
820 dnl it is nested within a conditional block, so it was not working right.
821 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
822 AC_ARG_VAR(PKG_CONFIG_PATH,
823        [Paths where to find .pc not at the default location])
824 PKG_PROG_PKG_CONFIG()
826 dnl On some OS we need static linking
827 AS_IF([test -n "${PKG_CONFIG}" ],[
828     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
829         PKG_CONFIG="${PKG_CONFIG} --static"
830     ])
835 dnl Check for zlib.h and -lz along with system -lminizip if available
837 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
838 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
839 if test "${have_zlib}" = "yes"
840 then
841   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
842   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
843     AC_CHECK_HEADERS([unzip.h], [
844       have_minizip=yes
845       MINIZIP_LIBS="-lminizip -lz"
846     ], [
847       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
848       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
849       have_minizip=no
850     ])
851   ])
852   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
853   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
855 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
859 dnl Domain name i18n support via GNU libidn
861 PKG_CHECK_MODULES([IDN], [libidn], [
862   have_libidn="yes"
863   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
864 ], [
865   have_libidn="no"
869 dnl Check for dbus
870 AC_ARG_ENABLE(dbus,
871   [AS_HELP_STRING([--enable-dbus],
872     [compile D-Bus message bus support (default enabled)])])
873 have_dbus="no"
874 AS_IF([test "${enable_dbus}" != "no"], [
875   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
876     have_dbus="yes"
877   ], [
878     AS_IF([test -n "${enable_dbus}"], [
879       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
880     ], [
881       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
882     ])
883   ])
885 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
888 dnl Check for systemd
889 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
890   have_systemd="yes"
891 ], [
892   AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
894 AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
897 dnl Check for ntohl, etc.
898 VLC_SAVE_FLAGS
899 CFLAGS="${CFLAGS} -Wall -Werror"
900 AC_CACHE_CHECK([for ntohl in sys/param.h],
901     [ac_cv_c_ntohl_sys_param_h],
902     [     AC_TRY_COMPILE([#include <sys/param.h>],
903         [int meuh; ntohl(meuh);],
904         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
905 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
906     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
908 VLC_RESTORE_FLAGS
910 EXTEND_HELP_STRING([Optimization options:])
912 dnl  Compiler warnings
915 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])
916 RDC_PROG_CC_FLAGS([-pipe])
917 AC_LANG_PUSH([C++])
918 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var format-security])
919 AC_LANG_POP([C++])
922 dnl  Debugging mode
924 AC_ARG_ENABLE(debug,
925   [AS_HELP_STRING([--enable-debug],
926     [build with run-time assertions (default disabled)])],,
927   [enable_debug="no"])
928 AH_TEMPLATE(NDEBUG,
929             [Define to 1 if debug code should NOT be compiled])
930 AS_IF([test "${enable_debug}" != "no"], [
931   AC_CHECK_HEADERS([valgrind/valgrind.h])
932 ], [
933   AC_DEFINE(NDEBUG)
937 dnl  Profiling
939 AC_ARG_ENABLE(gprof,
940   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
941   [enable_gprof="no"])
942 AS_IF([test "${enable_gprof}" != "no"], [
943   CFLAGS="${CFLAGS} -pg"
944   CXXFLAGS="${CXXFLAGS} -pg"
945   OBJCFLAGS="${OBJCFLAGS} -pg"
946   LDFLAGS="${LDFLAGS} -pg"
949 AC_ARG_ENABLE(cprof,
950   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
951   [enable_cprof="no"])
952 AS_IF([test "${enable_gprof}" != "no"], [
953   CFLAGS="${CFLAGS} -finstrument-functions"
954   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
955   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
956   LDFLAGS="${LDFLAGS} -finstrument-functions"
960 dnl  Test coverage
962 AC_ARG_ENABLE(coverage,
963   [AS_HELP_STRING([--enable-coverage],
964     [build for test coverage (default disabled)])],,
965   [enable_coverage="no"])
966 AS_IF([test "${enable_coverage}" != "no"], [
967   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
968   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
969   LDFLAGS="-lgcov ${LDFLAGS}"
972 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
973   VLC_SAVE_FLAGS
974   CFLAGS="${CFLAGS} -fvisibility=hidden"
975   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
976   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
977   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
978                  [ac_cv_c_visibility_hidden], [
979     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
980       ac_cv_c_visibility_hidden=yes
981     ], [
982       ac_cv_c_visibility_hidden=no
983     ])
984   ])
985   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
990 dnl  Enable/disable optimizations
992 AC_ARG_ENABLE(optimizations,
993   [AS_HELP_STRING([--disable-optimizations],
994     [disable compiler optimizations (default enabled)])],,
995   [enable_optimizations="yes"])
997 dnl Check for various optimization flags
998 AS_IF([test "${enable_optimizations}" != "no"], [
1000   dnl -O3 only in production builds
1001   AS_IF([test "${enable_debug}" = "no"], [
1002     VLC_SAVE_FLAGS
1003     CFLAGS="${CFLAGS} -O3"
1004     CXXFLAGS="${CXXFLAGS} -O3"
1005     OBJCFLAGS="${OBJCFLAGS} -O3"
1006     AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
1007       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1008         ac_cv_c_o3=yes
1009       ], [
1010         ac_cv_c_o3=no
1011       ])
1012     ])
1013     AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
1014   ])
1016   dnl Check for fast maths
1017   RDC_PROG_CC_FFLAGS([no-math-errno unsafe-math-optimizations no-rounding-math no-signaling-nans cx-limited-range])
1018   AC_LANG_PUSH(C++)
1019   RDC_PROG_CXX_FFLAGS([no-math-errno unsafe-math-optimizations no-rounding-math no-signaling-nans cx-limited-range])
1020   AC_LANG_POP
1022 AH_BOTTOM([
1023 #if defined(_MSC_VER) && !defined(__clang__)
1024 # pragma fenv_access(off)
1025 # pragma fp_contract(on)
1026 #elif defined(__GNUC__)
1027 /* Not supported so far */
1028 #else
1029 # pragma STDC FENV_ACCESS OFF
1030 # pragma STDC FP_CONTRACT ON
1031 #endif
1034   dnl Check for -funroll-loops
1035   VLC_SAVE_FLAGS
1036   CFLAGS="${CFLAGS} -funroll-loops"
1037   CXXFLAGS="${CXXFLAGS} -funroll-loops"
1038   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
1039   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
1040     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1041       ac_cv_c_unroll_loops=yes
1042     ], [
1043       ac_cv_c_unroll_loops=no
1044     ])
1045   ])
1046   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
1048   AS_IF([test "$enable_debug" = "no"], [
1049     dnl Check for -fomit-frame-pointer
1050     VLC_SAVE_FLAGS
1051     CFLAGS="${CFLAGS} -fomit-frame-pointer"
1052     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
1053     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
1054     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
1055       [ac_cv_c_omit_frame_pointer], [
1056       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1057         ac_cv_c_omit_frame_pointer=yes
1058       ], [
1059         ac_cv_c_omit_frame_pointer=no
1060       ])
1061     ])
1062     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1063   ])
1066 VLC_SAVE_FLAGS
1067 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1068 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1069   AC_TRY_LINK([],, [
1070     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1071   ], [
1072     ac_cv_ld_bsymbolic=""
1073   ])
1075 VLC_RESTORE_FLAGS
1076 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1077 AC_SUBST(SYMBOLIC_LDFLAGS)
1079 dnl Checks for __attribute__(aligned()) directive
1080 VLC_SAVE_FLAGS
1081 CFLAGS="${CFLAGS} -Werror"
1082 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1083     [ac_cv_c_attribute_aligned],
1084     [ac_cv_c_attribute_aligned=0
1085     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1086         AC_TRY_COMPILE([],
1087         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1088         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1089     done])
1090 VLC_RESTORE_FLAGS
1091 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1092     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1093         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1096 dnl Check for __attribute__((packed))
1097 AC_CACHE_CHECK([for __attribute__((packed))],
1098   [ac_cv_c_attribute_packed],
1099   [ac_cv_c_attribute_packed=no
1100    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1101                     [ac_cv_c_attribute_packed=yes])])
1102 if test "${ac_cv_c_attribute_packed}" != "no"; then
1103   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1107 dnl  Check the CPU
1109 case "${host_cpu}" in
1110   "")
1111     ARCH=unknown
1112     ;;
1113   *)
1114     ARCH="${host_cpu}"
1115     ;;
1116 esac
1118 dnl Check for backtrace() support
1119 AC_CHECK_HEADERS(execinfo.h)
1120 AC_CHECK_FUNCS(backtrace)
1123 dnl  default modules
1125 ALIASES="${ALIASES} cvlc rvlc"
1128 dnl  Accelerated modules
1131 dnl  Check for fully working MMX intrinsics
1132 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1133 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1134 AC_ARG_ENABLE(mmx,
1135   [AS_HELP_STRING([--disable-mmx],
1136     [disable MMX optimizations (default auto)])],,[
1137   case "${host_cpu}" in
1138     i?86|x86_64)
1139       enable_mmx="yes"
1140       ;;
1141     *)
1142       enable_mmx="no"
1143       ;;
1144   esac
1146 have_mmx="no"
1147 have_mmxext="no"
1148 AS_IF([test "${enable_mmx}" != "no"], [
1149   ARCH="${ARCH} mmx"
1150   VLC_SAVE_FLAGS
1151   CFLAGS="${CFLAGS} -mmmx"
1152   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1153     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1154 [#include <mmintrin.h>
1155 #include <stdint.h>
1156 uint64_t frobzor;]], [
1157 [__m64 a, b, c;
1158 a = b = c = (__m64)frobzor;
1159 a = _mm_slli_pi16(a, 3);
1160 a = _mm_adds_pi16(a, b);
1161 c = _mm_srli_pi16(c, 8);
1162 c = _mm_slli_pi16(c, 3);
1163 b = _mm_adds_pi16(b, c);
1164 a = _mm_unpacklo_pi8(a, b);
1165 frobzor = (uint64_t)a;]])], [
1166       ac_cv_c_mmx_intrinsics=yes
1167     ], [
1168       ac_cv_c_mmx_intrinsics=no
1169     ])
1170   ])
1171   VLC_RESTORE_FLAGS
1172   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1173     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1174   ])
1176   VLC_SAVE_FLAGS
1177   CFLAGS="${CFLAGS} -mmmx"
1178   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1179     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1180 void *p;
1181 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1183     ], [
1184       ac_cv_mmx_inline=yes
1185     ], [
1186       ac_cv_mmx_inline=no
1187     ])
1188   ])
1189   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1190     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1191     have_mmx="yes"
1192   ])
1194   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1195                  [ac_cv_mmxext_inline], [
1196     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1197 void *p;
1198 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1200     ], [
1201       ac_cv_mmxext_inline=yes
1202     ], [
1203       ac_cv_mmxext_inline=no
1204     ])
1205   ])
1206   VLC_RESTORE_FLAGS
1207   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1208     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1209     have_mmxext="yes"
1210   ])
1212 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1213 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1215 dnl  Check for fully workin SSE2 intrinsics
1216 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1217 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1218 AC_ARG_ENABLE(sse,
1219   [AS_HELP_STRING([--disable-sse],
1220     [disable SSE (1-4) optimizations (default auto)])],, [
1221   case "${host_cpu}" in
1222     i?86|x86_64)
1223       enable_sse=yes
1224       ;;
1225     *)
1226       enable_sse=no
1227       ;;
1228   esac
1230 have_sse2="no"
1231 AS_IF([test "${enable_sse}" != "no"], [
1232   ARCH="${ARCH} sse sse2"
1234   VLC_SAVE_FLAGS
1235   CFLAGS="${CFLAGS} -msse2"
1236   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1237     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1238 [#include <emmintrin.h>
1239 #include <stdint.h>
1240 uint64_t frobzor;]], [
1241 [__m128i a, b, c;
1242 a = b = c = _mm_set1_epi64((__m64)frobzor);
1243 a = _mm_slli_epi16(a, 3);
1244 a = _mm_adds_epi16(a, b);
1245 c = _mm_srli_epi16(c, 8);
1246 c = _mm_slli_epi16(c, 3);
1247 b = _mm_adds_epi16(b, c);
1248 a = _mm_unpacklo_epi8(a, b);
1249 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1250       ac_cv_c_sse2_intrinsics=yes
1251     ], [
1252       ac_cv_c_sse2_intrinsics=no
1253     ])
1254   ])
1255   VLC_RESTORE_FLAGS
1256   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1257     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1258   ])
1260   VLC_SAVE_FLAGS
1261   CFLAGS="${CFLAGS} -msse"
1262   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1263     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1264 void *p;
1265 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1267     ], [
1268       ac_cv_sse_inline=yes
1269     ], [
1270       ac_cv_sse_inline=no
1271     ])
1272   ])
1274   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1275     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1276   ])
1278   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1279     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1280 void *p;
1281 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1283     ], [
1284       ac_cv_sse2_inline=yes
1285     ], [
1286       ac_cv_sse2_inline=no
1287     ])
1288   ])
1289   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1290     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1291     have_sse2="yes"
1292   ])
1294   # SSE3
1295   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1296     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1297 void *p;
1298 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1300     ], [
1301       ac_cv_sse3_inline=yes
1302     ], [
1303       ac_cv_sse3_inline=no
1304     ])
1305   ])
1307   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1308     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1309   # SSSE3
1310   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1311     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1312 void *p;
1313 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1315     ], [
1316       ac_cv_ssse3_inline=yes
1317     ], [
1318       ac_cv_ssse3_inline=no
1319     ])
1320   ])
1322   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1323     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1325   # SSE4.1
1326   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1327                  [ac_cv_sse4_1_inline], [
1328     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1329 void *p;
1330 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1332     ], [
1333       ac_cv_sse4_1_inline=yes
1334     ], [
1335       ac_cv_sse4_1_inline=no
1336     ])
1337   ])
1339   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1340     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1342   # SSE4.2
1343   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1344                  [ac_cv_sse4_2_inline], [
1345     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1346 void *p;
1347 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1349     ], [
1350       ac_cv_sse4_2_inline=yes
1351     ], [
1352       ac_cv_sse4_2_inline=no
1353     ])
1354   ])
1356   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1357     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1359   # SSE4A
1360   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1361     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1362 void *p;
1363 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1365     ], [
1366       ac_cv_sse4a_inline=yes
1367     ], [
1368       ac_cv_sse4a_inline=no
1369     ])
1370   ])
1371   VLC_RESTORE_FLAGS
1372   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1373     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1375 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1377 VLC_SAVE_FLAGS
1378 CFLAGS="${CFLAGS} -mmmx"
1379 have_3dnow="no"
1380 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1381   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1382 void *p;
1383 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1385   ], [
1386     ac_cv_3dnow_inline=yes
1387   ], [
1388     ac_cv_3dnow_inline=no
1389   ])
1391 VLC_RESTORE_FLAGS
1392 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1393   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1394             [Define to 1 if 3D Now! inline assembly is available.])
1395   have_3dnow="yes"
1397 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1400 AC_ARG_ENABLE(neon,
1401   [AS_HELP_STRING([--disable-neon],
1402     [disable NEON optimizations (default auto)])],, [
1403   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1405 AS_IF([test "${enable_neon}" != "no"], [
1406   VLC_SAVE_FLAGS
1407   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1408   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1409     AC_COMPILE_IFELSE([
1410       AC_LANG_PROGRAM(,[[
1411 asm volatile("vqmovun.s64 d0, q1":::"d0");
1413     ], [
1414       ac_cv_arm_neon="yes"
1415     ], [
1416       ac_cv_arm_neon="no"
1417     ])
1418   ])
1419   VLC_RESTORE_FLAGS
1421 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1424 AC_ARG_ENABLE(altivec,
1425   [AS_HELP_STRING([--disable-altivec],
1426     [disable AltiVec optimizations (default auto)])],, [
1427   AS_CASE("${host_cpu}", [powerpc*],
1428         [enable_altivec=yes], [enable_altivec=no])
1430 have_altivec="no"
1431 ALTIVEC_CFLAGS=""
1432 AS_IF([test "${enable_altivec}" = "yes"], [
1433   ARCH="${ARCH} altivec";
1434   VLC_SAVE_FLAGS
1435   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1436     [ac_cv_altivec_inline],
1437     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1438          ac_cv_altivec_inline="yes",
1439          [CFLAGS="${CFLAGS} -Wa,-maltivec"
1440           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1441             [ac_cv_altivec_inline="-Wa,-maltivec"],
1442             ac_cv_altivec_inline=no)
1443          ])])
1444   VLC_RESTORE_FLAGS
1445   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1446     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1447               [Define to 1 if AltiVec inline assembly is available.])
1448     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1449       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1450       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1451     ])
1452     have_altivec="yes"
1453   ])
1455   VLC_SAVE_FLAGS
1456   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1457   [ac_cv_c_altivec], [
1458     CFLAGS="${CFLAGS} -maltivec"
1459     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1460 [#include <altivec.h>]], [
1461 [vec_ld(0, (unsigned char *)0);]])], [
1462       ac_cv_c_altivec="-maltivec"
1463     ], [
1464       ac_cv_c_altivec="no"
1465     ])
1466   ])
1467   VLC_RESTORE_FLAGS
1468   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1469     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1470     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1471     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1472     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1473     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1474     have_altivec="yes"
1475   ])
1476   AC_CHECK_HEADERS(altivec.h)
1478   VLC_SAVE_FLAGS
1479   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1480   AC_CACHE_CHECK([if linker needs -framework vecLib],
1481     [ac_cv_ld_altivec],
1482     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1483   VLC_RESTORE_FLAGS
1484   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1485     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1486   ])
1488 AC_SUBST(ALTIVEC_CFLAGS)
1489 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1492 dnl  Memory usage
1494 AC_ARG_ENABLE(optimize-memory,
1495   [AS_HELP_STRING([--enable-optimize-memory],
1496     [optimize memory usage over performance])])
1497 if test "${enable_optimize_memory}" = "yes"; then
1498   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1502 dnl Allow running as root (useful for people running on embedded platforms)
1504 AC_ARG_ENABLE(run-as-root,
1505   [AS_HELP_STRING([--enable-run-as-root],
1506     [allow running VLC as root (default disabled)])])
1507 AS_IF([test "${enable_run_as_root}" = "yes"],[
1508     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1509               [Define to 1 to allow running VLC as root (uid 0).])
1513 dnl Stream output
1515 AC_ARG_ENABLE(sout,
1516   [AS_HELP_STRING([--disable-sout],
1517     [disable streaming output (default enabled)])])
1518 AS_IF([test "${enable_sout}" != "no"], [
1519   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1521 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1523 dnl Lua modules
1524 AC_ARG_ENABLE(lua,
1525   [AS_HELP_STRING([--disable-lua],
1526     [disable LUA scripting support (default enabled)])])
1527 if test "${enable_lua}" != "no"
1528 then
1529   PKG_CHECK_MODULES(LUA, lua5.2,
1530     [ have_lua=yes ],
1531     [
1532     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1534     PKG_CHECK_MODULES(LUA, lua5.1,
1535       [ have_lua=yes ],
1536       [
1537       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1538       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1539         [ have_lua=yes ],
1540         [
1541           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1542           have_lua=yes
1543           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1544             [],
1545             [ have_lua=no ] )
1546           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1547             [LUA_LIBS="-llua5.2"],
1548           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1549             [LUA_LIBS="-llua5.1"],
1550             AC_CHECK_LIB( lua51 , luaL_newstate,
1551               [LUA_LIBS="-llua51"],
1552               AC_CHECK_LIB( lua , luaL_newstate,
1553                 [LUA_LIBS="-llua"],
1554                 [ have_lua=no
1555                 ], [-lm])
1556             )))
1557         ])
1558       ])
1559     ])
1560   if test "x${have_lua}" != "xyes" ;  then
1561       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.])
1562   fi
1563   AC_ARG_VAR([LUAC], [LUA byte compiler])
1564   AC_CHECK_PROGS(LUAC, [${LUAC} luac], [false])
1565   AS_IF([test "${LUAC}" = "false"], [
1566     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1567   ])
1568   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], [
1569     AC_MSG_ERROR([You need 32-bits luac when using lua from contrib.])
1570   ])
1572 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1576 dnl HTTP daemon
1578 AC_ARG_ENABLE(httpd,
1579   [AS_HELP_STRING([--disable-httpd],
1580     [disable the built-in HTTP server (default enabled)])])
1581 if test "${enable_httpd}" != "no"
1582 then
1583   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1585 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1589 dnl VideoLAN manager
1591 AC_ARG_ENABLE(vlm,
1592   [AS_HELP_STRING([--disable-vlm],
1593     [disable the stream manager (default enabled)])],,
1594   [enable_vlm="${enable_sout}"])
1595 AS_IF([test "${enable_vlm}" != "no"], [
1596   AS_IF([test "${enable_sout}" = "no"], [
1597     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1598   ])
1599   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1601 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1605 dnl Addons manager storage and repositories modules
1607 AC_ARG_ENABLE(addonmanagermodules,
1608   [AS_HELP_STRING([--disable-addonmanagermodules],
1609     [disable the addons manager modules (default enabled)])])
1610 if test "${enable_addonmanagermodules}" != "no"
1611 then
1612   AC_DEFINE(ENABLE_ADDONMANAGERMODULES, 1, [Define if you want the addons manager modules])
1614 AM_CONDITIONAL([ENABLE_ADDONMANAGERMODULES], [test "${enable_addonmanagermodules}" != "no"])
1618 dnl  Input plugins
1621 EXTEND_HELP_STRING([Input plugins:])
1624 dnl  libarchive access module
1626 PKG_ENABLE_MODULES_VLC([ARCHIVE], [access_archive], [libarchive >= 3.1.0], (libarchive support), [auto])
1629 dnl  live555 input
1631 AC_ARG_ENABLE(live555,
1632   [AS_HELP_STRING([--enable-live555],
1633     [enable RTSP input through live555 (default enabled)])])
1635 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1636   PKG_CHECK_MODULES(LIVE555, live555, [
1637     VLC_ADD_PLUGIN([live555])
1638     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1639     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1640   ], [
1641     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1643     AC_LANG_PUSH(C++)
1644     VLC_SAVE_FLAGS
1646     dnl detect include paths
1647     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1648       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1649     ], [
1650       AS_IF([test "${SYS}" != "os2"], [
1651         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1652         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1653       ], [
1654         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1655         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1656         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1657       ])
1658     ])
1660     dnl CPP Flags
1661     AS_IF([test "${SYS}" = "solaris"], [
1662       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1663     ])
1664     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1665     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1667     dnl version check
1668     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1669       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1670 [#include <liveMedia_version.hh>
1671 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1672 # error BOOM
1673 #endif]])
1674       ], [
1675         ac_cv_live555="yes"
1676       ], [
1677         ac_cv_live555="no"
1678       ])
1679     ])
1681     AS_IF([test "$ac_cv_live555" = "no"], [
1682       AC_MSG_WARN([live555 is missing or its installed version is too old:
1683 Version 2011.12.23 or later is required to proceed.
1684 You can get an updated one from http://www.live555.com/liveMedia .])
1685       AS_IF([test -n "${enable_live555}"], [
1686         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1687       ])
1688     ], [
1689       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1690       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1691       AS_IF([test "${SYS}" = "mingw32"], [
1692         # add ws2_32 for closesocket, select, recv
1693         other_libs="$other_libs -lws2_32"
1694       ])
1696       dnl We need to check for pic because live555 don't provide shared libs
1697       dnl and we want to build a plugins so we need -fPIC on some arch.
1698       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1699       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1700       AC_CHECK_LIB(liveMedia_pic, main, [
1701         VLC_ADD_PLUGIN([live555])
1702         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1703       ],[
1704         AC_CHECK_LIB(liveMedia, main, [
1705           VLC_ADD_PLUGIN([live555])
1706           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1707         ],[],[${other_libs}])
1708       ],[${other_libs_pic}])
1709     ])
1710     VLC_RESTORE_FLAGS
1711     AC_LANG_POP(C++)
1712   ])
1716 dnl IIDC and DV FireWire input modules
1718 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1719 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1722 dnl - linsys modules: access module check for libzvbi
1724 AC_ARG_ENABLE(linsys,
1725   [AS_HELP_STRING([--enable-linsys],
1726     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1727 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1728   VLC_ADD_PLUGIN([linsys_hdsdi])
1729   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1730     VLC_ADD_PLUGIN([linsys_sdi])
1731   ], [
1732     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1733   ])
1737 dnl dvdread module: check for libdvdread
1739 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread > 4.9.0], [dvdread input module], [auto])
1742 dnl libdvdnav plugin
1744 PKG_ENABLE_MODULES_VLC([DVDNAV], [], [dvdnav > 4.9.0], [DVD with navigation input module (dvdnav)], [auto])
1745 AS_IF([test "${enable_dvdnav}" != "no"], [
1746   AC_MSG_CHECKING(for dvdnav_stream_cb in dvdnav/dvdnav.h)
1747     AC_EGREP_HEADER(dvdnav_stream_cb,dvdnav/dvdnav.h,[
1748       AC_MSG_RESULT(yes)
1749       AC_DEFINE(HAVE_STREAM_CB_IN_DVDNAV_H, 1, For dvdnav demux support)
1750       ],[
1751       AC_MSG_RESULT(no)
1752     ])
1756 dnl  Blu-ray Disc Support with libbluray
1758 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray for Blu-ray disc support ) )
1761 dnl  OpenCV wrapper and example filters
1763 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1767 dnl  libsmbclient plugin
1769 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1770 AS_IF([test "${SYS}" = "mingw32" -a "${enable_smbclient}" != "no"], [ VLC_ADD_PLUGIN([smb]) ])
1773 dnl  liBDSM access module
1775 PKG_ENABLE_MODULES_VLC([DSM], [dsm], [libdsm >= 0.2.0], [libdsm SMB/CIFS access/sd module], [auto])
1778 dnl sftp access support
1780 PKG_ENABLE_MODULES_VLC([SFTP], [sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1783 dnl nfs access support
1785 PKG_ENABLE_MODULES_VLC([NFS], [nfs], [libnfs >= 1.10.0], (support nfs protocol via libnfs), [auto])
1788 dnl  Video4Linux 2
1790 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1791   [disable Video4Linux version 2 (default auto)])])
1792 have_v4l2="no"
1793 AS_IF([test "$enable_v4l2" != "no"], [
1794   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1795     have_v4l2="yes"
1796   ])
1798 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1801 dnl special access module for Blackmagic SDI cards
1803 AC_ARG_ENABLE(decklink,
1804   [AS_HELP_STRING([--disable-decklink],
1805     [disable Blackmagic DeckLink SDI input (default auto)])])
1806 AC_ARG_WITH(decklink_sdk,
1807   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1808     [                        location of Blackmagic DeckLink SDI SDK])])
1809 have_decklink=no
1810 if test "${enable_decklink}" != "no"
1811 then
1812   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1813   then
1814     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1815   fi
1816   VLC_SAVE_FLAGS
1817   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1818   AC_LANG_PUSH(C++)
1819   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1820       have_decklink=yes
1821   ], [
1822       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1823   ])
1824   AC_LANG_POP(C++)
1825   VLC_RESTORE_FLAGS
1827 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1831 dnl  Built-in CD-DA and VCD module
1833 AC_ARG_ENABLE(vcd,
1834   [AS_HELP_STRING([--disable-vcd],
1835     [disable built-in VCD and CD-DA support (default enabled)])])
1837 AC_ARG_ENABLE(libcddb,
1838   [AS_HELP_STRING([--disable-libcddb],
1839     [disable CDDB for Audio CD (default enabled)])])
1841 if test "${enable_vcd}" != "no"
1842 then
1843   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1844   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1845     AC_MSG_RESULT(yes)
1846     VLC_ADD_PLUGIN([vcd cdda])
1847   ],[
1848     AC_MSG_RESULT(no)
1849   ])
1851   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1852   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1853     AC_MSG_RESULT(yes)
1854     VLC_ADD_PLUGIN([vcd cdda])
1855     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1856   ],[
1857     AC_MSG_RESULT(no)
1858   ])
1860   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1861   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1862     AC_MSG_RESULT(yes)
1863     VLC_ADD_PLUGIN([vcd cdda])
1864     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1865   ],[
1866     AC_MSG_RESULT(no)
1867   ])
1869   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2" -o "${SYS}" = "darwin"
1870   then
1871     VLC_ADD_PLUGIN([vcd cdda])
1872   fi
1874   if test "$enable_libcddb" != "no"; then
1875     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1876       HAVE_LIBCDDB=yes
1877       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1878       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1879       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1880       ],:
1881       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1882       HAVE_LIBCDDB=no])
1883   fi
1887 dnl Linux DVB
1889 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1890   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1891 [#include <linux/dvb/version.h>
1892 #if (DVB_API_VERSION < 5)
1893 # error Linux DVB API v3.2 and older are not supported.
1894 #endif
1895 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1896 # error Linux DVB API v5.0 is unsupported. Please update.
1897 #endif
1898 ]])], [
1899   ac_cv_linux_dvb_5_1=yes
1900 ], [
1901   ac_cv_linux_dvb_5_1=no
1902 ])])
1903 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1906 dnl  Screen capture module
1908 AC_ARG_ENABLE(screen,
1909   [AS_HELP_STRING([--enable-screen],
1910     [disable screen capture (default enabled)])])
1911 if test "${enable_screen}" != "no"; then
1912   if test "${SYS}" = "darwin"; then
1913     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1914       VLC_ADD_PLUGIN([screen])
1915     ])
1916   fi
1918 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1921 dnl  VNC/RFB access module
1923 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1925 dnl  RDP/Remote Desktop access module
1927 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1930 dnl  Real RTSP plugin
1932 AC_ARG_ENABLE(realrtsp,
1933   [  --enable-realrtsp       Real RTSP module (default disabled)])
1934 if test "${enable_realrtsp}" = "yes"; then
1935   VLC_ADD_PLUGIN([access_realrtsp])
1939 dnl MacOS eyeTV
1940 AC_ARG_ENABLE(macosx-eyetv,
1941   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1942 if test "x${enable_macosx_eyetv}" != "xno" &&
1943   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1944 then
1945   VLC_ADD_PLUGIN([access_eyetv])
1949 dnl QTKit
1950 AC_ARG_ENABLE(macosx-qtkit,
1951   [  --enable-macosx-qtkit Mac OS X qtsound (audio) module (default enabled on Mac OS X <= v10.11)])
1952 if test "x${enable_macosx_qtkit}" != "xno" &&
1953   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1954 then
1955   AC_CHECK_HEADERS(QTKit/QTKit.h, [
1956       VLC_ADD_PLUGIN([qtsound])
1957     ])
1961 dnl AVFoundation
1962 AC_SUBST(have_avfoundation, ["no"])
1963 AC_ARG_ENABLE(macosx-avfoundation,
1964   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
1965 if test "x${enable_macosx_avfoundation}" != "xno" &&
1966   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
1967 then
1968   SAVED_LIBS="${LIBS}"
1969   LIBS="-framework AVFoundation"
1970   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
1971   LIBS="${SAVED_LIBS}"
1972   if test "${have_avfoundation}" != "no"
1973   then
1974     VLC_ADD_PLUGIN([avcapture])
1975   fi
1977 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
1980 dnl  DCP plugin (using asdcplib)
1982 PKG_WITH_MODULES([ASDCP], [asdcplib], [have_asdcp="yes"])
1983 AM_CONDITIONAL(HAVE_ASDCP, [test "${have_asdcp}" = "yes"])
1986 dnl  Demux plugins
1989 EXTEND_HELP_STRING([Mux/Demux plugins:])
1992 dnl  libdvbpsi check for ts mux/demux
1994 have_dvbpsi="no"
1995 PKG_WITH_MODULES([DVBPSI], [libdvbpsi >= 1.2.0], [have_dvbpsi="yes"])
1996 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
2000 dnl  GME demux plugin
2002 AC_ARG_ENABLE(gme,
2003   [AS_HELP_STRING([--enable-gme],
2004     [use Game Music Emu (default auto)])])
2005 AS_IF([test "${enable_gme}" != "no"], [
2006   AC_CHECK_HEADER([gme/gme.h], [
2007     VLC_ADD_LIBS([gme], [-lgme])
2008     VLC_ADD_PLUGIN([gme])
2009   ], [
2010     AS_IF([test "x${enable_gme}" != "x"], [
2011       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
2012     ])
2013   ])
2018 dnl  SIDPlay plugin
2020 AC_ARG_ENABLE(sid,
2021     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2022 AS_IF([test "${enable_sid}" != "no"], [
2023     PKG_CHECK_MODULES(SID, [libsidplay2], [
2024         AC_LANG_PUSH(C++)
2025         oldCPPFLAGS="$CPPFLAGS"
2026         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2027         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2028             VLC_ADD_PLUGIN([sid])
2029             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2030             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2031         ], [
2032             AS_IF([test -n "${enable_sid}"],
2033                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2034                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2035                 )
2036         ])
2037         CPPFLAGS="$oldCPPFLAGS"
2038         AC_LANG_POP(C++)
2039     ], [
2040         AS_IF([test "x${enable_sid}" = "xyes"],
2041             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2042             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2043             )
2044     ])
2049 dnl  ogg demux plugin
2051 PKG_ENABLE_MODULES_VLC([OGG], [mux_ogg], [ogg >= 1.0], [Ogg demux support], [auto])
2052 PKG_CHECK_MODULES(LIBVORBIS, [vorbis >= 1.1], [
2053     AC_DEFINE(HAVE_LIBVORBIS, 1, [Define to 1 if you have the libvorbis])
2054 ],[true])
2055 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto], [${LIBVORBIS_CFLAGS}], [${LIBVORBIS_LIBS}])
2056 if test "${enable_sout}" != "no"; then
2057 dnl Check for libshout
2058     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2062 dnl  matroska demux plugin
2064 AC_ARG_ENABLE(mkv,
2065   [AS_HELP_STRING([--disable-mkv],
2066     [do not use libmatroska (default auto)])])
2067 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2068   AC_LANG_PUSH(C++)
2069   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2070     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2071     AC_EGREP_CPP(yes,
2072       [#include <ebml/EbmlVersion.h>
2073        #ifdef LIBEBML_VERSION
2074        #if LIBEBML_VERSION >= 0x010000
2075        yes
2076        #endif
2077        #endif],
2078       [AC_MSG_RESULT([yes])
2079         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2080           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2081           AC_EGREP_CPP(yes,
2082             [#include <matroska/KaxVersion.h>
2083              #ifdef LIBMATROSKA_VERSION
2084              #if LIBMATROSKA_VERSION >= 0x010000
2085              yes
2086              #endif
2087              #endif],
2088             [AC_MSG_RESULT([yes])
2089               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2090               AC_CHECK_LIB(ebml_pic, main, [
2091                 VLC_ADD_PLUGIN([mkv])
2092                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2093               ],[
2094                 AC_CHECK_LIB(ebml, main, [
2095                   VLC_ADD_PLUGIN([mkv])
2096                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2097                 ])
2098               ])
2099             ], [
2100               AC_MSG_RESULT([no])
2101               AC_MSG_ERROR([Your libmatroska is too old: you may get a more recent one from http://dl.matroska.org/downloads/libmatroska/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2102           ])
2103         ])
2104       ],
2105       [AC_MSG_RESULT([no])
2106         AC_MSG_ERROR([Your libebml is too old: you may get a more recent one from http://dl.matroska.org/downloads/libebml/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2107     ])
2108   ])
2109   AC_LANG_POP(C++)
2113 dnl  modplug demux plugin
2115 AC_ARG_ENABLE(mod,
2116   [AS_HELP_STRING([--disable-mod],
2117     [do not use libmodplug (default auto)])])
2118 if test "${enable_mod}" != "no" ; then
2119     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2120           VLC_ADD_PLUGIN([mod])
2121           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2122           VLC_ADD_CFLAGS([mod],[$LIBMODPLUG_CFLAGS]) #modules/demux/mod.c needs CFLAGS_mod, not CXXFLAGS_mod
2123           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2124     ],[
2125        AS_IF([test -n "${enable_mod}"],
2126          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2127          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2128     ])
2132 dnl  mpc demux plugin
2134 AC_ARG_ENABLE(mpc,
2135   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2136 if test "${enable_mpc}" != "no"
2137 then
2138   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2139     VLC_ADD_PLUGIN([mpc])
2140     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2141     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2142     VLC_ADD_PLUGIN([mpc])
2143     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2147 dnl  Codec plugins
2150 EXTEND_HELP_STRING([Codec plugins:])
2153 dnl wmafixed plugin
2155 AC_ARG_ENABLE(wma-fixed,
2156   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2157 if test "${enable_wma_fixed}" = "yes"
2158 then
2159   VLC_ADD_PLUGIN([wma_fixed])
2163 dnl shine encoder plugin
2165 PKG_ENABLE_MODULES_VLC([SHINE], [], [shine >= 3.0.0], [MPEG Audio Layer 3 encoder], [auto], [], [], [])
2169 dnl openmax il codec plugin
2171 AC_ARG_ENABLE(omxil,
2172   [  --enable-omxil          openmax il codec module (default disabled)])
2173 if test "${enable_omxil}" = "yes"
2174 then
2175   VLC_ADD_PLUGIN([omxil])
2179 dnl openmax il vout plugin
2181 AC_ARG_ENABLE(omxil-vout,
2182   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2183 if test "${enable_omxil_vout}" = "yes"
2184 then
2185   VLC_ADD_PLUGIN([omxil_vout])
2189 dnl raspberry pi openmax il configuration
2191 AC_ARG_ENABLE(rpi-omxil,
2192   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2193 if test "${enable_rpi_omxil}" = "yes"
2194 then
2195   VLC_ADD_PLUGIN([omxil omxil_vout])
2196   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2200 dnl CrystalHD codec plugin
2202 AC_ARG_ENABLE(crystalhd,
2203   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2204 if test "${enable_crystalhd}" != "no"; then
2205     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2206       VLC_ADD_PLUGIN([crystalhd])
2207       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2208     ],[
2209       if test "${SYS}" = "mingw32" ; then
2210         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2211           VLC_ADD_PLUGIN([crystalhd])
2212           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2213             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2214             ])
2215         ],[
2216           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2217                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2218                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2219         ],[#define __LINUX_USER__
2220                #include <libcrystalhd/bc_dts_types.h>
2221         ])
2222       fi
2223     ],[
2224        #include <libcrystalhd/bc_dts_types.h>
2225       ])
2229 dnl  mad plugin
2231 have_mad="no"
2232 MAD_CFLAGS=""
2233 MAD_LIBS=""
2235 AC_ARG_WITH(mad, [  --with-mad=PATH         path to libmad], [
2236   enable_mad="yes"
2237 ], [
2238   with_mad="no"
2240 AS_IF([test "${with_mad}" != "no"], [
2241   MAD_CFLAGS="-I${with_mad}/include"
2242   MAD_LIBS="-L${with_mad}/lib"
2245 AC_ARG_ENABLE(mad,
2246   [  --enable-mad            libmad module (default enabled)])
2247 AS_IF([test "${enable_mad}" != "no"], [
2248   VLC_SAVE_FLAGS
2249   CPPFLAGS="${CPPFLAGS} ${MAD_CFLAGS}"
2250   LDFLAGS="${LDFLAGS} ${MAD_LIBS}"
2251   AC_CHECK_HEADERS(mad.h, [
2252     AC_CHECK_LIB(mad, mad_bit_init, [
2253       have_mad="yes"
2254       MAD_LIBS="${MAD_LIBS} -lmad"
2255     ])
2256   ])
2257   VLC_RESTORE_FLAGS
2258   AS_IF([test -n "$enable_mad" -a "${have_mad}" = "no"], [
2259     AC_MSG_ERROR([Could not find libmad. Install it or pass --disable-mad to disable it.])
2260   ])
2262 AC_SUBST(MAD_CFLAGS)
2263 AC_SUBST(MAD_LIBS)
2264 AM_CONDITIONAL([HAVE_MAD], [test "${have_mad}" = "yes"])
2266 dnl  mpg123 plugin
2269 PKG_ENABLE_MODULES_VLC([MPG123], [mpg123], [libmpg123], [libmpg123 decoder support], [auto])
2272 AC_ARG_ENABLE(merge-ffmpeg,
2273 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2274   enable_merge_ffmpeg="no"
2276 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2278 AC_MSG_CHECKING([for libavutil variant])
2279 PKG_CHECK_EXISTS([libavutil], [
2280   libavutil_version="$(${PKG_CONFIG} --modversion libavutil)"
2281   libavutil_micro="${libavutil_version##*.}"
2282   AS_IF([test ${libavutil_micro} -le 99], [
2283     avfork="libav"
2284   ], [
2285     avfork="ffmpeg"
2286   ])
2287 ], [
2288   avfork="none"
2290 AC_MSG_RESULT([${avfork}])
2293 dnl gstreamer stuff
2295 AC_ARG_ENABLE(gst-decode,
2296   [  --enable-gst-decode     GStreamer based decoding support (currently supports only video decoding) (default auto)])
2298 have_gst_decode="no"
2299 AS_IF([test "${enable_gst_decode}" != "no"], [
2300   PKG_CHECK_MODULES([GST_APP], [gstreamer-app-1.0], [
2301     PKG_CHECK_MODULES([GST_VIDEO], [gstreamer-video-1.0], [
2302       have_gst_decode="yes"
2303     ], [
2304       AC_MSG_WARN([${GST_VIDEO_PKG_ERRORS}. GStreamer decoder module will not be built.])
2305     ])
2306   ], [
2307     AC_MSG_WARN([${GST_APP_PKG_ERRORS}. GStreamer modules will not be built.])
2308   ])
2310 AM_CONDITIONAL([HAVE_GST_DECODE], [test "${have_gst_decode}" = "yes"])
2313 dnl  avcodec decoder/encoder plugin
2315 AC_ARG_ENABLE(avcodec,
2316 [  --enable-avcodec        libavcodec codec (default enabled)])
2317 AS_IF([test "${enable_avcodec}" != "no"], [
2318   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 55.0.0 libavutil >= 52.0.0], [
2319     dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
2320     dnl   AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
2321     dnl ])
2322     VLC_SAVE_FLAGS
2323     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2324     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2325     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2326     AC_CHECK_HEADERS(libavutil/avutil.h)
2327     VLC_RESTORE_FLAGS
2328     have_avcodec="yes"
2329   ],[
2330     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2331   ])
2332 ], [
2333   have_avcodec="no"
2335 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2338 dnl libva needs avcodec
2340 AC_ARG_ENABLE(libva,
2341   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2343 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2344   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2347 have_vaapi="no"
2348 have_vaapi_drm="no"
2349 have_vaapi_x11="no"
2350 AS_IF([test "${enable_libva}" != "no"], [
2351   PKG_CHECK_EXISTS([libva], [
2352     have_vaapi="yes"
2353   ], [
2354     AS_IF([test -n "${enable_libva}"], [
2355       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2356     ], [
2357       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2358     ])
2359   ])
2360   PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm], [
2361     have_vaapi_drm="yes"
2362   ], [
2363     AC_MSG_WARN([${LIBVA_DRM_PKG_ERRORS}.])
2364   ])
2365   PKG_CHECK_MODULES(LIBVA_X11, [libva-x11], [
2366     have_vaapi_x11="yes"
2367   ], [
2368     AC_MSG_WARN([${LIBVA_X11_PKG_ERRORS}.])
2369   ])
2371 AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
2372 AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
2374 have_avcodec_vaapi="no"
2375 AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
2376   case "${avfork}" in
2377     ffmpeg)
2378       PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [
2379         PKG_CHECK_EXISTS([libavcodec <= 57.12.100], [
2380           AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or > 57.12 or libav.])
2381         ])
2382       ])
2383       ;;
2384   esac
2385   VLC_SAVE_FLAGS
2386   CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2387   CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2388   AC_CHECK_HEADERS([libavcodec/vaapi.h], [
2389     AC_MSG_NOTICE([VA API acceleration activated])
2390     have_avcodec_vaapi="yes"
2391   ],[
2392     AS_IF([test -n "${enable_libva}"], [
2393       AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2394     ], [
2395       AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2396     ])
2397   ])
2398   VLC_RESTORE_FLAGS
2400 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2403 dnl dxva2 needs avcodec
2405 AC_ARG_ENABLE(dxva2,
2406   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2408 have_avcodec_dxva2="no"
2409 AS_IF([test "${enable_dxva2}" != "no"], [
2410   if test "${SYS}" = "mingw32"; then
2411   AS_IF([test "x${have_avcodec}" = "xyes"], [
2412     AC_CHECK_HEADERS(dxva2api.h,
2413       [
2414         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2415            AC_MSG_NOTICE([DxVA2 acceleration activated])
2416            have_avcodec_dxva2="yes"
2417         ],[
2418     AS_IF([test "${enable_dxva2}" = "yes"],
2419           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2420               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2421         ], [#undef _WIN32_WINNT
2422             /* DXVA2 is only available in Vista and above */
2423             #define _WIN32_WINNT 0x600])
2424       ],[
2425     AS_IF([test "${enable_dxva2}" = "yes"],
2426               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2427               [AC_MSG_WARN([dxva2api.h not found])])
2428       ],[#include <d3d9.h>])
2429   ],[
2430     AS_IF([test "x${enable_dxva2}" != "x"], [
2431       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2432     ])
2433   ])
2434   fi
2436 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2439 dnl d3d11va needs avcodec
2441 AC_ARG_ENABLE(d3d11va,
2442   [  --enable-d3d11va          D3D11 GPU decoding support (default auto)])
2444 have_avcodec_d3d11va="no"
2445 AS_IF([test "${enable_d3d11va}" != "no"], [
2446   if test "${SYS}" = "mingw32"; then
2447   AS_IF([test "x${have_avcodec}" = "xyes"], [
2448         AC_CHECK_TYPES([ID3D11VideoDecoder],
2449           [
2450             AC_CHECK_HEADERS(dxva2api.h,
2451               [
2452                 AC_CHECK_HEADERS(libavcodec/d3d11va.h, [
2453                    AC_MSG_NOTICE([D3D11 acceleration activated])
2454                    AC_DEFINE(HAVE_AVCODEC_D3D11VA, 1, [Define if the d3d11va module is built])
2455                    have_avcodec_d3d11va="yes"
2456                 ],[
2457                   AS_IF([test "${enable_d3d11va}" = "yes"],
2458                     [AC_MSG_ERROR([d3d11va is present but libavcodec/d3d11va.h is missing])],
2459                         [AC_MSG_WARN([d3d11va is present but libavcodec/d3d11va.h is missing ])])
2460                   ], [#undef _WIN32_WINNT
2461                       /* D3D11 is only available in Vista and above */
2462                       #define _WIN32_WINNT 0x600])
2463                   ],[
2464                     AS_IF([test "${enable_d3d11va}" = "yes"],
2465                           [AC_MSG_ERROR([Could not find required dxva2api.h])],
2466                           [AC_MSG_WARN([dxva2api.h not found])])
2467                   ],[#include <d3d9.h>])
2468           ],[
2469             AS_IF([test "${enable_d3d11va}" = "yes"],
2470                   [AC_MSG_ERROR([Could not find required ID3D11VideoDecoder in d3d11.h])],
2471                   [AC_MSG_WARN([ID3D11VideoDecoder not found])])
2472           ], [#include <d3d11.h>])
2473   ],[
2474     AS_IF([test "x${enable_d3d11va}" != "x"], [
2475       AC_MSG_ERROR([--enable-d3d11va and --disable-avcodec options are mutually exclusive.])
2476     ])
2477   ])
2478   fi
2480 AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
2483 dnl DXGI debug
2485 AC_CHECK_HEADERS(dxgidebug.h)
2488 dnl vda needs avcodec
2490 AC_ARG_ENABLE(vda,
2491   [  --enable-vda          VDA  support (default auto)])
2493 have_avcodec_vda="no"
2494 AS_IF([test "${enable_vda}" != "no"], [
2495   if test "${SYS}" = "darwin"; then
2496   AS_IF([test "x${have_avcodec}" = "xyes"], [
2497     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2498       [
2499         AC_CHECK_HEADERS(libavcodec/vda.h, [
2500            have_avcodec_vda="yes"
2501         ],[
2502         AS_IF([test "${enable_vda}" = "yes"],
2503               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2504               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2505         ])
2506   ],[
2507         AS_IF([test "${enable_vda}" = "yes"],
2508               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2509               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2510       ])
2511   ],[
2512     AS_IF([test "x${enable_vda}" != "x"], [
2513       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2514     ])
2515  ])
2516  AS_IF([test "${have_avcodec_vda}" = "yes"], [
2517      SAVE_LIBS=$LIBS
2518      LIBS="$LIBS $AVCODEC_LIBS"
2519      AC_CHECK_FUNCS([av_vda_alloc_context])
2520      LIBS=$SAVE_LIBS
2521  ])
2522  fi
2524 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2527 dnl  avformat demuxer/muxer plugin
2530 AC_ARG_ENABLE(avformat,
2531 [  --enable-avformat       libavformat containers (default enabled)],, [
2532   enable_avformat="${have_avcodec}"
2534 have_avformat="no"
2535 AS_IF([test "${enable_avformat}" != "no"], [
2536   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2537       have_avformat="yes"
2538       VLC_SAVE_FLAGS
2539       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2540       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2541       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2542       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2543       AC_CHECK_HEADERS(libavutil/avutil.h)
2544       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2545         have_avformat="no"
2546       ])
2547       VLC_RESTORE_FLAGS
2548     ],[
2549       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2550   ])
2552 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2555 dnl  swscale image scaling and conversion plugin
2558 AC_ARG_ENABLE(swscale,
2559   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2560           (default enabled)]))
2561 if test "${enable_swscale}" != "no"
2562 then
2563   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2564     [
2565       VLC_SAVE_FLAGS
2566       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2567       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2568       AC_CHECK_HEADERS(libswscale/swscale.h)
2569       AC_CHECK_HEADERS(libavutil/avutil.h)
2570       VLC_ADD_PLUGIN([swscale])
2571       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2572       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2573       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2574         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2575       ])
2576       VLC_RESTORE_FLAGS
2577     ],[
2578       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2579   ])
2583 dnl  postproc plugin
2586 AC_ARG_ENABLE(postproc,
2587 [  --enable-postproc       libpostproc image post-processing (default auto)])
2588 if test "${enable_postproc}" != "no"
2589 then
2590   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2591     [
2592       VLC_SAVE_FLAGS
2593       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2594       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2595       AC_CHECK_HEADERS(postproc/postprocess.h)
2596       VLC_ADD_PLUGIN([postproc])
2597       VLC_RESTORE_FLAGS
2598     ],[
2599       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2600   ])
2604 dnl  faad decoder plugin
2606 AC_ARG_ENABLE(faad,
2607 [  --enable-faad           faad codec (default auto)])
2608 have_faad="no"
2609 AS_IF([test "${enable_faad}" != "no"], [
2610   AC_CHECK_HEADERS([neaacdec.h], [
2611     AC_CHECK_LIB(faad, NeAACDecOpen, [have_faad="yes"],, [$LIBM])
2613     AS_IF([test "${have_faad}" = "yes"], [
2614       VLC_ADD_PLUGIN([faad])
2615       VLC_ADD_LIBS([faad],[-lfaad])
2616     ], [
2617       AS_IF([test "${enable_faad}" = "yes"], [
2618         AC_MSG_ERROR([cannot find FAAD library])
2619       ], [
2620         AC_MSG_WARN([cannot find FAAD library])
2621       ])
2622     ])
2623   ])
2627 dnl libvpx decoder plugin
2629 AC_ARG_ENABLE(vpx,
2630     AS_HELP_STRING([--enable-vpx],[libvpx VP8/VP9 encoder and decoder (default auto)]))
2631 AS_IF([test "${enable_vpx}" != "no"],[
2632     PKG_CHECK_MODULES([VPX], [vpx] , [
2633         VLC_ADD_PLUGIN([vpx])
2634         VLC_ADD_CPPFLAGS([vpx], [${VPX_CFLAGS}])
2635         VLC_ADD_LIBS([vpx], [${VPX_LIBS}])
2636         AC_CHECK_LIB([vpx],[vpx_codec_vp8_dx], [
2637             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_DECODER])
2638         ], [], [${VPX_LIBS}])
2639         AC_CHECK_LIB([vpx],[vpx_codec_vp9_dx], [
2640             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_DECODER])
2641         ], [], [${VPX_LIBS}])
2642         AC_CHECK_LIB([vpx],[vpx_codec_vp8_cx], [
2643             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_ENCODER])
2644         ], [], [${VPX_LIBS}])
2645         AC_CHECK_LIB([vpx],[vpx_codec_vp9_cx], [
2646             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_ENCODER])
2647         ], [], [${VPX_LIBS}])
2648     ], [
2649     AS_IF([test "${enable_vpx}" = "yes"],[
2650         AC_MSG_ERROR([libvpx was not found])
2651     ])])
2655 dnl twolame encoder plugin
2657 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2660 dnl fdk-aac encoder plugin
2662 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2666 dnl A52/AC3 decoder plugin
2668 AC_ARG_ENABLE(a52,
2669   [  --enable-a52            A/52 support with liba52 (default enabled)])
2670 if test "${enable_a52}" != "no"
2671 then
2672   AC_ARG_WITH(a52,
2673     [  --with-a52=PATH         a52 headers and libraries])
2674     if test -z "${with_a52}"
2675     then
2676       LDFLAGS_test=""
2677       CPPFLAGS_test=""
2678     else
2679       LDFLAGS_test="-L${with_a52}/lib"
2680       CPPFLAGS_test="-I${with_a52}/include"
2681     fi
2682     VLC_SAVE_FLAGS
2683     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_liba52}"
2684     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_liba52}"
2685     AC_CHECK_HEADERS(a52dec/a52.h, [
2686       AC_CHECK_LIB(a52, a52_free, [
2687         VLC_ADD_PLUGIN([liba52])
2688         VLC_ADD_LIBS([liba52],[${LDFLAGS_test} -la52])
2689         VLC_ADD_CPPFLAGS([liba52],[${CPPFLAGS_test}])
2690       ],[
2691         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.])
2692         ], [$LIBM])
2693     ],[
2694       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.])
2695     ])
2696     VLC_RESTORE_FLAGS
2700 dnl DTS Coherent Acoustics decoder plugin
2702 PKG_ENABLE_MODULES_VLC([DCA], [dca], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2705 dnl  Flac plugin
2707 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2710 dnl  Libmpeg2 plugin
2712 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2715 dnl  Vorbis plugin
2717 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2720 dnl  Tremor plugin
2722 AC_ARG_ENABLE(tremor,
2723   [  --enable-tremor         Tremor decoder support (default disabled)])
2724 if test "${enable_tremor}" = "yes"
2725 then
2726   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2727     VLC_ADD_PLUGIN([tremor])
2728    ],[])
2732 dnl  Speex plugins
2734 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2735 have_speexdsp="no"
2736 AS_IF([test "${enable_speex}" != "no"], [
2737   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2738     have_speexdsp="yes"
2739   ], [
2740     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2741   ])
2743 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2746 dnl  Opus plugin
2748 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus >= 1.0.3], [Opus support], [auto])
2751 dnl  theora decoder plugin
2753 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2756 dnl  OggSpots decoder plugin
2758 PKG_ENABLE_MODULES_VLC([OGGSPOTS], [], [ogg], [experimental OggSpots codec], [auto])
2761 dnl  Daala decoder plugin
2763 PKG_ENABLE_MODULES_VLC([DAALA], [], [daaladec daalaenc], [experimental daala codec], [disabled])
2766 dnl  schroedinger decoder plugin (for dirac format video)
2768 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2771 dnl  PNG decoder module
2773 AC_ARG_ENABLE(png,
2774   [  --enable-png            PNG support (default enabled)])
2775 AS_IF([test "${enable_png}" != "no"], [
2776 AC_CHECK_HEADERS(png.h, [
2777   VLC_SAVE_FLAGS
2778   LDFLAGS="${LDFLAGS} -lz $LIBM"
2779   AC_CHECK_LIB(png, png_set_rows, [
2780     VLC_ADD_PLUGIN([png])
2781   ], [], [-lz $LIBM])
2782   VLC_RESTORE_FLAGS
2783   ])
2787 dnl  JPEG decoder module
2789 AC_ARG_ENABLE(jpeg,
2790   [  --enable-jpeg           JPEG support (default enabled)])
2791 AS_IF([test "${enable_jpeg}" != "no"], [
2792 AC_CHECK_HEADERS(jpeglib.h, [
2793   VLC_ADD_PLUGIN([jpeg])
2794   ])
2798 dnl  BPG decoder module
2800 AC_ARG_ENABLE(bpg,
2801   [  --enable-bpg           BPG support (default disabled)])
2802 AS_IF([test "${enable_bpg}" != "no"], [
2803 AC_CHECK_HEADERS(libbpg.h, [
2804   VLC_ADD_PLUGIN([bpg])
2805   ])
2809 dnl H262 encoder plugin (lib262)
2811 AC_ARG_ENABLE(x262,
2812   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2813 if test "${enable_x262}" != "no"; then
2814     PKG_CHECK_MODULES(X262, x262, [
2815         VLC_ADD_PLUGIN([x262])
2816         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2817         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2818           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2819         ])
2820         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2821         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2822           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2823         fi
2824     ], [
2825        if test "${enable_x262}" = "yes"; then
2826         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2827        fi
2828     ])
2831 dnl x265 encoder
2832 PKG_ENABLE_MODULES_VLC([X265],, [x265], [HEVC/H.265 encoder], [auto])
2835 dnl H264 encoder plugin (10-bit lib264)
2837 AC_ARG_ENABLE(x26410b,
2838   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2839 if test "${enable_x26410b}" != "no"; then
2840     PKG_CHECK_MODULES(X26410B, x26410b, [
2841         VLC_ADD_PLUGIN([x26410b])
2842         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2843         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2844           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2845         ])
2846         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2847         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2848           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2849         fi
2850     ], [
2851        if test "${enable_x26410b}" = "yes"; then
2852         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2853        fi
2854     ])
2859 dnl H264 encoder plugin (using libx264)
2861 AC_ARG_ENABLE(x264,
2862   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2863 if test "${enable_x264}" != "no"; then
2864       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2865         VLC_ADD_PLUGIN([x264])
2866         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2868         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2869           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2870         ])
2872         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2873         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2874           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2875         fi
2876       ],[
2877         if test "${enable_x264}" = "yes"; then
2878             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2879           fi
2880       ])
2884 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2886 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2889 dnl libfluidsynth (MIDI synthetizer) plugin
2891 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2892 PKG_ENABLE_MODULES_VLC([FLUIDLITE], [fluidsynth], [fluidlite], [MIDI synthetiser with libfluidsynth], [auto])
2893 AC_CHECK_HEADERS(fluidlite.h, [AC_SUBST([FLUIDSYNTH_LIBS], ${FLUIDLITE_LIBS})])
2896 dnl Teletext Modules
2897 dnl vbi decoder plugin (using libzbvi)
2898 dnl telx module
2899 dnl uncompatible
2901 AC_ARG_ENABLE(zvbi,
2902   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2903                   libzvbi (default enabled)]))
2904 AC_ARG_ENABLE(telx,
2905   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2906                   zvbi) (default enabled if zvbi is absent)]))
2908 AS_IF( [test "${enable_zvbi}" != "no"],[
2909     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2910         [
2911           VLC_ADD_PLUGIN([zvbi])
2912           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2913           AS_IF( [test "${enable_telx}" = "yes"],[
2914                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2915                   ])
2916         ],[
2917           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2918         ])
2919     ])
2920 AS_IF( [test "${enable_telx}" != "no" ],[
2921   VLC_ADD_PLUGIN([telx])
2922   ])
2925 dnl libass subtitle rendering module
2927 AC_ARG_ENABLE(libass,
2928   [  --enable-libass         Subtitle support using libass (default enabled)])
2929 AS_IF( [test "${enable_libass}" != "no"], [
2930   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2931       [
2932         VLC_ADD_PLUGIN([libass])
2934         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2935           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2936            VLC_ADD_LIBS([libass],[-lfontconfig])
2937        ])
2938       ],[
2939         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2940       ])
2941   ])
2944 dnl ARIB subtitles rendering module
2946 AC_ARG_ENABLE(aribsub,
2947   [  --enable-aribsub        ARIB Subtitles support (default enabled)])
2948 AS_IF( [test "${enable_aribsub}" != "no" ],[
2949   PKG_CHECK_MODULES(ARIBB24, [aribb24 >= 1.0.1], [
2950       have_aribb24="yes"
2951       VLC_ADD_PLUGIN([aribsub])
2952       VLC_ADD_LIBS([aribsub],[-laribb24])
2953       AC_DEFINE(HAVE_ARIBB24, 1, [Define if libaribb24 is available.])
2954     ],[
2955       AC_MSG_WARN(Library [aribb24] needed for [aribsub] was not found)
2956       have_aribb24="no"
2957   ])
2959 AM_CONDITIONAL([HAVE_ARIBB24], [test x"${have_aribb24}" = x"yes"])
2962 dnl ARIB B25
2964 PKG_ENABLE_MODULES_VLC([ARIBB25], [aribcam], [aribb25 >= 0.2.6], [ARIB STD-B25], [auto])
2967 dnl  kate decoder plugin
2969 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2972 dnl  tiger rendering for kate decoder plugin
2974 AC_ARG_ENABLE(tiger,
2975 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2976 AS_IF([test "${enable_tiger}" != "no"], [
2977   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2978       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2979         AS_IF([test -n "${enable_tiger}"], [
2980           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2981         ])
2982   ])
2987 dnl  Video plugins
2990 EXTEND_HELP_STRING([Video plugins:])
2993 dnl  OpenGL
2995 PKG_CHECK_MODULES([EGL], [egl], [
2996   have_egl="yes"
2997 ], [
2998   have_egl="no"
3000 AM_CONDITIONAL([HAVE_EGL], [test "${have_egl}" = "yes"])
3002 have_gl="no"
3003 PKG_CHECK_MODULES([GL], [gl], [
3004   have_gl="yes"
3005 ], [
3006   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3007 #ifdef _WIN32
3008 # include <GL/glew.h>
3009 #endif
3010 #include <GL/gl.h>
3011 ]], [
3012     [int t0 = GL_TEXTURE0;]])
3013   ], [
3014     GL_CFLAGS=""
3015     have_gl="yes"
3016     AS_IF([test "${SYS}" != "mingw32"], [
3017       GL_LIBS="-lGL"
3018     ], [
3019       GL_LIBS="-lopengl32"
3020     ])
3021   ])
3023 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
3025 dnl OpenGL ES 2: depends on EGL 1.1
3026 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
3027 dnl OpenGL ES 1: depends on EGL 1.0
3028 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
3031 dnl  Xlib
3034 AC_PATH_XTRA()
3035 AC_CHECK_HEADERS(X11/Xlib.h)
3038 dnl  X C Bindings modules
3040 AC_ARG_ENABLE(xcb,
3041   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3042   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"], [
3043     enable_xcb="yes"
3044   ], [
3045     enable_xcb="no"
3046   ])
3048 AC_ARG_ENABLE(xvideo,
3049   [  --enable-xvideo         XVideo support (default enabled)],, [
3050     enable_xvideo="$enable_xcb"
3053 have_xcb="no"
3054 have_xcb_keysyms="no"
3055 have_xcb_randr="no"
3056 have_xcb_xvideo="no"
3057 AS_IF([test "${enable_xcb}" != "no"], [
3058   dnl libxcb
3059   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3060   have_xcb="yes"
3061   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3062   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3063   PKG_CHECK_MODULES(XPROTO, [xproto])
3065   AS_IF([test "${enable_xvideo}" != "no"], [
3066     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3067   ])
3069   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3071   dnl xcb-utils
3072   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3073     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3074   ])
3076 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3077 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3078 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3079 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3083 dnl VDPAU needs X11
3085 AC_ARG_ENABLE(vdpau,
3086   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3087 have_vdpau="no"
3088 AS_IF([test "${enable_vdpau}" != "no"], [
3089   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3090     have_vdpau="yes"
3091     AS_IF([test "${no_x}" = "yes"], [
3092       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3093     ])
3094   ], [
3095     AS_IF([test -n "${enable_vdpau}"], [
3096       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3097     ])
3098   ])
3100 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3102 have_avcodec_vdpau="no"
3103 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3104   case "${avfork}" in
3105     libav) av_vdpau_ver="55.26.0" ;;
3106     ffmpeg) av_vdpau_ver="55.42.100" ;;
3107   esac
3108   PKG_CHECK_EXISTS([libavutil >= 52.4.0 libavcodec >= ${av_vdpau_ver}], [
3109     have_avcodec_vdpau="yes"
3110     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3111   ], [
3112     AS_IF([test -n "${enable_vdpau}"], [
3113       AC_MSG_ERROR([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3114     ], [
3115       AC_MSG_WARN([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3116     ])
3117   ])
3119 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3123 dnl  Wayland
3125 AC_ARG_ENABLE(wayland,
3126   [AS_HELP_STRING([--enable-wayland], [Wayland support (default auto)])])
3127 have_wayland="no"
3128 AC_ARG_VAR([WAYLAND_SCANNER], [Wayland scanner utility])
3130 AS_IF([test "${enable_wayland}" != "no"], [
3131   AC_MSG_CHECKING([for the Wayland scanner])
3132   AS_IF([test -z "$WAYLAND_SCANNER"], [
3133     PKG_CHECK_EXISTS([wayland-scanner], [
3134       WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
3135     ], [
3136       WAYLAND_SCANNER="wayland-scanner"
3137     ])
3138   ])
3139   AC_MSG_RESULT([$WAYLAND_SCANNER])
3141   PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91], [
3142     have_wayland="yes"
3143   ], [
3144     AS_IF([test -n "${enable_wayland}"], [
3145       AC_MSG_ERROR([${WAYLAND_CLIENT_PKG_ERRORS}.])
3146     ])
3147   ])
3149   AS_IF([test "${have_egl}" = "yes"], [
3150     PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [
3151       have_wayland_egl="yes"
3152     ], [
3153       AS_IF([test -n "${enable_wayland}"], [
3154         AC_MSG_ERROR([${WAYLAND_EGL_PKG_ERRORS}.])
3155       ])
3156     ])
3157   ])
3159 AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
3160 AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "${have_wayland_egl}" = "yes"])
3164 dnl  SDL module
3166 AC_ARG_ENABLE(sdl,
3167   [  --enable-sdl            SDL support (default enabled)])
3168 AC_ARG_ENABLE(sdl-image,
3169   [  --enable-sdl-image      SDL image support (default enabled)])
3170 if test "${enable_sdl}" != "no"
3171 then
3172    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3173       # SDL on Darwin is heavily patched and can only run SDL_image
3174       if test "${SYS}" != "darwin"; then
3175         VLC_ADD_PLUGIN([vout_sdl])
3176       fi
3178       # SDL_image
3179       AS_IF([ test "${enable_sdl_image}" != "no"],[
3180         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3181           VLC_ADD_PLUGIN([sdl_image])],
3182           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3183           ])
3184       ])
3185    ],[
3186      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3187    ])
3191 dnl  freetype module
3193 AC_ARG_ENABLE(freetype,
3194   [  --enable-freetype       freetype support   (default auto)])
3195 AC_ARG_ENABLE(fribidi,
3196   [  --enable-fribidi        fribidi support    (default auto)])
3197 AC_ARG_ENABLE(harfbuzz,
3198   [  --enable-harfbuzz       harfbuzz support   (default auto)])
3199 AC_ARG_ENABLE(fontconfig,
3200   [  --enable-fontconfig     fontconfig support (default auto)])
3202 AC_ARG_WITH([default-font],
3203     AS_HELP_STRING([--with-default-font=PATH],
3204         [Path to the default font]),
3205         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3206             "$withval", [Default font])])
3207 AC_ARG_WITH([default-monospace-font],
3208     AS_HELP_STRING([--with-default-monospace-font=PATH],
3209         [Path to the default font]),
3210         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3211             "$withval", [Default monospace font])])
3213 AC_ARG_WITH([default-font-family],
3214     AS_HELP_STRING([--with-default-font-family=NAME],
3215         [Path to the default font family]),
3216         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3217             "$withval", [Default font family])])
3218 AC_ARG_WITH([default-monospace-font-family],
3219     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3220         [Path to the default font family]),
3221         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3222             "$withval", [Default monospace font family])])
3224 have_freetype="no"
3225 have_fontconfig="no"
3226 have_fribidi="no"
3227 have_harfbuzz="no"
3229 if test "${enable_freetype}" != "no"; then
3230    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3231       have_freetype="yes"
3232       VLC_ADD_CPPFLAGS([skins2],[${FREETYPE_CFLAGS}])
3233       VLC_ADD_LIBS([skins2],[${FREETYPE_LIBS}])
3235       dnl fontconfig support
3236       if test "${SYS}" != "mingw32"; then
3237           if test "${enable_fontconfig}" != "no"; then
3238             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3239               have_fontconfig="yes"
3240             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3241           fi
3242       fi
3244       dnl fribidi support
3245       if test "${enable_fribidi}" != "no"; then
3246         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3247           have_fribidi="yes"
3248           VLC_ADD_CPPFLAGS([skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3249           VLC_ADD_LIBS([skins2], [${FRIBIDI_LIBS}])
3250         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional text and complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3251       fi
3253       dnl harfbuzz support
3254       if test "${have_fribidi}" != "no"; then
3255         if test "${enable_harfbuzz}" != "no"; then
3256           PKG_CHECK_MODULES(HARFBUZZ, harfbuzz, [
3257             have_harfbuzz="yes"
3258             VLC_ADD_CPPFLAGS([skins2], [${HARFBUZZ_CFLAGS} -DHAVE_HARFBUZZ])
3259             VLC_ADD_LIBS([skins2], [${HARFBUZZ_LIBS}])
3260           ],[AC_MSG_WARN([${HARFBUZZ_PKG_ERRORS}. Support for complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3261         fi
3262       fi
3263   ],[
3264   AS_IF([test -n "${enable_freetype}"],[
3265     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3266     ])
3267   ])
3270 AM_CONDITIONAL([HAVE_FREETYPE], [test "${have_freetype}" = "yes"])
3271 AM_CONDITIONAL([HAVE_FONTCONFIG], [test "${have_fontconfig}" = "yes"])
3272 AM_CONDITIONAL([HAVE_FRIBIDI], [test "${have_fribidi}" = "yes"])
3273 AM_CONDITIONAL([HAVE_HARFBUZZ], [test "${have_harfbuzz}" = "yes"])
3276 dnl SAPI (text to Speech renderer for Windows)
3278 AC_LANG_PUSH([C++])
3279 AC_CHECK_TYPES([ISpObjectToken],[
3280               have_sapi="yes"
3281             ],[AC_MSG_WARN([sapi.h not found. Text to Speech renderer for Windows disabled])],
3282               [#include <windows.h>
3283                #include <sapi.h>
3284                #include <sphelper.h>])
3285 AM_CONDITIONAL([HAVE_SAPI], [test "${have_sapi}" = "yes"])
3286 AC_LANG_POP([C++])
3289 dnl  QuartzText vout module (iOS/Mac OS)
3291 AC_ARG_ENABLE(macosx-quartztext,
3292   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3293 if test "x${enable_macosx_quartztext}" != "xno" &&
3294   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3295 then
3296   VLC_ADD_PLUGIN([quartztext])
3300 dnl  SVG module (text rendering and image decoding)
3302 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3303 PKG_ENABLE_MODULES_VLC([SVGDEC], [], [librsvg-2.0 >= 2.9.0 cairo >= 1.13.1], [SVG image decoder library],[auto])
3306 dnl  Windows DirectX module
3309 AC_ARG_ENABLE(directx,
3310   [AS_HELP_STRING([--enable-directx],
3311     [Microsoft DirectX support (default enabled on Windows)])],, [
3312   AS_IF([test "${SYS}" = "mingw32"], [
3313     enable_directx="yes"
3314   ], [
3315     enable_directx="no"
3316   ])
3318 AS_IF([test "${enable_directx}" != "no"], [
3319   dnl DirectDraw
3320   AC_CHECK_HEADERS(ddraw.h, [
3321     VLC_ADD_PLUGIN([directdraw])
3322   ])
3324   dnl OpenGL
3325   AC_CHECK_HEADERS(GL/wglew.h, [
3326     VLC_ADD_PLUGIN([glwin32, wgl])
3327   ],, [
3328     #include <windows.h>
3329     #include <GL/gl.h>
3330   ])
3332   dnl Direct3D11
3333   AC_CHECK_HEADERS(d3d11.h, [
3334     VLC_ADD_PLUGIN([direct3d11])
3335   ])
3337   dnl Direct3D9
3338   AC_CHECK_HEADERS(d3d9.h, [
3339     VLC_ADD_PLUGIN([direct3d9])
3340   ])
3342   dnl Direct2D
3343   AC_CHECK_HEADERS(d2d1.h, [
3344     VLC_ADD_PLUGIN([direct2d])
3345   ])
3349 dnl  Linux framebuffer module
3351 AC_CHECK_HEADER([linux/fb.h], [
3352   VLC_ADD_PLUGIN([fb])
3357 dnl  DirectFB module
3358 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3359 dnl  TODO: support for static linking
3361 AC_ARG_ENABLE(directfb,
3362   [  --enable-directfb       DirectFB support (default disabled)])
3363 AC_ARG_WITH(directfb,
3364   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3366 if test "${enable_directfb}" = "yes"; then
3367     have_directfb="false"
3368     CPPFLAGS_mydirectfb=
3369     LIBS_mydirectfb=
3370     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3371         dnl Trying the given location
3372         VLC_SAVE_FLAGS
3374         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3375         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3377         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3378         LIBS="${LIBS} ${LIBS_new}"
3380         dnl FIXME: too obscure
3381         AC_CHECK_HEADER([directfb.h], [
3382             AC_CHECK_LIB([direct],[direct_initialize], [
3383                 AC_CHECK_LIB([fusion], [fusion_enter], [
3384                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3385                 ], have_directfb="false")
3386             ], have_directfb="false")
3387         ], have_directfb="false")
3389         VLC_RESTORE_FLAGS
3391         if test "${have_directfb}" = "true"; then
3392             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3393             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3394         fi
3395     else
3396         dnl Look for directfb-config
3397         AC_CHECK_PROG(DIRECTFB_CONFIG, [directfb-config], [false])
3398         AS_IF(["${DIRECTFB_CONFIG}" != "false"], [
3399             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3400             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3401             have_directfb="true"
3402         ], [
3403             dnl Trying with pkg-config
3404             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3405                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3406                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3407                 have_directfb="true"
3408                 ], [have_directfb="false"])
3409         ])
3410     fi
3411     if test "${have_directfb}" = "true"; then
3412         VLC_ADD_PLUGIN([directfb])
3413         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3414         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3415     else
3416         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3417     fi
3421 dnl  AA plugin
3423 AC_ARG_ENABLE(aa,
3424   [  --enable-aa             aalib output (default disabled)])
3425 if test "${enable_aa}" = "yes"
3426 then
3427   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3428   if test "${have_aa}" = "true"
3429   then
3430     VLC_ADD_PLUGIN([aa])
3431   fi
3435 dnl  libcaca plugin
3437 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3440 dnl  OS/2 KVA plugin
3442 AC_ARG_ENABLE(kva,
3443   [AS_HELP_STRING([--enable-kva],
3444     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3445   AS_IF([test "$SYS" = "os2"], [
3446     enable_kva="yes"
3447   ])
3449 have_kva="no"
3450 KVA_LIBS=""
3451 AS_IF([test "$enable_kva" != "no"], [
3452   AC_CHECK_HEADERS([kva.h], [
3453     have_kva="yes"
3454     AC_CHECK_LIB(kva, main, [
3455       KVA_LIBS="-lkva"
3456     ])
3457   ])
3459 AC_SUBST(KVA_LIBS)
3460 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3463 dnl MMAL plugin
3465 AC_ARG_ENABLE(mmal,
3466   AS_HELP_STRING([--enable-mmal],
3467     [Multi-Media Abstraction Layer (MMAL) hardware plugin (default enable)]))
3468 if test "${enable_mmal}" != "no"; then
3469   VLC_SAVE_FLAGS
3470   LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
3471   CPPFLAGS="${CPPFLAGS} -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
3472   AC_CHECK_HEADERS(interface/mmal/mmal.h,
3473     [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
3474         have_mmal="yes"
3475         VLC_ADD_PLUGIN([mmal])
3476         VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
3477         VLC_ADD_CFLAGS([mmal],[ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux ])
3478         VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lvchostif ]) ], [
3479           AS_IF([test "${enable_mmal}" = "yes"],
3480             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
3481             [ AC_MSG_WARN([Cannot find bcm library...]) ])
3482           ],
3483         [])
3484     ] , [ AS_IF([test "${enable_mmal}" = "yes"],
3485       [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
3486       [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
3487   VLC_RESTORE_FLAGS
3489 AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
3492 dnl evas plugin
3494 AC_ARG_ENABLE(evas,
3495   [AS_HELP_STRING([--enable-evas],
3496     [use evas output module (default disabled)])])
3497 have_evas="no"
3498 AS_IF([test "${enable_evas}" = "yes"], [
3499   PKG_CHECK_MODULES(EVAS, [evas >= 1.15.99 ecore >= 1.15.99], [
3500       have_evas="yes"
3501       AC_DEFINE([HAVE_EVAS], [1], [Define to 1 if evas is enabled.])
3502     ],[
3503     AS_IF([test "x${enable_evas}" != "x"], [
3504       AC_MSG_ERROR([$EVAS_PKG_ERRORS. libevas and libecore 1.15.99 or later required.])
3505     ])
3506   ])
3508 AM_CONDITIONAL([HAVE_EVAS], [test "${have_evas}" = "yes"])
3511 dnl  Audio plugins
3514 EXTEND_HELP_STRING([Audio plugins:])
3517 dnl  Pulseaudio module
3519 AC_ARG_ENABLE(pulse,
3520   [AS_HELP_STRING([--enable-pulse],
3521     [use the PulseAudio client library (default auto)])])
3522 have_pulse="no"
3523 AS_IF([test "${enable_pulse}" != "no"], [
3524   PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0], [
3525     have_pulse="yes"
3526   ], [
3527     AS_IF([test "x${enable_pulse}" != "x"], [
3528       AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 1.0 or later required.])
3529     ])
3530   ])
3532 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3535 dnl  ALSA module
3537 AC_ARG_ENABLE(alsa,
3538   [AS_HELP_STRING([--enable-alsa],
3539     [support the Advanced Linux Sound Architecture (default auto)])],, [
3540   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3541     enable_alsa="yes"
3542   ])
3544 have_alsa="no"
3545 AS_IF([test "${enable_alsa}" != "no"], [
3546   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3547     have_alsa="yes"
3548   ], [
3549     AS_IF([test "x${enable_alsa}" != "x"], [
3550       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3551     ])
3552   ])
3554 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3557 dnl  Open Sound System module
3559 AC_ARG_ENABLE(oss,
3560   [AS_HELP_STRING([--enable-oss],
3561     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3562   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3563     enable_oss="no"
3564   ])
3566 have_oss="no"
3567 OSS_LIBS=""
3568 AS_IF([test "$enable_oss" != "no"], [
3569   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3570     have_oss="yes"
3571     AC_CHECK_LIB(ossaudio, main, [
3572       OSS_LIBS="-lossaudio"
3573     ])
3574   ])
3576 AC_SUBST(OSS_LIBS)
3577 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3580 dnl  OpenBSD sndio module
3582 AC_ARG_ENABLE([sndio],
3583   [AS_HELP_STRING([--disable-sndio],
3584     [support the OpenBSD sndio (default auto)])],, [
3585   AS_IF([test "$SYS" = "openbsd"], [
3586     enable_sndio="yes"
3587   ])
3589 have_sndio="no"
3590 AS_IF([test "$enable_sndio" != "no"], [
3591   AC_CHECK_HEADER([sndio.h], [
3592     have_sndio="yes"
3593   ])
3595 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3598 dnl  Windows Audio Session plugin
3600 AC_ARG_ENABLE([wasapi],
3601   [AS_HELP_STRING([--enable-wasapi],
3602     [use the Windows Audio Session API (default auto)])
3604 have_wasapi="no"
3605 AS_IF([test "$enable_wasapi" != "no"], [
3606   AC_CHECK_HEADER([audioclient.h], [
3607     have_wasapi="yes"
3608   ], [
3609     AS_IF([test "x${enable_wasapi}" != "x"], [
3610       AC_MSG_ERROR([Windows Audio Session API not found.])
3611     ])
3612   ])
3614 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3617 dnl  AudioQueue plugin
3619 AC_ARG_ENABLE(audioqueue,
3620   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3621 if test "${enable_audioqueue}" = "yes"
3622 then
3623   VLC_ADD_PLUGIN([audioqueue])
3627 dnl  JACK modules
3629 AC_ARG_ENABLE(jack,
3630   [AS_HELP_STRING([--disable-jack],
3631     [do not use jack (default auto)])])
3632 have_jack="no"
3633 AS_IF([test "${enable_jack}" != "no"], [
3634     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3635       [ have_jack=yes ],
3636       [
3637       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3639       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3640       [ have_jack=yes ],
3641       [
3642       AS_IF([test -n "${enable_jack}"],
3643          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3644          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3645       ])
3646     ])
3648 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3651 dnl  OpenSLES Android
3653 AC_ARG_ENABLE(opensles,
3654   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3655 if test "${HAVE_ANDROID}" = "1"; then
3656   if test "${enable_opensles}" = "yes"; then
3657       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3658         [ VLC_ADD_PLUGIN([opensles_android]) ],
3659         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3660   fi
3664 dnl  Tizen audio
3666 AC_ARG_ENABLE(tizen_audio,
3667   [AS_HELP_STRING([--enable-tizen-audio],
3668     [Tizen audio module (default enabled on Tizen)])],, [
3669   AS_IF([test "$HAVE_TIZEN" = "1"], [
3670     enable_tizen_audio="yes"
3671   ])
3673 if test "${enable_tizen_audio}" = "yes"; then
3674   AC_CHECK_HEADERS(audio_io.h,
3675     [ VLC_ADD_PLUGIN([tizen_audio]) ],
3676     [ AC_MSG_ERROR([cannot find Tizen audio_io headers])] )
3680 dnl libsamplerate plugin
3682 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3685 dnl  soxr module
3687 PKG_ENABLE_MODULES_VLC([SOXR], [], [soxr >= 0.1.2], [SoX Resampler library], [auto])
3690 dnl  OS/2 KAI plugin
3692 AC_ARG_ENABLE(kai,
3693   [AS_HELP_STRING([--enable-kai],
3694     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3695   AS_IF([test "$SYS" = "os2"], [
3696     enable_kai="yes"
3697   ])
3699 have_kai="no"
3700 KAI_LIBS=""
3701 AS_IF([test "$enable_kai" != "no"], [
3702   AC_CHECK_HEADERS([kai.h], [
3703     have_kai="yes"
3704     AC_CHECK_LIB(kai, main, [
3705       KAI_LIBS="-lkai"
3706     ])
3707   ])
3709 AC_SUBST(KAI_LIBS)
3710 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3713 dnl  chromaprint audio track fingerprinter
3715 m4_pushdef([libchromaprint_version], 0.6.0)
3716 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3717     VLC_ADD_PLUGIN([stream_out_chromaprint]),
3718     AS_IF([test "${enable_chromaprint}" = "yes"],
3719         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3720         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3721          ),
3722     [(Chromaprint based audio fingerprinter)],[auto])
3723 m4_popdef([libchromaprint_version])
3726 dnl  Chromecast streaming support
3728 m4_pushdef([protobuf_lite_version], 2.5.0)
3729 AC_ARG_VAR(PROTOC, [protobuf compiler])
3730 AC_CHECK_PROGS(PROTOC, protoc, no)
3731 PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
3732     AS_IF([test "x${PROTOC}" != "xno"], [
3733         build_chromecast="yes"
3734     ], [
3735     AC_MSG_ERROR(protoc compiler needed for [chromecast] was not found)
3736     ])
3737 ], [
3738     AS_IF([test "${enable_chromecast}" = "yes"],
3739         AC_MSG_ERROR(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found),
3740         AC_MSG_WARN(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found)
3741     )
3742     enable_chromecast="no"
3743 ], [(Chromecast streaming support)], [auto])
3744 AM_CONDITIONAL([BUILD_CHROMECAST], [test "${build_chromecast}" = "yes"])
3745 m4_popdef([protobuf_lite_version])
3748 dnl  Interface plugins
3751 EXTEND_HELP_STRING([Interface plugins:])
3754 dnl QT
3756 AC_ARG_ENABLE(qt, [
3757   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3758   AS_IF([test "${SYS}" = "darwin"], [
3759     enable_qt="no"
3760   ])
3762 AS_IF([test "${enable_qt}" != "no"], [
3763   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.2.0 Qt5Widgets Qt5Gui], [
3764       PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
3765           VLC_ADD_LIBS([qt],[${QTX11_LIBS}])
3766           VLC_ADD_CXXFLAGS([qt],[${QTX11_CFLAGS} -DQT5_HAS_X11])
3767           PKG_CHECK_MODULES([XI], [xi], [
3768             VLC_ADD_LIBS([qt], [${XI_LIBS}])
3769             VLC_ADD_CXXFLAGS([qt], [${XI_CFLAGS} -DHAVE_XI])
3770           ], [
3771             PKG_CHECK_EXISTS([Qt5Gui >= 5.5], [
3772               AC_MSG_ERROR([${XI_PKG_ERRORS}.])
3773             ], [
3774               AC_MSG_WARN([${XI_PKG_ERRORS}.])
3775             ])
3776           ])
3777       ],[
3778           AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
3779       ])
3780       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3781       QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
3782       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3783       AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3784       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
3785     ], [
3786       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.8.0],, [
3787         AS_IF([test -n "${enable_qt}"],[
3788           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3789         ],[
3790           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3791         ])
3792         enable_qt="no"
3793       ])
3794       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3795       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin"])
3796       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin])
3797       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin"])
3798     ])
3800 AS_IF([test "${enable_qt}" != "no"], [
3801   VLC_ADD_PLUGIN([qt])
3802   ALIASES="${ALIASES} qvlc"
3804 AM_CONDITIONAL(ENABLE_QT, [test "$enable_qt" != "no"])
3807 dnl detect kde4-config patch (used for kde solids and kwallet).
3809 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
3810 AS_IF([test "x$KDE4_CONFIG" = "x"], [
3811   KDE4_CONFIG="kde4-config"
3815 dnl Simple test for skins2 dependency
3817 AS_IF([test "$enable_qt" = "no"], [
3818   AS_IF([test "${enable_skins2}" = "yes"], [
3819     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.])
3820   ], [
3821     enable_skins2="no"
3822     AC_MSG_WARN([The skins2 module depends on the Qt interface, Qt is not built so skins2 is disabled.])
3823   ])
3827 dnl Skins2 module
3829 AC_ARG_ENABLE(skins2,
3830   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3831 AS_IF([test "${enable_skins2}" != "no"], [
3832   have_skins_deps="yes"
3834   dnl Win32
3835   AS_IF([test "${SYS}" = "mingw32"], [
3836     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3837     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3838   dnl MacOS
3839   ], [test "${SYS}" = "darwin"], [
3840     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3841     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3842   dnl OS/2
3843   ], [test "${SYS}" = "os2"], [
3844     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3845   dnl Linux/Unix
3846   ], [
3847     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3848     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3849     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3850     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3851     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3852   ])
3854   dnl for All OSes
3855   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3857   dnl we need freetype
3858   AS_IF([test "${have_freetype}" != "yes"], [
3859     have_skins_deps="no"
3860   ])
3862   AS_IF([test "${have_skins_deps}" = "no"], [
3863     AS_IF([test "x${enable_skins2}" = "x"], [
3864       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3865     ], [
3866       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3867     ])
3868     enable_skins2="no"
3869   ], [
3870     VLC_ADD_PLUGIN([skins2])
3871     ALIASES="${ALIASES} svlc"
3872     enable_skins2="yes"
3873   ])
3875 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3877 AC_ARG_ENABLE(libtar,
3878   [  --enable-libtar         libtar support for skins2 (default auto)])
3879 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3880   AC_CHECK_HEADERS(libtar.h, [
3881     VLC_ADD_LIBS([skins2],[-ltar])
3882   ])
3886 dnl  MacOS X gui module
3888 AC_ARG_ENABLE(macosx,
3889   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3890 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3891 then
3892   VLC_ADD_PLUGIN([macosx])
3894   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3895   then
3896     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3897   fi
3899 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3902 dnl  MacOS X sparkle update support
3904 AC_ARG_ENABLE(sparkle,
3905   [  --enable-sparkle        Sparkle update support for OS X (default enabled on Mac OS X)])
3906 if test "x${enable_sparkle}" != "xno" -a "${HAVE_OSX}" = "1"
3907 then
3908   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3909   then
3910     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3911   fi
3913   AC_DEFINE([HAVE_SPARKLE], [1], [Define to 1 if sparkle is enabled.])
3915 AM_CONDITIONAL(HAVE_SPARKLE, [test "$enable_sparkle" != "no"])
3919 dnl  Minimal Mac OS X module
3921 AC_ARG_ENABLE(minimal-macosx,
3922   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3923 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3924 then
3925   VLC_ADD_PLUGIN([minimal_macosx])
3929 dnl  VideoToolbox plugins
3930 AC_CHECK_HEADERS(VideoToolbox/VideoToolbox.h, [
3931     VLC_ADD_PLUGIN([videotoolbox])
3932     VLC_ADD_PLUGIN([cvpx_i420])
3933   ])
3936 dnl  ncurses module
3938 AC_ARG_ENABLE(ncurses,
3939 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3940 have_ncurses="no"
3941 AS_IF([test "${enable_ncurses}" != "no"] ,[
3942   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3943     have_ncurses="yes"
3944     ALIASES="${ALIASES} nvlc"
3945   ], [
3946     AS_IF([test -n "${enable_ncurses}"], [
3947       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3948     ])
3949   ])
3951 AM_CONDITIONAL([HAVE_NCURSES], [test "${have_ncurses}" = "yes"])
3954 dnl  Lirc plugin
3956 AC_ARG_ENABLE(lirc,
3957   [  --enable-lirc           lirc support (default disabled)])
3958 have_lirc="no"
3959 AS_IF([test "${enable_lirc}" = "yes"], [
3960   AC_CHECK_HEADER(lirc/lirc_client.h, [
3961     AC_CHECK_LIB(lirc_client, lirc_init, [
3962       have_lirc="true"
3963     ])
3964   ])
3966 AM_CONDITIONAL([HAVE_LIRC], [test "${have_lirc}" = "yes"])
3968 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3970 dnl  goom visualization plugin
3972 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3975 dnl libprojectM visualization plugin
3977 AC_ARG_ENABLE(projectm,
3978   [  --enable-projectm       projectM visualization plugin (default enabled)])
3979 AS_IF([test "${enable_projectm}" != "no"],
3980   [
3981     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3982     [
3983       VLC_ADD_PLUGIN([projectm])
3984       PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
3985         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3986         [ AC_MSG_WARN( [Using libprojectM version 1] )
3987       ])
3988     ],[
3989       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3990     ])
3991   ])
3994 dnl Vovoid VSXu visualization plugin
3996 AC_ARG_ENABLE(vsxu,
3997   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3998 AS_IF([test "${enable_vsxu}" != "no"],
3999   [
4000     PKG_CHECK_MODULES(VSXU, libvsxu,
4001     [
4002       VLC_ADD_PLUGIN([vsxu])
4003     ],[
4004       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
4005     ])
4006   ])
4008 EXTEND_HELP_STRING([Service Discovery plugins:])
4010 dnl  Avahi-Zeroconf services discovery
4011 PKG_ENABLE_MODULES_VLC([AVAHI], [], [avahi-client >= 0.6], [Zeroconf services discovery], [auto])
4014 dnl  libudev services discovery
4015 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
4018 dnl MTP devices services discovery
4019 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
4022 dnl UPnP Plugin (Intel SDK)
4024 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
4027 dnl mDNS using libmicrodns
4029 PKG_ENABLE_MODULES_VLC([MICRODNS], [], [microdns], [mDNS services discovery], [auto])
4032 EXTEND_HELP_STRING([Misc options:])
4035 dnl  libxml2 module
4037 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
4041 dnl libgcrypt
4043 AC_ARG_ENABLE(libgcrypt,
4044   [  --disable-libgcrypt     gcrypt support (default enabled)])
4045 AC_ARG_VAR([GCRYPT_CFLAGS], [C compiler flags for gcrypt])
4046 AC_ARG_VAR([GCRYPT_LIBS], [linker flags flags for gcrypt])
4048 # require libgcrypt >= 1.6.0
4049 AS_IF([test "${enable_libgcrypt}" != "no"], [
4050   AC_CACHE_CHECK([for gcrypt 1.6.0 or later], [ac_cv_lib_gcrypt], [
4051     VLC_SAVE_FLAGS
4052     CFLAGS="${CFLAGS} ${GCRYPT_CFLAGS}"
4053     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
4054 [#include <gcrypt.h>
4055 #if GCRYPT_VERSION_NUMBER < 0x010600
4056 #error
4057 #endif]])], [
4058       ac_cv_lib_gcrypt=yes
4059     ], [
4060       ac_cv_lib_gcrypt=no
4061     ])
4062     VLC_RESTORE_FLAGS
4063   ])
4065   AS_IF([test "${ac_cv_lib_gcrypt}" = "yes"], [
4066     AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
4067   ], [
4068     AS_IF([test "${enable_libgcrypt}" = "yes"], [
4069       AC_MSG_ERROR([libgcrypt version 1.6.0 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
4070     ])
4071   ])
4074 AS_IF([test -z "$GCRYPT_LIBS"], [
4075   GCRYPT_LIBS="-lgcrypt -lgpg-error"
4078 AC_SUBST(GCRYPT_CFLAGS)
4079 AC_SUBST(GCRYPT_LIBS)
4080 AM_CONDITIONAL([HAVE_GCRYPT], [test "${ac_cv_lib_gcrypt}" = "yes"])
4083 dnl TLS/SSL
4085 AC_ARG_ENABLE(gnutls,
4086   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4087 AS_IF([test "${enable_gnutls}" != "no"], [
4088   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.2.0], [
4089     VLC_ADD_PLUGIN([gnutls])
4090   ], [
4091     AS_IF([test -n "${enable_gnutls}"], [
4092       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4093     ])
4094   ])
4099 dnl Taglib plugin
4101 AC_ARG_ENABLE(taglib,
4102   [AS_HELP_STRING([--disable-taglib],
4103     [do not use TagLib (default enabled)])])
4104 AS_IF([test "${enable_taglib}" != "no"], [
4105   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.9, [
4106     VLC_ADD_PLUGIN([taglib])
4107   ], [
4108     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4112 dnl  libsecret
4114 PKG_ENABLE_MODULES_VLC([SECRET], [], [libsecret-1 >= 0.18], [use libsecret for keystore], [auto])
4117 dnl  Developers helper modules (should be hidden from configure help)
4119 AC_ARG_ENABLE(devtools, [], [], [enable_devtools="no"])
4120 AS_IF([test "${enable_devtools}" != "no"], [
4121   VLC_ADD_PLUGIN([accesstweaks])
4125 dnl update checking system
4127 AC_ARG_ENABLE(update-check,
4128   [  --enable-update-check   update checking system (default disabled)])
4129 if test "${enable_update_check}" = "yes"
4130 then
4131   if test "${have_libgcrypt}" != "yes"
4132   then
4133     AC_MSG_ERROR([libgcrypt is required for update checking system])
4134   fi
4135   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4136   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4137   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4141 dnl OS X notification plugin
4143 AC_ARG_ENABLE(osx_notifications,
4144   [  --enable-osx-notifications          osx notification plugin (default disabled)],,
4145   [enable_osx_notifications=no])
4146 AS_IF([test "${enable_osx_notifications}" != "no"], [
4147     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4148       VLC_ADD_PLUGIN([osx_notifications])
4149       VLC_ADD_LIBS([osx_notifications], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4150       VLC_ADD_OBJCFLAGS([osx_notifications], [-F${CONTRIB_DIR}])
4151       VLC_ADD_OBJCFLAGS([osx_notifications], [-fobjc-exceptions] )
4152     ])
4153   ]
4157 dnl Libnotify notification plugin
4159 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4162 dnl  Endianness check
4164 AC_C_BIGENDIAN
4165 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4166   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4167 ], [
4168   DEFS_BIGENDIAN=""
4170 AC_SUBST(DEFS_BIGENDIAN)
4173 dnl Where to install KDE solid .desktop
4175 AC_ARG_WITH(kde-solid,
4176   AS_HELP_STRING([--with-kde-solid=PATH],
4177                  [KDE Solid actions directory (auto)]),, [
4179 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4180   with_kde_solid="yes"
4183 soliddatadir=""
4184 AS_IF([test "${with_kde_solid}" != "no"], [
4185   AS_IF([test "${with_kde_solid}" = "yes"], [
4186     kde4datadir="`${KDE4_CONFIG} --install data`"
4187     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4188     soliddatadir="${kde4datadir}/solid/actions"
4189   ], [
4190     soliddatadir="${with_kde_solid}"
4191   ])
4193 AC_SUBST(soliddatadir)
4194 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4196 EXTEND_HELP_STRING([Components:])
4199 dnl  the VLC binary
4201 AC_ARG_ENABLE(vlc,
4202   [  --enable-vlc            build the VLC media player (default enabled)])
4203 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4205 AC_ARG_ENABLE(macosx-vlc-app,
4206   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4207 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4208     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4211 dnl  Stuff used by the program
4213 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4214 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4215 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4216 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4217 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4218 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4219 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4220 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4221 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4222 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4223 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4224 AC_SUBST(COPYRIGHT_MESSAGE)
4225 AC_SUBST(VERSION_MESSAGE)
4226 AC_SUBST(VERSION_MAJOR)
4227 AC_SUBST(VERSION_MINOR)
4228 AC_SUBST(VERSION_REVISION)
4229 AC_SUBST(VERSION_EXTRA)
4230 AC_SUBST(COPYRIGHT_YEARS)
4231 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4232 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4233 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4235 dnl  Handle substvars that use $(top_srcdir)
4237 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4240 dnl  Configuration is finished
4242 AC_SUBST(SYS)
4243 AC_SUBST(ARCH)
4244 AC_SUBST(ALIASES)
4245 AC_SUBST(ASM)
4246 AC_SUBST(MOC)
4247 AC_SUBST(RCC)
4248 AC_SUBST(UIC)
4249 AC_SUBST(WINDRES)
4250 AC_SUBST(WINE_SDK_PATH)
4251 AC_SUBST(LIBEXT)
4252 AC_SUBST(AM_CPPFLAGS)
4253 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4254 AC_SUBST(FILE_LIBVLCCORE_DLL)
4255 AC_SUBST(FILE_LIBVLC_DLL)
4257 AC_CONFIG_FILES([
4258   Makefile
4259   doc/Makefile
4260   modules/Makefile
4261   m4/Makefile
4262   po/Makefile.in
4263   share/Makefile
4264   compat/Makefile
4265   src/Makefile
4266   lib/Makefile
4267   bin/Makefile
4268   test/Makefile
4269   modules/gui/macosx/Makefile
4270   modules/gui/qt/Makefile
4271   modules/gui/skins2/Makefile
4272   modules/hw/mmal/Makefile
4275 AM_COND_IF([HAVE_WIN32], [
4276   AC_CONFIG_FILES([
4277     extras/package/win32/NSIS/spad.nsi
4278     extras/package/win32/NSIS/vlc.win32.nsi
4279     extras/package/win32/msi/config.wxi
4280   ])
4283 AM_COND_IF([HAVE_DARWIN], [
4284   AC_CONFIG_FILES([
4285     extras/package/macosx/Info.plist
4286     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4287   ])
4290 dnl Generate makefiles
4291 AC_OUTPUT
4293 dnl Do we have to use make or gmake ?
4294 if make --version 2>&1|grep -q GNU
4295 then
4296     # GNU make, all seems good
4297     MAKE=make
4298 else
4299     # Known GNU make alias (on BSD)
4300     MAKE=gmake
4302 dnl Shortcut to nice compile message
4303 if test -n $SHELL; then
4304   SHELL=${CONFIG_SHELL-/bin/sh}
4306 rm -f compile
4307 compile_top_srcdir=`sed -ne "s/^top_srcdir *= *//p" < Makefile`
4308 echo "#! $SHELL
4309 rm -f .error\$\$
4310 ERROR=0
4311 export PATH=\"$PATH\" LANG=C
4312 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| $compile_top_srcdir/extras/buildsystem/make.pl
4313 test -f .error\$\$ && ERROR=1
4314 rm -f .error\$\$
4315 exit \$ERROR" >compile
4316 chmod a+x compile
4318 echo "
4319 libvlc configuration
4320 --------------------
4321 version               : ${VERSION}
4322 system                : ${SYS}
4323 architecture          : ${ARCH}
4324 optimizations         : ${enable_optimizations}"
4325 if test "${enable_vlc}" != "no"; then
4326 echo "vlc aliases           :${ALIASES}"
4327 else
4328 echo "build vlc executable  : no"
4330 echo "
4331 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."