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