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