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