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