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