]> git.sesse.net Git - vlc/blob - configure.ac
demux: remove makefile recursion
[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_CFLAGS([motion rotate],[-fconstant-cfstrings])
160     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,SystemConfiguration])
161
162     dnl Allow binaries created on Lion to run on earlier releases
163     AC_EGREP_CPP(yes,
164            [#import <Cocoa/Cocoa.h>
165             #ifdef MAC_OS_X_VERSION_10_7
166             yes
167             #endif],
168             [AC_MSG_RESULT([yes])
169             AC_LIBOBJ([getdelim])
170             AC_LIBOBJ([strndup])
171             AC_LIBOBJ([strnlen])],)
172
173     dnl
174     dnl  Handle Mac OS X SDK flags
175     dnl
176     AC_ARG_WITH(macosx-sdk,
177       [AS_HELP_STRING([--with-macosx-sdk=DIR],
178         [compile using the SDK in DIR])])
179     if test "${with_macosx_sdk}" != "" ; then
180         test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
181         CPP="${CPP} -isysroot ${with_macosx_sdk}"
182         CC="${CC} -isysroot ${with_macosx_sdk}"
183         CXX="${CXX} -isysroot ${with_macosx_sdk}"
184         OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
185         LD="${LD} -syslibroot ${with_macosx_sdk}"
186     fi
187     AC_ARG_WITH(macosx-version-min,
188       [AS_HELP_STRING([--with-macosx-version-min=VERSION],
189         [compile for Mac OS X VERSION and above])])
190     if test "${with_macosx_version_min}" != "" ; then
191         MACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}
192         CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
193         CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
194         CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
195         OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
196         LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
197         CFLAGS="${CFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
198         CXXFLAGS="${CXXFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
199         OBJCFLAGS="${OBJCFLAGS} -DMACOSX_DEPLOYMENT_TARGET=${with_macosx_version_min}"
200         export MACOSX_DEPLOYMENT_TARGET
201     fi
202     ;;
203   *mingw32* | *cygwin* | *wince* | *mingwce*)
204     AC_CHECK_TOOL(WINDRES, windres, :)
205     AC_CHECK_TOOL(OBJCOPY, objcopy, :)
206     AH_TOP([#if defined(_WIN32) && !defined(_WIN32_WINNT)])
207     AH_TOP([# define _WIN32_WINNT 0x0502 /* Windows XP SP2 */])
208     AH_TOP([#endif])
209     AC_DEFINE([_WIN32_IE], 0x0600, [Define to '0x0600' for IE 6.0 (and shell) APIs.])
210     AC_DEFINE([_UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
211     AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
212
213     case "${host_os}" in
214       *mingw32*)
215         SYS=mingw32
216         ;;
217       *cygwin*)
218         dnl Check if we are using the mno-cygwin mode in which case we are
219         dnl actually dealing with a mingw32 compiler.
220         AC_EGREP_CPP(yes,
221             [#ifdef _WIN32
222              yes
223              #endif],
224             SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
225         ;;
226     esac
227
228     if test "${SYS}" = "mingw32"; then
229         # DEP, ASLR, NO SEH
230         LDFLAGS="${LDFLAGS} -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase"
231
232         VLC_ADD_LIBS([libvlccore],[-lwinmm])
233         VLC_ADD_LDFLAGS([vlc],[-mwindows])
234         VLC_ADD_LIBS([win32text],[-lgdi32])
235         AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
236         ac_default_prefix="`pwd`/_win32"
237         DESTDIR="`pwd`/_win32/"
238
239         dnl
240         dnl NSIS/MSI Installer prefix and WIN64
241         dnl
242         case "${host}" in
243             amd64*|x86_64*)
244                 HAVE_WIN64="1"
245                 WINDOWS_ARCH="x64"
246                 PROGRAMFILES="PROGRAMFILES64"
247             ;;
248             *)
249                 WINDOWS_ARCH="x86"
250                 PROGRAMFILES="PROGRAMFILES"
251             ;;
252         esac
253         AC_SUBST(WINDOWS_ARCH)
254         AC_SUBST(PROGRAMFILES)
255
256     fi
257     ;;
258   *nto*)
259     SYS=nto
260     ;;
261   solaris*)
262     SYS=solaris
263     ;;
264   hpux*)
265     SYS=hpux
266     ;;
267   symbian*)
268     SYS=symbian
269     ;;
270   *os2*)
271     SYS=os2
272     LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild"
273     ;;
274   *)
275     SYS="${host_os}"
276     ;;
277 esac
278 AM_CONDITIONAL(HAVE_DARWIN,  test "${SYS}" = "darwin")
279 AM_CONDITIONAL(HAVE_LINUX,   test "${SYS}" = "linux")
280 AM_CONDITIONAL(HAVE_OS2,     test "${SYS}" = "os2")
281 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
282 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1")
283 AM_CONDITIONAL(HAVE_SYMBIAN, test "${SYS}" = "symbian")
284
285 dnl
286 dnl Sadly autoconf does not think about testing foo.exe when ask to test
287 dnl for program foo on win32
288 case "${build_os}" in
289     cygwin|msys)
290         ac_executable_extensions=".exe"
291     ;;
292     *)
293     ;;
294 esac
295
296 dnl Android is linux, but a bit different
297 AS_IF([test "$SYS" = linux],[
298     AC_MSG_CHECKING([for an Android system])
299     AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
300         [[#ifndef __ANDROID__
301          # error Not Android
302          #endif
303         ]],[[;]])
304     ],[
305       HAVE_ANDROID="1"
306       AC_MSG_RESULT([yes])
307     ],[
308       AC_MSG_RESULT([no])
309     ])
310 ])
311 AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
312
313
314 dnl
315 dnl  Check for the contrib directory
316 dnl
317 AC_ARG_WITH(contrib,
318   [AS_HELP_STRING([--with-contrib[=DIR]],
319     [search for 3rd party libraries in DIR/include and DIR/lib])
320 ])
321 AC_MSG_CHECKING([for 3rd party libraries path])
322 AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
323   CONTRIB_DIR="${srcdir}/contrib/${host}"
324   AS_IF([test ! -d "${CONTRIB_DIR}"], [
325     echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
326     CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
327     AS_IF([test ! -d "${CONTRIB_DIR}"], [
328       echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
329       CONTRIB_DIR="${srcdir}/extras/contrib/hosts/${host}"
330       AS_IF([test ! -d "${CONTRIB_DIR}"], [
331         echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
332         CONTRIB_DIR="${srcdir}/extras/contrib/hosts/`$CC -dumpmachine`"
333         AS_IF([test ! -d "${CONTRIB_DIR}"], [
334           echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
335           CONTRIB_DIR=""
336           AC_MSG_RESULT([not found])
337         ])
338       ])
339     ])
340   ])
341 ], [
342   AS_IF([test "${with_contrib}" != "no"], [
343     CONTRIB_DIR="${with_contrib}"
344   ], [
345     CONTRIB_DIR=""
346     AC_MSG_RESULT([disabled])
347   ])
348 ])
349 AS_IF([test -n "${CONTRIB_DIR}"], [
350   AS_IF([test -d "${CONTRIB_DIR}/lib"],[
351     CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`
352   ], [
353     echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
354     CONTRIB_DIR=""
355     AC_MSG_RESULT([not usable])
356   ])
357
358 ])
359 AS_IF([test -n "${CONTRIB_DIR}"], [
360   AC_MSG_RESULT([${CONTRIB_DIR}])
361   export PATH=${CONTRIB_DIR}/bin:$PATH
362   CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
363   CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
364   CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
365   OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
366   AS_IF([test "$build" = "$host" -o "$PKG_CONFIG_LIBDIR"], [
367     export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH"
368   ], [
369     export PKG_CONFIG_LIBDIR="${CONTRIB_DIR}/lib/pkgconfig"
370   ])
371   LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
372
373   AS_IF([test "${SYS}" = "darwin"], [
374     export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
375     export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
376   ])
377 ], [
378   AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
379     AC_MSG_ERROR([Third party libraries not found!])
380   ])
381 ])
382 AC_SUBST(CONTRIB_DIR)
383
384 dnl
385 dnl  Libtool
386 dnl  It's very bad, but our former custom system was worst
387 dnl  -- Courmisch
388 dnl
389
390 dnl override platform specific check for dependent libraries
391 dnl otherwise libtool linking of shared libraries will
392 dnl fail on anything other than pass_all.
393 AC_CACHE_VAL(lt_cv_deplibs_check_method,
394     [lt_cv_deplibs_check_method=pass_all])
395
396 LT_INIT([dlopen win32-dll shared disable-static])
397 LT_LANG([C++])
398 LT_LANG([Windows Resource])
399
400 DOLT
401
402 lt_cv_deplibs_check_method=pass_all
403
404 AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
405   AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
406 ])
407
408 dnl
409 dnl Gettext stuff
410 dnl
411 AM_GNU_GETTEXT_VERSION([0.18.3])
412 AM_GNU_GETTEXT([external], [need-ngettext])
413
414 dnl
415 dnl Iconv stuff
416 dnl
417 AM_ICONV
418
419 dnl
420 dnl checks for mingw
421 AS_IF([test "${SYS}" = "mingw32"], [
422 dnl Check for broken versions of mingw-runtime compatability library
423     AC_MSG_CHECKING(for broken mingw-runtime)
424     AC_PREPROC_IFELSE([AC_LANG_SOURCE([
425 #include <_mingw.h>
426 #if defined(__MINGW64_VERSION_MAJOR)
427 # if __MINGW64_VERSION_MAJOR < 3
428 #  error Attempting to use mingw-runtime with broken vsnprintf and direct2d support
429 # endif
430 #elif __MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION < 15
431 # error Attempting to use mingw-runtime with broken vsnprintf support
432 #endif
433     ])], [
434         AC_MSG_RESULT([ok])
435     ], [
436         AC_MSG_RESULT([present])
437         AC_MSG_ERROR([LibVLC requires mingw-runtime version 3.15 or higher, or mingw-w64 version 3.0 or higher!])
438     ])
439     dnl force use of mingw provided c99 *printf over msvcrt
440     CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
441
442 dnl Check for the need to include the mingwex lib for mingw32
443     VLC_SAVE_FLAGS
444     AC_CHECK_LIB(mingwex,opendir,
445         AC_CHECK_LIB(mingw32,opendir,,
446             [VLC_ADD_LIBS([libvlccore],[-lmingwex])])
447     )
448     VLC_RESTORE_FLAGS
449
450 dnl Check for fnative-struct or mms-bitfields support for mingw32
451     VLC_SAVE_FLAGS
452     CFLAGS="${CFLAGS} -mms-bitfields"
453     CXXFLAGS="${CXXFLAGS} -mms-bitfields"
454     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
455         [ac_cv_c_mms_bitfields],
456         [AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
457     if test "${ac_cv_c_mms_bitfields}" = "no"; then
458         VLC_RESTORE_FLAGS
459         CFLAGS="${CFLAGS} -fnative-struct"
460         CXXFLAGS="${CXXFLAGS} -fnative-struct"
461         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
462             [ac_cv_c_fnative_struct],
463             [AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
464         "${ac_cv_c_fnative_struct}" = "no" && VLC_RESTORE_FLAGS
465     fi
466 ])
467
468 AC_ARG_ENABLE(winstore_app,
469      AS_HELP_STRING([--enable-winstore-app],
470                     [Build targetted for Windows Store apps (default disabled)]))
471
472 vlc_winstore_app=0
473 AS_IF([test "${SYS}" = "mingw32" -a "${enable_winstore_app}" = "yes"], [
474     vlc_winstore_app=1
475     VLC_ADD_LIBS([libvlccore], [-lole32 -lruntimeobject])
476     ])
477 AC_DEFINE_UNQUOTED(VLC_WINSTORE_APP, ${vlc_winstore_app}, [Define to 1 if you want to build for Windows Store apps])
478
479
480 dnl
481 dnl Buggy glibc prevention. Purposedly not cached.
482 dnl See sourceware.org bugs 5058 and 5443.
483 dnl Ubuntu alone has 20 bug numbers for this...
484 dnl
485 AC_MSG_CHECKING(for buggy GNU/libc versions)
486 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
487 #include <limits.h>
488 #if defined (__GLIBC__) && (__GLIBC__ == 2) \
489   && (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
490 # error GNU/libc with dcgettext killer bug!
491 #endif
492 ])], [
493   AC_MSG_RESULT([not present])
494 ], [
495   AC_MSG_RESULT([found])
496   AS_IF([test "x${enable_nls}" != "xno"], [
497     AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
498 work-around for this. Check with your distribution vendor on how to update the
499 glibc run-time. Alternatively, build with --disable-nls.])
500   ])
501 ])
502
503 dnl Plugin compilation stuff
504
505 VLC_LIBRARY_SUFFIX
506
507 dnl Check for system libs needed
508 need_libc=false
509
510 dnl Check for usual libc functions
511 AC_CHECK_DECLS([nanosleep],,,[#include <time.h>])
512 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])
513 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])
514 AC_CHECK_FUNCS(fdatasync,,
515   [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
516 ])
517
518 dnl mingw64 implements those as static inline, not functions with C linkage
519 AC_LINK_IFELSE([
520     AC_LANG_PROGRAM([#include <stdio.h>], [
521         char *c;
522         if (asprintf(&c, "%s %d", "string", 1) == -1)
523             c = NULL;
524     ])],[AC_DEFINE([HAVE_ASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([asprintf])])
525 AC_LINK_IFELSE([
526     AC_LANG_PROGRAM([#include <stdio.h>
527                      #include <stdarg.h>], [
528         char *c;
529         va_list ap;
530         if (vasprintf(&c, "%s %d", ap) == -1)
531             c = NULL;
532     ])],[AC_DEFINE([HAVE_VASPRINTF],[1],[Define to 1 if you have asprintf function])],[AC_LIBOBJ([vasprintf])])
533
534 dnl C11 static_assert()
535 AC_MSG_CHECKING([for static_assert in assert.h])
536 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <assert.h>], [
537 static_assert(1, "The impossible happened.");
538 ])], [
539   AC_MSG_RESULT([yes])
540   AC_DEFINE([HAVE_STATIC_ASSERT], [1], [Define to 1 if <assert.h> defines static_assert.])
541 ], [
542   AC_MSG_RESULT([no])
543 ])
544
545 # Windows CE does not have strcoll()
546 AC_FUNC_STRCOLL
547
548 dnl Check for non-standard system calls
549 case "$SYS" in
550   "linux")
551     AC_CHECK_FUNCS([accept4 pipe2 eventfd vmsplice sched_getaffinity])
552     ;;
553   "mingw32")
554     AC_CHECK_FUNCS([_lock_file])
555     ;;
556 esac
557
558 AH_BOTTOM([#include <vlc_fixups.h>])
559
560 dnl Check for struct pollfd
561 AC_CHECK_TYPES([struct pollfd],,,
562 [#include <sys/types.h>
563 #if HAVE_POLL
564 # include <poll.h>
565 #elif defined (_WIN32)
566 # include <winsock2.h>
567 #endif
568 ])
569
570 dnl Checks for socket stuff
571 VLC_SAVE_FLAGS
572 SOCKET_LIBS=""
573 AC_SEARCH_LIBS(connect, [socket], [
574   AS_IF([test "$ac_cv_search_connect" != "none required"], [
575     SOCKET_LIBS="$ac_cv_search_connect"
576   ])
577 ], [
578   AS_IF([test "${SYS}" = "mingw32"], [
579     SOCKET_LIBS="-lws2_32"
580   ])
581 ])
582
583 AC_SEARCH_LIBS([getaddrinfo], [nsl], [
584  AS_IF([test "$ac_cv_search_getaddrinfo" != "none required"], [
585     SOCKET_LIBS="$ac_cv_search_getaddrinfo $SOCKET_LIBS"
586   ])
587 ],, [${SOCKET_LIBS}])
588
589 LIBS="${LIBS} ${SOCKET_LIBS}"
590 AC_LINK_IFELSE([
591     AC_LANG_PROGRAM([#ifdef _WIN32
592         # if _WIN32_WINNT < 0x600
593         #  error Needs vista+
594         # endif
595         #include <ws2tcpip.h>
596         #else
597         #include <sys/socket.h>
598         #include <arpa/inet.h>
599         #endif], [
600         char dst[[sizeof(struct in_addr)]];
601         inet_pton(AF_INET, "127.0.0.1", dst);
602     ])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
603 AC_CHECK_FUNCS([if_nameindex if_nametoindex])
604 VLC_RESTORE_FLAGS
605
606 AS_IF([test -n "$SOCKET_LIBS"], [
607   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}])
608 ])
609 AC_SUBST(SOCKET_LIBS)
610
611 dnl Check for socklen_t
612 AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
613 AC_CACHE_CHECK([for socklen_t in sys/socket.h], dnl ` (fix VIM syntax highlight
614 ac_cv_type_socklen_t,
615 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
616 [#include <sys/types.h>
617 #ifdef _WIN32
618 # include <winsock2.h>
619 # include <ws2tcpip.h>
620 #else
621 # include <sys/socket.h>
622 #endif]], [[socklen_t len; len = 0;]])],
623 ac_cv_type_socklen_t=yes,
624 ac_cv_type_socklen_t=no)])
625 AS_IF([test "$ac_cv_type_socklen_t" = no],
626  [AC_DEFINE(socklen_t, int)])
627
628 dnl Check for struct sockaddr_storage
629 AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
630 AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
631 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
632   [AC_TRY_COMPILE(
633     [#include <sys/types.h>
634      #if defined( _WIN32 )
635      # include <winsock2.h>
636      #else
637      # include <sys/socket.h>
638      #endif], [struct sockaddr_storage addr;],
639      ac_cv_struct_sockaddr_storage=yes,
640      ac_cv_struct_sockaddr_storage=no)])
641 AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
642   AC_DEFINE(sockaddr_storage, sockaddr)
643   AC_DEFINE(ss_family, sa_family)
644 ])
645
646 dnl FreeBSD has a gnugetopt library for this:
647 GNUGETOPT_LIBS=""
648 AC_CHECK_FUNC(getopt_long,, [
649   AC_CHECK_LIB([gnugetopt],[getopt_long], [
650     GNUGETOPT_LIBS="-lgnugetopt"
651   ])
652 ])
653 AC_SUBST(GNUGETOPT_LIBS)
654
655 AC_CHECK_LIB(m,cos,[
656   VLC_ADD_LIBS([adjust wave ripple psychedelic gradient a52tofloat32 dtstofloat32 x264 goom rotate 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])
657   LIBM="-lm"
658 ], [
659   LIBM=""
660 ])
661 AC_SUBST(LIBM)
662
663 AC_CHECK_LIB(m,lrintf, [
664   AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
665   VLC_ADD_LIBS([skins2],[-lm])
666 ])
667
668 dnl Check for dynamic plugins
669 LIBDL=""
670 have_dynamic_objects="no"
671 VLC_SAVE_FLAGS
672 AC_SEARCH_LIBS(dlopen, [dl svld], [
673   AS_IF([test "$ac_cv_search_dlopen" != "none required"], [
674     LIBDL="$ac_cv_search_dlopen"
675   ])
676   have_dynamic_objects="yes"
677 ])
678 VLC_RESTORE_FLAGS
679
680 # Windows
681 AS_IF([test "${SYS}" = "mingw32"], [
682   LIBDL=""
683   have_dynamic_objects="yes" #assume we can use shared objects
684 ])
685
686 AS_IF([test "${enable_shared}" = "no"], [
687   have_dynamic_objects=no
688 ])
689 AM_CONDITIONAL(HAVE_DYNAMIC_PLUGINS, [test "${have_dynamic_objects}" != "no"])
690
691 AC_SUBST(LIBDL)
692 VLC_ADD_LIBS([lua],[$LIBDL])
693
694 dnl Check for thread library
695 LIBPTHREAD=""
696 AS_IF([test "${SYS}" != "mingw32"], [
697   VLC_SAVE_FLAGS
698   LIBS=""
699   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
700     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
701       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
702     ])
703   ])
704   VLC_RESTORE_FLAGS
705
706   AC_CHECK_LIB(rt, clock_nanosleep, [
707     VLC_ADD_LIBS([libvlccore],[-lrt])
708   ], [
709     AC_CHECK_FUNC(nanosleep,,[
710       AC_CHECK_LIB(rt,nanosleep, [
711         VLC_ADD_LIBS([libvlccore],[-lrt])
712       ], [
713         AC_CHECK_LIB(posix4,nanosleep, [
714           VLC_ADD_LIBS([libvlccore],[-lposix4])
715         ])
716       ])
717     ])
718     dnl HP/UX port
719     AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlccore],[-lrt])])
720   ])
721 ])
722 AC_SUBST(LIBPTHREAD)
723
724 dnl Check for headers
725 AC_CHECK_HEADERS([search.h])
726 AC_CHECK_HEADERS(getopt.h locale.h xlocale.h)
727 AC_CHECK_HEADERS([sys/time.h sys/ioctl.h])
728 AC_CHECK_HEADERS([arpa/inet.h netinet/udplite.h sys/eventfd.h])
729 AC_CHECK_HEADERS([net/if.h], [], [],
730   [
731     #include <sys/types.h>
732     #include <sys/socket.h>
733   ])
734 AC_CHECK_HEADERS([sys/mount.h], [], [],
735   [
736     #include <sys/param.h>
737   ])
738
739 if test "${SYS}" != "mingw32"; then
740   AC_CHECK_HEADERS(machine/param.h sys/shm.h)
741   AC_CHECK_HEADERS([linux/version.h linux/dccp.h scsi/scsi.h linux/magic.h])
742   AC_CHECK_HEADERS(syslog.h mntent.h)
743 fi # end "${SYS}" != "mingw32"
744
745 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
746 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
747 AC_CHECK_TYPE(ssize_t,, [
748   AC_DEFINE(ssize_t, int)
749 ])
750
751 dnl Check for threads library
752 if test "${SYS}" != "mingw32"; then
753   AC_CHECK_HEADERS(pthread.h)
754 fi # end "${SYS}" != "mingw32"
755
756 dnl It seems that autoconf detects pkg-config only during the first
757 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
758 dnl it is nested within a conditional block, so it was not working right.
759 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
760 AC_ARG_VAR(PKG_CONFIG_PATH,
761        [Paths where to find .pc not at the default location])
762 PKG_PROG_PKG_CONFIG()
763
764 dnl On some OS we need static linking
765 AS_IF([test -n "${PKG_CONFIG}" ],[
766     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
767         PKG_CONFIG="${PKG_CONFIG} --static"
768     ])
769 ])
770
771
772 dnl
773 dnl Check for zlib.h and -lz along with system -lminizip if available
774 dnl
775 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
776 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
777 if test "${have_zlib}" = "yes"
778 then
779   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
780   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
781     AC_CHECK_HEADERS([unzip.h], [
782       have_minizip=yes
783       MINIZIP_LIBS="-lminizip -lz"
784     ], [
785       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
786       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/access/libunzip.la])
787       have_minizip=no
788     ])
789   ])
790   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
791   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
792 fi
793 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
794
795
796 dnl
797 dnl Domain name i18n support via GNU libidn
798 dnl
799 PKG_CHECK_MODULES([IDN], [libidn], [
800   have_libidn="yes"
801   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
802 ], [
803   have_libidn="no"
804 ])
805
806
807 dnl Check for dbus
808 AC_ARG_ENABLE(dbus,
809   [AS_HELP_STRING([--enable-dbus],
810     [compile D-Bus message bus support (default enabled)])])
811 have_dbus="no"
812 AS_IF([test "${enable_dbus}" != "no"], [
813   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
814     have_dbus="yes"
815   ], [
816     AS_IF([test -n "${enable_dbus}"], [
817       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
818     ], [
819       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
820     ])
821   ])
822 ])
823 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
824
825 dnl Check for ntohl, etc.
826 VLC_SAVE_FLAGS
827 CFLAGS="${CFLAGS} -Wall -Werror"
828 AC_CACHE_CHECK([for ntohl in sys/param.h],
829     [ac_cv_c_ntohl_sys_param_h],
830     [     AC_TRY_COMPILE([#include <sys/param.h>],
831         [int meuh; ntohl(meuh);],
832         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
833 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
834     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
835 fi
836 VLC_RESTORE_FLAGS
837
838 EXTEND_HELP_STRING([Optimization options:])
839 dnl
840 dnl  Compiler warnings
841 dnl
842
843 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])
844 RDC_PROG_CC_FLAGS([-pipe])
845 AC_LANG_PUSH([C++])
846 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
847 AC_LANG_POP([C++])
848
849 dnl
850 dnl  Debugging mode
851 dnl
852 AC_ARG_ENABLE(debug,
853   [AS_HELP_STRING([--enable-debug],
854     [build with run-time assertions (default disabled)])],,
855   [enable_debug="no"])
856 AH_TEMPLATE(NDEBUG,
857             [Define to 1 if debug code should NOT be compiled])
858 AS_IF([test "${enable_debug}" != "no"], [
859   AC_CHECK_HEADERS([valgrind/valgrind.h])
860 ], [
861   AC_DEFINE(NDEBUG)
862 ])
863
864 dnl
865 dnl  Profiling
866 dnl
867 AC_ARG_ENABLE(gprof,
868   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
869   [enable_gprof="no"])
870 AS_IF([test "${enable_gprof}" != "no"], [
871   CFLAGS="${CFLAGS} -pg"
872   CXXFLAGS="${CXXFLAGS} -pg"
873   OBJCFLAGS="${OBJCFLAGS} -pg"
874   LDFLAGS="${LDFLAGS} -pg"
875 ])
876
877 AC_ARG_ENABLE(cprof,
878   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
879   [enable_cprof="no"])
880 AS_IF([test "${enable_gprof}" != "no"], [
881   CFLAGS="${CFLAGS} -finstrument-functions"
882   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
883   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
884   LDFLAGS="${LDFLAGS} -finstrument-functions"
885 ])
886
887 dnl
888 dnl  Test coverage
889 dnl
890 AC_ARG_ENABLE(coverage,
891   [AS_HELP_STRING([--enable-coverage],
892     [build for test coverage (default disabled)])],,
893   [enable_coverage="no"])
894 AS_IF([test "${enable_coverage}" != "no"], [
895   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
896   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
897   LDFLAGS="-lgcov ${LDFLAGS}"
898 ])
899
900 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
901   VLC_SAVE_FLAGS
902   CFLAGS="${CFLAGS} -fvisibility=hidden"
903   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
904   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
905   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
906                  [ac_cv_c_visibility_hidden], [
907     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
908       ac_cv_c_visibility_hidden=yes
909     ], [
910       ac_cv_c_visibility_hidden=no
911     ])
912   ])
913   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
914 ])
915
916
917 dnl
918 dnl  Enable/disable optimizations
919 dnl
920 AC_ARG_ENABLE(optimizations,
921   [AS_HELP_STRING([--disable-optimizations],
922     [disable compiler optimizations (default enabled)])],,
923   [enable_optimizations="yes"])
924
925 dnl Check for various optimization flags
926 AS_IF([test "${enable_optimizations}" != "no"], [
927
928   dnl -O4 and -O3 only in production builds
929   AS_IF([test "{enable_debug}" = "no"], [
930     VLC_SAVE_FLAGS
931     CFLAGS="${CFLAGS} -O4"
932     CXXFLAGS="${CXXFLAGS} -O4"
933     OBJCFLAGS="${OBJCFLAGS} -O4"
934     AC_CACHE_CHECK([if $CC accepts -O4], [ac_cv_c_o4], [
935       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
936         ac_cv_c_o4=yes
937       ], [
938         ac_cv_c_o4=no
939       ])
940     ])
941     AS_IF([test "${ac_cv_c_o4}" = "no"], [
942       VLC_RESTORE_FLAGS
943       CFLAGS="${CFLAGS} -O3"
944       CXXFLAGS="${CXXFLAGS} -O3"
945       OBJCFLAGS="${OBJCFLAGS} -O3"
946       AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
947         AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
948           ac_cv_c_o3=yes
949         ], [
950           ac_cv_c_o3=no
951         ])
952       ])
953       AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
954     ])
955   ])
956
957   dnl Check for -ffast-math
958   VLC_SAVE_FLAGS
959   CFLAGS="${CFLAGS} -ffast-math"
960   CXXFLAGS="${CXXFLAGS} -ffast-math"
961   OBJCFLAGS="${OBJCFLAGS} -ffast-math"
962   AC_CACHE_CHECK([if $CC accepts -ffast-math], [ac_cv_c_fast_math], [
963     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
964       ac_cv_c_fast_math=yes
965     ], [
966       ac_cv_c_fast_math=no
967     ])
968   ])
969   AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
970   AH_BOTTOM([
971 #ifndef __FAST_MATH__
972 # pragma STDC FENV_ACCESS OFF
973 # pragma STDC FP_CONTRACT ON
974 #endif
975 ])
976
977   dnl Check for -funroll-loops
978   VLC_SAVE_FLAGS
979   CFLAGS="${CFLAGS} -funroll-loops"
980   CXXFLAGS="${CXXFLAGS} -funroll-loops"
981   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
982   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
983     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
984       ac_cv_c_unroll_loops=yes
985     ], [
986       ac_cv_c_unroll_loops=no
987     ])
988   ])
989   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
990
991   AS_IF([test "$enable_debug" = "no"], [
992     dnl Check for -fomit-frame-pointer
993     VLC_SAVE_FLAGS
994     CFLAGS="${CFLAGS} -fomit-frame-pointer"
995     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
996     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
997     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
998       [ac_cv_c_omit_frame_pointer], [
999       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1000         ac_cv_c_omit_frame_pointer=yes
1001       ], [
1002         ac_cv_c_omit_frame_pointer=no
1003       ])
1004     ])
1005     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1006   ])
1007 ])
1008
1009 VLC_SAVE_FLAGS
1010 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1011 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1012   AC_TRY_LINK([],, [
1013     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1014   ], [
1015     ac_cv_ld_bsymbolic=""
1016   ])
1017 ])
1018 VLC_RESTORE_FLAGS
1019 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1020 AC_SUBST(SYMBOLIC_LDFLAGS)
1021
1022 dnl Check for Darwin plugin linking flags
1023 AS_IF([test "${SYS}" = "darwin"], [
1024   VLC_SAVE_FLAGS
1025   CFLAGS="${CFLAGS} -bundle -undefined error"
1026   AC_CACHE_CHECK([if $CC accepts -bundle -undefined error],
1027     [ac_cv_ld_darwin], [
1028     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1029       ac_cv_ld_darwin=yes
1030     ], [
1031       ac_cv_ld_darwin=no
1032     ])
1033   ])
1034   AS_IF([test "${ac_cv_ld_darwin}" != "no"], [
1035     VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
1036   ])
1037   VLC_RESTORE_FLAGS
1038 ])
1039
1040 dnl Checks for __attribute__(aligned()) directive
1041 VLC_SAVE_FLAGS
1042 CFLAGS="${CFLAGS} -Werror"
1043 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1044     [ac_cv_c_attribute_aligned],
1045     [ac_cv_c_attribute_aligned=0
1046     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1047         AC_TRY_COMPILE([],
1048         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1049         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1050     done])
1051 VLC_RESTORE_FLAGS
1052 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1053     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1054         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1055 fi
1056
1057 dnl Check for __attribute__((packed))
1058 AC_CACHE_CHECK([for __attribute__((packed))],
1059   [ac_cv_c_attribute_packed],
1060   [ac_cv_c_attribute_packed=no
1061    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1062                     [ac_cv_c_attribute_packed=yes])])
1063 if test "${ac_cv_c_attribute_packed}" != "no"; then
1064   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1065 fi
1066
1067 dnl
1068 dnl  Check the CPU
1069 dnl
1070 case "${host_cpu}" in
1071   "")
1072     ARCH=unknown
1073     ;;
1074   *)
1075     ARCH="${host_cpu}"
1076     ;;
1077 esac
1078
1079 dnl Check for backtrace() support
1080 AC_CHECK_HEADERS(execinfo.h)
1081 AC_CHECK_FUNCS(backtrace)
1082
1083 dnl
1084 dnl  default modules
1085 dnl
1086 ALIASES="${ALIASES} cvlc rvlc"
1087
1088 dnl
1089 dnl  Accelerated modules
1090 dnl
1091
1092 dnl  Check for fully working MMX intrinsics
1093 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1094 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1095 AC_ARG_ENABLE(mmx,
1096   [AS_HELP_STRING([--disable-mmx],
1097     [disable MMX optimizations (default auto)])],,[
1098   case "${host_cpu}" in
1099     i?86|x86_64)
1100       enable_mmx="yes"
1101       ;;
1102     *)
1103       enable_mmx="no"
1104       ;;
1105   esac
1106 ])
1107 have_mmx="no"
1108 have_mmxext="no"
1109 AS_IF([test "${enable_mmx}" != "no"], [
1110   ARCH="${ARCH} mmx"
1111   VLC_SAVE_FLAGS
1112   CFLAGS="${CFLAGS} -mmmx"
1113   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1114     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1115 [#include <mmintrin.h>
1116 #include <stdint.h>
1117 uint64_t frobzor;]], [
1118 [__m64 a, b, c;
1119 a = b = c = (__m64)frobzor;
1120 a = _mm_slli_pi16(a, 3);
1121 a = _mm_adds_pi16(a, b);
1122 c = _mm_srli_pi16(c, 8);
1123 c = _mm_slli_pi16(c, 3);
1124 b = _mm_adds_pi16(b, c);
1125 a = _mm_unpacklo_pi8(a, b);
1126 frobzor = (uint64_t)a;]])], [
1127       ac_cv_c_mmx_intrinsics=yes
1128     ], [
1129       ac_cv_c_mmx_intrinsics=no
1130     ])
1131   ])
1132   VLC_RESTORE_FLAGS
1133   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1134     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1135   ])
1136
1137   VLC_SAVE_FLAGS
1138   CFLAGS="${CFLAGS} -mmmx"
1139   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1140     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1141 void *p;
1142 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1143 ]])
1144     ], [
1145       ac_cv_mmx_inline=yes
1146     ], [
1147       ac_cv_mmx_inline=no
1148     ])
1149   ])
1150   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1151     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1152     have_mmx="yes"
1153   ])
1154
1155   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1156                  [ac_cv_mmxext_inline], [
1157     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1158 void *p;
1159 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1160 ]])
1161     ], [
1162       ac_cv_mmxext_inline=yes
1163     ], [
1164       ac_cv_mmxext_inline=no
1165     ])
1166   ])
1167   VLC_RESTORE_FLAGS
1168   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1169     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1170     have_mmxext="yes"
1171   ])
1172 ])
1173 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1174 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1175
1176 dnl  Check for fully workin SSE2 intrinsics
1177 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1178 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1179 AC_ARG_ENABLE(sse,
1180   [AS_HELP_STRING([--disable-sse],
1181     [disable SSE (1-4) optimizations (default auto)])],, [
1182   case "${host_cpu}" in
1183     i?86|x86_64)
1184       enable_sse=yes
1185       ;;
1186     *)
1187       enable_sse=no
1188       ;;
1189   esac
1190 ])
1191 have_sse2="no"
1192 AS_IF([test "${enable_sse}" != "no"], [
1193   ARCH="${ARCH} sse sse2"
1194
1195   VLC_SAVE_FLAGS
1196   CFLAGS="${CFLAGS} -msse2"
1197   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1198     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1199 [#include <emmintrin.h>
1200 #include <stdint.h>
1201 uint64_t frobzor;]], [
1202 [__m128i a, b, c;
1203 a = b = c = _mm_set1_epi64((__m64)frobzor);
1204 a = _mm_slli_epi16(a, 3);
1205 a = _mm_adds_epi16(a, b);
1206 c = _mm_srli_epi16(c, 8);
1207 c = _mm_slli_epi16(c, 3);
1208 b = _mm_adds_epi16(b, c);
1209 a = _mm_unpacklo_epi8(a, b);
1210 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1211       ac_cv_c_sse2_intrinsics=yes
1212     ], [
1213       ac_cv_c_sse2_intrinsics=no
1214     ])
1215   ])
1216   VLC_RESTORE_FLAGS
1217   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1218     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1219   ])
1220
1221   VLC_SAVE_FLAGS
1222   CFLAGS="${CFLAGS} -msse"
1223   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1224     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1225 void *p;
1226 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1227 ]])
1228     ], [
1229       ac_cv_sse_inline=yes
1230     ], [
1231       ac_cv_sse_inline=no
1232     ])
1233   ])
1234
1235   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1236     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1237   ])
1238
1239   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1240     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1241 void *p;
1242 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1243 ]])
1244     ], [
1245       ac_cv_sse2_inline=yes
1246     ], [
1247       ac_cv_sse2_inline=no
1248     ])
1249   ])
1250   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1251     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1252     have_sse2="yes"
1253   ])
1254
1255   # SSE3
1256   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1257     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1258 void *p;
1259 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1260 ]])
1261     ], [
1262       ac_cv_sse3_inline=yes
1263     ], [
1264       ac_cv_sse3_inline=no
1265     ])
1266   ])
1267
1268   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1269     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1270   # SSSE3
1271   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1272     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1273 void *p;
1274 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1275 ]])
1276     ], [
1277       ac_cv_ssse3_inline=yes
1278     ], [
1279       ac_cv_ssse3_inline=no
1280     ])
1281   ])
1282
1283   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1284     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1285
1286   # SSE4.1
1287   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1288                  [ac_cv_sse4_1_inline], [
1289     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1290 void *p;
1291 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1292 ]])
1293     ], [
1294       ac_cv_sse4_1_inline=yes
1295     ], [
1296       ac_cv_sse4_1_inline=no
1297     ])
1298   ])
1299
1300   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1301     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1302
1303   # SSE4.2
1304   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1305                  [ac_cv_sse4_2_inline], [
1306     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1307 void *p;
1308 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1309 ]])
1310     ], [
1311       ac_cv_sse4_2_inline=yes
1312     ], [
1313       ac_cv_sse4_2_inline=no
1314     ])
1315   ])
1316
1317   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1318     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1319
1320   # SSE4A
1321   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1322     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1323 void *p;
1324 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1325 ]])
1326     ], [
1327       ac_cv_sse4a_inline=yes
1328     ], [
1329       ac_cv_sse4a_inline=no
1330     ])
1331   ])
1332   VLC_RESTORE_FLAGS
1333   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1334     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1335 ])
1336 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1337
1338 VLC_SAVE_FLAGS
1339 CFLAGS="${CFLAGS} -mmmx"
1340 have_3dnow="no"
1341 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1342   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1343 void *p;
1344 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1345 ]])
1346   ], [
1347     ac_cv_3dnow_inline=yes
1348   ], [
1349     ac_cv_3dnow_inline=no
1350   ])
1351 ])
1352 VLC_RESTORE_FLAGS
1353 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1354   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1355             [Define to 1 if 3D Now! inline assembly is available.])
1356   have_3dnow="yes"
1357 ])
1358 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1359
1360
1361 AC_ARG_ENABLE(neon,
1362   [AS_HELP_STRING([--disable-neon],
1363     [disable NEON optimizations (default auto)])],, [
1364   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1365 ])
1366 AS_IF([test "${enable_neon}" != "no"], [
1367   VLC_SAVE_FLAGS
1368   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1369   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1370     AC_COMPILE_IFELSE([
1371       AC_LANG_PROGRAM(,[[
1372 asm volatile("vqmovun.s64 d0, q1":::"d0");
1373 ]])
1374     ], [
1375       ac_cv_arm_neon="yes"
1376     ], [
1377       ac_cv_arm_neon="no"
1378     ])
1379   ])
1380   VLC_RESTORE_FLAGS
1381 ])
1382 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1383
1384
1385 AC_ARG_ENABLE(altivec,
1386   [AS_HELP_STRING([--disable-altivec],
1387     [disable AltiVec optimizations (default auto)])],, [
1388   AS_CASE("${host_cpu}", [powerpc*],
1389         [enable_altivec=yes], [enable_altivec=no])
1390 ])
1391 have_altivec="no"
1392 ALTIVEC_CFLAGS=""
1393 AS_IF([test "${enable_altivec}" = "yes"], [
1394   ARCH="${ARCH} altivec";
1395   VLC_SAVE_FLAGS
1396   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1397     [ac_cv_altivec_inline],
1398     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1399          ac_cv_altivec_inline="yes",
1400          [CFLAGS="${CFLAGS} -Wa,-m7400"
1401           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1402             [ac_cv_altivec_inline="-Wa,-m7400"],
1403             ac_cv_altivec_inline=no)
1404          ])])
1405   VLC_RESTORE_FLAGS
1406   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1407     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1408               [Define to 1 if AltiVec inline assembly is available.])
1409     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1410       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1411       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1412     ])
1413     have_altivec="yes"
1414   ])
1415
1416 dnl The AltiVec C extensions
1417 dnl
1418 dnl There are several possible cases:
1419 dnl - OS X PPC, gcc 4.x: use -mpim-altivec -force_cpusubtype_ALL, don't
1420 dnl                      need <altivec.h>
1421 dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
1422 dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
1423 dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
1424 dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
1425 dnl - Others: test should fail
1426   VLC_SAVE_FLAGS
1427   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1428   [ac_cv_c_altivec],
1429   [# OS X/PPC test (gcc 4.x)
1430    CFLAGS="${CFLAGS} -mpim-altivec -force_cpusubtype_ALL"
1431    AC_TRY_COMPILE([vector unsigned char foo;],
1432      [vec_ld(0, (unsigned char *)0);],
1433      [ac_cv_c_altivec="-mpim-altivec -force_cpusubtype_ALL"],
1434      [# OS X/PPC test (gcc 3.x)
1435       CFLAGS="${CFLAGS} -faltivec"
1436       AC_TRY_COMPILE([vector unsigned char foo;],
1437         [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
1438         [ac_cv_c_altivec="-faltivec"],
1439         dnl Below this are the Linux tests
1440         [# Linux/PPC test (gcc 4.x)
1441          CFLAGS="${CFLAGS} -maltivec"
1442          AC_TRY_COMPILE([#include <altivec.h>],
1443            [vec_ld(0, (unsigned char *)0);],
1444            [ac_cv_c_altivec="-maltivec"],
1445            [# Linux/PPC test (gcc 3.3)
1446             CFLAGS="${CFLAGS} -maltivec -mabi=altivec"
1447             AC_TRY_COMPILE([#include <altivec.h>],
1448               [vec_ld(0, (unsigned char *)0);],
1449               [ac_cv_c_altivec=""
1450                ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
1451               [# Linux/PPC test (gcc 3.3)
1452                CFLAGS="${CFLAGS} -fvec"
1453                AC_TRY_COMPILE([#include <altivec.h>],
1454                  [vec_ld(0, (unsigned char *)0);],
1455                  [ac_cv_c_altivec="-fvec"],
1456                  [ac_cv_c_altivec=no])
1457               ])
1458            ])
1459         ])
1460      ])
1461   ])
1462
1463   VLC_RESTORE_FLAGS
1464   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1465     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1466     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1467     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1468     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1469     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1470     have_altivec="yes"
1471   ])
1472   AC_CHECK_HEADERS(altivec.h)
1473
1474   VLC_SAVE_FLAGS
1475   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1476   AC_CACHE_CHECK([if linker needs -framework vecLib],
1477     [ac_cv_ld_altivec],
1478     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1479   VLC_RESTORE_FLAGS
1480   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1481     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1482   ])
1483 ])
1484 AC_SUBST(ALTIVEC_CFLAGS)
1485 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1486
1487 dnl
1488 dnl  Memory usage
1489 dnl
1490 AC_ARG_ENABLE(optimize-memory,
1491   [AS_HELP_STRING([--enable-optimize-memory],
1492     [optimize memory usage over performance])])
1493 if test "${enable_optimize_memory}" = "yes"; then
1494   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1495 fi
1496
1497 dnl
1498 dnl Allow running as root (useful for people running on embedded platforms)
1499 dnl
1500 AC_ARG_ENABLE(run-as-root,
1501   [AS_HELP_STRING([--enable-run-as-root],
1502     [allow running VLC as root (default disabled)])])
1503 AS_IF([test "${enable_run_as_root}" = "yes"],[
1504     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1505               [Define to 1 to allow running VLC as root (uid 0).])
1506 ])
1507
1508 dnl
1509 dnl Stream output
1510 dnl
1511 AC_ARG_ENABLE(sout,
1512   [AS_HELP_STRING([--disable-sout],
1513     [disable streaming output (default enabled)])])
1514 AS_IF([test "${enable_sout}" != "no"], [
1515   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1516 ])
1517 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1518
1519 dnl Lua modules
1520 AC_ARG_ENABLE(lua,
1521   [AS_HELP_STRING([--disable-lua],
1522     [disable LUA scripting support (default enabled)])])
1523 if test "${enable_lua}" != "no"
1524 then
1525   PKG_CHECK_MODULES(LUA, lua5.2,
1526     [ have_lua=yes ],
1527     [
1528     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1529
1530     PKG_CHECK_MODULES(LUA, lua5.1,
1531       [ have_lua=yes ],
1532       [
1533       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1534       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1535         [ have_lua=yes ],
1536         [
1537           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1538           have_lua=yes
1539           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1540             [],
1541             [ have_lua=no ] )
1542           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1543             [LUA_LIBS="-llua5.2"],
1544           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1545             [LUA_LIBS="-llua5.1"],
1546             AC_CHECK_LIB( lua51 , luaL_newstate,
1547               [LUA_LIBS="-llua51"],
1548               AC_CHECK_LIB( lua , luaL_newstate,
1549                 [LUA_LIBS="-llua"],
1550                 [ have_lua=no
1551                 ], [-lm])
1552             )))
1553         ])
1554       ])
1555     ])
1556   if test "x${have_lua}" = "xyes" ;  then
1557      VLC_ADD_LIBS([lua],[$LUA_LIBS])
1558      VLC_ADD_CFLAGS([lua],[$LUA_CFLAGS])
1559   else
1560       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.])
1561   fi
1562   AC_ARG_VAR([LUAC], [LUA byte compiler])
1563   AC_PATH_PROGS(LUAC,[${LUAC} luac], [false])
1564   AS_IF([test "${LUAC}" = "false"], [
1565     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1566   ])
1567   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], [
1568     AC_MSG_ERROR([You need 32-bits luac when using using lua from contrib.])
1569   ])
1570 fi
1571 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1572
1573
1574 dnl
1575 dnl HTTP daemon
1576 dnl
1577 AC_ARG_ENABLE(httpd,
1578   [AS_HELP_STRING([--disable-httpd],
1579     [disable the built-in HTTP server (default enabled)])])
1580 if test "${enable_httpd}" != "no"
1581 then
1582   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1583 fi
1584 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1585
1586
1587 dnl
1588 dnl VideoLAN manager
1589 dnl
1590 AC_ARG_ENABLE(vlm,
1591   [AS_HELP_STRING([--disable-vlm],
1592     [disable the stream manager (default enabled)])],,
1593   [enable_vlm="${enable_sout}"])
1594 AS_IF([test "${enable_vlm}" != "no"], [
1595   AS_IF([test "${enable_sout}" = "no"], [
1596     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1597   ])
1598   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1599 ])
1600 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1601
1602
1603 dnl
1604 dnl  Input plugins
1605 dnl
1606
1607 EXTEND_HELP_STRING([Input plugins:])
1608
1609 dnl
1610 dnl  live555 input
1611 dnl
1612 AC_ARG_ENABLE(live555,
1613   [AS_HELP_STRING([--enable-live555],
1614     [enable RTSP input through live555 (default enabled)])])
1615
1616 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1617   PKG_CHECK_MODULES(LIVE555, live555, [
1618     VLC_ADD_PLUGIN([live555])
1619     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1620     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1621   ], [
1622     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1623
1624     AC_LANG_PUSH(C++)
1625     VLC_SAVE_FLAGS
1626
1627     dnl detect include paths
1628     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1629       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1630     ], [
1631       AS_IF([test "${SYS}" != "os2"], [
1632         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1633         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1634       ], [
1635         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1636         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1637         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1638       ])
1639     ])
1640
1641     dnl CPP Flags
1642     AS_IF([test "${SYS}" = "solaris"], [
1643       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1644     ])
1645     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1646     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1647
1648     dnl version check
1649     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1650       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1651 [#include <liveMedia_version.hh>
1652 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1653 # error BOOM
1654 #endif]])
1655       ], [
1656         ac_cv_live555="yes"
1657       ], [
1658         ac_cv_live555="no"
1659       ])
1660     ])
1661
1662     AS_IF([test "$ac_cv_live555" = "no"], [
1663       AC_MSG_WARN([live555 is missing or its installed version is too old:
1664 Version 2011.12.23 or later is required to proceed.
1665 You can get an updated one from http://www.live555.com/liveMedia .])
1666       AS_IF([test -n "${enable_live555}"], [
1667         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1668       ])
1669     ], [
1670       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1671       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1672       AS_IF([test "${SYS}" = "mingw32"], [
1673         # add ws2_32 for closesocket, select, recv
1674         other_libs="$other_libs -lws2_32"
1675       ])
1676
1677       dnl We need to check for pic because live555 don't provide shared libs
1678       dnl and we want to build a plugins so we need -fPIC on some arch.
1679       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1680       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1681       AC_CHECK_LIB(liveMedia_pic, main, [
1682         VLC_ADD_PLUGIN([live555])
1683         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1684       ],[
1685         AC_CHECK_LIB(liveMedia, main, [
1686           VLC_ADD_PLUGIN([live555])
1687           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1688         ],[],[${other_libs}])
1689       ],[${other_libs_pic}])
1690     ])
1691     VLC_RESTORE_FLAGS
1692     AC_LANG_POP(C++)
1693   ])
1694 ])
1695
1696 dnl
1697 dnl IIDC and DV FireWire input modules
1698 dnl
1699 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1700 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1701
1702 dnl
1703 dnl - linsys modules: access module check for libzvbi
1704 dnl
1705 AC_ARG_ENABLE(linsys,
1706   [AS_HELP_STRING([--enable-linsys],
1707     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1708 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1709   VLC_ADD_PLUGIN([linsys_hdsdi])
1710   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1711     VLC_ADD_PLUGIN([linsys_sdi])
1712   ], [
1713     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1714   ])
1715 ])
1716
1717 dnl
1718 dnl dvdread module: check for libdvdread
1719 dnl
1720 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread], [dvdread input module], [auto])
1721
1722 dnl
1723 dnl libdvdnav plugin
1724 dnl
1725 AC_ARG_ENABLE(dvdnav,
1726   [AS_HELP_STRING([--disable-dvdnav],
1727     [disable DVD navigation with libdvdnav (default auto)])])
1728 AS_IF([test "${enable_dvdnav}" != "no"], [
1729   PKG_CHECK_MODULES(DVDNAV, dvdnav, [
1730     VLC_ADD_PLUGIN([dvdnav])
1731     AC_CHECK_LIB(dvdnav, dvdnav_get_video_resolution,
1732       AC_DEFINE(HAVE_DVDNAV_GET_VIDEO_RESOLUTION, 1, [Define if you have dvdnav_get_video_resolution.]),
1733         [], [${LIBS_dvdnav}])
1734     AC_CHECK_LIB(dvdnav, dvdnav_describe_title_chapters,
1735       AC_DEFINE(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS, 1, [Define if you have dvdnav_describe_title_chapters.]),
1736         [], [${LIBS_dvdnav}])],
1737       [AC_MSG_WARN([${DVDNAV_PKG_ERRORS}.])])
1738 ])
1739
1740 dnl
1741 dnl  Blu-ray Disc Support with libbluray
1742 dnl
1743 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2.1], (libbluray for Blu-ray disc support ) )
1744
1745 dnl
1746 dnl  OpenCV wrapper and example filters
1747 dnl
1748 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1749
1750
1751 dnl
1752 dnl  libsmbclient plugin
1753 dnl
1754 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1755 AS_IF([test "${SYS}" = "mingw32"], [ VLC_ADD_PLUGIN([access_smb]) ])
1756
1757
1758 dnl
1759 dnl sftp access support
1760 dnl
1761 PKG_ENABLE_MODULES_VLC([SFTP], [access_sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1762
1763 dnl
1764 dnl  Video4Linux 2
1765 dnl
1766 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1767   [disable Video4Linux version 2 (default auto)])])
1768 have_v4l2="no"
1769 AS_IF([test "$enable_v4l2" != "no"], [
1770   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1771     have_v4l2="yes"
1772   ])
1773 ])
1774 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1775
1776 dnl
1777 dnl special access module for Blackmagic SDI cards
1778 dnl
1779 AC_ARG_ENABLE(decklink,
1780   [AS_HELP_STRING([--disable-decklink],
1781     [disable Blackmagic DeckLink SDI input (default auto)])])
1782 AC_ARG_WITH(decklink_sdk,
1783   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1784     [                        location of Blackmagic DeckLink SDI SDK])])
1785 have_decklink=no
1786 if test "${enable_decklink}" != "no"
1787 then
1788   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1789   then
1790     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1791   fi
1792   VLC_SAVE_FLAGS
1793   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1794   AC_LANG_PUSH(C++)
1795   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1796       have_decklink=yes
1797   ], [
1798       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1799   ])
1800   AC_LANG_POP(C++)
1801   VLC_RESTORE_FLAGS
1802 fi
1803 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1804
1805
1806 dnl
1807 dnl  gnomeVFS access module
1808 dnl
1809 PKG_ENABLE_MODULES_VLC([GNOMEVFS], [gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
1810
1811 dnl
1812 dnl  VCDX modules
1813 dnl
1814 PKG_ENABLE_MODULES_VLC([VCDX], [vcdx], [libcdio >= 0.78.2 libiso9660 >= 0.72 libvcdinfo >= 0.7.22], [navigate VCD with libvcdinfo], [no])
1815
1816 dnl
1817 dnl  Built-in CD-DA and VCD module
1818 dnl
1819 AC_ARG_ENABLE(vcd,
1820   [AS_HELP_STRING([--disable-vcd],
1821     [disable built-in VCD and CD-DA support (default enabled)])])
1822
1823 AC_ARG_ENABLE(libcddb,
1824   [AS_HELP_STRING([--disable-libcddb],
1825     [disable CDDB for Audio CD (default enabled)])])
1826
1827 if test "${enable_vcd}" != "no"
1828 then
1829   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1830   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1831     AC_MSG_RESULT(yes)
1832     VLC_ADD_PLUGIN([vcd cdda])
1833   ],[
1834     AC_MSG_RESULT(no)
1835   ])
1836
1837   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1838   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1839     AC_MSG_RESULT(yes)
1840     VLC_ADD_PLUGIN([vcd cdda])
1841     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1842   ],[
1843     AC_MSG_RESULT(no)
1844   ])
1845
1846   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1847   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1848     AC_MSG_RESULT(yes)
1849     VLC_ADD_PLUGIN([vcd cdda])
1850     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1851   ],[
1852     AC_MSG_RESULT(no)
1853   ])
1854
1855   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2"
1856   then
1857     VLC_ADD_PLUGIN([vcd cdda])
1858   fi
1859
1860   if test "${SYS}" = "darwin"
1861   then
1862     VLC_ADD_PLUGIN([vcd cdda])
1863     VLC_ADD_LIBS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
1864   fi
1865
1866   if test "$enable_libcddb" != "no"; then
1867     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1868       HAVE_LIBCDDB=yes
1869       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1870       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1871       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1872       ],:
1873       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1874       HAVE_LIBCDDB=no])
1875   fi
1876 fi
1877
1878 dnl
1879 dnl Linux DVB
1880 dnl
1881 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1882   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1883 [#include <linux/dvb/version.h>
1884 #if (DVB_API_VERSION < 5)
1885 # error Linux DVB API v3.2 and older are not supported.
1886 #endif
1887 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1888 # error Linux DVB API v5.0 is unsupported. Please update.
1889 #endif
1890 ]])], [
1891   ac_cv_linux_dvb_5_1=yes
1892 ], [
1893   ac_cv_linux_dvb_5_1=no
1894 ])])
1895 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1896
1897 dnl
1898 dnl  Screen capture module
1899 dnl
1900 AC_ARG_ENABLE(screen,
1901   [AS_HELP_STRING([--enable-screen],
1902     [disable screen capture (default enabled)])])
1903 if test "${enable_screen}" != "no"; then
1904   if test "${SYS}" = "darwin"; then
1905     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1906       VLC_ADD_PLUGIN([screen])
1907     ])
1908   fi
1909 fi
1910 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1911
1912 dnl
1913 dnl  VNC/RFB access module
1914 dnl
1915 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1916
1917 dnl  RDP/Remote Desktop access module
1918 dnl
1919 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1920
1921 dnl
1922 dnl  Real RTSP plugin
1923 dnl
1924 AC_ARG_ENABLE(realrtsp,
1925   [  --enable-realrtsp       Real RTSP module (default disabled)])
1926 if test "${enable_realrtsp}" = "yes"; then
1927   VLC_ADD_PLUGIN([access_realrtsp])
1928 fi
1929
1930 dnl
1931 dnl MacOS eyeTV
1932 AC_ARG_ENABLE(macosx-eyetv,
1933   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1934 if test "x${enable_macosx_eyetv}" != "xno" &&
1935   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1936 then
1937   VLC_ADD_PLUGIN([access_eyetv])
1938 fi
1939
1940 dnl
1941 dnl QTKit
1942 AC_ARG_ENABLE(macosx-qtkit,
1943   [  --enable-macosx-qtkit Mac OS X qtcapture (video) and qtsound (audio) module (default enabled on Mac OS X)])
1944 if test "x${enable_macosx_qtkit}" != "xno" &&
1945   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1946 then
1947   VLC_ADD_PLUGIN([qtcapture])
1948   VLC_ADD_PLUGIN([qtsound])
1949 fi
1950 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1951
1952 dnl
1953 dnl AVFoundation
1954 AC_SUBST(have_avfoundation, ["no"])
1955 AC_ARG_ENABLE(macosx-avfoundation,
1956   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
1957 if test "x${enable_macosx_avfoundation}" != "xno" &&
1958   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
1959 then
1960   SAVED_LIBS="${LIBS}"
1961   LIBS="-framework AVFoundation"
1962   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
1963   LIBS="${SAVED_LIBS}"
1964   if test "${have_avfoundation}" != "no"
1965   then
1966     VLC_ADD_PLUGIN([avcapture])
1967   fi
1968 fi
1969 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
1970
1971 dnl
1972 dnl  Demux plugins
1973 dnl
1974
1975 EXTEND_HELP_STRING([Mux/Demux plugins:])
1976
1977 dnl
1978 dnl  libdvbpsi check for ts mux/demux
1979 dnl
1980 have_dvbpsi="no"
1981 PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
1982 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1983
1984
1985 dnl
1986 dnl  GME demux plugin
1987 dnl
1988 AC_ARG_ENABLE(gme,
1989   [AS_HELP_STRING([--enable-gme],
1990     [use Game Music Emu (default auto)])])
1991 AS_IF([test "${enable_gme}" != "no"], [
1992   AC_CHECK_HEADER([gme/gme.h], [
1993     VLC_ADD_LIBS([gme], [-lgme])
1994     VLC_ADD_PLUGIN([gme])
1995   ], [
1996     AS_IF([test "x${enable_gme}" != "x"], [
1997       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
1998     ])
1999   ])
2000 ])
2001
2002
2003 dnl
2004 dnl  SIDPlay plugin
2005 dnl
2006 AC_ARG_ENABLE(sid,
2007     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2008 AS_IF([test "${enable_sid}" != "no"], [
2009     PKG_CHECK_MODULES(SID, [libsidplay2], [
2010         AC_LANG_PUSH(C++)
2011         oldCPPFLAGS="$CPPFLAGS"
2012         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2013         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2014             VLC_ADD_PLUGIN([sid])
2015             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2016             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2017         ], [
2018             AS_IF([test -n "${enable_sid}"],
2019                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2020                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2021                 )
2022         ])
2023         CPPFLAGS="$oldCPPFLAGS"
2024         AC_LANG_POP(C++)
2025     ], [
2026         AS_IF([test "x${enable_sid}" = "xyes"],
2027             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2028             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2029             )
2030     ])
2031 ])
2032
2033
2034 dnl
2035 dnl  ogg demux plugin
2036 dnl
2037 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
2038 if test "${enable_sout}" != "no"; then
2039     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg mux support], [auto])
2040 dnl Check for libshout
2041     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2042 fi
2043
2044 dnl
2045 dnl  matroska demux plugin
2046 dnl
2047 AC_ARG_ENABLE(mkv,
2048   [AS_HELP_STRING([--disable-mkv],
2049     [do not use libmatroska (default auto)])])
2050 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2051   AC_LANG_PUSH(C++)
2052   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2053     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2054     AC_EGREP_CPP(yes,
2055       [#include <ebml/EbmlVersion.h>
2056        #ifdef LIBEBML_VERSION
2057        #if LIBEBML_VERSION >= 0x010000
2058        yes
2059        #endif
2060        #endif],
2061       [AC_MSG_RESULT([yes])
2062         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2063           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2064           AC_EGREP_CPP(yes,
2065             [#include <matroska/KaxVersion.h>
2066              #ifdef LIBMATROSKA_VERSION
2067              #if LIBMATROSKA_VERSION >= 0x010000
2068              yes
2069              #endif
2070              #endif],
2071             [AC_MSG_RESULT([yes])
2072               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2073               AC_CHECK_LIB(ebml_pic, main, [
2074                 VLC_ADD_PLUGIN([mkv])
2075                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2076               ],[
2077                 AC_CHECK_LIB(ebml, main, [
2078                   VLC_ADD_PLUGIN([mkv])
2079                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2080                 ])
2081               ])
2082             ], [
2083               AC_MSG_RESULT([no])
2084               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.])
2085           ])
2086         ])
2087       ],
2088       [AC_MSG_RESULT([no])
2089         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.])
2090     ])
2091   ])
2092   AC_LANG_POP(C++)
2093 fi
2094
2095 dnl
2096 dnl  modplug demux plugin
2097 dnl
2098 AC_ARG_ENABLE(mod,
2099   [AS_HELP_STRING([--disable-mod],
2100     [do not use libmodplug (default auto)])])
2101 if test "${enable_mod}" != "no" ; then
2102     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2103           VLC_ADD_PLUGIN([mod])
2104           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2105           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2106     ],[
2107        AS_IF([test -n "${enable_mod}"],
2108          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2109          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2110     ])
2111 fi
2112
2113 dnl
2114 dnl  mpc demux plugin
2115 dnl
2116 AC_ARG_ENABLE(mpc,
2117   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2118 if test "${enable_mpc}" != "no"
2119 then
2120   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2121     VLC_ADD_PLUGIN([mpc])
2122     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2123     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2124     VLC_ADD_PLUGIN([mpc])
2125     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2126 fi
2127
2128 dnl
2129 dnl  Codec plugins
2130 dnl
2131
2132 EXTEND_HELP_STRING([Codec plugins:])
2133
2134 dnl
2135 dnl wmafixed plugin
2136 dnl
2137 AC_ARG_ENABLE(wma-fixed,
2138   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2139 if test "${enable_wma_fixed}" = "yes"
2140 then
2141   VLC_ADD_PLUGIN([wma_fixed])
2142 fi
2143
2144 dnl
2145 dnl shine fixed point mp3 encoder
2146 dnl
2147 AC_ARG_ENABLE(shine,
2148   [  --enable-shine          shine mp3 encoding module (default disabled)])
2149 if test "${enable_shine}" = "yes"
2150 then
2151   VLC_ADD_PLUGIN([shine])
2152 fi
2153
2154 dnl
2155 dnl openmax il codec plugin
2156 dnl
2157 AC_ARG_ENABLE(omxil,
2158   [  --enable-omxil          openmax il codec module (default disabled)])
2159 if test "${enable_omxil}" = "yes"
2160 then
2161   VLC_ADD_PLUGIN([omxil])
2162 fi
2163
2164 dnl
2165 dnl openmax il vout plugin
2166 dnl
2167 AC_ARG_ENABLE(omxil-vout,
2168   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2169 if test "${enable_omxil_vout}" = "yes"
2170 then
2171   VLC_ADD_PLUGIN([omxil_vout])
2172 fi
2173
2174 dnl
2175 dnl raspberry pi openmax il configuration
2176 dnl
2177 AC_ARG_ENABLE(rpi-omxil,
2178   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2179 if test "${enable_rpi_omxil}" = "yes"
2180 then
2181   VLC_ADD_PLUGIN([omxil omxil_vout])
2182   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2183 fi
2184
2185 dnl
2186 dnl CrystalHD codec plugin
2187 dnl
2188 AC_ARG_ENABLE(crystalhd,
2189   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2190 if test "${enable_crystalhd}" != "no"; then
2191     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2192       VLC_ADD_PLUGIN([crystalhd])
2193       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2194     ],[
2195       if test "${SYS}" = "mingw32" ; then
2196         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2197           VLC_ADD_PLUGIN([crystalhd])
2198           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2199             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2200             ])
2201         ],[
2202           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2203                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2204                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2205         ],[#define __LINUX_USER__
2206                #include <libcrystalhd/bc_dts_types.h>
2207         ])
2208       fi
2209     ],[
2210        #include <libcrystalhd/bc_dts_types.h>
2211       ])
2212 fi
2213
2214 dnl
2215 dnl  mad plugin
2216 dnl
2217 AC_ARG_ENABLE(mad,
2218   [  --enable-mad            libmad module (default enabled)])
2219 if test "${enable_mad}" != "no"
2220 then
2221   AC_ARG_WITH(mad,
2222     [  --with-mad=PATH         path to libmad],[],[])
2223   if test "${with_mad}" != "no" -a -n "${with_mad}"
2224   then
2225     VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
2226     VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib])
2227   fi
2228
2229   AC_ARG_WITH(mad-tree,
2230     [  --with-mad-tree=PATH    mad tree for static linking],[],[])
2231   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
2232   then
2233     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
2234     if test -z "${real_mad_tree}"
2235     then
2236       dnl  The given directory can't be found
2237       AC_MSG_RESULT(no)
2238       AC_MSG_ERROR([${with_mad_tree} directory does not exist])
2239     fi
2240     dnl  Use a custom libmad
2241     AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
2242     if test -f ${real_mad_tree}/mad.h
2243     then
2244       AC_MSG_RESULT(yes)
2245       VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
2246       VLC_ADD_LIBS([mpgatofixed32],[-L${real_mad_tree}/.libs])
2247       VLC_SAVE_FLAGS
2248       LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2249       AC_CHECK_LIB(mad, mad_bit_init, [
2250         VLC_ADD_PLUGIN([mpgatofixed32])
2251         VLC_ADD_LIBS([mpgatofixed32],[-lmad])
2252         ],[ AC_MSG_ERROR([the specified tree has not been compiled ])
2253       ],[])
2254       VLC_RESTORE_FLAGS
2255     else
2256       AC_MSG_RESULT(no)
2257       AC_MSG_ERROR([the specified tree does not have mad.h])
2258     fi
2259   else
2260     VLC_SAVE_FLAGS
2261     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_mpgatofixed32}"
2262     LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2263     AC_CHECK_HEADERS(mad.h, ,
2264       [ 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.]) ])
2265     AC_CHECK_LIB(mad, mad_bit_init, [
2266       VLC_ADD_PLUGIN([mpgatofixed32])
2267       VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
2268       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
2269     VLC_RESTORE_FLAGS
2270   fi
2271 fi
2272
2273
2274 AC_ARG_ENABLE(merge-ffmpeg,
2275 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2276   enable_merge_ffmpeg="no"
2277 ])
2278 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2279
2280 dnl
2281 dnl  avcodec decoder/encoder plugin
2282 dnl
2283 AC_ARG_ENABLE(avcodec,
2284 [  --enable-avcodec        libavcodec codec (default enabled)])
2285 AS_IF([test "${enable_avcodec}" != "no"], [
2286   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
2287     dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
2288     dnl   AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
2289     dnl ])
2290     VLC_SAVE_FLAGS
2291     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2292     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2293     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2294     AC_CHECK_HEADERS(libavutil/avutil.h)
2295     VLC_RESTORE_FLAGS
2296     have_avcodec="yes"
2297   ],[
2298     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2299   ])
2300 ], [
2301   have_avcodec="no"
2302 ])
2303 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2304
2305 dnl
2306 dnl libva needs avcodec
2307 dnl
2308 AC_ARG_ENABLE(libva,
2309   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2310
2311 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2312   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2313 ])
2314 have_avcodec_vaapi="no"
2315 AS_IF([test "${enable_libva}" != "no" -a "${have_avcodec}" = "yes"], [
2316   PKG_CHECK_MODULES(LIBVA, [libva libva-x11], [
2317     VLC_SAVE_FLAGS
2318     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2319     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2320     AC_CHECK_HEADERS(libavcodec/vaapi.h, [
2321       AC_MSG_NOTICE([VAAPI acceleration activated])
2322       have_avcodec_vaapi="yes"
2323     ],[
2324       AS_IF([test -n "${enable_libva}"], [
2325         AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2326       ], [
2327         AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2328       ])
2329     ])
2330     VLC_RESTORE_FLAGS
2331   ],[
2332     AS_IF([test -n "${enable_libva}"], [
2333       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2334     ], [
2335       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2336     ])
2337   ])
2338 ])
2339 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2340
2341 dnl
2342 dnl dxva2 needs avcodec
2343 dnl
2344 AC_ARG_ENABLE(dxva2,
2345   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2346
2347 have_avcodec_dxva2="no"
2348 AS_IF([test "${enable_dxva2}" != "no"], [
2349   if test "${SYS}" = "mingw32"; then
2350   AS_IF([test "x${have_avcodec}" = "xyes"], [
2351     AC_CHECK_HEADERS(dxva2api.h,
2352       [
2353         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2354            AC_MSG_NOTICE([DxVA2 acceleration activated])
2355            have_avcodec_dxva2="yes"
2356         ],[
2357     AS_IF([test "${enable_dxva2}" = "yes"],
2358           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2359               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2360         ], [#undef _WIN32_WINNT
2361             /* DXVA2 is only available in Vista and above */
2362             #define _WIN32_WINNT 0x600])
2363       ],[
2364     AS_IF([test "${enable_dxva2}" = "yes"],
2365               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2366               [AC_MSG_WARN([dxva2api.h not found])])
2367       ])
2368   ],[
2369     AS_IF([test "x${enable_dxva2}" != "x"], [
2370       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2371     ])
2372   ])
2373   fi
2374 ])
2375 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2376
2377 dnl
2378 dnl vda needs avcodec
2379 dnl
2380 AC_ARG_ENABLE(vda,
2381   [  --enable-vda          VDA  support (default auto)])
2382
2383 have_avcodec_vda="no"
2384 AS_IF([test "${enable_vda}" != "no"], [
2385   if test "${SYS}" = "darwin"; then
2386   AS_IF([test "x${have_avcodec}" = "xyes"], [
2387     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2388       [
2389         AC_CHECK_HEADERS(libavcodec/vda.h, [
2390            have_avcodec_vda="yes"
2391         ],[
2392         AS_IF([test "${enable_vda}" = "yes"],
2393               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2394               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2395         ])
2396   ],[
2397         AS_IF([test "${enable_vda}" = "yes"],
2398               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2399               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2400       ])
2401   ],[
2402     AS_IF([test "x${enable_vda}" != "x"], [
2403       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2404     ])
2405  ])
2406   fi
2407 ])
2408 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2409
2410 dnl
2411 dnl  avformat demuxer/muxer plugin
2412 dnl
2413
2414 AC_ARG_ENABLE(avformat,
2415 [  --enable-avformat       libavformat containers (default enabled)],, [
2416   enable_avformat="${have_avcodec}"
2417 ])
2418 have_avformat="no"
2419 AS_IF([test "${enable_avformat}" != "no"], [
2420   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2421       have_avformat="yes"
2422       VLC_SAVE_FLAGS
2423       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2424       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2425       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2426       AC_CHECK_HEADERS(libavutil/avutil.h)
2427       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2428         have_avformat="no"
2429       ])
2430       VLC_RESTORE_FLAGS
2431     ],[
2432       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2433   ])
2434 ])
2435 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2436
2437 dnl
2438 dnl  swscale image scaling and conversion plugin
2439 dnl
2440
2441 AC_ARG_ENABLE(swscale,
2442   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2443           (default enabled)]))
2444 if test "${enable_swscale}" != "no"
2445 then
2446   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2447     [
2448       VLC_SAVE_FLAGS
2449       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2450       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2451       AC_CHECK_HEADERS(libswscale/swscale.h)
2452       VLC_ADD_PLUGIN([swscale])
2453       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2454       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2455       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2456         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2457       ])
2458       VLC_RESTORE_FLAGS
2459     ],[
2460       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2461   ])
2462 fi
2463
2464 dnl
2465 dnl  postproc plugin
2466 dnl
2467
2468 AC_ARG_ENABLE(postproc,
2469 [  --enable-postproc       libpostproc image post-processing (default auto)])
2470 if test "${enable_postproc}" != "no"
2471 then
2472   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2473     [
2474       VLC_SAVE_FLAGS
2475       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2476       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2477       AC_CHECK_HEADERS(postproc/postprocess.h)
2478       VLC_ADD_PLUGIN([postproc])
2479       VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS])
2480       VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS])
2481       VLC_RESTORE_FLAGS
2482     ],[
2483       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2484   ])
2485 fi
2486
2487 dnl
2488 dnl  faad decoder plugin
2489 dnl
2490 AC_ARG_ENABLE(faad,
2491 [  --enable-faad           faad codec (default auto)])
2492 if test "${enable_faad}" != "no"; then
2493   AC_ARG_WITH(faad-tree,  [  --with-faad-tree=PATH   faad tree for static linking])
2494   if test -n "${with_faad_tree}"; then
2495     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
2496     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
2497     if test -z "${real_faad_tree}"; then
2498       dnl  The given directory can't be found
2499       AC_MSG_RESULT(no)
2500       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
2501     fi
2502     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"; then
2503       dnl  Use the custom faad
2504       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
2505       VLC_ADD_PLUGIN([faad])
2506       VLC_ADD_LIBS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
2507       VLC_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
2508     else
2509       dnl  The given libfaad wasn't built
2510       AC_MSG_RESULT(no)
2511       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
2512     fi
2513   else
2514     VLC_SAVE_FLAGS
2515     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_faad}"
2516     LDFLAGS="${LDFLAGS} ${LIBS_faad}"
2517     AC_CHECK_HEADERS(faad.h,
2518       [ AC_CHECK_LIB(faad, faacDecOpen, [
2519           VLC_ADD_PLUGIN([faad])
2520           VLC_ADD_LIBS([faad],[-lfaad]) ], [
2521             AC_CHECK_LIB(faad, NeAACDecOpen, [
2522               VLC_ADD_PLUGIN([faad])
2523               VLC_ADD_LIBS([faad],[-lfaad]) ], [
2524                 AS_IF([test "${enable_faad}" = "yes"],
2525                 [ AC_MSG_ERROR([Cannot find libfaad library...]) ],
2526                 [ AC_MSG_WARN([Cannot find libfaad library...]) ]) ]) ])
2527       ] , [ AS_IF([test "${enable_faad}" = "yes"],
2528         [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ],
2529         [ AC_MSG_WARN([Cannot find development headers for libfaad...]) ]) ])
2530     VLC_RESTORE_FLAGS
2531   fi
2532 fi
2533
2534 dnl
2535 dnl twolame encoder plugin
2536 dnl
2537 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2538
2539 dnl
2540 dnl fdk-aac encoder plugin
2541 dnl
2542 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2543
2544 dnl
2545 dnl  QuickTime plugin
2546 dnl
2547 AC_ARG_ENABLE(quicktime,
2548   [  --enable-quicktime      QuickTime module (deprecated)])
2549 if test "${enable_quicktime}" = "yes"; then
2550   if test "${SYS}" = "mingw32"; then
2551     VLC_ADD_PLUGIN([quicktime])
2552   else
2553   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2554     [ VLC_ADD_PLUGIN([quicktime])
2555       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2556     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2557   fi
2558 fi
2559
2560 dnl
2561 dnl A52/AC3 decoder plugin
2562 dnl
2563 AC_ARG_ENABLE(a52,
2564   [  --enable-a52            A/52 support with liba52 (default enabled)])
2565 if test "${enable_a52}" != "no"
2566 then
2567   AC_ARG_WITH(a52,
2568     [  --with-a52=PATH         a52 headers and libraries])
2569   AC_ARG_WITH(a52-tree,
2570     [  --with-a52-tree=PATH    a52dec tree for static linking ],[],[])
2571   if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
2572   then
2573     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
2574     if test -z "${real_a52_tree}"
2575     then
2576       dnl  The given directory can't be found
2577       AC_MSG_RESULT(no)
2578       AC_MSG_ERROR([${with_a52_tree} directory does not exist])
2579     fi
2580     dnl  Use a custom a52dec
2581     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
2582     if test -f ${real_a52_tree}/include/a52.h
2583     then
2584       AC_MSG_RESULT(yes)
2585       VLC_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
2586       VLC_ADD_LIBS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
2587       VLC_SAVE_FLAGS
2588       LDFLAGS="${LDFLAGS} ${LIBS_a52tofloat32}"
2589       AC_CHECK_LIB(a52, a52_free, [
2590         VLC_ADD_PLUGIN([a52tofloat32])
2591         VLC_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
2592         VLC_ADD_LIBS([a52tofloat32],[-la52])
2593         ],[
2594         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
2595         then
2596           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3 ($real_a52_tree)])
2597         else
2598           AC_MSG_ERROR([the specified tree has not been compiled])
2599         fi
2600       ])
2601     else
2602       AC_MSG_RESULT(no)
2603       AC_MSG_ERROR([the specified tree does not have a52.h])
2604     fi
2605   else
2606     if test -z "${with_a52}"
2607     then
2608       LDFLAGS_test=""
2609       CPPFLAGS_test=""
2610     else
2611       LDFLAGS_test="-L${with_a52}/lib"
2612       CPPFLAGS_test="-I${with_a52}/include"
2613     fi
2614     VLC_SAVE_FLAGS
2615     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2616     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2617     AC_CHECK_HEADERS(a52dec/a52.h, [
2618       AC_CHECK_LIB(a52, a52_free, [
2619         VLC_ADD_PLUGIN([a52tofloat32])
2620         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2621         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2622       ],[
2623         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.])
2624         ], [$LIBM])
2625     ],[
2626       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.])
2627     ])
2628     VLC_RESTORE_FLAGS
2629   fi
2630 fi
2631
2632 dnl
2633 dnl DTS Coherent Acoustics decoder plugin
2634 dnl
2635 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2636
2637 dnl
2638 dnl  Flac plugin
2639 dnl
2640 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2641
2642 dnl
2643 dnl  Libmpeg2 plugin
2644 dnl
2645 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2646
2647 dnl
2648 dnl  Vorbis plugin
2649 dnl
2650 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2651
2652 dnl
2653 dnl  Tremor plugin
2654 dnl
2655 AC_ARG_ENABLE(tremor,
2656   [  --enable-tremor         Tremor decoder support (default disabled)])
2657 if test "${enable_tremor}" = "yes"
2658 then
2659   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2660     VLC_ADD_PLUGIN([tremor])
2661    ],[])
2662 fi
2663
2664 dnl
2665 dnl  Speex plugins
2666 dnl
2667 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2668 have_speexdsp="no"
2669 AS_IF([test "${enable_speex}" != "no"], [
2670   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2671     have_speexdsp="yes"
2672   ], [
2673     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2674   ])
2675 ])
2676 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2677
2678 dnl
2679 dnl  Opus plugin
2680 dnl
2681 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus], [Opus support], [auto])
2682
2683 dnl
2684 dnl  theora decoder plugin
2685 dnl
2686 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2687
2688 dnl
2689 dnl  dirac encoder plugin
2690 dnl
2691 PKG_ENABLE_MODULES_VLC([DIRAC], [], [dirac >= 0.10.0], [dirac encoder], [auto])
2692
2693 dnl
2694 dnl  schroedinger decoder plugin (for dirac format video)
2695 dnl
2696 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2697
2698 dnl
2699 dnl  PNG decoder module
2700 dnl
2701 AC_ARG_ENABLE(png,
2702   [  --enable-png            PNG support (default enabled)])
2703 AS_IF([test "${enable_png}" != "no"], [
2704 AC_CHECK_HEADERS(png.h, [
2705   VLC_SAVE_FLAGS
2706   LDFLAGS="${LDFLAGS} -lz $LIBM"
2707   AC_CHECK_LIB(png, png_set_rows, [
2708     VLC_ADD_PLUGIN([png])
2709   ], [], [-lz $LIBM])
2710   VLC_RESTORE_FLAGS
2711   ])
2712 ])
2713
2714 dnl
2715 dnl H262 encoder plugin (lib262)
2716 dnl
2717 AC_ARG_ENABLE(x262,
2718   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2719 if test "${enable_x262}" != "no"; then
2720 AC_ARG_WITH(x262-tree,
2721   [ --with-x262-tree=PATH      H262 encoding module with libx262 (static linking)],[],[])
2722   if test "${with_x262_tree}" != "no" -a -n "${with_x262_tree}"
2723   then
2724     real_x262_tree="̧`cd ${with_x262_tree} 2>/dev/null && pwd`"
2725     if test -z "${real_x262_tree}"
2726     then
2727       AC_MSG_RESULT(no)
2728       AC_MSG_ERROR([${with_x262_tree} directory does not exist])
2729     fi
2730     AC_MSG_CHECKING(for x262.h in ${real_x262_tree})
2731     if test -f ${with_x262_tree}/x262_config.h
2732     then
2733       VLC_ADD_PLUGIN([x262])
2734       VLC_ADD_CFLAGS([x262],[-I${with_x262_tree}])
2735       VLC_ADD_LIBS([x262],[-L${with_x262_tree} -lm -lpthread -lx262])
2736     else
2737       AC_MSG_RESULT(no)
2738       AC_MSG_ERROR([${with_x262_tree} doesnt have x262_config.h])
2739     fi
2740   else
2741     PKG_CHECK_MODULES(X262, x262, [
2742         VLC_ADD_PLUGIN([x262])
2743         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2744         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2745           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2746         ])
2747         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2748         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2749           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2750         fi
2751     ], [
2752        if test "${enable_x262}" = "yes"; then
2753         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2754        fi
2755     ])
2756   fi
2757 fi
2758
2759
2760 dnl
2761 dnl H264 encoder plugin (10-bit lib264)
2762 dnl
2763 AC_ARG_ENABLE(x26410b,
2764   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2765 if test "${enable_x26410b}" != "no"; then
2766 AC_ARG_WITH(x26410b-tree,
2767   [ --with-x26410b-tree=PATH      H264 10-bit encoding module with libx264 (static linking)],[],[])
2768   if test "${with_x26410b_tree}" != "no" -a -n "${with_x26410b_tree}"
2769   then
2770     real_x26410b_tree="̧`cd ${with_x26410b_tree} 2>/dev/null && pwd`"
2771     if test -z "${real_x26410b_tree}"
2772     then
2773       AC_MSG_RESULT(no)
2774       AC_MSG_ERROR([${with_x26410b_tree} directory does not exist])
2775     fi
2776     AC_MSG_CHECKING(for x264.h in ${real_x26410b_tree})
2777     if test -f ${with_x26410b_tree}/x264_config.h
2778     then
2779       AC_MSG_RESULT(yes)
2780       AC_MSG_CHECKING(for 10-bit build of x264)
2781       if grep -q "BIT_DEPTH.*10"  ${with_x26410b_tree}/x264_config.h ;then
2782         AC_MSG_RESULT(yes)
2783         VLC_ADD_PLUGIN([x26410b])
2784         VLC_ADD_CFLAGS([x26410b],[-I${with_x26410b_tree}])
2785         VLC_ADD_LIBS([x26410b],[-L${with_x26410b_tree} -lm -lpthread -lx264])
2786       else
2787         AC_MSG_RESULT(no)
2788         AC_MSG_ERROR([${with_x26410b_tree} isnt build 10-bit])
2789       fi
2790     else
2791       AC_MSG_RESULT(no)
2792       AC_MSG_ERROR([${with_x26410b_tree} doesnt have x264_config.h])
2793     fi
2794   else
2795     PKG_CHECK_MODULES(X26410B, x26410b, [
2796         VLC_ADD_PLUGIN([x26410b])
2797         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2798         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2799           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2800         ])
2801         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2802         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2803           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2804         fi
2805     ], [
2806        if test "${enable_x26410b}" = "yes"; then
2807         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2808        fi
2809     ])
2810   fi
2811 fi
2812
2813
2814 dnl
2815 dnl H264 encoder plugin (using libx264)
2816 dnl
2817 AC_ARG_ENABLE(x264,
2818   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2819 if test "${enable_x264}" != "no"; then
2820   AC_ARG_WITH(x264-tree,
2821     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
2822   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
2823   then
2824     real_x264_tree="`cd ${with_x264_tree} 2>/dev/null && pwd`"
2825     if test -z "${real_x264_tree}"
2826     then
2827       dnl  The given directory can't be found
2828       AC_MSG_RESULT(no)
2829       AC_MSG_ERROR([${with_x264_tree} directory does not exist])
2830     fi
2831     dnl  Use a custom libx264
2832     AC_MSG_CHECKING(for x264.h in ${real_x264_tree})
2833     if test -f ${real_x264_tree}/x264.h
2834     then
2835       AC_MSG_RESULT(yes)
2836       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
2837       VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
2838       PKG_CHECK_MODULES(X264,x264, [
2839         VLC_ADD_PLUGIN([x264])
2840         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2841         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2842         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2843           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2844         fi
2845       ],[
2846         AC_MSG_ERROR([the specified tree has not been compiled])
2847       ])
2848     else
2849       AC_MSG_RESULT(no)
2850       AC_MSG_ERROR([the specified tree does not have x264.h])
2851     fi
2852   else
2853       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2854         VLC_ADD_PLUGIN([x264])
2855         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2856
2857         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2858           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2859         ])
2860
2861         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2862         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2863           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2864         fi
2865       ],[
2866         if test "${enable_x264}" = "yes"; then
2867             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2868           fi
2869       ])
2870   fi
2871 fi
2872
2873 dnl
2874 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2875 dnl
2876 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2877
2878 dnl
2879 dnl libfluidsynth (MIDI synthetizer) plugin
2880 dnl
2881 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2882
2883 dnl
2884 dnl Teletext Modules
2885 dnl vbi decoder plugin (using libzbvi)
2886 dnl telx module
2887 dnl uncompatible
2888 dnl
2889 AC_ARG_ENABLE(zvbi,
2890   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2891                   libzvbi (default enabled)]))
2892 AC_ARG_ENABLE(telx,
2893   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2894                   zvbi) (default enabled if zvbi is absent)]))
2895
2896 AS_IF( [test "${enable_zvbi}" != "no"],[
2897     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2898         [
2899           VLC_ADD_PLUGIN([zvbi])
2900           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2901           AS_IF( [test "${enable_telx}" = "yes"],[
2902                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2903                   ])
2904         ],[
2905           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2906         ])
2907     ])
2908 AS_IF( [test "${enable_telx}" != "no" ],[
2909   VLC_ADD_PLUGIN([telx])
2910   ])
2911
2912 dnl
2913 dnl libass subtitle rendering module
2914 dnl
2915 AC_ARG_ENABLE(libass,
2916   [  --enable-libass         Subtitle support using libass (default enabled)])
2917 AS_IF( [test "${enable_libass}" != "no"], [
2918   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2919       [
2920         VLC_ADD_PLUGIN([libass])
2921
2922         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2923           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2924            VLC_ADD_LIBS([libass],[-lfontconfig])
2925        ])
2926       ],[
2927         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2928       ])
2929   ])
2930
2931 dnl
2932 dnl  kate decoder plugin
2933 dnl
2934 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2935
2936 dnl
2937 dnl  tiger rendering for kate decoder plugin
2938 dnl
2939 AC_ARG_ENABLE(tiger,
2940 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2941 AS_IF([test "${enable_tiger}" != "no"], [
2942   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2943       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2944         AS_IF([test -n "${enable_tiger}"], [
2945           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2946         ])
2947   ])
2948 ])
2949
2950
2951 dnl
2952 dnl  Video plugins
2953 dnl
2954
2955 EXTEND_HELP_STRING([Video plugins:])
2956
2957 dnl
2958 dnl  OpenGL
2959 dnl
2960 PKG_CHECK_MODULES([GL], [gl], [
2961   have_gl="yes"
2962 ], [
2963   AC_CHECK_HEADER([GL/gl.h], [
2964     have_gl="yes"
2965     GL_CFLAGS=""
2966     AS_IF([test "${SYS}" = "mingw32"], [
2967       GL_LIBS="-lopengl32"
2968     ], [
2969       GL_LIBS="-lGL"
2970     ])
2971   ], [
2972     have_gl="no"
2973   ])
2974 ])
2975
2976 dnl OpenGL ES 2: depends on EGL 1.1
2977 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
2978 dnl OpenGL ES 1: depends on EGL 1.0
2979 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
2980
2981 AC_ARG_ENABLE(egl,
2982   [  --enable-egl            OpenGL support through EGL (default disabled)],, [
2983   enable_egl="no"
2984 ])
2985 AS_IF([test "$enable_egl" != "no"], [
2986   PKG_CHECK_MODULES([EGL], [egl], [
2987     VLC_ADD_PLUGIN([gl])
2988     VLC_ADD_PLUGIN([egl])
2989   ])
2990 ])
2991
2992 dnl
2993 dnl  Xlib
2994 dnl
2995
2996 AC_PATH_XTRA()
2997 AC_CHECK_HEADERS(X11/Xlib.h)
2998
2999 dnl
3000 dnl  X C Bindings modules
3001 dnl
3002 AC_ARG_ENABLE(xcb,
3003   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3004   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [
3005     enable_xcb="yes"
3006   ], [
3007     enable_xcb="no"
3008   ])
3009 ])
3010 AC_ARG_ENABLE(xvideo,
3011   [  --enable-xvideo         XVideo support (default enabled)],, [
3012     enable_xvideo="$enable_xcb"
3013 ])
3014 AC_ARG_ENABLE(glx,
3015   [  --enable-glx            OpenGL support through GLX (default enabled)],, [
3016   enable_glx="$enable_xcb"
3017 ])
3018
3019 have_xcb="no"
3020 have_xcb_randr="no"
3021 AS_IF([test "${enable_xcb}" != "no"], [
3022   dnl libxcb
3023   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3024   have_xcb="yes"
3025   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3026   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3027
3028   AS_IF([test "${enable_xvideo}" != "no"], [
3029     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
3030       VLC_ADD_PLUGIN([xcb_xv])
3031     ])
3032   ])
3033
3034   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [
3035     have_xcb_randr="yes"
3036   ])
3037
3038   PKG_CHECK_MODULES(XPROTO, [xproto], [
3039     VLC_ADD_PLUGIN([xwd])
3040
3041     dnl xcb-utils
3042     PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [
3043       VLC_ADD_PLUGIN([xcb_hotkeys])
3044       VLC_ADD_CFLAGS([xcb_window], [-DHAVE_XCB_KEYSYMS])
3045     ], [
3046       AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3047     ])
3048   ], [
3049     AC_MSG_WARN([${XPROTO_PKG_ERRORS}. Hotkeys and XWD will not work.])
3050   ])
3051
3052   AS_IF([test "${enable_glx}" != "no"], [
3053     AS_IF([test "${have_gl}" != "yes"], [
3054       AC_MSG_ERROR([${GL_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.])
3055     ])
3056     VLC_ADD_PLUGIN([xcb_glx])
3057     VLC_ADD_PLUGIN([glx])
3058     VLC_ADD_PLUGIN([gl])
3059   ])
3060 ])
3061 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3062 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "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     VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
4061     VLC_ADD_CXXFLAGS([taglib],[$TAGLIB_CFLAGS])
4062   ], [
4063     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4064 ])
4065
4066
4067 dnl
4068 dnl update checking system
4069 dnl
4070 AC_ARG_ENABLE(update-check,
4071   [  --enable-update-check   update checking system (default disabled)])
4072 if test "${enable_update_check}" = "yes"
4073 then
4074   if test "${have_libgcrypt}" != "yes"
4075   then
4076     AC_MSG_ERROR([libgcrypt is required for update checking system])
4077   fi
4078   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4079   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4080   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4081 fi
4082
4083 dnl
4084 dnl Growl notification plugin
4085 dnl
4086 AC_ARG_ENABLE(growl,
4087   [  --enable-growl          growl notification plugin (default disabled)],,
4088   [enable_growl=no])
4089 AS_IF([test "${enable_growl}" != "no"], [
4090     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4091       VLC_ADD_PLUGIN([growl])
4092       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4093       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
4094       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
4095     ])
4096   ]
4097 )
4098
4099 dnl
4100 dnl Libnotify notification plugin
4101 dnl
4102 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4103
4104 dnl
4105 dnl  Endianness check
4106 dnl
4107 AC_C_BIGENDIAN
4108 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4109   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4110 ], [
4111   DEFS_BIGENDIAN=""
4112 ])
4113 AC_SUBST(DEFS_BIGENDIAN)
4114
4115 dnl
4116 dnl Where to install KDE solid .desktop
4117 dnl
4118 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4119 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4120   KDE4_CONFIG="kde4-config"
4121 ])
4122
4123 AC_ARG_WITH(kde-solid,
4124   AS_HELP_STRING([--with-kde-solid=PATH],
4125                  [KDE Solid actions directory (auto)]),, [
4126
4127 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4128   with_kde_solid="yes"
4129 fi
4130 ])
4131 soliddatadir=""
4132 AS_IF([test "${with_kde_solid}" != "no"], [
4133   AS_IF([test "${with_kde_solid}" = "yes"], [
4134     kde4datadir="`${KDE4_CONFIG} --install data`"
4135     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4136     soliddatadir="${kde4datadir}/solid/actions"
4137   ], [
4138     soliddatadir="${with_kde_solid}"
4139   ])
4140 ])
4141 AC_SUBST(soliddatadir)
4142 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4143
4144 EXTEND_HELP_STRING([Components:])
4145
4146 dnl
4147 dnl  the VLC binary
4148 dnl
4149 AC_ARG_ENABLE(vlc,
4150   [  --enable-vlc            build the VLC media player (default enabled)])
4151 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4152
4153 AC_ARG_ENABLE(macosx-vlc-app,
4154   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4155 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4156     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4157
4158 dnl
4159 dnl  Stuff used by the program
4160 dnl
4161 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4162 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4163 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4164 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4165 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4166 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4167 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4168 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4169 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4170 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4171 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4172 AC_SUBST(COPYRIGHT_MESSAGE)
4173 AC_SUBST(VERSION_MESSAGE)
4174 AC_SUBST(VERSION_MAJOR)
4175 AC_SUBST(VERSION_MINOR)
4176 AC_SUBST(VERSION_REVISION)
4177 AC_SUBST(VERSION_EXTRA)
4178 AC_SUBST(COPYRIGHT_YEARS)
4179 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4180 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4181 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4182 dnl
4183 dnl  Handle substvars that use $(top_srcdir)
4184 dnl
4185 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4186
4187 dnl
4188 dnl  Configuration is finished
4189 dnl
4190 AC_SUBST(SYS)
4191 AC_SUBST(ARCH)
4192 AC_SUBST(ALIASES)
4193 AC_SUBST(ASM)
4194 AC_SUBST(MOC)
4195 AC_SUBST(RCC)
4196 AC_SUBST(UIC)
4197 AC_SUBST(WINDRES)
4198 AC_SUBST(WINE_SDK_PATH)
4199 AC_SUBST(LIBEXT)
4200 AC_SUBST(AM_CPPFLAGS)
4201 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4202 AC_SUBST(FILE_LIBVLCCORE_DLL)
4203 AC_SUBST(FILE_LIBVLC_DLL)
4204
4205 AC_CONFIG_FILES([
4206   Makefile
4207   doc/Makefile
4208   modules/Makefile
4209   m4/Makefile
4210   po/Makefile.in
4211   share/Makefile
4212   compat/Makefile
4213   src/Makefile
4214   lib/Makefile
4215   bin/Makefile
4216   test/Makefile
4217   modules/access/rtp/Makefile
4218   modules/access_output/Makefile
4219   modules/audio_filter/Makefile
4220   modules/audio_mixer/Makefile
4221   modules/audio_output/Makefile
4222   modules/control/Makefile
4223   modules/gui/Makefile
4224   modules/gui/macosx/Makefile
4225   modules/gui/minimal_macosx/Makefile
4226   modules/gui/macosx_dialog_provider/Makefile
4227   modules/gui/qt4/Makefile
4228   modules/gui/skins2/Makefile
4229   modules/lua/Makefile
4230   modules/meta_engine/Makefile
4231   modules/misc/Makefile
4232   modules/mux/Makefile
4233   modules/notify/Makefile
4234   modules/packetizer/Makefile
4235   modules/services_discovery/Makefile
4236   modules/stream_filter/Makefile
4237   modules/stream_out/Makefile
4238   modules/text_renderer/Makefile
4239   modules/video_chroma/Makefile
4240   modules/video_filter/Makefile
4241   modules/video_output/Makefile
4242   modules/video_splitter/Makefile
4243   modules/visualization/Makefile
4244   modules/arm_neon/Makefile
4245   modules/hw/vdpau/Makefile
4246 ])
4247
4248 AM_COND_IF([HAVE_WIN32], [
4249   AC_CONFIG_FILES([
4250     extras/package/win32/NSIS/spad.nsi
4251     extras/package/win32/NSIS/vlc.win32.nsi
4252     extras/package/win32/msi/config.wxi
4253   ])
4254 ])
4255
4256 AM_COND_IF([HAVE_DARWIN], [
4257   AC_CONFIG_FILES([
4258     extras/package/macosx/Info.plist
4259     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4260   ])
4261 ])
4262
4263 dnl Generate makefiles
4264 AC_OUTPUT
4265
4266 dnl Do we have to use make or gmake ?
4267 if make --version 2>&1|grep -q GNU
4268 then
4269     # GNU make, all seems good
4270     MAKE=make
4271 else
4272     # Known GNU make alias (on BSD)
4273     MAKE=gmake
4274 fi
4275 dnl Shortcut to nice compile message
4276 if test -n $SHELL; then
4277   SHELL=${CONFIG_SHELL-/bin/sh}
4278 fi
4279 rm -f compile
4280 echo "#! $SHELL
4281 rm -f .error\$\$
4282 ERROR=0
4283 export PATH=\"$PATH\" LANG=C
4284 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| `sed -ne \"s/^top_srcdir *= *//p\" < Makefile`/extras/buildsystem/make.pl
4285 test -f .error\$\$ && ERROR=1
4286 rm -f .error\$\$
4287 exit \$ERROR" >compile
4288 chmod a+x compile
4289
4290 echo "
4291 libvlc configuration
4292 --------------------
4293 version               : ${VERSION}
4294 system                : ${SYS}
4295 architecture          : ${ARCH}
4296 optimizations         : ${enable_optimizations}"
4297 if test "${enable_vlc}" != "no"; then
4298 echo "vlc aliases           :${ALIASES}"
4299 else
4300 echo "build vlc executable  : no"
4301 fi
4302 echo "
4303 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."