]> git.sesse.net Git - vlc/blob - configure.ac
macosx: fix linking the motion and rotate modules
[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       GL_LIBS="-lopengl32"
2978     ], [
2979       GL_LIBS="-lGL"
2980     ])
2981   ], [
2982     have_gl="no"
2983   ])
2984 ])
2985 AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
2986
2987 dnl OpenGL ES 2: depends on EGL 1.1
2988 PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [disabled])
2989 dnl OpenGL ES 1: depends on EGL 1.0
2990 PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [disabled])
2991
2992 AC_ARG_ENABLE(egl,
2993   [  --enable-egl            OpenGL support through EGL (default disabled)],, [
2994   enable_egl="no"
2995 ])
2996 AS_IF([test "$enable_egl" != "no"], [
2997   PKG_CHECK_MODULES([EGL], [egl], [
2998     VLC_ADD_PLUGIN([egl])
2999   ])
3000 ])
3001
3002 dnl
3003 dnl  Xlib
3004 dnl
3005
3006 AC_PATH_XTRA()
3007 AC_CHECK_HEADERS(X11/Xlib.h)
3008
3009 dnl
3010 dnl  X C Bindings modules
3011 dnl
3012 AC_ARG_ENABLE(xcb,
3013   [  --enable-xcb            X11 support with XCB (default enabled)],, [
3014   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [
3015     enable_xcb="yes"
3016   ], [
3017     enable_xcb="no"
3018   ])
3019 ])
3020 AC_ARG_ENABLE(xvideo,
3021   [  --enable-xvideo         XVideo support (default enabled)],, [
3022     enable_xvideo="$enable_xcb"
3023 ])
3024 AC_ARG_ENABLE(glx,
3025   [  --enable-glx            OpenGL support through GLX (default enabled)],, [
3026   enable_glx="$enable_xcb"
3027 ])
3028
3029 have_xcb="no"
3030 have_xcb_keysyms="no"
3031 have_xcb_randr="no"
3032 have_xcb_xvideo="no"
3033 AS_IF([test "${enable_xcb}" != "no"], [
3034   dnl libxcb
3035   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3036   have_xcb="yes"
3037   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3038   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3039   PKG_CHECK_MODULES(XPROTO, [xproto])
3040
3041   AS_IF([test "${enable_xvideo}" != "no"], [
3042     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [have_xcb_xvideo="yes"])
3043   ])
3044
3045   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [have_xcb_randr="yes"])
3046
3047   dnl xcb-utils
3048   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [have_xcb_keysyms="yes"], [
3049     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3050   ])
3051 ])
3052 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3053 AM_CONDITIONAL([HAVE_XCB_KEYSYMS], [test "${have_xcb_keysyms}" = "yes"])
3054 AM_CONDITIONAL([HAVE_XCB_RANDR], [test "${have_xcb_randr}" = "yes"])
3055 AM_CONDITIONAL([HAVE_XCB_XVIDEO], [test "${have_xcb_xvideo}" = "yes"])
3056
3057
3058 dnl
3059 dnl VDPAU needs X11
3060 dnl
3061 AC_ARG_ENABLE(vdpau,
3062   [AS_HELP_STRING([--enable-vdpau], [VDPAU hardware support (default auto)])])
3063 have_vdpau="no"
3064 AS_IF([test "${enable_vdpau}" != "no"], [
3065   PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.6], [
3066     have_vdpau="yes"
3067     AS_IF([test "${no_x}" = "yes"], [
3068       AC_MSG_ERROR([VDPAU requires Xlib (X11).])
3069     ])
3070   ], [
3071     AS_IF([test -n "${enable_vdpau}"], [
3072       AC_MSG_ERROR([${VDPAU_PKG_ERRORS}.])
3073     ])
3074   ])
3075 ])
3076 AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
3077
3078 have_avcodec_vdpau="no"
3079 AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [
3080   PKG_CHECK_EXISTS([libavutil >= 0.52.4 libavcodec >= 54.36.0], [
3081     have_avcodec_vdpau="yes"
3082     AC_MSG_NOTICE([VDPAU decoding acceleration activated])
3083   ], [
3084     AS_IF([test -n "${enable_vdpau}"], [
3085       AC_MSG_ERROR([libavutil >= 0.52.4 and libavcodec >= 54.36.0 are required for VDPAU decoding.])
3086     ], [
3087       AC_MSG_WARN([libavutil >= 0.52.4 and libavcodec >= 54.36.0 are required for VDPAU decoding.])
3088     ])
3089   ])
3090 ])
3091 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
3092
3093
3094 dnl
3095 dnl  SDL module
3096 dnl
3097 AC_ARG_ENABLE(sdl,
3098   [  --enable-sdl            SDL support (default enabled)])
3099 AC_ARG_ENABLE(sdl-image,
3100   [  --enable-sdl-image      SDL image support (default enabled)])
3101 if test "${enable_sdl}" != "no"
3102 then
3103    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3104       # SDL on Darwin is heavily patched and can only run SDL_image
3105       if test "${SYS}" != "darwin"; then
3106         VLC_ADD_PLUGIN([vout_sdl])
3107       fi
3108       if test "${SYS}" != "mingw32" -a "${SYS}" != "os2"; then
3109         VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3110       fi
3111       VLC_ADD_CFLAGS([vout_sdl],[${SDL_CFLAGS}])
3112       VLC_ADD_LIBS([vout_sdl],[${SDL_LIBS}])
3113
3114       # SDL_image
3115       AS_IF([ test "${enable_sdl_image}" != "no"],[
3116         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3117           VLC_ADD_PLUGIN([sdl_image])],
3118           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3119           ])
3120       ])
3121    ],[
3122      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3123    ])
3124 fi
3125
3126
3127 dnl
3128 dnl Mac Vout
3129 AC_ARG_ENABLE(macosx-vout,
3130   [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
3131 if test "x${enable_macosx_vout}" != "xno" &&
3132   (test "${SYS}" = "darwin" || test "${enable_macosx_vout}" = "yes")
3133 then
3134   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,Cocoa])
3135   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,OpenGL])
3136   VLC_ADD_PLUGIN([vout_macosx])
3137 fi
3138
3139 dnl
3140 dnl Mac CoreGraphics Layer Vout
3141 AC_ARG_ENABLE(coregraphicslayer-vout,
3142   [  --enable-coregraphicslayer-vout CoreGraphics layered video output module (default disabled)])
3143 if test "${enable_coregraphicslayer_vout}" = "yes"; then
3144   VLC_ADD_LIBS([vout_coregraphicslayer],[-Wl,-framework,Cocoa])
3145   VLC_ADD_LIBS([vout_coregraphicslayer],[-Wl,-framework,QuartzCore])
3146   VLC_ADD_PLUGIN([vout_coregraphicslayer])
3147 fi
3148
3149 dnl
3150 dnl  freetype module
3151 dnl
3152 AC_ARG_ENABLE(freetype,
3153   [  --enable-freetype       freetype support   (default auto)])
3154 AC_ARG_ENABLE(fribidi,
3155   [  --enable-fribidi        fribidi support    (default auto)])
3156 AC_ARG_ENABLE(fontconfig,
3157   [  --enable-fontconfig     fontconfig support (default auto)])
3158
3159 AC_ARG_WITH([default-font],
3160     AS_HELP_STRING([--with-default-font=PATH],
3161         [Path to the default font]),
3162         [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
3163             "$withval", [Default font])])
3164 AC_ARG_WITH([default-monospace-font],
3165     AS_HELP_STRING([--with-default-monospace-font=PATH],
3166         [Path to the default font]),
3167         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
3168             "$withval", [Default monospace font])])
3169
3170 AC_ARG_WITH([default-font-family],
3171     AS_HELP_STRING([--with-default-font-family=NAME],
3172         [Path to the default font family]),
3173         [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
3174             "$withval", [Default font family])])
3175 AC_ARG_WITH([default-monospace-font-family],
3176     AS_HELP_STRING([--with-default-monospace-font-family=NAME],
3177         [Path to the default font family]),
3178         [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
3179             "$withval", [Default monospace font family])])
3180
3181 if test "${enable_freetype}" != "no"; then
3182    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3183       have_freetype=yes
3184       VLC_ADD_PLUGIN([freetype])
3185       VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
3186       if test "${SYS}" = "mingw32"; then
3187         VLC_ADD_LIBS([freetype],[-liconv -lz])
3188       fi
3189       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
3190
3191       AC_CHECK_HEADERS(Carbon/Carbon.h,
3192                        [VLC_ADD_LIBS([freetype],[-Wl,-framework,Carbon])])
3193
3194       dnl fontconfig support
3195       if test "${SYS}" != "mingw32"; then
3196           if test "${enable_fontconfig}" != "no"; then
3197             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3198               VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
3199               VLC_ADD_LIBS([freetype],[-lfontconfig])
3200             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3201           fi
3202       else
3203           VLC_ADD_LIBS([freetype],[-lgdi32])
3204       fi
3205
3206       dnl fribidi support
3207       if test "${enable_fribidi}" != "no"; then
3208         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3209           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3210           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
3211         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional support will be disabled in FreeType.])])
3212       fi
3213
3214   ],[
3215   have_freetype=no
3216   AS_IF([test -n "${enable_freetype}"],[
3217     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3218     ])
3219   ])
3220 fi
3221
3222
3223 dnl
3224 dnl  QuartzText vout module (iOS/Mac OS)
3225 dnl
3226 AC_ARG_ENABLE(macosx-quartztext,
3227   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3228 if test "x${enable_macosx_quartztext}" != "xno" &&
3229   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3230 then
3231   VLC_ADD_PLUGIN([quartztext])
3232   VLC_ADD_LIBS([quartztext],[-Wl,-framework,ApplicationServices])
3233 fi
3234
3235 dnl
3236 dnl  SVG module
3237 dnl
3238 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3239
3240 dnl
3241 dnl  android surface module
3242 dnl
3243 AC_ARG_ENABLE(android-surface,
3244   [  --enable-android-surface   Android Surface video output module (default disabled)])
3245 if test "${enable_android_surface}" = "yes"; then
3246   if test "${HAVE_ANDROID}" = "1"; then
3247      VLC_ADD_PLUGIN([android_surface])
3248      VLC_ADD_LIBS([android_surface], [-ldl])
3249   fi
3250 fi
3251
3252
3253 dnl
3254 dnl  iOS vout module
3255 dnl
3256 AC_ARG_ENABLE(ios-vout,
3257   [  --enable-ios-vout    iOS video output module (default disabled)])
3258 if test "${enable_ios_vout}" = "yes"
3259 then
3260   VLC_ADD_PLUGIN([vout_ios])
3261   VLC_ADD_LIBS([vout_ios], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit,-framework,Foundation])
3262 fi
3263
3264 dnl
3265 dnl  iOS ES2 vout module
3266 dnl
3267 AC_ARG_ENABLE(ios-vout2,
3268   [  --enable-ios-vout2    iOS video output module (default disabled)])
3269 if test "${enable_ios_vout2}" = "yes"
3270 then
3271   VLC_ADD_PLUGIN([vout_ios2])
3272   VLC_ADD_LIBS([vout_ios2], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit])
3273 fi
3274
3275
3276 dnl
3277 dnl  Windows DirectX module
3278 dnl
3279
3280 AC_ARG_ENABLE(directx,
3281   [AS_HELP_STRING([--enable-directx],
3282     [Microsoft DirectX support (default enabled on Windows)])],, [
3283   AS_IF([test "${SYS}" = "mingw32"], [
3284     enable_directx="yes"
3285   ], [
3286     enable_directx="no"
3287   ])
3288 ])
3289 have_directx="no"
3290 AS_IF([test "${enable_directx}" != "no"], [
3291   dnl DirectDraw
3292   AC_CHECK_HEADERS(ddraw.h, [
3293     have_directx="yes"
3294   ], [
3295     AC_MSG_ERROR([Cannot find DirectX headers!])
3296   ])
3297
3298   dnl OpenGL
3299   AC_CHECK_HEADERS(GL/wglew.h, [
3300     VLC_ADD_PLUGIN([glwin32])
3301   ],, [
3302     #include <windows.h>
3303     #include <GL/gl.h>
3304   ])
3305
3306   dnl Direct3D
3307   AC_CHECK_HEADERS(d3d9.h, [
3308     VLC_ADD_PLUGIN([direct3d])
3309   ])
3310
3311   dnl Direct2D
3312   AC_CHECK_HEADERS(d2d1.h, [
3313     VLC_ADD_PLUGIN([direct2d])
3314   ])
3315 ])
3316 AM_CONDITIONAL([HAVE_DIRECTX], [test "$have_directx" = "yes"])
3317
3318 dnl
3319 dnl  Linux framebuffer module
3320 dnl
3321 AC_CHECK_HEADER([linux/fb.h], [
3322   VLC_ADD_PLUGIN([fb])
3323 ])
3324
3325
3326 dnl
3327 dnl  DirectFB module
3328 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3329 dnl  TODO: support for static linking
3330 dnl
3331 AC_ARG_ENABLE(directfb,
3332   [  --enable-directfb       DirectFB support (default disabled)])
3333 AC_ARG_WITH(directfb,
3334   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3335
3336 if test "${enable_directfb}" = "yes"; then
3337     have_directfb="false"
3338     CPPFLAGS_mydirectfb=
3339     LIBS_mydirectfb=
3340     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3341         dnl Trying the given location
3342         VLC_SAVE_FLAGS
3343
3344         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3345         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3346
3347         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3348         LIBS="${LIBS} ${LIBS_new}"
3349
3350         dnl FIXME: too obscure
3351         AC_CHECK_HEADER([directfb.h], [
3352             AC_CHECK_LIB([direct],[direct_initialize], [
3353                 AC_CHECK_LIB([fusion], [fusion_enter], [
3354                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3355                 ], have_directfb="false")
3356             ], have_directfb="false")
3357         ], have_directfb="false")
3358
3359         VLC_RESTORE_FLAGS
3360
3361         if test "${have_directfb}" = "true"; then
3362             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3363             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3364         fi
3365     else
3366         dnl Look for directfb-config
3367         AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
3368         if test "${DIRECTFB_CONFIG}" != "no"; then
3369             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3370             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3371             have_directfb="true"
3372         else
3373             dnl Trying with pkg-config
3374             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3375                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3376                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3377                 have_directfb="true"
3378                 ], [have_directfb="false"])
3379         fi
3380     fi
3381     if test "${have_directfb}" = "true"; then
3382         VLC_ADD_PLUGIN([directfb])
3383         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3384         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3385     else
3386         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3387     fi
3388 fi
3389
3390 dnl
3391 dnl  AA plugin
3392 dnl
3393 AC_ARG_ENABLE(aa,
3394   [  --enable-aa             aalib output (default disabled)])
3395 if test "${enable_aa}" = "yes"
3396 then
3397   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3398   if test "${have_aa}" = "true"
3399   then
3400     VLC_ADD_PLUGIN([aa])
3401     VLC_ADD_LIBS([aa],[-laa])
3402     if test "${SYS}" != "mingw32"; then
3403       VLC_ADD_LIBS([aa],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3404     fi
3405   fi
3406 fi
3407
3408 dnl
3409 dnl  libcaca plugin
3410 dnl
3411 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3412
3413 dnl
3414 dnl  OS/2 KVA plugin
3415 dnl
3416 AC_ARG_ENABLE(kva,
3417   [AS_HELP_STRING([--enable-kva],
3418     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3419   AS_IF([test "$SYS" = "os2"], [
3420     enable_kva="yes"
3421   ])
3422 ])
3423 have_kva="no"
3424 KVA_LIBS=""
3425 AS_IF([test "$enable_kva" != "no"], [
3426   AC_CHECK_HEADERS([kva.h], [
3427     have_kva="yes"
3428     AC_CHECK_LIB(kva, main, [
3429       KVA_LIBS="-lkva"
3430     ])
3431   ])
3432 ])
3433 AC_SUBST(KVA_LIBS)
3434 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3435
3436 dnl
3437 dnl  Audio plugins
3438 dnl
3439
3440 EXTEND_HELP_STRING([Audio plugins:])
3441
3442 dnl
3443 dnl  Pulseaudio module
3444 dnl
3445 AC_ARG_ENABLE(pulse,
3446   [AS_HELP_STRING([--enable-pulse],
3447     [use the PulseAudio client library (default auto)])])
3448 have_pulse="no"
3449 AS_IF([test "${enable_pulse}" != "no"], [
3450   PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.22], [
3451     have_pulse="yes"
3452   ], [
3453     PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.16], [
3454       AS_IF([test "${no_x}" != "yes"], [
3455         have_pulse="yes"
3456         PULSE_LIBS="$PULSE_LIBS ${X_LIBS} ${X_PRE_LIBS} -lX11"
3457       ], [
3458         AS_IF([test "${enable_pulse}" = "yes"], [
3459           AC_MSG_ERROR([Xlib is required with PulseAudio pre-0.9.22 versions
3460 (see http://www.pulseaudio.org/ticket/799 for further reference).])
3461         ])
3462       ])
3463     ], [
3464       AS_IF([test "x${enable_pulse}" != "x"], [
3465         AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 0.9.22 or later required.])
3466       ])
3467     ])
3468   ])
3469 ])
3470 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3471
3472 dnl
3473 dnl  ALSA module
3474 dnl
3475 AC_ARG_ENABLE(alsa,
3476   [AS_HELP_STRING([--enable-alsa],
3477     [support the Advanced Linux Sound Architecture (default auto)])],, [
3478   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3479     enable_alsa="yes"
3480   ])
3481 ])
3482 have_alsa="no"
3483 AS_IF([test "${enable_alsa}" != "no"], [
3484   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.24], [
3485     have_alsa="yes"
3486   ], [
3487     AS_IF([test "x${enable_alsa}" != "x"], [
3488       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.24 or later required.])
3489     ])
3490   ])
3491 ])
3492 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3493
3494 dnl
3495 dnl  Open Sound System module
3496 dnl
3497 AC_ARG_ENABLE(oss,
3498   [AS_HELP_STRING([--enable-oss],
3499     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3500   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3501     enable_oss="no"
3502   ])
3503 ])
3504 have_oss="no"
3505 OSS_LIBS=""
3506 AS_IF([test "$enable_oss" != "no"], [
3507   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3508     have_oss="yes"
3509     AC_CHECK_LIB(ossaudio, main, [
3510       OSS_LIBS="-lossaudio"
3511     ])
3512   ])
3513 ])
3514 AC_SUBST(OSS_LIBS)
3515 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3516
3517 dnl
3518 dnl  OpenBSD sndio module
3519 dnl
3520 AC_ARG_ENABLE([sndio],
3521   [AS_HELP_STRING([--disable-sndio],
3522     [support the OpenBSD sndio (default auto)])],, [
3523   AS_IF([test "$SYS" = "openbsd"], [
3524     enable_sndio="yes"
3525   ])
3526 ])
3527 have_sndio="no"
3528 AS_IF([test "$enable_sndio" != "no"], [
3529   AC_CHECK_HEADER([sndio.h], [
3530     have_sndio="yes"
3531   ])
3532 ])
3533 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3534
3535 dnl
3536 dnl  Windows Audio Session plugin
3537 dnl
3538 AC_ARG_ENABLE([wasapi],
3539   [AS_HELP_STRING([--enable-wasapi],
3540     [use the Windows Audio Session API (default auto)])
3541 ])
3542 have_wasapi="no"
3543 AS_IF([test "$enable_wasapi" != "no"], [
3544   AC_CHECK_HEADER([audioclient.h], [
3545     have_wasapi="yes"
3546   ], [
3547     AS_IF([test "x${enable_wasapi}" != "x"], [
3548       AC_MSG_ERROR([Windows Audio Session API not found.])
3549     ])
3550   ])
3551 ])
3552 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3553
3554 dnl
3555 dnl  win32 waveOut plugin
3556 dnl
3557 AC_ARG_ENABLE(waveout,
3558   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
3559 if test "${enable_waveout}" != "no"; then
3560   if test "${SYS}" = "mingw32"; then
3561     VLC_ADD_PLUGIN([waveout])
3562     VLC_ADD_LIBS([waveout],[-lwinmm])
3563   fi
3564 fi
3565
3566 dnl
3567 dnl  CoreAudio plugin
3568 dnl
3569 AC_ARG_ENABLE(macosx-audio,
3570   [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
3571 if test "x${enable_macosx_audio}" != "xno" &&
3572   (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
3573 then
3574   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
3575     [ VLC_ADD_PLUGIN([auhal])
3576       VLC_ADD_LIBS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices])
3577     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
3578 fi
3579
3580 dnl
3581 dnl  iOS CoreAudio plugin
3582 dnl
3583 AC_ARG_ENABLE(ios-audio,
3584   [  --enable-ios-audio       Audio module for iOS (default disabled)])
3585 if test "${enable_ios_audio}" = "yes"
3586 then
3587   AC_CHECK_HEADERS(AudioUnit/AudioUnit.h,
3588     [ VLC_ADD_PLUGIN([audiounit_ios])
3589       VLC_ADD_LIBS([audiounit_ios],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,CoreServices])
3590     ], [ AC_MSG_ERROR([cannot find AudioUnit headers]) ])
3591 fi
3592
3593 dnl
3594 dnl  AudioQueue plugin
3595 dnl
3596 AC_ARG_ENABLE(audioqueue,
3597   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3598 if test "${enable_audioqueue}" = "yes"
3599 then
3600   VLC_ADD_PLUGIN([audioqueue])
3601   VLC_ADD_LIBS([audioqueue], [-Wl,-framework,AudioToolbox,-framework,CoreFoundation])
3602 fi
3603
3604 dnl
3605 dnl  JACK modules
3606 dnl
3607 AC_ARG_ENABLE(jack,
3608   [AS_HELP_STRING([--disable-jack],
3609     [do not use jack (default auto)])])
3610 have_jack="no"
3611 AS_IF([test "${enable_jack}" != "no"], [
3612     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3613       [ have_jack=yes ],
3614       [
3615       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3616
3617       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3618       [ have_jack=yes ],
3619       [
3620       AS_IF([test -n "${enable_jack}"],
3621          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3622          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3623       ])
3624     ])
3625 ])
3626 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3627
3628 dnl
3629 dnl  OpenSLES Android
3630 dnl
3631 AC_ARG_ENABLE(opensles,
3632   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3633 if test "${HAVE_ANDROID}" = "1"; then
3634   if test "${enable_opensles}" = "yes"; then
3635       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3636         [ VLC_ADD_PLUGIN([opensles_android]) ],
3637         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3638   fi
3639 fi
3640
3641 dnl
3642 dnl libsamplerate plugin
3643 dnl
3644 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3645
3646 dnl
3647 dnl  OS/2 KAI plugin
3648 dnl
3649 AC_ARG_ENABLE(kai,
3650   [AS_HELP_STRING([--enable-kai],
3651     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3652   AS_IF([test "$SYS" = "os2"], [
3653     enable_kai="yes"
3654   ])
3655 ])
3656 have_kai="no"
3657 KAI_LIBS=""
3658 AS_IF([test "$enable_kai" != "no"], [
3659   AC_CHECK_HEADERS([kai.h], [
3660     have_kai="yes"
3661     AC_CHECK_LIB(kai, main, [
3662       KAI_LIBS="-lkai"
3663     ])
3664   ])
3665 ])
3666 AC_SUBST(KAI_LIBS)
3667 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3668
3669 dnl
3670 dnl  chromaprint audio track fingerprinter
3671 dnl
3672 m4_pushdef([libchromaprint_version], 0.6.0)
3673 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3674     VLC_ADD_PLUGIN([stream_out_chromaprint fingerprinter])
3675     VLC_ADD_CFLAGS([stream_out_chromaprint],[${CHROMAPRINT_CFLAGS}] [-I./webservices -I../stream_out])
3676     VLC_ADD_LIBS([stream_out_chromaprint],[${CHROMAPRINT_LIBS}])
3677     VLC_ADD_LIBS([fingerprinter],[-lm]),
3678     AS_IF([test "${enable_chromaprint}" = "yes"],
3679         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3680         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3681          ),
3682     [(Chromaprint based audio fingerprinter)],[auto])
3683 m4_popdef([libchromaprint_version])
3684
3685 dnl
3686 dnl  Interface plugins
3687 dnl
3688
3689 EXTEND_HELP_STRING([Interface plugins:])
3690
3691 dnl
3692 dnl QT
3693 dnl
3694 AC_ARG_ENABLE(qt, [
3695   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3696   AS_IF([test "${SYS}" = "darwin"], [
3697     enable_qt="no"
3698   ])
3699 ])
3700 AS_IF([test "${enable_qt}" != "no"], [
3701   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
3702       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3703       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3704       AC_PATH_PROG(RCC, [rcc-qt5 rcc], rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3705       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3706     ], [
3707       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3708         AS_IF([test -n "${enable_qt}"],[
3709           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3710         ],[
3711           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3712         ])
3713         enable_qt="no"
3714       ])
3715       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3716       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3717       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3718       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3719     ])
3720 ])
3721 AS_IF([test "${enable_qt}" != "no"], [
3722   VLC_ADD_PLUGIN([qt4])
3723   ALIASES="${ALIASES} qvlc"
3724
3725   AC_LANG_PUSH([C++])
3726   VLC_SAVE_FLAGS
3727
3728   AC_MSG_CHECKING([whether Qt uses Xlib])
3729   CPPFLAGS="${CPPFLAGS} ${QT_CFLAGS}"
3730   AC_PREPROC_IFELSE([AC_LANG_SOURCE([
3731 #include <QWidget>
3732 #if !defined (Q_WS_X11)
3733 # error Fail
3734 #endif
3735   ])], [
3736     AC_MSG_RESULT([yes])
3737   ], [
3738     AC_MSG_RESULT([no])
3739   ])
3740
3741   VLC_RESTORE_FLAGS
3742   AC_LANG_POP([C++])
3743
3744 ])
3745 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3746
3747 dnl
3748 dnl Simple test for skins2 dependency
3749 dnl
3750 AS_IF([test "$enable_qt" = "no"], [
3751   AS_IF([test "${enable_skins2}" = "yes"], [
3752     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.])
3753   ], [
3754     enable_skins2="no"
3755     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3756   ])
3757 ])
3758
3759 dnl
3760 dnl Skins2 module
3761 dnl
3762 AC_ARG_ENABLE(skins2,
3763   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3764 AS_IF([test "${enable_skins2}" != "no"], [
3765   have_skins_deps="yes"
3766
3767   dnl Win32
3768   AS_IF([test "${SYS}" = "mingw32"], [
3769     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3770     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3771   dnl MacOS
3772   ], [test "${SYS}" = "darwin"], [
3773     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3774     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3775   dnl OS/2
3776   ], [test "${SYS}" = "os2"], [
3777     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3778   dnl Linux/Unix
3779   ], [
3780     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3781     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3782     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3783     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3784     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3785   ])
3786
3787   dnl for All OSes
3788   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3789
3790   dnl we need freetype
3791   AS_IF([test "${have_freetype}" != "yes"], [
3792     have_skins_deps="no"
3793   ])
3794
3795   AS_IF([test "${have_skins_deps}" = "no"], [
3796     AS_IF([test "x${enable_skins2}" = "x"], [
3797       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3798     ], [
3799       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3800     ])
3801     enable_skins2="no"
3802   ], [
3803     VLC_ADD_PLUGIN([skins2])
3804     ALIASES="${ALIASES} svlc"
3805     enable_skins2="yes"
3806   ])
3807 ])
3808 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3809
3810 AC_ARG_ENABLE(libtar,
3811   [  --enable-libtar         libtar support for skins2 (default auto)])
3812 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3813   AC_CHECK_HEADERS(libtar.h, [
3814     VLC_ADD_LIBS([skins2],[-ltar])
3815   ])
3816 ])
3817
3818 dnl
3819 dnl  MacOS X gui module
3820 dnl
3821 AC_ARG_ENABLE(macosx,
3822   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3823 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3824 then
3825   VLC_ADD_LIBS([macosx], [-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreServices])
3826   VLC_ADD_OBJCFLAGS([macosx], [-fobjc-exceptions] )
3827   VLC_ADD_PLUGIN([macosx])
3828
3829   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])
3830
3831   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3832   then
3833     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3834   fi
3835   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,Sparkle])
3836   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3837
3838   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3839   then
3840     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3841   fi
3842   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit])
3843   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3844 fi
3845 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3846
3847 dnl
3848 dnl  Minimal Mac OS X module
3849 dnl
3850 AC_ARG_ENABLE(minimal-macosx,
3851   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3852 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3853 then
3854   VLC_ADD_LIBS([minimal_macosx], [-Wl,-framework,Cocoa])
3855   VLC_ADD_OBJCFLAGS([minimal_macosx], [-fobjc-exceptions] )
3856   VLC_ADD_PLUGIN([minimal_macosx])
3857 fi
3858 AM_CONDITIONAL(ENABLE_MINIMAL_MACOSX, [test "$enable_minimal_macosx" != "no"])
3859
3860 dnl
3861 dnl  MacOS X dialog provider
3862 dnl
3863 AC_ARG_ENABLE(macosx-dialog-provider,
3864   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3865 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3866   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3867 then
3868   VLC_ADD_LIBS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
3869   VLC_ADD_PLUGIN([macosx_dialog_provider])
3870 fi
3871 AM_CONDITIONAL(ENABLE_MACOSX_DIALOG_PROVIDER, [test "$enable_macosx_dialog_provider" != "no"])
3872
3873 dnl
3874 dnl  ncurses module
3875 dnl
3876 AC_ARG_ENABLE(ncurses,
3877 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3878 AS_IF([test "${enable_ncurses}" != "no"] ,[
3879   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3880     VLC_ADD_PLUGIN([ncurses])
3881     VLC_ADD_CFLAGS([ncurses],[${NCURSES_CFLAGS}])
3882     VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS}])
3883     ALIASES="${ALIASES} nvlc"
3884   ], [
3885     AS_IF([test -n "${enable_ncurses}"], [
3886       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3887     ])
3888   ])
3889 ])
3890
3891 dnl
3892 dnl  Lirc plugin
3893 dnl
3894 AC_ARG_ENABLE(lirc,
3895   [  --enable-lirc           lirc support (default disabled)])
3896 if test "${enable_lirc}" = "yes"
3897 then
3898   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
3899   if test "${have_lirc}" = "true"
3900   then
3901     VLC_ADD_PLUGIN([lirc])
3902     VLC_ADD_LIBS([lirc],[-llirc_client])
3903   fi
3904 fi
3905
3906 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3907 dnl
3908 dnl  goom visualization plugin
3909 dnl
3910 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3911
3912 dnl
3913 dnl libprojectM visualization plugin
3914 dnl
3915 AC_ARG_ENABLE(projectm,
3916   [  --enable-projectm       projectM visualization plugin (default enabled)])
3917 AS_IF([test "${enable_projectm}" != "no"],
3918   [
3919     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3920     [
3921       VLC_ADD_PLUGIN([projectm])
3922       VLC_ADD_CXXFLAGS([projectm],[$PROJECTM_CFLAGS])
3923       VLC_ADD_LIBS([projectm],[$PROJECTM_LIBS])
3924       PKG_CHECK_MODULES(PROJECTM2, [libprojectM >= 2.0.0],
3925         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3926         [ AC_MSG_WARN( [Using libprojectM version 1] )
3927       ])
3928     ],[
3929       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3930     ])
3931   ])
3932
3933 dnl
3934 dnl Vovoid VSXu visualization plugin
3935 dnl
3936 AC_ARG_ENABLE(vsxu,
3937   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3938 AS_IF([test "${enable_vsxu}" != "no"],
3939   [
3940     PKG_CHECK_MODULES(VSXU, libvsxu,
3941     [
3942       VLC_ADD_PLUGIN([vsxu])
3943       VLC_ADD_CXXFLAGS([vsxu],[$VSXU_CFLAGS])
3944       VLC_ADD_LIBS([vsxu],[$VSXU_LIBS])
3945     ],[
3946       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3947     ])
3948   ])
3949
3950 dnl
3951 dnl  AtmoLight (homemade Philips Ambilight clone)
3952 dnl
3953 AC_ARG_ENABLE(atmo,
3954 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
3955                 (default enabled)]),, [enable_atmo="yes"])
3956 AS_IF([test "${enable_atmo}" != no], [
3957   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
3958     AC_LANG_PUSH(C++)
3959     VLC_ADD_PLUGIN([atmo])
3960     AC_LANG_POP(C++)
3961   ])
3962 ])
3963
3964 dnl
3965 dnl  glSpectrum
3966 dnl
3967 AC_ARG_ENABLE(glspectrum,
3968   [  --enable-glspectrum    3D OpenGL spectrum visualization (default auto)])
3969 if test "${enable_glspectrum}" != "no" && test "${have_gl}" = "yes"
3970 then
3971     VLC_ADD_PLUGIN([glspectrum])
3972     VLC_ADD_LIBS([glspectrum],[$GL_LIBS])
3973 fi
3974
3975 EXTEND_HELP_STRING([Service Discovery plugins:])
3976 dnl
3977 dnl  Bonjour services discovery
3978 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3979
3980 dnl
3981 dnl  libudev services discovery
3982 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3983
3984 dnl
3985 dnl MTP devices services discovery
3986 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3987
3988 dnl
3989 dnl UPnP Plugin (Intel SDK)
3990 dnl
3991 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
3992 VLC_ADD_CXXFLAGS([upnp],[${UPNP_CFLAGS}])
3993
3994 EXTEND_HELP_STRING([Misc options:])
3995
3996 dnl
3997 dnl  libxml2 module
3998 dnl
3999 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
4000
4001
4002 dnl
4003 dnl libgcrypt
4004 dnl
4005 AC_ARG_ENABLE(libgcrypt,
4006   [  --disable-libgcrypt     gcrypt support (default enabled)])
4007 AS_IF([test "${enable_libgcrypt}" != "no"], [
4008   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
4009     libgcrypt-config --version >/dev/null || \
4010         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
4011     AC_CHECK_LIB(gcrypt, gcry_control, [
4012       have_libgcrypt="yes"
4013       GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
4014       GCRYPT_LIBS="`libgcrypt-config --libs`"
4015     ], [
4016       AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
4017     ], [`libgcrypt-config --libs`])
4018   ], [
4019     AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
4020   ], [#include <gcrypt.h>]
4021   )
4022 ])
4023
4024 AC_SUBST(GCRYPT_CFLAGS)
4025 AC_SUBST(GCRYPT_LIBS)
4026 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
4027
4028 dnl
4029 dnl TLS/SSL
4030 dnl
4031 AC_ARG_ENABLE(gnutls,
4032   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4033 AS_IF([test "${enable_gnutls}" != "no"], [
4034   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.0.20], [
4035     VLC_ADD_PLUGIN([gnutls])
4036   ], [
4037     AS_IF([test -n "${enable_gnutls}"], [
4038       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4039     ])
4040   ])
4041 ])
4042
4043
4044 dnl
4045 dnl Taglib plugin
4046 dnl
4047 AC_ARG_ENABLE(taglib,
4048   [AS_HELP_STRING([--disable-taglib],
4049     [do not use TagLib (default enabled)])])
4050 AS_IF([test "${enable_taglib}" != "no"], [
4051   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.6.1, [
4052     VLC_ADD_PLUGIN([taglib])
4053   ], [
4054     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4055 ])
4056
4057
4058 dnl
4059 dnl update checking system
4060 dnl
4061 AC_ARG_ENABLE(update-check,
4062   [  --enable-update-check   update checking system (default disabled)])
4063 if test "${enable_update_check}" = "yes"
4064 then
4065   if test "${have_libgcrypt}" != "yes"
4066   then
4067     AC_MSG_ERROR([libgcrypt is required for update checking system])
4068   fi
4069   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4070   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4071   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4072 fi
4073
4074 dnl
4075 dnl Growl notification plugin
4076 dnl
4077 AC_ARG_ENABLE(growl,
4078   [  --enable-growl          growl notification plugin (default disabled)],,
4079   [enable_growl=no])
4080 AS_IF([test "${enable_growl}" != "no"], [
4081     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4082       VLC_ADD_PLUGIN([growl])
4083       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4084       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
4085       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
4086     ])
4087   ]
4088 )
4089
4090 dnl
4091 dnl Libnotify notification plugin
4092 dnl
4093 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4094
4095 dnl
4096 dnl  Endianness check
4097 dnl
4098 AC_C_BIGENDIAN
4099 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4100   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4101 ], [
4102   DEFS_BIGENDIAN=""
4103 ])
4104 AC_SUBST(DEFS_BIGENDIAN)
4105
4106 dnl
4107 dnl Where to install KDE solid .desktop
4108 dnl
4109 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4110 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4111   KDE4_CONFIG="kde4-config"
4112 ])
4113
4114 AC_ARG_WITH(kde-solid,
4115   AS_HELP_STRING([--with-kde-solid=PATH],
4116                  [KDE Solid actions directory (auto)]),, [
4117
4118 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4119   with_kde_solid="yes"
4120 fi
4121 ])
4122 soliddatadir=""
4123 AS_IF([test "${with_kde_solid}" != "no"], [
4124   AS_IF([test "${with_kde_solid}" = "yes"], [
4125     kde4datadir="`${KDE4_CONFIG} --install data`"
4126     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4127     soliddatadir="${kde4datadir}/solid/actions"
4128   ], [
4129     soliddatadir="${with_kde_solid}"
4130   ])
4131 ])
4132 AC_SUBST(soliddatadir)
4133 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4134
4135 EXTEND_HELP_STRING([Components:])
4136
4137 dnl
4138 dnl  the VLC binary
4139 dnl
4140 AC_ARG_ENABLE(vlc,
4141   [  --enable-vlc            build the VLC media player (default enabled)])
4142 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4143
4144 AC_ARG_ENABLE(macosx-vlc-app,
4145   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4146 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4147     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4148
4149 dnl
4150 dnl  Stuff used by the program
4151 dnl
4152 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4153 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4154 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4155 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4156 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4157 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4158 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4159 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4160 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4161 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4162 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4163 AC_SUBST(COPYRIGHT_MESSAGE)
4164 AC_SUBST(VERSION_MESSAGE)
4165 AC_SUBST(VERSION_MAJOR)
4166 AC_SUBST(VERSION_MINOR)
4167 AC_SUBST(VERSION_REVISION)
4168 AC_SUBST(VERSION_EXTRA)
4169 AC_SUBST(COPYRIGHT_YEARS)
4170 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4171 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4172 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4173 dnl
4174 dnl  Handle substvars that use $(top_srcdir)
4175 dnl
4176 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4177
4178 dnl
4179 dnl  Configuration is finished
4180 dnl
4181 AC_SUBST(SYS)
4182 AC_SUBST(ARCH)
4183 AC_SUBST(ALIASES)
4184 AC_SUBST(ASM)
4185 AC_SUBST(MOC)
4186 AC_SUBST(RCC)
4187 AC_SUBST(UIC)
4188 AC_SUBST(WINDRES)
4189 AC_SUBST(WINE_SDK_PATH)
4190 AC_SUBST(LIBEXT)
4191 AC_SUBST(AM_CPPFLAGS)
4192 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4193 AC_SUBST(FILE_LIBVLCCORE_DLL)
4194 AC_SUBST(FILE_LIBVLC_DLL)
4195
4196 AC_CONFIG_FILES([
4197   Makefile
4198   doc/Makefile
4199   modules/Makefile
4200   m4/Makefile
4201   po/Makefile.in
4202   share/Makefile
4203   compat/Makefile
4204   src/Makefile
4205   lib/Makefile
4206   bin/Makefile
4207   test/Makefile
4208   modules/access/rtp/Makefile
4209   modules/access_output/Makefile
4210   modules/audio_filter/Makefile
4211   modules/audio_mixer/Makefile
4212   modules/audio_output/Makefile
4213   modules/control/Makefile
4214   modules/gui/Makefile
4215   modules/gui/macosx/Makefile
4216   modules/gui/minimal_macosx/Makefile
4217   modules/gui/macosx_dialog_provider/Makefile
4218   modules/gui/qt4/Makefile
4219   modules/gui/skins2/Makefile
4220   modules/lua/Makefile
4221   modules/misc/Makefile
4222   modules/mux/Makefile
4223   modules/notify/Makefile
4224   modules/packetizer/Makefile
4225   modules/services_discovery/Makefile
4226   modules/stream_filter/Makefile
4227   modules/stream_out/Makefile
4228   modules/text_renderer/Makefile
4229   modules/video_chroma/Makefile
4230   modules/video_filter/Makefile
4231   modules/video_output/Makefile
4232   modules/video_splitter/Makefile
4233   modules/visualization/Makefile
4234   modules/arm_neon/Makefile
4235   modules/hw/vdpau/Makefile
4236 ])
4237
4238 AM_COND_IF([HAVE_WIN32], [
4239   AC_CONFIG_FILES([
4240     extras/package/win32/NSIS/spad.nsi
4241     extras/package/win32/NSIS/vlc.win32.nsi
4242     extras/package/win32/msi/config.wxi
4243   ])
4244 ])
4245
4246 AM_COND_IF([HAVE_DARWIN], [
4247   AC_CONFIG_FILES([
4248     extras/package/macosx/Info.plist
4249     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4250   ])
4251 ])
4252
4253 dnl Generate makefiles
4254 AC_OUTPUT
4255
4256 dnl Do we have to use make or gmake ?
4257 if make --version 2>&1|grep -q GNU
4258 then
4259     # GNU make, all seems good
4260     MAKE=make
4261 else
4262     # Known GNU make alias (on BSD)
4263     MAKE=gmake
4264 fi
4265 dnl Shortcut to nice compile message
4266 if test -n $SHELL; then
4267   SHELL=${CONFIG_SHELL-/bin/sh}
4268 fi
4269 rm -f compile
4270 echo "#! $SHELL
4271 rm -f .error\$\$
4272 ERROR=0
4273 export PATH=\"$PATH\" LANG=C
4274 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| `sed -ne \"s/^top_srcdir *= *//p\" < Makefile`/extras/buildsystem/make.pl
4275 test -f .error\$\$ && ERROR=1
4276 rm -f .error\$\$
4277 exit \$ERROR" >compile
4278 chmod a+x compile
4279
4280 echo "
4281 libvlc configuration
4282 --------------------
4283 version               : ${VERSION}
4284 system                : ${SYS}
4285 architecture          : ${ARCH}
4286 optimizations         : ${enable_optimizations}"
4287 if test "${enable_vlc}" != "no"; then
4288 echo "vlc aliases           :${ALIASES}"
4289 else
4290 echo "build vlc executable  : no"
4291 fi
4292 echo "
4293 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."