dvb: use xrealloc()
[vlc.git] / configure.ac
blobc46120d7f2a7d49d68d488d617e071148b8c5595
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     AC_LIBOBJ([gai_strerror])
294     ;;
295   *)
296     SYS="${host_os}"
297     ;;
298 esac
299 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
300 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
301 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
302 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
303 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1")
304 AM_CONDITIONAL(HAVE_IOS,     test "${HAVE_IOS}" = "1")
305 AM_CONDITIONAL(HAVE_OSX,     test "${HAVE_OSX}" = "1")
306 AM_CONDITIONAL(HAVE_TVOS,    test "${HAVE_TVOS}" = "1")
309 dnl Sadly autoconf does not think about testing foo.exe when ask to test
310 dnl for program foo on win32
311 case "${build_os}" in
312     cygwin|msys)
313         ac_executable_extensions=".exe"
314     ;;
315     os2*)
316         BUILDEXEEXT=".exe"
317     ;;
318     *)
319     ;;
320 esac
321 AC_SUBST(BUILDEXEEXT)
323 dnl Android is linux, but a bit different
324 AS_IF([test "$SYS" = linux],[
325     AC_MSG_CHECKING([for an Android system])
326     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
327         [[#ifndef __ANDROID__
328          # error Not Android
329          #endif
330         ]],[[;]])
331     ],[
332       HAVE_ANDROID="1"
333       AC_MSG_RESULT([yes])
334     ],[
335       AC_MSG_RESULT([no])
336     ])
338 AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
340 dnl Tizen (minimum SDK version: 2.3)
341 AS_IF([test "$SYS" = linux],[
342     AC_MSG_CHECKING([for Tizen])
343     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
344         [[#include <tizen.h>
345         ]],[[;]])
346     ],[
347       HAVE_TIZEN="1"
348       AC_DEFINE([HAVE_TIZEN_SDK], [1], [Define to 1 if vlc is built against Tizen SDK])
349       AC_MSG_RESULT([yes])
350     ],[
351       AC_MSG_RESULT([no])
352     ])
354 AM_CONDITIONAL(HAVE_TIZEN, test "${HAVE_TIZEN}" = "1")
357 dnl  Check for the contrib directory
359 AC_ARG_WITH(contrib,
360   [AS_HELP_STRING([--with-contrib[=DIR]],
361     [search for 3rd party libraries in DIR/include and DIR/lib])
363 AC_MSG_CHECKING([for 3rd party libraries path])
364 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
365   CONTRIB_DIR="${srcdir}/contrib/${host}"
366   AS_IF([test ! -d "${CONTRIB_DIR}"], [
367     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
368     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
369     AS_IF([test ! -d "${CONTRIB_DIR}"], [
370       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
371       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
372       AS_IF([test ! -d "${CONTRIB_DIR}"], [
373         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
374         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
375         AS_IF([test ! -d "${CONTRIB_DIR}"], [
376           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
377           CONTRIB_DIR=""
378           AC_MSG_RESULT([not found])
379         ])
380       ])
381     ])
382   ])
383 ], [
384   AS_IF([test "${with_contrib}" != "no"], [
385     CONTRIB_DIR="${with_contrib}"
386   ], [
387     CONTRIB_DIR=""
388     AC_MSG_RESULT([disabled])
389   ])
391 AS_IF([test -n "${CONTRIB_DIR}"], [
392   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
393     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
394   ], [
395     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
396     CONTRIB_DIR=""
397     AC_MSG_RESULT([not usable])
398   ])
401 AS_IF([test -n "${CONTRIB_DIR}"], [
402   AC_MSG_RESULT([${CONTRIB_DIR}])
403   export PATH=${CONTRIB_DIR}/bin:$PATH
404   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
405   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
406   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
407   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
408   export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
409   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
411   AS_IF([test "${SYS}" = "darwin"], [
412     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
413     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
414   ])
415 ], [
416   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
417     AC_MSG_ERROR([Third party libraries not found!])
418   ])
420 AC_SUBST(CONTRIB_DIR)
422 dnl Add extras/tools to the PATH
423 TOOLS_DIR="${srcdir}/extras/tools/build/bin"
424 AS_IF([test -d "${TOOLS_DIR}"], [
425     TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
426     export PATH="${TOOLS_DIR}":$PATH
430 dnl  Libtool
431 dnl  It's very bad, but our former custom system was worst
432 dnl  -- Courmisch
435 dnl override platform specific check for dependent libraries
436 dnl otherwise libtool linking of shared libraries will
437 dnl fail on anything other than pass_all.
438 AC_CACHE_VAL(lt_cv_deplibs_check_method,
439     [lt_cv_deplibs_check_method=pass_all])
441 LT_INIT([dlopen win32-dll shared disable-static])
442 LT_LANG([C++])
443 LT_LANG([Windows Resource])
445 DOLT
447 lt_cv_deplibs_check_method=pass_all
449 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
450   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
454 dnl Gettext stuff
456 AM_GNU_GETTEXT_VERSION([0.19.6])
457 AM_GNU_GETTEXT([external], [need-formatstring-macros])
460 dnl Iconv stuff
462 AM_ICONV
465 dnl checks for mingw
466 AS_IF([test "${SYS}" = "mingw32"], [
468 dnl Check for broken versions of mingw-runtime compatability library
469     AC_MSG_CHECKING(for broken mingw-runtime)
470     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
471 #include <_mingw.h>
472 #if defined(__MINGW64_VERSION_MAJOR)
473 # if __MINGW64_VERSION_MAJOR < 3
474 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
475 # endif
476 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
477 # error Attempting to use mingw-runtime with broken vsnprintf support
478 #endif
479     ])], [
480         AC_MSG_RESULT([ok])
481     ], [
482         AC_MSG_RESULT([present])
483         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
484     ])
486     dnl force use of mingw provided c99 *printf over msvcrt
487     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
489     dnl Add WinMainCRTStartup entry point to show it's a WinMain application
490     VLC_ADD_LDFLAGS([vlc],[-mwindows])
492     dnl Check for the need to include the mingwex lib for mingw32
493     VLC_SAVE_FLAGS
494     AC_CHECK_LIB(mingwex,opendir,
495         AC_CHECK_LIB(mingw32,opendir,,
496             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
497     )
498     VLC_RESTORE_FLAGS
500     dnl Check for fnative-struct or mms-bitfields support for mingw32
501     VLC_SAVE_FLAGS
502     CFLAGS="${CFLAGS} -mms-bitfields"
503     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
504     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
505         [ac_cv_c_mms_bitfields],
506         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
507     if test "${ac_cv_c_mms_bitfields}" = "no"; then
508         VLC_RESTORE_FLAGS
509         CFLAGS="${CFLAGS} -fnative-struct"
510         CXXFLAGS="${CXXFLAGS} -fnative-struct"
511         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
512             [ac_cv_c_fnative_struct],
513             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
514         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
515     fi
518 AC_ARG_ENABLE(winstore_app,
519      AS_HELP_STRING([--enable-winstore-app],
520                     [Build targetted for Windows Store apps (default disabled)]))
522 vlc_winstore_app=0
523 AS_IF([test "${SYS}" = "mingw32"],[
524   AS_IF([test "${enable_winstore_app}" = "yes"], [
525     vlc_winstore_app=1
526      VLC_ADD_LIBS([libvlccore], [-lole32 -lruntimeobject])
527     ],[
528      VLC_ADD_LIBS([libvlccore],[-lwinmm])
529     ])
530   ])
531 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
532 AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])
536 dnl Buggy glibc prevention. Purposedly not cached.
537 dnl See sourceware.org bugs 5058 and 5443.
538 dnl Ubuntu alone has 20 bug numbers for this...
540 AC_MSG_CHECKING(for buggy GNU/libc versions)
541 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
542 #include <limits.h>
543 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
544   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
545 # error GNU/libc with dcgettext killer bug!
546 #endif
547 ])], [
548   AC_MSG_RESULT([not present])
549 ], [
550   AC_MSG_RESULT([found])
551   AS_IF([test "x${enable_nls}" != "xno"], [
552     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
553 work-around for this. Check with your distribution vendor on how to update the
554 glibc run-time. Alternatively, build with --disable-nls.])
555   ])
558 dnl Plugin compilation stuff
560 VLC_LIBRARY_SUFFIX
562 dnl Check for system libs needed
563 need_libc=false
565 dnl Check for usual libc functions
566 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
567 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])
568 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 timegm timespec_get strverscmp])
569 AC_CHECK_FUNCS(fdatasync,,
570   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
573 dnl mingw64 implements those as static inline, not functions with C linkage
574 VLC_REPLACE_DECL([asprintf], [#include <stdio.h>])
575 VLC_REPLACE_DECL([vasprintf], [#include <stdio.h>])
576 VLC_REPLACE_DECL([gmtime_r], [#include <time.h>])
577 VLC_REPLACE_DECL([localtime_r], [#include <time.h>])
579 dnl C11 static_assert()
580 AC_MSG_CHECKING([for static_assert in assert.h])
581 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
582 static_assert(1, "The impossible happened.");
583 ])], [
584   AC_MSG_RESULT([yes])
585   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
586 ], [
587   AC_MSG_RESULT([no])
590 # Windows CE does not have strcoll()
591 AC_FUNC_STRCOLL
593 dnl Check for non-standard system calls
594 case "$SYS" in
595   "linux")
596     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
597     ;;
598   "mingw32")
599     AC_CHECK_FUNCS([_lock_file])
600     ;;
601 esac
603 AH_BOTTOM([#include <vlc_fixups.h>])
605 dnl Check for struct pollfd
606 AC_CHECK_TYPES([struct pollfd],,,
607 [#include <sys/types.h>
608 #if HAVE_POLL
609 # include <poll.h>
610 #elif defined (_WIN32)
611 # include <winsock2.h>
612 #endif
615 dnl Checks for socket stuff
616 VLC_SAVE_FLAGS
617 SOCKET_LIBS=""
618 AC_SEARCH_LIBS(connect, [socket], [
619   AS_IF([test "$ac_cv_search_connect" != "none required"], [
620     SOCKET_LIBS="$ac_cv_search_connect"
621   ])
622 ], [
623   AS_IF([test "${SYS}" = "mingw32"], [
624     SOCKET_LIBS="-lws2_32"
625   ])
628 AC_SEARCH_LIBS([inet_pton], [nsl], [
629  AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [
630     SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS"
631   ])
632 ],, [${SOCKET_LIBS}])
634 LIBS="${LIBS} ${SOCKET_LIBS}"
635 AC_LINK_IFELSE([
636     AC_LANG_PROGRAM([#ifdef _WIN32
637         # if _WIN32_WINNT < 0x600
638         #  error Needs vista+
639         # endif
640         #include <ws2tcpip.h>
641         #else
642         #include <sys/socket.h>
643         #include <arpa/inet.h>
644         #endif], [
645         char dst[[sizeof(struct in_addr)]];
646         inet_pton(AF_INET, "127.0.0.1", dst);
647     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
648 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
649 VLC_RESTORE_FLAGS
650 AC_SUBST(SOCKET_LIBS)
652 dnl Check for socklen_t
653 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
654 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
655 ac_cv_type_socklen_t,
656 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
657 [#include <sys/types.h>
658 #ifdef _WIN32
659 # include <winsock2.h>
660 # include <ws2tcpip.h>
661 #else
662 # include <sys/socket.h>
663 #endif]], [[socklen_t len; len = 0;]])],
664 ac_cv_type_socklen_t=yes,
665 ac_cv_type_socklen_t=no)])
666 AS_IF([test "$ac_cv_type_socklen_t" = no],
667  [AC_DEFINE(socklen_t, int)])
669 dnl Check for struct sockaddr_storage
670 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
671 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
672 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
673   [AC_TRY_COMPILE(
674     [#include <sys/types.h>
675      #if defined( _WIN32 )
676      # include <winsock2.h>
677      #else
678      # include <sys/socket.h>
679      #endif], [struct sockaddr_storage addr;],
680      ac_cv_struct_sockaddr_storage=yes,
681      ac_cv_struct_sockaddr_storage=no)])
682 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
683   AC_DEFINE(sockaddr_storage, sockaddr)
684   AC_DEFINE(ss_family, sa_family)
687 dnl FreeBSD has a gnugetopt library for this:
688 GNUGETOPT_LIBS=""
689 AC_CHECK_FUNC(getopt_long,, [
690   AC_CHECK_LIB([gnugetopt],[getopt_long], [
691     GNUGETOPT_LIBS="-lgnugetopt"
692   ])
694 AC_SUBST(GNUGETOPT_LIBS)
696 AC_CHECK_LIB(m,cos,[
697   LIBM="-lm"
698 ], [
699   LIBM=""
701 AC_SUBST(LIBM)
703 AC_CHECK_LIB(m,lrintf, [
704   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
705   VLC_ADD_LIBS([skins2],[-lm])
707 AC_CHECK_LIB(m,nanf,
708   AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
711 dnl Check for dynamic plugins
712 LIBDL=""
713 have_dynamic_objects="no"
714 VLC_SAVE_FLAGS
715 AC_SEARCH_LIBS(dlsym, [dl svld], [
716   AS_IF([test "$ac_cv_search_dlsym" != "none required"], [
717     LIBDL="$ac_cv_search_dlsym"
718   ])
719   have_dynamic_objects="yes"
721 VLC_RESTORE_FLAGS
723 # Windows
724 AS_IF([test "${SYS}" = "mingw32"], [
725   LIBDL=""
726   have_dynamic_objects="yes" #assume we can use shared objects
729 AS_IF([test "${enable_shared}" = "no"], [
730   have_dynamic_objects=no
732 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
734 AC_SUBST(LIBDL)
736 dnl Check for thread library
737 LIBPTHREAD=""
738 AS_IF([test "${SYS}" != "mingw32"], [
739   VLC_SAVE_FLAGS
740   LIBS=""
741   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
742     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
743       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
744     ])
745   ])
746   VLC_RESTORE_FLAGS
748 AC_SUBST(LIBPTHREAD)
750 AC_SEARCH_LIBS([clock_nanosleep], [rt pthread], [
751   AS_IF([test "$ac_cv_search_clock_nanosleep" != "none required"], [
752     LIBRT="$ac_cv_search_clock_nanosleep"
753   ])
754 ], [
755   AC_SEARCH_LIBS([nanosleep], [rt pthread posix4], [
756     AS_IF([test "$ac_cv_search_nanosleep" != "none required"], [
757       LIBRT="$ac_cv_search_nanosleep"
758     ])
759   ])
761 AC_SUBST(LIBRT)
764 dnl Check for headers
767 dnl  POSIX
768 AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/shm.h sys/socket.h])
769 AC_CHECK_HEADERS([net/if.h], [], [],
771 #include <sys/types.h>
772 #include <sys/socket.h>
774 AC_CHECK_HEADER([syslog.h], [have_syslog="yes"], [have_syslog="no"])
775 AM_CONDITIONAL([HAVE_SYSLOG], [test "$have_syslog" = "yes"])
777 dnl  BSD
778 AC_CHECK_HEADERS([netinet/udplite.h sys/param.h sys/mount.h])
780 dnl  GNU/Linux
781 AC_CHECK_HEADERS([getopt.h linux/dccp.h linux/magic.h mntent.h sys/eventfd.h])
783 dnl  MacOS
784 AC_CHECK_HEADERS([xlocale.h])
786 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
787 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
788 AC_CHECK_TYPE(ssize_t,, [
789   AC_DEFINE(ssize_t, int)
792 dnl It seems that autoconf detects pkg-config only during the first
793 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
794 dnl it is nested within a conditional block, so it was not working right.
795 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
796 AC_ARG_VAR(PKG_CONFIG_PATH,
797        [Paths where to find .pc not at the default location])
798 PKG_PROG_PKG_CONFIG()
800 dnl On some OS we need static linking
801 AS_IF([test -n "${PKG_CONFIG}" ],[
802     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
803         PKG_CONFIG="${PKG_CONFIG} --static"
804     ])
809 dnl Check for zlib.h and -lz along with system -lminizip if available
811 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
812 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
813 if test "${have_zlib}" = "yes"
814 then
815   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
816   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
817     AC_CHECK_HEADERS([unzip.h], [
818       have_minizip=yes
819       MINIZIP_LIBS="-lminizip -lz"
820     ], [
821       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
822       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
823       have_minizip=no
824     ])
825   ])
826   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
827   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
829 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
833 dnl Domain name i18n support via GNU libidn
835 PKG_CHECK_MODULES([IDN], [libidn], [
836   have_libidn="yes"
837   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
838 ], [
839   have_libidn="no"
843 dnl Check for dbus
844 AC_ARG_ENABLE(dbus,
845   [AS_HELP_STRING([--enable-dbus],
846     [compile D-Bus message bus support (default enabled)])])
847 have_dbus="no"
848 AS_IF([test "${enable_dbus}" != "no"], [
849   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
850     have_dbus="yes"
851   ], [
852     AS_IF([test -n "${enable_dbus}"], [
853       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
854     ], [
855       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
856     ])
857   ])
859 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
862 dnl Check for systemd
863 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
864   have_systemd="yes"
865 ], [
866   AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
868 AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
871 dnl Check for ntohl, etc.
872 VLC_SAVE_FLAGS
873 CFLAGS="${CFLAGS} -Wall -Werror"
874 AC_CACHE_CHECK([for ntohl in sys/param.h],
875     [ac_cv_c_ntohl_sys_param_h],
876     [     AC_TRY_COMPILE([#include <sys/param.h>],
877         [int meuh; ntohl(meuh);],
878         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
879 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
880     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
882 VLC_RESTORE_FLAGS
884 EXTEND_HELP_STRING([Optimization options:])
886 dnl  Compiler warnings
889 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])
890 RDC_PROG_CC_FLAGS([-pipe])
891 AC_LANG_PUSH([C++])
892 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
893 AC_LANG_POP([C++])
896 dnl  Debugging mode
898 AC_ARG_ENABLE(debug,
899   [AS_HELP_STRING([--enable-debug],
900     [build with run-time assertions (default disabled)])],,
901   [enable_debug="no"])
902 AH_TEMPLATE(NDEBUG,
903             [Define to 1 if debug code should NOT be compiled])
904 AS_IF([test "${enable_debug}" != "no"], [
905   AC_CHECK_HEADERS([valgrind/valgrind.h])
906 ], [
907   AC_DEFINE(NDEBUG)
911 dnl  Profiling
913 AC_ARG_ENABLE(gprof,
914   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
915   [enable_gprof="no"])
916 AS_IF([test "${enable_gprof}" != "no"], [
917   CFLAGS="${CFLAGS} -pg"
918   CXXFLAGS="${CXXFLAGS} -pg"
919   OBJCFLAGS="${OBJCFLAGS} -pg"
920   LDFLAGS="${LDFLAGS} -pg"
923 AC_ARG_ENABLE(cprof,
924   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
925   [enable_cprof="no"])
926 AS_IF([test "${enable_gprof}" != "no"], [
927   CFLAGS="${CFLAGS} -finstrument-functions"
928   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
929   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
930   LDFLAGS="${LDFLAGS} -finstrument-functions"
934 dnl  Test coverage
936 AC_ARG_ENABLE(coverage,
937   [AS_HELP_STRING([--enable-coverage],
938     [build for test coverage (default disabled)])],,
939   [enable_coverage="no"])
940 AS_IF([test "${enable_coverage}" != "no"], [
941   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
942   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
943   LDFLAGS="-lgcov ${LDFLAGS}"
946 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
947   VLC_SAVE_FLAGS
948   CFLAGS="${CFLAGS} -fvisibility=hidden"
949   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
950   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
951   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
952                  [ac_cv_c_visibility_hidden], [
953     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
954       ac_cv_c_visibility_hidden=yes
955     ], [
956       ac_cv_c_visibility_hidden=no
957     ])
958   ])
959   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
964 dnl  Enable/disable optimizations
966 AC_ARG_ENABLE(optimizations,
967   [AS_HELP_STRING([--disable-optimizations],
968     [disable compiler optimizations (default enabled)])],,
969   [enable_optimizations="yes"])
971 dnl Check for various optimization flags
972 AS_IF([test "${enable_optimizations}" != "no"], [
974   dnl -O3 only in production builds
975   AS_IF([test "${enable_debug}" = "no"], [
976     VLC_SAVE_FLAGS
977     CFLAGS="${CFLAGS} -O3"
978     CXXFLAGS="${CXXFLAGS} -O3"
979     OBJCFLAGS="${OBJCFLAGS} -O3"
980     AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
981       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
982         ac_cv_c_o3=yes
983       ], [
984         ac_cv_c_o3=no
985       ])
986     ])
987     AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
988   ])
990   dnl Check for -ffast-math
991   VLC_SAVE_FLAGS
992   CFLAGS="${CFLAGS} -ffast-math"
993   CXXFLAGS="${CXXFLAGS} -ffast-math"
994   OBJCFLAGS="${OBJCFLAGS} -ffast-math"
995   AC_CACHE_CHECK([if $CC accepts -ffast-math], [ac_cv_c_fast_math], [
996     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
997       ac_cv_c_fast_math=yes
998     ], [
999       ac_cv_c_fast_math=no
1000     ])
1001   ])
1002   AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
1003   AH_BOTTOM([
1004 #ifndef __FAST_MATH__
1005 # ifndef _MSC_VER
1006 #  pragma STDC FENV_ACCESS OFF
1007 #  pragma STDC FP_CONTRACT ON
1008 # else
1009 #  pragma fenv_access(off)
1010 #  pragma fp_contract(on)
1011 # endif
1012 #endif
1015   dnl Check for -funroll-loops
1016   VLC_SAVE_FLAGS
1017   CFLAGS="${CFLAGS} -funroll-loops"
1018   CXXFLAGS="${CXXFLAGS} -funroll-loops"
1019   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
1020   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
1021     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1022       ac_cv_c_unroll_loops=yes
1023     ], [
1024       ac_cv_c_unroll_loops=no
1025     ])
1026   ])
1027   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
1029   AS_IF([test "$enable_debug" = "no"], [
1030     dnl Check for -fomit-frame-pointer
1031     VLC_SAVE_FLAGS
1032     CFLAGS="${CFLAGS} -fomit-frame-pointer"
1033     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
1034     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
1035     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
1036       [ac_cv_c_omit_frame_pointer], [
1037       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1038         ac_cv_c_omit_frame_pointer=yes
1039       ], [
1040         ac_cv_c_omit_frame_pointer=no
1041       ])
1042     ])
1043     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1044   ])
1047 VLC_SAVE_FLAGS
1048 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1049 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1050   AC_TRY_LINK([],, [
1051     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1052   ], [
1053     ac_cv_ld_bsymbolic=""
1054   ])
1056 VLC_RESTORE_FLAGS
1057 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1058 AC_SUBST(SYMBOLIC_LDFLAGS)
1060 dnl Checks for __attribute__(aligned()) directive
1061 VLC_SAVE_FLAGS
1062 CFLAGS="${CFLAGS} -Werror"
1063 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1064     [ac_cv_c_attribute_aligned],
1065     [ac_cv_c_attribute_aligned=0
1066     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1067         AC_TRY_COMPILE([],
1068         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1069         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1070     done])
1071 VLC_RESTORE_FLAGS
1072 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1073     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1074         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1077 dnl Check for __attribute__((packed))
1078 AC_CACHE_CHECK([for __attribute__((packed))],
1079   [ac_cv_c_attribute_packed],
1080   [ac_cv_c_attribute_packed=no
1081    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1082                     [ac_cv_c_attribute_packed=yes])])
1083 if test "${ac_cv_c_attribute_packed}" != "no"; then
1084   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1088 dnl  Check the CPU
1090 case "${host_cpu}" in
1091   "")
1092     ARCH=unknown
1093     ;;
1094   *)
1095     ARCH="${host_cpu}"
1096     ;;
1097 esac
1099 dnl Check for backtrace() support
1100 AC_CHECK_HEADERS(execinfo.h)
1101 AC_CHECK_FUNCS(backtrace)
1104 dnl  default modules
1106 ALIASES="${ALIASES} cvlc rvlc"
1109 dnl  Accelerated modules
1112 dnl  Check for fully working MMX intrinsics
1113 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1114 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1115 AC_ARG_ENABLE(mmx,
1116   [AS_HELP_STRING([--disable-mmx],
1117     [disable MMX optimizations (default auto)])],,[
1118   case "${host_cpu}" in
1119     i?86|x86_64)
1120       enable_mmx="yes"
1121       ;;
1122     *)
1123       enable_mmx="no"
1124       ;;
1125   esac
1127 have_mmx="no"
1128 have_mmxext="no"
1129 AS_IF([test "${enable_mmx}" != "no"], [
1130   ARCH="${ARCH} mmx"
1131   VLC_SAVE_FLAGS
1132   CFLAGS="${CFLAGS} -mmmx"
1133   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1134     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1135 [#include <mmintrin.h>
1136 #include <stdint.h>
1137 uint64_t frobzor;]], [
1138 [__m64 a, b, c;
1139 a = b = c = (__m64)frobzor;
1140 a = _mm_slli_pi16(a, 3);
1141 a = _mm_adds_pi16(a, b);
1142 c = _mm_srli_pi16(c, 8);
1143 c = _mm_slli_pi16(c, 3);
1144 b = _mm_adds_pi16(b, c);
1145 a = _mm_unpacklo_pi8(a, b);
1146 frobzor = (uint64_t)a;]])], [
1147       ac_cv_c_mmx_intrinsics=yes
1148     ], [
1149       ac_cv_c_mmx_intrinsics=no
1150     ])
1151   ])
1152   VLC_RESTORE_FLAGS
1153   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1154     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1155   ])
1157   VLC_SAVE_FLAGS
1158   CFLAGS="${CFLAGS} -mmmx"
1159   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1160     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1161 void *p;
1162 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1164     ], [
1165       ac_cv_mmx_inline=yes
1166     ], [
1167       ac_cv_mmx_inline=no
1168     ])
1169   ])
1170   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1171     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1172     have_mmx="yes"
1173   ])
1175   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1176                  [ac_cv_mmxext_inline], [
1177     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1178 void *p;
1179 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1181     ], [
1182       ac_cv_mmxext_inline=yes
1183     ], [
1184       ac_cv_mmxext_inline=no
1185     ])
1186   ])
1187   VLC_RESTORE_FLAGS
1188   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1189     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1190     have_mmxext="yes"
1191   ])
1193 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1194 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1196 dnl  Check for fully workin SSE2 intrinsics
1197 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1198 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1199 AC_ARG_ENABLE(sse,
1200   [AS_HELP_STRING([--disable-sse],
1201     [disable SSE (1-4) optimizations (default auto)])],, [
1202   case "${host_cpu}" in
1203     i?86|x86_64)
1204       enable_sse=yes
1205       ;;
1206     *)
1207       enable_sse=no
1208       ;;
1209   esac
1211 have_sse2="no"
1212 AS_IF([test "${enable_sse}" != "no"], [
1213   ARCH="${ARCH} sse sse2"
1215   VLC_SAVE_FLAGS
1216   CFLAGS="${CFLAGS} -msse2"
1217   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1218     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1219 [#include <emmintrin.h>
1220 #include <stdint.h>
1221 uint64_t frobzor;]], [
1222 [__m128i a, b, c;
1223 a = b = c = _mm_set1_epi64((__m64)frobzor);
1224 a = _mm_slli_epi16(a, 3);
1225 a = _mm_adds_epi16(a, b);
1226 c = _mm_srli_epi16(c, 8);
1227 c = _mm_slli_epi16(c, 3);
1228 b = _mm_adds_epi16(b, c);
1229 a = _mm_unpacklo_epi8(a, b);
1230 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1231       ac_cv_c_sse2_intrinsics=yes
1232     ], [
1233       ac_cv_c_sse2_intrinsics=no
1234     ])
1235   ])
1236   VLC_RESTORE_FLAGS
1237   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1238     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1239   ])
1241   VLC_SAVE_FLAGS
1242   CFLAGS="${CFLAGS} -msse"
1243   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1244     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1245 void *p;
1246 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1248     ], [
1249       ac_cv_sse_inline=yes
1250     ], [
1251       ac_cv_sse_inline=no
1252     ])
1253   ])
1255   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1256     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1257   ])
1259   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1260     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1261 void *p;
1262 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1264     ], [
1265       ac_cv_sse2_inline=yes
1266     ], [
1267       ac_cv_sse2_inline=no
1268     ])
1269   ])
1270   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1271     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1272     have_sse2="yes"
1273   ])
1275   # SSE3
1276   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1277     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1278 void *p;
1279 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1281     ], [
1282       ac_cv_sse3_inline=yes
1283     ], [
1284       ac_cv_sse3_inline=no
1285     ])
1286   ])
1288   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1289     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1290   # SSSE3
1291   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1292     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1293 void *p;
1294 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1296     ], [
1297       ac_cv_ssse3_inline=yes
1298     ], [
1299       ac_cv_ssse3_inline=no
1300     ])
1301   ])
1303   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1304     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1306   # SSE4.1
1307   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1308                  [ac_cv_sse4_1_inline], [
1309     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1310 void *p;
1311 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1313     ], [
1314       ac_cv_sse4_1_inline=yes
1315     ], [
1316       ac_cv_sse4_1_inline=no
1317     ])
1318   ])
1320   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1321     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1323   # SSE4.2
1324   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1325                  [ac_cv_sse4_2_inline], [
1326     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1327 void *p;
1328 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1330     ], [
1331       ac_cv_sse4_2_inline=yes
1332     ], [
1333       ac_cv_sse4_2_inline=no
1334     ])
1335   ])
1337   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1338     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1340   # SSE4A
1341   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1342     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1343 void *p;
1344 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1346     ], [
1347       ac_cv_sse4a_inline=yes
1348     ], [
1349       ac_cv_sse4a_inline=no
1350     ])
1351   ])
1352   VLC_RESTORE_FLAGS
1353   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1354     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1356 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1358 VLC_SAVE_FLAGS
1359 CFLAGS="${CFLAGS} -mmmx"
1360 have_3dnow="no"
1361 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1362   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1363 void *p;
1364 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1366   ], [
1367     ac_cv_3dnow_inline=yes
1368   ], [
1369     ac_cv_3dnow_inline=no
1370   ])
1372 VLC_RESTORE_FLAGS
1373 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1374   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1375             [Define to 1 if 3D Now! inline assembly is available.])
1376   have_3dnow="yes"
1378 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1381 AC_ARG_ENABLE(neon,
1382   [AS_HELP_STRING([--disable-neon],
1383     [disable NEON optimizations (default auto)])],, [
1384   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1386 AS_IF([test "${enable_neon}" != "no"], [
1387   VLC_SAVE_FLAGS
1388   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1389   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1390     AC_COMPILE_IFELSE([
1391       AC_LANG_PROGRAM(,[[
1392 asm volatile("vqmovun.s64 d0, q1":::"d0");
1394     ], [
1395       ac_cv_arm_neon="yes"
1396     ], [
1397       ac_cv_arm_neon="no"
1398     ])
1399   ])
1400   VLC_RESTORE_FLAGS
1402 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1405 AC_ARG_ENABLE(altivec,
1406   [AS_HELP_STRING([--disable-altivec],
1407     [disable AltiVec optimizations (default auto)])],, [
1408   AS_CASE("${host_cpu}", [powerpc*],
1409         [enable_altivec=yes], [enable_altivec=no])
1411 have_altivec="no"
1412 ALTIVEC_CFLAGS=""
1413 AS_IF([test "${enable_altivec}" = "yes"], [
1414   ARCH="${ARCH} altivec";
1415   VLC_SAVE_FLAGS
1416   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1417     [ac_cv_altivec_inline],
1418     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1419          ac_cv_altivec_inline="yes",
1420          [CFLAGS="${CFLAGS} -Wa,-maltivec"
1421           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1422             [ac_cv_altivec_inline="-Wa,-maltivec"],
1423             ac_cv_altivec_inline=no)
1424          ])])
1425   VLC_RESTORE_FLAGS
1426   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1427     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1428               [Define to 1 if AltiVec inline assembly is available.])
1429     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1430       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1431       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1432     ])
1433     have_altivec="yes"
1434   ])
1436   VLC_SAVE_FLAGS
1437   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1438   [ac_cv_c_altivec], [
1439     CFLAGS="${CFLAGS} -maltivec"
1440     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1441 [#include <altivec.h>]], [
1442 [vec_ld(0, (unsigned char *)0);]])], [
1443       ac_cv_c_altivec="-maltivec"
1444     ], [
1445       ac_cv_c_altivec="no"
1446     ])
1447   ])
1448   VLC_RESTORE_FLAGS
1449   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1450     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1451     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1452     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1453     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1454     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1455     have_altivec="yes"
1456   ])
1457   AC_CHECK_HEADERS(altivec.h)
1459   VLC_SAVE_FLAGS
1460   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1461   AC_CACHE_CHECK([if linker needs -framework vecLib],
1462     [ac_cv_ld_altivec],
1463     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1464   VLC_RESTORE_FLAGS
1465   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1466     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1467   ])
1469 AC_SUBST(ALTIVEC_CFLAGS)
1470 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1473 dnl  Memory usage
1475 AC_ARG_ENABLE(optimize-memory,
1476   [AS_HELP_STRING([--enable-optimize-memory],
1477     [optimize memory usage over performance])])
1478 if test "${enable_optimize_memory}" = "yes"; then
1479   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1483 dnl Allow running as root (useful for people running on embedded platforms)
1485 AC_ARG_ENABLE(run-as-root,
1486   [AS_HELP_STRING([--enable-run-as-root],
1487     [allow running VLC as root (default disabled)])])
1488 AS_IF([test "${enable_run_as_root}" = "yes"],[
1489     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1490               [Define to 1 to allow running VLC as root (uid 0).])
1494 dnl Stream output
1496 AC_ARG_ENABLE(sout,
1497   [AS_HELP_STRING([--disable-sout],
1498     [disable streaming output (default enabled)])])
1499 AS_IF([test "${enable_sout}" != "no"], [
1500   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1502 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1504 dnl Lua modules
1505 AC_ARG_ENABLE(lua,
1506   [AS_HELP_STRING([--disable-lua],
1507     [disable LUA scripting support (default enabled)])])
1508 if test "${enable_lua}" != "no"
1509 then
1510   PKG_CHECK_MODULES(LUA, lua5.2,
1511     [ have_lua=yes ],
1512     [
1513     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1515     PKG_CHECK_MODULES(LUA, lua5.1,
1516       [ have_lua=yes ],
1517       [
1518       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1519       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1520         [ have_lua=yes ],
1521         [
1522           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1523           have_lua=yes
1524           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1525             [],
1526             [ have_lua=no ] )
1527           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1528             [LUA_LIBS="-llua5.2"],
1529           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1530             [LUA_LIBS="-llua5.1"],
1531             AC_CHECK_LIB( lua51 , luaL_newstate,
1532               [LUA_LIBS="-llua51"],
1533               AC_CHECK_LIB( lua , luaL_newstate,
1534                 [LUA_LIBS="-llua"],
1535                 [ have_lua=no
1536                 ], [-lm])
1537             )))
1538         ])
1539       ])
1540     ])
1541   if test "x${have_lua}" != "xyes" ;  then
1542       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.])
1543   fi
1544   AC_ARG_VAR([LUAC], [LUA byte compiler])
1545   AC_CHECK_PROGS(LUAC, [${LUAC} luac], [false])
1546   AS_IF([test "${LUAC}" = "false"], [
1547     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1548   ])
1549   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], [
1550     AC_MSG_ERROR([You need 32-bits luac when using using lua from contrib.])
1551   ])
1553 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1557 dnl HTTP daemon
1559 AC_ARG_ENABLE(httpd,
1560   [AS_HELP_STRING([--disable-httpd],
1561     [disable the built-in HTTP server (default enabled)])])
1562 if test "${enable_httpd}" != "no"
1563 then
1564   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1566 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1570 dnl VideoLAN manager
1572 AC_ARG_ENABLE(vlm,
1573   [AS_HELP_STRING([--disable-vlm],
1574     [disable the stream manager (default enabled)])],,
1575   [enable_vlm="${enable_sout}"])
1576 AS_IF([test "${enable_vlm}" != "no"], [
1577   AS_IF([test "${enable_sout}" = "no"], [
1578     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1579   ])
1580   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1582 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1586 dnl Addons manager storage and repositories modules
1588 AC_ARG_ENABLE(addonmanagermodules,
1589   [AS_HELP_STRING([--disable-addonmanagermodules],
1590     [disable the addons manager modules (default enabled)])])
1591 if test "${enable_addonmanagermodules}" != "no"
1592 then
1593   AC_DEFINE(ENABLE_ADDONMANAGERMODULES, 1, [Define if you want the addons manager modules])
1595 AM_CONDITIONAL([ENABLE_ADDONMANAGERMODULES], [test "${enable_addonmanagermodules}" != "no"])
1599 dnl  Input plugins
1602 EXTEND_HELP_STRING([Input plugins:])
1605 dnl  libarchive access module
1607 PKG_ENABLE_MODULES_VLC([ARCHIVE], [access_archive], [libarchive >= 3.1.0], (libarchive support), [auto])
1610 dnl  live555 input
1612 AC_ARG_ENABLE(live555,
1613   [AS_HELP_STRING([--enable-live555],
1614     [enable RTSP input through live555 (default enabled)])])
1616 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1617   PKG_CHECK_MODULES(LIVE555, live555, [
1618     VLC_ADD_PLUGIN([live555])
1619     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1620     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1621   ], [
1622     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1624     AC_LANG_PUSH(C++)
1625     VLC_SAVE_FLAGS
1627     dnl detect include paths
1628     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1629       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1630     ], [
1631       AS_IF([test "${SYS}" != "os2"], [
1632         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1633         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1634       ], [
1635         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1636         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1637         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1638       ])
1639     ])
1641     dnl CPP Flags
1642     AS_IF([test "${SYS}" = "solaris"], [
1643       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1644     ])
1645     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1646     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1648     dnl version check
1649     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1650       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1651 [#include <liveMedia_version.hh>
1652 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1653 # error BOOM
1654 #endif]])
1655       ], [
1656         ac_cv_live555="yes"
1657       ], [
1658         ac_cv_live555="no"
1659       ])
1660     ])
1662     AS_IF([test "$ac_cv_live555" = "no"], [
1663       AC_MSG_WARN([live555 is missing or its installed version is too old:
1664 Version 2011.12.23 or later is required to proceed.
1665 You can get an updated one from http://www.live555.com/liveMedia .])
1666       AS_IF([test -n "${enable_live555}"], [
1667         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1668       ])
1669     ], [
1670       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1671       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1672       AS_IF([test "${SYS}" = "mingw32"], [
1673         # add ws2_32 for closesocket, select, recv
1674         other_libs="$other_libs -lws2_32"
1675       ])
1677       dnl We need to check for pic because live555 don't provide shared libs
1678       dnl and we want to build a plugins so we need -fPIC on some arch.
1679       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1680       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1681       AC_CHECK_LIB(liveMedia_pic, main, [
1682         VLC_ADD_PLUGIN([live555])
1683         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1684       ],[
1685         AC_CHECK_LIB(liveMedia, main, [
1686           VLC_ADD_PLUGIN([live555])
1687           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1688         ],[],[${other_libs}])
1689       ],[${other_libs_pic}])
1690     ])
1691     VLC_RESTORE_FLAGS
1692     AC_LANG_POP(C++)
1693   ])
1697 dnl IIDC and DV FireWire input modules
1699 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1700 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1703 dnl - linsys modules: access module check for libzvbi
1705 AC_ARG_ENABLE(linsys,
1706   [AS_HELP_STRING([--enable-linsys],
1707     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1708 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1709   VLC_ADD_PLUGIN([linsys_hdsdi])
1710   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1711     VLC_ADD_PLUGIN([linsys_sdi])
1712   ], [
1713     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1714   ])
1718 dnl dvdread module: check for libdvdread
1720 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread > 4.9.0], [dvdread input module], [auto])
1723 dnl libdvdnav plugin
1725 PKG_ENABLE_MODULES_VLC([DVDNAV], [], [dvdnav > 4.9.0], [DVD with navigation input module (dvdnav)], [auto])
1726 AS_IF([test "${enable_dvdnav}" != "no"], [
1727   AC_MSG_CHECKING(for dvdnav_stream_cb in dvdnav/dvdnav.h)
1728     AC_EGREP_HEADER(dvdnav_stream_cb,dvdnav/dvdnav.h,[
1729       AC_MSG_RESULT(yes)
1730       AC_DEFINE(HAVE_STREAM_CB_IN_DVDNAV_H, 1, For dvdnav demux support)
1731       ],[
1732       AC_MSG_RESULT(no)
1733     ])
1737 dnl  Blu-ray Disc Support with libbluray
1739 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray for Blu-ray disc support ) )
1742 dnl  OpenCV wrapper and example filters
1744 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1748 dnl  libsmbclient plugin
1750 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1751 AS_IF([test "${SYS}" = "mingw32"], [ VLC_ADD_PLUGIN([smb]) ])
1754 dnl  liBDSM access module
1756 PKG_ENABLE_MODULES_VLC([DSM], [dsm], [libdsm >= 0.0.7], [libdsm SMB/CIFS access/sd module], [auto])
1759 dnl sftp access support
1761 PKG_ENABLE_MODULES_VLC([SFTP], [sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1764 dnl  Video4Linux 2
1766 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1767   [disable Video4Linux version 2 (default auto)])])
1768 have_v4l2="no"
1769 AS_IF([test "$enable_v4l2" != "no"], [
1770   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1771     have_v4l2="yes"
1772   ])
1774 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1777 dnl special access module for Blackmagic SDI cards
1779 AC_ARG_ENABLE(decklink,
1780   [AS_HELP_STRING([--disable-decklink],
1781     [disable Blackmagic DeckLink SDI input (default auto)])])
1782 AC_ARG_WITH(decklink_sdk,
1783   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1784     [                        location of Blackmagic DeckLink SDI SDK])])
1785 have_decklink=no
1786 if test "${enable_decklink}" != "no"
1787 then
1788   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1789   then
1790     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1791   fi
1792   VLC_SAVE_FLAGS
1793   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1794   AC_LANG_PUSH(C++)
1795   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1796       have_decklink=yes
1797   ], [
1798       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1799   ])
1800   AC_LANG_POP(C++)
1801   VLC_RESTORE_FLAGS
1803 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1807 dnl  VCDX modules
1809 PKG_ENABLE_MODULES_VLC([VCDX], [vcdx], [libcdio >= 0.78.2 libiso9660 >= 0.72 libvcdinfo >= 0.7.22], [navigate VCD with libvcdinfo], [no])
1812 dnl  Built-in CD-DA and VCD module
1814 AC_ARG_ENABLE(vcd,
1815   [AS_HELP_STRING([--disable-vcd],
1816     [disable built-in VCD and CD-DA support (default enabled)])])
1818 AC_ARG_ENABLE(libcddb,
1819   [AS_HELP_STRING([--disable-libcddb],
1820     [disable CDDB for Audio CD (default enabled)])])
1822 if test "${enable_vcd}" != "no"
1823 then
1824   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1825   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1826     AC_MSG_RESULT(yes)
1827     VLC_ADD_PLUGIN([vcd cdda])
1828   ],[
1829     AC_MSG_RESULT(no)
1830   ])
1832   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1833   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1834     AC_MSG_RESULT(yes)
1835     VLC_ADD_PLUGIN([vcd cdda])
1836     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1837   ],[
1838     AC_MSG_RESULT(no)
1839   ])
1841   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1842   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1843     AC_MSG_RESULT(yes)
1844     VLC_ADD_PLUGIN([vcd cdda])
1845     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1846   ],[
1847     AC_MSG_RESULT(no)
1848   ])
1850   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2" -o "${SYS}" = "darwin"
1851   then
1852     VLC_ADD_PLUGIN([vcd cdda])
1853   fi
1855   if test "$enable_libcddb" != "no"; then
1856     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1857       HAVE_LIBCDDB=yes
1858       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1859       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1860       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1861       ],:
1862       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1863       HAVE_LIBCDDB=no])
1864   fi
1868 dnl Linux DVB
1870 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1871   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1872 [#include <linux/dvb/version.h>
1873 #if (DVB_API_VERSION < 5)
1874 # error Linux DVB API v3.2 and older are not supported.
1875 #endif
1876 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1877 # error Linux DVB API v5.0 is unsupported. Please update.
1878 #endif
1879 ]])], [
1880   ac_cv_linux_dvb_5_1=yes
1881 ], [
1882   ac_cv_linux_dvb_5_1=no
1883 ])])
1884 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1887 dnl  Screen capture module
1889 AC_ARG_ENABLE(screen,
1890   [AS_HELP_STRING([--enable-screen],
1891     [disable screen capture (default enabled)])])
1892 if test "${enable_screen}" != "no"; then
1893   if test "${SYS}" = "darwin"; then
1894     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1895       VLC_ADD_PLUGIN([screen])
1896     ])
1897   fi
1899 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1902 dnl  VNC/RFB access module
1904 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1906 dnl  RDP/Remote Desktop access module
1908 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1911 dnl  Real RTSP plugin
1913 AC_ARG_ENABLE(realrtsp,
1914   [  --enable-realrtsp       Real RTSP module (default disabled)])
1915 if test "${enable_realrtsp}" = "yes"; then
1916   VLC_ADD_PLUGIN([access_realrtsp])
1920 dnl MacOS eyeTV
1921 AC_ARG_ENABLE(macosx-eyetv,
1922   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1923 if test "x${enable_macosx_eyetv}" != "xno" &&
1924   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1925 then
1926   VLC_ADD_PLUGIN([access_eyetv])
1930 dnl QTKit
1931 AC_ARG_ENABLE(macosx-qtkit,
1932   [  --enable-macosx-qtkit Mac OS X qtsound (audio) module (default enabled on Mac OS X)])
1933 if test "x${enable_macosx_qtkit}" != "xno" &&
1934   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1935 then
1936   VLC_ADD_PLUGIN([qtsound])
1938 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1941 dnl AVFoundation
1942 AC_SUBST(have_avfoundation, ["no"])
1943 AC_ARG_ENABLE(macosx-avfoundation,
1944   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
1945 if test "x${enable_macosx_avfoundation}" != "xno" &&
1946   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
1947 then
1948   SAVED_LIBS="${LIBS}"
1949   LIBS="-framework AVFoundation"
1950   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
1951   LIBS="${SAVED_LIBS}"
1952   if test "${have_avfoundation}" != "no"
1953   then
1954     VLC_ADD_PLUGIN([avcapture])
1955   fi
1957 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
1960 dnl  DCP plugin (using asdcplib)
1962 PKG_WITH_MODULES([ASDCP], [asdcplib], [have_asdcp="yes"])
1963 AM_CONDITIONAL(HAVE_ASDCP, [test "${have_asdcp}" = "yes"])
1966 dnl  Demux plugins
1969 EXTEND_HELP_STRING([Mux/Demux plugins:])
1972 dnl  libdvbpsi check for ts mux/demux
1974 have_dvbpsi="no"
1975 PKG_WITH_MODULES([DVBPSI], [libdvbpsi >= 1.0.0], [have_dvbpsi="yes"])
1976 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1980 dnl  GME demux plugin
1982 AC_ARG_ENABLE(gme,
1983   [AS_HELP_STRING([--enable-gme],
1984     [use Game Music Emu (default auto)])])
1985 AS_IF([test "${enable_gme}" != "no"], [
1986   AC_CHECK_HEADER([gme/gme.h], [
1987     VLC_ADD_LIBS([gme], [-lgme])
1988     VLC_ADD_PLUGIN([gme])
1989   ], [
1990     AS_IF([test "x${enable_gme}" != "x"], [
1991       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
1992     ])
1993   ])
1998 dnl  SIDPlay plugin
2000 AC_ARG_ENABLE(sid,
2001     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2002 AS_IF([test "${enable_sid}" != "no"], [
2003     PKG_CHECK_MODULES(SID, [libsidplay2], [
2004         AC_LANG_PUSH(C++)
2005         oldCPPFLAGS="$CPPFLAGS"
2006         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2007         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2008             VLC_ADD_PLUGIN([sid])
2009             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2010             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2011         ], [
2012             AS_IF([test -n "${enable_sid}"],
2013                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2014                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2015                 )
2016         ])
2017         CPPFLAGS="$oldCPPFLAGS"
2018         AC_LANG_POP(C++)
2019     ], [
2020         AS_IF([test "x${enable_sid}" = "xyes"],
2021             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2022             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2023             )
2024     ])
2029 dnl  ogg demux plugin
2031 PKG_ENABLE_MODULES_VLC([OGG], [mux_ogg], [ogg >= 1.0], [Ogg demux support], [auto])
2032 PKG_CHECK_MODULES(LIBVORBIS, [vorbis >= 1.1], [
2033     AC_DEFINE(HAVE_LIBVORBIS, 1, [Define to 1 if you have the libvorbis])
2034 ],[true])
2035 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto], [${LIBVORBIS_CFLAGS}], [${LIBVORBIS_LIBS}])
2036 if test "${enable_sout}" != "no"; then
2037 dnl Check for libshout
2038     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2042 dnl  matroska demux plugin
2044 AC_ARG_ENABLE(mkv,
2045   [AS_HELP_STRING([--disable-mkv],
2046     [do not use libmatroska (default auto)])])
2047 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2048   AC_LANG_PUSH(C++)
2049   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2050     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2051     AC_EGREP_CPP(yes,
2052       [#include <ebml/EbmlVersion.h>
2053        #ifdef LIBEBML_VERSION
2054        #if LIBEBML_VERSION >= 0x010000
2055        yes
2056        #endif
2057        #endif],
2058       [AC_MSG_RESULT([yes])
2059         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2060           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2061           AC_EGREP_CPP(yes,
2062             [#include <matroska/KaxVersion.h>
2063              #ifdef LIBMATROSKA_VERSION
2064              #if LIBMATROSKA_VERSION >= 0x010000
2065              yes
2066              #endif
2067              #endif],
2068             [AC_MSG_RESULT([yes])
2069               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2070               AC_CHECK_LIB(ebml_pic, main, [
2071                 VLC_ADD_PLUGIN([mkv])
2072                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2073               ],[
2074                 AC_CHECK_LIB(ebml, main, [
2075                   VLC_ADD_PLUGIN([mkv])
2076                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2077                 ])
2078               ])
2079             ], [
2080               AC_MSG_RESULT([no])
2081               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.])
2082           ])
2083         ])
2084       ],
2085       [AC_MSG_RESULT([no])
2086         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.])
2087     ])
2088   ])
2089   AC_LANG_POP(C++)
2093 dnl  modplug demux plugin
2095 AC_ARG_ENABLE(mod,
2096   [AS_HELP_STRING([--disable-mod],
2097     [do not use libmodplug (default auto)])])
2098 if test "${enable_mod}" != "no" ; then
2099     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2100           VLC_ADD_PLUGIN([mod])
2101           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2102           VLC_ADD_CFLAGS([mod],[$LIBMODPLUG_CFLAGS]) #modules/demux/mod.c needs CFLAGS_mod, not CXXFLAGS_mod
2103           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2104     ],[
2105        AS_IF([test -n "${enable_mod}"],
2106          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2107          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2108     ])
2112 dnl  mpc demux plugin
2114 AC_ARG_ENABLE(mpc,
2115   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2116 if test "${enable_mpc}" != "no"
2117 then
2118   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2119     VLC_ADD_PLUGIN([mpc])
2120     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2121     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2122     VLC_ADD_PLUGIN([mpc])
2123     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2127 dnl  Codec plugins
2130 EXTEND_HELP_STRING([Codec plugins:])
2133 dnl wmafixed plugin
2135 AC_ARG_ENABLE(wma-fixed,
2136   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2137 if test "${enable_wma_fixed}" = "yes"
2138 then
2139   VLC_ADD_PLUGIN([wma_fixed])
2143 dnl shine encoder plugin
2145 PKG_ENABLE_MODULES_VLC([SHINE], [], [shine >= 3.0.0], [MPEG Audio Layer 3 encoder], [auto], [], [], [])
2149 dnl openmax il codec plugin
2151 AC_ARG_ENABLE(omxil,
2152   [  --enable-omxil          openmax il codec module (default disabled)])
2153 if test "${enable_omxil}" = "yes"
2154 then
2155   VLC_ADD_PLUGIN([omxil])
2159 dnl openmax il vout plugin
2161 AC_ARG_ENABLE(omxil-vout,
2162   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2163 if test "${enable_omxil_vout}" = "yes"
2164 then
2165   VLC_ADD_PLUGIN([omxil_vout])
2169 dnl raspberry pi openmax il configuration
2171 AC_ARG_ENABLE(rpi-omxil,
2172   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2173 if test "${enable_rpi_omxil}" = "yes"
2174 then
2175   VLC_ADD_PLUGIN([omxil omxil_vout])
2176   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2180 dnl CrystalHD codec plugin
2182 AC_ARG_ENABLE(crystalhd,
2183   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2184 if test "${enable_crystalhd}" != "no"; then
2185     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2186       VLC_ADD_PLUGIN([crystalhd])
2187       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2188     ],[
2189       if test "${SYS}" = "mingw32" ; then
2190         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2191           VLC_ADD_PLUGIN([crystalhd])
2192           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2193             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2194             ])
2195         ],[
2196           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2197                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2198                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2199         ],[#define __LINUX_USER__
2200                #include <libcrystalhd/bc_dts_types.h>
2201         ])
2202       fi
2203     ],[
2204        #include <libcrystalhd/bc_dts_types.h>
2205       ])
2209 dnl  mad plugin
2211 have_mad="no"
2212 MAD_CFLAGS=""
2213 MAD_LIBS=""
2215 AC_ARG_WITH(mad, [  --with-mad=PATH         path to libmad], [
2216   enable_mad="yes"
2217 ], [
2218   with_mad="no"
2220 AS_IF([test "${with_mad}" != "no"], [
2221   MAD_CFLAGS="-I${with_mad}/include"
2222   MAD_LIBS="-L${with_mad}/lib"
2225 AC_ARG_ENABLE(mad,
2226   [  --enable-mad            libmad module (default enabled)])
2227 AS_IF([test "${enable_mad}" != "no"], [
2228   VLC_SAVE_FLAGS
2229   CPPFLAGS="${CPPFLAGS} ${MAD_CFLAGS}"
2230   LDFLAGS="${LDFLAGS} ${MAD_LIBS}"
2231   AC_CHECK_HEADERS(mad.h, [
2232     AC_CHECK_LIB(mad, mad_bit_init, [
2233       have_mad="yes"
2234       MAD_LIBS="${MAD_LIBS} -lmad"
2235     ])
2236   ])
2237   VLC_RESTORE_FLAGS
2238   AS_IF([test -n "$enable_mad" -a "${have_mad}" = "no"], [
2239     AC_MSG_ERROR([Could not find libmad. Install it or pass --disable-mad to disable it.])
2240   ])
2242 AC_SUBST(MAD_CFLAGS)
2243 AC_SUBST(MAD_LIBS)
2244 AM_CONDITIONAL([HAVE_MAD], [test "${have_mad}" = "yes"])
2246 dnl  mpg123 plugin
2249 PKG_ENABLE_MODULES_VLC([MPG123], [mpg123], [libmpg123], [libmpg123 decoder support], [auto])
2252 AC_ARG_ENABLE(merge-ffmpeg,
2253 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2254   enable_merge_ffmpeg="no"
2256 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2258 AC_MSG_CHECKING([for libavutil variant])
2259 PKG_CHECK_EXISTS([libavutil], [
2260   libavutil_version="$(${PKG_CONFIG} --modversion libavutil)"
2261   libavutil_micro="${libavutil_version##*.}"
2262   AS_IF([test ${libavutil_micro} -le 99], [
2263     avfork="libav"
2264   ], [
2265     avfork="ffmpeg"
2266   ])
2267 ], [
2268   avfork="none"
2270 AC_MSG_RESULT([${avfork}])
2273 dnl gstreamer stuff
2275 AC_ARG_ENABLE(gst-decode,
2276   [  --enable-gst-decode     GStreamer based decoding support (currently supports only video decoding) (default auto)])
2278 have_gst_decode="no"
2279 AS_IF([test "${enable_gst_decode}" != "no"], [
2280   PKG_CHECK_MODULES([GST_APP], [gstreamer-app-1.0], [
2281     PKG_CHECK_MODULES([GST_VIDEO], [gstreamer-video-1.0], [
2282       have_gst_decode="yes"
2283     ], [
2284       AC_MSG_WARN([${GST_VIDEO_PKG_ERRORS}. GStreamer decoder module will not be built.])
2285     ])
2286   ], [
2287     AC_MSG_WARN([${GST_APP_PKG_ERRORS}. GStreamer modules will not be built.])
2288   ])
2290 AM_CONDITIONAL([HAVE_GST_DECODE], [test "${have_gst_decode}" = "yes"])
2293 dnl  avcodec decoder/encoder plugin
2295 AC_ARG_ENABLE(avcodec,
2296 [  --enable-avcodec        libavcodec codec (default enabled)])
2297 AS_IF([test "${enable_avcodec}" != "no"], [
2298   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 55.0.0 libavutil >= 52.0.0], [
2299     dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
2300     dnl   AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
2301     dnl ])
2302     VLC_SAVE_FLAGS
2303     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2304     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2305     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2306     AC_CHECK_HEADERS(libavutil/avutil.h)
2307     VLC_RESTORE_FLAGS
2308     have_avcodec="yes"
2309   ],[
2310     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2311   ])
2312 ], [
2313   have_avcodec="no"
2315 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2318 dnl libva needs avcodec
2320 AC_ARG_ENABLE(libva,
2321   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2323 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2324   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2327 have_vaapi="no"
2328 have_vaapi_drm="no"
2329 have_vaapi_x11="no"
2330 AS_IF([test "${enable_libva}" != "no"], [
2331   PKG_CHECK_EXISTS([libva], [
2332     have_vaapi="yes"
2333   ], [
2334     AS_IF([test -n "${enable_libva}"], [
2335       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2336     ], [
2337       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2338     ])
2339   ])
2340   PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm], [
2341     have_vaapi_drm="yes"
2342   ], [
2343     AC_MSG_WARN([${LIBVA_DRM_PKG_ERRORS}.])
2344   ])
2345   PKG_CHECK_MODULES(LIBVA_X11, [libva-x11], [
2346     have_vaapi_x11="yes"
2347   ], [
2348     AC_MSG_WARN([${LIBVA_X11_PKG_ERRORS}.])
2349   ])
2351 AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
2352 AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
2354 have_avcodec_vaapi="no"
2355 AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
2356   VLC_SAVE_FLAGS
2357   CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2358   CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2359   AC_CHECK_HEADERS([libavcodec/vaapi.h], [
2360     AC_MSG_NOTICE([VAAPI acceleration activated])
2361     have_avcodec_vaapi="yes"
2362   ],[
2363     AS_IF([test -n "${enable_libva}"], [
2364       AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2365     ], [
2366       AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2367     ])
2368   ])
2369   VLC_RESTORE_FLAGS
2371 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2374 dnl dxva2 needs avcodec
2376 AC_ARG_ENABLE(dxva2,
2377   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2379 have_avcodec_dxva2="no"
2380 AS_IF([test "${enable_dxva2}" != "no"], [
2381   if test "${SYS}" = "mingw32"; then
2382   AS_IF([test "x${have_avcodec}" = "xyes"], [
2383     AC_CHECK_HEADERS(dxva2api.h,
2384       [
2385         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2386            AC_MSG_NOTICE([DxVA2 acceleration activated])
2387            have_avcodec_dxva2="yes"
2388         ],[
2389     AS_IF([test "${enable_dxva2}" = "yes"],
2390           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2391               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2392         ], [#undef _WIN32_WINNT
2393             /* DXVA2 is only available in Vista and above */
2394             #define _WIN32_WINNT 0x600])
2395       ],[
2396     AS_IF([test "${enable_dxva2}" = "yes"],
2397               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2398               [AC_MSG_WARN([dxva2api.h not found])])
2399       ])
2400   ],[
2401     AS_IF([test "x${enable_dxva2}" != "x"], [
2402       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2403     ])
2404   ])
2405   fi
2407 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2410 dnl d3d11va needs avcodec
2412 AC_ARG_ENABLE(d3d11va,
2413   [  --enable-d3d11va          D3D11 GPU decoding support (default auto)])
2415 have_avcodec_d3d11va="no"
2416 AS_IF([test "${enable_d3d11va}" != "no"], [
2417   if test "${SYS}" = "mingw32"; then
2418   AS_IF([test "x${have_avcodec}" = "xyes"], [
2419         AC_CHECK_TYPES([ID3D11VideoDecoder],
2420           [
2421             AC_CHECK_HEADERS(dxva2api.h,
2422               [
2423                 AC_CHECK_HEADERS(libavcodec/d3d11va.h, [
2424                    AC_MSG_NOTICE([D3D11 acceleration activated])
2425                    AC_DEFINE(HAVE_AVCODEC_D3D11VA, 1, [Define if the d3d11va module is built])
2426                    have_avcodec_d3d11va="yes"
2427                 ],[
2428                   AS_IF([test "${enable_d3d11va}" = "yes"],
2429                     [AC_MSG_ERROR([d3d11va is present but libavcodec/d3d11va.h is missing])],
2430                         [AC_MSG_WARN([d3d11va is present but libavcodec/d3d11va.h is missing ])])
2431                   ], [#undef _WIN32_WINNT
2432                       /* D3D11 is only available in Vista and above */
2433                       #define _WIN32_WINNT 0x600])
2434                   ],[
2435                     AS_IF([test "${enable_d3d11va}" = "yes"],
2436                           [AC_MSG_ERROR([Could not find required dxva2api.h])],
2437                           [AC_MSG_WARN([dxva2api.h not found])])
2438                   ])
2439           ],[
2440             AS_IF([test "${enable_d3d11va}" = "yes"],
2441                   [AC_MSG_ERROR([Could not find required ID3D11VideoDecoder in d3d11.h])],
2442                   [AC_MSG_WARN([ID3D11VideoDecoder not found])])
2443           ], [#include <d3d11.h>])
2444   ],[
2445     AS_IF([test "x${enable_d3d11va}" != "x"], [
2446       AC_MSG_ERROR([--enable-d3d11va and --disable-avcodec options are mutually exclusive.])
2447     ])
2448   ])
2449   fi
2451 AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
2454 dnl DXGI debug
2456 AC_CHECK_HEADERS(dxgidebug.h)
2459 dnl vda needs avcodec
2461 AC_ARG_ENABLE(vda,
2462   [  --enable-vda          VDA  support (default auto)])
2464 have_avcodec_vda="no"
2465 AS_IF([test "${enable_vda}" != "no"], [
2466   if test "${SYS}" = "darwin"; then
2467   AS_IF([test "x${have_avcodec}" = "xyes"], [
2468     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2469       [
2470         AC_CHECK_HEADERS(libavcodec/vda.h, [
2471            have_avcodec_vda="yes"
2472         ],[
2473         AS_IF([test "${enable_vda}" = "yes"],
2474               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2475               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2476         ])
2477   ],[
2478         AS_IF([test "${enable_vda}" = "yes"],
2479               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2480               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2481       ])
2482   ],[
2483     AS_IF([test "x${enable_vda}" != "x"], [
2484       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2485     ])
2486  ])
2487  AS_IF([test "${have_avcodec_vda}" = "yes"], [
2488      SAVE_LIBS=$LIBS
2489      LIBS="$LIBS $AVCODEC_LIBS"
2490      AC_CHECK_FUNCS([av_vda_alloc_context])
2491      LIBS=$SAVE_LIBS
2492  ])
2493  fi
2495 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2498 dnl  avformat demuxer/muxer plugin
2501 AC_ARG_ENABLE(avformat,
2502 [  --enable-avformat       libavformat containers (default enabled)],, [
2503   enable_avformat="${have_avcodec}"
2505 have_avformat="no"
2506 AS_IF([test "${enable_avformat}" != "no"], [
2507   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2508       have_avformat="yes"
2509       VLC_SAVE_FLAGS
2510       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2511       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2512       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2513       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2514       AC_CHECK_HEADERS(libavutil/avutil.h)
2515       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2516         have_avformat="no"
2517       ])
2518       VLC_RESTORE_FLAGS
2519     ],[
2520       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2521   ])
2523 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2526 dnl  swscale image scaling and conversion plugin
2529 AC_ARG_ENABLE(swscale,
2530   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2531           (default enabled)]))
2532 if test "${enable_swscale}" != "no"
2533 then
2534   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2535     [
2536       VLC_SAVE_FLAGS
2537       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2538       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2539       AC_CHECK_HEADERS(libswscale/swscale.h)
2540       AC_CHECK_HEADERS(libavutil/avutil.h)
2541       VLC_ADD_PLUGIN([swscale])
2542       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2543       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2544       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2545         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2546       ])
2547       VLC_RESTORE_FLAGS
2548     ],[
2549       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2550   ])
2554 dnl  postproc plugin
2557 AC_ARG_ENABLE(postproc,
2558 [  --enable-postproc       libpostproc image post-processing (default auto)])
2559 if test "${enable_postproc}" != "no"
2560 then
2561   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2562     [
2563       VLC_SAVE_FLAGS
2564       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2565       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2566       AC_CHECK_HEADERS(postproc/postprocess.h)
2567       VLC_ADD_PLUGIN([postproc])
2568       VLC_RESTORE_FLAGS
2569     ],[
2570       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2571   ])
2575 dnl  faad decoder plugin
2577 AC_ARG_ENABLE(faad,
2578 [  --enable-faad           faad codec (default auto)])
2579 have_faad="no"
2580 AS_IF([test "${enable_faad}" != "no"], [
2581   AC_CHECK_HEADERS([neaacdec.h], [
2582     AC_CHECK_LIB(faad, NeAACDecOpen, [have_faad="yes"],, [$LIBM])
2584     AS_IF([test "${have_faad}" = "yes"], [
2585       VLC_ADD_PLUGIN([faad])
2586       VLC_ADD_LIBS([faad],[-lfaad])
2587     ], [
2588       AS_IF([test "${enable_faad}" = "yes"], [
2589         AC_MSG_ERROR([cannot find FAAD library])
2590       ], [
2591         AC_MSG_WARN([cannot find FAAD library])
2592       ])
2593     ])
2594   ])
2598 dnl libvpx decoder plugin
2600 AC_ARG_ENABLE(vpx,
2601     AS_HELP_STRING([--enable-vpx],[libvpx VP8/VP9 decoder (default auto)]))
2602 AS_IF([test "${enable_vpx}" != "no"],[
2603     PKG_CHECK_MODULES([VPX], [vpx] , [
2604         VLC_ADD_PLUGIN([vpx])
2605         VLC_ADD_CPPFLAGS([vpx], [${VPX_CFLAGS}])
2606         VLC_ADD_LIBS([vpx], [${VPX_LIBS}])
2607         AC_CHECK_LIB([vpx],[vpx_codec_vp8_dx], [
2608             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_DECODER])
2609         ], [], [${VPX_LIBS}])
2610         AC_CHECK_LIB([vpx],[vpx_codec_vp9_dx], [
2611             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_DECODER])
2612         ], [], [${VPX_LIBS}])
2613     ], [
2614     AS_IF([test "${enable_vpx}" = "yes"],[
2615         AC_MSG_ERROR([libvpx was not found])
2616     ])])
2620 dnl twolame encoder plugin
2622 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2625 dnl fdk-aac encoder plugin
2627 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2630 dnl  QuickTime plugin
2632 AC_ARG_ENABLE(quicktime,
2633   [  --enable-quicktime      QuickTime module (deprecated)])
2634 if test "${enable_quicktime}" = "yes"; then
2635   if test "${SYS}" = "mingw32"; then
2636     VLC_ADD_PLUGIN([quicktime])
2637   else
2638   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2639     [ VLC_ADD_PLUGIN([quicktime])
2640       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2641     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2642   fi
2646 dnl A52/AC3 decoder plugin
2648 AC_ARG_ENABLE(a52,
2649   [  --enable-a52            A/52 support with liba52 (default enabled)])
2650 if test "${enable_a52}" != "no"
2651 then
2652   AC_ARG_WITH(a52,
2653     [  --with-a52=PATH         a52 headers and libraries])
2654     if test -z "${with_a52}"
2655     then
2656       LDFLAGS_test=""
2657       CPPFLAGS_test=""
2658     else
2659       LDFLAGS_test="-L${with_a52}/lib"
2660       CPPFLAGS_test="-I${with_a52}/include"
2661     fi
2662     VLC_SAVE_FLAGS
2663     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2664     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2665     AC_CHECK_HEADERS(a52dec/a52.h, [
2666       AC_CHECK_LIB(a52, a52_free, [
2667         VLC_ADD_PLUGIN([a52tofloat32])
2668         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2669         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2670       ],[
2671         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.])
2672         ], [$LIBM])
2673     ],[
2674       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.])
2675     ])
2676     VLC_RESTORE_FLAGS
2680 dnl DTS Coherent Acoustics decoder plugin
2682 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2685 dnl  Flac plugin
2687 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2690 dnl  Libmpeg2 plugin
2692 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2695 dnl  Vorbis plugin
2697 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2700 dnl  Tremor plugin
2702 AC_ARG_ENABLE(tremor,
2703   [  --enable-tremor         Tremor decoder support (default disabled)])
2704 if test "${enable_tremor}" = "yes"
2705 then
2706   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2707     VLC_ADD_PLUGIN([tremor])
2708    ],[])
2712 dnl  Speex plugins
2714 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2715 have_speexdsp="no"
2716 AS_IF([test "${enable_speex}" != "no"], [
2717   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2718     have_speexdsp="yes"
2719   ], [
2720     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2721   ])
2723 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2726 dnl  Opus plugin
2728 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus >= 1.0.3], [Opus support], [auto])
2731 dnl  theora decoder plugin
2733 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2736 dnl  Daala decoder plugin
2738 PKG_ENABLE_MODULES_VLC([DAALA], [], [ogg daaladec daalaenc], [experimental daala codec], [disabled])
2741 dnl  schroedinger decoder plugin (for dirac format video)
2743 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2746 dnl  PNG decoder module
2748 AC_ARG_ENABLE(png,
2749   [  --enable-png            PNG support (default enabled)])
2750 AS_IF([test "${enable_png}" != "no"], [
2751 AC_CHECK_HEADERS(png.h, [
2752   VLC_SAVE_FLAGS
2753   LDFLAGS="${LDFLAGS} -lz $LIBM"
2754   AC_CHECK_LIB(png, png_set_rows, [
2755     VLC_ADD_PLUGIN([png])
2756   ], [], [-lz $LIBM])
2757   VLC_RESTORE_FLAGS
2758   ])
2762 dnl  JPEG decoder module
2764 AC_ARG_ENABLE(jpeg,
2765   [  --enable-jpeg           JPEG support (default enabled)])
2766 AS_IF([test "${enable_jpeg}" != "no"], [
2767 AC_CHECK_HEADERS(jpeglib.h, [
2768   VLC_ADD_PLUGIN([jpeg])
2769   ])
2773 dnl  BPG decoder module
2775 AC_ARG_ENABLE(bpg,
2776   [  --enable-bpg           BPG support (default disabled)])
2777 AS_IF([test "${enable_bpg}" != "no"], [
2778 AC_CHECK_HEADERS(libbpg.h, [
2779   VLC_ADD_PLUGIN([bpg])
2780   ])
2784 dnl H262 encoder plugin (lib262)
2786 AC_ARG_ENABLE(x262,
2787   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2788 if test "${enable_x262}" != "no"; then
2789     PKG_CHECK_MODULES(X262, x262, [
2790         VLC_ADD_PLUGIN([x262])
2791         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2792         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2793           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2794         ])
2795         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2796         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2797           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2798         fi
2799     ], [
2800        if test "${enable_x262}" = "yes"; then
2801         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2802        fi
2803     ])
2806 dnl x265 encoder
2807 PKG_ENABLE_MODULES_VLC([X265],, [x265], [HEVC/H.265 encoder], [auto])
2810 dnl H264 encoder plugin (10-bit lib264)
2812 AC_ARG_ENABLE(x26410b,
2813   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2814 if test "${enable_x26410b}" != "no"; then
2815     PKG_CHECK_MODULES(X26410B, x26410b, [
2816         VLC_ADD_PLUGIN([x26410b])
2817         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2818         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2819           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2820         ])
2821         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2822         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2823           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2824         fi
2825     ], [
2826        if test "${enable_x26410b}" = "yes"; then
2827         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2828        fi
2829     ])
2834 dnl H264 encoder plugin (using libx264)
2836 AC_ARG_ENABLE(x264,
2837   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2838 if test "${enable_x264}" != "no"; then
2839       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2840         VLC_ADD_PLUGIN([x264])
2841         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2843         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2844           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2845         ])
2847         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2848         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2849           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2850         fi
2851       ],[
2852         if test "${enable_x264}" = "yes"; then
2853             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2854           fi
2855       ])
2859 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2861 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2864 dnl libfluidsynth (MIDI synthetizer) plugin
2866 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2869 dnl Teletext Modules
2870 dnl vbi decoder plugin (using libzbvi)
2871 dnl telx module
2872 dnl uncompatible
2874 AC_ARG_ENABLE(zvbi,
2875   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2876                   libzvbi (default enabled)]))
2877 AC_ARG_ENABLE(telx,
2878   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2879                   zvbi) (default enabled if zvbi is absent)]))
2881 AS_IF( [test "${enable_zvbi}" != "no"],[
2882     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2883         [
2884           VLC_ADD_PLUGIN([zvbi])
2885           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2886           AS_IF( [test "${enable_telx}" = "yes"],[
2887                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2888                   ])
2889         ],[
2890           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2891         ])
2892     ])
2893 AS_IF( [test "${enable_telx}" != "no" ],[
2894   VLC_ADD_PLUGIN([telx])
2895   ])
2898 dnl libass subtitle rendering module
2900 AC_ARG_ENABLE(libass,
2901   [  --enable-libass         Subtitle support using libass (default enabled)])
2902 AS_IF( [test "${enable_libass}" != "no"], [
2903   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2904       [
2905         VLC_ADD_PLUGIN([libass])
2907         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2908           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2909            VLC_ADD_LIBS([libass],[-lfontconfig])
2910        ])
2911       ],[
2912         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2913       ])
2914   ])
2917 dnl ARIB subtitles rendering module
2919 AC_ARG_ENABLE(aribsub,
2920   [  --enable-aribsub        ARIB Subtitles support (default enabled)])
2921 AS_IF( [test "${enable_aribsub}" != "no" ],[
2922   PKG_CHECK_MODULES(ARIBB24, [aribb24 >= 1.0.1], [
2923       have_aribb24="yes"
2924       VLC_ADD_PLUGIN([aribsub])
2925       VLC_ADD_LIBS([aribsub],[-laribb24])
2926       AC_DEFINE(HAVE_ARIBB24, 1, [Define if libaribb24 is available.])
2927     ],[
2928       AC_MSG_WARN(Library [aribb24] needed for [aribsub] was not found)
2929       have_aribb24="no"
2930   ])
2932 AM_CONDITIONAL([HAVE_ARIBB24], [test x"${have_aribb24}" = x"yes"])
2935 dnl ARIB B25
2937 PKG_ENABLE_MODULES_VLC([ARIBB25], [aribcam], [aribb25 >= 0.2.6], [ARIB STD-B25], [auto])
2940 dnl  kate decoder plugin
2942 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2945 dnl  tiger rendering for kate decoder plugin
2947 AC_ARG_ENABLE(tiger,
2948 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2949 AS_IF([test "${enable_tiger}" != "no"], [
2950   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2951       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2952         AS_IF([test -n "${enable_tiger}"], [
2953           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2954         ])
2955   ])
2960 dnl  Video plugins
2963 EXTEND_HELP_STRING([Video plugins:])
2966 dnl  OpenGL
2968 PKG_CHECK_MODULES([EGL], [egl], [
2969   have_egl="yes"
2970 ], [
2971   have_egl="no"
2973 AM_CONDITIONAL([HAVE_EGL], [test "${have_egl}" = "yes"])
2975 have_gl="no"
2976 PKG_CHECK_MODULES([GL], [gl], [
2977   have_gl="yes"
2978 ], [
2979   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2980 #ifdef _WIN32
2981 # include <GL/glew.h>
2982 #endif
2983 #include <GL/gl.h>
2984 ]], [
2985     [int t0 = GL_TEXTURE0;]])
2986   ], [
2987     GL_CFLAGS=""
2988     have_gl="yes"
2989     AS_IF([test "${SYS}" != "mingw32"], [
2990       GL_LIBS="-lGL"
2991     ], [
2992       GL_LIBS="-lopengl32"
2993     ])
2994   ])
2996 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
2998 dnl OpenGL ES 2: depends on EGL 1.1
2999 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
3000 dnl OpenGL ES 1: depends on EGL 1.0
3001 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
3004 dnl  Xlib
3007 AC_PATH_XTRA()
3008 AC_CHECK_HEADERS(X11/Xlib.h)
3011 dnl  X C Bindings modules
3013 AC_ARG_ENABLE(xcb,
3014   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3015   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"], [
3016     enable_xcb="yes"
3017   ], [
3018     enable_xcb="no"
3019   ])
3021 AC_ARG_ENABLE(xvideo,
3022   [  --enable-xvideo         XVideo support (default enabled)],, [
3023     enable_xvideo="$enable_xcb"
3026 have_xcb="no"
3027 have_xcb_keysyms="no"
3028 have_xcb_randr="no"
3029 have_xcb_xvideo="no"
3030 AS_IF([test "${enable_xcb}" != "no"], [
3031   dnl libxcb
3032   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3033   have_xcb="yes"
3034   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3035   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3036   PKG_CHECK_MODULES(XPROTO, [xproto])
3038   AS_IF([test "${enable_xvideo}" != "no"], [
3039     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3040   ])
3042   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3044   dnl xcb-utils
3045   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3046     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3047   ])
3049 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3050 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3051 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3052 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3056 dnl VDPAU needs X11
3058 AC_ARG_ENABLE(vdpau,
3059   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3060 have_vdpau="no"
3061 AS_IF([test "${enable_vdpau}" != "no"], [
3062   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3063     have_vdpau="yes"
3064     AS_IF([test "${no_x}" = "yes"], [
3065       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3066     ])
3067   ], [
3068     AS_IF([test -n "${enable_vdpau}"], [
3069       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3070     ])
3071   ])
3073 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3075 have_avcodec_vdpau="no"
3076 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3077   case "${avfork}" in
3078     libav) av_vdpau_ver="55.26.0" ;;
3079     ffmpeg) av_vdpau_ver="55.42.100" ;;
3080   esac
3081   PKG_CHECK_EXISTS([libavutil >= 52.4.0 libavcodec >= ${av_vdpau_ver}], [
3082     have_avcodec_vdpau="yes"
3083     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3084   ], [
3085     AS_IF([test -n "${enable_vdpau}"], [
3086       AC_MSG_ERROR([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3087     ], [
3088       AC_MSG_WARN([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3089     ])
3090   ])
3092 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3096 dnl  Wayland
3098 AC_ARG_ENABLE(wayland,
3099   [AS_HELP_STRING([--enable-wayland], [Wayland support (default auto)])])
3100 have_wayland="no"
3101 AC_ARG_VAR([WAYLAND_SCANNER], [Wayland scanner utility])
3103 AS_IF([test "${enable_wayland}" != "no"], [
3104   AC_MSG_CHECKING([for the Wayland scanner])
3105   AS_IF([test -z "$WAYLAND_SCANNER"], [
3106     PKG_CHECK_EXISTS([wayland-scanner], [
3107       WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
3108     ], [
3109       WAYLAND_SCANNER="wayland-scanner"
3110     ])
3111   ])
3112   AC_MSG_RESULT([$WAYLAND_SCANNER])
3114   PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91], [
3115     have_wayland="yes"
3116   ], [
3117     AS_IF([test -n "${enable_wayland}"], [
3118       AC_MSG_ERROR([${WAYLAND_CLIENT_PKG_ERRORS}.])
3119     ])
3120   ])
3122   AS_IF([test "${have_egl}" = "yes"], [
3123     PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [
3124       have_wayland_egl="yes"
3125     ], [
3126       AS_IF([test -n "${enable_wayland}"], [
3127         AC_MSG_ERROR([${WAYLAND_EGL_PKG_ERRORS}.])
3128       ])
3129     ])
3130   ])
3132 AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
3133 AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "${have_wayland_egl}" = "yes"])
3137 dnl  SDL module
3139 AC_ARG_ENABLE(sdl,
3140   [  --enable-sdl            SDL support (default enabled)])
3141 AC_ARG_ENABLE(sdl-image,
3142   [  --enable-sdl-image      SDL image support (default enabled)])
3143 if test "${enable_sdl}" != "no"
3144 then
3145    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3146       # SDL on Darwin is heavily patched and can only run SDL_image
3147       if test "${SYS}" != "darwin"; then
3148         VLC_ADD_PLUGIN([vout_sdl])
3149       fi
3151       # SDL_image
3152       AS_IF([ test "${enable_sdl_image}" != "no"],[
3153         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3154           VLC_ADD_PLUGIN([sdl_image])],
3155           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3156           ])
3157       ])
3158    ],[
3159      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3160    ])
3164 dnl  freetype module
3166 AC_ARG_ENABLE(freetype,
3167   [  --enable-freetype       freetype support   (default auto)])
3168 AC_ARG_ENABLE(fribidi,
3169   [  --enable-fribidi        fribidi support    (default auto)])
3170 AC_ARG_ENABLE(harfbuzz,
3171   [  --enable-harfbuzz       harfbuzz support   (default auto)])
3172 AC_ARG_ENABLE(fontconfig,
3173   [  --enable-fontconfig     fontconfig support (default auto)])
3175 AC_ARG_WITH([default-font],
3176     AS_HELP_STRING([--with-default-font=PATH],
3177         [Path to the default font]),
3178         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3179             "$withval", [Default font])])
3180 AC_ARG_WITH([default-monospace-font],
3181     AS_HELP_STRING([--with-default-monospace-font=PATH],
3182         [Path to the default font]),
3183         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3184             "$withval", [Default monospace font])])
3186 AC_ARG_WITH([default-font-family],
3187     AS_HELP_STRING([--with-default-font-family=NAME],
3188         [Path to the default font family]),
3189         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3190             "$withval", [Default font family])])
3191 AC_ARG_WITH([default-monospace-font-family],
3192     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3193         [Path to the default font family]),
3194         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3195             "$withval", [Default monospace font family])])
3197 have_freetype="no"
3198 have_fontconfig="no"
3199 have_fribidi="no"
3200 have_harfbuzz="no"
3202 if test "${enable_freetype}" != "no"; then
3203    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3204       have_freetype="yes"
3205       VLC_ADD_CPPFLAGS([skins2],[${FREETYPE_CFLAGS}])
3206       VLC_ADD_LIBS([skins2],[${FREETYPE_LIBS}])
3208       dnl fontconfig support
3209       if test "${SYS}" != "mingw32"; then
3210           if test "${enable_fontconfig}" != "no"; then
3211             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3212               have_fontconfig="yes"
3213             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3214           fi
3215       fi
3217       dnl fribidi support
3218       if test "${enable_fribidi}" != "no"; then
3219         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3220           have_fribidi="yes"
3221           VLC_ADD_CPPFLAGS([skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3222           VLC_ADD_LIBS([skins2], [${FRIBIDI_LIBS}])
3223         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional text and complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3224       fi
3226       dnl harfbuzz support
3227       if test "${have_fribidi}" != "no"; then
3228         if test "${enable_harfbuzz}" != "no"; then
3229           PKG_CHECK_MODULES(HARFBUZZ, harfbuzz, [
3230             have_harfbuzz="yes"
3231             VLC_ADD_CPPFLAGS([skins2], [${HARFBUZZ_CFLAGS} -DHAVE_HARFBUZZ])
3232             VLC_ADD_LIBS([skins2], [${HARFBUZZ_LIBS}])
3233           ],[AC_MSG_WARN([${HARFBUZZ_PKG_ERRORS}. Support for complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3234         fi
3235       fi
3236   ],[
3237   AS_IF([test -n "${enable_freetype}"],[
3238     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3239     ])
3240   ])
3243 AM_CONDITIONAL([HAVE_FREETYPE], [test "${have_freetype}" = "yes"])
3244 AM_CONDITIONAL([HAVE_FONTCONFIG], [test "${have_fontconfig}" = "yes"])
3245 AM_CONDITIONAL([HAVE_FRIBIDI], [test "${have_fribidi}" = "yes"])
3246 AM_CONDITIONAL([HAVE_HARFBUZZ], [test "${have_harfbuzz}" = "yes"])
3249 dnl SAPI (text to Speech renderer for Windows)
3251 AC_CHECK_HEADERS(sapi.h, [
3252               have_sapi="yes"
3253             ],[AC_MSG_WARN([sapi.h not found. Text to Speech renderer for Windows disabled])])
3255 AM_CONDITIONAL([HAVE_SAPI], [test "${have_sapi}" = "yes"])
3258 dnl  QuartzText vout module (iOS/Mac OS)
3260 AC_ARG_ENABLE(macosx-quartztext,
3261   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3262 if test "x${enable_macosx_quartztext}" != "xno" &&
3263   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3264 then
3265   VLC_ADD_PLUGIN([quartztext])
3269 dnl  SVG module (text rendering and image decoding)
3271 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3272 PKG_ENABLE_MODULES_VLC([SVGDEC], [], [librsvg-2.0 >= 2.9.0 cairo >= 1.13.1], [SVG image decoder library],[auto])
3275 dnl  Windows DirectX module
3278 AC_ARG_ENABLE(directx,
3279   [AS_HELP_STRING([--enable-directx],
3280     [Microsoft DirectX support (default enabled on Windows)])],, [
3281   AS_IF([test "${SYS}" = "mingw32"], [
3282     enable_directx="yes"
3283   ], [
3284     enable_directx="no"
3285   ])
3287 have_directx="no"
3288 AS_IF([test "${enable_directx}" != "no"], [
3289   dnl DirectDraw
3290   AC_CHECK_HEADERS(ddraw.h, [
3291     have_directx="yes"
3292   ], [
3293     AC_MSG_ERROR([Cannot find DirectX headers!])
3294   ])
3296   dnl OpenGL
3297   AC_CHECK_HEADERS(GL/wglew.h, [
3298     VLC_ADD_PLUGIN([glwin32])
3299   ],, [
3300     #include <windows.h>
3301     #include <GL/gl.h>
3302   ])
3304   dnl Direct3D11
3305   AC_CHECK_HEADERS(d3d11.h, [
3306     VLC_ADD_PLUGIN([direct3d11])
3307   ])
3309   dnl Direct3D9
3310   AC_CHECK_HEADERS(d3d9.h, [
3311     VLC_ADD_PLUGIN([direct3d9])
3312   ])
3314   dnl Direct2D
3315   AC_CHECK_HEADERS(d2d1.h, [
3316     VLC_ADD_PLUGIN([direct2d])
3317   ])
3319 AM_CONDITIONAL([HAVE_DIRECTX], [test "$have_directx" = "yes"])
3322 dnl  Linux framebuffer module
3324 AC_CHECK_HEADER([linux/fb.h], [
3325   VLC_ADD_PLUGIN([fb])
3330 dnl  DirectFB module
3331 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3332 dnl  TODO: support for static linking
3334 AC_ARG_ENABLE(directfb,
3335   [  --enable-directfb       DirectFB support (default disabled)])
3336 AC_ARG_WITH(directfb,
3337   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3339 if test "${enable_directfb}" = "yes"; then
3340     have_directfb="false"
3341     CPPFLAGS_mydirectfb=
3342     LIBS_mydirectfb=
3343     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3344         dnl Trying the given location
3345         VLC_SAVE_FLAGS
3347         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3348         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3350         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3351         LIBS="${LIBS} ${LIBS_new}"
3353         dnl FIXME: too obscure
3354         AC_CHECK_HEADER([directfb.h], [
3355             AC_CHECK_LIB([direct],[direct_initialize], [
3356                 AC_CHECK_LIB([fusion], [fusion_enter], [
3357                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3358                 ], have_directfb="false")
3359             ], have_directfb="false")
3360         ], have_directfb="false")
3362         VLC_RESTORE_FLAGS
3364         if test "${have_directfb}" = "true"; then
3365             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3366             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3367         fi
3368     else
3369         dnl Look for directfb-config
3370         AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
3371         if test "${DIRECTFB_CONFIG}" != "no"; then
3372             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3373             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3374             have_directfb="true"
3375         else
3376             dnl Trying with pkg-config
3377             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3378                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3379                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3380                 have_directfb="true"
3381                 ], [have_directfb="false"])
3382         fi
3383     fi
3384     if test "${have_directfb}" = "true"; then
3385         VLC_ADD_PLUGIN([directfb])
3386         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3387         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3388     else
3389         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3390     fi
3394 dnl  AA plugin
3396 AC_ARG_ENABLE(aa,
3397   [  --enable-aa             aalib output (default disabled)])
3398 if test "${enable_aa}" = "yes"
3399 then
3400   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3401   if test "${have_aa}" = "true"
3402   then
3403     VLC_ADD_PLUGIN([aa])
3404   fi
3408 dnl  libcaca plugin
3410 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3413 dnl  OS/2 KVA plugin
3415 AC_ARG_ENABLE(kva,
3416   [AS_HELP_STRING([--enable-kva],
3417     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3418   AS_IF([test "$SYS" = "os2"], [
3419     enable_kva="yes"
3420   ])
3422 have_kva="no"
3423 KVA_LIBS=""
3424 AS_IF([test "$enable_kva" != "no"], [
3425   AC_CHECK_HEADERS([kva.h], [
3426     have_kva="yes"
3427     AC_CHECK_LIB(kva, main, [
3428       KVA_LIBS="-lkva"
3429     ])
3430   ])
3432 AC_SUBST(KVA_LIBS)
3433 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3436 dnl MMAL plugin
3438 AC_ARG_ENABLE(mmal,
3439   AS_HELP_STRING([--enable-mmal],
3440     [Multi-Media Abstraction Layer (MMAL) hardware plugin (default enable)]))
3441 if test "${enable_mmal}" != "no"; then
3442   VLC_SAVE_FLAGS
3443   LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
3444   CPPFLAGS="${CPPFLAGS} -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
3445   AC_CHECK_HEADERS(interface/mmal/mmal.h,
3446     [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
3447         have_mmal="yes"
3448         VLC_ADD_PLUGIN([mmal])
3449         VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
3450         VLC_ADD_CFLAGS([mmal],[ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux ])
3451         VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lvchostif ]) ], [
3452           AS_IF([test "${enable_mmal}" = "yes"],
3453             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
3454             [ AC_MSG_WARN([Cannot find bcm library...]) ])
3455           ],
3456         [])
3457     ] , [ AS_IF([test "${enable_mmal}" = "yes"],
3458       [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
3459       [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
3460   VLC_RESTORE_FLAGS
3462 AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
3465 dnl evas plugin
3467 AC_ARG_ENABLE(evas,
3468   [AS_HELP_STRING([--enable-evas],
3469     [use evas output module (default disabled)])])
3470 have_evas="no"
3471 AS_IF([test "${enable_evas}" = "yes"], [
3472   PKG_CHECK_MODULES(EVAS, [evas >= 1.15.99 ecore >= 1.15.99], [
3473       have_evas="yes"
3474       AC_DEFINE([HAVE_EVAS], [1], [Define to 1 if evas is enabled.])
3475     ],[
3476     AS_IF([test "x${enable_evas}" != "x"], [
3477       AC_MSG_ERROR([$EVAS_PKG_ERRORS. libevas and libecore 1.15.99 or later required.])
3478     ])
3479   ])
3481 AM_CONDITIONAL([HAVE_EVAS], [test "${have_evas}" = "yes"])
3484 dnl  Audio plugins
3487 EXTEND_HELP_STRING([Audio plugins:])
3490 dnl  Pulseaudio module
3492 AC_ARG_ENABLE(pulse,
3493   [AS_HELP_STRING([--enable-pulse],
3494     [use the PulseAudio client library (default auto)])])
3495 have_pulse="no"
3496 AS_IF([test "${enable_pulse}" != "no"], [
3497   PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0], [
3498     have_pulse="yes"
3499   ], [
3500     AS_IF([test "x${enable_pulse}" != "x"], [
3501       AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 1.0 or later required.])
3502     ])
3503   ])
3505 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3508 dnl  ALSA module
3510 AC_ARG_ENABLE(alsa,
3511   [AS_HELP_STRING([--enable-alsa],
3512     [support the Advanced Linux Sound Architecture (default auto)])],, [
3513   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3514     enable_alsa="yes"
3515   ])
3517 have_alsa="no"
3518 AS_IF([test "${enable_alsa}" != "no"], [
3519   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3520     have_alsa="yes"
3521   ], [
3522     AS_IF([test "x${enable_alsa}" != "x"], [
3523       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3524     ])
3525   ])
3527 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3530 dnl  Open Sound System module
3532 AC_ARG_ENABLE(oss,
3533   [AS_HELP_STRING([--enable-oss],
3534     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3535   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3536     enable_oss="no"
3537   ])
3539 have_oss="no"
3540 OSS_LIBS=""
3541 AS_IF([test "$enable_oss" != "no"], [
3542   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3543     have_oss="yes"
3544     AC_CHECK_LIB(ossaudio, main, [
3545       OSS_LIBS="-lossaudio"
3546     ])
3547   ])
3549 AC_SUBST(OSS_LIBS)
3550 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3553 dnl  OpenBSD sndio module
3555 AC_ARG_ENABLE([sndio],
3556   [AS_HELP_STRING([--disable-sndio],
3557     [support the OpenBSD sndio (default auto)])],, [
3558   AS_IF([test "$SYS" = "openbsd"], [
3559     enable_sndio="yes"
3560   ])
3562 have_sndio="no"
3563 AS_IF([test "$enable_sndio" != "no"], [
3564   AC_CHECK_HEADER([sndio.h], [
3565     have_sndio="yes"
3566   ])
3568 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3571 dnl  Windows Audio Session plugin
3573 AC_ARG_ENABLE([wasapi],
3574   [AS_HELP_STRING([--enable-wasapi],
3575     [use the Windows Audio Session API (default auto)])
3577 have_wasapi="no"
3578 AS_IF([test "$enable_wasapi" != "no"], [
3579   AC_CHECK_HEADER([audioclient.h], [
3580     have_wasapi="yes"
3581   ], [
3582     AS_IF([test "x${enable_wasapi}" != "x"], [
3583       AC_MSG_ERROR([Windows Audio Session API not found.])
3584     ])
3585   ])
3587 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3590 dnl  AudioQueue plugin
3592 AC_ARG_ENABLE(audioqueue,
3593   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3594 if test "${enable_audioqueue}" = "yes"
3595 then
3596   VLC_ADD_PLUGIN([audioqueue])
3600 dnl  JACK modules
3602 AC_ARG_ENABLE(jack,
3603   [AS_HELP_STRING([--disable-jack],
3604     [do not use jack (default auto)])])
3605 have_jack="no"
3606 AS_IF([test "${enable_jack}" != "no"], [
3607     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3608       [ have_jack=yes ],
3609       [
3610       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3612       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3613       [ have_jack=yes ],
3614       [
3615       AS_IF([test -n "${enable_jack}"],
3616          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3617          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3618       ])
3619     ])
3621 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3624 dnl  OpenSLES Android
3626 AC_ARG_ENABLE(opensles,
3627   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3628 if test "${HAVE_ANDROID}" = "1"; then
3629   if test "${enable_opensles}" = "yes"; then
3630       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3631         [ VLC_ADD_PLUGIN([opensles_android]) ],
3632         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3633   fi
3637 dnl  Tizen audio
3639 AC_ARG_ENABLE(tizen_audio,
3640   [AS_HELP_STRING([--enable-tizen-audio],
3641     [Tizen audio module (default enabled on Tizen)])],, [
3642   AS_IF([test "$HAVE_TIZEN" = "1"], [
3643     enable_tizen_audio="yes"
3644   ])
3646 if test "${enable_tizen_audio}" = "yes"; then
3647   AC_CHECK_HEADERS(audio_io.h,
3648     [ VLC_ADD_PLUGIN([tizen_audio]) ],
3649     [ AC_MSG_ERROR([cannot find Tizen audio_io headers])] )
3653 dnl libsamplerate plugin
3655 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3658 dnl  soxr module
3660 PKG_ENABLE_MODULES_VLC([SOXR], [], [soxr >= 0.1.2], [SoX Resampler library], [auto])
3663 dnl  OS/2 KAI plugin
3665 AC_ARG_ENABLE(kai,
3666   [AS_HELP_STRING([--enable-kai],
3667     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3668   AS_IF([test "$SYS" = "os2"], [
3669     enable_kai="yes"
3670   ])
3672 have_kai="no"
3673 KAI_LIBS=""
3674 AS_IF([test "$enable_kai" != "no"], [
3675   AC_CHECK_HEADERS([kai.h], [
3676     have_kai="yes"
3677     AC_CHECK_LIB(kai, main, [
3678       KAI_LIBS="-lkai"
3679     ])
3680   ])
3682 AC_SUBST(KAI_LIBS)
3683 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3686 dnl  chromaprint audio track fingerprinter
3688 m4_pushdef([libchromaprint_version], 0.6.0)
3689 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3690     VLC_ADD_PLUGIN([stream_out_chromaprint]),
3691     AS_IF([test "${enable_chromaprint}" = "yes"],
3692         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3693         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3694          ),
3695     [(Chromaprint based audio fingerprinter)],[auto])
3696 m4_popdef([libchromaprint_version])
3699 dnl  Chromecast streaming support
3701 m4_pushdef([protobuf_lite_version], 2.5.0)
3702 AC_ARG_VAR(PROTOC, [protobuf compiler])
3703 AC_CHECK_PROGS(PROTOC, protoc, no)
3704 PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
3705     AS_IF([test "x${PROTOC}" != "xno"], [
3706         build_chromecast="yes"
3707     ], [
3708     AC_MSG_ERROR(protoc compiler needed for [chromecast] was not found)
3709     ])
3710 ], [
3711     AS_IF([test "${enable_chromecast}" = "yes"],
3712         AC_MSG_ERROR(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found),
3713         AC_MSG_WARN(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found)
3714     )
3715     enable_chromecast="no"
3716 ], [(Chromecast streaming support)], [auto])
3717 AM_CONDITIONAL([BUILD_CHROMECAST], [test "${build_chromecast}" = "yes"])
3718 m4_popdef([protobuf_lite_version])
3721 dnl  Interface plugins
3724 EXTEND_HELP_STRING([Interface plugins:])
3727 dnl QT
3729 AC_ARG_ENABLE(qt, [
3730   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3731   AS_IF([test "${SYS}" = "darwin"], [
3732     enable_qt="no"
3733   ])
3735 AS_IF([test "${enable_qt}" != "no"], [
3736   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
3737       PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
3738           VLC_ADD_LIBS([qt4],[${QTX11_LIBS}])
3739           VLC_ADD_CXXFLAGS([qt4],[${QTX11_CFLAGS} -DQT5_HAS_X11])
3740           PKG_CHECK_MODULES([XI], [xi], [
3741             VLC_ADD_LIBS([qt4], [${XI_LIBS}])
3742             VLC_ADD_CXXFLAGS([qt4], [${XI_CFLAGS} -DHAVE_XI])
3743           ], [
3744             PKG_CHECK_EXISTS([Qt5Gui >= 5.5], [
3745               AC_MSG_ERROR([${XI_PKG_ERRORS}.])
3746             ], [
3747               AC_MSG_WARN([${XI_PKG_ERRORS}.])
3748             ])
3749           ])
3750       ],[
3751           AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
3752       ])
3753       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3754       QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
3755       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3756       AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3757       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3758     ], [
3759       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3760         AS_IF([test -n "${enable_qt}"],[
3761           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3762         ],[
3763           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3764         ])
3765         enable_qt="no"
3766       ])
3767       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3768       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3769       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3770       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3771     ])
3773 AS_IF([test "${enable_qt}" != "no"], [
3774   VLC_ADD_PLUGIN([qt4])
3775   ALIASES="${ALIASES} qvlc"
3777 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3780 dnl Simple test for skins2 dependency
3782 AS_IF([test "$enable_qt" = "no"], [
3783   AS_IF([test "${enable_skins2}" = "yes"], [
3784     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.])
3785   ], [
3786     enable_skins2="no"
3787     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3788   ])
3792 dnl Skins2 module
3794 AC_ARG_ENABLE(skins2,
3795   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3796 AS_IF([test "${enable_skins2}" != "no"], [
3797   have_skins_deps="yes"
3799   dnl Win32
3800   AS_IF([test "${SYS}" = "mingw32"], [
3801     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3802     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3803   dnl MacOS
3804   ], [test "${SYS}" = "darwin"], [
3805     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3806     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3807   dnl OS/2
3808   ], [test "${SYS}" = "os2"], [
3809     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3810   dnl Linux/Unix
3811   ], [
3812     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3813     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3814     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3815     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3816     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3817   ])
3819   dnl for All OSes
3820   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3822   dnl we need freetype
3823   AS_IF([test "${have_freetype}" != "yes"], [
3824     have_skins_deps="no"
3825   ])
3827   AS_IF([test "${have_skins_deps}" = "no"], [
3828     AS_IF([test "x${enable_skins2}" = "x"], [
3829       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3830     ], [
3831       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3832     ])
3833     enable_skins2="no"
3834   ], [
3835     VLC_ADD_PLUGIN([skins2])
3836     ALIASES="${ALIASES} svlc"
3837     enable_skins2="yes"
3838   ])
3840 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3842 AC_ARG_ENABLE(libtar,
3843   [  --enable-libtar         libtar support for skins2 (default auto)])
3844 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3845   AC_CHECK_HEADERS(libtar.h, [
3846     VLC_ADD_LIBS([skins2],[-ltar])
3847   ])
3851 dnl  MacOS X gui module
3853 AC_ARG_ENABLE(macosx,
3854   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3855 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3856 then
3857   VLC_ADD_PLUGIN([macosx])
3859   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3860   then
3861     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3862   fi
3864 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3867 dnl  MacOS X sparkle update support
3869 AC_ARG_ENABLE(sparkle,
3870   [  --enable-sparkle        Sparkle update support for OS X (default enabled on Mac OS X)])
3871 if test "x${enable_sparkle}" != "xno" -a "${HAVE_OSX}" = "1"
3872 then
3873   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3874   then
3875     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3876   fi
3878   AC_DEFINE([HAVE_SPARKLE], [1], [Define to 1 if sparkle is enabled.])
3880 AM_CONDITIONAL(HAVE_SPARKLE, [test "$enable_sparkle" != "no"])
3884 dnl  Minimal Mac OS X module
3886 AC_ARG_ENABLE(minimal-macosx,
3887   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3888 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3889 then
3890   VLC_ADD_PLUGIN([minimal_macosx])
3894 dnl  MacOS X dialog provider
3896 AC_ARG_ENABLE(macosx-dialog-provider,
3897   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3898 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3899   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3900 then
3901   VLC_ADD_PLUGIN([macosx_dialog_provider])
3905 dnl  VideoToolbox plugins
3906 AC_CHECK_HEADERS(VideoToolbox/VideoToolbox.h, [
3907     VLC_ADD_PLUGIN([videotoolbox])
3908     VLC_ADD_PLUGIN([cvpx_i420])
3909   ])
3912 dnl  ncurses module
3914 AC_ARG_ENABLE(ncurses,
3915 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3916 have_ncurses="no"
3917 AS_IF([test "${enable_ncurses}" != "no"] ,[
3918   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3919     have_ncurses="yes"
3920     ALIASES="${ALIASES} nvlc"
3921   ], [
3922     AS_IF([test -n "${enable_ncurses}"], [
3923       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3924     ])
3925   ])
3927 AM_CONDITIONAL([HAVE_NCURSES], [test "${have_ncurses}" = "yes"])
3930 dnl  Lirc plugin
3932 AC_ARG_ENABLE(lirc,
3933   [  --enable-lirc           lirc support (default disabled)])
3934 have_lirc="no"
3935 AS_IF([test "${enable_lirc}" = "yes"], [
3936   AC_CHECK_HEADER(lirc/lirc_client.h, [
3937     AC_CHECK_LIB(lirc_client, lirc_init, [
3938       have_lirc="true"
3939     ])
3940   ])
3942 AM_CONDITIONAL([HAVE_LIRC], [test "${have_lirc}" = "yes"])
3944 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3946 dnl  goom visualization plugin
3948 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3951 dnl libprojectM visualization plugin
3953 AC_ARG_ENABLE(projectm,
3954   [  --enable-projectm       projectM visualization plugin (default enabled)])
3955 AS_IF([test "${enable_projectm}" != "no"],
3956   [
3957     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3958     [
3959       VLC_ADD_PLUGIN([projectm])
3960       PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
3961         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3962         [ AC_MSG_WARN( [Using libprojectM version 1] )
3963       ])
3964     ],[
3965       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3966     ])
3967   ])
3970 dnl Vovoid VSXu visualization plugin
3972 AC_ARG_ENABLE(vsxu,
3973   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3974 AS_IF([test "${enable_vsxu}" != "no"],
3975   [
3976     PKG_CHECK_MODULES(VSXU, libvsxu,
3977     [
3978       VLC_ADD_PLUGIN([vsxu])
3979     ],[
3980       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3981     ])
3982   ])
3984 EXTEND_HELP_STRING([Service Discovery plugins:])
3986 dnl  Bonjour services discovery
3987 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3990 dnl  libudev services discovery
3991 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3994 dnl MTP devices services discovery
3995 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3998 dnl UPnP Plugin (Intel SDK)
4000 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
4002 EXTEND_HELP_STRING([Misc options:])
4005 dnl  libxml2 module
4007 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
4011 dnl libgcrypt
4013 AC_ARG_ENABLE(libgcrypt,
4014   [  --disable-libgcrypt     gcrypt support (default enabled)])
4015 # require libgcrypt >= 1.6.0
4016 AS_IF([test "${enable_libgcrypt}" != "no"], [
4017   AC_TRY_COMPILE([
4018 #include <gcrypt.h>
4019 #if GCRYPT_VERSION_NUMBER < 0x010600
4020 #error
4021 #endif],
4022   [], [
4023     have_libgcrypt="yes"
4024     AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
4025     GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
4026     GCRYPT_LIBS="`libgcrypt-config --libs`"
4027   ], [
4028     AS_IF([test "${enable_libgcrypt}" == "yes"], [
4029       AC_MSG_ERROR([libgcrypt version 1.6.0 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
4030     ])
4031   ])
4034 AC_SUBST(GCRYPT_CFLAGS)
4035 AC_SUBST(GCRYPT_LIBS)
4036 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
4039 dnl TLS/SSL
4041 AC_ARG_ENABLE(gnutls,
4042   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4043 AS_IF([test "${enable_gnutls}" != "no"], [
4044   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.2.0], [
4045     VLC_ADD_PLUGIN([gnutls])
4046   ], [
4047     AS_IF([test -n "${enable_gnutls}"], [
4048       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4049     ])
4050   ])
4055 dnl Taglib plugin
4057 AC_ARG_ENABLE(taglib,
4058   [AS_HELP_STRING([--disable-taglib],
4059     [do not use TagLib (default enabled)])])
4060 AS_IF([test "${enable_taglib}" != "no"], [
4061   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.9, [
4062     VLC_ADD_PLUGIN([taglib])
4063   ], [
4064     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4068 dnl  Developers helper modules (should be hidden from configure help)
4070 AC_ARG_ENABLE(devtools, [], [], [enable_devtools="no"])
4071 AS_IF([test "${enable_devtools}" != "no"], [
4072   VLC_ADD_PLUGIN([accesstweaks])
4076 dnl update checking system
4078 AC_ARG_ENABLE(update-check,
4079   [  --enable-update-check   update checking system (default disabled)])
4080 if test "${enable_update_check}" = "yes"
4081 then
4082   if test "${have_libgcrypt}" != "yes"
4083   then
4084     AC_MSG_ERROR([libgcrypt is required for update checking system])
4085   fi
4086   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4087   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4088   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4092 dnl OS X notification plugin
4094 AC_ARG_ENABLE(osx_notifications,
4095   [  --enable-osx-notifications          osx notification plugin (default disabled)],,
4096   [enable_osx_notifications=no])
4097 AS_IF([test "${enable_osx_notifications}" != "no"], [
4098     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4099       VLC_ADD_PLUGIN([osx_notifications])
4100       VLC_ADD_LIBS([osx_notifications], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4101       VLC_ADD_OBJCFLAGS([osx_notifications], [-F${CONTRIB_DIR}])
4102       VLC_ADD_OBJCFLAGS([osx_notifications], [-fobjc-exceptions] )
4103     ])
4104   ]
4108 dnl Libnotify notification plugin
4110 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4113 dnl  Endianness check
4115 AC_C_BIGENDIAN
4116 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4117   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4118 ], [
4119   DEFS_BIGENDIAN=""
4121 AC_SUBST(DEFS_BIGENDIAN)
4124 dnl Where to install KDE solid .desktop
4126 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4127 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4128   KDE4_CONFIG="kde4-config"
4131 AC_ARG_WITH(kde-solid,
4132   AS_HELP_STRING([--with-kde-solid=PATH],
4133                  [KDE Solid actions directory (auto)]),, [
4135 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4136   with_kde_solid="yes"
4139 soliddatadir=""
4140 AS_IF([test "${with_kde_solid}" != "no"], [
4141   AS_IF([test "${with_kde_solid}" = "yes"], [
4142     kde4datadir="`${KDE4_CONFIG} --install data`"
4143     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4144     soliddatadir="${kde4datadir}/solid/actions"
4145   ], [
4146     soliddatadir="${with_kde_solid}"
4147   ])
4149 AC_SUBST(soliddatadir)
4150 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4152 EXTEND_HELP_STRING([Components:])
4155 dnl  the VLC binary
4157 AC_ARG_ENABLE(vlc,
4158   [  --enable-vlc            build the VLC media player (default enabled)])
4159 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4161 AC_ARG_ENABLE(macosx-vlc-app,
4162   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4163 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4164     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4167 dnl  Stuff used by the program
4169 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4170 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4171 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4172 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4173 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4174 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4175 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4176 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4177 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4178 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4179 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4180 AC_SUBST(COPYRIGHT_MESSAGE)
4181 AC_SUBST(VERSION_MESSAGE)
4182 AC_SUBST(VERSION_MAJOR)
4183 AC_SUBST(VERSION_MINOR)
4184 AC_SUBST(VERSION_REVISION)
4185 AC_SUBST(VERSION_EXTRA)
4186 AC_SUBST(COPYRIGHT_YEARS)
4187 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4188 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4189 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4191 dnl  Handle substvars that use $(top_srcdir)
4193 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4196 dnl  Configuration is finished
4198 AC_SUBST(SYS)
4199 AC_SUBST(ARCH)
4200 AC_SUBST(ALIASES)
4201 AC_SUBST(ASM)
4202 AC_SUBST(MOC)
4203 AC_SUBST(RCC)
4204 AC_SUBST(UIC)
4205 AC_SUBST(WINDRES)
4206 AC_SUBST(WINE_SDK_PATH)
4207 AC_SUBST(LIBEXT)
4208 AC_SUBST(AM_CPPFLAGS)
4209 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4210 AC_SUBST(FILE_LIBVLCCORE_DLL)
4211 AC_SUBST(FILE_LIBVLC_DLL)
4213 AC_CONFIG_FILES([
4214   Makefile
4215   doc/Makefile
4216   modules/Makefile
4217   m4/Makefile
4218   po/Makefile.in
4219   share/Makefile
4220   compat/Makefile
4221   src/Makefile
4222   lib/Makefile
4223   bin/Makefile
4224   test/Makefile
4225   modules/gui/macosx/Makefile
4226   modules/gui/qt4/Makefile
4227   modules/gui/skins2/Makefile
4228   modules/hw/mmal/Makefile
4231 AM_COND_IF([HAVE_WIN32], [
4232   AC_CONFIG_FILES([
4233     extras/package/win32/NSIS/spad.nsi
4234     extras/package/win32/NSIS/vlc.win32.nsi
4235     extras/package/win32/msi/config.wxi
4236   ])
4239 AM_COND_IF([HAVE_DARWIN], [
4240   AC_CONFIG_FILES([
4241     extras/package/macosx/Info.plist
4242     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4243   ])
4246 dnl Generate makefiles
4247 AC_OUTPUT
4249 dnl Do we have to use make or gmake ?
4250 if make --version 2>&1|grep -q GNU
4251 then
4252     # GNU make, all seems good
4253     MAKE=make
4254 else
4255     # Known GNU make alias (on BSD)
4256     MAKE=gmake
4258 dnl Shortcut to nice compile message
4259 if test -n $SHELL; then
4260   SHELL=${CONFIG_SHELL-/bin/sh}
4262 rm -f compile
4263 compile_top_srcdir=`sed -ne "s/^top_srcdir *= *//p" < Makefile`
4264 echo "#! $SHELL
4265 rm -f .error\$\$
4266 ERROR=0
4267 export PATH=\"$PATH\" LANG=C
4268 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| $compile_top_srcdir/extras/buildsystem/make.pl
4269 test -f .error\$\$ && ERROR=1
4270 rm -f .error\$\$
4271 exit \$ERROR" >compile
4272 chmod a+x compile
4274 echo "
4275 libvlc configuration
4276 --------------------
4277 version               : ${VERSION}
4278 system                : ${SYS}
4279 architecture          : ${ARCH}
4280 optimizations         : ${enable_optimizations}"
4281 if test "${enable_vlc}" != "no"; then
4282 echo "vlc aliases           :${ALIASES}"
4283 else
4284 echo "build vlc executable  : no"
4286 echo "
4287 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."