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