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