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