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