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