]> git.sesse.net Git - vlc/blob - configure.ac
lua: remove recursion
[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_shout sap stream_out_standard stream_out_rtp stream_out_raop vod_rtsp rtp oldrc netsync gnutls ts 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 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
691 dnl Check for thread library
692 LIBPTHREAD=""
693 AS_IF([test "${SYS}" != "mingw32"], [
694   VLC_SAVE_FLAGS
695   LIBS=""
696   AC_SEARCH_LIBS(pthread_rwlock_init, pthread pthreads c_r, [
697     AS_IF([test "$ac_cv_search_pthread_rwlock_init" != "none required"], [
698       LIBPTHREAD="$ac_cv_search_pthread_rwlock_init"
699     ])
700   ])
701   VLC_RESTORE_FLAGS
702
703   AC_CHECK_LIB(rt, clock_nanosleep, [
704     VLC_ADD_LIBS([libvlccore],[-lrt])
705   ], [
706     AC_CHECK_FUNC(nanosleep,,[
707       AC_CHECK_LIB(rt,nanosleep, [
708         VLC_ADD_LIBS([libvlccore],[-lrt])
709       ], [
710         AC_CHECK_LIB(posix4,nanosleep, [
711           VLC_ADD_LIBS([libvlccore],[-lposix4])
712         ])
713       ])
714     ])
715     dnl HP/UX port
716     AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlccore],[-lrt])])
717   ])
718 ])
719 AC_SUBST(LIBPTHREAD)
720
721 dnl Check for headers
722 AC_CHECK_HEADERS([search.h])
723 AC_CHECK_HEADERS(getopt.h locale.h xlocale.h)
724 AC_CHECK_HEADERS([sys/time.h sys/ioctl.h])
725 AC_CHECK_HEADERS([arpa/inet.h netinet/udplite.h sys/eventfd.h])
726 AC_CHECK_HEADERS([net/if.h], [], [],
727   [
728     #include <sys/types.h>
729     #include <sys/socket.h>
730   ])
731 AC_CHECK_HEADERS([sys/mount.h], [], [],
732   [
733     #include <sys/param.h>
734   ])
735
736 if test "${SYS}" != "mingw32"; then
737   AC_CHECK_HEADERS(machine/param.h sys/shm.h)
738   AC_CHECK_HEADERS([linux/version.h linux/dccp.h scsi/scsi.h linux/magic.h])
739   AC_CHECK_HEADERS(syslog.h mntent.h)
740 fi # end "${SYS}" != "mingw32"
741
742 dnl LP64 and LLP64 architectures had better define ssize_t by themselves...
743 AH_TEMPLATE(ssize_t, [Define to `int' if <stddef.h> does not define.]) dnl ` (fix VIM syntax highlight
744 AC_CHECK_TYPE(ssize_t,, [
745   AC_DEFINE(ssize_t, int)
746 ])
747
748 dnl Check for threads library
749 if test "${SYS}" != "mingw32"; then
750   AC_CHECK_HEADERS(pthread.h)
751 fi # end "${SYS}" != "mingw32"
752
753 dnl It seems that autoconf detects pkg-config only during the first
754 dnl PKG_CHECK_MODULES from configure.ac - which makes sense. But in our case,
755 dnl it is nested within a conditional block, so it was not working right.
756 dnl Make PKG_CONFIG_PATH precious so that it appears in the help and get saved
757 AC_ARG_VAR(PKG_CONFIG_PATH,
758        [Paths where to find .pc not at the default location])
759 PKG_PROG_PKG_CONFIG()
760
761 dnl On some OS we need static linking
762 AS_IF([test -n "${PKG_CONFIG}" ],[
763     AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin" -o "${SYS}" = "os2" ],[
764         PKG_CONFIG="${PKG_CONFIG} --static"
765     ])
766 ])
767
768
769 dnl
770 dnl Check for zlib.h and -lz along with system -lminizip if available
771 dnl
772 AC_CHECK_HEADERS(zlib.h, [ have_zlib=yes ], [ have_zlib=no ])
773 AM_CONDITIONAL(HAVE_ZLIB, [ test "${have_zlib}" = "yes" ])
774 if test "${have_zlib}" = "yes"
775 then
776   VLC_ADD_LIBS([skins2 sap unzip zip],[-lz])
777   PKG_CHECK_MODULES([MINIZIP], [minizip] , [ have_minizip=yes ], [
778     AC_CHECK_HEADERS([unzip.h], [
779       have_minizip=yes
780       MINIZIP_LIBS="-lminizip -lz"
781     ], [
782       VLC_ADD_CPPFLAGS([skins2], [-I\\\$(top_srcdir)/modules/access/zip/unzip])
783       VLC_ADD_LIBS([skins2], [\\\$(top_builddir)/modules/libunzip.la])
784       have_minizip=no
785     ])
786   ])
787   VLC_ADD_CPPFLAGS([skins2],[$MINIZIP_CFLAGS])
788   VLC_ADD_LIBS([skins2],[$MINIZIP_LIBS])
789 fi
790 AM_CONDITIONAL(HAVE_MINIZIP, [ test "${have_minizip}" = "yes" ])
791
792
793 dnl
794 dnl Domain name i18n support via GNU libidn
795 dnl
796 PKG_CHECK_MODULES([IDN], [libidn], [
797   have_libidn="yes"
798   AC_DEFINE([HAVE_IDN], 1, [Define to 1 if you have GNU libidn.])
799 ], [
800   have_libidn="no"
801 ])
802
803
804 dnl Check for dbus
805 AC_ARG_ENABLE(dbus,
806   [AS_HELP_STRING([--enable-dbus],
807     [compile D-Bus message bus support (default enabled)])])
808 have_dbus="no"
809 AS_IF([test "${enable_dbus}" != "no"], [
810   PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.6.0], [
811     have_dbus="yes"
812   ], [
813     AS_IF([test -n "${enable_dbus}"], [
814       AC_MSG_ERROR([${DBUS_PKG_ERRORS}.])
815     ], [
816       AC_MSG_WARN([${DBUS_PKG_ERRORS}.])
817     ])
818   ])
819 ])
820 AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
821
822 dnl Check for ntohl, etc.
823 VLC_SAVE_FLAGS
824 CFLAGS="${CFLAGS} -Wall -Werror"
825 AC_CACHE_CHECK([for ntohl in sys/param.h],
826     [ac_cv_c_ntohl_sys_param_h],
827     [     AC_TRY_COMPILE([#include <sys/param.h>],
828         [int meuh; ntohl(meuh);],
829         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
830 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
831     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
832 fi
833 VLC_RESTORE_FLAGS
834
835 EXTEND_HELP_STRING([Optimization options:])
836 dnl
837 dnl  Compiler warnings
838 dnl
839
840 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])
841 RDC_PROG_CC_FLAGS([-pipe])
842 AC_LANG_PUSH([C++])
843 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
844 AC_LANG_POP([C++])
845
846 dnl
847 dnl  Debugging mode
848 dnl
849 AC_ARG_ENABLE(debug,
850   [AS_HELP_STRING([--enable-debug],
851     [build with run-time assertions (default disabled)])],,
852   [enable_debug="no"])
853 AH_TEMPLATE(NDEBUG,
854             [Define to 1 if debug code should NOT be compiled])
855 AS_IF([test "${enable_debug}" != "no"], [
856   AC_CHECK_HEADERS([valgrind/valgrind.h])
857 ], [
858   AC_DEFINE(NDEBUG)
859 ])
860
861 dnl
862 dnl  Profiling
863 dnl
864 AC_ARG_ENABLE(gprof,
865   [AS_HELP_STRING([--enable-gprof],[profile with gprof (default disabled)])],,
866   [enable_gprof="no"])
867 AS_IF([test "${enable_gprof}" != "no"], [
868   CFLAGS="${CFLAGS} -pg"
869   CXXFLAGS="${CXXFLAGS} -pg"
870   OBJCFLAGS="${OBJCFLAGS} -pg"
871   LDFLAGS="${LDFLAGS} -pg"
872 ])
873
874 AC_ARG_ENABLE(cprof,
875   [AS_HELP_STRING([--enable-cprof],[profile with cprof (default disabled)])],,
876   [enable_cprof="no"])
877 AS_IF([test "${enable_gprof}" != "no"], [
878   CFLAGS="${CFLAGS} -finstrument-functions"
879   CXXFLAGS="${CXXFLAGS} -finstrument-functions"
880   OBJCFLAGS="${OBJCFLAGS} -finstrument-functions"
881   LDFLAGS="${LDFLAGS} -finstrument-functions"
882 ])
883
884 dnl
885 dnl  Test coverage
886 dnl
887 AC_ARG_ENABLE(coverage,
888   [AS_HELP_STRING([--enable-coverage],
889     [build for test coverage (default disabled)])],,
890   [enable_coverage="no"])
891 AS_IF([test "${enable_coverage}" != "no"], [
892   CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}"
893   CXXFLAGS="-fprofile-arcs -ftest-coverage ${CXXFLAGS}"
894   LDFLAGS="-lgcov ${LDFLAGS}"
895 ])
896
897 AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "os2"], [
898   VLC_SAVE_FLAGS
899   CFLAGS="${CFLAGS} -fvisibility=hidden"
900   CXXFLAGS="${CXXFLAGS} -fvisibility=hidden"
901   OBJCFLAGS="${OBJCFLAGS} -fvisibility=hidden"
902   AC_CACHE_CHECK([if $CC accepts -fvisibility=hidden],
903                  [ac_cv_c_visibility_hidden], [
904     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
905       ac_cv_c_visibility_hidden=yes
906     ], [
907       ac_cv_c_visibility_hidden=no
908     ])
909   ])
910   AS_IF([test "${ac_cv_c_visibility_hidden}" = "no"], [VLC_RESTORE_FLAGS])
911 ])
912
913
914 dnl
915 dnl  Enable/disable optimizations
916 dnl
917 AC_ARG_ENABLE(optimizations,
918   [AS_HELP_STRING([--disable-optimizations],
919     [disable compiler optimizations (default enabled)])],,
920   [enable_optimizations="yes"])
921
922 dnl Check for various optimization flags
923 AS_IF([test "${enable_optimizations}" != "no"], [
924
925   dnl -O4 and -O3 only in production builds
926   AS_IF([test "{enable_debug}" = "no"], [
927     VLC_SAVE_FLAGS
928     CFLAGS="${CFLAGS} -O4"
929     CXXFLAGS="${CXXFLAGS} -O4"
930     OBJCFLAGS="${OBJCFLAGS} -O4"
931     AC_CACHE_CHECK([if $CC accepts -O4], [ac_cv_c_o4], [
932       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
933         ac_cv_c_o4=yes
934       ], [
935         ac_cv_c_o4=no
936       ])
937     ])
938     AS_IF([test "${ac_cv_c_o4}" = "no"], [
939       VLC_RESTORE_FLAGS
940       CFLAGS="${CFLAGS} -O3"
941       CXXFLAGS="${CXXFLAGS} -O3"
942       OBJCFLAGS="${OBJCFLAGS} -O3"
943       AC_CACHE_CHECK([if $CC accepts -O3],  [ac_cv_c_o3], [
944         AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
945           ac_cv_c_o3=yes
946         ], [
947           ac_cv_c_o3=no
948         ])
949       ])
950       AS_IF([test "${ac_cv_c_o3}" = "no"], [VLC_RESTORE_FLAGS])
951     ])
952   ])
953
954   dnl Check for -ffast-math
955   VLC_SAVE_FLAGS
956   CFLAGS="${CFLAGS} -ffast-math"
957   CXXFLAGS="${CXXFLAGS} -ffast-math"
958   OBJCFLAGS="${OBJCFLAGS} -ffast-math"
959   AC_CACHE_CHECK([if $CC accepts -ffast-math], [ac_cv_c_fast_math], [
960     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
961       ac_cv_c_fast_math=yes
962     ], [
963       ac_cv_c_fast_math=no
964     ])
965   ])
966   AS_IF([test "${ac_cv_c_fast_math}" = "no"], [VLC_RESTORE_FLAGS])
967   AH_BOTTOM([
968 #ifndef __FAST_MATH__
969 # pragma STDC FENV_ACCESS OFF
970 # pragma STDC FP_CONTRACT ON
971 #endif
972 ])
973
974   dnl Check for -funroll-loops
975   VLC_SAVE_FLAGS
976   CFLAGS="${CFLAGS} -funroll-loops"
977   CXXFLAGS="${CXXFLAGS} -funroll-loops"
978   OBJCFLAGS="${OBJCFLAGS} -funroll-loops"
979   AC_CACHE_CHECK([if $CC accepts -funroll-loops], [ac_cv_c_unroll_loops], [
980     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
981       ac_cv_c_unroll_loops=yes
982     ], [
983       ac_cv_c_unroll_loops=no
984     ])
985   ])
986   AS_IF([test "${ac_cv_c_unroll_loops}" = "no"], [VLC_RESTORE_FLAGS])
987
988   AS_IF([test "$enable_debug" = "no"], [
989     dnl Check for -fomit-frame-pointer
990     VLC_SAVE_FLAGS
991     CFLAGS="${CFLAGS} -fomit-frame-pointer"
992     CXXFLAGS="${CXXFLAGS} -fomit-frame-pointer"
993     OBJCFLAGS="${OBJCFLAGS} -fomit-frame-pointer"
994     AC_CACHE_CHECK([if $CC accepts -fomit-frame-pointer],
995       [ac_cv_c_omit_frame_pointer], [
996       AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
997         ac_cv_c_omit_frame_pointer=yes
998       ], [
999         ac_cv_c_omit_frame_pointer=no
1000       ])
1001     ])
1002     AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS])
1003   ])
1004 ])
1005
1006 VLC_SAVE_FLAGS
1007 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
1008 AC_CACHE_CHECK([if linker supports -Bsymbolic], [ac_cv_ld_bsymbolic], [
1009   AC_TRY_LINK([],, [
1010     ac_cv_ld_bsymbolic="-Wl,-Bsymbolic"
1011   ], [
1012     ac_cv_ld_bsymbolic=""
1013   ])
1014 ])
1015 VLC_RESTORE_FLAGS
1016 SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
1017 AC_SUBST(SYMBOLIC_LDFLAGS)
1018
1019 dnl Check for Darwin plugin linking flags
1020 AS_IF([test "${SYS}" = "darwin"], [
1021   VLC_SAVE_FLAGS
1022   CFLAGS="${CFLAGS} -bundle -undefined error"
1023   AC_CACHE_CHECK([if $CC accepts -bundle -undefined error],
1024     [ac_cv_ld_darwin], [
1025     AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
1026       ac_cv_ld_darwin=yes
1027     ], [
1028       ac_cv_ld_darwin=no
1029     ])
1030   ])
1031   AS_IF([test "${ac_cv_ld_darwin}" != "no"], [
1032     VLC_ADD_LDFLAGS([plugin],[-bundle -undefined error])
1033   ])
1034   VLC_RESTORE_FLAGS
1035 ])
1036
1037 dnl Checks for __attribute__(aligned()) directive
1038 VLC_SAVE_FLAGS
1039 CFLAGS="${CFLAGS} -Werror"
1040 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
1041     [ac_cv_c_attribute_aligned],
1042     [ac_cv_c_attribute_aligned=0
1043     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
1044         AC_TRY_COMPILE([],
1045         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
1046         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
1047     done])
1048 VLC_RESTORE_FLAGS
1049 if test "${ac_cv_c_attribute_aligned}" != "0"; then
1050     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
1051         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
1052 fi
1053
1054 dnl Check for __attribute__((packed))
1055 AC_CACHE_CHECK([for __attribute__((packed))],
1056   [ac_cv_c_attribute_packed],
1057   [ac_cv_c_attribute_packed=no
1058    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b; (void)b;],
1059                     [ac_cv_c_attribute_packed=yes])])
1060 if test "${ac_cv_c_attribute_packed}" != "no"; then
1061   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
1062 fi
1063
1064 dnl
1065 dnl  Check the CPU
1066 dnl
1067 case "${host_cpu}" in
1068   "")
1069     ARCH=unknown
1070     ;;
1071   *)
1072     ARCH="${host_cpu}"
1073     ;;
1074 esac
1075
1076 dnl Check for backtrace() support
1077 AC_CHECK_HEADERS(execinfo.h)
1078 AC_CHECK_FUNCS(backtrace)
1079
1080 dnl
1081 dnl  default modules
1082 dnl
1083 ALIASES="${ALIASES} cvlc rvlc"
1084
1085 dnl
1086 dnl  Accelerated modules
1087 dnl
1088
1089 dnl  Check for fully working MMX intrinsics
1090 dnl  We need support for -mmmx, we need <mmintrin.h>, and we also need a
1091 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1092 AC_ARG_ENABLE(mmx,
1093   [AS_HELP_STRING([--disable-mmx],
1094     [disable MMX optimizations (default auto)])],,[
1095   case "${host_cpu}" in
1096     i?86|x86_64)
1097       enable_mmx="yes"
1098       ;;
1099     *)
1100       enable_mmx="no"
1101       ;;
1102   esac
1103 ])
1104 have_mmx="no"
1105 have_mmxext="no"
1106 AS_IF([test "${enable_mmx}" != "no"], [
1107   ARCH="${ARCH} mmx"
1108   VLC_SAVE_FLAGS
1109   CFLAGS="${CFLAGS} -mmmx"
1110   AC_CACHE_CHECK([if $CC groks MMX intrinsics], [ac_cv_c_mmx_intrinsics], [
1111     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1112 [#include <mmintrin.h>
1113 #include <stdint.h>
1114 uint64_t frobzor;]], [
1115 [__m64 a, b, c;
1116 a = b = c = (__m64)frobzor;
1117 a = _mm_slli_pi16(a, 3);
1118 a = _mm_adds_pi16(a, b);
1119 c = _mm_srli_pi16(c, 8);
1120 c = _mm_slli_pi16(c, 3);
1121 b = _mm_adds_pi16(b, c);
1122 a = _mm_unpacklo_pi8(a, b);
1123 frobzor = (uint64_t)a;]])], [
1124       ac_cv_c_mmx_intrinsics=yes
1125     ], [
1126       ac_cv_c_mmx_intrinsics=no
1127     ])
1128   ])
1129   VLC_RESTORE_FLAGS
1130   AS_IF([test "${ac_cv_c_mmx_intrinsics}" != "no"], [
1131     AC_DEFINE(HAVE_MMX_INTRINSICS, 1, [Define to 1 if MMX intrinsics are available.])
1132   ])
1133
1134   VLC_SAVE_FLAGS
1135   CFLAGS="${CFLAGS} -mmmx"
1136   AC_CACHE_CHECK([if $CC groks MMX inline assembly], [ac_cv_mmx_inline], [
1137     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1138 void *p;
1139 asm volatile("packuswb %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1140 ]])
1141     ], [
1142       ac_cv_mmx_inline=yes
1143     ], [
1144       ac_cv_mmx_inline=no
1145     ])
1146   ])
1147   AS_IF([test "${ac_cv_mmx_inline}" != "no"], [
1148     AC_DEFINE(CAN_COMPILE_MMX, 1, [Define to 1 inline MMX assembly is available.])
1149     have_mmx="yes"
1150   ])
1151
1152   AC_CACHE_CHECK([if $CC groks MMX EXT inline assembly],
1153                  [ac_cv_mmxext_inline], [
1154     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1155 void *p;
1156 asm volatile("maskmovq %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1157 ]])
1158     ], [
1159       ac_cv_mmxext_inline=yes
1160     ], [
1161       ac_cv_mmxext_inline=no
1162     ])
1163   ])
1164   VLC_RESTORE_FLAGS
1165   AS_IF([test "${ac_cv_mmxext_inline}" != "no"], [
1166     AC_DEFINE(CAN_COMPILE_MMXEXT, 1, [Define to 1 if MMX EXT inline assembly is available.])
1167     have_mmxext="yes"
1168   ])
1169 ])
1170 AM_CONDITIONAL([HAVE_MMX], [test "${have_mmx}" = "yes"])
1171 AM_CONDITIONAL([HAVE_MMXEXT], [test "${have_mmxext}" = "yes"])
1172
1173 dnl  Check for fully workin SSE2 intrinsics
1174 dnl  We need support for -mmmx, we need <emmintrin.h>, and we also need a
1175 dnl  working compiler (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23963)
1176 AC_ARG_ENABLE(sse,
1177   [AS_HELP_STRING([--disable-sse],
1178     [disable SSE (1-4) optimizations (default auto)])],, [
1179   case "${host_cpu}" in
1180     i?86|x86_64)
1181       enable_sse=yes
1182       ;;
1183     *)
1184       enable_sse=no
1185       ;;
1186   esac
1187 ])
1188 have_sse2="no"
1189 AS_IF([test "${enable_sse}" != "no"], [
1190   ARCH="${ARCH} sse sse2"
1191
1192   VLC_SAVE_FLAGS
1193   CFLAGS="${CFLAGS} -msse2"
1194   AC_CACHE_CHECK([if $CC groks SSE2 intrinsics], [ac_cv_c_sse2_intrinsics], [
1195     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1196 [#include <emmintrin.h>
1197 #include <stdint.h>
1198 uint64_t frobzor;]], [
1199 [__m128i a, b, c;
1200 a = b = c = _mm_set1_epi64((__m64)frobzor);
1201 a = _mm_slli_epi16(a, 3);
1202 a = _mm_adds_epi16(a, b);
1203 c = _mm_srli_epi16(c, 8);
1204 c = _mm_slli_epi16(c, 3);
1205 b = _mm_adds_epi16(b, c);
1206 a = _mm_unpacklo_epi8(a, b);
1207 frobzor = (uint64_t)_mm_movepi64_pi64(a);]])], [
1208       ac_cv_c_sse2_intrinsics=yes
1209     ], [
1210       ac_cv_c_sse2_intrinsics=no
1211     ])
1212   ])
1213   VLC_RESTORE_FLAGS
1214   AS_IF([test "${ac_cv_c_sse2_intrinsics}" != "no"], [
1215     AC_DEFINE(HAVE_SSE2_INTRINSICS, 1, [Define to 1 if SSE2 intrinsics are available.])
1216   ])
1217
1218   VLC_SAVE_FLAGS
1219   CFLAGS="${CFLAGS} -msse"
1220   AC_CACHE_CHECK([if $CC groks SSE inline assembly], [ac_cv_sse_inline], [
1221     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1222 void *p;
1223 asm volatile("xorps %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1224 ]])
1225     ], [
1226       ac_cv_sse_inline=yes
1227     ], [
1228       ac_cv_sse_inline=no
1229     ])
1230   ])
1231
1232   AS_IF([test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "solaris"], [
1233     AC_DEFINE(CAN_COMPILE_SSE, 1, [Define to 1 if SSE inline assembly is available.])
1234   ])
1235
1236   AC_CACHE_CHECK([if $CC groks SSE2 inline assembly], [ac_cv_sse2_inline], [
1237     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1238 void *p;
1239 asm volatile("punpckhqdq %%xmm1,%%xmm2"::"r"(p):"xmm1", "xmm2");
1240 ]])
1241     ], [
1242       ac_cv_sse2_inline=yes
1243     ], [
1244       ac_cv_sse2_inline=no
1245     ])
1246   ])
1247   AS_IF([test "${ac_cv_sse2_inline}" != "no" -a "${SYS}" != "solaris"], [
1248     AC_DEFINE(CAN_COMPILE_SSE2, 1, [Define to 1 if SSE2 inline assembly is available.])
1249     have_sse2="yes"
1250   ])
1251
1252   # SSE3
1253   AC_CACHE_CHECK([if $CC groks SSE3 inline assembly], [ac_cv_sse3_inline], [
1254     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1255 void *p;
1256 asm volatile("movsldup %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1257 ]])
1258     ], [
1259       ac_cv_sse3_inline=yes
1260     ], [
1261       ac_cv_sse3_inline=no
1262     ])
1263   ])
1264
1265   AS_IF([test "${ac_cv_sse3_inline}" != "no"], [
1266     AC_DEFINE(CAN_COMPILE_SSE3, 1, [Define to 1 if SSE3 inline assembly is available.]) ])
1267   # SSSE3
1268   AC_CACHE_CHECK([if $CC groks SSSE3 inline assembly], [ac_cv_ssse3_inline], [
1269     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1270 void *p;
1271 asm volatile("pabsw %%xmm0,%%xmm0"::"r"(p):"xmm0");
1272 ]])
1273     ], [
1274       ac_cv_ssse3_inline=yes
1275     ], [
1276       ac_cv_ssse3_inline=no
1277     ])
1278   ])
1279
1280   AS_IF([test "${ac_cv_ssse3_inline}" != "no"], [
1281     AC_DEFINE(CAN_COMPILE_SSSE3, 1, [Define to 1 if SSSE3 inline assembly is available.]) ])
1282
1283   # SSE4.1
1284   AC_CACHE_CHECK([if $CC groks SSE4.1 inline assembly],
1285                  [ac_cv_sse4_1_inline], [
1286     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1287 void *p;
1288 asm volatile("pmaxsb %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1289 ]])
1290     ], [
1291       ac_cv_sse4_1_inline=yes
1292     ], [
1293       ac_cv_sse4_1_inline=no
1294     ])
1295   ])
1296
1297   AS_IF([test "${ac_cv_sse4_1_inline}" != "no"], [
1298     AC_DEFINE(CAN_COMPILE_SSE4_1, 1, [Define to 1 if SSE4_1 inline assembly is available.]) ])
1299
1300   # SSE4.2
1301   AC_CACHE_CHECK([if $CC groks SSE4.2 inline assembly],
1302                  [ac_cv_sse4_2_inline], [
1303     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1304 void *p;
1305 asm volatile("pcmpgtq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1306 ]])
1307     ], [
1308       ac_cv_sse4_2_inline=yes
1309     ], [
1310       ac_cv_sse4_2_inline=no
1311     ])
1312   ])
1313
1314   AS_IF([test "${ac_cv_sse4_2_inline}" != "no"], [
1315     AC_DEFINE(CAN_COMPILE_SSE4_2, 1, [Define to 1 if SSE4_2 inline assembly is available.]) ])
1316
1317   # SSE4A
1318   AC_CACHE_CHECK([if $CC groks SSE4A inline assembly], [ac_cv_sse4a_inline], [
1319     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1320 void *p;
1321 asm volatile("insertq %%xmm1,%%xmm0"::"r"(p):"xmm0", "xmm1");
1322 ]])
1323     ], [
1324       ac_cv_sse4a_inline=yes
1325     ], [
1326       ac_cv_sse4a_inline=no
1327     ])
1328   ])
1329   VLC_RESTORE_FLAGS
1330   AS_IF([test "${ac_cv_sse4a_inline}" != "no"], [
1331     AC_DEFINE(CAN_COMPILE_SSE4A, 1, [Define to 1 if SSE4A inline assembly is available.]) ])
1332 ])
1333 AM_CONDITIONAL([HAVE_SSE2], [test "$have_sse2" = "yes"])
1334
1335 VLC_SAVE_FLAGS
1336 CFLAGS="${CFLAGS} -mmmx"
1337 have_3dnow="no"
1338 AC_CACHE_CHECK([if $CC groks 3D Now! inline assembly], [ac_cv_3dnow_inline], [
1339   AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[[
1340 void *p;
1341 asm volatile("pfadd %%mm1,%%mm2"::"r"(p):"mm1", "mm2");
1342 ]])
1343   ], [
1344     ac_cv_3dnow_inline=yes
1345   ], [
1346     ac_cv_3dnow_inline=no
1347   ])
1348 ])
1349 VLC_RESTORE_FLAGS
1350 AS_IF([test "${ac_cv_3dnow_inline}" != "no"], [
1351   AC_DEFINE(CAN_COMPILE_3DNOW, 1,
1352             [Define to 1 if 3D Now! inline assembly is available.])
1353   have_3dnow="yes"
1354 ])
1355 AM_CONDITIONAL([HAVE_3DNOW], [test "$have_3dnow" = "yes"])
1356
1357
1358 AC_ARG_ENABLE(neon,
1359   [AS_HELP_STRING([--disable-neon],
1360     [disable NEON optimizations (default auto)])],, [
1361   AS_IF([test "${host_cpu}" = "arm"], [enable_neon="yes"] ,[enable_neon="no"])
1362 ])
1363 AS_IF([test "${enable_neon}" != "no"], [
1364   VLC_SAVE_FLAGS
1365   CFLAGS="${CFLAGS} -mfpu=neon -mhard-float"
1366   AC_CACHE_CHECK([if $CCAS groks ARM NEON assembly], [ac_cv_arm_neon], [
1367     AC_COMPILE_IFELSE([
1368       AC_LANG_PROGRAM(,[[
1369 asm volatile("vqmovun.s64 d0, q1":::"d0");
1370 ]])
1371     ], [
1372       ac_cv_arm_neon="yes"
1373     ], [
1374       ac_cv_arm_neon="no"
1375     ])
1376   ])
1377   VLC_RESTORE_FLAGS
1378 ])
1379 AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_arm_neon}" = "yes"])
1380
1381
1382 AC_ARG_ENABLE(altivec,
1383   [AS_HELP_STRING([--disable-altivec],
1384     [disable AltiVec optimizations (default auto)])],, [
1385   AS_CASE("${host_cpu}", [powerpc*],
1386         [enable_altivec=yes], [enable_altivec=no])
1387 ])
1388 have_altivec="no"
1389 ALTIVEC_CFLAGS=""
1390 AS_IF([test "${enable_altivec}" = "yes"], [
1391   ARCH="${ARCH} altivec";
1392   VLC_SAVE_FLAGS
1393   AC_CACHE_CHECK([if $CC groks AltiVec inline assembly],
1394     [ac_cv_altivec_inline],
1395     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1396          ac_cv_altivec_inline="yes",
1397          [CFLAGS="${CFLAGS} -Wa,-m7400"
1398           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
1399             [ac_cv_altivec_inline="-Wa,-m7400"],
1400             ac_cv_altivec_inline=no)
1401          ])])
1402   VLC_RESTORE_FLAGS
1403   AS_IF([test "${ac_cv_altivec_inline}" != "no"], [
1404     AC_DEFINE(CAN_COMPILE_ALTIVEC, 1,
1405               [Define to 1 if AltiVec inline assembly is available.])
1406     AS_IF([test "${ac_cv_altivec_inline}" != "yes"], [
1407       ALTIVEC_CFLAGS="${ac_cv_altivec_inline}"
1408       VLC_ADD_CFLAGS([libvlccore],[${ac_cv_altivec_inline}])
1409     ])
1410     have_altivec="yes"
1411   ])
1412
1413 dnl The AltiVec C extensions
1414 dnl
1415 dnl There are several possible cases:
1416 dnl - OS X PPC, gcc 4.x: use -mpim-altivec -force_cpusubtype_ALL, don't
1417 dnl                      need <altivec.h>
1418 dnl - OS X PPC, gcc 3.x: need -faltivec, don't need <altivec.h>
1419 dnl - Linux PPC, gcc 3.4, 4.x: need <altivec.h> which requires -maltivec
1420 dnl - Linux PPC, gcc 3.3: need <altivec.h> and -maltivec -mabi=altivec
1421 dnl - Linux PPC, gcc 3.x: need <altivec.h> and -fvec
1422 dnl - Others: test should fail
1423   VLC_SAVE_FLAGS
1424   AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1425   [ac_cv_c_altivec],
1426   [# OS X/PPC test (gcc 4.x)
1427    CFLAGS="${CFLAGS} -mpim-altivec -force_cpusubtype_ALL"
1428    AC_TRY_COMPILE([vector unsigned char foo;],
1429      [vec_ld(0, (unsigned char *)0);],
1430      [ac_cv_c_altivec="-mpim-altivec -force_cpusubtype_ALL"],
1431      [# OS X/PPC test (gcc 3.x)
1432       CFLAGS="${CFLAGS} -faltivec"
1433       AC_TRY_COMPILE([vector unsigned char foo;],
1434         [vec_ld(1 * sizeof(vector float), (unsigned char *)0);],
1435         [ac_cv_c_altivec="-faltivec"],
1436         dnl Below this are the Linux tests
1437         [# Linux/PPC test (gcc 4.x)
1438          CFLAGS="${CFLAGS} -maltivec"
1439          AC_TRY_COMPILE([#include <altivec.h>],
1440            [vec_ld(0, (unsigned char *)0);],
1441            [ac_cv_c_altivec="-maltivec"],
1442            [# Linux/PPC test (gcc 3.3)
1443             CFLAGS="${CFLAGS} -maltivec -mabi=altivec"
1444             AC_TRY_COMPILE([#include <altivec.h>],
1445               [vec_ld(0, (unsigned char *)0);],
1446               [ac_cv_c_altivec=""
1447                ac_cv_c_altivec_abi="-maltivec -mabi=altivec"],
1448               [# Linux/PPC test (gcc 3.3)
1449                CFLAGS="${CFLAGS} -fvec"
1450                AC_TRY_COMPILE([#include <altivec.h>],
1451                  [vec_ld(0, (unsigned char *)0);],
1452                  [ac_cv_c_altivec="-fvec"],
1453                  [ac_cv_c_altivec=no])
1454               ])
1455            ])
1456         ])
1457      ])
1458   ])
1459
1460   VLC_RESTORE_FLAGS
1461   AS_IF([test "${ac_cv_c_altivec}" != "no"], [
1462     CPPFLAGS="${CPPFLAGS} ${ac_cv_c_altivec}"
1463     AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, [Define to 1 if C AltiVec extensions are available.])
1464     VLC_ADD_CFLAGS([libvlccore],[${ac_cv_c_altivec}])
1465     ALTIVEC_CFLAGS="$ALTIVEC_FLAGS ${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}"
1466     VLC_ADD_CFLAGS([deinterlace],[${ac_cv_c_altivec} ${ac_cv_c_altivec_abi}])
1467     have_altivec="yes"
1468   ])
1469   AC_CHECK_HEADERS(altivec.h)
1470
1471   VLC_SAVE_FLAGS
1472   LDFLAGS="${LDFLAGS} -Wl,-framework,vecLib"
1473   AC_CACHE_CHECK([if linker needs -framework vecLib],
1474     [ac_cv_ld_altivec],
1475     [AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)])
1476   VLC_RESTORE_FLAGS
1477   AS_IF([test "${ac_cv_ld_altivec}" != "no"], [
1478     VLC_ADD_LIBS([libvlccore],[-Wl,-framework,vecLib])
1479   ])
1480 ])
1481 AC_SUBST(ALTIVEC_CFLAGS)
1482 AM_CONDITIONAL([HAVE_ALTIVEC], [test "$have_altivec" = "yes"])
1483
1484 dnl
1485 dnl  Memory usage
1486 dnl
1487 AC_ARG_ENABLE(optimize-memory,
1488   [AS_HELP_STRING([--enable-optimize-memory],
1489     [optimize memory usage over performance])])
1490 if test "${enable_optimize_memory}" = "yes"; then
1491   AC_DEFINE(OPTIMIZE_MEMORY, 1, Define if you want to optimize memory usage over performance)
1492 fi
1493
1494 dnl
1495 dnl Allow running as root (useful for people running on embedded platforms)
1496 dnl
1497 AC_ARG_ENABLE(run-as-root,
1498   [AS_HELP_STRING([--enable-run-as-root],
1499     [allow running VLC as root (default disabled)])])
1500 AS_IF([test "${enable_run_as_root}" = "yes"],[
1501     AC_DEFINE(ALLOW_RUN_AS_ROOT, 1,
1502               [Define to 1 to allow running VLC as root (uid 0).])
1503 ])
1504
1505 dnl
1506 dnl Stream output
1507 dnl
1508 AC_ARG_ENABLE(sout,
1509   [AS_HELP_STRING([--disable-sout],
1510     [disable streaming output (default enabled)])])
1511 AS_IF([test "${enable_sout}" != "no"], [
1512   AC_DEFINE(ENABLE_SOUT, 1, [Define to 1 for stream output support.])
1513 ])
1514 AM_CONDITIONAL(ENABLE_SOUT, [test "${enable_sout}" != "no"])
1515
1516 dnl Lua modules
1517 AC_ARG_ENABLE(lua,
1518   [AS_HELP_STRING([--disable-lua],
1519     [disable LUA scripting support (default enabled)])])
1520 if test "${enable_lua}" != "no"
1521 then
1522   PKG_CHECK_MODULES(LUA, lua5.2,
1523     [ have_lua=yes ],
1524     [
1525     AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua 5.1 instead])
1526
1527     PKG_CHECK_MODULES(LUA, lua5.1,
1528       [ have_lua=yes ],
1529       [
1530       AC_MSG_WARN([${LUA_PKG_ERRORS}, trying lua >= 5.1 instead])
1531       PKG_CHECK_MODULES(LUA, lua >= 5.1,
1532         [ have_lua=yes ],
1533         [
1534           AC_MSG_WARN([${LUA_PKG_ERRORS}, trying manual detection instead])
1535           have_lua=yes
1536           AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
1537             [],
1538             [ have_lua=no ] )
1539           AC_CHECK_LIB(  lua5.2 , luaL_newstate,
1540             [LUA_LIBS="-llua5.2"],
1541           AC_CHECK_LIB( lua5.1 , luaL_newstate,
1542             [LUA_LIBS="-llua5.1"],
1543             AC_CHECK_LIB( lua51 , luaL_newstate,
1544               [LUA_LIBS="-llua51"],
1545               AC_CHECK_LIB( lua , luaL_newstate,
1546                 [LUA_LIBS="-llua"],
1547                 [ have_lua=no
1548                 ], [-lm])
1549             )))
1550         ])
1551       ])
1552     ])
1553   if test "x${have_lua}" != "xyes" ;  then
1554       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.])
1555   fi
1556   AC_ARG_VAR([LUAC], [LUA byte compiler])
1557   AC_PATH_PROGS(LUAC,[${LUAC} luac], [false])
1558   AS_IF([test "${LUAC}" = "false"], [
1559     AC_MSG_ERROR([Could not find the LUA byte compiler.])
1560   ])
1561   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], [
1562     AC_MSG_ERROR([You need 32-bits luac when using using lua from contrib.])
1563   ])
1564 fi
1565 AM_CONDITIONAL(BUILD_LUA, [test "${have_lua}" = "yes"])
1566
1567
1568 dnl
1569 dnl HTTP daemon
1570 dnl
1571 AC_ARG_ENABLE(httpd,
1572   [AS_HELP_STRING([--disable-httpd],
1573     [disable the built-in HTTP server (default enabled)])])
1574 if test "${enable_httpd}" != "no"
1575 then
1576   AC_DEFINE(ENABLE_HTTPD, 1, Define if you want the HTTP daemon support)
1577 fi
1578 AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
1579
1580
1581 dnl
1582 dnl VideoLAN manager
1583 dnl
1584 AC_ARG_ENABLE(vlm,
1585   [AS_HELP_STRING([--disable-vlm],
1586     [disable the stream manager (default enabled)])],,
1587   [enable_vlm="${enable_sout}"])
1588 AS_IF([test "${enable_vlm}" != "no"], [
1589   AS_IF([test "${enable_sout}" = "no"], [
1590     AC_MSG_ERROR([VLM requires the stream output. Do not use --disable-sout.])
1591   ])
1592   AC_DEFINE(ENABLE_VLM, 1, [Define if you want the VideoLAN manager support])
1593 ])
1594 AM_CONDITIONAL([ENABLE_VLM], [test "${enable_vlm}" != "no"])
1595
1596
1597 dnl
1598 dnl  Input plugins
1599 dnl
1600
1601 EXTEND_HELP_STRING([Input plugins:])
1602
1603 dnl
1604 dnl  live555 input
1605 dnl
1606 AC_ARG_ENABLE(live555,
1607   [AS_HELP_STRING([--enable-live555],
1608     [enable RTSP input through live555 (default enabled)])])
1609
1610 AS_IF([test "${enable_live555}" != "no" -a -n "${CXX}"], [
1611   PKG_CHECK_MODULES(LIVE555, live555, [
1612     VLC_ADD_PLUGIN([live555])
1613     VLC_ADD_CXXFLAGS([live555], [$LIVE555_CFLAGS])
1614     VLC_ADD_LIBS([live555],[$LIVE555_LIBS])
1615   ], [
1616     AC_MSG_WARN([${LIVE555_PKG_ERRORS}.])
1617
1618     AC_LANG_PUSH(C++)
1619     VLC_SAVE_FLAGS
1620
1621     dnl detect include paths
1622     AS_IF([test -f "${CONTRIB_DIR}/include/UsageEnvironment.hh"], [
1623       CPPFLAGS_live555="-I${CONTRIB_DIR}/include/liveMedia -I${CONTRIB_DIR}/include/groupsock -I${CONTRIB_DIR}/include/BasicUsageEnvironment -I${CONTRIB_DIR}/include/UsageEnvironment"
1624     ], [
1625       AS_IF([test "${SYS}" != "os2"], [
1626         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr"}
1627         CPPFLAGS_live555="-I${LIVE555_PREFIX}/include/liveMedia -I${LIVE555_PREFIX}/include/groupsock -I${LIVE555_PREFIX}/include/BasicUsageEnvironment -I${LIVE555_PREFIX}/include/UsageEnvironment"
1628       ], [
1629         LIVE555_PREFIX=${LIVE555_PREFIX-"/usr/lib/live"}
1630         CPPFLAGS_live555="-I${LIVE555_PREFIX}/liveMedia/include -I${LIVE555_PREFIX}/groupsock/include -I${LIVE555_PREFIX}/BasicUsageEnvironment/include -I${LIVE555_PREFIX}/UsageEnvironment/include"
1631         LDFLAGS_live555="-L${LIVE555_PREFIX}/liveMedia -L${LIVE555_PREFIX}/groupsock -L${LIVE555_PREFIX}/BasicUsageEnvironment -L${LIVE555_PREFIX}/UsageEnvironment"
1632       ])
1633     ])
1634
1635     dnl CPP Flags
1636     AS_IF([test "${SYS}" = "solaris"], [
1637       CPPFLAGS_live555="${CPPFLAGS_live555} -DSOLARIS"
1638     ])
1639     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_live555}"
1640     LDFLAGS="${LDFLAGS} ${LDFLAGS_live555}"
1641
1642     dnl version check
1643     AC_CACHE_CHECK([for live555 version 1324598400 or later], [ac_cv_live555], [
1644       AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1645 [#include <liveMedia_version.hh>
1646 #if !defined (LIVEMEDIA_LIBRARY_VERSION_INT) || (LIVEMEDIA_LIBRARY_VERSION_INT < 1324598400)
1647 # error BOOM
1648 #endif]])
1649       ], [
1650         ac_cv_live555="yes"
1651       ], [
1652         ac_cv_live555="no"
1653       ])
1654     ])
1655
1656     AS_IF([test "$ac_cv_live555" = "no"], [
1657       AC_MSG_WARN([live555 is missing or its installed version is too old:
1658 Version 2011.12.23 or later is required to proceed.
1659 You can get an updated one from http://www.live555.com/liveMedia .])
1660       AS_IF([test -n "${enable_live555}"], [
1661         AC_MSG_ERROR([Update live555 or pass --disable-live555 to disable RTSP input support.])
1662       ])
1663     ], [
1664       other_libs="-lgroupsock -lBasicUsageEnvironment -lUsageEnvironment"
1665       other_libs_pic="-lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic"
1666       AS_IF([test "${SYS}" = "mingw32"], [
1667         # add ws2_32 for closesocket, select, recv
1668         other_libs="$other_libs -lws2_32"
1669       ])
1670
1671       dnl We need to check for pic because live555 don't provide shared libs
1672       dnl and we want to build a plugins so we need -fPIC on some arch.
1673       VLC_ADD_CXXFLAGS([live555], [${CPPFLAGS_live555}])
1674       VLC_ADD_LDFLAGS([live555], [${LDFLAGS_live555}])
1675       AC_CHECK_LIB(liveMedia_pic, main, [
1676         VLC_ADD_PLUGIN([live555])
1677         VLC_ADD_LIBS([live555], [-lliveMedia_pic ${other_libs_pic}])
1678       ],[
1679         AC_CHECK_LIB(liveMedia, main, [
1680           VLC_ADD_PLUGIN([live555])
1681           VLC_ADD_LIBS([live555], [-lliveMedia ${other_libs}])
1682         ],[],[${other_libs}])
1683       ],[${other_libs_pic}])
1684     ])
1685     VLC_RESTORE_FLAGS
1686     AC_LANG_POP(C++)
1687   ])
1688 ])
1689
1690 dnl
1691 dnl IIDC and DV FireWire input modules
1692 dnl
1693 PKG_ENABLE_MODULES_VLC([DC1394], [], [libdc1394-2 >= 2.1.0], [IIDC FireWire input module], [auto])
1694 PKG_ENABLE_MODULES_VLC([DV1394], [], [libraw1394 >= 2.0.1 libavc1394 >= 0.5.3], [DV FireWire input module], [auto])
1695
1696 dnl
1697 dnl - linsys modules: access module check for libzvbi
1698 dnl
1699 AC_ARG_ENABLE(linsys,
1700   [AS_HELP_STRING([--enable-linsys],
1701     [Linux Linear Systems Ltd. SDI and HD-SDI input cards (default enabled)])])
1702 AS_IF([test "$SYS" = "linux" -a "${enable_linsys}" != "no"], [
1703   VLC_ADD_PLUGIN([linsys_hdsdi])
1704   PKG_CHECK_MODULES(LINSYS_SDI, [zvbi-0.2 >= 0.2.28], [
1705     VLC_ADD_PLUGIN([linsys_sdi])
1706   ], [
1707     AC_MSG_WARN([${LINSYS_SDI_PKG_ERRORS}.])
1708   ])
1709 ])
1710
1711 dnl
1712 dnl dvdread module: check for libdvdread
1713 dnl
1714 PKG_ENABLE_MODULES_VLC([DVDREAD], [], [dvdread], [dvdread input module], [auto])
1715
1716 dnl
1717 dnl libdvdnav plugin
1718 dnl
1719 AC_ARG_ENABLE(dvdnav,
1720   [AS_HELP_STRING([--disable-dvdnav],
1721     [disable DVD navigation with libdvdnav (default auto)])])
1722 AS_IF([test "${enable_dvdnav}" != "no"], [
1723   PKG_CHECK_MODULES(DVDNAV, dvdnav, [
1724     VLC_ADD_PLUGIN([dvdnav])
1725     AC_CHECK_LIB(dvdnav, dvdnav_get_video_resolution,
1726       AC_DEFINE(HAVE_DVDNAV_GET_VIDEO_RESOLUTION, 1, [Define if you have dvdnav_get_video_resolution.]),
1727         [], [${LIBS_dvdnav}])
1728     AC_CHECK_LIB(dvdnav, dvdnav_describe_title_chapters,
1729       AC_DEFINE(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS, 1, [Define if you have dvdnav_describe_title_chapters.]),
1730         [], [${LIBS_dvdnav}])],
1731       [AC_MSG_WARN([${DVDNAV_PKG_ERRORS}.])])
1732 ])
1733
1734 dnl
1735 dnl  Blu-ray Disc Support with libbluray
1736 dnl
1737 PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.2.1], (libbluray for Blu-ray disc support ) )
1738
1739 dnl
1740 dnl  OpenCV wrapper and example filters
1741 dnl
1742 PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
1743
1744
1745 dnl
1746 dnl  libsmbclient plugin
1747 dnl
1748 PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
1749 AS_IF([test "${SYS}" = "mingw32"], [ VLC_ADD_PLUGIN([access_smb]) ])
1750
1751
1752 dnl
1753 dnl sftp access support
1754 dnl
1755 PKG_ENABLE_MODULES_VLC([SFTP], [access_sftp], [libssh2], (support SFTP file transfer via libssh2), [auto])
1756
1757 dnl
1758 dnl  Video4Linux 2
1759 dnl
1760 AC_ARG_ENABLE(v4l2, [AS_HELP_STRING([--disable-v4l2],
1761   [disable Video4Linux version 2 (default auto)])])
1762 have_v4l2="no"
1763 AS_IF([test "$enable_v4l2" != "no"], [
1764   AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [
1765     have_v4l2="yes"
1766   ])
1767 ])
1768 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1769
1770 dnl
1771 dnl special access module for Blackmagic SDI cards
1772 dnl
1773 AC_ARG_ENABLE(decklink,
1774   [AS_HELP_STRING([--disable-decklink],
1775     [disable Blackmagic DeckLink SDI input (default auto)])])
1776 AC_ARG_WITH(decklink_sdk,
1777   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1778     [                        location of Blackmagic DeckLink SDI SDK])])
1779 have_decklink=no
1780 if test "${enable_decklink}" != "no"
1781 then
1782   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1783   then
1784     VLC_ADD_CPPFLAGS([decklink decklinkoutput],[-I${with_decklink_sdk}/include])
1785   fi
1786   VLC_SAVE_FLAGS
1787   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1788   AC_LANG_PUSH(C++)
1789   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1790       have_decklink=yes
1791   ], [
1792       AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)
1793   ])
1794   AC_LANG_POP(C++)
1795   VLC_RESTORE_FLAGS
1796 fi
1797 AM_CONDITIONAL(HAVE_DECKLINK, [ test "${have_decklink}" != "no" ])
1798
1799
1800 dnl
1801 dnl  gnomeVFS access module
1802 dnl
1803 PKG_ENABLE_MODULES_VLC([GNOMEVFS], [gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
1804
1805 dnl
1806 dnl  VCDX modules
1807 dnl
1808 PKG_ENABLE_MODULES_VLC([VCDX], [vcdx], [libcdio >= 0.78.2 libiso9660 >= 0.72 libvcdinfo >= 0.7.22], [navigate VCD with libvcdinfo], [no])
1809
1810 dnl
1811 dnl  Built-in CD-DA and VCD module
1812 dnl
1813 AC_ARG_ENABLE(vcd,
1814   [AS_HELP_STRING([--disable-vcd],
1815     [disable built-in VCD and CD-DA support (default enabled)])])
1816
1817 AC_ARG_ENABLE(libcddb,
1818   [AS_HELP_STRING([--disable-libcddb],
1819     [disable CDDB for Audio CD (default enabled)])])
1820
1821 if test "${enable_vcd}" != "no"
1822 then
1823   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1824   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1825     AC_MSG_RESULT(yes)
1826     VLC_ADD_PLUGIN([vcd cdda])
1827   ],[
1828     AC_MSG_RESULT(no)
1829   ])
1830
1831   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1832   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1833     AC_MSG_RESULT(yes)
1834     VLC_ADD_PLUGIN([vcd cdda])
1835     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1836   ],[
1837     AC_MSG_RESULT(no)
1838   ])
1839
1840   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1841   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1842     AC_MSG_RESULT(yes)
1843     VLC_ADD_PLUGIN([vcd cdda])
1844     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1845   ],[
1846     AC_MSG_RESULT(no)
1847   ])
1848
1849   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2" -o "${SYS}" = "darwin"
1850   then
1851     VLC_ADD_PLUGIN([vcd cdda])
1852   fi
1853
1854   if test "$enable_libcddb" != "no"; then
1855     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1856       HAVE_LIBCDDB=yes
1857       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1858       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1859       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1860       ],:
1861       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1862       HAVE_LIBCDDB=no])
1863   fi
1864 fi
1865
1866 dnl
1867 dnl Linux DVB
1868 dnl
1869 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1870   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1871 [#include <linux/dvb/version.h>
1872 #if (DVB_API_VERSION < 5)
1873 # error Linux DVB API v3.2 and older are not supported.
1874 #endif
1875 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1876 # error Linux DVB API v5.0 is unsupported. Please update.
1877 #endif
1878 ]])], [
1879   ac_cv_linux_dvb_5_1=yes
1880 ], [
1881   ac_cv_linux_dvb_5_1=no
1882 ])])
1883 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1884
1885 dnl
1886 dnl  Screen capture module
1887 dnl
1888 AC_ARG_ENABLE(screen,
1889   [AS_HELP_STRING([--enable-screen],
1890     [disable screen capture (default enabled)])])
1891 if test "${enable_screen}" != "no"; then
1892   if test "${SYS}" = "darwin"; then
1893     AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1894       VLC_ADD_PLUGIN([screen])
1895     ])
1896   fi
1897 fi
1898 AM_CONDITIONAL(HAVE_MAC_SCREEN, [test "${SYS}" = "darwin" -a "x${enable_screen}" != "xno"])
1899
1900 dnl
1901 dnl  VNC/RFB access module
1902 dnl
1903 PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client support), [auto])
1904
1905 dnl  RDP/Remote Desktop access module
1906 dnl
1907 PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
1908
1909 dnl
1910 dnl  Real RTSP plugin
1911 dnl
1912 AC_ARG_ENABLE(realrtsp,
1913   [  --enable-realrtsp       Real RTSP module (default disabled)])
1914 if test "${enable_realrtsp}" = "yes"; then
1915   VLC_ADD_PLUGIN([access_realrtsp])
1916 fi
1917
1918 dnl
1919 dnl MacOS eyeTV
1920 AC_ARG_ENABLE(macosx-eyetv,
1921   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1922 if test "x${enable_macosx_eyetv}" != "xno" &&
1923   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1924 then
1925   VLC_ADD_PLUGIN([access_eyetv])
1926 fi
1927
1928 dnl
1929 dnl QTKit
1930 AC_ARG_ENABLE(macosx-qtkit,
1931   [  --enable-macosx-qtkit Mac OS X qtcapture (video) and qtsound (audio) module (default enabled on Mac OS X)])
1932 if test "x${enable_macosx_qtkit}" != "xno" &&
1933   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1934 then
1935   VLC_ADD_PLUGIN([qtcapture])
1936   VLC_ADD_PLUGIN([qtsound])
1937 fi
1938 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1939
1940 dnl
1941 dnl AVFoundation
1942 AC_SUBST(have_avfoundation, ["no"])
1943 AC_ARG_ENABLE(macosx-avfoundation,
1944   [  --enable-macosx-avfoundation Mac OS X avcapture (video) module (default enabled on Mac OS X)])
1945 if test "x${enable_macosx_avfoundation}" != "xno" &&
1946   (test "${SYS}" = "darwin" || test "${enable_macosx_avfoundation}" = "yes")
1947 then
1948   SAVED_LIBS="${LIBS}"
1949   LIBS="-framework AVFoundation"
1950   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[have_avfoundation=yes],[have_avfoundation=no])
1951   LIBS="${SAVED_LIBS}"
1952   if test "${have_avfoundation}" != "no"
1953   then
1954     VLC_ADD_PLUGIN([avcapture])
1955   fi
1956 fi
1957 AM_CONDITIONAL(HAVE_AVFOUNDATION, [test "${have_avfoundation}" != "no"])
1958
1959 dnl
1960 dnl  Demux plugins
1961 dnl
1962
1963 EXTEND_HELP_STRING([Mux/Demux plugins:])
1964
1965 dnl
1966 dnl  libdvbpsi check for ts mux/demux
1967 dnl
1968 have_dvbpsi="no"
1969 PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
1970 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1971
1972
1973 dnl
1974 dnl  GME demux plugin
1975 dnl
1976 AC_ARG_ENABLE(gme,
1977   [AS_HELP_STRING([--enable-gme],
1978     [use Game Music Emu (default auto)])])
1979 AS_IF([test "${enable_gme}" != "no"], [
1980   AC_CHECK_HEADER([gme/gme.h], [
1981     VLC_ADD_LIBS([gme], [-lgme])
1982     VLC_ADD_PLUGIN([gme])
1983   ], [
1984     AS_IF([test "x${enable_gme}" != "x"], [
1985       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
1986     ])
1987   ])
1988 ])
1989
1990
1991 dnl
1992 dnl  SIDPlay plugin
1993 dnl
1994 AC_ARG_ENABLE(sid,
1995     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
1996 AS_IF([test "${enable_sid}" != "no"], [
1997     PKG_CHECK_MODULES(SID, [libsidplay2], [
1998         AC_LANG_PUSH(C++)
1999         oldCPPFLAGS="$CPPFLAGS"
2000         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2001         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2002             VLC_ADD_PLUGIN([sid])
2003             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2004             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2005         ], [
2006             AS_IF([test -n "${enable_sid}"],
2007                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2008                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2009                 )
2010         ])
2011         CPPFLAGS="$oldCPPFLAGS"
2012         AC_LANG_POP(C++)
2013     ], [
2014         AS_IF([test "x${enable_sid}" = "xyes"],
2015             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2016             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2017             )
2018     ])
2019 ])
2020
2021
2022 dnl
2023 dnl  ogg demux plugin
2024 dnl
2025 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
2026 if test "${enable_sout}" != "no"; then
2027     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg mux support], [auto])
2028 dnl Check for libshout
2029     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2030 fi
2031
2032 dnl
2033 dnl  matroska demux plugin
2034 dnl
2035 AC_ARG_ENABLE(mkv,
2036   [AS_HELP_STRING([--disable-mkv],
2037     [do not use libmatroska (default auto)])])
2038 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2039   AC_LANG_PUSH(C++)
2040   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2041     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2042     AC_EGREP_CPP(yes,
2043       [#include <ebml/EbmlVersion.h>
2044        #ifdef LIBEBML_VERSION
2045        #if LIBEBML_VERSION >= 0x010000
2046        yes
2047        #endif
2048        #endif],
2049       [AC_MSG_RESULT([yes])
2050         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2051           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2052           AC_EGREP_CPP(yes,
2053             [#include <matroska/KaxVersion.h>
2054              #ifdef LIBMATROSKA_VERSION
2055              #if LIBMATROSKA_VERSION >= 0x010000
2056              yes
2057              #endif
2058              #endif],
2059             [AC_MSG_RESULT([yes])
2060               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2061               AC_CHECK_LIB(ebml_pic, main, [
2062                 VLC_ADD_PLUGIN([mkv])
2063                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2064               ],[
2065                 AC_CHECK_LIB(ebml, main, [
2066                   VLC_ADD_PLUGIN([mkv])
2067                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2068                 ])
2069               ])
2070             ], [
2071               AC_MSG_RESULT([no])
2072               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.])
2073           ])
2074         ])
2075       ],
2076       [AC_MSG_RESULT([no])
2077         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.])
2078     ])
2079   ])
2080   AC_LANG_POP(C++)
2081 fi
2082
2083 dnl
2084 dnl  modplug demux plugin
2085 dnl
2086 AC_ARG_ENABLE(mod,
2087   [AS_HELP_STRING([--disable-mod],
2088     [do not use libmodplug (default auto)])])
2089 if test "${enable_mod}" != "no" ; then
2090     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2091           VLC_ADD_PLUGIN([mod])
2092           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2093           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2094     ],[
2095        AS_IF([test -n "${enable_mod}"],
2096          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2097          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2098     ])
2099 fi
2100
2101 dnl
2102 dnl  mpc demux plugin
2103 dnl
2104 AC_ARG_ENABLE(mpc,
2105   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2106 if test "${enable_mpc}" != "no"
2107 then
2108   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2109     VLC_ADD_PLUGIN([mpc])
2110     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2111     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2112     VLC_ADD_PLUGIN([mpc])
2113     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2114 fi
2115
2116 dnl
2117 dnl  Codec plugins
2118 dnl
2119
2120 EXTEND_HELP_STRING([Codec plugins:])
2121
2122 dnl
2123 dnl wmafixed plugin
2124 dnl
2125 AC_ARG_ENABLE(wma-fixed,
2126   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2127 if test "${enable_wma_fixed}" = "yes"
2128 then
2129   VLC_ADD_PLUGIN([wma_fixed])
2130 fi
2131
2132 dnl
2133 dnl shine fixed point mp3 encoder
2134 dnl
2135 AC_ARG_ENABLE(shine,
2136   [  --enable-shine          shine mp3 encoding module (default disabled)])
2137 if test "${enable_shine}" = "yes"
2138 then
2139   VLC_ADD_PLUGIN([shine])
2140 fi
2141
2142 dnl
2143 dnl openmax il codec plugin
2144 dnl
2145 AC_ARG_ENABLE(omxil,
2146   [  --enable-omxil          openmax il codec module (default disabled)])
2147 if test "${enable_omxil}" = "yes"
2148 then
2149   VLC_ADD_PLUGIN([omxil])
2150 fi
2151
2152 dnl
2153 dnl openmax il vout plugin
2154 dnl
2155 AC_ARG_ENABLE(omxil-vout,
2156   [  --enable-omxil-vout     openmax il video output module (default disabled)])
2157 if test "${enable_omxil_vout}" = "yes"
2158 then
2159   VLC_ADD_PLUGIN([omxil_vout])
2160 fi
2161
2162 dnl
2163 dnl raspberry pi openmax il configuration
2164 dnl
2165 AC_ARG_ENABLE(rpi-omxil,
2166   [  --enable-rpi-omxil     openmax il configured for raspberry pi (default disabled)])
2167 if test "${enable_rpi_omxil}" = "yes"
2168 then
2169   VLC_ADD_PLUGIN([omxil omxil_vout])
2170   VLC_ADD_CFLAGS([omxil omxil_vout],[-DRPI_OMX])
2171 fi
2172
2173 dnl
2174 dnl CrystalHD codec plugin
2175 dnl
2176 AC_ARG_ENABLE(crystalhd,
2177   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2178 if test "${enable_crystalhd}" != "no"; then
2179     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2180       VLC_ADD_PLUGIN([crystalhd])
2181       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2182     ],[
2183       if test "${SYS}" = "mingw32" ; then
2184         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2185           VLC_ADD_PLUGIN([crystalhd])
2186           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2187             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2188             ])
2189         ],[
2190           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2191                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2192                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2193         ],[#define __LINUX_USER__
2194                #include <libcrystalhd/bc_dts_types.h>
2195         ])
2196       fi
2197     ],[
2198        #include <libcrystalhd/bc_dts_types.h>
2199       ])
2200 fi
2201
2202 dnl
2203 dnl  mad plugin
2204 dnl
2205 AC_ARG_ENABLE(mad,
2206   [  --enable-mad            libmad module (default enabled)])
2207 if test "${enable_mad}" != "no"
2208 then
2209   AC_ARG_WITH(mad,
2210     [  --with-mad=PATH         path to libmad],[],[])
2211   if test "${with_mad}" != "no" -a -n "${with_mad}"
2212   then
2213     VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
2214     VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib])
2215   fi
2216
2217   AC_ARG_WITH(mad-tree,
2218     [  --with-mad-tree=PATH    mad tree for static linking],[],[])
2219   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
2220   then
2221     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
2222     if test -z "${real_mad_tree}"
2223     then
2224       dnl  The given directory can't be found
2225       AC_MSG_RESULT(no)
2226       AC_MSG_ERROR([${with_mad_tree} directory does not exist])
2227     fi
2228     dnl  Use a custom libmad
2229     AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
2230     if test -f ${real_mad_tree}/mad.h
2231     then
2232       AC_MSG_RESULT(yes)
2233       VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
2234       VLC_ADD_LIBS([mpgatofixed32],[-L${real_mad_tree}/.libs])
2235       VLC_SAVE_FLAGS
2236       LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2237       AC_CHECK_LIB(mad, mad_bit_init, [
2238         VLC_ADD_PLUGIN([mpgatofixed32])
2239         VLC_ADD_LIBS([mpgatofixed32],[-lmad])
2240         ],[ AC_MSG_ERROR([the specified tree has not been compiled ])
2241       ],[])
2242       VLC_RESTORE_FLAGS
2243     else
2244       AC_MSG_RESULT(no)
2245       AC_MSG_ERROR([the specified tree does not have mad.h])
2246     fi
2247   else
2248     VLC_SAVE_FLAGS
2249     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_mpgatofixed32}"
2250     LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2251     AC_CHECK_HEADERS(mad.h, ,
2252       [ 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.]) ])
2253     AC_CHECK_LIB(mad, mad_bit_init, [
2254       VLC_ADD_PLUGIN([mpgatofixed32])
2255       VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
2256       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
2257     VLC_RESTORE_FLAGS
2258   fi
2259 fi
2260
2261
2262 AC_ARG_ENABLE(merge-ffmpeg,
2263 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2264   enable_merge_ffmpeg="no"
2265 ])
2266 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2267
2268 dnl
2269 dnl  avcodec decoder/encoder plugin
2270 dnl
2271 AC_ARG_ENABLE(avcodec,
2272 [  --enable-avcodec        libavcodec codec (default enabled)])
2273 AS_IF([test "${enable_avcodec}" != "no"], [
2274   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [
2275     dnl PKG_CHECK_EXISTS([libavcodec < 56],, [
2276     dnl   AC_MSG_ERROR([libavcodec versions 56 and later are not supported yet.])
2277     dnl ])
2278     VLC_SAVE_FLAGS
2279     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2280     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2281     AC_CHECK_HEADERS(libavcodec/avcodec.h)
2282     AC_CHECK_HEADERS(libavutil/avutil.h)
2283     VLC_RESTORE_FLAGS
2284     have_avcodec="yes"
2285   ],[
2286     AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2287   ])
2288 ], [
2289   have_avcodec="no"
2290 ])
2291 AM_CONDITIONAL([HAVE_AVCODEC], [test "${have_avcodec}" != "no"])
2292
2293 dnl
2294 dnl libva needs avcodec
2295 dnl
2296 AC_ARG_ENABLE(libva,
2297   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2298
2299 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2300   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2301 ])
2302 have_avcodec_vaapi="no"
2303 AS_IF([test "${enable_libva}" != "no" -a "${have_avcodec}" = "yes"], [
2304   PKG_CHECK_MODULES(LIBVA, [libva libva-x11], [
2305     VLC_SAVE_FLAGS
2306     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2307     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2308     AC_CHECK_HEADERS(libavcodec/vaapi.h, [
2309       AC_MSG_NOTICE([VAAPI acceleration activated])
2310       have_avcodec_vaapi="yes"
2311     ],[
2312       AS_IF([test -n "${enable_libva}"], [
2313         AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2314       ], [
2315         AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2316       ])
2317     ])
2318     VLC_RESTORE_FLAGS
2319   ],[
2320     AS_IF([test -n "${enable_libva}"], [
2321       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2322     ], [
2323       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2324     ])
2325   ])
2326 ])
2327 AM_CONDITIONAL([HAVE_AVCODEC_VAAPI], [test "${have_avcodec_vaapi}" = "yes"])
2328
2329 dnl
2330 dnl dxva2 needs avcodec
2331 dnl
2332 AC_ARG_ENABLE(dxva2,
2333   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2334
2335 have_avcodec_dxva2="no"
2336 AS_IF([test "${enable_dxva2}" != "no"], [
2337   if test "${SYS}" = "mingw32"; then
2338   AS_IF([test "x${have_avcodec}" = "xyes"], [
2339     AC_CHECK_HEADERS(dxva2api.h,
2340       [
2341         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2342            AC_MSG_NOTICE([DxVA2 acceleration activated])
2343            have_avcodec_dxva2="yes"
2344         ],[
2345     AS_IF([test "${enable_dxva2}" = "yes"],
2346           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2347               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2348         ], [#undef _WIN32_WINNT
2349             /* DXVA2 is only available in Vista and above */
2350             #define _WIN32_WINNT 0x600])
2351       ],[
2352     AS_IF([test "${enable_dxva2}" = "yes"],
2353               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2354               [AC_MSG_WARN([dxva2api.h not found])])
2355       ])
2356   ],[
2357     AS_IF([test "x${enable_dxva2}" != "x"], [
2358       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2359     ])
2360   ])
2361   fi
2362 ])
2363 AM_CONDITIONAL([HAVE_AVCODEC_DXVA2], [test "${have_avcodec_dxva2}" = "yes"])
2364
2365 dnl
2366 dnl vda needs avcodec
2367 dnl
2368 AC_ARG_ENABLE(vda,
2369   [  --enable-vda          VDA  support (default auto)])
2370
2371 have_avcodec_vda="no"
2372 AS_IF([test "${enable_vda}" != "no"], [
2373   if test "${SYS}" = "darwin"; then
2374   AS_IF([test "x${have_avcodec}" = "xyes"], [
2375     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2376     [
2377       PKG_CHECK_EXISTS([libavcodec >= 55.19.0], [
2378         have_avcodec_vda="yes"
2379       ],[
2380         AS_IF([test "${enable_vda}" = "yes"],
2381          [AC_MSG_ERROR([libavcodec >= 55.19.0 is required for VDA decoding])],
2382          [AC_MSG_WARN([libavcodec >= 55.19.0 is required for VDA decoding])])
2383       ])
2384     ],[
2385         AS_IF([test "${enable_vda}" = "yes"],
2386       [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2387       [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2388     ])
2389   ],[
2390     AS_IF([test "x${enable_vda}" != "x"], [
2391       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2392     ])
2393   ])
2394   fi
2395 ])
2396 AM_CONDITIONAL([HAVE_AVCODEC_VDA], [test "${have_avcodec_vda}" = "yes"])
2397
2398 dnl
2399 dnl  avformat demuxer/muxer plugin
2400 dnl
2401
2402 AC_ARG_ENABLE(avformat,
2403 [  --enable-avformat       libavformat containers (default enabled)],, [
2404   enable_avformat="${have_avcodec}"
2405 ])
2406 have_avformat="no"
2407 AS_IF([test "${enable_avformat}" != "no"], [
2408   PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
2409       have_avformat="yes"
2410       VLC_SAVE_FLAGS
2411       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2412       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2413       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2414       AC_CHECK_HEADERS(libavutil/avutil.h)
2415       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2416         have_avformat="no"
2417       ])
2418       VLC_RESTORE_FLAGS
2419     ],[
2420       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2421   ])
2422 ])
2423 AM_CONDITIONAL([HAVE_AVFORMAT], [test "${enable_avformat}" != "no"])
2424
2425 dnl
2426 dnl  swscale image scaling and conversion plugin
2427 dnl
2428
2429 AC_ARG_ENABLE(swscale,
2430   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2431           (default enabled)]))
2432 if test "${enable_swscale}" != "no"
2433 then
2434   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2435     [
2436       VLC_SAVE_FLAGS
2437       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2438       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2439       AC_CHECK_HEADERS(libswscale/swscale.h)
2440       VLC_ADD_PLUGIN([swscale])
2441       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2442       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2443       AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2444         VLC_ADD_LIBS([swscale],[${ac_cv_ld_bsymbolic}])
2445       ])
2446       VLC_RESTORE_FLAGS
2447     ],[
2448       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2449   ])
2450 fi
2451
2452 dnl
2453 dnl  postproc plugin
2454 dnl
2455
2456 AC_ARG_ENABLE(postproc,
2457 [  --enable-postproc       libpostproc image post-processing (default auto)])
2458 if test "${enable_postproc}" != "no"
2459 then
2460   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2461     [
2462       VLC_SAVE_FLAGS
2463       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2464       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2465       AC_CHECK_HEADERS(postproc/postprocess.h)
2466       VLC_ADD_PLUGIN([postproc])
2467       VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS])
2468       VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS])
2469       VLC_RESTORE_FLAGS
2470     ],[
2471       AC_MSG_WARN([${POSTPROC_PKG_ERRORS}.])
2472   ])
2473 fi
2474
2475 dnl
2476 dnl  faad decoder plugin
2477 dnl
2478 AC_ARG_ENABLE(faad,
2479 [  --enable-faad           faad codec (default auto)])
2480 if test "${enable_faad}" != "no"; then
2481   AC_ARG_WITH(faad-tree,  [  --with-faad-tree=PATH   faad tree for static linking])
2482   if test -n "${with_faad_tree}"; then
2483     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
2484     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
2485     if test -z "${real_faad_tree}"; then
2486       dnl  The given directory can't be found
2487       AC_MSG_RESULT(no)
2488       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
2489     fi
2490     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"; then
2491       dnl  Use the custom faad
2492       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
2493       VLC_ADD_PLUGIN([faad])
2494       VLC_ADD_LIBS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
2495       VLC_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
2496     else
2497       dnl  The given libfaad wasn't built
2498       AC_MSG_RESULT(no)
2499       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
2500     fi
2501   else
2502     VLC_SAVE_FLAGS
2503     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_faad}"
2504     LDFLAGS="${LDFLAGS} ${LIBS_faad}"
2505     AC_CHECK_HEADERS(faad.h,
2506       [ AC_CHECK_LIB(faad, faacDecOpen, [
2507           VLC_ADD_PLUGIN([faad])
2508           VLC_ADD_LIBS([faad],[-lfaad]) ], [
2509             AC_CHECK_LIB(faad, NeAACDecOpen, [
2510               VLC_ADD_PLUGIN([faad])
2511               VLC_ADD_LIBS([faad],[-lfaad]) ], [
2512                 AS_IF([test "${enable_faad}" = "yes"],
2513                 [ AC_MSG_ERROR([Cannot find libfaad library...]) ],
2514                 [ AC_MSG_WARN([Cannot find libfaad library...]) ]) ]) ])
2515       ] , [ AS_IF([test "${enable_faad}" = "yes"],
2516         [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ],
2517         [ AC_MSG_WARN([Cannot find development headers for libfaad...]) ]) ])
2518     VLC_RESTORE_FLAGS
2519   fi
2520 fi
2521
2522 dnl
2523 dnl twolame encoder plugin
2524 dnl
2525 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2526
2527 dnl
2528 dnl fdk-aac encoder plugin
2529 dnl
2530 PKG_ENABLE_MODULES_VLC([FDKAAC], [], [fdk-aac], [FDK-AAC encoder], [disabled])
2531
2532 dnl
2533 dnl  QuickTime plugin
2534 dnl
2535 AC_ARG_ENABLE(quicktime,
2536   [  --enable-quicktime      QuickTime module (deprecated)])
2537 if test "${enable_quicktime}" = "yes"; then
2538   if test "${SYS}" = "mingw32"; then
2539     VLC_ADD_PLUGIN([quicktime])
2540   else
2541   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2542     [ VLC_ADD_PLUGIN([quicktime])
2543       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2544     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2545   fi
2546 fi
2547
2548 dnl
2549 dnl A52/AC3 decoder plugin
2550 dnl
2551 AC_ARG_ENABLE(a52,
2552   [  --enable-a52            A/52 support with liba52 (default enabled)])
2553 if test "${enable_a52}" != "no"
2554 then
2555   AC_ARG_WITH(a52,
2556     [  --with-a52=PATH         a52 headers and libraries])
2557   AC_ARG_WITH(a52-tree,
2558     [  --with-a52-tree=PATH    a52dec tree for static linking ],[],[])
2559   if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
2560   then
2561     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
2562     if test -z "${real_a52_tree}"
2563     then
2564       dnl  The given directory can't be found
2565       AC_MSG_RESULT(no)
2566       AC_MSG_ERROR([${with_a52_tree} directory does not exist])
2567     fi
2568     dnl  Use a custom a52dec
2569     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
2570     if test -f ${real_a52_tree}/include/a52.h
2571     then
2572       AC_MSG_RESULT(yes)
2573       VLC_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
2574       VLC_ADD_LIBS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
2575       VLC_SAVE_FLAGS
2576       LDFLAGS="${LDFLAGS} ${LIBS_a52tofloat32}"
2577       AC_CHECK_LIB(a52, a52_free, [
2578         VLC_ADD_PLUGIN([a52tofloat32])
2579         VLC_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
2580         VLC_ADD_LIBS([a52tofloat32],[-la52])
2581         ],[
2582         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
2583         then
2584           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3 ($real_a52_tree)])
2585         else
2586           AC_MSG_ERROR([the specified tree has not been compiled])
2587         fi
2588       ])
2589     else
2590       AC_MSG_RESULT(no)
2591       AC_MSG_ERROR([the specified tree does not have a52.h])
2592     fi
2593   else
2594     if test -z "${with_a52}"
2595     then
2596       LDFLAGS_test=""
2597       CPPFLAGS_test=""
2598     else
2599       LDFLAGS_test="-L${with_a52}/lib"
2600       CPPFLAGS_test="-I${with_a52}/include"
2601     fi
2602     VLC_SAVE_FLAGS
2603     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2604     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2605     AC_CHECK_HEADERS(a52dec/a52.h, [
2606       AC_CHECK_LIB(a52, a52_free, [
2607         VLC_ADD_PLUGIN([a52tofloat32])
2608         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2609         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2610       ],[
2611         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.])
2612         ], [$LIBM])
2613     ],[
2614       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.])
2615     ])
2616     VLC_RESTORE_FLAGS
2617   fi
2618 fi
2619
2620 dnl
2621 dnl DTS Coherent Acoustics decoder plugin
2622 dnl
2623 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2624
2625 dnl
2626 dnl  Flac plugin
2627 dnl
2628 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2629
2630 dnl
2631 dnl  Libmpeg2 plugin
2632 dnl
2633 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2634
2635 dnl
2636 dnl  Vorbis plugin
2637 dnl
2638 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2639
2640 dnl
2641 dnl  Tremor plugin
2642 dnl
2643 AC_ARG_ENABLE(tremor,
2644   [  --enable-tremor         Tremor decoder support (default disabled)])
2645 if test "${enable_tremor}" = "yes"
2646 then
2647   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2648     VLC_ADD_PLUGIN([tremor])
2649    ],[])
2650 fi
2651
2652 dnl
2653 dnl  Speex plugins
2654 dnl
2655 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2656 have_speexdsp="no"
2657 AS_IF([test "${enable_speex}" != "no"], [
2658   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2659     have_speexdsp="yes"
2660   ], [
2661     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2662   ])
2663 ])
2664 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2665
2666 dnl
2667 dnl  Opus plugin
2668 dnl
2669 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus], [Opus support], [auto])
2670
2671 dnl
2672 dnl  theora decoder plugin
2673 dnl
2674 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2675
2676 dnl
2677 dnl  dirac encoder plugin
2678 dnl
2679 PKG_ENABLE_MODULES_VLC([DIRAC], [], [dirac >= 0.10.0], [dirac encoder], [auto])
2680
2681 dnl
2682 dnl  schroedinger decoder plugin (for dirac format video)
2683 dnl
2684 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2685
2686 dnl
2687 dnl  PNG decoder module
2688 dnl
2689 AC_ARG_ENABLE(png,
2690   [  --enable-png            PNG support (default enabled)])
2691 AS_IF([test "${enable_png}" != "no"], [
2692 AC_CHECK_HEADERS(png.h, [
2693   VLC_SAVE_FLAGS
2694   LDFLAGS="${LDFLAGS} -lz $LIBM"
2695   AC_CHECK_LIB(png, png_set_rows, [
2696     VLC_ADD_PLUGIN([png])
2697   ], [], [-lz $LIBM])
2698   VLC_RESTORE_FLAGS
2699   ])
2700 ])
2701
2702 dnl
2703 dnl H262 encoder plugin (lib262)
2704 dnl
2705 AC_ARG_ENABLE(x262,
2706   [  --enable-x262           H262 encoding support with static libx262 (default disabled)])
2707 if test "${enable_x262}" != "no"; then
2708 AC_ARG_WITH(x262-tree,
2709   [ --with-x262-tree=PATH      H262 encoding module with libx262 (static linking)],[],[])
2710   if test "${with_x262_tree}" != "no" -a -n "${with_x262_tree}"
2711   then
2712     real_x262_tree="̧`cd ${with_x262_tree} 2>/dev/null && pwd`"
2713     if test -z "${real_x262_tree}"
2714     then
2715       AC_MSG_RESULT(no)
2716       AC_MSG_ERROR([${with_x262_tree} directory does not exist])
2717     fi
2718     AC_MSG_CHECKING(for x262.h in ${real_x262_tree})
2719     if test -f ${with_x262_tree}/x262_config.h
2720     then
2721       VLC_ADD_PLUGIN([x262])
2722       VLC_ADD_CFLAGS([x262],[-I${with_x262_tree}])
2723       VLC_ADD_LIBS([x262],[-L${with_x262_tree} -lm -lpthread -lx262])
2724     else
2725       AC_MSG_RESULT(no)
2726       AC_MSG_ERROR([${with_x262_tree} doesnt have x262_config.h])
2727     fi
2728   else
2729     PKG_CHECK_MODULES(X262, x262, [
2730         VLC_ADD_PLUGIN([x262])
2731         VLC_ADD_LDFLAGS([x262],[${X262_LIBS}])
2732         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2733           VLC_ADD_LIBS([x262],[${av_cv_ld_bsymbolic}])
2734         ])
2735         VLC_ADD_CFLAGS([x262],[${X262_CFLAGS}])
2736         if echo ${X262_LIBS} |grep -q 'pthreadGC2'; then
2737           VLC_ADD_CFLAGS([x262], [-DPTW32_STATIC_LIB])
2738         fi
2739     ], [
2740        if test "${enable_x262}" = "yes"; then
2741         AC_MSG_ERROR([x262 module doesn't work without staticly compiled libx262.a])
2742        fi
2743     ])
2744   fi
2745 fi
2746
2747 dnl x265 encoder
2748 AC_ARG_ENABLE(x265,
2749   AS_HELP_STRING([--enable-x265],[H265 / HEVC encoding support with libx265 (default enabled)]))
2750 AS_IF( [test "${enable_x265}" != "no"],[
2751   AC_CHECK_HEADER([x265.h], [
2752       AC_CHECK_LIB([x265],[x265_encoder_open], [
2753         VLC_ADD_PLUGIN([x265])
2754         VLC_ADD_LIBS([x265], [-lx265 -lstdc++ -lm -lpthread])
2755       ], [
2756         AC_MSG_ERROR([x265 library not found])
2757       ], [-lstdc++ -lm -lpthread])
2758   ], [
2759     AS_IF([test "${enable_x265}" = "yes"], [
2760         AC_MSG_ERROR([x265.h not found])
2761     ])
2762   ])
2763 ])
2764
2765
2766 dnl
2767 dnl H264 encoder plugin (10-bit lib264)
2768 dnl
2769 AC_ARG_ENABLE(x26410b,
2770   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2771 if test "${enable_x26410b}" != "no"; then
2772 AC_ARG_WITH(x26410b-tree,
2773   [ --with-x26410b-tree=PATH      H264 10-bit encoding module with libx264 (static linking)],[],[])
2774   if test "${with_x26410b_tree}" != "no" -a -n "${with_x26410b_tree}"
2775   then
2776     real_x26410b_tree="̧`cd ${with_x26410b_tree} 2>/dev/null && pwd`"
2777     if test -z "${real_x26410b_tree}"
2778     then
2779       AC_MSG_RESULT(no)
2780       AC_MSG_ERROR([${with_x26410b_tree} directory does not exist])
2781     fi
2782     AC_MSG_CHECKING(for x264.h in ${real_x26410b_tree})
2783     if test -f ${with_x26410b_tree}/x264_config.h
2784     then
2785       AC_MSG_RESULT(yes)
2786       AC_MSG_CHECKING(for 10-bit build of x264)
2787       if grep -q "BIT_DEPTH.*10"  ${with_x26410b_tree}/x264_config.h ;then
2788         AC_MSG_RESULT(yes)
2789         VLC_ADD_PLUGIN([x26410b])
2790         VLC_ADD_CFLAGS([x26410b],[-I${with_x26410b_tree}])
2791         VLC_ADD_LIBS([x26410b],[-L${with_x26410b_tree} -lm -lpthread -lx264])
2792       else
2793         AC_MSG_RESULT(no)
2794         AC_MSG_ERROR([${with_x26410b_tree} isnt build 10-bit])
2795       fi
2796     else
2797       AC_MSG_RESULT(no)
2798       AC_MSG_ERROR([${with_x26410b_tree} doesnt have x264_config.h])
2799     fi
2800   else
2801     PKG_CHECK_MODULES(X26410B, x26410b, [
2802         VLC_ADD_PLUGIN([x26410b])
2803         VLC_ADD_LIBS([x26410b],[${X26410B_LIBS}])
2804         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2805           VLC_ADD_LDFLAGS([x26410b],[${ac_cv_ld_bsymbolic}])
2806         ])
2807         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2808         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2809           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2810         fi
2811     ], [
2812        if test "${enable_x26410b}" = "yes"; then
2813         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2814        fi
2815     ])
2816   fi
2817 fi
2818
2819
2820 dnl
2821 dnl H264 encoder plugin (using libx264)
2822 dnl
2823 AC_ARG_ENABLE(x264,
2824   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2825 if test "${enable_x264}" != "no"; then
2826   AC_ARG_WITH(x264-tree,
2827     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
2828   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
2829   then
2830     real_x264_tree="`cd ${with_x264_tree} 2>/dev/null && pwd`"
2831     if test -z "${real_x264_tree}"
2832     then
2833       dnl  The given directory can't be found
2834       AC_MSG_RESULT(no)
2835       AC_MSG_ERROR([${with_x264_tree} directory does not exist])
2836     fi
2837     dnl  Use a custom libx264
2838     AC_MSG_CHECKING(for x264.h in ${real_x264_tree})
2839     if test -f ${real_x264_tree}/x264.h
2840     then
2841       AC_MSG_RESULT(yes)
2842       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
2843       VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
2844       PKG_CHECK_MODULES(X264,x264, [
2845         VLC_ADD_PLUGIN([x264])
2846         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2847         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2848         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2849           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2850         fi
2851       ],[
2852         AC_MSG_ERROR([the specified tree has not been compiled])
2853       ])
2854     else
2855       AC_MSG_RESULT(no)
2856       AC_MSG_ERROR([the specified tree does not have x264.h])
2857     fi
2858   else
2859       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2860         VLC_ADD_PLUGIN([x264])
2861         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2862
2863         AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
2864           VLC_ADD_LDFLAGS([x264],[${ac_cv_ld_bsymbolic}])
2865         ])
2866
2867         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2868         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2869           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2870         fi
2871       ],[
2872         if test "${enable_x264}" = "yes"; then
2873             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2874           fi
2875       ])
2876   fi
2877 fi
2878
2879 dnl
2880 dnl Intel QuickSync (aka MediaSDK) H264/H262 encoder
2881 dnl
2882 PKG_ENABLE_MODULES_VLC([MFX], [qsv], [libmfx], [Intel QuickSync MPEG4-Part10/MPEG2 (aka H.264/H.262) encoder], [auto])
2883
2884 dnl
2885 dnl libfluidsynth (MIDI synthetizer) plugin
2886 dnl
2887 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2888
2889 dnl
2890 dnl Teletext Modules
2891 dnl vbi decoder plugin (using libzbvi)
2892 dnl telx module
2893 dnl uncompatible
2894 dnl
2895 AC_ARG_ENABLE(zvbi,
2896   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2897                   libzvbi (default enabled)]))
2898 AC_ARG_ENABLE(telx,
2899   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2900                   zvbi) (default enabled if zvbi is absent)]))
2901
2902 AS_IF( [test "${enable_zvbi}" != "no"],[
2903     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2904         [
2905           VLC_ADD_PLUGIN([zvbi])
2906           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2907           AS_IF( [test "${enable_telx}" = "yes"],[
2908                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2909                   ])
2910         ],[
2911           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2912         ])
2913     ])
2914 AS_IF( [test "${enable_telx}" != "no" ],[
2915   VLC_ADD_PLUGIN([telx])
2916   ])
2917
2918 dnl
2919 dnl libass subtitle rendering module
2920 dnl
2921 AC_ARG_ENABLE(libass,
2922   [  --enable-libass         Subtitle support using libass (default enabled)])
2923 AS_IF( [test "${enable_libass}" != "no"], [
2924   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2925       [
2926         VLC_ADD_PLUGIN([libass])
2927
2928         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2929           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2930            VLC_ADD_LIBS([libass],[-lfontconfig])
2931        ])
2932       ],[
2933         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2934       ])
2935   ])
2936
2937 dnl
2938 dnl  kate decoder plugin
2939 dnl
2940 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2941
2942 dnl
2943 dnl  tiger rendering for kate decoder plugin
2944 dnl
2945 AC_ARG_ENABLE(tiger,
2946 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2947 AS_IF([test "${enable_tiger}" != "no"], [
2948   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2949       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])],[
2950         AS_IF([test -n "${enable_tiger}"], [
2951           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2952         ])
2953   ])
2954 ])
2955
2956
2957 dnl
2958 dnl  Video plugins
2959 dnl
2960
2961 EXTEND_HELP_STRING([Video plugins:])
2962
2963 dnl
2964 dnl  OpenGL
2965 dnl
2966 PKG_CHECK_MODULES([GL], [gl], [
2967   have_gl="yes"
2968 ], [
2969   AC_CHECK_HEADER([GL/gl.h], [
2970     have_gl="yes"
2971     GL_CFLAGS=""
2972     AS_IF([test "${SYS}" = "mingw32"], [
2973       AC_CHECK_HEADER([GL/glew.h], [
2974       ], [
2975         have_gl="no"
2976       ])
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  CoreAudio plugin
3556 dnl
3557 AC_ARG_ENABLE(macosx-audio,
3558   [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
3559 if test "x${enable_macosx_audio}" != "xno" &&
3560   (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
3561 then
3562   AC_CHECK_HEADER([CoreAudio/CoreAudio.h],
3563     [ VLC_ADD_PLUGIN([auhal])
3564     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
3565 fi
3566
3567 dnl
3568 dnl  iOS CoreAudio plugin
3569 dnl
3570 AC_ARG_ENABLE(ios-audio,
3571   [  --enable-ios-audio       Audio module for iOS (default disabled)])
3572 if test "${enable_ios_audio}" = "yes"
3573 then
3574   AC_CHECK_HEADER([AudioUnit/AudioUnit.h],
3575     [ VLC_ADD_PLUGIN([audiounit_ios])
3576     ], [ AC_MSG_ERROR([cannot find AudioUnit headers]) ])
3577 fi
3578
3579 dnl
3580 dnl  AudioQueue plugin
3581 dnl
3582 AC_ARG_ENABLE(audioqueue,
3583   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3584 if test "${enable_audioqueue}" = "yes"
3585 then
3586   VLC_ADD_PLUGIN([audioqueue])
3587 fi
3588
3589 dnl
3590 dnl  JACK modules
3591 dnl
3592 AC_ARG_ENABLE(jack,
3593   [AS_HELP_STRING([--disable-jack],
3594     [do not use jack (default auto)])])
3595 have_jack="no"
3596 AS_IF([test "${enable_jack}" != "no"], [
3597     PKG_CHECK_MODULES(JACK, jack >= 1.9.7,
3598       [ have_jack=yes ],
3599       [
3600       AC_MSG_WARN([${JACK_PKG_ERRORS}, trying jack1 instead])
3601
3602       PKG_CHECK_MODULES(JACK, jack >= 0.120.1 jack < 1.0,
3603       [ have_jack=yes ],
3604       [
3605       AS_IF([test -n "${enable_jack}"],
3606          [AC_MSG_ERROR([${JACK_PKG_ERRORS}.])],
3607          [AC_MSG_WARN([${JACK_PKG_ERRORS}.])])
3608       ])
3609     ])
3610 ])
3611 AM_CONDITIONAL([HAVE_JACK], [test "${have_jack}" != "no"])
3612
3613 dnl
3614 dnl  OpenSLES Android
3615 dnl
3616 AC_ARG_ENABLE(opensles,
3617   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3618 if test "${HAVE_ANDROID}" = "1"; then
3619   if test "${enable_opensles}" = "yes"; then
3620       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3621         [ VLC_ADD_PLUGIN([opensles_android]) ],
3622         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3623   fi
3624 fi
3625
3626 dnl
3627 dnl libsamplerate plugin
3628 dnl
3629 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3630
3631 dnl
3632 dnl  OS/2 KAI plugin
3633 dnl
3634 AC_ARG_ENABLE(kai,
3635   [AS_HELP_STRING([--enable-kai],
3636     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3637   AS_IF([test "$SYS" = "os2"], [
3638     enable_kai="yes"
3639   ])
3640 ])
3641 have_kai="no"
3642 KAI_LIBS=""
3643 AS_IF([test "$enable_kai" != "no"], [
3644   AC_CHECK_HEADERS([kai.h], [
3645     have_kai="yes"
3646     AC_CHECK_LIB(kai, main, [
3647       KAI_LIBS="-lkai"
3648     ])
3649   ])
3650 ])
3651 AC_SUBST(KAI_LIBS)
3652 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3653
3654 dnl
3655 dnl  chromaprint audio track fingerprinter
3656 dnl
3657 m4_pushdef([libchromaprint_version], 0.6.0)
3658 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
3659     VLC_ADD_PLUGIN([stream_out_chromaprint])
3660     VLC_ADD_CFLAGS([stream_out_chromaprint],[${CHROMAPRINT_CFLAGS}] [-I./webservices -I../stream_out])
3661     VLC_ADD_LIBS([stream_out_chromaprint],[${CHROMAPRINT_LIBS}]),
3662     AS_IF([test "${enable_chromaprint}" = "yes"],
3663         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
3664         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
3665          ),
3666     [(Chromaprint based audio fingerprinter)],[auto])
3667 m4_popdef([libchromaprint_version])
3668
3669 dnl
3670 dnl  Interface plugins
3671 dnl
3672
3673 EXTEND_HELP_STRING([Interface plugins:])
3674
3675 dnl
3676 dnl QT
3677 dnl
3678 AC_ARG_ENABLE(qt, [
3679   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3680   AS_IF([test "${SYS}" = "darwin"], [
3681     enable_qt="no"
3682   ])
3683 ])
3684 AS_IF([test "${enable_qt}" != "no"], [
3685   PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
3686       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
3687       AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3688       AC_PATH_PROG(RCC, [rcc-qt5 rcc], rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3689       AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3690     ], [
3691       PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3692         AS_IF([test -n "${enable_qt}"],[
3693           AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3694         ],[
3695           AC_MSG_WARN([${QT_PKG_ERRORS}.])
3696         ])
3697         enable_qt="no"
3698       ])
3699       QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3700       AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3701       AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3702       AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
3703     ])
3704 ])
3705 AS_IF([test "${enable_qt}" != "no"], [
3706   VLC_ADD_PLUGIN([qt4])
3707   ALIASES="${ALIASES} qvlc"
3708
3709   AC_LANG_PUSH([C++])
3710   VLC_SAVE_FLAGS
3711
3712   AC_MSG_CHECKING([whether Qt uses Xlib])
3713   CPPFLAGS="${CPPFLAGS} ${QT_CFLAGS}"
3714   AC_PREPROC_IFELSE([AC_LANG_SOURCE([
3715 #include <QWidget>
3716 #if !defined (Q_WS_X11)
3717 # error Fail
3718 #endif
3719   ])], [
3720     AC_MSG_RESULT([yes])
3721   ], [
3722     AC_MSG_RESULT([no])
3723   ])
3724
3725   VLC_RESTORE_FLAGS
3726   AC_LANG_POP([C++])
3727
3728 ])
3729 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3730
3731 dnl
3732 dnl Simple test for skins2 dependency
3733 dnl
3734 AS_IF([test "$enable_qt" = "no"], [
3735   AS_IF([test "${enable_skins2}" = "yes"], [
3736     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.])
3737   ], [
3738     enable_skins2="no"
3739     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3740   ])
3741 ])
3742
3743 dnl
3744 dnl Skins2 module
3745 dnl
3746 AC_ARG_ENABLE(skins2,
3747   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3748 AS_IF([test "${enable_skins2}" != "no"], [
3749   have_skins_deps="yes"
3750
3751   dnl Win32
3752   AS_IF([test "${SYS}" = "mingw32"], [
3753     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3754     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3755   dnl MacOS
3756   ], [test "${SYS}" = "darwin"], [
3757     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3758     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3759   dnl OS/2
3760   ], [test "${SYS}" = "os2"], [
3761     VLC_ADD_CPPFLAGS([skins2],[ -DOS2_SKINS])
3762   dnl Linux/Unix
3763   ], [
3764     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3765     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3766     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3767     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3768     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3769   ])
3770
3771   dnl for All OSes
3772   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3773
3774   dnl we need freetype
3775   AS_IF([test "${have_freetype}" != "yes"], [
3776     have_skins_deps="no"
3777   ])
3778
3779   AS_IF([test "${have_skins_deps}" = "no"], [
3780     AS_IF([test "x${enable_skins2}" = "x"], [
3781       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3782     ], [
3783       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3784     ])
3785     enable_skins2="no"
3786   ], [
3787     VLC_ADD_PLUGIN([skins2])
3788     ALIASES="${ALIASES} svlc"
3789     enable_skins2="yes"
3790   ])
3791 ])
3792 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3793
3794 AC_ARG_ENABLE(libtar,
3795   [  --enable-libtar         libtar support for skins2 (default auto)])
3796 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3797   AC_CHECK_HEADERS(libtar.h, [
3798     VLC_ADD_LIBS([skins2],[-ltar])
3799   ])
3800 ])
3801
3802 dnl
3803 dnl  MacOS X gui module
3804 dnl
3805 AC_ARG_ENABLE(macosx,
3806   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3807 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3808 then
3809   VLC_ADD_LIBS([macosx], [-Wl,-framework,Cocoa -Wl,-framework,Carbon -Wl,-framework,CoreServices])
3810   VLC_ADD_OBJCFLAGS([macosx], [-fobjc-exceptions] )
3811   VLC_ADD_PLUGIN([macosx])
3812
3813   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])
3814
3815   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3816   then
3817     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3818   fi
3819   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,Sparkle])
3820   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3821
3822   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3823   then
3824     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3825   fi
3826   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit])
3827   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3828 fi
3829 AM_CONDITIONAL(ENABLE_MACOSX_UI, [test "$enable_macosx" != "no"])
3830
3831 dnl
3832 dnl  Minimal Mac OS X module
3833 dnl
3834 AC_ARG_ENABLE(minimal-macosx,
3835   [  --enable-minimal-macosx Minimal Mac OS X support (default disabled)])
3836 if test "${enable_minimal_macosx}" = "yes" -a "${SYS}" = "darwin"
3837 then
3838   VLC_ADD_LIBS([minimal_macosx], [-Wl,-framework,Cocoa])
3839   VLC_ADD_OBJCFLAGS([minimal_macosx], [-fobjc-exceptions] )
3840   VLC_ADD_PLUGIN([minimal_macosx])
3841 fi
3842 AM_CONDITIONAL(ENABLE_MINIMAL_MACOSX, [test "$enable_minimal_macosx" != "no"])
3843
3844 dnl
3845 dnl  MacOS X dialog provider
3846 dnl
3847 AC_ARG_ENABLE(macosx-dialog-provider,
3848   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3849 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3850   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3851 then
3852   VLC_ADD_LIBS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
3853   VLC_ADD_PLUGIN([macosx_dialog_provider])
3854 fi
3855 AM_CONDITIONAL(ENABLE_MACOSX_DIALOG_PROVIDER, [test "$enable_macosx_dialog_provider" != "no"])
3856
3857 dnl
3858 dnl  ncurses module
3859 dnl
3860 AC_ARG_ENABLE(ncurses,
3861 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3862 AS_IF([test "${enable_ncurses}" != "no"] ,[
3863   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3864     VLC_ADD_PLUGIN([ncurses])
3865     VLC_ADD_CFLAGS([ncurses],[${NCURSES_CFLAGS}])
3866     VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS}])
3867     ALIASES="${ALIASES} nvlc"
3868   ], [
3869     AS_IF([test -n "${enable_ncurses}"], [
3870       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3871     ])
3872   ])
3873 ])
3874
3875 dnl
3876 dnl  Lirc plugin
3877 dnl
3878 AC_ARG_ENABLE(lirc,
3879   [  --enable-lirc           lirc support (default disabled)])
3880 if test "${enable_lirc}" = "yes"
3881 then
3882   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
3883   if test "${have_lirc}" = "true"
3884   then
3885     VLC_ADD_PLUGIN([lirc])
3886     VLC_ADD_LIBS([lirc],[-llirc_client])
3887   fi
3888 fi
3889
3890 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3891 dnl
3892 dnl  goom visualization plugin
3893 dnl
3894 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3895
3896 dnl
3897 dnl libprojectM visualization plugin
3898 dnl
3899 AC_ARG_ENABLE(projectm,
3900   [  --enable-projectm       projectM visualization plugin (default enabled)])
3901 AS_IF([test "${enable_projectm}" != "no"],
3902   [
3903     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3904     [
3905       VLC_ADD_PLUGIN([projectm])
3906       PKG_CHECK_EXISTS([libprojectM >= 2.0.0],
3907         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3908         [ AC_MSG_WARN( [Using libprojectM version 1] )
3909       ])
3910     ],[
3911       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3912     ])
3913   ])
3914
3915 dnl
3916 dnl Vovoid VSXu visualization plugin
3917 dnl
3918 AC_ARG_ENABLE(vsxu,
3919   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3920 AS_IF([test "${enable_vsxu}" != "no"],
3921   [
3922     PKG_CHECK_MODULES(VSXU, libvsxu,
3923     [
3924       VLC_ADD_PLUGIN([vsxu])
3925       VLC_ADD_CXXFLAGS([vsxu],[$VSXU_CFLAGS])
3926       VLC_ADD_LIBS([vsxu],[$VSXU_LIBS])
3927     ],[
3928       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3929     ])
3930   ])
3931
3932 dnl
3933 dnl  AtmoLight (homemade Philips Ambilight clone)
3934 dnl
3935 AC_ARG_ENABLE(atmo,
3936 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
3937                 (default enabled)]),, [enable_atmo="yes"])
3938 AS_IF([test "${enable_atmo}" != no], [
3939   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
3940     AC_LANG_PUSH(C++)
3941     VLC_ADD_PLUGIN([atmo])
3942     AC_LANG_POP(C++)
3943   ])
3944 ])
3945
3946 dnl
3947 dnl  glSpectrum
3948 dnl
3949 AC_ARG_ENABLE(glspectrum,
3950   [  --enable-glspectrum    3D OpenGL spectrum visualization (default auto)])
3951 if test "${enable_glspectrum}" != "no" && test "${have_gl}" = "yes"
3952 then
3953     VLC_ADD_PLUGIN([glspectrum])
3954     VLC_ADD_LIBS([glspectrum],[$GL_LIBS])
3955 fi
3956
3957 EXTEND_HELP_STRING([Service Discovery plugins:])
3958 dnl
3959 dnl  Bonjour services discovery
3960 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3961
3962 dnl
3963 dnl  libudev services discovery
3964 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3965
3966 dnl
3967 dnl MTP devices services discovery
3968 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3969
3970 dnl
3971 dnl UPnP Plugin (Intel SDK)
3972 dnl
3973 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
3974
3975 EXTEND_HELP_STRING([Misc options:])
3976
3977 dnl
3978 dnl  libxml2 module
3979 dnl
3980 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
3981
3982
3983 dnl
3984 dnl libgcrypt
3985 dnl
3986 AC_ARG_ENABLE(libgcrypt,
3987   [  --disable-libgcrypt     gcrypt support (default enabled)])
3988 AS_IF([test "${enable_libgcrypt}" != "no"], [
3989   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
3990     libgcrypt-config --version >/dev/null || \
3991         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
3992     AC_CHECK_LIB(gcrypt, gcry_control, [
3993       have_libgcrypt="yes"
3994       GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
3995       GCRYPT_LIBS="`libgcrypt-config --libs`"
3996     ], [
3997       AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
3998     ], [`libgcrypt-config --libs`])
3999   ], [
4000     AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
4001   ], [#include <gcrypt.h>]
4002   )
4003 ])
4004
4005 AC_SUBST(GCRYPT_CFLAGS)
4006 AC_SUBST(GCRYPT_LIBS)
4007 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
4008
4009 dnl
4010 dnl TLS/SSL
4011 dnl
4012 AC_ARG_ENABLE(gnutls,
4013   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
4014 AS_IF([test "${enable_gnutls}" != "no"], [
4015   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.0.20], [
4016     VLC_ADD_PLUGIN([gnutls])
4017   ], [
4018     AS_IF([test -n "${enable_gnutls}"], [
4019       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
4020     ])
4021   ])
4022 ])
4023
4024
4025 dnl
4026 dnl Taglib plugin
4027 dnl
4028 AC_ARG_ENABLE(taglib,
4029   [AS_HELP_STRING([--disable-taglib],
4030     [do not use TagLib (default enabled)])])
4031 AS_IF([test "${enable_taglib}" != "no"], [
4032   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.6.1, [
4033     VLC_ADD_PLUGIN([taglib])
4034   ], [
4035     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
4036 ])
4037
4038
4039 dnl
4040 dnl update checking system
4041 dnl
4042 AC_ARG_ENABLE(update-check,
4043   [  --enable-update-check   update checking system (default disabled)])
4044 if test "${enable_update_check}" = "yes"
4045 then
4046   if test "${have_libgcrypt}" != "yes"
4047   then
4048     AC_MSG_ERROR([libgcrypt is required for update checking system])
4049   fi
4050   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
4051   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
4052   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
4053 fi
4054
4055 dnl
4056 dnl Growl notification plugin
4057 dnl
4058 AC_ARG_ENABLE(growl,
4059   [  --enable-growl          growl notification plugin (default disabled)],,
4060   [enable_growl=no])
4061 AS_IF([test "${enable_growl}" != "no"], [
4062     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
4063       VLC_ADD_PLUGIN([growl])
4064       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
4065       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
4066       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
4067     ])
4068   ]
4069 )
4070
4071 dnl
4072 dnl Libnotify notification plugin
4073 dnl
4074 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4075
4076 dnl
4077 dnl  Endianness check
4078 dnl
4079 AC_C_BIGENDIAN
4080 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4081   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4082 ], [
4083   DEFS_BIGENDIAN=""
4084 ])
4085 AC_SUBST(DEFS_BIGENDIAN)
4086
4087 dnl
4088 dnl Where to install KDE solid .desktop
4089 dnl
4090 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4091 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4092   KDE4_CONFIG="kde4-config"
4093 ])
4094
4095 AC_ARG_WITH(kde-solid,
4096   AS_HELP_STRING([--with-kde-solid=PATH],
4097                  [KDE Solid actions directory (auto)]),, [
4098
4099 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4100   with_kde_solid="yes"
4101 fi
4102 ])
4103 soliddatadir=""
4104 AS_IF([test "${with_kde_solid}" != "no"], [
4105   AS_IF([test "${with_kde_solid}" = "yes"], [
4106     kde4datadir="`${KDE4_CONFIG} --install data`"
4107     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4108     soliddatadir="${kde4datadir}/solid/actions"
4109   ], [
4110     soliddatadir="${with_kde_solid}"
4111   ])
4112 ])
4113 AC_SUBST(soliddatadir)
4114 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4115
4116 EXTEND_HELP_STRING([Components:])
4117
4118 dnl
4119 dnl  the VLC binary
4120 dnl
4121 AC_ARG_ENABLE(vlc,
4122   [  --enable-vlc            build the VLC media player (default enabled)])
4123 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4124
4125 AC_ARG_ENABLE(macosx-vlc-app,
4126   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4127 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4128     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4129
4130 dnl
4131 dnl  Stuff used by the program
4132 dnl
4133 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4134 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4135 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4136 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4137 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4138 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4139 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4140 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4141 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4142 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4143 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4144 AC_SUBST(COPYRIGHT_MESSAGE)
4145 AC_SUBST(VERSION_MESSAGE)
4146 AC_SUBST(VERSION_MAJOR)
4147 AC_SUBST(VERSION_MINOR)
4148 AC_SUBST(VERSION_REVISION)
4149 AC_SUBST(VERSION_EXTRA)
4150 AC_SUBST(COPYRIGHT_YEARS)
4151 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4152 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4153 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4154 dnl
4155 dnl  Handle substvars that use $(top_srcdir)
4156 dnl
4157 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4158
4159 dnl
4160 dnl  Configuration is finished
4161 dnl
4162 AC_SUBST(SYS)
4163 AC_SUBST(ARCH)
4164 AC_SUBST(ALIASES)
4165 AC_SUBST(ASM)
4166 AC_SUBST(MOC)
4167 AC_SUBST(RCC)
4168 AC_SUBST(UIC)
4169 AC_SUBST(WINDRES)
4170 AC_SUBST(WINE_SDK_PATH)
4171 AC_SUBST(LIBEXT)
4172 AC_SUBST(AM_CPPFLAGS)
4173 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4174 AC_SUBST(FILE_LIBVLCCORE_DLL)
4175 AC_SUBST(FILE_LIBVLC_DLL)
4176
4177 AC_CONFIG_FILES([
4178   Makefile
4179   doc/Makefile
4180   modules/Makefile
4181   m4/Makefile
4182   po/Makefile.in
4183   share/Makefile
4184   compat/Makefile
4185   src/Makefile
4186   lib/Makefile
4187   bin/Makefile
4188   test/Makefile
4189   modules/access/rtp/Makefile
4190   modules/access_output/Makefile
4191   modules/audio_filter/Makefile
4192   modules/control/Makefile
4193   modules/gui/Makefile
4194   modules/gui/macosx/Makefile
4195   modules/gui/minimal_macosx/Makefile
4196   modules/gui/macosx_dialog_provider/Makefile
4197   modules/gui/qt4/Makefile
4198   modules/gui/skins2/Makefile
4199   modules/misc/Makefile
4200   modules/mux/Makefile
4201   modules/notify/Makefile
4202   modules/packetizer/Makefile
4203   modules/stream_filter/Makefile
4204   modules/stream_out/Makefile
4205   modules/text_renderer/Makefile
4206   modules/video_chroma/Makefile
4207   modules/video_filter/Makefile
4208   modules/video_output/Makefile
4209   modules/video_splitter/Makefile
4210   modules/visualization/Makefile
4211   modules/hw/vdpau/Makefile
4212 ])
4213
4214 AM_COND_IF([HAVE_WIN32], [
4215   AC_CONFIG_FILES([
4216     extras/package/win32/NSIS/spad.nsi
4217     extras/package/win32/NSIS/vlc.win32.nsi
4218     extras/package/win32/msi/config.wxi
4219   ])
4220 ])
4221
4222 AM_COND_IF([HAVE_DARWIN], [
4223   AC_CONFIG_FILES([
4224     extras/package/macosx/Info.plist
4225     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4226   ])
4227 ])
4228
4229 dnl Generate makefiles
4230 AC_OUTPUT
4231
4232 dnl Do we have to use make or gmake ?
4233 if make --version 2>&1|grep -q GNU
4234 then
4235     # GNU make, all seems good
4236     MAKE=make
4237 else
4238     # Known GNU make alias (on BSD)
4239     MAKE=gmake
4240 fi
4241 dnl Shortcut to nice compile message
4242 if test -n $SHELL; then
4243   SHELL=${CONFIG_SHELL-/bin/sh}
4244 fi
4245 rm -f compile
4246 echo "#! $SHELL
4247 rm -f .error\$\$
4248 ERROR=0
4249 export PATH=\"$PATH\" LANG=C
4250 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| `sed -ne \"s/^top_srcdir *= *//p\" < Makefile`/extras/buildsystem/make.pl
4251 test -f .error\$\$ && ERROR=1
4252 rm -f .error\$\$
4253 exit \$ERROR" >compile
4254 chmod a+x compile
4255
4256 echo "
4257 libvlc configuration
4258 --------------------
4259 version               : ${VERSION}
4260 system                : ${SYS}
4261 architecture          : ${ARCH}
4262 optimizations         : ${enable_optimizations}"
4263 if test "${enable_vlc}" != "no"; then
4264 echo "vlc aliases           :${ALIASES}"
4265 else
4266 echo "build vlc executable  : no"
4267 fi
4268 echo "
4269 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."