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