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