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