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