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