]> git.sesse.net Git - vlc/blob - configure.ac
6a058a06604a8daffa6743853a85f62882e3ffd0
[vlc] / configure.ac
1 dnl Autoconf settings for vlc
2
3 AC_COPYRIGHT([Copyright 2002-2013 VLC authors and VideoLAN])
4
5 AC_INIT(vlc, 2.2.0-git)
6 VERSION_MAJOR=2
7 VERSION_MINOR=2
8 VERSION_REVISION=0
9 VERSION_EXTRA=0
10 VERSION_DEV=git
11
12 PKGDIR="vlc"
13 AC_SUBST(PKGDIR)
14
15 CONFIGURE_LINE="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`"
16 CODENAME="Weatherwax"
17 COPYRIGHT_YEARS="1996-2013"
18
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
26
27 AM_INIT_AUTOMAKE(tar-ustar color-tests foreign)
28 AC_CONFIG_HEADERS([config.h])
29
30 # Disable with "./configure --disable-silent-rules" or "make V=1"
31 AM_SILENT_RULES([yes])
32
33 dnl Too many people are not aware of maintainer mode:
34 dnl If you want to use it, you definitely know what you are doing, so
35 dnl you can specify "--disable-maintainer-mode". But if you want the default
36 dnl automake behavior, you've likely never heard of maintainer mode, so we
37 dnl can't expect you to enable it manually.
38 AS_IF([test "x${enable_maintainer_mode}" != "xno"],
39     [enable_maintainer_mode="yes"])
40 AM_MAINTAINER_MODE
41
42 dnl
43 dnl Directories
44 dnl
45 dnl vlcincludedir="\${includedir}/\${PKGDIR}"
46 dnl AC_SUBST(vlcincludedir)
47 vlcdatadir="\${datadir}/\${PKGDIR}"
48 AC_SUBST(vlcdatadir)
49 vlclibdir="\${libdir}/\${PKGDIR}"
50 AC_SUBST(vlclibdir)
51
52 dnl
53 dnl Check for tools
54 dnl
55 AC_PROG_CC_C99
56 AC_USE_SYSTEM_EXTENSIONS
57 AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.])
58 AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
59 AC_DEFINE([_REENTRANT],, [Define to expose reentrant functions.])
60 AC_DEFINE([_THREAD_SAFE],, [Same as _REENTANT for some other OSes.])
61 AC_DEFINE([__LIBVLC__],, [Define within the LibVLC source code tree.])
62 AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])
63
64 AM_PROG_CC_C_O
65 AC_PROG_CXX
66 AC_PROG_CPP
67 AC_PROG_OBJC
68 _AM_DEPENDENCIES([OBJC])
69 AC_PROG_EGREP
70 AC_PROG_MAKE_SET
71 AC_PROG_INSTALL
72 AM_PROG_AS
73
74 AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
75 AC_CHECK_PROGS(DESKTOP_FILE_VALIDATE, [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
76
77 dnl Check for compiler properties
78 AC_C_CONST
79 AC_C_INLINE
80 AC_C_RESTRICT
81
82 dnl Extend the --help string at the current spot.
83 AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
84
85 dnl Allow binary package maintainer to pass a custom string to avoid
86 dnl cache problem
87 AC_ARG_WITH(binary-version,
88     AS_HELP_STRING([--with-binary-version=STRING],
89          [To avoid plugins cache problem between binary version]),[],[])
90 AS_IF([test -n "${with_binary_version}"],[
91     AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
92          [Binary specific version])
93 ])
94
95 dnl
96 dnl  Check the operating system
97 dnl
98 HAVE_WIN64="0"
99 case "${host_os}" in
100   "")
101     SYS=unknown
102     ;;
103   linux*)
104     SYS=linux
105     ;;
106   bsdi*)
107     SYS=bsdi
108     CFLAGS="${CFLAGS} -pthread"
109     ;;
110   freebsd*)
111     SYS=freebsd
112     CFLAGS="${CFLAGS} -pthread"
113     CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
114     LDFLAGS="${LDFLAGS} -L/usr/local/lib"
115     ;;
116   openbsd*)
117     SYS=openbsd
118     CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/X11R6/include"
119     LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/X11R6/lib/"
120     ;;
121   netbsd*)
122     SYS=netbsd
123     ;;
124   dragonfly*)
125     SYS=dragonfly
126     ;;
127   darwin*)
128
129     dnl Force gcc "-arch" flag
130     ARCH_flag=""
131     case "${host}" in
132       i?86*)
133         ARCH_flag="-arch i386"
134       ;;
135       ppc64*)
136         ARCH_flag="-arch ppc64"
137       ;;
138       ppc*)
139         ARCH_flag="-arch ppc"
140       ;;
141       x86_64*)
142         ARCH_flag="-arch x86_64"
143       ;;
144       arm*)
145         ac_cv_c_bigendian="no"
146         ac_cv_c_attribute_packed="no"
147       ;;
148     esac
149
150     SYS=darwin
151     CFLAGS="${CFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
152     CXXFLAGS="${CXXFLAGS} -D_INTL_REDIRECT_MACROS ${ARCH_flag}"
153     CPPFLAGS="${CPPFLAGS} ${ARCH_flag}"
154     OBJCFLAGS="${OBJCFLAGS} -D_INTL_REDIRECT_MACROS -std=gnu99 ${ARCH_flag}"
155     LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
156     VLC_ADD_LIBS([motion rotate], [-Wl,-framework,IOKit,-framework,CoreFoundation])
157     VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup,-framework,AppKit])
158     VLC_ADD_LIBS([avcodec access_avio swscale postproc i420_rgb_mmx x262 x264 x26410b],[-Wl,-read_only_relocs,suppress])
159     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,SystemConfiguration])
160
161     dnl Allow binaries created on Lion to run on earlier releases
162     AC_EGREP_CPP(yes,
163            [#import <Cocoa/Cocoa.h>
164             #ifdef MAC_OS_X_VERSION_10_7
165             yes
166             #endif],
167             [AC_MSG_RESULT([yes])
168             AC_LIBOBJ([getdelim])
169             AC_LIBOBJ([strndup])
170             AC_LIBOBJ([strnlen])],)
171
172     dnl
173     dnl  Handle Mac OS X SDK flags
174     dnl
175     AC_ARG_WITH(macosx-sdk,
176       [AS_HELP_STRING([--with-macosx-sdk=DIR],
177         [compile using the SDK in DIR])])
178     if test "${with_macosx_sdk}" != "" ; then
179         test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
180         CPP="${CPP} -isysroot ${with_macosx_sdk}"
181         CC="${CC} -isysroot ${with_macosx_sdk}"
182         CXX="${CXX} -isysroot ${with_macosx_sdk}"
183         OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
184         LD="${LD} -syslibroot ${with_macosx_sdk}"
185     fi
186     AC_ARG_WITH(macosx-version-min,
187       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
188         [compile for Mac OS X VERSION and above])])
189     if test "${with_macosx_version_min}" != "" ; then
190         MACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}
191         CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
192         CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
193         CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
194         OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
195         LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
196         CFLAGS="${CFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
197         CXXFLAGS="${CXXFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
198         OBJCFLAGS="${OBJCFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
199         export MACOSX_DEPLOYMENT_TARGET
200     fi
201     ;;
202   *mingw32* | *cygwin* | *wince* | *mingwce*)
203     AC_CHECK_TOOL(WINDRES, windres, :)
204     AC_CHECK_TOOL(OBJCOPY, objcopy, :)
205     AH_TOP([#if defined(_WIN32) && !defined(_WIN32_WINNT)])
206     AH_TOP([# define _WIN32_WINNT 0x0502 /* Windows XP SP2 */])
207     AH_TOP([#endif])
208     AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE 6.0 (and shell) APIs.])
209     AC_DEFINE([_UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
210     AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
211
212     case "${host_os}" in
213       *mingw32*)
214         SYS=mingw32
215         ;;
216       *cygwin*)
217         dnl Check if we are using the mno-cygwin mode in which case we are
218         dnl actually dealing with a mingw32 compiler.
219         AC_EGREP_CPP(yes,
220             [#ifdef _WIN32
221              yes
222              #endif],
223             SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
224         ;;
225     esac
226
227     if test "${SYS}" = "mingw32"; then
228         # DEP, ASLR, NO SEH
229         LDFLAGS="${LDFLAGS} -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase"
230
231         VLC_ADD_LIBS([libvlccore],[-lwinmm])
232         VLC_ADD_LDFLAGS([vlc],[-mwindows])
233         VLC_ADD_LIBS([win32text],[-lgdi32])
234         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
235         ac_default_prefix="`pwd`/_win32"
236         DESTDIR="`pwd`/_win32/"
237
238         dnl
239         dnl NSIS/MSI Installer prefix and WIN64
240         dnl
241         case "${host}" in
242             amd64*|x86_64*)
243                 HAVE_WIN64="1"
244                 WINDOWS_ARCH="x64"
245                 PROGRAMFILES="PROGRAMFILES64"
246             ;;
247             *)
248                 WINDOWS_ARCH="x86"
249                 PROGRAMFILES="PROGRAMFILES"
250             ;;
251         esac
252         AC_SUBST(WINDOWS_ARCH)
253         AC_SUBST(PROGRAMFILES)
254
255     fi
256     ;;
257   *nto*)
258     SYS=nto
259     ;;
260   solaris*)
261     SYS=solaris
262     ;;
263   hpux*)
264     SYS=hpux
265     ;;
266   symbian*)
267     SYS=symbian
268     ;;
269   *os2*)
270     SYS=os2
271     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild"
272     ;;
273   *)
274     SYS="${host_os}"
275     ;;
276 esac
277 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
278 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
279 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
280 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
281 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1")
282 AM_CONDITIONAL(HAVE_SYMBIAN, test "${SYS}" = "symbian")
283
284 dnl
285 dnl Sadly autoconf does not think about testing foo.exe when ask to test
286 dnl for program foo on win32
287 case "${build_os}" in
288     cygwin|msys)
289         ac_executable_extensions=".exe"
290     ;;
291     *)
292     ;;
293 esac
294
295 dnl Android is linux, but a bit different
296 AS_IF([test "$SYS" = linux],[
297     AC_MSG_CHECKING([for an Android system])
298     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
299         [[#ifndef __ANDROID__
300          # error Not Android
301          #endif
302         ]],[[;]])
303     ],[
304       HAVE_ANDROID="1"
305       AC_MSG_RESULT([yes])
306     ],[
307       AC_MSG_RESULT([no])
308     ])
309 ])
310 AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
311
312
313 dnl
314 dnl  Check for the contrib directory
315 dnl
316 AC_ARG_WITH(contrib,
317   [AS_HELP_STRING([--with-contrib[=DIR]],
318     [search for 3rd party libraries in DIR/include and DIR/lib])
319 ])
320 AC_MSG_CHECKING([for 3rd party libraries path])
321 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
322   CONTRIB_DIR="${srcdir}/contrib/${host}"
323   AS_IF([test ! -d "${CONTRIB_DIR}"], [
324     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
325     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
326     AS_IF([test ! -d "${CONTRIB_DIR}"], [
327       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
328       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
329       AS_IF([test ! -d "${CONTRIB_DIR}"], [
330         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
331         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
332         AS_IF([test ! -d "${CONTRIB_DIR}"], [
333           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
334           CONTRIB_DIR=""
335           AC_MSG_RESULT([not found])
336         ])
337       ])
338     ])
339   ])
340 ], [
341   AS_IF([test "${with_contrib}" != "no"], [
342     CONTRIB_DIR="${with_contrib}"
343   ], [
344     CONTRIB_DIR=""
345     AC_MSG_RESULT([disabled])
346   ])
347 ])
348 AS_IF([test -n "${CONTRIB_DIR}"], [
349   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
350     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
351   ], [
352     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
353     CONTRIB_DIR=""
354     AC_MSG_RESULT([not usable])
355   ])
356
357 ])
358 AS_IF([test -n "${CONTRIB_DIR}"], [
359   AC_MSG_RESULT([${CONTRIB_DIR}])
360   export PATH=${CONTRIB_DIR}/bin:$PATH
361   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
362   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
363   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
364   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
365   AS_IF([test "$build" = "$host" -o "$PKG_CONFIG_LIBDIR"], [
366     export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
367   ], [
368     export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig"
369   ])
370   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
371
372   AS_IF([test "${SYS}" = "darwin"], [
373     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
374     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
375   ])
376 ], [
377   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
378     AC_MSG_ERROR([Third party libraries not found!])
379   ])
380 ])
381 AC_SUBST(CONTRIB_DIR)
382
383 dnl
384 dnl  Libtool
385 dnl  It's very bad, but our former custom system was worst
386 dnl  -- Courmisch
387 dnl
388
389 dnl override platform specific check for dependent libraries
390 dnl otherwise libtool linking of shared libraries will
391 dnl fail on anything other than pass_all.
392 AC_CACHE_VAL(lt_cv_deplibs_check_method,
393     [lt_cv_deplibs_check_method=pass_all])
394
395 LT_INIT([dlopen win32-dll shared disable-static])
396 LT_LANG([C++])
397 LT_LANG([Windows Resource])
398
399 DOLT
400
401 lt_cv_deplibs_check_method=pass_all
402
403 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
404   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
405 ])
406
407 dnl
408 dnl Gettext stuff
409 dnl
410 AM_GNU_GETTEXT_VERSION([0.18.3])
411 AM_GNU_GETTEXT([external], [need-ngettext])
412
413 dnl
414 dnl Iconv stuff
415 dnl
416 AM_ICONV
417
418 dnl
419 dnl checks for mingw
420 AS_IF([test "${SYS}" = "mingw32"], [
421 dnl Check for broken versions of mingw-runtime compatability library
422     AC_MSG_CHECKING(for broken mingw-runtime)
423     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
424 #include <_mingw.h>
425 #if defined(__MINGW64_VERSION_MAJOR)
426 # if __MINGW64_VERSION_MAJOR < 3
427 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
428 # endif
429 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
430 # error Attempting to use mingw-runtime with broken vsnprintf support
431 #endif
432     ])], [
433         AC_MSG_RESULT([ok])
434     ], [
435         AC_MSG_RESULT([present])
436         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
437     ])
438     dnl force use of mingw provided c99 *printf over msvcrt
439     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
440
441 dnl Check for the need to include the mingwex lib for mingw32
442     VLC_SAVE_FLAGS
443     AC_CHECK_LIB(mingwex,opendir,
444         AC_CHECK_LIB(mingw32,opendir,,
445             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
446     )
447     VLC_RESTORE_FLAGS
448
449 dnl Check for fnative-struct or mms-bitfields support for mingw32
450     VLC_SAVE_FLAGS
451     CFLAGS="${CFLAGS} -mms-bitfields"
452     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
453     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
454         [ac_cv_c_mms_bitfields],
455         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
456     if test "${ac_cv_c_mms_bitfields}" = "no"; then
457         VLC_RESTORE_FLAGS
458         CFLAGS="${CFLAGS} -fnative-struct"
459         CXXFLAGS="${CXXFLAGS} -fnative-struct"
460         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
461             [ac_cv_c_fnative_struct],
462             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
463         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
464     fi
465 ])
466
467 AC_ARG_ENABLE(winstore_app,
468      AS_HELP_STRING([--enable-winstore-app],
469                     [Build targetted for Windows Store apps (default disabled)]))
470
471 vlc_winstore_app=0
472 AS_IF([test "${SYS}" = "mingw32" -a "${enable_winstore_app}" = "yes"], [
473     vlc_winstore_app=1
474     VLC_ADD_LIBS([libvlccore], [-lole32 -lruntimeobject])
475     ])
476 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
477
478
479 dnl
480 dnl Buggy glibc prevention. Purposedly not cached.
481 dnl See sourceware.org bugs 5058 and 5443.
482 dnl Ubuntu alone has 20 bug numbers for this...
483 dnl
484 AC_MSG_CHECKING(for buggy GNU/libc versions)
485 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
486 #include <limits.h>
487 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
488   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
489 # error GNU/libc with dcgettext killer bug!
490 #endif
491 ])], [
492   AC_MSG_RESULT([not present])
493 ], [
494   AC_MSG_RESULT([found])
495   AS_IF([test "x${enable_nls}" != "xno"], [
496     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
497 work-around for this. Check with your distribution vendor on how to update the
498 glibc run-time. Alternatively, build with --disable-nls.])
499   ])
500 ])
501
502 dnl Plugin compilation stuff
503
504 VLC_LIBRARY_SUFFIX
505
506 dnl Check for system libs needed
507 need_libc=false
508
509 dnl Check for usual libc functions
510 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
511 AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale])
512 AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp])
513 AC_CHECK_FUNCS(fdatasync,,
514   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
515 ])
516
517 dnl mingw64 implements those as static inline, not functions with C linkage
518 AC_LINK_IFELSE([
519     AC_LANG_PROGRAM([#include <stdio.h>], [
520         char *c;
521         if (asprintf(&c, "%s %d", "string", 1) == -1)
522             c = NULL;
523     ])],[AC_DEFINE([HAVE_ASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([asprintf])])
524 AC_LINK_IFELSE([
525     AC_LANG_PROGRAM([#include <stdio.h>
526                      #include <stdarg.h>], [
527         char *c;
528         va_list ap;
529         if (vasprintf(&c, "%s %d", ap) == -1)
530             c = NULL;
531     ])],[AC_DEFINE([HAVE_VASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([vasprintf])])
532
533 dnl C11 static_assert()
534 AC_MSG_CHECKING([for static_assert in assert.h])
535 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
536 static_assert(1, "The impossible happened.");
537 ])], [
538   AC_MSG_RESULT([yes])
539   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
540 ], [
541   AC_MSG_RESULT([no])
542 ])
543
544 # Windows CE does not have strcoll()
545 AC_FUNC_STRCOLL
546
547 dnl Check for non-standard system calls
548 case "$SYS" in
549   "linux")
550     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
551     ;;
552   "mingw32")
553     AC_CHECK_FUNCS([_lock_file])
554     ;;
555 esac
556
557 AH_BOTTOM([#include <vlc_fixups.h>])
558
559 dnl Check for struct pollfd
560 AC_CHECK_TYPES([struct pollfd],,,
561 [#include <sys/types.h>
562 #if HAVE_POLL
563 # include <poll.h>
564 #elif defined (_WIN32)
565 # include <winsock2.h>
566 #endif
567 ])
568
569 dnl Checks for socket stuff
570 VLC_SAVE_FLAGS
571 SOCKET_LIBS=""
572 AC_SEARCH_LIBS(connect, [socket], [
573   AS_IF([test "$ac_cv_search_connect" != "none required"], [
574     SOCKET_LIBS="$ac_cv_search_connect"
575   ])
576 ], [
577   AS_IF([test "${SYS}" = "mingw32"], [
578     SOCKET_LIBS="-lws2_32"
579   ])
580 ])
581
582 AC_SEARCH_LIBS([getaddrinfo], [nsl], [
583  AS_IF([test "$ac_cv_search_getaddrinfo" != "none required"], [
584     SOCKET_LIBS="$ac_cv_search_getaddrinfo $SOCKET_LIBS"
585   ])
586 ],, [${SOCKET_LIBS}])
587
588 LIBS="${LIBS} ${SOCKET_LIBS}"
589 AC_LINK_IFELSE([
590     AC_LANG_PROGRAM([#ifdef _WIN32
591         # if _WIN32_WINNT < 0x600
592         #  error Needs vista+
593         # endif
594         #include <ws2tcpip.h>
595         #else
596         #include <sys/socket.h>
597         #include <arpa/inet.h>
598         #endif], [
599         char dst[[sizeof(struct in_addr)]];
600         inet_pton(AF_INET, "127.0.0.1", dst);
601     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
602 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
603 VLC_RESTORE_FLAGS
604
605 AS_IF([test -n "$SOCKET_LIBS"], [
606   VLC_ADD_LIBS([access_rtmp access_output_udp access_output_shout sap stream_out_standard stream_out_rtp stream_out_raop vod_rtsp rtp oldrc netsync gnutls ts audioscrobbler lua remoteosd audiobargraph_a],[${SOCKET_LIBS}])
607 ])
608 AC_SUBST(SOCKET_LIBS)
609
610 dnl Check for socklen_t
611 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
612 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
613 ac_cv_type_socklen_t,
614 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
615 [#include <sys/types.h>
616 #ifdef _WIN32
617 # include <winsock2.h>
618 # include <ws2tcpip.h>
619 #else
620 # include <sys/socket.h>
621 #endif]], [[socklen_t len; len = 0;]])],
622 ac_cv_type_socklen_t=yes,
623 ac_cv_type_socklen_t=no)])
624 AS_IF([test "$ac_cv_type_socklen_t" = no],
625  [AC_DEFINE(socklen_t, int)])
626
627 dnl Check for struct sockaddr_storage
628 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
629 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
630 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
631   [AC_TRY_COMPILE(
632     [#include <sys/types.h>
633      #if defined( _WIN32 )
634      # include <winsock2.h>
635      #else
636      # include <sys/socket.h>
637      #endif], [struct sockaddr_storage addr;],
638      ac_cv_struct_sockaddr_storage=yes,
639      ac_cv_struct_sockaddr_storage=no)])
640 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
641   AC_DEFINE(sockaddr_storage, sockaddr)
642   AC_DEFINE(ss_family, sa_family)
643 ])
644
645 dnl FreeBSD has a gnugetopt library for this:
646 GNUGETOPT_LIBS=""
647 AC_CHECK_FUNC(getopt_long,, [
648   AC_CHECK_LIB([gnugetopt],[getopt_long], [
649     GNUGETOPT_LIBS="-lgnugetopt"
650   ])
651 ])
652 AC_SUBST(GNUGETOPT_LIBS)
653
654 AC_CHECK_LIB(m,cos,[
655   VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom noise grain scene lua chorus_flanger freetype swscale postproc equalizer spatializer param_eq samplerate freetype mpc qt4 compressor headphone_channel_mixer normvol audiobargraph_a audiobargraph_v mono colorthres extract ball hotkeys mosaic gaussianblur x262 x26410b hqdn3d anaglyph oldrc ncurses oldmovie glspectrum],[-lm])
656   LIBM="-lm"
657 ], [
658   LIBM=""
659 ])
660 AC_SUBST(LIBM)
661
662 AC_CHECK_LIB(m,lrintf, [
663   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
664   VLC_ADD_LIBS([skins2],[-lm])
665 ])
666
667 dnl Check for dynamic plugins
668 LIBDL=""
669 have_dynamic_objects="no"
670 VLC_SAVE_FLAGS
671 AC_SEARCH_LIBS(dlopen, [dl svld], [
672   AS_IF([test "$ac_cv_search_dlopen" != "none required"], [
673     LIBDL="$ac_cv_search_dlopen"
674   ])
675   have_dynamic_objects="yes"
676 ])
677 VLC_RESTORE_FLAGS
678
679 # Windows
680 AS_IF([test "${SYS}" = "mingw32"], [
681   LIBDL=""
682   have_dynamic_objects="yes" #assume we can use shared objects
683 ])
684
685 AS_IF([test "${enable_shared}" = "no"], [
686   have_dynamic_objects=no
687 ])
688 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
689
690 AC_SUBST(LIBDL)
691 VLC_ADD_LIBS([lua],[$LIBDL])
692
693 dnl Check for thread library
694 LIBPTHREAD=""
695 AS_IF([test "${SYS}" != "mingw32"], [
696   VLC_SAVE_FLAGS
697   LIBS=""
698   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
699     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
700       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
701     ])
702   ])
703   VLC_RESTORE_FLAGS
704
705   AC_CHECK_LIB(rt, clock_nanosleep, [
706     VLC_ADD_LIBS([libvlccore],[-lrt])
707   ], [
708     AC_CHECK_FUNC(nanosleep,,[
709       AC_CHECK_LIB(rt,nanosleep, [
710         VLC_ADD_LIBS([libvlccore],[-lrt])
711       ], [
712         AC_CHECK_LIB(posix4,nanosleep, [
713           VLC_ADD_LIBS([libvlccore],[-lposix4])
714         ])
715       ])
716     ])
717     dnl HP/UX port
718     AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlccore],[-lrt])])
719   ])
720 ])
721 AC_SUBST(LIBPTHREAD)
722
723 dnl Check for headers
724 AC_CHECK_HEADERS([search.h])
725 AC_CHECK_HEADERS(getopt.h locale.h xlocale.h)
726 AC_CHECK_HEADERS([sys/time.h sys/ioctl.h])
727 AC_CHECK_HEADERS([arpa/inet.h netinet/udplite.h sys/eventfd.h])
728 AC_CHECK_HEADERS([net/if.h], [], [],
729   [
730     #include <sys/types.h>
731     #include <sys/socket.h>
732   ])
733 AC_CHECK_HEADERS([sys/mount.h], [], [],
734   [
735     #include <sys/param.h>
736   ])
737
738 if test "${SYS}" != "mingw32"; then
739   AC_CHECK_HEADERS(machine/param.h sys/shm.h)
740   AC_CHECK_HEADERS([linux/version.h linux/dccp.h scsi/scsi.h linux/magic.h])
741   AC_CHECK_HEADERS(syslog.h mntent.h)
742 fi # end "${SYS}" != "mingw32"
743
744 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
745 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
746 AC_CHECK_TYPE(ssize_t,, [
747   AC_DEFINE(ssize_t, int)
748 ])
749
750 dnl Check for threads library
751 if test "${SYS}" != "mingw32"; then
752   AC_CHECK_HEADERS(pthread.h)
753 fi # end "${SYS}" != "mingw32"
754
755 dnl It seems that autoconf detects pkg-config only during the first
756 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
757 dnl it is nested within a conditional block, so it was not working right.
758 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
759 AC_ARG_VAR(PKG_CONFIG_PATH,
760        [Paths where to find .pc not at the default location])
761 PKG_PROG_PKG_CONFIG()
762
763 dnl On some OS we need static linking
764 AS_IF([test -n "${PKG_CONFIG}" ],[
765     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
766         PKG_CONFIG="${PKG_CONFIG} --static"
767     ])
768 ])
769
770
771 dnl
772 dnl Check for zlib.h and -lz along with system -lminizip if available
773 dnl
774 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
775 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
776 if test "${have_zlib}" = "yes"
777 then
778   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
779   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
780     AC_CHECK_HEADERS([unzip.h], [
781       have_minizip=yes
782       MINIZIP_LIBS="-lminizip -lz"
783     ], [
784       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
785       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
786       have_minizip=no
787     ])
788   ])
789   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
790   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
791 fi
792 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
793
794
795 dnl
796 dnl Domain name i18n support via GNU libidn
797 dnl
798 PKG_CHECK_MODULES([IDN], [libidn], [
799   have_libidn="yes"
800   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
801 ], [
802   have_libidn="no"
803 ])
804
805
806 dnl Check for dbus
807 AC_ARG_ENABLE(dbus,
808   [AS_HELP_STRING([--enable-dbus],
809     [compile D-Bus message bus support (default enabled)])])
810 have_dbus="no"
811 AS_IF([test "${enable_dbus}" != "no"], [
812   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
813     have_dbus="yes"
814   ], [
815     AS_IF([test -n "${enable_dbus}"], [
816       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
817     ], [
818       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
819     ])
820   ])
821 ])
822 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
823
824 dnl Check for ntohl, etc.
825 VLC_SAVE_FLAGS
826 CFLAGS="${CFLAGS} -Wall -Werror"
827 AC_CACHE_CHECK([for ntohl in sys/param.h],
828     [ac_cv_c_ntohl_sys_param_h],
829     [     AC_TRY_COMPILE([#include <sys/param.h>],
830         [int meuh; ntohl(meuh);],
831         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
832 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
833     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
834 fi
835 VLC_RESTORE_FLAGS
836
837 EXTEND_HELP_STRING([Optimization options:])
838 dnl
839 dnl  Compiler warnings
840 dnl
841
842 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])
843 RDC_PROG_CC_FLAGS([-pipe])
844 AC_LANG_PUSH([C++])
845 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
846 AC_LANG_POP([C++])
847
848 dnl
849 dnl  Debugging mode
850 dnl
851 AC_ARG_ENABLE(debug,
852   [AS_HELP_STRING([--enable-debug],
853     [build with run-time assertions (default disabled)])],,
854   [enable_debug="no"])
855 AH_TEMPLATE(NDEBUG,
856             [Define to 1 if debug code should NOT be compiled])
857 AS_IF([test "${enable_debug}" != "no"], [
858   AC_CHECK_HEADERS([valgrind/valgrind.h])
859 ], [
860   AC_DEFINE(NDEBUG)
861 ])
862
863 dnl
864 dnl  Profiling
865 dnl
866 AC_ARG_ENABLE(gprof,
867   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
868   [enable_gprof="no"])
869 AS_IF([test "${enable_gprof}" != "no"], [
870   CFLAGS="${CFLAGS} -pg"
871   CXXFLAGS="${CXXFLAGS} -pg"
872   OBJCFLAGS="${OBJCFLAGS} -pg"
873   LDFLAGS="${LDFLAGS} -pg"
874 ])
875
876 AC_ARG_ENABLE(cprof,
877   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
878   [enable_cprof="no"])
879 AS_IF([test "${enable_gprof}" != "no"], [
880   CFLAGS="${CFLAGS} -finstrument-functions"
881   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
882   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
883   LDFLAGS="${LDFLAGS} -finstrument-functions"
884 ])
885
886 dnl
887 dnl  Test coverage
888 dnl
889 AC_ARG_ENABLE(coverage,
890   [AS_HELP_STRING([--enable-coverage],
891     [build for test coverage (default disabled)])],,
892   [enable_coverage="no"])
893 AS_IF([test "${enable_coverage}" != "no"], [
894   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
895   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
896   LDFLAGS="-lgcov ${LDFLAGS}"
897 ])
898
899 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
900   VLC_SAVE_FLAGS
901   CFLAGS="${CFLAGS} -fvisibility=hidden"
902   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
903   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
904   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
905                  [ac_cv_c_visibility_hidden], [
906     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
907       ac_cv_c_visibility_hidden=yes
908     ], [
909       ac_cv_c_visibility_hidden=no
910     ])
911   ])
912   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
913 ])
914
915
916 dnl
917 dnl  Enable/disable optimizations
918 dnl
919 AC_ARG_ENABLE(optimizations,
920   [AS_HELP_STRING([--disable-optimizations],
921     [disable compiler optimizations (default enabled)])],,
922   [enable_optimizations="yes"])
923
924 dnl Check for various optimization flags
925 AS_IF([test "${enable_optimizations}" != "no"], [
926
927   dnl -O4 and -O3 only in production builds
928   AS_IF([test "{enable_debug}" = "no"], [
929     VLC_SAVE_FLAGS
930     CFLAGS="${CFLAGS} -O4"
931     CXXFLAGS="${CXXFLAGS} -O4"
932     OBJCFLAGS="${OBJCFLAGS} -O4"
933     AC_CACHE_CHECK([if $CC accepts -O4], [ac_cv_c_o4], [
934       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
935         ac_cv_c_o4=yes
936       ], [
937         ac_cv_c_o4=no
938       ])
939     ])
940     AS_IF([test "${ac_cv_c_o4}" = "no"], [
941       VLC_RESTORE_FLAGS
942       CFLAGS="${CFLAGS} -O3"
943       CXXFLAGS="${CXXFLAGS} -O3"
944       OBJCFLAGS="${OBJCFLAGS} -O3"
945       AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
946         AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
947           ac_cv_c_o3=yes
948         ], [
949           ac_cv_c_o3=no
950         ])
951       ])
952       AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
953     ])
954   ])
955
956   dnl Check for -ffast-math
957   VLC_SAVE_FLAGS
958   CFLAGS="${CFLAGS} -ffast-math"
959   CXXFLAGS="${CXXFLAGS} -ffast-math"
960   OBJCFLAGS="${OBJCFLAGS} -ffast-math"
961   AC_CACHE_CHECK([if $CC accepts -ffast-math], [ac_cv_c_fast_math], [
962     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
963       ac_cv_c_fast_math=yes
964     ], [
965       ac_cv_c_fast_math=no
966     ])
967   ])
968   AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
969   AH_BOTTOM([
970 #ifndef __FAST_MATH__
971 # pragma STDC FENV_ACCESS OFF
972 # pragma STDC FP_CONTRACT ON
973 #endif
974 ])
975
976   dnl Check for -funroll-loops
977   VLC_SAVE_FLAGS
978   CFLAGS="${CFLAGS} -funroll-loops"
979   CXXFLAGS="${CXXFLAGS} -funroll-loops"
980   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
981   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
982     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
983       ac_cv_c_unroll_loops=yes
984     ], [
985       ac_cv_c_unroll_loops=no
986     ])
987   ])
988   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
989
990   AS_IF([test "$enable_debug" = "no"], [
991     dnl Check for -fomit-frame-pointer
992     VLC_SAVE_FLAGS
993     CFLAGS="${CFLAGS} -fomit-frame-pointer"
994     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
995     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
996     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
997       [ac_cv_c_omit_frame_pointer], [
998       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
999         ac_cv_c_omit_frame_pointer=yes
1000       ], [
1001         ac_cv_c_omit_frame_pointer=no
1002       ])
1003     ])
1004     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1005   ])
1006 ])
1007
1008 VLC_SAVE_FLAGS
1009 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1010 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1011   AC_TRY_LINK([],, [
1012     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1013   ], [
1014     ac_cv_ld_bsymbolic=""
1015   ])
1016 ])
1017 VLC_RESTORE_FLAGS
1018 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1019 AC_SUBST(SYMBOLIC_LDFLAGS)
1020
1021 dnl Check for Darwin plugin linking flags
1022 AS_IF([test "${SYS}" = "darwin"], [
1023   VLC_SAVE_FLAGS
1024   CFLAGS="${CFLAGS} -bundle -undefined error"
1025   AC_CACHE_CHECK([if $CC accepts -bundle -undefined error],
1026     [ac_cv_ld_darwin], [
1027     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1028       ac_cv_ld_darwin=yes
1029     ], [
1030       ac_cv_ld_darwin=no
1031     ])
1032   ])
1033   AS_IF([test "${ac_cv_ld_darwin}" != "no"], [
1034     VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
1035   ])
1036   VLC_RESTORE_FLAGS
1037 ])
1038
1039 dnl Checks for __attribute__(aligned()) directive
1040 VLC_SAVE_FLAGS
1041 CFLAGS="${CFLAGS} -Werror"
1042 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1043     [ac_cv_c_attribute_aligned],
1044     [ac_cv_c_attribute_aligned=0
1045     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1046         AC_TRY_COMPILE([],
1047         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1048         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1049     done])
1050 VLC_RESTORE_FLAGS
1051 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1052     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1053         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1054 fi
1055
1056 dnl Check for __attribute__((packed))
1057 AC_CACHE_CHECK([for __attribute__((packed))],
1058   [ac_cv_c_attribute_packed],
1059   [ac_cv_c_attribute_packed=no
1060    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1061                     [ac_cv_c_attribute_packed=yes])])
1062 if test "${ac_cv_c_attribute_packed}" != "no"; then
1063   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1064 fi
1065
1066 dnl
1067 dnl  Check the CPU
1068 dnl
1069 case "${host_cpu}" in
1070   "")
1071     ARCH=unknown
1072     ;;
1073   *)
1074     ARCH="${host_cpu}"
1075     ;;
1076 esac
1077
1078 dnl Check for backtrace() support
1079 AC_CHECK_HEADERS(execinfo.h)
1080 AC_CHECK_FUNCS(backtrace)
1081
1082 dnl
1083 dnl  default modules
1084 dnl
1085 ALIASES="${ALIASES} cvlc rvlc"
1086
1087 dnl
1088 dnl  Accelerated modules
1089 dnl
1090
1091 dnl  Check for fully working MMX intrinsics
1092 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1093 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1094 AC_ARG_ENABLE(mmx,
1095   [AS_HELP_STRING([--disable-mmx],
1096     [disable MMX optimizations (default auto)])],,[
1097   case "${host_cpu}" in
1098     i?86|x86_64)
1099       enable_mmx="yes"
1100       ;;
1101     *)
1102       enable_mmx="no"
1103       ;;
1104   esac
1105 ])
1106 have_mmx="no"
1107 have_mmxext="no"
1108 AS_IF([test "${enable_mmx}" != "no"], [
1109   ARCH="${ARCH} mmx"
1110   VLC_SAVE_FLAGS
1111   CFLAGS="${CFLAGS} -mmmx"
1112   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1113     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1114 [#include <mmintrin.h>
1115 #include <stdint.h>
1116 uint64_t frobzor;]], [
1117 [__m64 a, b, c;
1118 a = b = c = (__m64)frobzor;
1119 a = _mm_slli_pi16(a, 3);
1120 a = _mm_adds_pi16(a, b);
1121 c = _mm_srli_pi16(c, 8);
1122 c = _mm_slli_pi16(c, 3);
1123 b = _mm_adds_pi16(b, c);
1124 a = _mm_unpacklo_pi8(a, b);
1125 frobzor = (uint64_t)a;]])], [
1126       ac_cv_c_mmx_intrinsics=yes
1127     ], [
1128       ac_cv_c_mmx_intrinsics=no
1129     ])
1130   ])
1131   VLC_RESTORE_FLAGS
1132   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1133     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1134   ])
1135
1136   VLC_SAVE_FLAGS
1137   CFLAGS="${CFLAGS} -mmmx"
1138   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1139     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1140 void *p;
1141 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1142 ]])
1143     ], [
1144       ac_cv_mmx_inline=yes
1145     ], [
1146       ac_cv_mmx_inline=no
1147     ])
1148   ])
1149   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1150     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1151     have_mmx="yes"
1152   ])
1153
1154   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1155                  [ac_cv_mmxext_inline], [
1156     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1157 void *p;
1158 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1159 ]])
1160     ], [
1161       ac_cv_mmxext_inline=yes
1162     ], [
1163       ac_cv_mmxext_inline=no
1164     ])
1165   ])
1166   VLC_RESTORE_FLAGS
1167   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1168     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1169     have_mmxext="yes"
1170   ])
1171 ])
1172 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1173 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1174
1175 dnl  Check for fully workin SSE2 intrinsics
1176 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1177 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1178 AC_ARG_ENABLE(sse,
1179   [AS_HELP_STRING([--disable-sse],
1180     [disable SSE (1-4) optimizations (default auto)])],, [
1181   case "${host_cpu}" in
1182     i?86|x86_64)
1183       enable_sse=yes
1184       ;;
1185     *)
1186       enable_sse=no
1187       ;;
1188   esac
1189 ])
1190 have_sse2="no"
1191 AS_IF([test "${enable_sse}" != "no"], [
1192   ARCH="${ARCH} sse sse2"
1193
1194   VLC_SAVE_FLAGS
1195   CFLAGS="${CFLAGS} -msse2"
1196   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1197     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1198 [#include <emmintrin.h>
1199 #include <stdint.h>
1200 uint64_t frobzor;]], [
1201 [__m128i a, b, c;
1202 a = b = c = _mm_set1_epi64((__m64)frobzor);
1203 a = _mm_slli_epi16(a, 3);
1204 a = _mm_adds_epi16(a, b);
1205 c = _mm_srli_epi16(c, 8);
1206 c = _mm_slli_epi16(c, 3);
1207 b = _mm_adds_epi16(b, c);
1208 a = _mm_unpacklo_epi8(a, b);
1209 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1210       ac_cv_c_sse2_intrinsics=yes
1211     ], [
1212       ac_cv_c_sse2_intrinsics=no
1213     ])
1214   ])
1215   VLC_RESTORE_FLAGS
1216   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1217     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1218   ])
1219
1220   VLC_SAVE_FLAGS
1221   CFLAGS="${CFLAGS} -msse"
1222   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1223     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1224 void *p;
1225 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1226 ]])
1227     ], [
1228       ac_cv_sse_inline=yes
1229     ], [
1230       ac_cv_sse_inline=no
1231     ])
1232   ])
1233
1234   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1235     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1236   ])
1237
1238   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1239     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1240 void *p;
1241 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1242 ]])
1243     ], [
1244       ac_cv_sse2_inline=yes
1245     ], [
1246       ac_cv_sse2_inline=no
1247     ])
1248   ])
1249   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1250     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1251     have_sse2="yes"
1252   ])
1253
1254   # SSE3
1255   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1256     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1257 void *p;
1258 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1259 ]])
1260     ], [
1261       ac_cv_sse3_inline=yes
1262     ], [
1263       ac_cv_sse3_inline=no
1264     ])
1265   ])
1266
1267   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1268     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1269   # SSSE3
1270   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1271     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1272 void *p;
1273 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1274 ]])
1275     ], [
1276       ac_cv_ssse3_inline=yes
1277     ], [
1278       ac_cv_ssse3_inline=no
1279     ])
1280   ])
1281
1282   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1283     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1284
1285   # SSE4.1
1286   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1287                  [ac_cv_sse4_1_inline], [
1288     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1289 void *p;
1290 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1291 ]])
1292     ], [
1293       ac_cv_sse4_1_inline=yes
1294     ], [
1295       ac_cv_sse4_1_inline=no
1296     ])
1297   ])
1298
1299   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1300     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1301
1302   # SSE4.2
1303   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1304                  [ac_cv_sse4_2_inline], [
1305     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1306 void *p;
1307 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1308 ]])
1309     ], [
1310       ac_cv_sse4_2_inline=yes
1311     ], [
1312       ac_cv_sse4_2_inline=no
1313     ])
1314   ])
1315
1316   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1317     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1318
1319   # SSE4A
1320   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1321     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1322 void *p;
1323 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1324 ]])
1325     ], [
1326       ac_cv_sse4a_inline=yes
1327     ], [
1328       ac_cv_sse4a_inline=no
1329     ])
1330   ])
1331   VLC_RESTORE_FLAGS
1332   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1333     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1334 ])
1335 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1336
1337 VLC_SAVE_FLAGS
1338 CFLAGS="${CFLAGS} -mmmx"
1339 have_3dnow="no"
1340 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1341   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1342 void *p;
1343 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1344 ]])
1345   ], [
1346     ac_cv_3dnow_inline=yes
1347   ], [
1348     ac_cv_3dnow_inline=no
1349   ])
1350 ])
1351 VLC_RESTORE_FLAGS
1352 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1353   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1354             [Define to 1 if 3D Now! inline assembly is available.])
1355   have_3dnow="yes"
1356 ])
1357 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1358
1359
1360 AC_ARG_ENABLE(neon,
1361   [AS_HELP_STRING([--disable-neon],
1362     [disable NEON optimizations (default auto)])],, [
1363   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1364 ])
1365 AS_IF([test "${enable_neon}" != "no"], [
1366   VLC_SAVE_FLAGS
1367   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1368   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1369     AC_COMPILE_IFELSE([
1370       AC_LANG_PROGRAM(,[[
1371 asm volatile("vqmovun.s64 d0, q1":::"d0");
1372 ]])
1373     ], [
1374       ac_cv_arm_neon="yes"
1375     ], [
1376       ac_cv_arm_neon="no"
1377     ])
1378   ])
1379   VLC_RESTORE_FLAGS
1380 ])
1381 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1382
1383
1384 AC_ARG_ENABLE(altivec,
1385   [AS_HELP_STRING([--disable-altivec],
1386     [disable AltiVec optimizations (default auto)])],, [
1387   AS_CASE("${host_cpu}", [powerpc*],
1388         [enable_altivec=yes], [enable_altivec=no])
1389 ])
1390 have_altivec="no"
1391 ALTIVEC_CFLAGS=""
1392 AS_IF([test "${enable_altivec}" = "yes"], [
1393   ARCH="${ARCH} altivec";
1394   VLC_SAVE_FLAGS
1395   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1396     [ac_cv_altivec_inline],
1397     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1398          ac_cv_altivec_inline="yes",
1399          [CFLAGS="${CFLAGS} -Wa,-m7400"
1400           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1401             [ac_cv_altivec_inline="-Wa,-m7400"],
1402             ac_cv_altivec_inline=no)
1403          ])])
1404   VLC_RESTORE_FLAGS
1405   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1406     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1407               [Define to 1 if AltiVec inline assembly is available.])
1408     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1409       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1410       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1411     ])
1412     have_altivec="yes"
1413   ])
1414
1415 dnl The AltiVec C extensions
1416 dnl
1417 dnl There are several possible cases:
1418 dnl - OS X PPC, gcc 4.x: use -mpim-altivec -force_cpusubtype_ALL, don't
1419 dnl                      need <altivec.h>
1420 dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
1421 dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
1422 dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
1423 dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
1424 dnl - Others: test should fail
1425   VLC_SAVE_FLAGS
1426   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1427   [ac_cv_c_altivec],
1428   [# OS X/PPC test (gcc 4.x)
1429    CFLAGS="${CFLAGS} -mpim-altivec -force_cpusubtype_ALL"
1430    AC_TRY_COMPILE([vector unsigned char foo;],
1431      [vec_ld(0, (unsigned char *)0);],
1432      [ac_cv_c_altivec="-mpim-altivec -force_cpusubtype_ALL"],
1433      [# OS X/PPC test (gcc 3.x)
1434       CFLAGS="${CFLAGS} -faltivec"
1435       AC_TRY_COMPILE([vector unsigned char foo;],
1436         [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
1437         [ac_cv_c_altivec="-faltivec"],
1438         dnl Below this are the Linux tests
1439         [# Linux/PPC test (gcc 4.x)
1440          CFLAGS="${CFLAGS} -maltivec"
1441          AC_TRY_COMPILE([#include <altivec.h>],
1442            [vec_ld(0, (unsigned char *)0);],
1443            [ac_cv_c_altivec="-maltivec"],
1444            [# Linux/PPC test (gcc 3.3)
1445             CFLAGS="${CFLAGS} -maltivec -mabi=altivec"
1446             AC_TRY_COMPILE([#include <altivec.h>],
1447               [vec_ld(0, (unsigned char *)0);],
1448               [ac_cv_c_altivec=""
1449                ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
1450               [# Linux/PPC test (gcc 3.3)
1451                CFLAGS="${CFLAGS} -fvec"
1452                AC_TRY_COMPILE([#include <altivec.h>],
1453                  [vec_ld(0, (unsigned char *)0);],
1454                  [ac_cv_c_altivec="-fvec"],
1455                  [ac_cv_c_altivec=no])
1456               ])
1457            ])
1458         ])
1459      ])
1460   ])
1461
1462   VLC_RESTORE_FLAGS
1463   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1464     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1465     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1466     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1467     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1468     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1469     have_altivec="yes"
1470   ])
1471   AC_CHECK_HEADERS(altivec.h)
1472
1473   VLC_SAVE_FLAGS
1474   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1475   AC_CACHE_CHECK([if linker needs -framework vecLib],
1476     [ac_cv_ld_altivec],
1477     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1478   VLC_RESTORE_FLAGS
1479   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1480     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1481   ])
1482 ])
1483 AC_SUBST(ALTIVEC_CFLAGS)
1484 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1485
1486 dnl
1487 dnl  Memory usage
1488 dnl
1489 AC_ARG_ENABLE(optimize-memory,
1490   [AS_HELP_STRING([--enable-optimize-memory],
1491     [optimize memory usage over performance])])
1492 if test "${enable_optimize_memory}" = "yes"; then
1493   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1494 fi
1495
1496 dnl
1497 dnl Allow running as root (useful for people running on embedded platforms)
1498 dnl
1499 AC_ARG_ENABLE(run-as-root,
1500   [AS_HELP_STRING([--enable-run-as-root],
1501     [allow running VLC as root (default disabled)])])
1502 AS_IF([test "${enable_run_as_root}" = "yes"],[
1503     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1504               [Define to 1 to allow running VLC as root (uid 0).])
1505 ])
1506
1507 dnl
1508 dnl Stream output
1509 dnl
1510 AC_ARG_ENABLE(sout,
1511   [AS_HELP_STRING([--disable-sout],
1512     [disable streaming output (default enabled)])])
1513 AS_IF([test "${enable_sout}" != "no"], [
1514   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1515 ])
1516 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1517
1518 dnl Lua modules
1519 AC_ARG_ENABLE(lua,
1520   [AS_HELP_STRING([--disable-lua],
1521     [disable LUA scripting support (default enabled)])])
1522 if test "${enable_lua}" != "no"
1523 then
1524   PKG_CHECK_MODULES(LUA, lua5.2,
1525     [ have_lua=yes ],
1526     [
1527     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1528
1529     PKG_CHECK_MODULES(LUA, lua5.1,
1530       [ have_lua=yes ],
1531       [
1532       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1533       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1534         [ have_lua=yes ],
1535         [
1536           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1537           have_lua=yes
1538           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1539             [],
1540             [ have_lua=no ] )
1541           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1542             [LUA_LIBS="-llua5.2"],
1543           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1544             [LUA_LIBS="-llua5.1"],
1545             AC_CHECK_LIB( lua51 , luaL_newstate,
1546               [LUA_LIBS="-llua51"],
1547               AC_CHECK_LIB( lua , luaL_newstate,
1548                 [LUA_LIBS="-llua"],
1549                 [ have_lua=no
1550                 ], [-lm])
1551             )))
1552         ])
1553       ])
1554     ])
1555   if test "x${have_lua}" = "xyes" ;  then
1556      VLC_ADD_LIBS([lua],[$LUA_LIBS])
1557      VLC_ADD_CFLAGS([lua],[$LUA_CFLAGS])
1558   else
1559       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.])
1560   fi
1561   AC_ARG_VAR([LUAC], [LUA byte compiler])
1562   AC_PATH_PROGS(LUAC,[${LUAC} luac], [false])
1563   AS_IF([test "${LUAC}" = "false"], [
1564     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1565   ])
1566   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|cut -d' ' -f2` != 0404], [
1567     AC_MSG_ERROR([You need 32-bits luac when using using lua from contrib.])
1568   ])
1569 fi
1570 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1571
1572
1573 dnl
1574 dnl HTTP daemon
1575 dnl
1576 AC_ARG_ENABLE(httpd,
1577   [AS_HELP_STRING([--disable-httpd],
1578     [disable the built-in HTTP server (default enabled)])])
1579 if test "${enable_httpd}" != "no"
1580 then
1581   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1582 fi
1583 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1584
1585
1586 dnl
1587 dnl VideoLAN manager
1588 dnl
1589 AC_ARG_ENABLE(vlm,
1590   [AS_HELP_STRING([--disable-vlm],
1591     [disable the stream manager (default enabled)])],,
1592   [enable_vlm="${enable_sout}"])
1593 AS_IF([test "${enable_vlm}" != "no"], [
1594   AS_IF([test "${enable_sout}" = "no"], [
1595     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1596   ])
1597   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1598 ])
1599 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1600
1601
1602 dnl
1603 dnl  Input plugins
1604 dnl
1605
1606 EXTEND_HELP_STRING([Input plugins:])
1607
1608 dnl
1609 dnl  live555 input
1610 dnl
1611 AC_ARG_ENABLE(live555,
1612   [AS_HELP_STRING([--enable-live555],
1613     [enable RTSP input through live555 (default enabled)])])
1614
1615 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1616   PKG_CHECK_MODULES(LIVE555, live555, [
1617     VLC_ADD_PLUGIN([live555])
1618     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1619     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1620   ], [
1621     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1622
1623     AC_LANG_PUSH(C++)
1624     VLC_SAVE_FLAGS
1625
1626     dnl detect include paths
1627     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1628       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1629     ], [
1630       AS_IF([test "${SYS}" != "os2"], [
1631         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1632         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1633       ], [
1634         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1635         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1636         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1637       ])
1638     ])
1639
1640     dnl CPP Flags
1641     AS_IF([test "${SYS}" = "solaris"], [
1642       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1643     ])
1644     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1645     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1646
1647     dnl version check
1648     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1649       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1650 [#include <liveMedia_version.hh>
1651 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1652 # error BOOM
1653 #endif]])
1654       ], [
1655         ac_cv_live555="yes"
1656       ], [
1657         ac_cv_live555="no"
1658       ])
1659     ])
1660
1661     AS_IF([test "$ac_cv_live555" = "no"], [
1662       AC_MSG_WARN([live555 is missing or its installed version is too old:
1663 Version 2011.12.23 or later is required to proceed.
1664 You can get an updated one from http://www.live555.com/liveMedia .])
1665       AS_IF([test -n "${enable_live555}"], [
1666         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1667       ])
1668     ], [
1669       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1670       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1671       AS_IF([test "${SYS}" = "mingw32"], [
1672         # add ws2_32 for closesocket, select, recv
1673         other_libs="$other_libs -lws2_32"
1674       ])
1675
1676       dnl We need to check for pic because live555 don't provide shared libs
1677       dnl and we want to build a plugins so we need -fPIC on some arch.
1678       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1679       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1680       AC_CHECK_LIB(liveMedia_pic, main, [
1681         VLC_ADD_PLUGIN([live555])
1682         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1683       ],[
1684         AC_CHECK_LIB(liveMedia, main, [
1685           VLC_ADD_PLUGIN([live555])
1686           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1687         ],[],[${other_libs}])
1688       ],[${other_libs_pic}])
1689     ])
1690     VLC_RESTORE_FLAGS
1691     AC_LANG_POP(C++)
1692   ])
1693 ])
1694
1695 dnl
1696 dnl IIDC and DV FireWire input modules
1697 dnl
1698 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1699 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1700
1701 dnl
1702 dnl - linsys modules: access module check for libzvbi
1703 dnl
1704 AC_ARG_ENABLE(linsys,
1705   [AS_HELP_STRING([--enable-linsys],
1706     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1707 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1708   VLC_ADD_PLUGIN([linsys_hdsdi])
1709   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1710     VLC_ADD_PLUGIN([linsys_sdi])
1711   ], [
1712     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1713   ])
1714 ])
1715
1716 dnl
1717 dnl dvdread module: check for libdvdread
1718 dnl
1719 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread], [dvdread input module], [auto])
1720
1721 dnl
1722 dnl libdvdnav plugin
1723 dnl
1724 AC_ARG_ENABLE(dvdnav,
1725   [AS_HELP_STRING([--disable-dvdnav],
1726     [disable DVD navigation with libdvdnav (default auto)])])
1727 AS_IF([test "${enable_dvdnav}" != "no"], [
1728   PKG_CHECK_MODULES(DVDNAV, dvdnav, [
1729     VLC_ADD_PLUGIN([dvdnav])
1730     AC_CHECK_LIB(dvdnav, dvdnav_get_video_resolution,
1731       AC_DEFINE(HAVE_DVDNAV_GET_VIDEO_RESOLUTION, 1, [Define if you have dvdnav_get_video_resolution.]),
1732         [], [${LIBS_dvdnav}])
1733     AC_CHECK_LIB(dvdnav, dvdnav_describe_title_chapters,
1734       AC_DEFINE(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS, 1, [Define if you have dvdnav_describe_title_chapters.]),
1735         [], [${LIBS_dvdnav}])],
1736       [AC_MSG_WARN([${DVDNAV_PKG_ERRORS}.])])
1737 ])
1738
1739 dnl
1740 dnl  Blu-ray Disc Support with libbluray
1741 dnl
1742 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2.1], (libbluray for Blu-ray disc support ) )
1743
1744 dnl
1745 dnl  OpenCV wrapper and example filters
1746 dnl
1747 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1748
1749
1750 dnl
1751 dnl  libsmbclient plugin
1752 dnl
1753 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1754 AS_IF([test "${SYS}" = "mingw32"], [ VLC_ADD_PLUGIN([access_smb]) ])
1755
1756
1757 dnl
1758 dnl sftp access support
1759 dnl
1760 PKG_ENABLE_MODULES_VLC([SFTP], [access_sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1761
1762 dnl
1763 dnl  Video4Linux 2
1764 dnl
1765 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1766   [disable Video4Linux version 2 (default auto)])])
1767 have_v4l2="no"
1768 AS_IF([test "$enable_v4l2" != "no"], [
1769   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1770     have_v4l2="yes"
1771   ])
1772 ])
1773 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1774
1775 dnl
1776 dnl special access module for Blackmagic SDI cards
1777 dnl
1778 AC_ARG_ENABLE(decklink,
1779   [AS_HELP_STRING([--disable-decklink],
1780     [disable Blackmagic DeckLink SDI input (default auto)])])
1781 AC_ARG_WITH(decklink_sdk,
1782   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1783     [                        location of Blackmagic DeckLink SDI SDK])])
1784 have_decklink=no
1785 if test "${enable_decklink}" != "no"
1786 then
1787   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1788   then
1789     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1790   fi
1791   VLC_SAVE_FLAGS
1792   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1793   AC_LANG_PUSH(C++)
1794   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1795       have_decklink=yes
1796   ], [
1797       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1798   ])
1799   AC_LANG_POP(C++)
1800   VLC_RESTORE_FLAGS
1801 fi
1802 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1803
1804
1805 dnl
1806 dnl  gnomeVFS access module
1807 dnl
1808 PKG_ENABLE_MODULES_VLC([GNOMEVFS], [gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
1809
1810 dnl
1811 dnl  VCDX modules
1812 dnl
1813 PKG_ENABLE_MODULES_VLC([VCDX], [vcdx], [libcdio >= 0.78.2 libiso9660 >= 0.72 libvcdinfo >= 0.7.22], [navigate VCD with libvcdinfo], [no])
1814
1815 dnl
1816 dnl  Built-in CD-DA and VCD module
1817 dnl
1818 AC_ARG_ENABLE(vcd,
1819   [AS_HELP_STRING([--disable-vcd],
1820     [disable built-in VCD and CD-DA support (default enabled)])])
1821
1822 AC_ARG_ENABLE(libcddb,
1823   [AS_HELP_STRING([--disable-libcddb],
1824     [disable CDDB for Audio CD (default enabled)])])
1825
1826 if test "${enable_vcd}" != "no"
1827 then
1828   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1829   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1830     AC_MSG_RESULT(yes)
1831     VLC_ADD_PLUGIN([vcd cdda])
1832   ],[
1833     AC_MSG_RESULT(no)
1834   ])
1835
1836   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1837   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1838     AC_MSG_RESULT(yes)
1839     VLC_ADD_PLUGIN([vcd cdda])
1840     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1841   ],[
1842     AC_MSG_RESULT(no)
1843   ])
1844
1845   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1846   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1847     AC_MSG_RESULT(yes)
1848     VLC_ADD_PLUGIN([vcd cdda])
1849     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1850   ],[
1851     AC_MSG_RESULT(no)
1852   ])
1853
1854   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2"
1855   then
1856     VLC_ADD_PLUGIN([vcd cdda])
1857   fi
1858
1859   if test "${SYS}" = "darwin"
1860   then
1861     VLC_ADD_PLUGIN([vcd cdda])
1862     VLC_ADD_LIBS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
1863   fi
1864
1865   if test "$enable_libcddb" != "no"; then
1866     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1867       HAVE_LIBCDDB=yes
1868       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1869       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1870       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1871       ],:
1872       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1873       HAVE_LIBCDDB=no])
1874   fi
1875 fi
1876
1877 dnl
1878 dnl Linux DVB
1879 dnl
1880 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1881   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1882 [#include <linux/dvb/version.h>
1883 #if (DVB_API_VERSION < 5)
1884 # error Linux DVB API v3.2 and older are not supported.
1885 #endif
1886 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1887 # error Linux DVB API v5.0 is unsupported. Please update.
1888 #endif
1889 ]])], [
1890   ac_cv_linux_dvb_5_1=yes
1891 ], [
1892   ac_cv_linux_dvb_5_1=no
1893 ])])
1894 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1895
1896 dnl
1897 dnl  Screen capture module
1898 dnl
1899 AC_ARG_ENABLE(screen,
1900   [AS_HELP_STRING([--enable-screen],
1901     [disable screen capture (default enabled)])])
1902 if test "${enable_screen}" != "no"; then
1903   if test "${SYS}" = "darwin"; then
1904     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1905       VLC_ADD_PLUGIN([screen])
1906     ])
1907   fi
1908 fi
1909 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1910
1911 dnl
1912 dnl  VNC/RFB access module
1913 dnl
1914 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1915
1916 dnl  RDP/Remote Desktop access module
1917 dnl
1918 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1919
1920 dnl
1921 dnl  Real RTSP plugin
1922 dnl
1923 AC_ARG_ENABLE(realrtsp,
1924   [  --enable-realrtsp       Real RTSP module (default disabled)])
1925 if test "${enable_realrtsp}" = "yes"; then
1926   VLC_ADD_PLUGIN([access_realrtsp])
1927 fi
1928
1929 dnl
1930 dnl MacOS eyeTV
1931 AC_ARG_ENABLE(macosx-eyetv,
1932   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1933 if test "x${enable_macosx_eyetv}" != "xno" &&
1934   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1935 then
1936   VLC_ADD_PLUGIN([access_eyetv])
1937 fi
1938
1939 dnl
1940 dnl QTKit
1941 AC_ARG_ENABLE(macosx-qtkit,
1942   [  --enable-macosx-qtkit Mac OS X qtcapture (video) and qtsound (audio) module (default enabled on Mac OS X)])
1943 if test "x${enable_macosx_qtkit}" != "xno" &&
1944   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1945 then
1946   VLC_ADD_PLUGIN([qtcapture])
1947   VLC_ADD_PLUGIN([qtsound])
1948 fi
1949 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1950
1951 dnl
1952 dnl AVFoundation
1953 AC_SUBST(have_avfoundation, ["no"])
1954 AC_ARG_ENABLE(macosx-avfoundation,
1955   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
1956 if test "x${enable_macosx_avfoundation}" != "xno" &&
1957   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
1958 then
1959   SAVED_LIBS="${LIBS}"
1960   LIBS="-framework AVFoundation"
1961   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
1962   LIBS="${SAVED_LIBS}"
1963   if test "${have_avfoundation}" != "no"
1964   then
1965     VLC_ADD_PLUGIN([avcapture])
1966   fi
1967 fi
1968 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
1969
1970 dnl
1971 dnl  Demux plugins
1972 dnl
1973
1974 EXTEND_HELP_STRING([Mux/Demux plugins:])
1975
1976 dnl
1977 dnl  libdvbpsi check for ts mux/demux
1978 dnl
1979 have_dvbpsi="no"
1980 PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
1981 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1982
1983
1984 dnl
1985 dnl  GME demux plugin
1986 dnl
1987 AC_ARG_ENABLE(gme,
1988   [AS_HELP_STRING([--enable-gme],
1989     [use Game Music Emu (default auto)])])
1990 AS_IF([test "${enable_gme}" != "no"], [
1991   AC_CHECK_HEADER([gme/gme.h], [
1992     VLC_ADD_LIBS([gme], [-lgme])
1993     VLC_ADD_PLUGIN([gme])
1994   ], [
1995     AS_IF([test "x${enable_gme}" != "x"], [
1996       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
1997     ])
1998   ])
1999 ])
2000
2001
2002 dnl
2003 dnl  SIDPlay plugin
2004 dnl
2005 AC_ARG_ENABLE(sid,
2006     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2007 AS_IF([test "${enable_sid}" != "no"], [
2008     PKG_CHECK_MODULES(SID, [libsidplay2], [
2009         AC_LANG_PUSH(C++)
2010         oldCPPFLAGS="$CPPFLAGS"
2011         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2012         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2013             VLC_ADD_PLUGIN([sid])
2014             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2015             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2016         ], [
2017             AS_IF([test -n "${enable_sid}"],
2018                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2019                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2020                 )
2021         ])
2022         CPPFLAGS="$oldCPPFLAGS"
2023         AC_LANG_POP(C++)
2024     ], [
2025         AS_IF([test "x${enable_sid}" = "xyes"],
2026             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2027             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2028             )
2029     ])
2030 ])
2031
2032
2033 dnl
2034 dnl  ogg demux plugin
2035 dnl
2036 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
2037 if test "${enable_sout}" != "no"; then
2038     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg mux support], [auto])
2039 dnl Check for libshout
2040     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2041 fi
2042
2043 dnl
2044 dnl  matroska demux plugin
2045 dnl
2046 AC_ARG_ENABLE(mkv,
2047   [AS_HELP_STRING([--disable-mkv],
2048     [do not use libmatroska (default auto)])])
2049 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2050   AC_LANG_PUSH(C++)
2051   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2052     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2053     AC_EGREP_CPP(yes,
2054       [#include <ebml/EbmlVersion.h>
2055        #ifdef LIBEBML_VERSION
2056        #if LIBEBML_VERSION >= 0x010000
2057        yes
2058        #endif
2059        #endif],
2060       [AC_MSG_RESULT([yes])
2061         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2062           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2063           AC_EGREP_CPP(yes,
2064             [#include <matroska/KaxVersion.h>
2065              #ifdef LIBMATROSKA_VERSION
2066              #if LIBMATROSKA_VERSION >= 0x010000
2067              yes
2068              #endif
2069              #endif],
2070             [AC_MSG_RESULT([yes])
2071               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2072               AC_CHECK_LIB(ebml_pic, main, [
2073                 VLC_ADD_PLUGIN([mkv])
2074                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2075               ],[
2076                 AC_CHECK_LIB(ebml, main, [
2077                   VLC_ADD_PLUGIN([mkv])
2078                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2079                 ])
2080               ])
2081             ], [
2082               AC_MSG_RESULT([no])
2083               AC_MSG_ERROR([Your libmatroska is too old: you may get a more recent one from http://dl.matroska.org/downloads/libmatroska/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2084           ])
2085         ])
2086       ],
2087       [AC_MSG_RESULT([no])
2088         AC_MSG_ERROR([Your libebml is too old: you may get a more recent one from http://dl.matroska.org/downloads/libebml/. Alternatively you can use --disable-mkv to disable the matroska plugin.])
2089     ])
2090   ])
2091   AC_LANG_POP(C++)
2092 fi
2093
2094 dnl
2095 dnl  modplug demux plugin
2096 dnl
2097 AC_ARG_ENABLE(mod,
2098   [AS_HELP_STRING([--disable-mod],
2099     [do not use libmodplug (default auto)])])
2100 if test "${enable_mod}" != "no" ; then
2101     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2102           VLC_ADD_PLUGIN([mod])
2103           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2104           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2105     ],[
2106        AS_IF([test -n "${enable_mod}"],
2107          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2108          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2109     ])
2110 fi
2111
2112 dnl
2113 dnl  mpc demux plugin
2114 dnl
2115 AC_ARG_ENABLE(mpc,
2116   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2117 if test "${enable_mpc}" != "no"
2118 then
2119   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2120     VLC_ADD_PLUGIN([mpc])
2121     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2122     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2123     VLC_ADD_PLUGIN([mpc])
2124     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2125 fi
2126
2127 dnl
2128 dnl  Codec plugins
2129 dnl
2130
2131 EXTEND_HELP_STRING([Codec plugins:])
2132
2133 dnl
2134 dnl wmafixed plugin
2135 dnl
2136 AC_ARG_ENABLE(wma-fixed,
2137   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2138 if test "${enable_wma_fixed}" = "yes"
2139 then
2140   VLC_ADD_PLUGIN([wma_fixed])
2141 fi
2142
2143 dnl
2144 dnl shine fixed point mp3 encoder
2145 dnl
2146 AC_ARG_ENABLE(shine,
2147   [  --enable-shine          shine mp3 encoding module (default disabled)])
2148 if test "${enable_shine}" = "yes"
2149 then
2150   VLC_ADD_PLUGIN([shine])
2151 fi
2152
2153 dnl
2154 dnl openmax il codec plugin
2155 dnl
2156 AC_ARG_ENABLE(omxil,
2157   [  --enable-omxil          openmax il codec module (default disabled)])
2158 if test "${enable_omxil}" = "yes"
2159 then
2160   VLC_ADD_PLUGIN([omxil])
2161 fi
2162
2163 dnl
2164 dnl openmax il vout plugin
2165 dnl
2166 AC_ARG_ENABLE(omxil-vout,
2167   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2168 if test "${enable_omxil_vout}" = "yes"
2169 then
2170   VLC_ADD_PLUGIN([omxil_vout])
2171 fi
2172
2173 dnl
2174 dnl raspberry pi openmax il configuration
2175 dnl
2176 AC_ARG_ENABLE(rpi-omxil,
2177   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2178 if test "${enable_rpi_omxil}" = "yes"
2179 then
2180   VLC_ADD_PLUGIN([omxil omxil_vout])
2181   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2182 fi
2183
2184 dnl
2185 dnl CrystalHD codec plugin
2186 dnl
2187 AC_ARG_ENABLE(crystalhd,
2188   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2189 if test "${enable_crystalhd}" != "no"; then
2190     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2191       VLC_ADD_PLUGIN([crystalhd])
2192       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2193     ],[
2194       if test "${SYS}" = "mingw32" ; then
2195         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2196           VLC_ADD_PLUGIN([crystalhd])
2197           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2198             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2199             ])
2200         ],[
2201           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2202                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2203                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2204         ],[#define __LINUX_USER__
2205                #include <libcrystalhd/bc_dts_types.h>
2206         ])
2207       fi
2208     ],[
2209        #include <libcrystalhd/bc_dts_types.h>
2210       ])
2211 fi
2212
2213 dnl
2214 dnl  mad plugin
2215 dnl
2216 AC_ARG_ENABLE(mad,
2217   [  --enable-mad            libmad module (default enabled)])
2218 if test "${enable_mad}" != "no"
2219 then
2220   AC_ARG_WITH(mad,
2221     [  --with-mad=PATH         path to libmad],[],[])
2222   if test "${with_mad}" != "no" -a -n "${with_mad}"
2223   then
2224     VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
2225     VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib])
2226   fi
2227
2228   AC_ARG_WITH(mad-tree,
2229     [  --with-mad-tree=PATH    mad tree for static linking],[],[])
2230   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
2231   then
2232     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
2233     if test -z "${real_mad_tree}"
2234     then
2235       dnl  The given directory can't be found
2236       AC_MSG_RESULT(no)
2237       AC_MSG_ERROR([${with_mad_tree} directory does not exist])
2238     fi
2239     dnl  Use a custom libmad
2240     AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
2241     if test -f ${real_mad_tree}/mad.h
2242     then
2243       AC_MSG_RESULT(yes)
2244       VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
2245       VLC_ADD_LIBS([mpgatofixed32],[-L${real_mad_tree}/.libs])
2246       VLC_SAVE_FLAGS
2247       LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2248       AC_CHECK_LIB(mad, mad_bit_init, [
2249         VLC_ADD_PLUGIN([mpgatofixed32])
2250         VLC_ADD_LIBS([mpgatofixed32],[-lmad])
2251         ],[ AC_MSG_ERROR([the specified tree has not been compiled ])
2252       ],[])
2253       VLC_RESTORE_FLAGS
2254     else
2255       AC_MSG_RESULT(no)
2256       AC_MSG_ERROR([the specified tree does not have mad.h])
2257     fi
2258   else
2259     VLC_SAVE_FLAGS
2260     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_mpgatofixed32}"
2261     LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2262     AC_CHECK_HEADERS(mad.h, ,
2263       [ AC_MSG_ERROR([Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.]) ])
2264     AC_CHECK_LIB(mad, mad_bit_init, [
2265       VLC_ADD_PLUGIN([mpgatofixed32])
2266       VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
2267       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
2268     VLC_RESTORE_FLAGS
2269   fi
2270 fi
2271
2272
2273 AC_ARG_ENABLE(merge-ffmpeg,
2274 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2275   enable_merge_ffmpeg="no"
2276 ])
2277 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2278
2279 dnl
2280 dnl  avcodec decoder/encoder plugin
2281 dnl
2282 AC_ARG_ENABLE(avcodec,
2283 [  --enable-avcodec        libavcodec codec (default enabled)])
2284 AS_IF([test "${enable_avcodec}" != "no"], [
2285   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
2286     dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
2287     dnl   AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
2288     dnl ])
2289     VLC_SAVE_FLAGS
2290     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2291     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2292     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2293     AC_CHECK_HEADERS(libavutil/avutil.h)
2294     VLC_RESTORE_FLAGS
2295     have_avcodec="yes"
2296   ],[
2297     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2298   ])
2299 ], [
2300   have_avcodec="no"
2301 ])
2302 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2303
2304 dnl
2305 dnl libva needs avcodec
2306 dnl
2307 AC_ARG_ENABLE(libva,
2308   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2309
2310 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2311   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2312 ])
2313 have_avcodec_vaapi="no"
2314 AS_IF([test "${enable_libva}" != "no" -a "${have_avcodec}" = "yes"], [
2315   PKG_CHECK_MODULES(LIBVA, [libva libva-x11], [
2316     VLC_SAVE_FLAGS
2317     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2318     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2319     AC_CHECK_HEADERS(libavcodec/vaapi.h, [
2320       AC_MSG_NOTICE([VAAPI acceleration activated])
2321       have_avcodec_vaapi="yes"
2322     ],[
2323       AS_IF([test -n "${enable_libva}"], [
2324         AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2325       ], [
2326         AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2327       ])
2328     ])
2329     VLC_RESTORE_FLAGS
2330   ],[
2331     AS_IF([test -n "${enable_libva}"], [
2332       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2333     ], [
2334       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2335     ])
2336   ])
2337 ])
2338 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2339
2340 dnl
2341 dnl dxva2 needs avcodec
2342 dnl
2343 AC_ARG_ENABLE(dxva2,
2344   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2345
2346 have_avcodec_dxva2="no"
2347 AS_IF([test "${enable_dxva2}" != "no"], [
2348   if test "${SYS}" = "mingw32"; then
2349   AS_IF([test "x${have_avcodec}" = "xyes"], [
2350     AC_CHECK_HEADERS(dxva2api.h,
2351       [
2352         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2353            AC_MSG_NOTICE([DxVA2 acceleration activated])
2354            have_avcodec_dxva2="yes"
2355         ],[
2356     AS_IF([test "${enable_dxva2}" = "yes"],
2357           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2358               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2359         ], [#undef _WIN32_WINNT
2360             /* DXVA2 is only available in Vista and above */
2361             #define _WIN32_WINNT 0x600])
2362       ],[
2363     AS_IF([test "${enable_dxva2}" = "yes"],
2364               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2365               [AC_MSG_WARN([dxva2api.h not found])])
2366       ])
2367   ],[
2368     AS_IF([test "x${enable_dxva2}" != "x"], [
2369       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2370     ])
2371   ])
2372   fi
2373 ])
2374 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2375
2376 dnl
2377 dnl vda needs avcodec
2378 dnl
2379 AC_ARG_ENABLE(vda,
2380   [  --enable-vda          VDA  support (default auto)])
2381
2382 have_avcodec_vda="no"
2383 AS_IF([test "${enable_vda}" != "no"], [
2384   if test "${SYS}" = "darwin"; then
2385   AS_IF([test "x${have_avcodec}" = "xyes"], [
2386     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2387     [
2388       PKG_CHECK_EXISTS([libavcodec >= 55.19.0], [
2389         have_avcodec_vda="yes"
2390       ],[
2391         AS_IF([test "${enable_vda}" = "yes"],
2392          [AC_MSG_ERROR([libavcodec >= 55.19.0 is required for VDA decoding])],
2393          [AC_MSG_WARN([libavcodec >= 55.19.0 is required for VDA decoding])])
2394       ])
2395     ],[
2396         AS_IF([test "${enable_vda}" = "yes"],
2397       [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2398       [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2399     ])
2400   ],[
2401     AS_IF([test "x${enable_vda}" != "x"], [
2402       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2403     ])
2404   ])
2405   fi
2406 ])
2407 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2408
2409 dnl
2410 dnl  avformat demuxer/muxer plugin
2411 dnl
2412
2413 AC_ARG_ENABLE(avformat,
2414 [  --enable-avformat       libavformat containers (default enabled)],, [
2415   enable_avformat="${have_avcodec}"
2416 ])
2417 have_avformat="no"
2418 AS_IF([test "${enable_avformat}" != "no"], [
2419   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2420       have_avformat="yes"
2421       VLC_SAVE_FLAGS
2422       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2423       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2424       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2425       AC_CHECK_HEADERS(libavutil/avutil.h)
2426       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2427         have_avformat="no"
2428       ])
2429       VLC_RESTORE_FLAGS
2430     ],[
2431       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2432   ])
2433 ])
2434 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2435
2436 dnl
2437 dnl  swscale image scaling and conversion plugin
2438 dnl
2439
2440 AC_ARG_ENABLE(swscale,
2441   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2442           (default enabled)]))
2443 if test "${enable_swscale}" != "no"
2444 then
2445   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2446     [
2447       VLC_SAVE_FLAGS
2448       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2449       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2450       AC_CHECK_HEADERS(libswscale/swscale.h)
2451       VLC_ADD_PLUGIN([swscale])
2452       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2453       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2454       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2455         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2456       ])
2457       VLC_RESTORE_FLAGS
2458     ],[
2459       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2460   ])
2461 fi
2462
2463 dnl
2464 dnl  postproc plugin
2465 dnl
2466
2467 AC_ARG_ENABLE(postproc,
2468 [  --enable-postproc       libpostproc image post-processing (default auto)])
2469 if test "${enable_postproc}" != "no"
2470 then
2471   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2472     [
2473       VLC_SAVE_FLAGS
2474       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2475       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2476       AC_CHECK_HEADERS(postproc/postprocess.h)
2477       VLC_ADD_PLUGIN([postproc])
2478       VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS])
2479       VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS])
2480       VLC_RESTORE_FLAGS
2481     ],[
2482       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2483   ])
2484 fi
2485
2486 dnl
2487 dnl  faad decoder plugin
2488 dnl
2489 AC_ARG_ENABLE(faad,
2490 [  --enable-faad           faad codec (default auto)])
2491 if test "${enable_faad}" != "no"; then
2492   AC_ARG_WITH(faad-tree,  [  --with-faad-tree=PATH   faad tree for static linking])
2493   if test -n "${with_faad_tree}"; then
2494     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
2495     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
2496     if test -z "${real_faad_tree}"; then
2497       dnl  The given directory can't be found
2498       AC_MSG_RESULT(no)
2499       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
2500     fi
2501     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"; then
2502       dnl  Use the custom faad
2503       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
2504       VLC_ADD_PLUGIN([faad])
2505       VLC_ADD_LIBS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
2506       VLC_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
2507     else
2508       dnl  The given libfaad wasn't built
2509       AC_MSG_RESULT(no)
2510       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
2511     fi
2512   else
2513     VLC_SAVE_FLAGS
2514     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_faad}"
2515     LDFLAGS="${LDFLAGS} ${LIBS_faad}"
2516     AC_CHECK_HEADERS(faad.h,
2517       [ AC_CHECK_LIB(faad, faacDecOpen, [
2518           VLC_ADD_PLUGIN([faad])
2519           VLC_ADD_LIBS([faad],[-lfaad]) ], [
2520             AC_CHECK_LIB(faad, NeAACDecOpen, [
2521               VLC_ADD_PLUGIN([faad])
2522               VLC_ADD_LIBS([faad],[-lfaad]) ], [
2523                 AS_IF([test "${enable_faad}" = "yes"],
2524                 [ AC_MSG_ERROR([Cannot find libfaad library...]) ],
2525                 [ AC_MSG_WARN([Cannot find libfaad library...]) ]) ]) ])
2526       ] , [ AS_IF([test "${enable_faad}" = "yes"],
2527         [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ],
2528         [ AC_MSG_WARN([Cannot find development headers for libfaad...]) ]) ])
2529     VLC_RESTORE_FLAGS
2530   fi
2531 fi
2532
2533 dnl
2534 dnl twolame encoder plugin
2535 dnl
2536 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2537
2538 dnl
2539 dnl fdk-aac encoder plugin
2540 dnl
2541 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2542
2543 dnl
2544 dnl  QuickTime plugin
2545 dnl
2546 AC_ARG_ENABLE(quicktime,
2547   [  --enable-quicktime      QuickTime module (deprecated)])
2548 if test "${enable_quicktime}" = "yes"; then
2549   if test "${SYS}" = "mingw32"; then
2550     VLC_ADD_PLUGIN([quicktime])
2551   else
2552   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2553     [ VLC_ADD_PLUGIN([quicktime])
2554       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2555     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2556   fi
2557 fi
2558
2559 dnl
2560 dnl A52/AC3 decoder plugin
2561 dnl
2562 AC_ARG_ENABLE(a52,
2563   [  --enable-a52            A/52 support with liba52 (default enabled)])
2564 if test "${enable_a52}" != "no"
2565 then
2566   AC_ARG_WITH(a52,
2567     [  --with-a52=PATH         a52 headers and libraries])
2568   AC_ARG_WITH(a52-tree,
2569     [  --with-a52-tree=PATH    a52dec tree for static linking ],[],[])
2570   if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
2571   then
2572     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
2573     if test -z "${real_a52_tree}"
2574     then
2575       dnl  The given directory can't be found
2576       AC_MSG_RESULT(no)
2577       AC_MSG_ERROR([${with_a52_tree} directory does not exist])
2578     fi
2579     dnl  Use a custom a52dec
2580     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
2581     if test -f ${real_a52_tree}/include/a52.h
2582     then
2583       AC_MSG_RESULT(yes)
2584       VLC_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
2585       VLC_ADD_LIBS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
2586       VLC_SAVE_FLAGS
2587       LDFLAGS="${LDFLAGS} ${LIBS_a52tofloat32}"
2588       AC_CHECK_LIB(a52, a52_free, [
2589         VLC_ADD_PLUGIN([a52tofloat32])
2590         VLC_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
2591         VLC_ADD_LIBS([a52tofloat32],[-la52])
2592         ],[
2593         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
2594         then
2595           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3 ($real_a52_tree)])
2596         else
2597           AC_MSG_ERROR([the specified tree has not been compiled])
2598         fi
2599       ])
2600     else
2601       AC_MSG_RESULT(no)
2602       AC_MSG_ERROR([the specified tree does not have a52.h])
2603     fi
2604   else
2605     if test -z "${with_a52}"
2606     then
2607       LDFLAGS_test=""
2608       CPPFLAGS_test=""
2609     else
2610       LDFLAGS_test="-L${with_a52}/lib"
2611       CPPFLAGS_test="-I${with_a52}/include"
2612     fi
2613     VLC_SAVE_FLAGS
2614     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2615     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2616     AC_CHECK_HEADERS(a52dec/a52.h, [
2617       AC_CHECK_LIB(a52, a52_free, [
2618         VLC_ADD_PLUGIN([a52tofloat32])
2619         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2620         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2621       ],[
2622         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.])
2623         ], [$LIBM])
2624     ],[
2625       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.])
2626     ])
2627     VLC_RESTORE_FLAGS
2628   fi
2629 fi
2630
2631 dnl
2632 dnl DTS Coherent Acoustics decoder plugin
2633 dnl
2634 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2635
2636 dnl
2637 dnl  Flac plugin
2638 dnl
2639 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2640
2641 dnl
2642 dnl  Libmpeg2 plugin
2643 dnl
2644 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2645
2646 dnl
2647 dnl  Vorbis plugin
2648 dnl
2649 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2650
2651 dnl
2652 dnl  Tremor plugin
2653 dnl
2654 AC_ARG_ENABLE(tremor,
2655   [  --enable-tremor         Tremor decoder support (default disabled)])
2656 if test "${enable_tremor}" = "yes"
2657 then
2658   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2659     VLC_ADD_PLUGIN([tremor])
2660    ],[])
2661 fi
2662
2663 dnl
2664 dnl  Speex plugins
2665 dnl
2666 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2667 have_speexdsp="no"
2668 AS_IF([test "${enable_speex}" != "no"], [
2669   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2670     have_speexdsp="yes"
2671   ], [
2672     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2673   ])
2674 ])
2675 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2676
2677 dnl
2678 dnl  Opus plugin
2679 dnl
2680 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus], [Opus support], [auto])
2681
2682 dnl
2683 dnl  theora decoder plugin
2684 dnl
2685 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2686
2687 dnl
2688 dnl  dirac encoder plugin
2689 dnl
2690 PKG_ENABLE_MODULES_VLC([DIRAC], [], [dirac >= 0.10.0], [dirac encoder], [auto])
2691
2692 dnl
2693 dnl  schroedinger decoder plugin (for dirac format video)
2694 dnl
2695 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2696
2697 dnl
2698 dnl  PNG decoder module
2699 dnl
2700 AC_ARG_ENABLE(png,
2701   [  --enable-png            PNG support (default enabled)])
2702 AS_IF([test "${enable_png}" != "no"], [
2703 AC_CHECK_HEADERS(png.h, [
2704   VLC_SAVE_FLAGS
2705   LDFLAGS="${LDFLAGS} -lz $LIBM"
2706   AC_CHECK_LIB(png, png_set_rows, [
2707     VLC_ADD_PLUGIN([png])
2708   ], [], [-lz $LIBM])
2709   VLC_RESTORE_FLAGS
2710   ])
2711 ])
2712
2713 dnl
2714 dnl H262 encoder plugin (lib262)
2715 dnl
2716 AC_ARG_ENABLE(x262,
2717   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2718 if test "${enable_x262}" != "no"; then
2719 AC_ARG_WITH(x262-tree,
2720   [ --with-x262-tree=PATH      H262 encoding module with libx262 (static linking)],[],[])
2721   if test "${with_x262_tree}" != "no" -a -n "${with_x262_tree}"
2722   then
2723     real_x262_tree="̧`cd ${with_x262_tree} 2>/dev/null && pwd`"
2724     if test -z "${real_x262_tree}"
2725     then
2726       AC_MSG_RESULT(no)
2727       AC_MSG_ERROR([${with_x262_tree} directory does not exist])
2728     fi
2729     AC_MSG_CHECKING(for x262.h in ${real_x262_tree})
2730     if test -f ${with_x262_tree}/x262_config.h
2731     then
2732       VLC_ADD_PLUGIN([x262])
2733       VLC_ADD_CFLAGS([x262],[-I${with_x262_tree}])
2734       VLC_ADD_LIBS([x262],[-L${with_x262_tree} -lm -lpthread -lx262])
2735     else
2736       AC_MSG_RESULT(no)
2737       AC_MSG_ERROR([${with_x262_tree} doesnt have x262_config.h])
2738     fi
2739   else
2740     PKG_CHECK_MODULES(X262, x262, [
2741         VLC_ADD_PLUGIN([x262])
2742         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2743         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2744           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2745         ])
2746         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2747         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2748           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2749         fi
2750     ], [
2751        if test "${enable_x262}" = "yes"; then
2752         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2753        fi
2754     ])
2755   fi
2756 fi
2757
2758 dnl x265 encoder
2759 AC_ARG_ENABLE(x265,
2760   AS_HELP_STRING([--enable-x265],[H265 / HEVC encoding support with libx265 (default enabled)]))
2761 AS_IF( [test "${enable_x265}" != "no"],[
2762   AC_CHECK_HEADER([x265.h], [
2763       AC_CHECK_LIB([x265],[x265_encoder_open], [
2764         VLC_ADD_PLUGIN([x265])
2765         VLC_ADD_LIBS([x265], [-lx265 -lstdc++ -lm -lpthread])
2766       ], [
2767         AC_MSG_ERROR([x265 library not found])
2768       ], [-lstdc++ -lm -lpthread])
2769   ], [
2770     AS_IF([test "${enable_x265}" = "yes"], [
2771         AC_MSG_ERROR([x265.h not found])
2772     ])
2773   ])
2774 ])
2775
2776
2777 dnl
2778 dnl H264 encoder plugin (10-bit lib264)
2779 dnl
2780 AC_ARG_ENABLE(x26410b,
2781   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2782 if test "${enable_x26410b}" != "no"; then
2783 AC_ARG_WITH(x26410b-tree,
2784   [ --with-x26410b-tree=PATH      H264 10-bit encoding module with libx264 (static linking)],[],[])
2785   if test "${with_x26410b_tree}" != "no" -a -n "${with_x26410b_tree}"
2786   then
2787     real_x26410b_tree="̧`cd ${with_x26410b_tree} 2>/dev/null && pwd`"
2788     if test -z "${real_x26410b_tree}"
2789     then
2790       AC_MSG_RESULT(no)
2791       AC_MSG_ERROR([${with_x26410b_tree} directory does not exist])
2792     fi
2793     AC_MSG_CHECKING(for x264.h in ${real_x26410b_tree})
2794     if test -f ${with_x26410b_tree}/x264_config.h
2795     then
2796       AC_MSG_RESULT(yes)
2797       AC_MSG_CHECKING(for 10-bit build of x264)
2798       if grep -q "BIT_DEPTH.*10"  ${with_x26410b_tree}/x264_config.h ;then
2799         AC_MSG_RESULT(yes)
2800         VLC_ADD_PLUGIN([x26410b])
2801         VLC_ADD_CFLAGS([x26410b],[-I${with_x26410b_tree}])
2802         VLC_ADD_LIBS([x26410b],[-L${with_x26410b_tree} -lm -lpthread -lx264])
2803       else
2804         AC_MSG_RESULT(no)
2805         AC_MSG_ERROR([${with_x26410b_tree} isnt build 10-bit])
2806       fi
2807     else
2808       AC_MSG_RESULT(no)
2809       AC_MSG_ERROR([${with_x26410b_tree} doesnt have x264_config.h])
2810     fi
2811   else
2812     PKG_CHECK_MODULES(X26410B, x26410b, [
2813         VLC_ADD_PLUGIN([x26410b])
2814         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2815         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2816           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2817         ])
2818         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2819         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2820           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2821         fi
2822     ], [
2823        if test "${enable_x26410b}" = "yes"; then
2824         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2825        fi
2826     ])
2827   fi
2828 fi
2829
2830
2831 dnl
2832 dnl H264 encoder plugin (using libx264)
2833 dnl
2834 AC_ARG_ENABLE(x264,
2835   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2836 if test "${enable_x264}" != "no"; then
2837   AC_ARG_WITH(x264-tree,
2838     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
2839   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
2840   then
2841     real_x264_tree="`cd ${with_x264_tree} 2>/dev/null && pwd`"
2842     if test -z "${real_x264_tree}"
2843     then
2844       dnl  The given directory can't be found
2845       AC_MSG_RESULT(no)
2846       AC_MSG_ERROR([${with_x264_tree} directory does not exist])
2847     fi
2848     dnl  Use a custom libx264
2849     AC_MSG_CHECKING(for x264.h in ${real_x264_tree})
2850     if test -f ${real_x264_tree}/x264.h
2851     then
2852       AC_MSG_RESULT(yes)
2853       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
2854       VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
2855       PKG_CHECK_MODULES(X264,x264, [
2856         VLC_ADD_PLUGIN([x264])
2857         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2858         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2859         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2860           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2861         fi
2862       ],[
2863         AC_MSG_ERROR([the specified tree has not been compiled])
2864       ])
2865     else
2866       AC_MSG_RESULT(no)
2867       AC_MSG_ERROR([the specified tree does not have x264.h])
2868     fi
2869   else
2870       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2871         VLC_ADD_PLUGIN([x264])
2872         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2873
2874         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2875           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2876         ])
2877
2878         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2879         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2880           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2881         fi
2882       ],[
2883         if test "${enable_x264}" = "yes"; then
2884             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2885           fi
2886       ])
2887   fi
2888 fi
2889
2890 dnl
2891 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2892 dnl
2893 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2894
2895 dnl
2896 dnl libfluidsynth (MIDI synthetizer) plugin
2897 dnl
2898 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2899
2900 dnl
2901 dnl Teletext Modules
2902 dnl vbi decoder plugin (using libzbvi)
2903 dnl telx module
2904 dnl uncompatible
2905 dnl
2906 AC_ARG_ENABLE(zvbi,
2907   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2908                   libzvbi (default enabled)]))
2909 AC_ARG_ENABLE(telx,
2910   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2911                   zvbi) (default enabled if zvbi is absent)]))
2912
2913 AS_IF( [test "${enable_zvbi}" != "no"],[
2914     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2915         [
2916           VLC_ADD_PLUGIN([zvbi])
2917           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2918           AS_IF( [test "${enable_telx}" = "yes"],[
2919                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2920                   ])
2921         ],[
2922           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2923         ])
2924     ])
2925 AS_IF( [test "${enable_telx}" != "no" ],[
2926   VLC_ADD_PLUGIN([telx])
2927   ])
2928
2929 dnl
2930 dnl libass subtitle rendering module
2931 dnl
2932 AC_ARG_ENABLE(libass,
2933   [  --enable-libass         Subtitle support using libass (default enabled)])
2934 AS_IF( [test "${enable_libass}" != "no"], [
2935   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2936       [
2937         VLC_ADD_PLUGIN([libass])
2938
2939         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2940           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2941            VLC_ADD_LIBS([libass],[-lfontconfig])
2942        ])
2943       ],[
2944         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2945       ])
2946   ])
2947
2948 dnl
2949 dnl  kate decoder plugin
2950 dnl
2951 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2952
2953 dnl
2954 dnl  tiger rendering for kate decoder plugin
2955 dnl
2956 AC_ARG_ENABLE(tiger,
2957 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2958 AS_IF([test "${enable_tiger}" != "no"], [
2959   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2960       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2961         AS_IF([test -n "${enable_tiger}"], [
2962           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2963         ])
2964   ])
2965 ])
2966
2967
2968 dnl
2969 dnl  Video plugins
2970 dnl
2971
2972 EXTEND_HELP_STRING([Video plugins:])
2973
2974 dnl
2975 dnl  OpenGL
2976 dnl
2977 PKG_CHECK_MODULES([GL], [gl], [
2978   have_gl="yes"
2979 ], [
2980   AC_CHECK_HEADER([GL/gl.h], [
2981     have_gl="yes"
2982     GL_CFLAGS=""
2983     AS_IF([test "${SYS}" = "mingw32"], [
2984       GL_LIBS="-lopengl32"
2985     ], [
2986       GL_LIBS="-lGL"
2987     ])
2988   ], [
2989     have_gl="no"
2990   ])
2991 ])
2992 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
2993
2994 dnl OpenGL ES 2: depends on EGL 1.1
2995 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
2996 dnl OpenGL ES 1: depends on EGL 1.0
2997 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
2998
2999 AC_ARG_ENABLE(egl,
3000   [  --enable-egl            OpenGL support through EGL (default disabled)],, [
3001   enable_egl="no"
3002 ])
3003 AS_IF([test "$enable_egl" != "no"], [
3004   PKG_CHECK_MODULES([EGL], [egl], [
3005     VLC_ADD_PLUGIN([egl])
3006   ])
3007 ])
3008
3009 dnl
3010 dnl  Xlib
3011 dnl
3012
3013 AC_PATH_XTRA()
3014 AC_CHECK_HEADERS(X11/Xlib.h)
3015
3016 dnl
3017 dnl  X C Bindings modules
3018 dnl
3019 AC_ARG_ENABLE(xcb,
3020   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3021   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [
3022     enable_xcb="yes"
3023   ], [
3024     enable_xcb="no"
3025   ])
3026 ])
3027 AC_ARG_ENABLE(xvideo,
3028   [  --enable-xvideo         XVideo support (default enabled)],, [
3029     enable_xvideo="$enable_xcb"
3030 ])
3031 AC_ARG_ENABLE(glx,
3032   [  --enable-glx            OpenGL support through GLX (default enabled)],, [
3033   enable_glx="$enable_xcb"
3034 ])
3035
3036 have_xcb="no"
3037 have_xcb_keysyms="no"
3038 have_xcb_randr="no"
3039 have_xcb_xvideo="no"
3040 AS_IF([test "${enable_xcb}" != "no"], [
3041   dnl libxcb
3042   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3043   have_xcb="yes"
3044   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3045   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3046   PKG_CHECK_MODULES(XPROTO, [xproto])
3047
3048   AS_IF([test "${enable_xvideo}" != "no"], [
3049     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3050   ])
3051
3052   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3053
3054   dnl xcb-utils
3055   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3056     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3057   ])
3058 ])
3059 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3060 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3061 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3062 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3063
3064
3065 dnl
3066 dnl VDPAU needs X11
3067 dnl
3068 AC_ARG_ENABLE(vdpau,
3069   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3070 have_vdpau="no"
3071 AS_IF([test "${enable_vdpau}" != "no"], [
3072   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3073     have_vdpau="yes"
3074     AS_IF([test "${no_x}" = "yes"], [
3075       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3076     ])
3077   ], [
3078     AS_IF([test -n "${enable_vdpau}"], [
3079       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3080     ])
3081   ])
3082 ])
3083 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3084
3085 have_avcodec_vdpau="no"
3086 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3087   PKG_CHECK_EXISTS([libavutil >= 0.52.4 libavcodec >= 54.36.0], [
3088     have_avcodec_vdpau="yes"
3089     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3090   ], [
3091     AS_IF([test -n "${enable_vdpau}"], [
3092       AC_MSG_ERROR([libavutil >= 0.52.4 and libavcodec >= 54.36.0 are required for VDPAU decoding.])
3093     ], [
3094       AC_MSG_WARN([libavutil >= 0.52.4 and libavcodec >= 54.36.0 are required for VDPAU decoding.])
3095     ])
3096   ])
3097 ])
3098 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3099
3100
3101 dnl
3102 dnl  SDL module
3103 dnl
3104 AC_ARG_ENABLE(sdl,
3105   [  --enable-sdl            SDL support (default enabled)])
3106 AC_ARG_ENABLE(sdl-image,
3107   [  --enable-sdl-image      SDL image support (default enabled)])
3108 if test "${enable_sdl}" != "no"
3109 then
3110    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3111       # SDL on Darwin is heavily patched and can only run SDL_image
3112       if test "${SYS}" != "darwin"; then
3113         VLC_ADD_PLUGIN([vout_sdl])
3114       fi
3115       if test "${SYS}" != "mingw32" -a "${SYS}" != "os2"; then
3116         VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3117       fi
3118       VLC_ADD_CFLAGS([vout_sdl],[${SDL_CFLAGS}])
3119       VLC_ADD_LIBS([vout_sdl],[${SDL_LIBS}])
3120
3121       # SDL_image
3122       AS_IF([ test "${enable_sdl_image}" != "no"],[
3123         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3124           VLC_ADD_PLUGIN([sdl_image])],
3125           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3126           ])
3127       ])
3128    ],[
3129      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3130    ])
3131 fi
3132
3133
3134 dnl
3135 dnl Mac Vout
3136 AC_ARG_ENABLE(macosx-vout,
3137   [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
3138 if test "x${enable_macosx_vout}" != "xno" &&
3139   (test "${SYS}" = "darwin" || test "${enable_macosx_vout}" = "yes")
3140 then
3141   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,Cocoa])
3142   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,OpenGL])
3143   VLC_ADD_PLUGIN([vout_macosx])
3144 fi
3145
3146 dnl
3147 dnl Mac CoreGraphics Layer Vout
3148 AC_ARG_ENABLE(coregraphicslayer-vout,
3149   [  --enable-coregraphicslayer-vout CoreGraphics layered video output module (default disabled)])
3150 if test "${enable_coregraphicslayer_vout}" = "yes"; then
3151   VLC_ADD_LIBS([vout_coregraphicslayer],[-Wl,-framework,Cocoa])
3152   VLC_ADD_LIBS([vout_coregraphicslayer],[-Wl,-framework,QuartzCore])
3153   VLC_ADD_PLUGIN([vout_coregraphicslayer])
3154 fi
3155
3156 dnl
3157 dnl  freetype module
3158 dnl
3159 AC_ARG_ENABLE(freetype,
3160   [  --enable-freetype       freetype support   (default auto)])
3161 AC_ARG_ENABLE(fribidi,
3162   [  --enable-fribidi        fribidi support    (default auto)])
3163 AC_ARG_ENABLE(fontconfig,
3164   [  --enable-fontconfig     fontconfig support (default auto)])
3165
3166 AC_ARG_WITH([default-font],
3167     AS_HELP_STRING([--with-default-font=PATH],
3168         [Path to the default font]),
3169         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3170             "$withval", [Default font])])
3171 AC_ARG_WITH([default-monospace-font],
3172     AS_HELP_STRING([--with-default-monospace-font=PATH],
3173         [Path to the default font]),
3174         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3175             "$withval", [Default monospace font])])
3176
3177 AC_ARG_WITH([default-font-family],
3178     AS_HELP_STRING([--with-default-font-family=NAME],
3179         [Path to the default font family]),
3180         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3181             "$withval", [Default font family])])
3182 AC_ARG_WITH([default-monospace-font-family],
3183     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3184         [Path to the default font family]),
3185         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3186             "$withval", [Default monospace font family])])
3187
3188 if test "${enable_freetype}" != "no"; then
3189    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3190       have_freetype=yes
3191       VLC_ADD_PLUGIN([freetype])
3192       VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
3193       if test "${SYS}" = "mingw32"; then
3194         VLC_ADD_LIBS([freetype],[-liconv -lz])
3195       fi
3196       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
3197
3198       AC_CHECK_HEADERS(Carbon/Carbon.h,
3199                        [VLC_ADD_LIBS([freetype],[-Wl,-framework,Carbon])])
3200
3201       dnl fontconfig support
3202       if test "${SYS}" != "mingw32"; then
3203           if test "${enable_fontconfig}" != "no"; then
3204             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3205               VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
3206               VLC_ADD_LIBS([freetype],[-lfontconfig])
3207             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3208           fi
3209       else
3210           VLC_ADD_LIBS([freetype],[-lgdi32])
3211       fi
3212
3213       dnl fribidi support
3214       if test "${enable_fribidi}" != "no"; then
3215         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3216           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3217           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
3218         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional support will be disabled in FreeType.])])
3219       fi
3220
3221   ],[
3222   have_freetype=no
3223   AS_IF([test -n "${enable_freetype}"],[
3224     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3225     ])
3226   ])
3227 fi
3228
3229
3230 dnl
3231 dnl  QuartzText vout module (iOS/Mac OS)
3232 dnl
3233 AC_ARG_ENABLE(macosx-quartztext,
3234   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3235 if test "x${enable_macosx_quartztext}" != "xno" &&
3236   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3237 then
3238   VLC_ADD_PLUGIN([quartztext])
3239   VLC_ADD_LIBS([quartztext],[-Wl,-framework,ApplicationServices])
3240 fi
3241
3242 dnl
3243 dnl  SVG module
3244 dnl
3245 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3246
3247 dnl
3248 dnl  android surface module
3249 dnl
3250 AC_ARG_ENABLE(android-surface,
3251   [  --enable-android-surface   Android Surface video output module (default disabled)])
3252 if test "${enable_android_surface}" = "yes"; then
3253   if test "${HAVE_ANDROID}" = "1"; then
3254      VLC_ADD_PLUGIN([android_surface])
3255      VLC_ADD_LIBS([android_surface], [-ldl])
3256   fi
3257 fi
3258
3259
3260 dnl
3261 dnl  iOS vout module
3262 dnl
3263 AC_ARG_ENABLE(ios-vout,
3264   [  --enable-ios-vout    iOS video output module (default disabled)])
3265 if test "${enable_ios_vout}" = "yes"
3266 then
3267   VLC_ADD_PLUGIN([vout_ios])
3268   VLC_ADD_LIBS([vout_ios], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit,-framework,Foundation])
3269 fi
3270
3271 dnl
3272 dnl  iOS ES2 vout module
3273 dnl
3274 AC_ARG_ENABLE(ios-vout2,
3275   [  --enable-ios-vout2    iOS video output module (default disabled)])
3276 if test "${enable_ios_vout2}" = "yes"
3277 then
3278   VLC_ADD_PLUGIN([vout_ios2])
3279   VLC_ADD_LIBS([vout_ios2], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit])
3280 fi
3281
3282
3283 dnl
3284 dnl  Windows DirectX module
3285 dnl
3286
3287 AC_ARG_ENABLE(directx,
3288   [AS_HELP_STRING([--enable-directx],
3289     [Microsoft DirectX support (default enabled on Windows)])],, [
3290   AS_IF([test "${SYS}" = "mingw32"], [
3291     enable_directx="yes"
3292   ], [
3293     enable_directx="no"
3294   ])
3295 ])
3296 have_directx="no"
3297 AS_IF([test "${enable_directx}" != "no"], [
3298   dnl DirectDraw
3299   AC_CHECK_HEADERS(ddraw.h, [
3300     have_directx="yes"
3301   ], [
3302     AC_MSG_ERROR([Cannot find DirectX headers!])
3303   ])
3304
3305   dnl OpenGL
3306   AC_CHECK_HEADERS(GL/wglew.h, [
3307     VLC_ADD_PLUGIN([glwin32])
3308   ],, [
3309     #include <windows.h>
3310     #include <GL/gl.h>
3311   ])
3312
3313   dnl Direct3D
3314   AC_CHECK_HEADERS(d3d9.h, [
3315     VLC_ADD_PLUGIN([direct3d])
3316   ])
3317
3318   dnl Direct2D
3319   AC_CHECK_HEADERS(d2d1.h, [
3320     VLC_ADD_PLUGIN([direct2d])
3321   ])
3322 ])
3323 AM_CONDITIONAL([HAVE_DIRECTX], [test "$have_directx" = "yes"])
3324
3325 dnl
3326 dnl  Linux framebuffer module
3327 dnl
3328 AC_CHECK_HEADER([linux/fb.h], [
3329   VLC_ADD_PLUGIN([fb])
3330 ])
3331
3332
3333 dnl
3334 dnl  DirectFB module
3335 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3336 dnl  TODO: support for static linking
3337 dnl
3338 AC_ARG_ENABLE(directfb,
3339   [  --enable-directfb       DirectFB support (default disabled)])
3340 AC_ARG_WITH(directfb,
3341   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3342
3343 if test "${enable_directfb}" = "yes"; then
3344     have_directfb="false"
3345     CPPFLAGS_mydirectfb=
3346     LIBS_mydirectfb=
3347     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3348         dnl Trying the given location
3349         VLC_SAVE_FLAGS
3350
3351         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3352         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3353
3354         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3355         LIBS="${LIBS} ${LIBS_new}"
3356
3357         dnl FIXME: too obscure
3358         AC_CHECK_HEADER([directfb.h], [
3359             AC_CHECK_LIB([direct],[direct_initialize], [
3360                 AC_CHECK_LIB([fusion], [fusion_enter], [
3361                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3362                 ], have_directfb="false")
3363             ], have_directfb="false")
3364         ], have_directfb="false")
3365
3366         VLC_RESTORE_FLAGS
3367
3368         if test "${have_directfb}" = "true"; then
3369             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3370             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3371         fi
3372     else
3373         dnl Look for directfb-config
3374         AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
3375         if test "${DIRECTFB_CONFIG}" != "no"; then
3376             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3377             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3378             have_directfb="true"
3379         else
3380             dnl Trying with pkg-config
3381             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3382                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3383                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3384                 have_directfb="true"
3385                 ], [have_directfb="false"])
3386         fi
3387     fi
3388     if test "${have_directfb}" = "true"; then
3389         VLC_ADD_PLUGIN([directfb])
3390         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3391         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3392     else
3393         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3394     fi
3395 fi
3396
3397 dnl
3398 dnl  AA plugin
3399 dnl
3400 AC_ARG_ENABLE(aa,
3401   [  --enable-aa             aalib output (default disabled)])
3402 if test "${enable_aa}" = "yes"
3403 then
3404   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3405   if test "${have_aa}" = "true"
3406   then
3407     VLC_ADD_PLUGIN([aa])
3408     VLC_ADD_LIBS([aa],[-laa])
3409     if test "${SYS}" != "mingw32"; then
3410       VLC_ADD_LIBS([aa],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3411     fi
3412   fi
3413 fi
3414
3415 dnl
3416 dnl  libcaca plugin
3417 dnl
3418 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3419
3420 dnl
3421 dnl  OS/2 KVA plugin
3422 dnl
3423 AC_ARG_ENABLE(kva,
3424   [AS_HELP_STRING([--enable-kva],
3425     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3426   AS_IF([test "$SYS" = "os2"], [
3427     enable_kva="yes"
3428   ])
3429 ])
3430 have_kva="no"
3431 KVA_LIBS=""
3432 AS_IF([test "$enable_kva" != "no"], [
3433   AC_CHECK_HEADERS([kva.h], [
3434     have_kva="yes"
3435     AC_CHECK_LIB(kva, main, [
3436       KVA_LIBS="-lkva"
3437     ])
3438   ])
3439 ])
3440 AC_SUBST(KVA_LIBS)
3441 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3442
3443 dnl
3444 dnl  Audio plugins
3445 dnl
3446
3447 EXTEND_HELP_STRING([Audio plugins:])
3448
3449 dnl
3450 dnl  Pulseaudio module
3451 dnl
3452 AC_ARG_ENABLE(pulse,
3453   [AS_HELP_STRING([--enable-pulse],
3454     [use the PulseAudio client library (default auto)])])
3455 have_pulse="no"
3456 AS_IF([test "${enable_pulse}" != "no"], [
3457   PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.22], [
3458     have_pulse="yes"
3459   ], [
3460     PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.16], [
3461       AS_IF([test "${no_x}" != "yes"], [
3462         have_pulse="yes"
3463         PULSE_LIBS="$PULSE_LIBS ${X_LIBS} ${X_PRE_LIBS} -lX11"
3464       ], [
3465         AS_IF([test "${enable_pulse}" = "yes"], [
3466           AC_MSG_ERROR([Xlib is required with PulseAudio pre-0.9.22 versions
3467 (see http://www.pulseaudio.org/ticket/799 for further reference).])
3468         ])
3469       ])
3470     ], [
3471       AS_IF([test "x${enable_pulse}" != "x"], [
3472         AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 0.9.22 or later required.])
3473       ])
3474     ])
3475   ])
3476 ])
3477 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3478
3479 dnl
3480 dnl  ALSA module
3481 dnl
3482 AC_ARG_ENABLE(alsa,
3483   [AS_HELP_STRING([--enable-alsa],
3484     [support the Advanced Linux Sound Architecture (default auto)])],, [
3485   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3486     enable_alsa="yes"
3487   ])
3488 ])
3489 have_alsa="no"
3490 AS_IF([test "${enable_alsa}" != "no"], [
3491   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3492     have_alsa="yes"
3493   ], [
3494     AS_IF([test "x${enable_alsa}" != "x"], [
3495       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3496     ])
3497   ])
3498 ])
3499 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3500
3501 dnl
3502 dnl  Open Sound System module
3503 dnl
3504 AC_ARG_ENABLE(oss,
3505   [AS_HELP_STRING([--enable-oss],
3506     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3507   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3508     enable_oss="no"
3509   ])
3510 ])
3511 have_oss="no"
3512 OSS_LIBS=""
3513 AS_IF([test "$enable_oss" != "no"], [
3514   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3515     have_oss="yes"
3516     AC_CHECK_LIB(ossaudio, main, [
3517       OSS_LIBS="-lossaudio"
3518     ])
3519   ])
3520 ])
3521 AC_SUBST(OSS_LIBS)
3522 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3523
3524 dnl
3525 dnl  OpenBSD sndio module
3526 dnl
3527 AC_ARG_ENABLE([sndio],
3528   [AS_HELP_STRING([--disable-sndio],
3529     [support the OpenBSD sndio (default auto)])],, [
3530   AS_IF([test "$SYS" = "openbsd"], [
3531     enable_sndio="yes"
3532   ])
3533 ])
3534 have_sndio="no"
3535 AS_IF([test "$enable_sndio" != "no"], [
3536   AC_CHECK_HEADER([sndio.h], [
3537     have_sndio="yes"
3538   ])
3539 ])
3540 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3541
3542 dnl
3543 dnl  Windows Audio Session plugin
3544 dnl
3545 AC_ARG_ENABLE([wasapi],
3546   [AS_HELP_STRING([--enable-wasapi],
3547     [use the Windows Audio Session API (default auto)])
3548 ])
3549 have_wasapi="no"
3550 AS_IF([test "$enable_wasapi" != "no"], [
3551   AC_CHECK_HEADER([audioclient.h], [
3552     have_wasapi="yes"
3553   ], [
3554     AS_IF([test "x${enable_wasapi}" != "x"], [
3555       AC_MSG_ERROR([Windows Audio Session API not found.])
3556     ])
3557   ])
3558 ])
3559 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3560
3561 dnl
3562 dnl  win32 waveOut plugin
3563 dnl
3564 AC_ARG_ENABLE(waveout,
3565   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
3566 if test "${enable_waveout}" != "no"; then
3567   if test "${SYS}" = "mingw32"; then
3568     VLC_ADD_PLUGIN([waveout])
3569     VLC_ADD_LIBS([waveout],[-lwinmm])
3570   fi
3571 fi
3572
3573 dnl
3574 dnl  CoreAudio plugin
3575 dnl
3576 AC_ARG_ENABLE(macosx-audio,
3577   [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
3578 if test "x${enable_macosx_audio}" != "xno" &&
3579   (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
3580 then
3581   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
3582     [ VLC_ADD_PLUGIN([auhal])
3583       VLC_ADD_LIBS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices])
3584     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
3585 fi
3586
3587 dnl
3588 dnl  iOS CoreAudio plugin
3589 dnl
3590 AC_ARG_ENABLE(ios-audio,
3591   [  --enable-ios-audio       Audio module for iOS (default disabled)])
3592 if test "${enable_ios_audio}" = "yes"
3593 then
3594   AC_CHECK_HEADERS(AudioUnit/AudioUnit.h,
3595     [ VLC_ADD_PLUGIN([audiounit_ios])
3596       VLC_ADD_LIBS([audiounit_ios],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices])
3597     ], [ AC_MSG_ERROR([cannot find AudioUnit headers]) ])
3598 fi
3599
3600 dnl
3601 dnl  AudioQueue plugin
3602 dnl
3603 AC_ARG_ENABLE(audioqueue,
3604   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3605 if test "${enable_audioqueue}" = "yes"
3606 then
3607   VLC_ADD_PLUGIN([audioqueue])
3608   VLC_ADD_LIBS([audioqueue], [-Wl,-framework,AudioToolbox,-framework,CoreFoundation])
3609 fi
3610
3611 dnl
3612 dnl  JACK modules
3613 dnl
3614 AC_ARG_ENABLE(jack,
3615   [AS_HELP_STRING([--disable-jack],
3616     [do not use jack (default auto)])])
3617 have_jack="no"
3618 AS_IF([test "${enable_jack}" != "no"], [
3619     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3620       [ have_jack=yes ],
3621       [
3622       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3623
3624       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3625       [ have_jack=yes ],
3626       [
3627       AS_IF([test -n "${enable_jack}"],
3628          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3629          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3630       ])
3631     ])
3632 ])
3633 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3634
3635 dnl
3636 dnl  OpenSLES Android
3637 dnl
3638 AC_ARG_ENABLE(opensles,
3639   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3640 if test "${HAVE_ANDROID}" = "1"; then
3641   if test "${enable_opensles}" = "yes"; then
3642       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3643         [ VLC_ADD_PLUGIN([opensles_android]) ],
3644         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3645   fi
3646 fi
3647
3648 dnl
3649 dnl libsamplerate plugin
3650 dnl
3651 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3652
3653 dnl
3654 dnl  OS/2 KAI plugin
3655 dnl
3656 AC_ARG_ENABLE(kai,
3657   [AS_HELP_STRING([--enable-kai],
3658     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3659   AS_IF([test "$SYS" = "os2"], [
3660     enable_kai="yes"
3661   ])
3662 ])
3663 have_kai="no"
3664 KAI_LIBS=""
3665 AS_IF([test "$enable_kai" != "no"], [
3666   AC_CHECK_HEADERS([kai.h], [
3667     have_kai="yes"
3668     AC_CHECK_LIB(kai, main, [
3669       KAI_LIBS="-lkai"
3670     ])
3671   ])
3672 ])
3673 AC_SUBST(KAI_LIBS)
3674 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3675
3676 dnl
3677 dnl  chromaprint audio track fingerprinter
3678 dnl
3679 m4_pushdef([libchromaprint_version], 0.6.0)
3680 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3681     VLC_ADD_PLUGIN([stream_out_chromaprint fingerprinter])
3682     VLC_ADD_CFLAGS([stream_out_chromaprint],[${CHROMAPRINT_CFLAGS}] [-I./webservices -I../stream_out])
3683     VLC_ADD_LIBS([stream_out_chromaprint],[${CHROMAPRINT_LIBS}])
3684     VLC_ADD_LIBS([fingerprinter],[-lm]),
3685     AS_IF([test "${enable_chromaprint}" = "yes"],
3686         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3687         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3688          ),
3689     [(Chromaprint based audio fingerprinter)],[auto])
3690 m4_popdef([libchromaprint_version])
3691
3692 dnl
3693 dnl  Interface plugins
3694 dnl
3695
3696 EXTEND_HELP_STRING([Interface plugins:])
3697
3698 dnl
3699 dnl QT
3700 dnl
3701 AC_ARG_ENABLE(qt, [
3702   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3703   AS_IF([test "${SYS}" = "darwin"], [
3704     enable_qt="no"
3705   ])
3706 ])
3707 AS_IF([test "${enable_qt}" != "no"], [
3708   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
3709       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3710       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3711       AC_PATH_PROG(RCC, [rcc-qt5 rcc], rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3712       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3713     ], [
3714       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3715         AS_IF([test -n "${enable_qt}"],[
3716           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3717         ],[
3718           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3719         ])
3720         enable_qt="no"
3721       ])
3722       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3723       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3724       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3725       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3726     ])
3727 ])
3728 AS_IF([test "${enable_qt}" != "no"], [
3729   VLC_ADD_PLUGIN([qt4])
3730   ALIASES="${ALIASES} qvlc"
3731
3732   AC_LANG_PUSH([C++])
3733   VLC_SAVE_FLAGS
3734
3735   AC_MSG_CHECKING([whether Qt uses Xlib])
3736   CPPFLAGS="${CPPFLAGS} ${QT_CFLAGS}"
3737   AC_PREPROC_IFELSE([AC_LANG_SOURCE([
3738 #include <QWidget>
3739 #if !defined (Q_WS_X11)
3740 # error Fail
3741 #endif
3742   ])], [
3743     AC_MSG_RESULT([yes])
3744   ], [
3745     AC_MSG_RESULT([no])
3746   ])
3747
3748   VLC_RESTORE_FLAGS
3749   AC_LANG_POP([C++])
3750
3751 ])
3752 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3753
3754 dnl
3755 dnl Simple test for skins2 dependency
3756 dnl
3757 AS_IF([test "$enable_qt" = "no"], [
3758   AS_IF([test "${enable_skins2}" = "yes"], [
3759     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.])
3760   ], [
3761     enable_skins2="no"
3762     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3763   ])
3764 ])
3765
3766 dnl
3767 dnl Skins2 module
3768 dnl
3769 AC_ARG_ENABLE(skins2,
3770   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3771 AS_IF([test "${enable_skins2}" != "no"], [
3772   have_skins_deps="yes"
3773
3774   dnl Win32
3775   AS_IF([test "${SYS}" = "mingw32"], [
3776     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3777     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3778   dnl MacOS
3779   ], [test "${SYS}" = "darwin"], [
3780     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3781     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3782   dnl OS/2
3783   ], [test "${SYS}" = "os2"], [
3784     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3785   dnl Linux/Unix
3786   ], [
3787     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3788     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3789     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3790     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3791     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3792   ])
3793
3794   dnl for All OSes
3795   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3796
3797   dnl we need freetype
3798   AS_IF([test "${have_freetype}" != "yes"], [
3799     have_skins_deps="no"
3800   ])
3801
3802   AS_IF([test "${have_skins_deps}" = "no"], [
3803     AS_IF([test "x${enable_skins2}" = "x"], [
3804       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3805     ], [
3806       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3807     ])
3808     enable_skins2="no"
3809   ], [
3810     VLC_ADD_PLUGIN([skins2])
3811     ALIASES="${ALIASES} svlc"
3812     enable_skins2="yes"
3813   ])
3814 ])
3815 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3816
3817 AC_ARG_ENABLE(libtar,
3818   [  --enable-libtar         libtar support for skins2 (default auto)])
3819 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3820   AC_CHECK_HEADERS(libtar.h, [
3821     VLC_ADD_LIBS([skins2],[-ltar])
3822   ])
3823 ])
3824
3825 dnl
3826 dnl  MacOS X gui module
3827 dnl
3828 AC_ARG_ENABLE(macosx,
3829   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3830 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3831 then
3832   VLC_ADD_LIBS([macosx], [-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreServices])
3833   VLC_ADD_OBJCFLAGS([macosx], [-fobjc-exceptions] )
3834   VLC_ADD_PLUGIN([macosx])
3835
3836   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])
3837
3838   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3839   then
3840     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3841   fi
3842   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,Sparkle])
3843   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3844
3845   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3846   then
3847     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3848   fi
3849   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit])
3850   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3851 fi
3852 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3853
3854 dnl
3855 dnl  Minimal Mac OS X module
3856 dnl
3857 AC_ARG_ENABLE(minimal-macosx,
3858   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3859 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3860 then
3861   VLC_ADD_LIBS([minimal_macosx], [-Wl,-framework,Cocoa])
3862   VLC_ADD_OBJCFLAGS([minimal_macosx], [-fobjc-exceptions] )
3863   VLC_ADD_PLUGIN([minimal_macosx])
3864 fi
3865 AM_CONDITIONAL(ENABLE_MINIMAL_MACOSX, [test "$enable_minimal_macosx" != "no"])
3866
3867 dnl
3868 dnl  MacOS X dialog provider
3869 dnl
3870 AC_ARG_ENABLE(macosx-dialog-provider,
3871   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3872 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3873   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3874 then
3875   VLC_ADD_LIBS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
3876   VLC_ADD_PLUGIN([macosx_dialog_provider])
3877 fi
3878 AM_CONDITIONAL(ENABLE_MACOSX_DIALOG_PROVIDER, [test "$enable_macosx_dialog_provider" != "no"])
3879
3880 dnl
3881 dnl  ncurses module
3882 dnl
3883 AC_ARG_ENABLE(ncurses,
3884 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3885 AS_IF([test "${enable_ncurses}" != "no"] ,[
3886   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3887     VLC_ADD_PLUGIN([ncurses])
3888     VLC_ADD_CFLAGS([ncurses],[${NCURSES_CFLAGS}])
3889     VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS}])
3890     ALIASES="${ALIASES} nvlc"
3891   ], [
3892     AS_IF([test -n "${enable_ncurses}"], [
3893       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3894     ])
3895   ])
3896 ])
3897
3898 dnl
3899 dnl  Lirc plugin
3900 dnl
3901 AC_ARG_ENABLE(lirc,
3902   [  --enable-lirc           lirc support (default disabled)])
3903 if test "${enable_lirc}" = "yes"
3904 then
3905   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
3906   if test "${have_lirc}" = "true"
3907   then
3908     VLC_ADD_PLUGIN([lirc])
3909     VLC_ADD_LIBS([lirc],[-llirc_client])
3910   fi
3911 fi
3912
3913 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3914 dnl
3915 dnl  goom visualization plugin
3916 dnl
3917 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3918
3919 dnl
3920 dnl libprojectM visualization plugin
3921 dnl
3922 AC_ARG_ENABLE(projectm,
3923   [  --enable-projectm       projectM visualization plugin (default enabled)])
3924 AS_IF([test "${enable_projectm}" != "no"],
3925   [
3926     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3927     [
3928       VLC_ADD_PLUGIN([projectm])
3929       VLC_ADD_CXXFLAGS([projectm],[$PROJECTM_CFLAGS])
3930       VLC_ADD_LIBS([projectm],[$PROJECTM_LIBS])
3931       PKG_CHECK_MODULES(PROJECTM2, [libprojectM >= 2.0.0],
3932         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3933         [ AC_MSG_WARN( [Using libprojectM version 1] )
3934       ])
3935     ],[
3936       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3937     ])
3938   ])
3939
3940 dnl
3941 dnl Vovoid VSXu visualization plugin
3942 dnl
3943 AC_ARG_ENABLE(vsxu,
3944   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3945 AS_IF([test "${enable_vsxu}" != "no"],
3946   [
3947     PKG_CHECK_MODULES(VSXU, libvsxu,
3948     [
3949       VLC_ADD_PLUGIN([vsxu])
3950       VLC_ADD_CXXFLAGS([vsxu],[$VSXU_CFLAGS])
3951       VLC_ADD_LIBS([vsxu],[$VSXU_LIBS])
3952     ],[
3953       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3954     ])
3955   ])
3956
3957 dnl
3958 dnl  AtmoLight (homemade Philips Ambilight clone)
3959 dnl
3960 AC_ARG_ENABLE(atmo,
3961 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
3962                 (default enabled)]),, [enable_atmo="yes"])
3963 AS_IF([test "${enable_atmo}" != no], [
3964   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
3965     AC_LANG_PUSH(C++)
3966     VLC_ADD_PLUGIN([atmo])
3967     AC_LANG_POP(C++)
3968   ])
3969 ])
3970
3971 dnl
3972 dnl  glSpectrum
3973 dnl
3974 AC_ARG_ENABLE(glspectrum,
3975   [  --enable-glspectrum    3D OpenGL spectrum visualization (default auto)])
3976 if test "${enable_glspectrum}" != "no" && test "${have_gl}" = "yes"
3977 then
3978     VLC_ADD_PLUGIN([glspectrum])
3979     VLC_ADD_LIBS([glspectrum],[$GL_LIBS])
3980 fi
3981
3982 EXTEND_HELP_STRING([Service Discovery plugins:])
3983 dnl
3984 dnl  Bonjour services discovery
3985 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3986
3987 dnl
3988 dnl  libudev services discovery
3989 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3990
3991 dnl
3992 dnl MTP devices services discovery
3993 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3994
3995 dnl
3996 dnl UPnP Plugin (Intel SDK)
3997 dnl
3998 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
3999 VLC_ADD_CXXFLAGS([upnp],[${UPNP_CFLAGS}])
4000
4001 EXTEND_HELP_STRING([Misc options:])
4002
4003 dnl
4004 dnl  libxml2 module
4005 dnl
4006 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
4007
4008
4009 dnl
4010 dnl libgcrypt
4011 dnl
4012 AC_ARG_ENABLE(libgcrypt,
4013   [  --disable-libgcrypt     gcrypt support (default enabled)])
4014 AS_IF([test "${enable_libgcrypt}" != "no"], [
4015   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
4016     libgcrypt-config --version >/dev/null || \
4017         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
4018     AC_CHECK_LIB(gcrypt, gcry_control, [
4019       have_libgcrypt="yes"
4020       GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
4021       GCRYPT_LIBS="`libgcrypt-config --libs`"
4022     ], [
4023       AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
4024     ], [`libgcrypt-config --libs`])
4025   ], [
4026     AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
4027   ], [#include <gcrypt.h>]
4028   )
4029 ])
4030
4031 AC_SUBST(GCRYPT_CFLAGS)
4032 AC_SUBST(GCRYPT_LIBS)
4033 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
4034
4035 dnl
4036 dnl TLS/SSL
4037 dnl
4038 AC_ARG_ENABLE(gnutls,
4039   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4040 AS_IF([test "${enable_gnutls}" != "no"], [
4041   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.0.20], [
4042     VLC_ADD_PLUGIN([gnutls])
4043   ], [
4044     AS_IF([test -n "${enable_gnutls}"], [
4045       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4046     ])
4047   ])
4048 ])
4049
4050
4051 dnl
4052 dnl Taglib plugin
4053 dnl
4054 AC_ARG_ENABLE(taglib,
4055   [AS_HELP_STRING([--disable-taglib],
4056     [do not use TagLib (default enabled)])])
4057 AS_IF([test "${enable_taglib}" != "no"], [
4058   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.6.1, [
4059     VLC_ADD_PLUGIN([taglib])
4060   ], [
4061     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4062 ])
4063
4064
4065 dnl
4066 dnl update checking system
4067 dnl
4068 AC_ARG_ENABLE(update-check,
4069   [  --enable-update-check   update checking system (default disabled)])
4070 if test "${enable_update_check}" = "yes"
4071 then
4072   if test "${have_libgcrypt}" != "yes"
4073   then
4074     AC_MSG_ERROR([libgcrypt is required for update checking system])
4075   fi
4076   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4077   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4078   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4079 fi
4080
4081 dnl
4082 dnl Growl notification plugin
4083 dnl
4084 AC_ARG_ENABLE(growl,
4085   [  --enable-growl          growl notification plugin (default disabled)],,
4086   [enable_growl=no])
4087 AS_IF([test "${enable_growl}" != "no"], [
4088     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4089       VLC_ADD_PLUGIN([growl])
4090       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4091       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
4092       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
4093     ])
4094   ]
4095 )
4096
4097 dnl
4098 dnl Libnotify notification plugin
4099 dnl
4100 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4101
4102 dnl
4103 dnl  Endianness check
4104 dnl
4105 AC_C_BIGENDIAN
4106 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4107   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4108 ], [
4109   DEFS_BIGENDIAN=""
4110 ])
4111 AC_SUBST(DEFS_BIGENDIAN)
4112
4113 dnl
4114 dnl Where to install KDE solid .desktop
4115 dnl
4116 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4117 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4118   KDE4_CONFIG="kde4-config"
4119 ])
4120
4121 AC_ARG_WITH(kde-solid,
4122   AS_HELP_STRING([--with-kde-solid=PATH],
4123                  [KDE Solid actions directory (auto)]),, [
4124
4125 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4126   with_kde_solid="yes"
4127 fi
4128 ])
4129 soliddatadir=""
4130 AS_IF([test "${with_kde_solid}" != "no"], [
4131   AS_IF([test "${with_kde_solid}" = "yes"], [
4132     kde4datadir="`${KDE4_CONFIG} --install data`"
4133     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4134     soliddatadir="${kde4datadir}/solid/actions"
4135   ], [
4136     soliddatadir="${with_kde_solid}"
4137   ])
4138 ])
4139 AC_SUBST(soliddatadir)
4140 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4141
4142 EXTEND_HELP_STRING([Components:])
4143
4144 dnl
4145 dnl  the VLC binary
4146 dnl
4147 AC_ARG_ENABLE(vlc,
4148   [  --enable-vlc            build the VLC media player (default enabled)])
4149 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4150
4151 AC_ARG_ENABLE(macosx-vlc-app,
4152   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4153 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4154     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4155
4156 dnl
4157 dnl  Stuff used by the program
4158 dnl
4159 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4160 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4161 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4162 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4163 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4164 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4165 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4166 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4167 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4168 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4169 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4170 AC_SUBST(COPYRIGHT_MESSAGE)
4171 AC_SUBST(VERSION_MESSAGE)
4172 AC_SUBST(VERSION_MAJOR)
4173 AC_SUBST(VERSION_MINOR)
4174 AC_SUBST(VERSION_REVISION)
4175 AC_SUBST(VERSION_EXTRA)
4176 AC_SUBST(COPYRIGHT_YEARS)
4177 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4178 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4179 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4180 dnl
4181 dnl  Handle substvars that use $(top_srcdir)
4182 dnl
4183 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4184
4185 dnl
4186 dnl  Configuration is finished
4187 dnl
4188 AC_SUBST(SYS)
4189 AC_SUBST(ARCH)
4190 AC_SUBST(ALIASES)
4191 AC_SUBST(ASM)
4192 AC_SUBST(MOC)
4193 AC_SUBST(RCC)
4194 AC_SUBST(UIC)
4195 AC_SUBST(WINDRES)
4196 AC_SUBST(WINE_SDK_PATH)
4197 AC_SUBST(LIBEXT)
4198 AC_SUBST(AM_CPPFLAGS)
4199 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4200 AC_SUBST(FILE_LIBVLCCORE_DLL)
4201 AC_SUBST(FILE_LIBVLC_DLL)
4202
4203 AC_CONFIG_FILES([
4204   Makefile
4205   doc/Makefile
4206   modules/Makefile
4207   m4/Makefile
4208   po/Makefile.in
4209   share/Makefile
4210   compat/Makefile
4211   src/Makefile
4212   lib/Makefile
4213   bin/Makefile
4214   test/Makefile
4215   modules/access/rtp/Makefile
4216   modules/access_output/Makefile
4217   modules/audio_filter/Makefile
4218   modules/audio_mixer/Makefile
4219   modules/audio_output/Makefile
4220   modules/control/Makefile
4221   modules/gui/Makefile
4222   modules/gui/macosx/Makefile
4223   modules/gui/minimal_macosx/Makefile
4224   modules/gui/macosx_dialog_provider/Makefile
4225   modules/gui/qt4/Makefile
4226   modules/gui/skins2/Makefile
4227   modules/lua/Makefile
4228   modules/misc/Makefile
4229   modules/mux/Makefile
4230   modules/notify/Makefile
4231   modules/packetizer/Makefile
4232   modules/services_discovery/Makefile
4233   modules/stream_filter/Makefile
4234   modules/stream_out/Makefile
4235   modules/text_renderer/Makefile
4236   modules/video_chroma/Makefile
4237   modules/video_filter/Makefile
4238   modules/video_output/Makefile
4239   modules/video_splitter/Makefile
4240   modules/visualization/Makefile
4241   modules/arm_neon/Makefile
4242   modules/hw/vdpau/Makefile
4243 ])
4244
4245 AM_COND_IF([HAVE_WIN32], [
4246   AC_CONFIG_FILES([
4247     extras/package/win32/NSIS/spad.nsi
4248     extras/package/win32/NSIS/vlc.win32.nsi
4249     extras/package/win32/msi/config.wxi
4250   ])
4251 ])
4252
4253 AM_COND_IF([HAVE_DARWIN], [
4254   AC_CONFIG_FILES([
4255     extras/package/macosx/Info.plist
4256     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4257   ])
4258 ])
4259
4260 dnl Generate makefiles
4261 AC_OUTPUT
4262
4263 dnl Do we have to use make or gmake ?
4264 if make --version 2>&1|grep -q GNU
4265 then
4266     # GNU make, all seems good
4267     MAKE=make
4268 else
4269     # Known GNU make alias (on BSD)
4270     MAKE=gmake
4271 fi
4272 dnl Shortcut to nice compile message
4273 if test -n $SHELL; then
4274   SHELL=${CONFIG_SHELL-/bin/sh}
4275 fi
4276 rm -f compile
4277 echo "#! $SHELL
4278 rm -f .error\$\$
4279 ERROR=0
4280 export PATH=\"$PATH\" LANG=C
4281 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| `sed -ne \"s/^top_srcdir *= *//p\" < Makefile`/extras/buildsystem/make.pl
4282 test -f .error\$\$ && ERROR=1
4283 rm -f .error\$\$
4284 exit \$ERROR" >compile
4285 chmod a+x compile
4286
4287 echo "
4288 libvlc configuration
4289 --------------------
4290 version               : ${VERSION}
4291 system                : ${SYS}
4292 architecture          : ${ARCH}
4293 optimizations         : ${enable_optimizations}"
4294 if test "${enable_vlc}" != "no"; then
4295 echo "vlc aliases           :${ALIASES}"
4296 else
4297 echo "build vlc executable  : no"
4298 fi
4299 echo "
4300 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."