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