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