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