macosx: add build schemes to Xcode project for complete compilation
[vlc/multisubs.git] / configure.ac
blob49f479384474eed66002afca2613d42bc7b50067
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 AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.])
49 AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
50 AH_TOP([
51 #ifndef _REENTRANT
52 # define _REENTRANT
53 #endif
55 AC_DEFINE([_THREAD_SAFE],, [Same as _REENTANT for some other OSes.])
56 AC_DEFINE([__LIBVLC__],, [Define within the LibVLC source code tree.])
57 AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])
59 AM_PROG_CC_C_O
60 AC_PROG_CXX
61 AC_PROG_CPP
62 AC_PROG_OBJC
63 _AM_DEPENDENCIES([OBJC])
64 AC_PROG_EGREP
65 AC_PROG_MAKE_SET
66 AC_PROG_INSTALL
67 AM_PROG_AS
69 AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
70 AC_CHECK_PROGS(DESKTOP_FILE_VALIDATE, [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
71 AC_PATH_PROG(YASM, yasm)
72 AC_ARG_VAR([BUILDCC], [Build system C99 compiler command])
73 AC_PATH_PROGS(BUILDCC, [c99-gcc c99])
75 dnl Check for compiler properties
76 AC_C_CONST
77 AC_C_INLINE
78 AC_C_RESTRICT
79 AX_CXX_COMPILE_STDCXX_11(noext, optional)
81 dnl Extend the --help string at the current spot.
82 AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
84 dnl Allow binary package maintainer to pass a custom string to avoid
85 dnl cache problem
86 AC_ARG_WITH(binary-version,
87     AS_HELP_STRING([--with-binary-version=STRING],
88          [To avoid plugins cache problem between binary version]),[],[])
89 AS_IF([test -n "${with_binary_version}"],[
90     AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
91          [Binary specific version])
94 dnl
95 dnl  Check the operating system
96 dnl
97 HAVE_WIN64="0"
98 HAVE_IOS="0"
99 HAVE_OSX="0"
101 YASMFLAGS=""
102 case "${host}" in
103     i?86*)
104     YASMFLAGS="-f elf32"
105         ;;
106     x86_64*)
107     YASMFLAGS="-f elf64"
108         ;;
109 esac
112 case "${host_os}" in
113   "")
114     SYS=unknown
115     ;;
116   linux*)
117     SYS=linux
118     ;;
119   bsdi*)
120     SYS=bsdi
121     CFLAGS="${CFLAGS} -pthread"
122     ;;
123   freebsd*)
124     SYS=freebsd
125     CFLAGS="${CFLAGS} -pthread"
126     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
127     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
128     ;;
129   openbsd*)
130     SYS=openbsd
131     CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/X11R6/include"
132     LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/X11R6/lib/"
133     ;;
134   netbsd*)
135     SYS=netbsd
136     ;;
137   dragonfly*)
138     SYS=dragonfly
139     ;;
140   darwin*)
142     dnl Force gcc "-arch" flag
143     ARCH_flag=""
144     case "${host}" in
145       i?86*)
146         ARCH_flag="-arch i386"
147         YASMFLAGS="-f macho32"
148       ;;
149       ppc64*)
150         ARCH_flag="-arch ppc64"
151       ;;
152       ppc*)
153         ARCH_flag="-arch ppc"
154       ;;
155       x86_64*)
156         ARCH_flag="-arch x86_64"
157         YASMFLAGS="-f macho64"
158       ;;
159       arm*)
160         ac_cv_c_bigendian="no"
161         ac_cv_c_attribute_packed="no"
162       ;;
163     esac
165     SYS=darwin
166     CFLAGS="${CFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
167     CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
168     CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
169     OBJCFLAGS="${OBJCFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu99 ${ARCH_flag}"
170     LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
171     VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup,-framework,AppKit])
172     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,CoreServices])
174     AC_EGREP_CPP(yes,
175             [#import <TargetConditionals.h>
176              #if TARGET_OS_IPHONE
177              yes
178              #endif],
179              [HAVE_IOS="1"],
180              [HAVE_OSX="1"])
182     dnl Allow binaries created on Lion to run on earlier releases
183     AC_EGREP_CPP(yes,
184            [#import <Cocoa/Cocoa.h>
185             #ifdef MAC_OS_X_VERSION_10_7
186             yes
187             #endif],
188             [AC_MSG_RESULT([yes])
189             AC_LIBOBJ([getdelim])
190             AC_LIBOBJ([strndup])
191             AC_LIBOBJ([strnlen])],)
193     dnl
194     dnl  Handle Mac OS X SDK flags
195     dnl
196     AC_ARG_WITH(macosx-sdk,
197       [AS_HELP_STRING([--with-macosx-sdk=DIR],
198         [compile using the SDK in DIR])])
199     if test "${with_macosx_sdk}" != "" ; then
200         test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
201         CPP="${CPP} -isysroot ${with_macosx_sdk}"
202         CC="${CC} -isysroot ${with_macosx_sdk}"
203         CXX="${CXX} -isysroot ${with_macosx_sdk}"
204         OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
205         LD="${LD} -syslibroot ${with_macosx_sdk}"
206     fi
207     AC_ARG_WITH(macosx-version-min,
208       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
209         [compile for Mac OS X VERSION and above])])
210     if test "${with_macosx_version_min}" != "" ; then
211         CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
212         CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
213         CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
214         OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
215         LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
216     fi
217     ;;
218   *mingw32* | *cygwin* | *wince* | *mingwce*)
219     AC_CHECK_TOOL(WINDRES, windres, :)
220     AC_CHECK_TOOL(OBJCOPY, objcopy, :)
221     AH_TOP([#if defined(_WIN32) && !defined(_WIN32_WINNT)])
222     AH_TOP([# define _WIN32_WINNT 0x0502 /* Windows XP SP2 */])
223     AH_TOP([#endif])
224     AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE 6.0 (and shell) APIs.])
225     AC_DEFINE([_UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
226     AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
227     AC_DEFINE([_ISOC99_SOURCE], [1], [Extensions to ISO C89 from ISO C99.])
228     AC_DEFINE([_ISOC11_SOURCE], [1], [Extensions to ISO C99 from ISO C11.])
229     AC_DEFINE([_POSIX_SOURCE], [1], [IEEE Std 1003.1.])
230     AC_DEFINE([_POSIX_C_SOURCE], [200809L], [IEEE Std 1003.1.])
231     AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition])
232     AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [XPG things and X/Open Unix extensions.])
233     AC_DEFINE([_BSD_SOURCE], [1], [ISO C, POSIX, and 4.3BSD things.])
234     AC_DEFINE([_SVID_SOURCE], [1], [ISO C, POSIX, and SVID things.])
236     case "${host_os}" in
237       *mingw32*)
238         SYS=mingw32
239         ;;
240       *cygwin*)
241         dnl Check if we are using the mno-cygwin mode in which case we are
242         dnl actually dealing with a mingw32 compiler.
243         AC_EGREP_CPP(yes,
244             [#ifdef _WIN32
245              yes
246              #endif],
247             SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
248         ;;
249     esac
251     if test "${SYS}" = "mingw32"; then
252         # DEP, ASLR, NO SEH
253         LDFLAGS="${LDFLAGS} -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase"
255         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
256         ac_default_prefix="`pwd`/_win32"
257         DESTDIR="`pwd`/_win32/"
259         dnl
260         dnl NSIS/MSI Installer prefix and WIN64
261         dnl
262         case "${host}" in
263             amd64*|x86_64*)
264                 HAVE_WIN64="1"
265                 WINDOWS_ARCH="x64"
266                 PROGRAMFILES="PROGRAMFILES64"
267                 YASMFLAGS="-f win64"
268             ;;
269             *)
270                 WINDOWS_ARCH="x86"
271                 PROGRAMFILES="PROGRAMFILES"
272                 YASMFLAGS="-f win32"
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   symbian*)
290     SYS=symbian
291     ;;
292   *os2*)
293     SYS=os2
294     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild -Zhigh-mem"
295     AC_LIBOBJ([freeaddrinfo])
296     ;;
297   *)
298     SYS="${host_os}"
299     ;;
300 esac
301 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
302 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
303 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
304 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
305 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1")
306 AM_CONDITIONAL(HAVE_SYMBIAN, test "${SYS}" = "symbian")
307 AM_CONDITIONAL(HAVE_IOS,   test "${HAVE_IOS}" = "1")
308 AM_CONDITIONAL(HAVE_OSX,   test "${HAVE_OSX}" = "1")
310 AC_SUBST(YASMFLAGS)
313 dnl Sadly autoconf does not think about testing foo.exe when ask to test
314 dnl for program foo on win32
315 case "${build_os}" in
316     cygwin|msys)
317         ac_executable_extensions=".exe"
318     ;;
319     *)
320     ;;
321 esac
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")
342 dnl  Check for the contrib directory
344 AC_ARG_WITH(contrib,
345   [AS_HELP_STRING([--with-contrib[=DIR]],
346     [search for 3rd party libraries in DIR/include and DIR/lib])
348 AC_MSG_CHECKING([for 3rd party libraries path])
349 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
350   CONTRIB_DIR="${srcdir}/contrib/${host}"
351   AS_IF([test ! -d "${CONTRIB_DIR}"], [
352     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
353     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
354     AS_IF([test ! -d "${CONTRIB_DIR}"], [
355       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
356       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
357       AS_IF([test ! -d "${CONTRIB_DIR}"], [
358         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
359         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
360         AS_IF([test ! -d "${CONTRIB_DIR}"], [
361           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
362           CONTRIB_DIR=""
363           AC_MSG_RESULT([not found])
364         ])
365       ])
366     ])
367   ])
368 ], [
369   AS_IF([test "${with_contrib}" != "no"], [
370     CONTRIB_DIR="${with_contrib}"
371   ], [
372     CONTRIB_DIR=""
373     AC_MSG_RESULT([disabled])
374   ])
376 AS_IF([test -n "${CONTRIB_DIR}"], [
377   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
378     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
379   ], [
380     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
381     CONTRIB_DIR=""
382     AC_MSG_RESULT([not usable])
383   ])
386 AS_IF([test -n "${CONTRIB_DIR}"], [
387   AC_MSG_RESULT([${CONTRIB_DIR}])
388   export PATH=${CONTRIB_DIR}/bin:$PATH
389   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
390   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
391   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
392   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
393   export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
394   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
396   AS_IF([test "${SYS}" = "darwin"], [
397     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
398     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
399   ])
400 ], [
401   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
402     AC_MSG_ERROR([Third party libraries not found!])
403   ])
405 AC_SUBST(CONTRIB_DIR)
407 dnl Add extras/tools to the PATH
408 TOOLS_DIR="${srcdir}/extras/tools/build/bin"
409 AS_IF([test -d "${TOOLS_DIR}"], [
410     TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
411     export PATH="${TOOLS_DIR}":$PATH
415 dnl  Libtool
416 dnl  It's very bad, but our former custom system was worst
417 dnl  -- Courmisch
420 dnl override platform specific check for dependent libraries
421 dnl otherwise libtool linking of shared libraries will
422 dnl fail on anything other than pass_all.
423 AC_CACHE_VAL(lt_cv_deplibs_check_method,
424     [lt_cv_deplibs_check_method=pass_all])
426 LT_INIT([dlopen win32-dll shared disable-static])
427 LT_LANG([C++])
428 LT_LANG([Windows Resource])
430 DOLT
432 lt_cv_deplibs_check_method=pass_all
434 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
435   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
439 dnl Gettext stuff
441 AM_GNU_GETTEXT_VERSION([0.19.2])
442 AM_GNU_GETTEXT([external], [need-ngettext])
445 dnl Iconv stuff
447 AM_ICONV
450 dnl checks for mingw
451 AS_IF([test "${SYS}" = "mingw32"], [
453 dnl Check for broken versions of mingw-runtime compatability library
454     AC_MSG_CHECKING(for broken mingw-runtime)
455     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
456 #include <_mingw.h>
457 #if defined(__MINGW64_VERSION_MAJOR)
458 # if __MINGW64_VERSION_MAJOR < 3
459 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
460 # endif
461 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
462 # error Attempting to use mingw-runtime with broken vsnprintf support
463 #endif
464     ])], [
465         AC_MSG_RESULT([ok])
466     ], [
467         AC_MSG_RESULT([present])
468         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
469     ])
471     dnl force use of mingw provided c99 *printf over msvcrt
472     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
474     dnl Add WinMainCRTStartup entry point to show it's a WinMain application
475     VLC_ADD_LDFLAGS([vlc],[-mwindows])
477     dnl Check for the need to include the mingwex lib for mingw32
478     VLC_SAVE_FLAGS
479     AC_CHECK_LIB(mingwex,opendir,
480         AC_CHECK_LIB(mingw32,opendir,,
481             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
482     )
483     VLC_RESTORE_FLAGS
485     dnl Check for fnative-struct or mms-bitfields support for mingw32
486     VLC_SAVE_FLAGS
487     CFLAGS="${CFLAGS} -mms-bitfields"
488     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
489     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
490         [ac_cv_c_mms_bitfields],
491         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
492     if test "${ac_cv_c_mms_bitfields}" = "no"; then
493         VLC_RESTORE_FLAGS
494         CFLAGS="${CFLAGS} -fnative-struct"
495         CXXFLAGS="${CXXFLAGS} -fnative-struct"
496         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
497             [ac_cv_c_fnative_struct],
498             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
499         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
500     fi
503 AC_ARG_ENABLE(winstore_app,
504      AS_HELP_STRING([--enable-winstore-app],
505                     [Build targetted for Windows Store apps (default disabled)]))
507 vlc_winstore_app=0
508 AS_IF([test "${SYS}" = "mingw32"],[
509   AS_IF([test "${enable_winstore_app}" = "yes"], [
510     vlc_winstore_app=1
511      VLC_ADD_LIBS([libvlccore], [-lole32 -lruntimeobject])
512     ],[
513      VLC_ADD_LIBS([libvlccore],[-lwinmm])
514     ])
515   ])
516 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
517 AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])
521 dnl Buggy glibc prevention. Purposedly not cached.
522 dnl See sourceware.org bugs 5058 and 5443.
523 dnl Ubuntu alone has 20 bug numbers for this...
525 AC_MSG_CHECKING(for buggy GNU/libc versions)
526 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
527 #include <limits.h>
528 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
529   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
530 # error GNU/libc with dcgettext killer bug!
531 #endif
532 ])], [
533   AC_MSG_RESULT([not present])
534 ], [
535   AC_MSG_RESULT([found])
536   AS_IF([test "x${enable_nls}" != "xno"], [
537     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
538 work-around for this. Check with your distribution vendor on how to update the
539 glibc run-time. Alternatively, build with --disable-nls.])
540   ])
543 dnl Plugin compilation stuff
545 VLC_LIBRARY_SUFFIX
547 dnl Check for system libs needed
548 need_libc=false
550 dnl Check for usual libc functions
551 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
552 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock])
553 AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid lldiv nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
554 AC_CHECK_FUNCS(fdatasync,,
555   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
558 dnl mingw64 implements those as static inline, not functions with C linkage
559 VLC_REPLACE_DECL([asprintf], [#include <stdio.h>])
560 VLC_REPLACE_DECL([vasprintf], [#include <stdio.h>])
561 VLC_REPLACE_DECL([gmtime_r], [#include <time.h>])
562 VLC_REPLACE_DECL([localtime_r], [#include <time.h>])
564 dnl C11 static_assert()
565 AC_MSG_CHECKING([for static_assert in assert.h])
566 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
567 static_assert(1, "The impossible happened.");
568 ])], [
569   AC_MSG_RESULT([yes])
570   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
571 ], [
572   AC_MSG_RESULT([no])
575 # Windows CE does not have strcoll()
576 AC_FUNC_STRCOLL
578 dnl Check for non-standard system calls
579 case "$SYS" in
580   "linux")
581     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
582     ;;
583   "mingw32")
584     AC_CHECK_FUNCS([_lock_file])
585     ;;
586 esac
588 AH_BOTTOM([#include <vlc_fixups.h>])
590 dnl Check for struct pollfd
591 AC_CHECK_TYPES([struct pollfd],,,
592 [#include <sys/types.h>
593 #if HAVE_POLL
594 # include <poll.h>
595 #elif defined (_WIN32)
596 # include <winsock2.h>
597 #endif
600 dnl Checks for socket stuff
601 VLC_SAVE_FLAGS
602 SOCKET_LIBS=""
603 AC_SEARCH_LIBS(connect, [socket], [
604   AS_IF([test "$ac_cv_search_connect" != "none required"], [
605     SOCKET_LIBS="$ac_cv_search_connect"
606   ])
607 ], [
608   AS_IF([test "${SYS}" = "mingw32"], [
609     SOCKET_LIBS="-lws2_32"
610   ])
613 AC_SEARCH_LIBS([inet_pton], [nsl], [
614  AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [
615     SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS"
616   ])
617 ],, [${SOCKET_LIBS}])
619 LIBS="${LIBS} ${SOCKET_LIBS}"
620 AC_LINK_IFELSE([
621     AC_LANG_PROGRAM([#ifdef _WIN32
622         # if _WIN32_WINNT < 0x600
623         #  error Needs vista+
624         # endif
625         #include <ws2tcpip.h>
626         #else
627         #include <sys/socket.h>
628         #include <arpa/inet.h>
629         #endif], [
630         char dst[[sizeof(struct in_addr)]];
631         inet_pton(AF_INET, "127.0.0.1", dst);
632     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
633 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
634 VLC_RESTORE_FLAGS
635 AC_SUBST(SOCKET_LIBS)
637 dnl Check for socklen_t
638 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
639 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
640 ac_cv_type_socklen_t,
641 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
642 [#include <sys/types.h>
643 #ifdef _WIN32
644 # include <winsock2.h>
645 # include <ws2tcpip.h>
646 #else
647 # include <sys/socket.h>
648 #endif]], [[socklen_t len; len = 0;]])],
649 ac_cv_type_socklen_t=yes,
650 ac_cv_type_socklen_t=no)])
651 AS_IF([test "$ac_cv_type_socklen_t" = no],
652  [AC_DEFINE(socklen_t, int)])
654 dnl Check for struct sockaddr_storage
655 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
656 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
657 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
658   [AC_TRY_COMPILE(
659     [#include <sys/types.h>
660      #if defined( _WIN32 )
661      # include <winsock2.h>
662      #else
663      # include <sys/socket.h>
664      #endif], [struct sockaddr_storage addr;],
665      ac_cv_struct_sockaddr_storage=yes,
666      ac_cv_struct_sockaddr_storage=no)])
667 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
668   AC_DEFINE(sockaddr_storage, sockaddr)
669   AC_DEFINE(ss_family, sa_family)
672 dnl FreeBSD has a gnugetopt library for this:
673 GNUGETOPT_LIBS=""
674 AC_CHECK_FUNC(getopt_long,, [
675   AC_CHECK_LIB([gnugetopt],[getopt_long], [
676     GNUGETOPT_LIBS="-lgnugetopt"
677   ])
679 AC_SUBST(GNUGETOPT_LIBS)
681 AC_CHECK_LIB(m,cos,[
682   LIBM="-lm"
683 ], [
684   LIBM=""
686 AC_SUBST(LIBM)
688 AC_CHECK_LIB(m,lrintf, [
689   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
690   VLC_ADD_LIBS([skins2],[-lm])
692 AC_CHECK_LIB(m,nanf,
693   AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
696 dnl Check for dynamic plugins
697 LIBDL=""
698 have_dynamic_objects="no"
699 VLC_SAVE_FLAGS
700 AC_SEARCH_LIBS(dlsym, [dl svld], [
701   AS_IF([test "$ac_cv_search_dlsym" != "none required"], [
702     LIBDL="$ac_cv_search_dlsym"
703   ])
704   have_dynamic_objects="yes"
706 VLC_RESTORE_FLAGS
708 # Windows
709 AS_IF([test "${SYS}" = "mingw32"], [
710   LIBDL=""
711   have_dynamic_objects="yes" #assume we can use shared objects
714 AS_IF([test "${enable_shared}" = "no"], [
715   have_dynamic_objects=no
717 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
719 AC_SUBST(LIBDL)
721 dnl Check for thread library
722 LIBPTHREAD=""
723 AS_IF([test "${SYS}" != "mingw32"], [
724   VLC_SAVE_FLAGS
725   LIBS=""
726   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
727     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
728       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
729     ])
730   ])
731   VLC_RESTORE_FLAGS
733   AC_CHECK_LIB(rt, clock_nanosleep, [
734     VLC_ADD_LIBS([libvlccore],[-lrt])
735   ], [
736     AC_CHECK_FUNC(nanosleep,,[
737       AC_CHECK_LIB(rt,nanosleep, [
738         VLC_ADD_LIBS([libvlccore],[-lrt])
739       ], [
740         AC_CHECK_LIB(posix4,nanosleep, [
741           VLC_ADD_LIBS([libvlccore],[-lposix4])
742         ])
743       ])
744     ])
745     dnl HP/UX port
746     AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlccore],[-lrt])])
747   ])
749 AC_SUBST(LIBPTHREAD)
752 dnl Check for headers
755 dnl  POSIX
756 AC_CHECK_HEADERS([arpa/inet.h pthread.h search.h sys/shm.h sys/socket.h])
757 AC_CHECK_HEADERS([net/if.h], [], [],
759 #include <sys/types.h>
760 #include <sys/socket.h>
762 AC_CHECK_HEADER([syslog.h], [have_syslog="yes"], [have_syslog="no"])
763 AM_CONDITIONAL([HAVE_SYSLOG], [test "$have_syslog" = "yes"])
765 dnl  BSD
766 AC_CHECK_HEADERS([netinet/udplite.h sys/param.h sys/mount.h])
768 dnl  GNU/Linux
769 AC_CHECK_HEADERS([getopt.h linux/dccp.h linux/magic.h mntent.h sys/eventfd.h])
771 dnl  MacOS
772 AC_CHECK_HEADERS([xlocale.h])
774 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
775 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
776 AC_CHECK_TYPE(ssize_t,, [
777   AC_DEFINE(ssize_t, int)
780 dnl It seems that autoconf detects pkg-config only during the first
781 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
782 dnl it is nested within a conditional block, so it was not working right.
783 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
784 AC_ARG_VAR(PKG_CONFIG_PATH,
785        [Paths where to find .pc not at the default location])
786 PKG_PROG_PKG_CONFIG()
788 dnl On some OS we need static linking
789 AS_IF([test -n "${PKG_CONFIG}" ],[
790     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
791         PKG_CONFIG="${PKG_CONFIG} --static"
792     ])
797 dnl Check for zlib.h and -lz along with system -lminizip if available
799 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
800 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
801 if test "${have_zlib}" = "yes"
802 then
803   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
804   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
805     AC_CHECK_HEADERS([unzip.h], [
806       have_minizip=yes
807       MINIZIP_LIBS="-lminizip -lz"
808     ], [
809       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
810       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
811       have_minizip=no
812     ])
813   ])
814   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
815   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
817 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
821 dnl Domain name i18n support via GNU libidn
823 PKG_CHECK_MODULES([IDN], [libidn], [
824   have_libidn="yes"
825   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
826 ], [
827   have_libidn="no"
831 dnl Check for dbus
832 AC_ARG_ENABLE(dbus,
833   [AS_HELP_STRING([--enable-dbus],
834     [compile D-Bus message bus support (default enabled)])])
835 have_dbus="no"
836 AS_IF([test "${enable_dbus}" != "no"], [
837   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
838     have_dbus="yes"
839   ], [
840     AS_IF([test -n "${enable_dbus}"], [
841       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
842     ], [
843       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
844     ])
845   ])
847 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
850 dnl Check for systemd
851 PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
852   have_systemd="yes"
853 ], [
854   AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
856 AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
859 dnl Check for ntohl, etc.
860 VLC_SAVE_FLAGS
861 CFLAGS="${CFLAGS} -Wall -Werror"
862 AC_CACHE_CHECK([for ntohl in sys/param.h],
863     [ac_cv_c_ntohl_sys_param_h],
864     [     AC_TRY_COMPILE([#include <sys/param.h>],
865         [int meuh; ntohl(meuh);],
866         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
867 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
868     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
870 VLC_RESTORE_FLAGS
872 EXTEND_HELP_STRING([Optimization options:])
874 dnl  Compiler warnings
877 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])
878 RDC_PROG_CC_FLAGS([-pipe])
879 AC_LANG_PUSH([C++])
880 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
881 AC_LANG_POP([C++])
884 dnl  Debugging mode
886 AC_ARG_ENABLE(debug,
887   [AS_HELP_STRING([--enable-debug],
888     [build with run-time assertions (default disabled)])],,
889   [enable_debug="no"])
890 AH_TEMPLATE(NDEBUG,
891             [Define to 1 if debug code should NOT be compiled])
892 AS_IF([test "${enable_debug}" != "no"], [
893   AC_CHECK_HEADERS([valgrind/valgrind.h])
894 ], [
895   AC_DEFINE(NDEBUG)
899 dnl  Profiling
901 AC_ARG_ENABLE(gprof,
902   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
903   [enable_gprof="no"])
904 AS_IF([test "${enable_gprof}" != "no"], [
905   CFLAGS="${CFLAGS} -pg"
906   CXXFLAGS="${CXXFLAGS} -pg"
907   OBJCFLAGS="${OBJCFLAGS} -pg"
908   LDFLAGS="${LDFLAGS} -pg"
911 AC_ARG_ENABLE(cprof,
912   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
913   [enable_cprof="no"])
914 AS_IF([test "${enable_gprof}" != "no"], [
915   CFLAGS="${CFLAGS} -finstrument-functions"
916   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
917   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
918   LDFLAGS="${LDFLAGS} -finstrument-functions"
922 dnl  Test coverage
924 AC_ARG_ENABLE(coverage,
925   [AS_HELP_STRING([--enable-coverage],
926     [build for test coverage (default disabled)])],,
927   [enable_coverage="no"])
928 AS_IF([test "${enable_coverage}" != "no"], [
929   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
930   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
931   LDFLAGS="-lgcov ${LDFLAGS}"
934 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
935   VLC_SAVE_FLAGS
936   CFLAGS="${CFLAGS} -fvisibility=hidden"
937   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
938   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
939   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
940                  [ac_cv_c_visibility_hidden], [
941     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
942       ac_cv_c_visibility_hidden=yes
943     ], [
944       ac_cv_c_visibility_hidden=no
945     ])
946   ])
947   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
952 dnl  Enable/disable optimizations
954 AC_ARG_ENABLE(optimizations,
955   [AS_HELP_STRING([--disable-optimizations],
956     [disable compiler optimizations (default enabled)])],,
957   [enable_optimizations="yes"])
959 dnl Check for various optimization flags
960 AS_IF([test "${enable_optimizations}" != "no"], [
962   dnl -O3 only in production builds
963   AS_IF([test "${enable_debug}" = "no"], [
964     VLC_SAVE_FLAGS
965     CFLAGS="${CFLAGS} -O3"
966     CXXFLAGS="${CXXFLAGS} -O3"
967     OBJCFLAGS="${OBJCFLAGS} -O3"
968     AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
969       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
970         ac_cv_c_o3=yes
971       ], [
972         ac_cv_c_o3=no
973       ])
974     ])
975     AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
976   ])
978   dnl Check for -ffast-math
979   VLC_SAVE_FLAGS
980   CFLAGS="${CFLAGS} -ffast-math"
981   CXXFLAGS="${CXXFLAGS} -ffast-math"
982   OBJCFLAGS="${OBJCFLAGS} -ffast-math"
983   AC_CACHE_CHECK([if $CC accepts -ffast-math], [ac_cv_c_fast_math], [
984     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
985       ac_cv_c_fast_math=yes
986     ], [
987       ac_cv_c_fast_math=no
988     ])
989   ])
990   AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
991   AH_BOTTOM([
992 #ifndef __FAST_MATH__
993 # ifndef _MSC_VER
994 #  pragma STDC FENV_ACCESS OFF
995 #  pragma STDC FP_CONTRACT ON
996 # else
997 #  pragma fenv_access(off)
998 #  pragma fp_contract(on)
999 # endif
1000 #endif
1003   dnl Check for -funroll-loops
1004   VLC_SAVE_FLAGS
1005   CFLAGS="${CFLAGS} -funroll-loops"
1006   CXXFLAGS="${CXXFLAGS} -funroll-loops"
1007   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
1008   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
1009     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1010       ac_cv_c_unroll_loops=yes
1011     ], [
1012       ac_cv_c_unroll_loops=no
1013     ])
1014   ])
1015   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
1017   AS_IF([test "$enable_debug" = "no"], [
1018     dnl Check for -fomit-frame-pointer
1019     VLC_SAVE_FLAGS
1020     CFLAGS="${CFLAGS} -fomit-frame-pointer"
1021     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
1022     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
1023     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
1024       [ac_cv_c_omit_frame_pointer], [
1025       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1026         ac_cv_c_omit_frame_pointer=yes
1027       ], [
1028         ac_cv_c_omit_frame_pointer=no
1029       ])
1030     ])
1031     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1032   ])
1035 VLC_SAVE_FLAGS
1036 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1037 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1038   AC_TRY_LINK([],, [
1039     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1040   ], [
1041     ac_cv_ld_bsymbolic=""
1042   ])
1044 VLC_RESTORE_FLAGS
1045 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1046 AC_SUBST(SYMBOLIC_LDFLAGS)
1048 dnl Checks for __attribute__(aligned()) directive
1049 VLC_SAVE_FLAGS
1050 CFLAGS="${CFLAGS} -Werror"
1051 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1052     [ac_cv_c_attribute_aligned],
1053     [ac_cv_c_attribute_aligned=0
1054     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1055         AC_TRY_COMPILE([],
1056         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1057         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1058     done])
1059 VLC_RESTORE_FLAGS
1060 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1061     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1062         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1065 dnl Check for __attribute__((packed))
1066 AC_CACHE_CHECK([for __attribute__((packed))],
1067   [ac_cv_c_attribute_packed],
1068   [ac_cv_c_attribute_packed=no
1069    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1070                     [ac_cv_c_attribute_packed=yes])])
1071 if test "${ac_cv_c_attribute_packed}" != "no"; then
1072   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1076 dnl  Check the CPU
1078 case "${host_cpu}" in
1079   "")
1080     ARCH=unknown
1081     ;;
1082   *)
1083     ARCH="${host_cpu}"
1084     ;;
1085 esac
1087 dnl Check for backtrace() support
1088 AC_CHECK_HEADERS(execinfo.h)
1089 AC_CHECK_FUNCS(backtrace)
1092 dnl  default modules
1094 ALIASES="${ALIASES} cvlc rvlc"
1097 dnl  Accelerated modules
1100 dnl  Check for fully working MMX intrinsics
1101 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1102 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1103 AC_ARG_ENABLE(mmx,
1104   [AS_HELP_STRING([--disable-mmx],
1105     [disable MMX optimizations (default auto)])],,[
1106   case "${host_cpu}" in
1107     i?86|x86_64)
1108       enable_mmx="yes"
1109       ;;
1110     *)
1111       enable_mmx="no"
1112       ;;
1113   esac
1115 have_mmx="no"
1116 have_mmxext="no"
1117 AS_IF([test "${enable_mmx}" != "no"], [
1118   ARCH="${ARCH} mmx"
1119   VLC_SAVE_FLAGS
1120   CFLAGS="${CFLAGS} -mmmx"
1121   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1122     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1123 [#include <mmintrin.h>
1124 #include <stdint.h>
1125 uint64_t frobzor;]], [
1126 [__m64 a, b, c;
1127 a = b = c = (__m64)frobzor;
1128 a = _mm_slli_pi16(a, 3);
1129 a = _mm_adds_pi16(a, b);
1130 c = _mm_srli_pi16(c, 8);
1131 c = _mm_slli_pi16(c, 3);
1132 b = _mm_adds_pi16(b, c);
1133 a = _mm_unpacklo_pi8(a, b);
1134 frobzor = (uint64_t)a;]])], [
1135       ac_cv_c_mmx_intrinsics=yes
1136     ], [
1137       ac_cv_c_mmx_intrinsics=no
1138     ])
1139   ])
1140   VLC_RESTORE_FLAGS
1141   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1142     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1143   ])
1145   VLC_SAVE_FLAGS
1146   CFLAGS="${CFLAGS} -mmmx"
1147   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1148     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1149 void *p;
1150 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1152     ], [
1153       ac_cv_mmx_inline=yes
1154     ], [
1155       ac_cv_mmx_inline=no
1156     ])
1157   ])
1158   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1159     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1160     have_mmx="yes"
1161   ])
1163   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1164                  [ac_cv_mmxext_inline], [
1165     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1166 void *p;
1167 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1169     ], [
1170       ac_cv_mmxext_inline=yes
1171     ], [
1172       ac_cv_mmxext_inline=no
1173     ])
1174   ])
1175   VLC_RESTORE_FLAGS
1176   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1177     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1178     have_mmxext="yes"
1179   ])
1181 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1182 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1184 dnl  Check for fully workin SSE2 intrinsics
1185 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1186 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1187 AC_ARG_ENABLE(sse,
1188   [AS_HELP_STRING([--disable-sse],
1189     [disable SSE (1-4) optimizations (default auto)])],, [
1190   case "${host_cpu}" in
1191     i?86|x86_64)
1192       enable_sse=yes
1193       ;;
1194     *)
1195       enable_sse=no
1196       ;;
1197   esac
1199 have_sse2="no"
1200 AS_IF([test "${enable_sse}" != "no"], [
1201   ARCH="${ARCH} sse sse2"
1203   VLC_SAVE_FLAGS
1204   CFLAGS="${CFLAGS} -msse2"
1205   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1206     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1207 [#include <emmintrin.h>
1208 #include <stdint.h>
1209 uint64_t frobzor;]], [
1210 [__m128i a, b, c;
1211 a = b = c = _mm_set1_epi64((__m64)frobzor);
1212 a = _mm_slli_epi16(a, 3);
1213 a = _mm_adds_epi16(a, b);
1214 c = _mm_srli_epi16(c, 8);
1215 c = _mm_slli_epi16(c, 3);
1216 b = _mm_adds_epi16(b, c);
1217 a = _mm_unpacklo_epi8(a, b);
1218 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1219       ac_cv_c_sse2_intrinsics=yes
1220     ], [
1221       ac_cv_c_sse2_intrinsics=no
1222     ])
1223   ])
1224   VLC_RESTORE_FLAGS
1225   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1226     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1227   ])
1229   VLC_SAVE_FLAGS
1230   CFLAGS="${CFLAGS} -msse"
1231   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1232     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1233 void *p;
1234 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1236     ], [
1237       ac_cv_sse_inline=yes
1238     ], [
1239       ac_cv_sse_inline=no
1240     ])
1241   ])
1243   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1244     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1245   ])
1247   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1248     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1249 void *p;
1250 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1252     ], [
1253       ac_cv_sse2_inline=yes
1254     ], [
1255       ac_cv_sse2_inline=no
1256     ])
1257   ])
1258   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1259     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1260     have_sse2="yes"
1261   ])
1263   # SSE3
1264   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1265     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1266 void *p;
1267 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1269     ], [
1270       ac_cv_sse3_inline=yes
1271     ], [
1272       ac_cv_sse3_inline=no
1273     ])
1274   ])
1276   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1277     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1278   # SSSE3
1279   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1280     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1281 void *p;
1282 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1284     ], [
1285       ac_cv_ssse3_inline=yes
1286     ], [
1287       ac_cv_ssse3_inline=no
1288     ])
1289   ])
1291   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1292     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1294   # SSE4.1
1295   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1296                  [ac_cv_sse4_1_inline], [
1297     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1298 void *p;
1299 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1301     ], [
1302       ac_cv_sse4_1_inline=yes
1303     ], [
1304       ac_cv_sse4_1_inline=no
1305     ])
1306   ])
1308   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1309     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1311   # SSE4.2
1312   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1313                  [ac_cv_sse4_2_inline], [
1314     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1315 void *p;
1316 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1318     ], [
1319       ac_cv_sse4_2_inline=yes
1320     ], [
1321       ac_cv_sse4_2_inline=no
1322     ])
1323   ])
1325   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1326     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1328   # SSE4A
1329   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1330     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1331 void *p;
1332 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1334     ], [
1335       ac_cv_sse4a_inline=yes
1336     ], [
1337       ac_cv_sse4a_inline=no
1338     ])
1339   ])
1340   VLC_RESTORE_FLAGS
1341   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1342     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1344 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1346 VLC_SAVE_FLAGS
1347 CFLAGS="${CFLAGS} -mmmx"
1348 have_3dnow="no"
1349 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1350   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1351 void *p;
1352 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1354   ], [
1355     ac_cv_3dnow_inline=yes
1356   ], [
1357     ac_cv_3dnow_inline=no
1358   ])
1360 VLC_RESTORE_FLAGS
1361 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1362   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1363             [Define to 1 if 3D Now! inline assembly is available.])
1364   have_3dnow="yes"
1366 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1369 AC_ARG_ENABLE(neon,
1370   [AS_HELP_STRING([--disable-neon],
1371     [disable NEON optimizations (default auto)])],, [
1372   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1374 AS_IF([test "${enable_neon}" != "no"], [
1375   VLC_SAVE_FLAGS
1376   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1377   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1378     AC_COMPILE_IFELSE([
1379       AC_LANG_PROGRAM(,[[
1380 asm volatile("vqmovun.s64 d0, q1":::"d0");
1382     ], [
1383       ac_cv_arm_neon="yes"
1384     ], [
1385       ac_cv_arm_neon="no"
1386     ])
1387   ])
1388   VLC_RESTORE_FLAGS
1390 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1393 AC_ARG_ENABLE(altivec,
1394   [AS_HELP_STRING([--disable-altivec],
1395     [disable AltiVec optimizations (default auto)])],, [
1396   AS_CASE("${host_cpu}", [powerpc*],
1397         [enable_altivec=yes], [enable_altivec=no])
1399 have_altivec="no"
1400 ALTIVEC_CFLAGS=""
1401 AS_IF([test "${enable_altivec}" = "yes"], [
1402   ARCH="${ARCH} altivec";
1403   VLC_SAVE_FLAGS
1404   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1405     [ac_cv_altivec_inline],
1406     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1407          ac_cv_altivec_inline="yes",
1408          [CFLAGS="${CFLAGS} -Wa,-maltivec"
1409           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1410             [ac_cv_altivec_inline="-Wa,-maltivec"],
1411             ac_cv_altivec_inline=no)
1412          ])])
1413   VLC_RESTORE_FLAGS
1414   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1415     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1416               [Define to 1 if AltiVec inline assembly is available.])
1417     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1418       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1419       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1420     ])
1421     have_altivec="yes"
1422   ])
1424   VLC_SAVE_FLAGS
1425   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1426   [ac_cv_c_altivec], [
1427     CFLAGS="${CFLAGS} -maltivec"
1428     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1429 [#include <altivec.h>]], [
1430 [vec_ld(0, (unsigned char *)0);]])], [
1431       ac_cv_c_altivec="-maltivec"
1432     ], [
1433       ac_cv_c_altivec="no"
1434     ])
1435   ])
1436   VLC_RESTORE_FLAGS
1437   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1438     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1439     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1440     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1441     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1442     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1443     have_altivec="yes"
1444   ])
1445   AC_CHECK_HEADERS(altivec.h)
1447   VLC_SAVE_FLAGS
1448   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1449   AC_CACHE_CHECK([if linker needs -framework vecLib],
1450     [ac_cv_ld_altivec],
1451     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1452   VLC_RESTORE_FLAGS
1453   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1454     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1455   ])
1457 AC_SUBST(ALTIVEC_CFLAGS)
1458 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1461 dnl  Memory usage
1463 AC_ARG_ENABLE(optimize-memory,
1464   [AS_HELP_STRING([--enable-optimize-memory],
1465     [optimize memory usage over performance])])
1466 if test "${enable_optimize_memory}" = "yes"; then
1467   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1471 dnl Allow running as root (useful for people running on embedded platforms)
1473 AC_ARG_ENABLE(run-as-root,
1474   [AS_HELP_STRING([--enable-run-as-root],
1475     [allow running VLC as root (default disabled)])])
1476 AS_IF([test "${enable_run_as_root}" = "yes"],[
1477     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1478               [Define to 1 to allow running VLC as root (uid 0).])
1482 dnl Stream output
1484 AC_ARG_ENABLE(sout,
1485   [AS_HELP_STRING([--disable-sout],
1486     [disable streaming output (default enabled)])])
1487 AS_IF([test "${enable_sout}" != "no"], [
1488   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1490 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1492 dnl Lua modules
1493 AC_ARG_ENABLE(lua,
1494   [AS_HELP_STRING([--disable-lua],
1495     [disable LUA scripting support (default enabled)])])
1496 if test "${enable_lua}" != "no"
1497 then
1498   PKG_CHECK_MODULES(LUA, lua5.2,
1499     [ have_lua=yes ],
1500     [
1501     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1503     PKG_CHECK_MODULES(LUA, lua5.1,
1504       [ have_lua=yes ],
1505       [
1506       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1507       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1508         [ have_lua=yes ],
1509         [
1510           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1511           have_lua=yes
1512           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1513             [],
1514             [ have_lua=no ] )
1515           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1516             [LUA_LIBS="-llua5.2"],
1517           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1518             [LUA_LIBS="-llua5.1"],
1519             AC_CHECK_LIB( lua51 , luaL_newstate,
1520               [LUA_LIBS="-llua51"],
1521               AC_CHECK_LIB( lua , luaL_newstate,
1522                 [LUA_LIBS="-llua"],
1523                 [ have_lua=no
1524                 ], [-lm])
1525             )))
1526         ])
1527       ])
1528     ])
1529   if test "x${have_lua}" != "xyes" ;  then
1530       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.])
1531   fi
1532   AC_ARG_VAR([LUAC], [LUA byte compiler])
1533   AC_PATH_PROGS(LUAC,[${LUAC} luac], [false])
1534   AS_IF([test "${LUAC}" = "false"], [
1535     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1536   ])
1537   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], [
1538     AC_MSG_ERROR([You need 32-bits luac when using using lua from contrib.])
1539   ])
1541 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1545 dnl HTTP daemon
1547 AC_ARG_ENABLE(httpd,
1548   [AS_HELP_STRING([--disable-httpd],
1549     [disable the built-in HTTP server (default enabled)])])
1550 if test "${enable_httpd}" != "no"
1551 then
1552   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1554 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1558 dnl VideoLAN manager
1560 AC_ARG_ENABLE(vlm,
1561   [AS_HELP_STRING([--disable-vlm],
1562     [disable the stream manager (default enabled)])],,
1563   [enable_vlm="${enable_sout}"])
1564 AS_IF([test "${enable_vlm}" != "no"], [
1565   AS_IF([test "${enable_sout}" = "no"], [
1566     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1567   ])
1568   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1570 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1574 dnl Addons manager storage and repositories modules
1576 AC_ARG_ENABLE(addonmanagermodules,
1577   [AS_HELP_STRING([--disable-addonmanagermodules],
1578     [disable the addons manager modules (default enabled)])])
1579 if test "${enable_addonmanagermodules}" != "no"
1580 then
1581   AC_DEFINE(ENABLE_ADDONMANAGERMODULES, 1, [Define if you want the addons manager modules])
1583 AM_CONDITIONAL([ENABLE_ADDONMANAGERMODULES], [test "${enable_addonmanagermodules}" != "no"])
1587 dnl  Input plugins
1590 EXTEND_HELP_STRING([Input plugins:])
1593 dnl  libarchive access module
1595 PKG_ENABLE_MODULES_VLC([ARCHIVE], [access_archive], [libarchive >= 3.1.0], (libarchive support), [auto])
1598 dnl  live555 input
1600 AC_ARG_ENABLE(live555,
1601   [AS_HELP_STRING([--enable-live555],
1602     [enable RTSP input through live555 (default enabled)])])
1604 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1605   PKG_CHECK_MODULES(LIVE555, live555, [
1606     VLC_ADD_PLUGIN([live555])
1607     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1608     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1609   ], [
1610     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1612     AC_LANG_PUSH(C++)
1613     VLC_SAVE_FLAGS
1615     dnl detect include paths
1616     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1617       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1618     ], [
1619       AS_IF([test "${SYS}" != "os2"], [
1620         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1621         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1622       ], [
1623         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1624         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1625         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1626       ])
1627     ])
1629     dnl CPP Flags
1630     AS_IF([test "${SYS}" = "solaris"], [
1631       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1632     ])
1633     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1634     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1636     dnl version check
1637     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1638       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1639 [#include <liveMedia_version.hh>
1640 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1641 # error BOOM
1642 #endif]])
1643       ], [
1644         ac_cv_live555="yes"
1645       ], [
1646         ac_cv_live555="no"
1647       ])
1648     ])
1650     AS_IF([test "$ac_cv_live555" = "no"], [
1651       AC_MSG_WARN([live555 is missing or its installed version is too old:
1652 Version 2011.12.23 or later is required to proceed.
1653 You can get an updated one from http://www.live555.com/liveMedia .])
1654       AS_IF([test -n "${enable_live555}"], [
1655         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1656       ])
1657     ], [
1658       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1659       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1660       AS_IF([test "${SYS}" = "mingw32"], [
1661         # add ws2_32 for closesocket, select, recv
1662         other_libs="$other_libs -lws2_32"
1663       ])
1665       dnl We need to check for pic because live555 don't provide shared libs
1666       dnl and we want to build a plugins so we need -fPIC on some arch.
1667       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1668       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1669       AC_CHECK_LIB(liveMedia_pic, main, [
1670         VLC_ADD_PLUGIN([live555])
1671         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1672       ],[
1673         AC_CHECK_LIB(liveMedia, main, [
1674           VLC_ADD_PLUGIN([live555])
1675           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1676         ],[],[${other_libs}])
1677       ],[${other_libs_pic}])
1678     ])
1679     VLC_RESTORE_FLAGS
1680     AC_LANG_POP(C++)
1681   ])
1685 dnl IIDC and DV FireWire input modules
1687 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1688 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1691 dnl - linsys modules: access module check for libzvbi
1693 AC_ARG_ENABLE(linsys,
1694   [AS_HELP_STRING([--enable-linsys],
1695     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1696 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1697   VLC_ADD_PLUGIN([linsys_hdsdi])
1698   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1699     VLC_ADD_PLUGIN([linsys_sdi])
1700   ], [
1701     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1702   ])
1706 dnl dvdread module: check for libdvdread
1708 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread > 4.9.0], [dvdread input module], [auto])
1711 dnl libdvdnav plugin
1713 PKG_ENABLE_MODULES_VLC([DVDNAV], [], [dvdnav > 4.9.0], [DVD with navigation input module (dvdnav)], [auto])
1716 dnl  Blu-ray Disc Support with libbluray
1718 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.5.0], (libbluray for Blu-ray disc support ) )
1721 dnl  OpenCV wrapper and example filters
1723 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1727 dnl  libsmbclient plugin
1729 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1730 AS_IF([test "${SYS}" = "mingw32"], [ VLC_ADD_PLUGIN([smb]) ])
1733 dnl  liBDSM access module
1735 PKG_ENABLE_MODULES_VLC([DSM], [dsm], [libdsm >= 0.0.4], [libdsm SMB/CIFS access/sd module], [auto])
1738 dnl sftp access support
1740 PKG_ENABLE_MODULES_VLC([SFTP], [sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1743 dnl  Video4Linux 2
1745 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1746   [disable Video4Linux version 2 (default auto)])])
1747 have_v4l2="no"
1748 AS_IF([test "$enable_v4l2" != "no"], [
1749   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1750     have_v4l2="yes"
1751   ])
1753 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1756 dnl special access module for Blackmagic SDI cards
1758 AC_ARG_ENABLE(decklink,
1759   [AS_HELP_STRING([--disable-decklink],
1760     [disable Blackmagic DeckLink SDI input (default auto)])])
1761 AC_ARG_WITH(decklink_sdk,
1762   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1763     [                        location of Blackmagic DeckLink SDI SDK])])
1764 have_decklink=no
1765 if test "${enable_decklink}" != "no"
1766 then
1767   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1768   then
1769     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1770   fi
1771   VLC_SAVE_FLAGS
1772   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1773   AC_LANG_PUSH(C++)
1774   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1775       have_decklink=yes
1776   ], [
1777       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1778   ])
1779   AC_LANG_POP(C++)
1780   VLC_RESTORE_FLAGS
1782 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1786 dnl  gnomeVFS access module
1788 PKG_ENABLE_MODULES_VLC([GNOMEVFS], [gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
1791 dnl  VCDX modules
1793 PKG_ENABLE_MODULES_VLC([VCDX], [vcdx], [libcdio >= 0.78.2 libiso9660 >= 0.72 libvcdinfo >= 0.7.22], [navigate VCD with libvcdinfo], [no])
1796 dnl  Built-in CD-DA and VCD module
1798 AC_ARG_ENABLE(vcd,
1799   [AS_HELP_STRING([--disable-vcd],
1800     [disable built-in VCD and CD-DA support (default enabled)])])
1802 AC_ARG_ENABLE(libcddb,
1803   [AS_HELP_STRING([--disable-libcddb],
1804     [disable CDDB for Audio CD (default enabled)])])
1806 if test "${enable_vcd}" != "no"
1807 then
1808   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1809   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1810     AC_MSG_RESULT(yes)
1811     VLC_ADD_PLUGIN([vcd cdda])
1812   ],[
1813     AC_MSG_RESULT(no)
1814   ])
1816   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1817   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1818     AC_MSG_RESULT(yes)
1819     VLC_ADD_PLUGIN([vcd cdda])
1820     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1821   ],[
1822     AC_MSG_RESULT(no)
1823   ])
1825   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1826   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1827     AC_MSG_RESULT(yes)
1828     VLC_ADD_PLUGIN([vcd cdda])
1829     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1830   ],[
1831     AC_MSG_RESULT(no)
1832   ])
1834   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2" -o "${SYS}" = "darwin"
1835   then
1836     VLC_ADD_PLUGIN([vcd cdda])
1837   fi
1839   if test "$enable_libcddb" != "no"; then
1840     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1841       HAVE_LIBCDDB=yes
1842       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1843       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1844       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1845       ],:
1846       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1847       HAVE_LIBCDDB=no])
1848   fi
1852 dnl Linux DVB
1854 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1855   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1856 [#include <linux/dvb/version.h>
1857 #if (DVB_API_VERSION < 5)
1858 # error Linux DVB API v3.2 and older are not supported.
1859 #endif
1860 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1861 # error Linux DVB API v5.0 is unsupported. Please update.
1862 #endif
1863 ]])], [
1864   ac_cv_linux_dvb_5_1=yes
1865 ], [
1866   ac_cv_linux_dvb_5_1=no
1867 ])])
1868 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1871 dnl  Screen capture module
1873 AC_ARG_ENABLE(screen,
1874   [AS_HELP_STRING([--enable-screen],
1875     [disable screen capture (default enabled)])])
1876 if test "${enable_screen}" != "no"; then
1877   if test "${SYS}" = "darwin"; then
1878     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1879       VLC_ADD_PLUGIN([screen])
1880     ])
1881   fi
1883 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1886 dnl  VNC/RFB access module
1888 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1890 dnl  RDP/Remote Desktop access module
1892 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1895 dnl  Real RTSP plugin
1897 AC_ARG_ENABLE(realrtsp,
1898   [  --enable-realrtsp       Real RTSP module (default disabled)])
1899 if test "${enable_realrtsp}" = "yes"; then
1900   VLC_ADD_PLUGIN([access_realrtsp])
1904 dnl MacOS eyeTV
1905 AC_ARG_ENABLE(macosx-eyetv,
1906   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1907 if test "x${enable_macosx_eyetv}" != "xno" &&
1908   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1909 then
1910   VLC_ADD_PLUGIN([access_eyetv])
1914 dnl QTKit
1915 AC_ARG_ENABLE(macosx-qtkit,
1916   [  --enable-macosx-qtkit Mac OS X qtcapture (video) and qtsound (audio) module (default enabled on Mac OS X)])
1917 if test "x${enable_macosx_qtkit}" != "xno" &&
1918   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1919 then
1920   VLC_ADD_PLUGIN([qtcapture])
1921   VLC_ADD_PLUGIN([qtsound])
1923 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1926 dnl AVFoundation
1927 AC_SUBST(have_avfoundation, ["no"])
1928 AC_ARG_ENABLE(macosx-avfoundation,
1929   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
1930 if test "x${enable_macosx_avfoundation}" != "xno" &&
1931   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
1932 then
1933   SAVED_LIBS="${LIBS}"
1934   LIBS="-framework AVFoundation"
1935   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
1936   LIBS="${SAVED_LIBS}"
1937   if test "${have_avfoundation}" != "no"
1938   then
1939     VLC_ADD_PLUGIN([avcapture])
1940   fi
1942 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
1945 dnl  DCP plugin (using asdcplib)
1947 PKG_WITH_MODULES([ASDCP], [asdcplib], [have_asdcp="yes"])
1948 AM_CONDITIONAL(HAVE_ASDCP, [test "${have_asdcp}" = "yes"])
1951 dnl  Demux plugins
1954 EXTEND_HELP_STRING([Mux/Demux plugins:])
1957 dnl  libdvbpsi check for ts mux/demux
1959 have_dvbpsi="no"
1960 PKG_WITH_MODULES([DVBPSI], [libdvbpsi >= 1.0.0], [have_dvbpsi="yes"])
1961 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1965 dnl  GME demux plugin
1967 AC_ARG_ENABLE(gme,
1968   [AS_HELP_STRING([--enable-gme],
1969     [use Game Music Emu (default auto)])])
1970 AS_IF([test "${enable_gme}" != "no"], [
1971   AC_CHECK_HEADER([gme/gme.h], [
1972     VLC_ADD_LIBS([gme], [-lgme])
1973     VLC_ADD_PLUGIN([gme])
1974   ], [
1975     AS_IF([test "x${enable_gme}" != "x"], [
1976       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
1977     ])
1978   ])
1983 dnl  SIDPlay plugin
1985 AC_ARG_ENABLE(sid,
1986     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
1987 AS_IF([test "${enable_sid}" != "no"], [
1988     PKG_CHECK_MODULES(SID, [libsidplay2], [
1989         AC_LANG_PUSH(C++)
1990         oldCPPFLAGS="$CPPFLAGS"
1991         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
1992         AC_CHECK_HEADER([sidplay/builders/resid.h], [
1993             VLC_ADD_PLUGIN([sid])
1994             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
1995             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
1996         ], [
1997             AS_IF([test -n "${enable_sid}"],
1998                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
1999                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2000                 )
2001         ])
2002         CPPFLAGS="$oldCPPFLAGS"
2003         AC_LANG_POP(C++)
2004     ], [
2005         AS_IF([test "x${enable_sid}" = "xyes"],
2006             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2007             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2008             )
2009     ])
2014 dnl  ogg demux plugin
2016 PKG_ENABLE_MODULES_VLC([OGG], [mux_ogg], [ogg >= 1.0], [Ogg demux support], [auto])
2017 PKG_CHECK_MODULES(LIBVORBIS, [vorbis >= 1.1], [
2018     AC_DEFINE(HAVE_LIBVORBIS, 1, [Define to 1 if you have the libvorbis])
2019 ],[true])
2020 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto], [${LIBVORBIS_CFLAGS}], [${LIBVORBIS_LIBS}])
2021 if test "${enable_sout}" != "no"; then
2022 dnl Check for libshout
2023     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2027 dnl  matroska demux plugin
2029 AC_ARG_ENABLE(mkv,
2030   [AS_HELP_STRING([--disable-mkv],
2031     [do not use libmatroska (default auto)])])
2032 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2033   AC_LANG_PUSH(C++)
2034   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2035     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2036     AC_EGREP_CPP(yes,
2037       [#include <ebml/EbmlVersion.h>
2038        #ifdef LIBEBML_VERSION
2039        #if LIBEBML_VERSION >= 0x010000
2040        yes
2041        #endif
2042        #endif],
2043       [AC_MSG_RESULT([yes])
2044         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2045           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2046           AC_EGREP_CPP(yes,
2047             [#include <matroska/KaxVersion.h>
2048              #ifdef LIBMATROSKA_VERSION
2049              #if LIBMATROSKA_VERSION >= 0x010000
2050              yes
2051              #endif
2052              #endif],
2053             [AC_MSG_RESULT([yes])
2054               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2055               AC_CHECK_LIB(ebml_pic, main, [
2056                 VLC_ADD_PLUGIN([mkv])
2057                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2058               ],[
2059                 AC_CHECK_LIB(ebml, main, [
2060                   VLC_ADD_PLUGIN([mkv])
2061                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2062                 ])
2063               ])
2064             ], [
2065               AC_MSG_RESULT([no])
2066               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.])
2067           ])
2068         ])
2069       ],
2070       [AC_MSG_RESULT([no])
2071         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.])
2072     ])
2073   ])
2074   AC_LANG_POP(C++)
2078 dnl  modplug demux plugin
2080 AC_ARG_ENABLE(mod,
2081   [AS_HELP_STRING([--disable-mod],
2082     [do not use libmodplug (default auto)])])
2083 if test "${enable_mod}" != "no" ; then
2084     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2085           VLC_ADD_PLUGIN([mod])
2086           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2087           VLC_ADD_CFLAGS([mod],[$LIBMODPLUG_CFLAGS]) #modules/demux/mod.c needs CFLAGS_mod, not CXXFLAGS_mod
2088           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2089     ],[
2090        AS_IF([test -n "${enable_mod}"],
2091          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2092          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2093     ])
2097 dnl  mpc demux plugin
2099 AC_ARG_ENABLE(mpc,
2100   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2101 if test "${enable_mpc}" != "no"
2102 then
2103   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2104     VLC_ADD_PLUGIN([mpc])
2105     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2106     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2107     VLC_ADD_PLUGIN([mpc])
2108     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2112 dnl  Codec plugins
2115 EXTEND_HELP_STRING([Codec plugins:])
2118 dnl wmafixed plugin
2120 AC_ARG_ENABLE(wma-fixed,
2121   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2122 if test "${enable_wma_fixed}" = "yes"
2123 then
2124   VLC_ADD_PLUGIN([wma_fixed])
2128 dnl shine encoder plugin
2130 PKG_ENABLE_MODULES_VLC([SHINE], [], [shine >= 3.0.0], [MPEG Audio Layer 3 encoder], [auto], [], [], [])
2134 dnl openmax il codec plugin
2136 AC_ARG_ENABLE(omxil,
2137   [  --enable-omxil          openmax il codec module (default disabled)])
2138 if test "${enable_omxil}" = "yes"
2139 then
2140   VLC_ADD_PLUGIN([omxil])
2144 dnl openmax il vout plugin
2146 AC_ARG_ENABLE(omxil-vout,
2147   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2148 if test "${enable_omxil_vout}" = "yes"
2149 then
2150   VLC_ADD_PLUGIN([omxil_vout])
2154 dnl raspberry pi openmax il configuration
2156 AC_ARG_ENABLE(rpi-omxil,
2157   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2158 if test "${enable_rpi_omxil}" = "yes"
2159 then
2160   VLC_ADD_PLUGIN([omxil omxil_vout])
2161   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2165 dnl CrystalHD codec plugin
2167 AC_ARG_ENABLE(crystalhd,
2168   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2169 if test "${enable_crystalhd}" != "no"; then
2170     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2171       VLC_ADD_PLUGIN([crystalhd])
2172       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2173     ],[
2174       if test "${SYS}" = "mingw32" ; then
2175         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2176           VLC_ADD_PLUGIN([crystalhd])
2177           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2178             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2179             ])
2180         ],[
2181           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2182                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2183                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2184         ],[#define __LINUX_USER__
2185                #include <libcrystalhd/bc_dts_types.h>
2186         ])
2187       fi
2188     ],[
2189        #include <libcrystalhd/bc_dts_types.h>
2190       ])
2194 dnl  mad plugin
2196 have_mad="no"
2197 MAD_CFLAGS=""
2198 MAD_LIBS=""
2200 AC_ARG_WITH(mad, [  --with-mad=PATH         path to libmad], [
2201   enable_mad="yes"
2202 ], [
2203   with_mad="no"
2205 AS_IF([test "${with_mad}" != "no"], [
2206   MAD_CFLAGS="-I${with_mad}/include"
2207   MAD_LIBS="-L${with_mad}/lib"
2210 AC_ARG_ENABLE(mad,
2211   [  --enable-mad            libmad module (default enabled)])
2212 AS_IF([test "${enable_mad}" != "no"], [
2213   VLC_SAVE_FLAGS
2214   CPPFLAGS="${CPPFLAGS} ${MAD_CFLAGS}"
2215   LDFLAGS="${LDFLAGS} ${MAD_LIBS}"
2216   AC_CHECK_HEADERS(mad.h, [
2217     AC_CHECK_LIB(mad, mad_bit_init, [
2218       have_mad="yes"
2219       MAD_LIBS="${MAD_LIBS} -lmad"
2220     ])
2221   ])
2222   VLC_RESTORE_FLAGS
2223   AS_IF([test -n "$enable_mad" -a "${have_mad}" = "no"], [
2224     AC_MSG_ERROR([Could not find libmad. Install it or pass --disable-mad to disable it.])
2225   ])
2227 AC_SUBST(MAD_CFLAGS)
2228 AC_SUBST(MAD_LIBS)
2229 AM_CONDITIONAL([HAVE_MAD], [test "${have_mad}" = "yes"])
2231 dnl  mpg123 plugin
2234 PKG_ENABLE_MODULES_VLC([MPG123], [mpg123], [libmpg123], [libmpg123 decoder support], [auto])
2237 AC_ARG_ENABLE(merge-ffmpeg,
2238 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2239   enable_merge_ffmpeg="no"
2241 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2243 AC_MSG_CHECKING([for libavutil variant])
2244 PKG_CHECK_EXISTS([libavutil], [
2245   libavutil_version="$(${PKG_CONFIG} --modversion libavutil)"
2246   libavutil_micro="${libavutil_version##*.}"
2247   AS_IF([test ${libavutil_micro} -le 99], [
2248     avfork="libav"
2249   ], [
2250     avfork="ffmpeg"
2251   ])
2252 ], [
2253   avfork="none"
2255 AC_MSG_RESULT([${avfork}])
2258 dnl gstreamer stuff
2260 AC_ARG_ENABLE(gst-decode,
2261   [  --enable-gst-decode     GStreamer based decoding support (currently supports only video decoding) (default auto)])
2263 have_gst_decode="no"
2264 AS_IF([test "${enable_gst_decode}" != "no"], [
2265   PKG_CHECK_MODULES([GST_APP], [gstreamer-app-1.0], [
2266     PKG_CHECK_MODULES([GST_VIDEO], [gstreamer-video-1.0], [
2267       have_gst_decode="yes"
2268     ], [
2269       AC_MSG_WARN([${GST_VIDEO_PKG_ERRORS}. GStreamer decoder module will not be built.])
2270     ])
2271   ], [
2272     AC_MSG_WARN([${GST_APP_PKG_ERRORS}. GStreamer modules will not be built.])
2273   ])
2275 AM_CONDITIONAL([HAVE_GST_DECODE], [test "${have_gst_decode}" = "yes"])
2278 dnl  avcodec decoder/encoder plugin
2280 AC_ARG_ENABLE(avcodec,
2281 [  --enable-avcodec        libavcodec codec (default enabled)])
2282 AS_IF([test "${enable_avcodec}" != "no"], [
2283   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 55.0.0 libavutil >= 52.0.0], [
2284     dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
2285     dnl   AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
2286     dnl ])
2287     VLC_SAVE_FLAGS
2288     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2289     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2290     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2291     AC_CHECK_HEADERS(libavutil/avutil.h)
2292     VLC_RESTORE_FLAGS
2293     have_avcodec="yes"
2294   ],[
2295     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2296   ])
2297 ], [
2298   have_avcodec="no"
2300 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2303 dnl libva needs avcodec
2305 AC_ARG_ENABLE(libva,
2306   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2308 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2309   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2312 have_vaapi="no"
2313 have_vaapi_drm="no"
2314 have_vaapi_x11="no"
2315 AS_IF([test "${enable_libva}" != "no"], [
2316   PKG_CHECK_EXISTS([libva], [
2317     have_vaapi="yes"
2318   ], [
2319     AS_IF([test -n "${enable_libva}"], [
2320       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2321     ], [
2322       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2323     ])
2324   ])
2325   PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm], [
2326     have_vaapi_drm="yes"
2327   ], [
2328     AC_MSG_WARN([${LIBVA_DRM_PKG_ERRORS}.])
2329   ])
2330   PKG_CHECK_MODULES(LIBVA_X11, [libva-x11], [
2331     have_vaapi_x11="yes"
2332   ], [
2333     AC_MSG_WARN([${LIBVA_X11_PKG_ERRORS}.])
2334   ])
2336 AM_CONDITIONAL([HAVE_VAAPI_DRM], [test "${have_vaapi_drm}" = "yes"])
2337 AM_CONDITIONAL([HAVE_VAAPI_X11], [test "${have_vaapi_x11}" = "yes"])
2339 have_avcodec_vaapi="no"
2340 AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [
2341   VLC_SAVE_FLAGS
2342   CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2343   CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2344   AC_CHECK_HEADERS([libavcodec/vaapi.h], [
2345     AC_MSG_NOTICE([VAAPI acceleration activated])
2346     have_avcodec_vaapi="yes"
2347   ],[
2348     AS_IF([test -n "${enable_libva}"], [
2349       AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2350     ], [
2351       AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2352     ])
2353   ])
2354   VLC_RESTORE_FLAGS
2356 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2359 dnl dxva2 needs avcodec
2361 AC_ARG_ENABLE(dxva2,
2362   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2364 have_avcodec_dxva2="no"
2365 AS_IF([test "${enable_dxva2}" != "no"], [
2366   if test "${SYS}" = "mingw32"; then
2367   AS_IF([test "x${have_avcodec}" = "xyes"], [
2368     AC_CHECK_HEADERS(dxva2api.h,
2369       [
2370         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2371            AC_MSG_NOTICE([DxVA2 acceleration activated])
2372            have_avcodec_dxva2="yes"
2373         ],[
2374     AS_IF([test "${enable_dxva2}" = "yes"],
2375           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2376               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2377         ], [#undef _WIN32_WINNT
2378             /* DXVA2 is only available in Vista and above */
2379             #define _WIN32_WINNT 0x600])
2380       ],[
2381     AS_IF([test "${enable_dxva2}" = "yes"],
2382               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2383               [AC_MSG_WARN([dxva2api.h not found])])
2384       ])
2385   ],[
2386     AS_IF([test "x${enable_dxva2}" != "x"], [
2387       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2388     ])
2389   ])
2390   fi
2392 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2395 dnl d3d11va needs avcodec
2397 AC_ARG_ENABLE(d3d11va,
2398   [  --enable-d3d11va          D3D11 GPU decoding support (default auto)])
2400 have_avcodec_d3d11va="no"
2401 AS_IF([test "${enable_d3d11va}" != "no"], [
2402   if test "${SYS}" = "mingw32"; then
2403   AS_IF([test "x${have_avcodec}" = "xyes"], [
2404         AC_CHECK_TYPES([ID3D11VideoDecoder],
2405           [
2406             AC_CHECK_HEADERS(dxva2api.h,
2407               [
2408                 AC_CHECK_HEADERS(libavcodec/d3d11va.h, [
2409                    AC_MSG_NOTICE([D3D11 acceleration activated])
2410                    AC_DEFINE(HAVE_AVCODEC_D3D11VA, 1, [Define if the d3d11va module is built])
2411                    have_avcodec_d3d11va="yes"
2412                 ],[
2413                   AS_IF([test "${enable_d3d11va}" = "yes"],
2414                     [AC_MSG_ERROR([d3d11va is present but libavcodec/d3d11va.h is missing])],
2415                         [AC_MSG_WARN([d3d11va is present but libavcodec/d3d11va.h is missing ])])
2416                   ], [#undef _WIN32_WINNT
2417                       /* D3D11 is only available in Vista and above */
2418                       #define _WIN32_WINNT 0x600])
2419                   ],[
2420                     AS_IF([test "${enable_d3d11va}" = "yes"],
2421                           [AC_MSG_ERROR([Could not find required dxva2api.h])],
2422                           [AC_MSG_WARN([dxva2api.h not found])])
2423                   ])
2424           ],[
2425             AS_IF([test "${enable_d3d11va}" = "yes"],
2426                   [AC_MSG_ERROR([Could not find required ID3D11VideoDecoder in d3d11.h])],
2427                   [AC_MSG_WARN([ID3D11VideoDecoder not found])])
2428           ], [#include <d3d11.h>])
2429   ],[
2430     AS_IF([test "x${enable_d3d11va}" != "x"], [
2431       AC_MSG_ERROR([--enable-d3d11va and --disable-avcodec options are mutually exclusive.])
2432     ])
2433   ])
2434   fi
2436 AM_CONDITIONAL([HAVE_AVCODEC_D3D11VA], [test "${have_avcodec_d3d11va}" = "yes"])
2439 dnl DXGI debug
2441 AC_CHECK_HEADERS(dxgidebug.h)
2444 dnl vda needs avcodec
2446 AC_ARG_ENABLE(vda,
2447   [  --enable-vda          VDA  support (default auto)])
2449 have_avcodec_vda="no"
2450 AS_IF([test "${enable_vda}" != "no"], [
2451   if test "${SYS}" = "darwin"; then
2452   AS_IF([test "x${have_avcodec}" = "xyes"], [
2453     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2454       [
2455         AC_CHECK_HEADERS(libavcodec/vda.h, [
2456            have_avcodec_vda="yes"
2457         ],[
2458         AS_IF([test "${enable_vda}" = "yes"],
2459               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2460               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2461         ])
2462   ],[
2463         AS_IF([test "${enable_vda}" = "yes"],
2464               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2465               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2466       ])
2467   ],[
2468     AS_IF([test "x${enable_vda}" != "x"], [
2469       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2470     ])
2471  ])
2472  AS_IF([test "${have_avcodec_vda}" = "yes"], [
2473      SAVE_LIBS=$LIBS
2474      LIBS="$LIBS $AVCODEC_LIBS"
2475      AC_CHECK_FUNCS([av_vda_alloc_context])
2476      LIBS=$SAVE_LIBS
2477  ])
2478  fi
2480 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2483 dnl  avformat demuxer/muxer plugin
2486 AC_ARG_ENABLE(avformat,
2487 [  --enable-avformat       libavformat containers (default enabled)],, [
2488   enable_avformat="${have_avcodec}"
2490 have_avformat="no"
2491 AS_IF([test "${enable_avformat}" != "no"], [
2492   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2493       have_avformat="yes"
2494       VLC_SAVE_FLAGS
2495       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2496       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2497       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2498       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2499       AC_CHECK_HEADERS(libavutil/avutil.h)
2500       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2501         have_avformat="no"
2502       ])
2503       VLC_RESTORE_FLAGS
2504     ],[
2505       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2506   ])
2508 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2511 dnl  swscale image scaling and conversion plugin
2514 AC_ARG_ENABLE(swscale,
2515   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2516           (default enabled)]))
2517 if test "${enable_swscale}" != "no"
2518 then
2519   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2520     [
2521       VLC_SAVE_FLAGS
2522       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2523       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2524       AC_CHECK_HEADERS(libswscale/swscale.h)
2525       AC_CHECK_HEADERS(libavutil/avutil.h)
2526       VLC_ADD_PLUGIN([swscale])
2527       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2528       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2529       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2530         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2531       ])
2532       VLC_RESTORE_FLAGS
2533     ],[
2534       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2535   ])
2539 dnl  postproc plugin
2542 AC_ARG_ENABLE(postproc,
2543 [  --enable-postproc       libpostproc image post-processing (default auto)])
2544 if test "${enable_postproc}" != "no"
2545 then
2546   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2547     [
2548       VLC_SAVE_FLAGS
2549       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2550       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2551       AC_CHECK_HEADERS(postproc/postprocess.h)
2552       VLC_ADD_PLUGIN([postproc])
2553       VLC_RESTORE_FLAGS
2554     ],[
2555       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2556   ])
2560 dnl  faad decoder plugin
2562 AC_ARG_ENABLE(faad,
2563 [  --enable-faad           faad codec (default auto)])
2564 have_faad="no"
2565 AS_IF([test "${enable_faad}" != "no"], [
2566   AC_CHECK_HEADERS([neaacdec.h], [
2567     AC_CHECK_LIB(faad, NeAACDecOpen, [have_faad="yes"],, [$LIBM])
2569     AS_IF([test "${have_faad}" = "yes"], [
2570       VLC_ADD_PLUGIN([faad])
2571       VLC_ADD_LIBS([faad],[-lfaad])
2572     ], [
2573       AS_IF([test "${enable_faad}" = "yes"], [
2574         AC_MSG_ERROR([cannot find FAAD library])
2575       ], [
2576         AC_MSG_WARN([cannot find FAAD library])
2577       ])
2578     ])
2579   ])
2583 dnl libvpx decoder plugin
2585 AC_ARG_ENABLE(vpx,
2586     AS_HELP_STRING([--enable-vpx],[libvpx VP8/VP9 decoder (default auto)]))
2587 AS_IF([test "${enable_vpx}" != "no"],[
2588     PKG_CHECK_MODULES([VPX], [vpx] , [
2589         VLC_ADD_PLUGIN([vpx])
2590         VLC_ADD_CPPFLAGS([vpx], [${VPX_CFLAGS}])
2591         VLC_ADD_LIBS([vpx], [${VPX_LIBS}])
2592         AC_CHECK_LIB([vpx],[vpx_codec_vp8_dx], [
2593             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP8_DECODER])
2594         ], [], [${VPX_LIBS}])
2595         AC_CHECK_LIB([vpx],[vpx_codec_vp9_dx], [
2596             VLC_ADD_CPPFLAGS([vpx], [-DENABLE_VP9_DECODER])
2597         ], [], [${VPX_LIBS}])
2598     ], [
2599     AS_IF([test "${enable_vpx}" = "yes"],[
2600         AC_MSG_ERROR([libvpx was not found])
2601     ])])
2605 dnl twolame encoder plugin
2607 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2610 dnl fdk-aac encoder plugin
2612 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2615 dnl  QuickTime plugin
2617 AC_ARG_ENABLE(quicktime,
2618   [  --enable-quicktime      QuickTime module (deprecated)])
2619 if test "${enable_quicktime}" = "yes"; then
2620   if test "${SYS}" = "mingw32"; then
2621     VLC_ADD_PLUGIN([quicktime])
2622   else
2623   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2624     [ VLC_ADD_PLUGIN([quicktime])
2625       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2626     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2627   fi
2631 dnl A52/AC3 decoder plugin
2633 AC_ARG_ENABLE(a52,
2634   [  --enable-a52            A/52 support with liba52 (default enabled)])
2635 if test "${enable_a52}" != "no"
2636 then
2637   AC_ARG_WITH(a52,
2638     [  --with-a52=PATH         a52 headers and libraries])
2639     if test -z "${with_a52}"
2640     then
2641       LDFLAGS_test=""
2642       CPPFLAGS_test=""
2643     else
2644       LDFLAGS_test="-L${with_a52}/lib"
2645       CPPFLAGS_test="-I${with_a52}/include"
2646     fi
2647     VLC_SAVE_FLAGS
2648     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2649     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2650     AC_CHECK_HEADERS(a52dec/a52.h, [
2651       AC_CHECK_LIB(a52, a52_free, [
2652         VLC_ADD_PLUGIN([a52tofloat32])
2653         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2654         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2655       ],[
2656         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.])
2657         ], [$LIBM])
2658     ],[
2659       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.])
2660     ])
2661     VLC_RESTORE_FLAGS
2665 dnl DTS Coherent Acoustics decoder plugin
2667 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2670 dnl  Flac plugin
2672 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2675 dnl  Libmpeg2 plugin
2677 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2680 dnl  Vorbis plugin
2682 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2685 dnl  Tremor plugin
2687 AC_ARG_ENABLE(tremor,
2688   [  --enable-tremor         Tremor decoder support (default disabled)])
2689 if test "${enable_tremor}" = "yes"
2690 then
2691   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2692     VLC_ADD_PLUGIN([tremor])
2693    ],[])
2697 dnl  Speex plugins
2699 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2700 have_speexdsp="no"
2701 AS_IF([test "${enable_speex}" != "no"], [
2702   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2703     have_speexdsp="yes"
2704   ], [
2705     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2706   ])
2708 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2711 dnl  Opus plugin
2713 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus >= 1.0.3], [Opus support], [auto])
2716 dnl  theora decoder plugin
2718 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2721 dnl  Daala decoder plugin
2723 PKG_ENABLE_MODULES_VLC([DAALA], [], [ogg daaladec daalaenc], [experimental daala codec], [disabled])
2726 dnl  schroedinger decoder plugin (for dirac format video)
2728 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2731 dnl  PNG decoder module
2733 AC_ARG_ENABLE(png,
2734   [  --enable-png            PNG support (default enabled)])
2735 AS_IF([test "${enable_png}" != "no"], [
2736 AC_CHECK_HEADERS(png.h, [
2737   VLC_SAVE_FLAGS
2738   LDFLAGS="${LDFLAGS} -lz $LIBM"
2739   AC_CHECK_LIB(png, png_set_rows, [
2740     VLC_ADD_PLUGIN([png])
2741   ], [], [-lz $LIBM])
2742   VLC_RESTORE_FLAGS
2743   ])
2747 dnl  JPEG decoder module
2749 AC_ARG_ENABLE(jpeg,
2750   [  --enable-jpeg           JPEG support (default enabled)])
2751 AS_IF([test "${enable_jpeg}" != "no"], [
2752 AC_CHECK_HEADERS(jpeglib.h, [
2753   VLC_ADD_PLUGIN([jpeg])
2754   ])
2758 dnl  BPG decoder module
2760 AC_ARG_ENABLE(bpg,
2761   [  --enable-bpg           BPG support (default disabled)])
2762 AS_IF([test "${enable_bpg}" != "no"], [
2763 AC_CHECK_HEADERS(libbpg.h, [
2764   VLC_ADD_PLUGIN([bpg])
2765   ])
2769 dnl H262 encoder plugin (lib262)
2771 AC_ARG_ENABLE(x262,
2772   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2773 if test "${enable_x262}" != "no"; then
2774     PKG_CHECK_MODULES(X262, x262, [
2775         VLC_ADD_PLUGIN([x262])
2776         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2777         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2778           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2779         ])
2780         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2781         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2782           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2783         fi
2784     ], [
2785        if test "${enable_x262}" = "yes"; then
2786         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2787        fi
2788     ])
2791 dnl x265 encoder
2792 PKG_ENABLE_MODULES_VLC([X265],, [x265], [HEVC/H.265 encoder], [auto])
2795 dnl H264 encoder plugin (10-bit lib264)
2797 AC_ARG_ENABLE(x26410b,
2798   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2799 if test "${enable_x26410b}" != "no"; then
2800     PKG_CHECK_MODULES(X26410B, x26410b, [
2801         VLC_ADD_PLUGIN([x26410b])
2802         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2803         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2804           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2805         ])
2806         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2807         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2808           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2809         fi
2810     ], [
2811        if test "${enable_x26410b}" = "yes"; then
2812         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2813        fi
2814     ])
2819 dnl H264 encoder plugin (using libx264)
2821 AC_ARG_ENABLE(x264,
2822   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2823 if test "${enable_x264}" != "no"; then
2824       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2825         VLC_ADD_PLUGIN([x264])
2826         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2828         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2829           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2830         ])
2832         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2833         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2834           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2835         fi
2836       ],[
2837         if test "${enable_x264}" = "yes"; then
2838             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2839           fi
2840       ])
2844 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2846 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2849 dnl libfluidsynth (MIDI synthetizer) plugin
2851 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2854 dnl Teletext Modules
2855 dnl vbi decoder plugin (using libzbvi)
2856 dnl telx module
2857 dnl uncompatible
2859 AC_ARG_ENABLE(zvbi,
2860   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2861                   libzvbi (default enabled)]))
2862 AC_ARG_ENABLE(telx,
2863   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2864                   zvbi) (default enabled if zvbi is absent)]))
2866 AS_IF( [test "${enable_zvbi}" != "no"],[
2867     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2868         [
2869           VLC_ADD_PLUGIN([zvbi])
2870           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2871           AS_IF( [test "${enable_telx}" = "yes"],[
2872                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2873                   ])
2874         ],[
2875           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2876         ])
2877     ])
2878 AS_IF( [test "${enable_telx}" != "no" ],[
2879   VLC_ADD_PLUGIN([telx])
2880   ])
2883 dnl libass subtitle rendering module
2885 AC_ARG_ENABLE(libass,
2886   [  --enable-libass         Subtitle support using libass (default enabled)])
2887 AS_IF( [test "${enable_libass}" != "no"], [
2888   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2889       [
2890         VLC_ADD_PLUGIN([libass])
2892         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2893           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2894            VLC_ADD_LIBS([libass],[-lfontconfig])
2895        ])
2896       ],[
2897         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2898       ])
2899   ])
2902 dnl ARIB subtitles rendering module
2904 AC_ARG_ENABLE(aribsub,
2905   [  --enable-aribsub        ARIB Subtitles support (default enabled)])
2906 AS_IF( [test "${enable_aribsub}" != "no" ],[
2907   PKG_CHECK_MODULES(ARIBB24, [aribb24 >= 1.0.1], [
2908       have_aribb24="yes"
2909       VLC_ADD_PLUGIN([aribsub])
2910       VLC_ADD_LIBS([aribsub],[-laribb24])
2911       AC_DEFINE(HAVE_ARIBB24, 1, [Define if libaribb24 is available.])
2912     ],[
2913       AC_MSG_WARN(Library [aribb24] needed for [aribsub] was not found)
2914       have_aribb24="no"
2915   ])
2917 AM_CONDITIONAL([HAVE_ARIBB24], [test x"${have_aribb24}" = x"yes"])
2920 dnl ARIB B25
2922 PKG_ENABLE_MODULES_VLC([ARIBB25], [aribcam], [aribb25 >= 0.2.6], [ARIB STD-B25], [auto])
2925 dnl  kate decoder plugin
2927 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2930 dnl  tiger rendering for kate decoder plugin
2932 AC_ARG_ENABLE(tiger,
2933 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2934 AS_IF([test "${enable_tiger}" != "no"], [
2935   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2936       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2937         AS_IF([test -n "${enable_tiger}"], [
2938           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2939         ])
2940   ])
2945 dnl  Video plugins
2948 EXTEND_HELP_STRING([Video plugins:])
2951 dnl  OpenGL
2953 PKG_CHECK_MODULES([EGL], [egl], [
2954   have_egl="yes"
2955 ], [
2956   have_egl="no"
2958 AM_CONDITIONAL([HAVE_EGL], [test "${have_egl}" = "yes"])
2960 have_gl="no"
2961 PKG_CHECK_MODULES([GL], [gl], [
2962   have_gl="yes"
2963 ], [
2964   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2965 #ifdef _WIN32
2966 # include <GL/glew.h>
2967 #endif
2968 #include <GL/gl.h>
2969 ]], [
2970     [int t0 = GL_TEXTURE0;]])
2971   ], [
2972     GL_CFLAGS=""
2973     have_gl="yes"
2974     AS_IF([test "${SYS}" != "mingw32"], [
2975       GL_LIBS="-lGL"
2976     ], [
2977       GL_LIBS="-lopengl32"
2978     ])
2979   ])
2981 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
2983 dnl OpenGL ES 2: depends on EGL 1.1
2984 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
2985 dnl OpenGL ES 1: depends on EGL 1.0
2986 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
2989 dnl  Xlib
2992 AC_PATH_XTRA()
2993 AC_CHECK_HEADERS(X11/Xlib.h)
2996 dnl  X C Bindings modules
2998 AC_ARG_ENABLE(xcb,
2999   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3000   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [
3001     enable_xcb="yes"
3002   ], [
3003     enable_xcb="no"
3004   ])
3006 AC_ARG_ENABLE(xvideo,
3007   [  --enable-xvideo         XVideo support (default enabled)],, [
3008     enable_xvideo="$enable_xcb"
3011 have_xcb="no"
3012 have_xcb_keysyms="no"
3013 have_xcb_randr="no"
3014 have_xcb_xvideo="no"
3015 AS_IF([test "${enable_xcb}" != "no"], [
3016   dnl libxcb
3017   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3018   have_xcb="yes"
3019   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3020   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3021   PKG_CHECK_MODULES(XPROTO, [xproto])
3023   AS_IF([test "${enable_xvideo}" != "no"], [
3024     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3025   ])
3027   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3029   dnl xcb-utils
3030   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3031     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3032   ])
3034 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3035 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3036 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3037 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3041 dnl VDPAU needs X11
3043 AC_ARG_ENABLE(vdpau,
3044   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3045 have_vdpau="no"
3046 AS_IF([test "${enable_vdpau}" != "no"], [
3047   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3048     have_vdpau="yes"
3049     AS_IF([test "${no_x}" = "yes"], [
3050       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3051     ])
3052   ], [
3053     AS_IF([test -n "${enable_vdpau}"], [
3054       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3055     ])
3056   ])
3058 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3060 have_avcodec_vdpau="no"
3061 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3062   case "${avfork}" in
3063     libav) av_vdpau_ver="55.26.0" ;;
3064     ffmpeg) av_vdpau_ver="55.42.100" ;;
3065   esac
3066   PKG_CHECK_EXISTS([libavutil >= 52.4.0 libavcodec >= ${av_vdpau_ver}], [
3067     have_avcodec_vdpau="yes"
3068     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3069   ], [
3070     AS_IF([test -n "${enable_vdpau}"], [
3071       AC_MSG_ERROR([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3072     ], [
3073       AC_MSG_WARN([libav libavutil >= 52.4.0 and libavcodec >= 55.26.0 are required for VDPAU decoding.])
3074     ])
3075   ])
3077 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3081 dnl  Wayland
3083 AC_ARG_ENABLE(wayland,
3084   [AS_HELP_STRING([--enable-wayland], [Wayland support (default auto)])])
3085 have_wayland="no"
3086 AC_ARG_VAR([WAYLAND_SCANNER], [Wayland scanner utility])
3088 AS_IF([test "${enable_wayland}" != "no"], [
3089   AC_MSG_CHECKING([for the Wayland scanner])
3090   AS_IF([test -z "$WAYLAND_SCANNER"], [
3091     PKG_CHECK_EXISTS([wayland-scanner], [
3092       WAYLAND_SCANNER="$(${PKG_CONFIG} wayland-scanner --variable wayland_scanner)"
3093     ], [
3094       WAYLAND_SCANNER="wayland-scanner"
3095     ])
3096   ])
3097   AC_MSG_RESULT([$WAYLAND_SCANNER])
3099   PKG_CHECK_MODULES([WAYLAND_CLIENT], [wayland-client >= 1.5.91], [
3100     have_wayland="yes"
3101   ], [
3102     AS_IF([test -n "${enable_wayland}"], [
3103       AC_MSG_ERROR([${WAYLAND_CLIENT_PKG_ERRORS}.])
3104     ])
3105   ])
3107   AS_IF([test "${have_egl}" = "yes"], [
3108     PKG_CHECK_MODULES([WAYLAND_EGL], [wayland-egl], [
3109       have_wayland_egl="yes"
3110     ], [
3111       AS_IF([test -n "${enable_wayland}"], [
3112         AC_MSG_ERROR([${WAYLAND_EGL_PKG_ERRORS}.])
3113       ])
3114     ])
3115   ])
3117 AM_CONDITIONAL([HAVE_WAYLAND], [test "${have_wayland}" = "yes"])
3118 AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "${have_wayland_egl}" = "yes"])
3122 dnl  SDL module
3124 AC_ARG_ENABLE(sdl,
3125   [  --enable-sdl            SDL support (default enabled)])
3126 AC_ARG_ENABLE(sdl-image,
3127   [  --enable-sdl-image      SDL image support (default enabled)])
3128 if test "${enable_sdl}" != "no"
3129 then
3130    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3131       # SDL on Darwin is heavily patched and can only run SDL_image
3132       if test "${SYS}" != "darwin"; then
3133         VLC_ADD_PLUGIN([vout_sdl])
3134       fi
3136       # SDL_image
3137       AS_IF([ test "${enable_sdl_image}" != "no"],[
3138         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3139           VLC_ADD_PLUGIN([sdl_image])],
3140           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3141           ])
3142       ])
3143    ],[
3144      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3145    ])
3149 dnl  freetype module
3151 AC_ARG_ENABLE(freetype,
3152   [  --enable-freetype       freetype support   (default auto)])
3153 AC_ARG_ENABLE(fribidi,
3154   [  --enable-fribidi        fribidi support    (default auto)])
3155 AC_ARG_ENABLE(harfbuzz,
3156   [  --enable-harfbuzz       harfbuzz support   (default auto)])
3157 AC_ARG_ENABLE(fontconfig,
3158   [  --enable-fontconfig     fontconfig support (default auto)])
3160 AC_ARG_WITH([default-font],
3161     AS_HELP_STRING([--with-default-font=PATH],
3162         [Path to the default font]),
3163         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3164             "$withval", [Default font])])
3165 AC_ARG_WITH([default-monospace-font],
3166     AS_HELP_STRING([--with-default-monospace-font=PATH],
3167         [Path to the default font]),
3168         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3169             "$withval", [Default monospace font])])
3171 AC_ARG_WITH([default-font-family],
3172     AS_HELP_STRING([--with-default-font-family=NAME],
3173         [Path to the default font family]),
3174         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3175             "$withval", [Default font family])])
3176 AC_ARG_WITH([default-monospace-font-family],
3177     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3178         [Path to the default font family]),
3179         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3180             "$withval", [Default monospace font family])])
3182 have_freetype="no"
3183 have_fontconfig="no"
3184 have_fribidi="no"
3185 have_harfbuzz="no"
3187 if test "${enable_freetype}" != "no"; then
3188    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3189       have_freetype="yes"
3190       VLC_ADD_CPPFLAGS([skins2],[${FREETYPE_CFLAGS}])
3191       VLC_ADD_LIBS([skins2],[${FREETYPE_LIBS}])
3193       dnl fontconfig support
3194       if test "${SYS}" != "mingw32"; then
3195           if test "${enable_fontconfig}" != "no"; then
3196             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3197               have_fontconfig="yes"
3198             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3199           fi
3200       fi
3202       dnl fribidi support
3203       if test "${enable_fribidi}" != "no"; then
3204         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3205           have_fribidi="yes"
3206           VLC_ADD_CPPFLAGS([skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3207           VLC_ADD_LIBS([skins2], [${FRIBIDI_LIBS}])
3208         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional text and complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3209       fi
3211       dnl harfbuzz support
3212       if test "${have_fribidi}" != "no"; then
3213         if test "${enable_harfbuzz}" != "no"; then
3214           PKG_CHECK_MODULES(HARFBUZZ, harfbuzz, [
3215             have_harfbuzz="yes"
3216             VLC_ADD_CPPFLAGS([skins2], [${HARFBUZZ_CFLAGS} -DHAVE_HARFBUZZ])
3217             VLC_ADD_LIBS([skins2], [${HARFBUZZ_LIBS}])
3218           ],[AC_MSG_WARN([${HARFBUZZ_PKG_ERRORS}. Support for complex scripts (Arabic, Farsi, Thai...) will be disabled in FreeType.])])
3219         fi
3220       fi
3221   ],[
3222   AS_IF([test -n "${enable_freetype}"],[
3223     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3224     ])
3225   ])
3228 AM_CONDITIONAL([HAVE_FREETYPE], [test "${have_freetype}" = "yes"])
3229 AM_CONDITIONAL([HAVE_FONTCONFIG], [test "${have_fontconfig}" = "yes"])
3230 AM_CONDITIONAL([HAVE_FRIBIDI], [test "${have_fribidi}" = "yes"])
3231 AM_CONDITIONAL([HAVE_HARFBUZZ], [test "${have_harfbuzz}" = "yes"])
3235 dnl  QuartzText vout module (iOS/Mac OS)
3237 AC_ARG_ENABLE(macosx-quartztext,
3238   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3239 if test "x${enable_macosx_quartztext}" != "xno" &&
3240   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3241 then
3242   VLC_ADD_PLUGIN([quartztext])
3246 dnl  SVG module (text rendering and image decoding)
3248 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3249 PKG_ENABLE_MODULES_VLC([SVGDEC], [], [librsvg-2.0 >= 2.9.0 cairo >= 1.13.1], [SVG image decoder library],[auto])
3252 dnl  android surface module
3254 AC_ARG_ENABLE(android-surface,
3255   [  --enable-android-surface   Android Surface video output module (default disabled)])
3256 if test "${enable_android_surface}" = "yes"; then
3257      VLC_ADD_PLUGIN([android_surface])
3258      VLC_ADD_PLUGIN([android_window])
3262 dnl  Windows DirectX module
3265 AC_ARG_ENABLE(directx,
3266   [AS_HELP_STRING([--enable-directx],
3267     [Microsoft DirectX support (default enabled on Windows)])],, [
3268   AS_IF([test "${SYS}" = "mingw32"], [
3269     enable_directx="yes"
3270   ], [
3271     enable_directx="no"
3272   ])
3274 have_directx="no"
3275 AS_IF([test "${enable_directx}" != "no"], [
3276   dnl DirectDraw
3277   AC_CHECK_HEADERS(ddraw.h, [
3278     have_directx="yes"
3279   ], [
3280     AC_MSG_ERROR([Cannot find DirectX headers!])
3281   ])
3283   dnl OpenGL
3284   AC_CHECK_HEADERS(GL/wglew.h, [
3285     VLC_ADD_PLUGIN([glwin32])
3286   ],, [
3287     #include <windows.h>
3288     #include <GL/gl.h>
3289   ])
3291   dnl Direct3D11
3292   AC_CHECK_HEADERS(d3d11.h, [
3293     VLC_ADD_PLUGIN([direct3d11])
3294   ])
3296   dnl Direct3D9
3297   AC_CHECK_HEADERS(d3d9.h, [
3298     VLC_ADD_PLUGIN([direct3d9])
3299   ])
3301   dnl Direct2D
3302   AC_CHECK_HEADERS(d2d1.h, [
3303     VLC_ADD_PLUGIN([direct2d])
3304   ])
3306 AM_CONDITIONAL([HAVE_DIRECTX], [test "$have_directx" = "yes"])
3309 dnl  Linux framebuffer module
3311 AC_CHECK_HEADER([linux/fb.h], [
3312   VLC_ADD_PLUGIN([fb])
3317 dnl  DirectFB module
3318 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3319 dnl  TODO: support for static linking
3321 AC_ARG_ENABLE(directfb,
3322   [  --enable-directfb       DirectFB support (default disabled)])
3323 AC_ARG_WITH(directfb,
3324   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3326 if test "${enable_directfb}" = "yes"; then
3327     have_directfb="false"
3328     CPPFLAGS_mydirectfb=
3329     LIBS_mydirectfb=
3330     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3331         dnl Trying the given location
3332         VLC_SAVE_FLAGS
3334         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3335         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3337         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3338         LIBS="${LIBS} ${LIBS_new}"
3340         dnl FIXME: too obscure
3341         AC_CHECK_HEADER([directfb.h], [
3342             AC_CHECK_LIB([direct],[direct_initialize], [
3343                 AC_CHECK_LIB([fusion], [fusion_enter], [
3344                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3345                 ], have_directfb="false")
3346             ], have_directfb="false")
3347         ], have_directfb="false")
3349         VLC_RESTORE_FLAGS
3351         if test "${have_directfb}" = "true"; then
3352             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3353             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3354         fi
3355     else
3356         dnl Look for directfb-config
3357         AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
3358         if test "${DIRECTFB_CONFIG}" != "no"; then
3359             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3360             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3361             have_directfb="true"
3362         else
3363             dnl Trying with pkg-config
3364             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3365                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3366                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3367                 have_directfb="true"
3368                 ], [have_directfb="false"])
3369         fi
3370     fi
3371     if test "${have_directfb}" = "true"; then
3372         VLC_ADD_PLUGIN([directfb])
3373         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3374         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3375     else
3376         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3377     fi
3381 dnl  AA plugin
3383 AC_ARG_ENABLE(aa,
3384   [  --enable-aa             aalib output (default disabled)])
3385 if test "${enable_aa}" = "yes"
3386 then
3387   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3388   if test "${have_aa}" = "true"
3389   then
3390     VLC_ADD_PLUGIN([aa])
3391   fi
3395 dnl  libcaca plugin
3397 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3400 dnl  OS/2 KVA plugin
3402 AC_ARG_ENABLE(kva,
3403   [AS_HELP_STRING([--enable-kva],
3404     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3405   AS_IF([test "$SYS" = "os2"], [
3406     enable_kva="yes"
3407   ])
3409 have_kva="no"
3410 KVA_LIBS=""
3411 AS_IF([test "$enable_kva" != "no"], [
3412   AC_CHECK_HEADERS([kva.h], [
3413     have_kva="yes"
3414     AC_CHECK_LIB(kva, main, [
3415       KVA_LIBS="-lkva"
3416     ])
3417   ])
3419 AC_SUBST(KVA_LIBS)
3420 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3423 dnl MMAL plugin
3425 AC_ARG_ENABLE(mmal,
3426   AS_HELP_STRING([--enable-mmal],
3427     [Multi-Media Abstraction Layer (MMAL) hardware plugin (default enable)]))
3428 if test "${enable_mmal}" != "no"; then
3429   VLC_SAVE_FLAGS
3430   LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
3431   CPPFLAGS="${CPPFLAGS} -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
3432   AC_CHECK_HEADERS(interface/mmal/mmal.h,
3433     [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
3434         have_mmal="yes"
3435         VLC_ADD_PLUGIN([mmal])
3436         VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
3437         VLC_ADD_CFLAGS([mmal],[ -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux ])
3438         VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lvchostif ]) ], [
3439           AS_IF([test "${enable_mmal}" = "yes"],
3440             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
3441             [ AC_MSG_WARN([Cannot find bcm library...]) ])
3442           ],
3443         [])
3444     ] , [ AS_IF([test "${enable_mmal}" = "yes"],
3445       [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
3446       [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
3447   VLC_RESTORE_FLAGS
3449 AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
3452 dnl  Audio plugins
3455 EXTEND_HELP_STRING([Audio plugins:])
3458 dnl  Pulseaudio module
3460 AC_ARG_ENABLE(pulse,
3461   [AS_HELP_STRING([--enable-pulse],
3462     [use the PulseAudio client library (default auto)])])
3463 have_pulse="no"
3464 AS_IF([test "${enable_pulse}" != "no"], [
3465   PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0], [
3466     have_pulse="yes"
3467   ], [
3468     AS_IF([test "x${enable_pulse}" != "x"], [
3469       AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 1.0 or later required.])
3470     ])
3471   ])
3473 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3476 dnl  ALSA module
3478 AC_ARG_ENABLE(alsa,
3479   [AS_HELP_STRING([--enable-alsa],
3480     [support the Advanced Linux Sound Architecture (default auto)])],, [
3481   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3482     enable_alsa="yes"
3483   ])
3485 have_alsa="no"
3486 AS_IF([test "${enable_alsa}" != "no"], [
3487   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3488     have_alsa="yes"
3489   ], [
3490     AS_IF([test "x${enable_alsa}" != "x"], [
3491       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3492     ])
3493   ])
3495 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3498 dnl  Open Sound System module
3500 AC_ARG_ENABLE(oss,
3501   [AS_HELP_STRING([--enable-oss],
3502     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3503   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3504     enable_oss="no"
3505   ])
3507 have_oss="no"
3508 OSS_LIBS=""
3509 AS_IF([test "$enable_oss" != "no"], [
3510   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3511     have_oss="yes"
3512     AC_CHECK_LIB(ossaudio, main, [
3513       OSS_LIBS="-lossaudio"
3514     ])
3515   ])
3517 AC_SUBST(OSS_LIBS)
3518 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3521 dnl  OpenBSD sndio module
3523 AC_ARG_ENABLE([sndio],
3524   [AS_HELP_STRING([--disable-sndio],
3525     [support the OpenBSD sndio (default auto)])],, [
3526   AS_IF([test "$SYS" = "openbsd"], [
3527     enable_sndio="yes"
3528   ])
3530 have_sndio="no"
3531 AS_IF([test "$enable_sndio" != "no"], [
3532   AC_CHECK_HEADER([sndio.h], [
3533     have_sndio="yes"
3534   ])
3536 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3539 dnl  Windows Audio Session plugin
3541 AC_ARG_ENABLE([wasapi],
3542   [AS_HELP_STRING([--enable-wasapi],
3543     [use the Windows Audio Session API (default auto)])
3545 have_wasapi="no"
3546 AS_IF([test "$enable_wasapi" != "no"], [
3547   AC_CHECK_HEADER([audioclient.h], [
3548     have_wasapi="yes"
3549   ], [
3550     AS_IF([test "x${enable_wasapi}" != "x"], [
3551       AC_MSG_ERROR([Windows Audio Session API not found.])
3552     ])
3553   ])
3555 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3558 dnl  AudioQueue plugin
3560 AC_ARG_ENABLE(audioqueue,
3561   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3562 if test "${enable_audioqueue}" = "yes"
3563 then
3564   VLC_ADD_PLUGIN([audioqueue])
3568 dnl  JACK modules
3570 AC_ARG_ENABLE(jack,
3571   [AS_HELP_STRING([--disable-jack],
3572     [do not use jack (default auto)])])
3573 have_jack="no"
3574 AS_IF([test "${enable_jack}" != "no"], [
3575     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3576       [ have_jack=yes ],
3577       [
3578       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3580       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3581       [ have_jack=yes ],
3582       [
3583       AS_IF([test -n "${enable_jack}"],
3584          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3585          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3586       ])
3587     ])
3589 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3592 dnl  OpenSLES Android
3594 AC_ARG_ENABLE(opensles,
3595   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3596 if test "${HAVE_ANDROID}" = "1"; then
3597   if test "${enable_opensles}" = "yes"; then
3598       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3599         [ VLC_ADD_PLUGIN([opensles_android]) ],
3600         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3601   fi
3605 dnl libsamplerate plugin
3607 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3610 dnl  OS/2 KAI plugin
3612 AC_ARG_ENABLE(kai,
3613   [AS_HELP_STRING([--enable-kai],
3614     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3615   AS_IF([test "$SYS" = "os2"], [
3616     enable_kai="yes"
3617   ])
3619 have_kai="no"
3620 KAI_LIBS=""
3621 AS_IF([test "$enable_kai" != "no"], [
3622   AC_CHECK_HEADERS([kai.h], [
3623     have_kai="yes"
3624     AC_CHECK_LIB(kai, main, [
3625       KAI_LIBS="-lkai"
3626     ])
3627   ])
3629 AC_SUBST(KAI_LIBS)
3630 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3633 dnl  chromaprint audio track fingerprinter
3635 m4_pushdef([libchromaprint_version], 0.6.0)
3636 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3637     VLC_ADD_PLUGIN([stream_out_chromaprint]),
3638     AS_IF([test "${enable_chromaprint}" = "yes"],
3639         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3640         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3641          ),
3642     [(Chromaprint based audio fingerprinter)],[auto])
3643 m4_popdef([libchromaprint_version])
3646 dnl  Chromecast streaming support
3648 m4_pushdef([protobuf_lite_version], 2.5.0)
3649 AC_ARG_VAR(PROTOC, [protobuf compiler])
3650 AC_PATH_PROGS(PROTOC, protoc, no)
3651 PKG_WITH_MODULES([CHROMECAST],[protobuf-lite >= protobuf_lite_version], [
3652     AS_IF([test "x${PROTOC}" != "xno"], [
3653         build_chromecast="yes"
3654     ], [
3655     AC_MSG_ERROR(protoc compiler needed for [chromecast] was not found)
3656     ])
3657 ], [
3658     AS_IF([test "${enable_chromecast}" = "yes"],
3659         AC_MSG_ERROR(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found),
3660         AC_MSG_WARN(Library [protobuf-lite >= protobuf_lite_version] needed for [chromecast] was not found)
3661     )
3662     enable_chromecast="no"
3663 ], [(Chromecast streaming support)], [auto])
3664 AM_CONDITIONAL([BUILD_CHROMECAST], [test "${build_chromecast}" = "yes"])
3665 m4_popdef([protobuf_lite_version])
3668 dnl  Interface plugins
3671 EXTEND_HELP_STRING([Interface plugins:])
3674 dnl QT
3676 AC_ARG_ENABLE(qt, [
3677   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3678   AS_IF([test "${SYS}" = "darwin"], [
3679     enable_qt="no"
3680   ])
3682 AS_IF([test "${enable_qt}" != "no"], [
3683   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
3684       PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
3685           VLC_ADD_LIBS([qt4],[${QTX11_LIBS}])
3686           VLC_ADD_CXXFLAGS([qt4],[${QTX11_CFLAGS} -DQT5_HAS_X11])
3687       ],[
3688           AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
3689       ])
3690       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3691       QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
3692       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3693       AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}" "${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3694       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}" "${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3695     ], [
3696       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3697         AS_IF([test -n "${enable_qt}"],[
3698           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3699         ],[
3700           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3701         ])
3702         enable_qt="no"
3703       ])
3704       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3705       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3706       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3707       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
3708     ])
3710 AS_IF([test "${enable_qt}" != "no"], [
3711   VLC_ADD_PLUGIN([qt4])
3712   ALIASES="${ALIASES} qvlc"
3714 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3717 dnl Simple test for skins2 dependency
3719 AS_IF([test "$enable_qt" = "no"], [
3720   AS_IF([test "${enable_skins2}" = "yes"], [
3721     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.])
3722   ], [
3723     enable_skins2="no"
3724     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3725   ])
3729 dnl Skins2 module
3731 AC_ARG_ENABLE(skins2,
3732   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3733 AS_IF([test "${enable_skins2}" != "no"], [
3734   have_skins_deps="yes"
3736   dnl Win32
3737   AS_IF([test "${SYS}" = "mingw32"], [
3738     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3739     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3740   dnl MacOS
3741   ], [test "${SYS}" = "darwin"], [
3742     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3743     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3744   dnl OS/2
3745   ], [test "${SYS}" = "os2"], [
3746     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3747   dnl Linux/Unix
3748   ], [
3749     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3750     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3751     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3752     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3753     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3754   ])
3756   dnl for All OSes
3757   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3759   dnl we need freetype
3760   AS_IF([test "${have_freetype}" != "yes"], [
3761     have_skins_deps="no"
3762   ])
3764   AS_IF([test "${have_skins_deps}" = "no"], [
3765     AS_IF([test "x${enable_skins2}" = "x"], [
3766       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3767     ], [
3768       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3769     ])
3770     enable_skins2="no"
3771   ], [
3772     VLC_ADD_PLUGIN([skins2])
3773     ALIASES="${ALIASES} svlc"
3774     enable_skins2="yes"
3775   ])
3777 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3779 AC_ARG_ENABLE(libtar,
3780   [  --enable-libtar         libtar support for skins2 (default auto)])
3781 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3782   AC_CHECK_HEADERS(libtar.h, [
3783     VLC_ADD_LIBS([skins2],[-ltar])
3784   ])
3788 dnl  MacOS X gui module
3790 AC_ARG_ENABLE(macosx,
3791   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3792 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3793 then
3794   VLC_ADD_LIBS([macosx], [-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreServices])
3795   VLC_ADD_OBJCFLAGS([macosx], [-fobjc-exceptions] )
3796   VLC_ADD_PLUGIN([macosx])
3798   VLC_ADD_LIBS([macosx], [-Wl,-framework,QTKit -Wl,-framework,IOKit -Wl,-framework,AddressBook -Wl,-framework,WebKit -Wl,-framework,CoreAudio -Wl,-framework,SystemConfiguration -Wl,-framework,ScriptingBridge])
3800   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3801   then
3802     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3803   fi
3804   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit])
3805   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3807 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3810 dnl  MacOS X sparkle update support
3812 AC_ARG_ENABLE(sparkle,
3813   [  --enable-sparkle        Sparkle update support for OS X (default enabled on Mac OS X)])
3814 if test "x${enable_sparkle}" != "xno" -a "${HAVE_OSX}" = "1"
3815 then
3816   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3817   then
3818     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3819   fi
3820   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,Sparkle])
3821   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3822   AC_DEFINE([HAVE_SPARKLE], [1], [Define to 1 if sparkle is enabled.])
3824 AM_CONDITIONAL(HAVE_SPARKLE, [test "$enable_sparkle" != "no"])
3828 dnl  Minimal Mac OS X module
3830 AC_ARG_ENABLE(minimal-macosx,
3831   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3832 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3833 then
3834   VLC_ADD_LIBS([minimal_macosx], [-Wl,-framework,Cocoa])
3835   VLC_ADD_OBJCFLAGS([minimal_macosx], [-fobjc-exceptions] )
3836   VLC_ADD_PLUGIN([minimal_macosx])
3838 AM_CONDITIONAL(ENABLE_MINIMAL_MACOSX, [test "$enable_minimal_macosx" != "no"])
3841 dnl  MacOS X dialog provider
3843 AC_ARG_ENABLE(macosx-dialog-provider,
3844   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3845 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3846   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3847 then
3848   VLC_ADD_LIBS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
3849   VLC_ADD_PLUGIN([macosx_dialog_provider])
3851 AM_CONDITIONAL(ENABLE_MACOSX_DIALOG_PROVIDER, [test "$enable_macosx_dialog_provider" != "no"])
3854 dnl  ncurses module
3856 AC_ARG_ENABLE(ncurses,
3857 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3858 have_ncurses="no"
3859 AS_IF([test "${enable_ncurses}" != "no"] ,[
3860   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3861     have_ncurses="yes"
3862     ALIASES="${ALIASES} nvlc"
3863   ], [
3864     AS_IF([test -n "${enable_ncurses}"], [
3865       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3866     ])
3867   ])
3869 AM_CONDITIONAL([HAVE_NCURSES], [test "${have_ncurses}" = "yes"])
3872 dnl  Lirc plugin
3874 AC_ARG_ENABLE(lirc,
3875   [  --enable-lirc           lirc support (default disabled)])
3876 have_lirc="no"
3877 AS_IF([test "${enable_lirc}" = "yes"], [
3878   AC_CHECK_HEADER(lirc/lirc_client.h, [
3879     AC_CHECK_LIB(lirc_client, lirc_init, [
3880       have_lirc="true"
3881     ])
3882   ])
3884 AM_CONDITIONAL([HAVE_LIRC], [test "${have_lirc}" = "yes"])
3886 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3888 dnl  goom visualization plugin
3890 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3893 dnl libprojectM visualization plugin
3895 AC_ARG_ENABLE(projectm,
3896   [  --enable-projectm       projectM visualization plugin (default enabled)])
3897 AS_IF([test "${enable_projectm}" != "no"],
3898   [
3899     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3900     [
3901       VLC_ADD_PLUGIN([projectm])
3902       PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
3903         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3904         [ AC_MSG_WARN( [Using libprojectM version 1] )
3905       ])
3906     ],[
3907       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3908     ])
3909   ])
3912 dnl Vovoid VSXu visualization plugin
3914 AC_ARG_ENABLE(vsxu,
3915   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3916 AS_IF([test "${enable_vsxu}" != "no"],
3917   [
3918     PKG_CHECK_MODULES(VSXU, libvsxu,
3919     [
3920       VLC_ADD_PLUGIN([vsxu])
3921     ],[
3922       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3923     ])
3924   ])
3927 dnl  AtmoLight (homemade Philips Ambilight clone)
3929 AC_ARG_ENABLE(atmo,
3930 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
3931                 (default enabled)]),, [enable_atmo="yes"])
3932 AS_IF([test "${enable_atmo}" != no], [
3933   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
3934     VLC_ADD_PLUGIN([atmo])
3935   ])
3938 EXTEND_HELP_STRING([Service Discovery plugins:])
3940 dnl  Bonjour services discovery
3941 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3944 dnl  libudev services discovery
3945 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3948 dnl MTP devices services discovery
3949 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3952 dnl UPnP Plugin (Intel SDK)
3954 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
3956 EXTEND_HELP_STRING([Misc options:])
3959 dnl  libxml2 module
3961 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
3965 dnl libgcrypt
3967 AC_ARG_ENABLE(libgcrypt,
3968   [  --disable-libgcrypt     gcrypt support (default enabled)])
3969 AS_IF([test "${enable_libgcrypt}" != "no"], [
3970   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
3971     libgcrypt-config --version >/dev/null || \
3972         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
3973     AC_CHECK_LIB(gcrypt, gcry_control, [
3974       have_libgcrypt="yes"
3975       AC_DEFINE([HAVE_GCRYPT], 1, [Defined if having gcrypt])
3976       GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
3977       GCRYPT_LIBS="`libgcrypt-config --libs`"
3978     ], [
3979       AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or pass --disable-libgcrypt.])
3980     ], [`libgcrypt-config --libs`])
3981   ], [
3982     AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or pass --disable-libgcrypt.])
3983   ], [#include <gcrypt.h>]
3984   )
3987 AC_SUBST(GCRYPT_CFLAGS)
3988 AC_SUBST(GCRYPT_LIBS)
3989 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
3992 dnl TLS/SSL
3994 AC_ARG_ENABLE(gnutls,
3995   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
3996 AS_IF([test "${enable_gnutls}" != "no"], [
3997   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.2.0], [
3998     VLC_ADD_PLUGIN([gnutls])
3999   ], [
4000     AS_IF([test -n "${enable_gnutls}"], [
4001       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4002     ])
4003   ])
4008 dnl Taglib plugin
4010 AC_ARG_ENABLE(taglib,
4011   [AS_HELP_STRING([--disable-taglib],
4012     [do not use TagLib (default enabled)])])
4013 AS_IF([test "${enable_taglib}" != "no"], [
4014   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.9, [
4015     VLC_ADD_PLUGIN([taglib])
4016   ], [
4017     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4022 dnl update checking system
4024 AC_ARG_ENABLE(update-check,
4025   [  --enable-update-check   update checking system (default disabled)])
4026 if test "${enable_update_check}" = "yes"
4027 then
4028   if test "${have_libgcrypt}" != "yes"
4029   then
4030     AC_MSG_ERROR([libgcrypt is required for update checking system])
4031   fi
4032   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4033   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4034   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4038 dnl Growl notification plugin
4040 AC_ARG_ENABLE(growl,
4041   [  --enable-growl          growl notification plugin (default disabled)],,
4042   [enable_growl=no])
4043 AS_IF([test "${enable_growl}" != "no"], [
4044     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4045       VLC_ADD_PLUGIN([growl])
4046       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4047       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
4048       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
4049     ])
4050   ]
4054 dnl Libnotify notification plugin
4056 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4059 dnl  Endianness check
4061 AC_C_BIGENDIAN
4062 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4063   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4064 ], [
4065   DEFS_BIGENDIAN=""
4067 AC_SUBST(DEFS_BIGENDIAN)
4070 dnl Where to install KDE solid .desktop
4072 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4073 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4074   KDE4_CONFIG="kde4-config"
4077 AC_ARG_WITH(kde-solid,
4078   AS_HELP_STRING([--with-kde-solid=PATH],
4079                  [KDE Solid actions directory (auto)]),, [
4081 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4082   with_kde_solid="yes"
4085 soliddatadir=""
4086 AS_IF([test "${with_kde_solid}" != "no"], [
4087   AS_IF([test "${with_kde_solid}" = "yes"], [
4088     kde4datadir="`${KDE4_CONFIG} --install data`"
4089     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4090     soliddatadir="${kde4datadir}/solid/actions"
4091   ], [
4092     soliddatadir="${with_kde_solid}"
4093   ])
4095 AC_SUBST(soliddatadir)
4096 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4098 EXTEND_HELP_STRING([Components:])
4101 dnl  the VLC binary
4103 AC_ARG_ENABLE(vlc,
4104   [  --enable-vlc            build the VLC media player (default enabled)])
4105 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4107 AC_ARG_ENABLE(macosx-vlc-app,
4108   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4109 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4110     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4113 dnl  Stuff used by the program
4115 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4116 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4117 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4118 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4119 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4120 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4121 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4122 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4123 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4124 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4125 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4126 AC_SUBST(COPYRIGHT_MESSAGE)
4127 AC_SUBST(VERSION_MESSAGE)
4128 AC_SUBST(VERSION_MAJOR)
4129 AC_SUBST(VERSION_MINOR)
4130 AC_SUBST(VERSION_REVISION)
4131 AC_SUBST(VERSION_EXTRA)
4132 AC_SUBST(COPYRIGHT_YEARS)
4133 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4134 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4135 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4137 dnl  Handle substvars that use $(top_srcdir)
4139 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4142 dnl  Configuration is finished
4144 AC_SUBST(SYS)
4145 AC_SUBST(ARCH)
4146 AC_SUBST(ALIASES)
4147 AC_SUBST(ASM)
4148 AC_SUBST(MOC)
4149 AC_SUBST(RCC)
4150 AC_SUBST(UIC)
4151 AC_SUBST(WINDRES)
4152 AC_SUBST(WINE_SDK_PATH)
4153 AC_SUBST(LIBEXT)
4154 AC_SUBST(AM_CPPFLAGS)
4155 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4156 AC_SUBST(FILE_LIBVLCCORE_DLL)
4157 AC_SUBST(FILE_LIBVLC_DLL)
4159 AC_CONFIG_FILES([
4160   Makefile
4161   doc/Makefile
4162   modules/Makefile
4163   m4/Makefile
4164   po/Makefile.in
4165   share/Makefile
4166   compat/Makefile
4167   src/Makefile
4168   lib/Makefile
4169   bin/Makefile
4170   test/Makefile
4171   modules/gui/ios_dialog_provider/Makefile
4172   modules/gui/macosx/Makefile
4173   modules/gui/minimal_macosx/Makefile
4174   modules/gui/macosx_dialog_provider/Makefile
4175   modules/gui/qt4/Makefile
4176   modules/gui/skins2/Makefile
4177   modules/hw/mmal/Makefile
4180 AM_COND_IF([HAVE_WIN32], [
4181   AC_CONFIG_FILES([
4182     extras/package/win32/NSIS/spad.nsi
4183     extras/package/win32/NSIS/vlc.win32.nsi
4184     extras/package/win32/msi/config.wxi
4185   ])
4188 AM_COND_IF([HAVE_DARWIN], [
4189   AC_CONFIG_FILES([
4190     extras/package/macosx/Info.plist
4191     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4192   ])
4195 dnl Generate makefiles
4196 AC_OUTPUT
4198 dnl Do we have to use make or gmake ?
4199 if make --version 2>&1|grep -q GNU
4200 then
4201     # GNU make, all seems good
4202     MAKE=make
4203 else
4204     # Known GNU make alias (on BSD)
4205     MAKE=gmake
4207 dnl Shortcut to nice compile message
4208 if test -n $SHELL; then
4209   SHELL=${CONFIG_SHELL-/bin/sh}
4211 rm -f compile
4212 compile_top_srcdir=`sed -ne "s/^top_srcdir *= *//p" < Makefile`
4213 echo "#! $SHELL
4214 rm -f .error\$\$
4215 ERROR=0
4216 export PATH=\"$PATH\" LANG=C
4217 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| $compile_top_srcdir/extras/buildsystem/make.pl
4218 test -f .error\$\$ && ERROR=1
4219 rm -f .error\$\$
4220 exit \$ERROR" >compile
4221 chmod a+x compile
4223 echo "
4224 libvlc configuration
4225 --------------------
4226 version               : ${VERSION}
4227 system                : ${SYS}
4228 architecture          : ${ARCH}
4229 optimizations         : ${enable_optimizations}"
4230 if test "${enable_vlc}" != "no"; then
4231 echo "vlc aliases           :${ALIASES}"
4232 else
4233 echo "build vlc executable  : no"
4235 echo "
4236 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."