]> git.sesse.net Git - vlc/blob - configure.ac
Opus decoder.
[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   AC_CHECK_DECLS([V4L2_CTRL_TYPE_BITMASK,V4L2_CTRL_TYPE_INTEGER_MENU],,, [
1784 #ifdef HAVE_LINUX_VIDEODEV2_H
1785 # include <linux/videodev2.h>
1786 #endif
1787 #ifdef HAVE_SYS_VIDEOIO_H
1788 # include <sys/videoio.h>
1789 #endif
1790   ])
1791 ])
1792 AS_IF([test "$have_v4l2" = "yes"], [
1793   AS_IF([test "${enable_pvr}" = "yes"], [
1794     VLC_ADD_PLUGIN([pvr])
1795   ])
1796 ])
1797 AM_CONDITIONAL(HAVE_V4L2, [test "${have_v4l2}" != "no"])
1798
1799 dnl
1800 dnl special access module for Blackmagic SDI cards
1801 dnl
1802 AC_ARG_ENABLE(decklink,
1803   [AS_HELP_STRING([--disable-decklink],
1804     [disable Blackmagic DeckLink SDI input (default auto)])])
1805 AC_ARG_WITH(decklink_sdk,
1806   [AS_HELP_STRING[--with-decklink-sdk=DIR],
1807     [                        location of Blackmagic DeckLink SDI SDK])])
1808 if test "${enable_decklink}" != "no"
1809 then
1810   if test "${with_decklink_sdk}" != "no" -a -n "${with_decklink_sdk}"
1811   then
1812     VLC_ADD_CPPFLAGS([decklink],[-I${with_decklink_sdk}/include])
1813   fi
1814   VLC_SAVE_FLAGS
1815   CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_decklink}"
1816   AC_LANG_PUSH(C++)
1817   AC_CHECK_HEADERS(DeckLinkAPIDispatch.cpp, [
1818     VLC_ADD_PLUGIN([decklink])
1819   ],[AC_MSG_WARN(Blackmagic DeckLink SDI include files not found, decklink disabled)])
1820   AC_LANG_POP(C++)
1821   VLC_RESTORE_FLAGS
1822 fi
1823
1824
1825 dnl
1826 dnl  gnomeVFS access module
1827 dnl
1828 PKG_ENABLE_MODULES_VLC([GNOMEVFS], [access_gnomevfs], [gnome-vfs-2.0], [GnomeVFS access module], [auto])
1829
1830 dnl
1831 dnl  VCDX modules
1832 dnl
1833 AC_ARG_ENABLE(vcdx,
1834   [AS_HELP_STRING([--enable-vcdx],
1835     [navigate VCD with libvcdinfo (default disabled)])])
1836 if test "${enable_vcdx}" = "yes"
1837 then
1838     PKG_CHECK_MODULES(LIBCDIO, [libcdio >= 0.78.2 libiso9660 >= 0.72],
1839       [VLC_ADD_LIBS([vcdx],[$LIBCDIO_LIBS])
1840          VLC_ADD_CFLAGS([vcdx],[$LIBCDIO_CFLAGS])],
1841         [AC_MSG_ERROR([${LIBCDIO_PKG_ERRORS} (required for vcdx plugin).])])
1842     PKG_CHECK_MODULES(LIBVCDINFO, libvcdinfo >= 0.7.22,
1843         [VLC_ADD_LIBS([vcdx],[$LIBVCDINFO_LIBS])
1844          VLC_ADD_CFLAGS([vcdx],[$LIBVCDINFO_CFLAGS])],
1845       [AC_MSG_ERROR([${LIBVCDINFO_PKG_ERRORS} (required for vcdx plugin).])])
1846     VLC_ADD_PLUGIN([vcdx])
1847 fi
1848
1849 dnl
1850 dnl  Built-in CD-DA and VCD module
1851 dnl
1852 AC_ARG_ENABLE(vcd,
1853   [AS_HELP_STRING([--disable-vcd],
1854     [disable built-in VCD and CD-DA support (default enabled)])])
1855
1856 AC_ARG_ENABLE(libcddb,
1857   [AS_HELP_STRING([--disable-libcddb],
1858     [disable CDDB for Audio CD (default enabled)])])
1859
1860 if test "${enable_vcd}" != "no"
1861 then
1862   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1863   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1864     AC_MSG_RESULT(yes)
1865     VLC_ADD_PLUGIN([vcd cdda])
1866   ],[
1867     AC_MSG_RESULT(no)
1868   ])
1869
1870   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1871   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1872     AC_MSG_RESULT(yes)
1873     VLC_ADD_PLUGIN([vcd cdda])
1874     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1875   ],[
1876     AC_MSG_RESULT(no)
1877   ])
1878
1879   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1880   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1881     AC_MSG_RESULT(yes)
1882     VLC_ADD_PLUGIN([vcd cdda])
1883     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1884   ],[
1885     AC_MSG_RESULT(no)
1886   ])
1887
1888   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32" -o "${SYS}" = "os2"
1889   then
1890     VLC_ADD_PLUGIN([vcd cdda])
1891   fi
1892
1893   if test "${SYS}" = "darwin"
1894   then
1895     VLC_ADD_PLUGIN([vcd cdda])
1896     VLC_ADD_LIBS([vcd vcdx cdda],[-Wl,-framework,IOKit,-framework,CoreFoundation])
1897     VLC_ADD_LIBS([vcdx cdda],[-liconv])
1898   fi
1899
1900   if test "$enable_libcddb" != "no"; then
1901     PKG_CHECK_MODULES(LIBCDDB, [libcddb >= 0.9.5], [
1902       HAVE_LIBCDDB=yes
1903       AC_DEFINE(HAVE_LIBCDDB, 1, [Define this if you have libcddb installed])
1904       VLC_ADD_LIBS([cdda],[$LIBCDDB_LIBS])
1905       VLC_ADD_CFLAGS([cdda],[$LIBCDDB_CFLAGS])
1906       ],:
1907       [AC_MSG_WARN([${LIBCDDB_PKG_ERRORS}: CDDB access disabled.])
1908       HAVE_LIBCDDB=no])
1909   fi
1910 fi
1911
1912 dnl
1913 dnl Linux DVB
1914 dnl
1915 AC_CACHE_CHECK([for Linux DVB version 5.1], [ac_cv_linux_dvb_5_1], [
1916   AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
1917 [#include <linux/dvb/version.h>
1918 #if (DVB_API_VERSION < 5)
1919 # error Linux DVB API v3.2 and older are not supported.
1920 #endif
1921 #if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR < 1)
1922 # error Linux DVB API v5.0 is unsupported. Please update.
1923 #endif
1924 ]])], [
1925   ac_cv_linux_dvb_5_1=yes
1926 ], [
1927   ac_cv_linux_dvb_5_1=no
1928 ])])
1929 AM_CONDITIONAL([HAVE_LINUX_DVB], [test "$ac_cv_linux_dvb_5_1" = "yes"])
1930
1931 dnl
1932 dnl  Screen capture module
1933 dnl
1934 AC_ARG_ENABLE(screen,
1935   [AS_HELP_STRING([--enable-screen],
1936     [disable screen capture (default enabled)])])
1937 if test "${enable_screen}" != "no"; then
1938   if test "${SYS}" = "darwin"; then
1939     AC_CHECK_HEADERS(OpenGL/gl.h, [
1940       AC_CHECK_HEADERS(ApplicationServices/ApplicationServices.h, [
1941         VLC_ADD_PLUGIN([screen])
1942         VLC_ADD_LIBS([screen],[-Wl,-framework,OpenGL,-framework,ApplicationServices])
1943       ])
1944     ])
1945   elif test "${SYS}" = "mingw32"; then
1946     VLC_ADD_PLUGIN([screen])
1947     VLC_ADD_LIBS([screen],[-lgdi32])
1948   fi
1949 fi
1950
1951 dnl
1952 dnl  Real RTSP plugin
1953 dnl
1954 AC_ARG_ENABLE(realrtsp,
1955   [  --enable-realrtsp       Real RTSP module (default disabled)])
1956 if test "${enable_realrtsp}" = "yes"; then
1957   VLC_ADD_PLUGIN([access_realrtsp])
1958 fi
1959
1960 dnl
1961 dnl MacOS eyeTV
1962 AC_ARG_ENABLE(macosx-eyetv,
1963   [  --enable-macosx-eyetv   Mac OS X EyeTV (TNT Tuner) module (default enabled on Mac OS X)])
1964 if test "x${enable_macosx_eyetv}" != "xno" &&
1965   (test "${SYS}" = "darwin" || test "${enable_macosx_eyetv}" = "yes")
1966 then
1967   VLC_ADD_LIBS([access_eyetv], [-Wl,-framework,Foundation])
1968   VLC_ADD_PLUGIN([access_eyetv])
1969 fi
1970
1971 dnl
1972 dnl QTKit
1973 AC_ARG_ENABLE(macosx-qtkit,
1974   [  --enable-macosx-qtkit Mac OS X qtcapture (video) and qtsound (audio) module (default enabled on Mac OS X)])
1975 if test "x${enable_macosx_qtkit}" != "xno" &&
1976   (test "${SYS}" = "darwin" || test "${enable_macosx_qtkit}" = "yes")
1977 then
1978   VLC_ADD_PLUGIN([qtcapture])
1979   VLC_ADD_PLUGIN([qtsound])
1980 fi
1981 AM_CONDITIONAL(HAVE_QTKIT, [test "${SYS}" = "darwin" -a "x${enable_macosx_qtkit}" != "xno"])
1982
1983
1984 dnl
1985 dnl  Demux plugins
1986 dnl
1987
1988 EXTEND_HELP_STRING([Mux/Demux plugins:])
1989
1990 dnl
1991 dnl  libdvbpsi check for ts mux/demux
1992 dnl
1993 have_dvbpsi="no"
1994 PKG_WITH_MODULES([DVBPSI], [libdvbpsi], [have_dvbpsi="yes"])
1995 AM_CONDITIONAL(HAVE_DVBPSI, [test "${have_dvbpsi}" = "yes"])
1996
1997
1998 dnl
1999 dnl  GME demux plugin
2000 dnl
2001 AC_ARG_ENABLE(gme,
2002   [AS_HELP_STRING([--enable-gme],
2003     [use Game Music Emu (default auto)])])
2004 AS_IF([test "${enable_gme}" != "no"], [
2005   AC_CHECK_HEADER([gme/gme.h], [
2006     VLC_ADD_LIBS([gme], [-lgme])
2007     VLC_ADD_PLUGIN([gme])
2008   ], [
2009     AS_IF([test "x${enable_gme}" != "x"], [
2010       AC_MSG_ERROR([GME cannot be found. Please install the development files.])
2011     ])
2012   ])
2013 ])
2014
2015
2016 dnl
2017 dnl  SIDPlay plugin
2018 dnl
2019 AC_ARG_ENABLE(sid,
2020     [AS_HELP_STRING([--enable-sid],[C64 sid demux support (default auto)])])
2021 AS_IF([test "${enable_sid}" != "no"], [
2022     PKG_CHECK_MODULES(SID, [libsidplay2], [
2023         AC_LANG_PUSH(C++)
2024         oldCPPFLAGS="$CPPFLAGS"
2025         CPPFLAGS="$CPPFLAGS $SID_CFLAGS"
2026         AC_CHECK_HEADER([sidplay/builders/resid.h], [
2027             VLC_ADD_PLUGIN([sid])
2028             VLC_ADD_CFLAGS([sid], [$SID_CFLAGS])
2029             VLC_ADD_LIBS([sid], [$SID_LIBS] [-lresid-builder])
2030         ], [
2031             AS_IF([test -n "${enable_sid}"],
2032                 [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2033                 [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2034                 )
2035         ])
2036         CPPFLAGS="$oldCPPFLAGS"
2037         AC_LANG_POP(C++)
2038     ], [
2039         AS_IF([test "x${enable_sid}" = "xyes"],
2040             [AC_MSG_ERROR([${SID_PKG_ERRORS} (required for sid).])],
2041             [AC_MSG_WARN([${SID_PKG_ERRORS} (required for sid).])]
2042             )
2043     ])
2044 ])
2045
2046
2047 dnl
2048 dnl  ogg demux plugin
2049 dnl
2050 PKG_ENABLE_MODULES_VLC([OGG], [], [ogg >= 1.0], [Ogg demux support], [auto])
2051 if test "${enable_sout}" != "no"; then
2052     PKG_ENABLE_MODULES_VLC([MUX_OGG], [], [ogg >= 1.0], [Ogg mux support], [auto])
2053 dnl Check for libshout
2054     PKG_ENABLE_MODULES_VLC([SHOUT], [access_output_shout], [shout >= 2.1], [libshout output plugin], [auto])
2055 fi
2056
2057 dnl
2058 dnl  matroska demux plugin
2059 dnl
2060 AC_ARG_ENABLE(mkv,
2061   [AS_HELP_STRING([--disable-mkv],
2062     [do not use libmatroska (default auto)])])
2063 if test "${enable_mkv}" != "no" -a "${CXX}" != ""; then
2064   AC_LANG_PUSH(C++)
2065   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
2066     AC_MSG_CHECKING(for libebml version >= 1.0.0)
2067     AC_EGREP_CPP(yes,
2068       [#include <ebml/EbmlVersion.h>
2069        #ifdef LIBEBML_VERSION
2070        #if LIBEBML_VERSION >= 0x010000
2071        yes
2072        #endif
2073        #endif],
2074       [AC_MSG_RESULT([yes])
2075         AC_CHECK_HEADERS(matroska/KaxVersion.h, [
2076           AC_MSG_CHECKING(for libmatroska version >= 1.0.0)
2077           AC_EGREP_CPP(yes,
2078             [#include <matroska/KaxVersion.h>
2079              #ifdef LIBMATROSKA_VERSION
2080              #if LIBMATROSKA_VERSION >= 0x010000
2081              yes
2082              #endif
2083              #endif],
2084             [AC_MSG_RESULT([yes])
2085               AC_CHECK_HEADERS(matroska/KaxAttachments.h)
2086               VLC_ADD_CXXFLAGS([mkv],[])
2087               AC_CHECK_LIB(ebml_pic, main, [
2088                 VLC_ADD_PLUGIN([mkv])
2089                 VLC_ADD_LIBS([mkv],[-lmatroska -lebml_pic])
2090               ],[
2091                 AC_CHECK_LIB(ebml, main, [
2092                   VLC_ADD_PLUGIN([mkv])
2093                   VLC_ADD_LIBS([mkv],[-lmatroska -lebml])
2094                 ])
2095               ])
2096             ], [
2097               AC_MSG_RESULT([no])
2098               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.])
2099           ])
2100         ])
2101       ],
2102       [AC_MSG_RESULT([no])
2103         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.])
2104     ])
2105   ])
2106   AC_LANG_POP(C++)
2107 fi
2108
2109 dnl
2110 dnl  modplug demux plugin
2111 dnl
2112 AC_ARG_ENABLE(mod,
2113   [AS_HELP_STRING([--disable-mod],
2114     [do not use libmodplug (default auto)])])
2115 if test "${enable_mod}" != "no" ; then
2116     PKG_CHECK_MODULES(LIBMODPLUG, [libmodplug >= 0.8.4 libmodplug != 0.8.8], [
2117           VLC_ADD_PLUGIN([mod])
2118           VLC_ADD_CXXFLAGS([mod],[$LIBMODPLUG_CFLAGS])
2119           VLC_ADD_LIBS([mod],[$LIBMODPLUG_LIBS])
2120     ],[
2121        AS_IF([test -n "${enable_mod}"],
2122          [AC_MSG_ERROR([${LIBMODPLUG_PKG_ERRORS}.])],
2123          [AC_MSG_WARN([${LIBMODPLUG_PKG_ERRORS}.])])
2124     ])
2125 fi
2126
2127 dnl
2128 dnl  mpc demux plugin
2129 dnl
2130 AC_ARG_ENABLE(mpc,
2131   [AS_HELP_STRING([--disable-mpc], [do not use libmpcdec (default auto)])])
2132 if test "${enable_mpc}" != "no"
2133 then
2134   AC_CHECK_HEADERS([mpc/mpcdec.h], [
2135     VLC_ADD_PLUGIN([mpc])
2136     VLC_ADD_LIBS([mpc],[-lmpcdec])],
2137     [AC_CHECK_HEADERS([mpcdec/mpcdec.h], [
2138     VLC_ADD_PLUGIN([mpc])
2139     VLC_ADD_LIBS([mpc],[-lmpcdec])])])
2140 fi
2141
2142 dnl
2143 dnl  Codec plugins
2144 dnl
2145
2146 EXTEND_HELP_STRING([Codec plugins:])
2147
2148 dnl
2149 dnl wmafixed plugin
2150 dnl
2151 AC_ARG_ENABLE(wma-fixed,
2152   [  --enable-wma-fixed      libwma-fixed module (default disabled)])
2153 if test "${enable_wma_fixed}" = "yes"
2154 then
2155   VLC_ADD_PLUGIN([wma_fixed])
2156 fi
2157
2158 dnl
2159 dnl shine fixed point mp3 encoder
2160 dnl
2161 AC_ARG_ENABLE(shine,
2162   [  --enable-shine          shine mp3 encoding module (default disabled)])
2163 if test "${enable_shine}" = "yes"
2164 then
2165   VLC_ADD_PLUGIN([shine])
2166 fi
2167
2168 dnl
2169 dnl openmax il codec plugin
2170 dnl
2171 AC_ARG_ENABLE(omxil,
2172   [  --enable-omxil          openmax il codec module (default disabled)])
2173 if test "${enable_omxil}" = "yes"
2174 then
2175   VLC_ADD_PLUGIN([omxil])
2176   VLC_ADD_LIBS([omxil], [$LIBDL])
2177 fi
2178
2179 dnl
2180 dnl iomx codec plugin
2181 dnl
2182 AC_ARG_ENABLE(iomx,
2183   [  --enable-iomx           iomx codec module (default disabled)])
2184 if test "${enable_iomx}" = "yes"
2185 then
2186   VLC_ADD_PLUGIN([iomx])
2187 fi
2188
2189 dnl
2190 dnl CrystalHD codec plugin
2191 dnl
2192 AC_ARG_ENABLE(crystalhd,
2193   [  --enable-crystalhd      crystalhd codec plugin (default auto)])
2194 if test "${enable_crystalhd}" != "no"; then
2195     AC_CHECK_HEADER(libcrystalhd/libcrystalhd_if.h, [
2196       VLC_ADD_PLUGIN([crystalhd])
2197       VLC_ADD_LIBS([crystalhd], [-lcrystalhd])
2198     ],[
2199       if test "${SYS}" = "mingw32" ; then
2200         AC_CHECK_HEADERS(libcrystalhd/bc_dts_defs.h, [
2201           VLC_ADD_PLUGIN([crystalhd])
2202           AC_CHECK_HEADERS(libcrystalhd/bc_drv_if.h, [
2203             VLC_ADD_LIBS([crystalhd], [-lbcmDIL])
2204             ])
2205         ],[
2206           AS_IF([test x"${enable_crystalhd}" = "xyes"],
2207                 [AC_MSG_ERROR("Could not find CrystalHD development headers")],
2208                 [AC_MSG_WARN("Could not find CrystalHD development headers")])
2209         ],[#define __LINUX_USER__
2210                #include <libcrystalhd/bc_dts_types.h>
2211         ])
2212       fi
2213     ],[
2214        #include <libcrystalhd/bc_dts_types.h>
2215       ])
2216 fi
2217
2218 dnl
2219 dnl  mad plugin
2220 dnl
2221 AC_ARG_ENABLE(mad,
2222   [  --enable-mad            libmad module (default enabled)])
2223 if test "${enable_mad}" != "no"
2224 then
2225   AC_ARG_WITH(mad,
2226     [  --with-mad=PATH         path to libmad],[],[])
2227   if test "${with_mad}" != "no" -a -n "${with_mad}"
2228   then
2229     VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
2230     VLC_ADD_LIBS([mpgatofixed32],[-L${with_mad}/lib])
2231   fi
2232
2233   AC_ARG_WITH(mad-tree,
2234     [  --with-mad-tree=PATH    mad tree for static linking],[],[])
2235   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
2236   then
2237     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
2238     if test -z "${real_mad_tree}"
2239     then
2240       dnl  The given directory can't be found
2241       AC_MSG_RESULT(no)
2242       AC_MSG_ERROR([${with_mad_tree} directory does not exist])
2243     fi
2244     dnl  Use a custom libmad
2245     AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
2246     if test -f ${real_mad_tree}/mad.h
2247     then
2248       AC_MSG_RESULT(yes)
2249       VLC_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
2250       VLC_ADD_LIBS([mpgatofixed32],[-L${real_mad_tree}/.libs])
2251       VLC_SAVE_FLAGS
2252       LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2253       AC_CHECK_LIB(mad, mad_bit_init, [
2254         VLC_ADD_PLUGIN([mpgatofixed32])
2255         VLC_ADD_LIBS([mpgatofixed32],[-lmad])
2256         ],[ AC_MSG_ERROR([the specified tree has not been compiled ])
2257       ],[])
2258       VLC_RESTORE_FLAGS
2259     else
2260       AC_MSG_RESULT(no)
2261       AC_MSG_ERROR([the specified tree does not have mad.h])
2262     fi
2263   else
2264     VLC_SAVE_FLAGS
2265     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_mpgatofixed32}"
2266     LDFLAGS="${LDFLAGS} ${LIBS_mpgatofixed32}"
2267     AC_CHECK_HEADERS(mad.h, ,
2268       [ 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.]) ])
2269     AC_CHECK_LIB(mad, mad_bit_init, [
2270       VLC_ADD_PLUGIN([mpgatofixed32])
2271       VLC_ADD_LIBS([mpgatofixed32],[-lmad])],
2272       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
2273     VLC_RESTORE_FLAGS
2274   fi
2275 fi
2276
2277
2278 AC_ARG_ENABLE(merge-ffmpeg,
2279 [  --enable-merge-ffmpeg   merge FFmpeg-based plugins (default disabled)],, [
2280   enable_merge_ffmpeg="no"
2281 ])
2282 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
2283
2284 VLC_SAVE_FLAGS
2285 LDFLAGS="${LDFLAGS} -Wl,-Bsymbolic"
2286 AC_CACHE_CHECK([if linker supports -Bsymbolic],
2287   [ac_cv_ld_bsymbolic],
2288   [AC_TRY_LINK([],,ac_cv_ld_bsymbolic=yes,ac_cv_ld_bsymbolic=no)])
2289 VLC_RESTORE_FLAGS
2290
2291 dnl
2292 dnl  avcodec decoder/encoder plugin
2293 dnl
2294 AC_ARG_ENABLE(avcodec,
2295 [  --enable-avcodec        libavcodec codec (default enabled)])
2296 AS_IF([test "${enable_avcodec}" != "no"], [
2297   PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 52.25.0 libavutil >= 49.5.0],
2298     [
2299       VLC_SAVE_FLAGS
2300       CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2301       CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2302       AC_CHECK_HEADERS(libavcodec/avcodec.h)
2303       AC_CHECK_HEADERS(libavutil/avutil.h)
2304       VLC_ADD_PLUGIN([avcodec])
2305       VLC_ADD_LIBS([avcodec],[$AVCODEC_LIBS])
2306       AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2307         VLC_ADD_LIBS([avcodec],[-Wl,-Bsymbolic])
2308       ])
2309       VLC_ADD_CFLAGS([avcodec],[$AVCODEC_CFLAGS])
2310       VLC_RESTORE_FLAGS
2311       have_avcodec="yes"
2312     ],[
2313       AC_MSG_ERROR([${AVCODEC_PKG_ERRORS}. Pass --disable-avcodec to ignore this error.])
2314   ])
2315 ], [
2316   have_avcodec="no"
2317 ])
2318
2319 dnl
2320 dnl libva needs avcodec
2321 dnl
2322 AC_ARG_ENABLE(libva,
2323   [  --enable-libva          VAAPI GPU decoding support (libVA) (default auto)])
2324
2325 AS_IF([test "${enable_libva}" = "yes" -a "${have_avcodec}" != "yes" ], [
2326   AC_MSG_ERROR([--enable-libva and --disable-avcodec options are mutually exclusive. Use --enable-avcodec.])
2327 ])
2328 AS_IF([test "${enable_libva}" != "no"], [
2329   PKG_CHECK_MODULES(LIBVA, [libva libva-x11], [
2330     VLC_SAVE_FLAGS
2331     CPPFLAGS="${CPPFLAGS} ${AVCODEC_CFLAGS}"
2332     CFLAGS="${CFLAGS} ${AVCODEC_CFLAGS}"
2333     AC_CHECK_HEADERS(libavcodec/vaapi.h, [
2334       VLC_ADD_LIBS([avcodec],[$LIBVA_LIBS ${X_LIBS} ${X_PRE_LIBS} -lX11])
2335       VLC_ADD_CFLAGS([avcodec],[$LIBVA_CFLAGS ${X_CFLAGS}])
2336       AC_DEFINE(HAVE_AVCODEC_VAAPI, 1, [Define if avcodec has to be built with VAAPI support.])
2337       AC_MSG_NOTICE([VAAPI acceleration activated])
2338     ],[
2339       AS_IF([test -n "${enable_libva}"], [
2340         AC_MSG_ERROR([libva is present but libavcodec/vaapi.h is missing])
2341       ], [
2342         AC_MSG_WARN([libva is present but libavcodec/vaapi.h is missing ])
2343       ])
2344     ])
2345     VLC_RESTORE_FLAGS
2346   ],[
2347     AS_IF([test -n "${enable_libva}"], [
2348       AC_MSG_ERROR([${LIBVA_PKG_ERRORS}.])
2349     ], [
2350       AC_MSG_WARN([${LIBVA_PKG_ERRORS}.])
2351     ])
2352   ])
2353 ])
2354
2355 dnl
2356 dnl dxva2 needs avcodec
2357 dnl
2358 AC_ARG_ENABLE(dxva2,
2359   [  --enable-dxva2          DxVA2 GPU decoding support (default auto)])
2360
2361 AS_IF([test "${enable_dxva2}" != "no"], [
2362   if test "${SYS}" = "mingw32"; then
2363   AS_IF([test "x${have_avcodec}" = "xyes"], [
2364     AC_CHECK_HEADERS(dxva2api.h,
2365       [
2366         AC_CHECK_HEADERS(libavcodec/dxva2.h, [
2367            VLC_ADD_LIBS([avcodec],[-lole32 -lshlwapi -luuid])
2368            AC_DEFINE(HAVE_AVCODEC_DXVA2, 1, [Define if avcodec has to be built with DxVA2 support.])
2369            echo "DxVA2 acceleration activated"
2370         ],[
2371     AS_IF([test "${enable_dxva2}" = "yes"],
2372           [AC_MSG_ERROR([dxva2 is present but libavcodec/dxva2.h is missing])],
2373               [AC_MSG_WARN([dxva2 is present but libavcodec/dxva2.h is missing ])])
2374         ], [#undef _WIN32_WINNT
2375             /* DXVA2 is only available in Vista and above */
2376             #define _WIN32_WINNT 0x600])
2377       ],[
2378     AS_IF([test "${enable_dxva2}" = "yes"],
2379               [AC_MSG_ERROR([Could not find required dxva2api.h])],
2380               [AC_MSG_WARN([dxva2api.h not found])])
2381       ])
2382   ],[
2383     AS_IF([test "x${enable_dxva2}" != "x"], [
2384       AC_MSG_ERROR([--enable-dxva2 and --disable-avcodec options are mutually exclusive.])
2385     ])
2386   ])
2387   fi
2388 ])
2389
2390 dnl
2391 dnl vda needs avcodec
2392 dnl
2393 AC_ARG_ENABLE(vda,
2394   [  --enable-vda          VDA  support (default auto)])
2395
2396 AS_IF([test "${enable_vda}" != "no"], [
2397   if test "${SYS}" = "darwin"; then
2398   AS_IF([test "x${have_avcodec}" = "xyes"], [
2399     AC_CHECK_HEADERS(VideoDecodeAcceleration/VDADecoder.h,
2400       [
2401         AC_CHECK_HEADERS(libavcodec/vda.h, [
2402            VLC_ADD_LIBS([avcodec],[-Wl,-framework,CoreFoundation,-framework,VideoDecodeAcceleration,-framework,QuartzCore])
2403            VLC_ADD_LDFLAGS([vda],[-Wl,-framework,CoreFoundation,-framework,VideoDecodeAcceleration,-framework,QuartzCore])
2404            AC_DEFINE(HAVE_AVCODEC_VDA, 1, [Define if avcodec has to be built with VDA support.])
2405         ],[
2406         AS_IF([test "${enable_vda}" == "yes"],
2407               [AC_MSG_ERROR([vda is present but libavcodec/vda.h is missing])],
2408               [AC_MSG_WARN([vda is present but libavcodec/vda.h is missing ])])
2409         ])
2410   ],[
2411         AS_IF([test "${enable_vda}" == "yes"],
2412               [AC_MSG_ERROR([Could not find required VideoDecodeAcceleration/VDADecoder.h])],
2413               [AC_MSG_WARN([VideoDecodeAcceleration/VDADecoder.h not found])])
2414       ])
2415   ],[
2416     AS_IF([test "x${enable_vda}" != "x"], [
2417       AC_MSG_ERROR([--enable-vda and --disable-avcodec options are mutually exclusive.])
2418     ])
2419  ])
2420   fi
2421 ])
2422
2423 dnl
2424 dnl stream_out switcher needs libavcodec
2425 dnl
2426 AC_ARG_ENABLE(switcher,
2427   [  --enable-switcher       Stream-out switcher plugin (default disabled)])
2428 AS_IF([test "${enable_switcher}" = "yes"], [
2429   AS_IF([test "x${have_avcodec}" = "xyes"], [
2430     VLC_ADD_PLUGIN([stream_out_switcher])
2431     VLC_ADD_LIBS([stream_out_switcher],[$AVCODEC_LIBS $AVUTIL_LIBS $LIBM])
2432     VLC_ADD_CFLAGS([stream_out_switcher],[$AVCODEC_CFLAGS $AVUTIL_CFLAGS])
2433   ],[AC_MSG_ERROR([Stream_out switcher depends on avcodec])
2434   ])
2435 ])
2436
2437
2438 dnl
2439 dnl  avformat demuxer/muxer plugin
2440 dnl
2441
2442 AC_ARG_ENABLE(avformat,
2443 [  --enable-avformat       libavformat containers (default enabled)],, [
2444   enable_avformat="${have_avcodec}"
2445 ])
2446 if test "${enable_avformat}" != "no"
2447 then
2448   PKG_CHECK_MODULES(AVFORMAT,[libavformat > 52.30.0 libavcodec libavutil],
2449     [
2450       VLC_SAVE_FLAGS
2451       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"
2452       CFLAGS="${CFLAGS} ${AVFORMAT_CFLAGS}"
2453       AC_CHECK_HEADERS(libavformat/avformat.h libavformat/avio.h)
2454       AC_CHECK_HEADERS(libavutil/avutil.h)
2455       AS_IF([test "$enable_merge_ffmpeg" = "no"], [
2456         VLC_ADD_PLUGIN([avformat access_avio])
2457         VLC_ADD_LIBS([avformat access_avio],[$AVFORMAT_LIBS $AVUTIL_LIBS])
2458         VLC_ADD_CFLAGS([avformat access_avio],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
2459         AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2460           VLC_ADD_LIBS([avformat access_avio],[-Wl,-Bsymbolic])
2461         ])
2462       ], [
2463         VLC_ADD_LIBS([avcodec],[$AVFORMAT_LIBS $AVUTIL_LIBS])
2464         VLC_ADD_CFLAGS([avcodec],[$AVFORMAT_CFLAGS $AVUTIL_CFLAGS])
2465       ])
2466       VLC_RESTORE_FLAGS
2467     ],[
2468       AC_MSG_ERROR([${AVFORMAT_PKG_ERRORS}. Pass --disable-avformat to ignore this error.])
2469   ])
2470 fi
2471
2472 dnl
2473 dnl  swscale image scaling and conversion plugin
2474 dnl
2475
2476 AC_ARG_ENABLE(swscale,
2477   AS_HELP_STRING([--enable-swscale],[libswscale image scaling and conversion
2478           (default enabled)]))
2479 if test "${enable_swscale}" != "no"
2480 then
2481   PKG_CHECK_MODULES(SWSCALE,[libswscale],
2482     [
2483       VLC_SAVE_FLAGS
2484       CPPFLAGS="${CPPFLAGS} ${SWSCALE_CFLAGS}"
2485       CFLAGS="${CFLAGS} ${SWSCALE_CFLAGS}"
2486       AC_CHECK_HEADERS(libswscale/swscale.h)
2487       VLC_ADD_PLUGIN([swscale])
2488       VLC_ADD_LIBS([swscale],[$SWSCALE_LIBS])
2489       VLC_ADD_CFLAGS([swscale],[$SWSCALE_CFLAGS])
2490       AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2491         VLC_ADD_LIBS([swscale],[-Wl,-Bsymbolic])
2492       ])
2493       VLC_RESTORE_FLAGS
2494     ],[
2495       AC_MSG_ERROR([${SWSCALE_PKG_ERRORS}. Pass --disable-swscale to ignore this error. Proper software scaling and some video chroma conversion will be missing.])
2496   ])
2497 fi
2498
2499 dnl
2500 dnl  postproc plugin
2501 dnl
2502
2503 AC_ARG_ENABLE(postproc,
2504 [  --enable-postproc       libpostproc image post-processing (default enabled)])
2505 if test "${enable_postproc}" != "no"
2506 then
2507   PKG_CHECK_MODULES(POSTPROC,[libpostproc libavutil],
2508     [
2509       VLC_SAVE_FLAGS
2510       CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}"
2511       CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}"
2512       AC_CHECK_HEADERS(postproc/postprocess.h)
2513       VLC_ADD_PLUGIN([postproc])
2514       VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS])
2515       VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS])
2516       VLC_RESTORE_FLAGS
2517     ],[
2518       AC_MSG_ERROR([${POSTPROC_PKG_ERRORS}. Pass --disable-postproc to ignore this error.])
2519   ])
2520 fi
2521
2522 dnl
2523 dnl  faad decoder plugin
2524 dnl
2525 AC_ARG_ENABLE(faad,
2526 [  --enable-faad           faad codec (default auto)])
2527 if test "${enable_faad}" != "no"; then
2528   AC_ARG_WITH(faad-tree,  [  --with-faad-tree=PATH   faad tree for static linking])
2529   if test -n "${with_faad_tree}"; then
2530     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
2531     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
2532     if test -z "${real_faad_tree}"; then
2533       dnl  The given directory can't be found
2534       AC_MSG_RESULT(no)
2535       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
2536     fi
2537     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"; then
2538       dnl  Use the custom faad
2539       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
2540       VLC_ADD_PLUGIN([faad])
2541       VLC_ADD_LIBS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
2542       VLC_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
2543     else
2544       dnl  The given libfaad wasn't built
2545       AC_MSG_RESULT(no)
2546       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
2547     fi
2548   else
2549     VLC_SAVE_FLAGS
2550     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_faad}"
2551     LDFLAGS="${LDFLAGS} ${LIBS_faad}"
2552     AC_CHECK_HEADERS(faad.h,
2553       [ AC_CHECK_LIB(faad, faacDecOpen, [
2554           VLC_ADD_PLUGIN([faad])
2555           VLC_ADD_LIBS([faad],[-lfaad]) ], [
2556             AC_CHECK_LIB(faad, NeAACDecOpen, [
2557               VLC_ADD_PLUGIN([faad])
2558               VLC_ADD_LIBS([faad],[-lfaad]) ], [
2559                 AS_IF([test "${enable_faad}" = "yes"],
2560                 [ AC_MSG_ERROR([Cannot find libfaad library...]) ],
2561                 [ AC_MSG_WARN([Cannot find libfaad library...]) ]) ]) ])
2562       ] , [ AS_IF([test "${enable_faad}" = "yes"],
2563         [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ],
2564         [ AC_MSG_WARN([Cannot find development headers for libfaad...]) ]) ])
2565     VLC_RESTORE_FLAGS
2566   fi
2567 fi
2568
2569 dnl
2570 dnl twolame encoder plugin
2571 dnl
2572 PKG_ENABLE_MODULES_VLC([TWOLAME], [], [twolame], [MPEG Audio Layer 2 encoder], [auto], [], [], [ -DLIBTWOLAME_STATIC])
2573
2574 dnl
2575 dnl  QuickTime plugin
2576 dnl
2577 AC_ARG_ENABLE(quicktime,
2578   [  --enable-quicktime      QuickTime module (deprecated)])
2579 if test "${enable_quicktime}" = "yes"; then
2580   if test "${SYS}" = "mingw32"; then
2581     VLC_ADD_PLUGIN([quicktime])
2582   else
2583   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2584     [ VLC_ADD_PLUGIN([quicktime])
2585       VLC_ADD_LIBS([quicktime],[-Wl,-framework,QuickTime,-framework,Carbon])
2586     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2587   fi
2588 fi
2589
2590 dnl
2591 dnl A52/AC3 decoder plugin
2592 dnl
2593 AC_ARG_ENABLE(a52,
2594   [  --enable-a52            A/52 support with liba52 (default enabled)])
2595 if test "${enable_a52}" != "no"
2596 then
2597   AC_ARG_WITH(a52,
2598     [  --with-a52=PATH         a52 headers and libraries])
2599   AC_ARG_WITH(a52-tree,
2600     [  --with-a52-tree=PATH    a52dec tree for static linking ],[],[])
2601   if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
2602   then
2603     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
2604     if test -z "${real_a52_tree}"
2605     then
2606       dnl  The given directory can't be found
2607       AC_MSG_RESULT(no)
2608       AC_MSG_ERROR([${with_a52_tree} directory does not exist])
2609     fi
2610     dnl  Use a custom a52dec
2611     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
2612     if test -f ${real_a52_tree}/include/a52.h
2613     then
2614       AC_MSG_RESULT(yes)
2615       VLC_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
2616       VLC_ADD_LIBS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
2617       VLC_SAVE_FLAGS
2618       LDFLAGS="${LDFLAGS} ${LIBS_a52tofloat32}"
2619       AC_CHECK_LIB(a52, a52_free, [
2620         VLC_ADD_PLUGIN([a52tofloat32])
2621         VLC_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
2622         VLC_ADD_LIBS([a52tofloat32],[-la52])
2623         ],[
2624         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
2625         then
2626           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3 ($real_a52_tree)])
2627         else
2628           AC_MSG_ERROR([the specified tree has not been compiled])
2629         fi
2630       ])
2631     else
2632       AC_MSG_RESULT(no)
2633       AC_MSG_ERROR([the specified tree does not have a52.h])
2634     fi
2635   else
2636     if test -z "${with_a52}"
2637     then
2638       LDFLAGS_test=""
2639       CPPFLAGS_test=""
2640     else
2641       LDFLAGS_test="-L${with_a52}/lib"
2642       CPPFLAGS_test="-I${with_a52}/include"
2643     fi
2644     VLC_SAVE_FLAGS
2645     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2646     LDFLAGS="${LDFLAGS} ${LDFLAGS_test} ${LIBS_a52tofloat32}"
2647     AC_CHECK_HEADERS(a52dec/a52.h, [
2648       AC_CHECK_LIB(a52, a52_free, [
2649         VLC_ADD_PLUGIN([a52tofloat32])
2650         VLC_ADD_LIBS([a52tofloat32],[${LDFLAGS_test} -la52])
2651         VLC_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2652       ],[
2653         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.])
2654         ], [$LIBM])
2655     ],[
2656       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.])
2657     ])
2658     VLC_RESTORE_FLAGS
2659   fi
2660 fi
2661
2662 AC_ARG_WITH(a52-fixed,
2663       [  --with-a52-fixed        specify if liba52 has been compiled with fixed point support],
2664       [
2665         VLC_ADD_CPPFLAGS([a52tofloat32],[-DLIBA52_FIXED]) ])
2666
2667 dnl
2668 dnl DTS Coherent Acoustics decoder plugin
2669 dnl
2670 PKG_ENABLE_MODULES_VLC([DCA], [dtstofloat32], [libdca >= 0.0.5], [DTS Coherent Acoustics support with libdca], [auto])
2671
2672 dnl
2673 dnl  Flac plugin
2674 dnl
2675 PKG_ENABLE_MODULES_VLC([FLAC], [], [flac], [libflac decoder/encoder support], [auto])
2676
2677 dnl
2678 dnl  Libmpeg2 plugin
2679 dnl
2680 PKG_ENABLE_MODULES_VLC([LIBMPEG2], [], [libmpeg2 > 0.3.2], [libmpeg2 decoder support], [auto])
2681
2682 dnl
2683 dnl  Vorbis plugin
2684 dnl
2685 PKG_ENABLE_MODULES_VLC([VORBIS], [], [ogg vorbis >= 1.1 vorbisenc >= 1.1], [Vorbis decoder and encoder], [auto])
2686
2687 dnl
2688 dnl  Tremor plugin
2689 dnl
2690 AC_ARG_ENABLE(tremor,
2691   [  --enable-tremor         Tremor decoder support (default disabled)])
2692 if test "${enable_tremor}" = "yes"
2693 then
2694   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2695     VLC_ADD_PLUGIN([tremor])
2696     VLC_ADD_LIBS([tremor],[-lvorbisidec -logg])
2697    ],[])
2698 fi
2699
2700 dnl
2701 dnl  Speex plugins
2702 dnl
2703 PKG_ENABLE_MODULES_VLC([SPEEX], [], [ogg speex >= 1.0.5], [Speex support], [auto])
2704 have_speexdsp="no"
2705 AS_IF([test "${enable_speex}" != "no"], [
2706   PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], [
2707     have_speexdsp="yes"
2708   ], [
2709     AC_MSG_WARN([${SPEEXDSP_PKG_ERRORS}.])
2710   ])
2711 ])
2712 AM_CONDITIONAL([HAVE_SPEEXDSP], [test "$have_speexdsp" = "yes"])
2713
2714 dnl
2715 dnl  Opus plugin
2716 dnl
2717 PKG_ENABLE_MODULES_VLC([OPUS], [], [ogg opus], [Opus support], [auto])
2718
2719 dnl
2720 dnl  theora decoder plugin
2721 dnl
2722 PKG_ENABLE_MODULES_VLC([THEORA], [], [ogg theoradec >= 1.0 theoraenc], [experimental theora codec], [auto])
2723
2724 dnl
2725 dnl  dirac encoder plugin
2726 dnl
2727 PKG_ENABLE_MODULES_VLC([DIRAC], [], [dirac >= 0.10.0], [dirac encoder], [auto])
2728
2729 dnl
2730 dnl  schroedinger decoder plugin (for dirac format video)
2731 dnl
2732 PKG_ENABLE_MODULES_VLC([SCHROEDINGER], [], [schroedinger-1.0 >= 1.0.10], [dirac decoder and encoder using schroedinger], [auto])
2733
2734 dnl
2735 dnl  PNG decoder module
2736 dnl
2737 AC_ARG_ENABLE(png,
2738   [  --enable-png            PNG support (default enabled)])
2739 if test "${enable_png}" != "no"; then
2740 AC_CHECK_HEADERS(png.h, [
2741   VLC_SAVE_FLAGS
2742   LDFLAGS="${LDFLAGS} -lz $LIBM"
2743   AC_CHECK_LIB(png, png_set_rows, [
2744     VLC_ADD_LIBS([png],[-lpng -lz $LIBM])
2745     VLC_ADD_PLUGIN([png osdmenu osd_parser])],
2746     [],[-lz $LIBM] )
2747   VLC_RESTORE_FLAGS
2748   ])
2749 fi
2750 AM_CONDITIONAL(BUILD_OSDMENU, [test "${enable_png}" != "no"])
2751
2752 dnl
2753 dnl H264 encoder plugin (10-bit lib264)
2754 dnl
2755 AC_ARG_ENABLE(x26410b,
2756   [  --enable-x26410b           H264 10-bit encoding support with static libx264 (default disabled)])
2757 if test "${enable_x26410b}" != "no"; then
2758 AC_ARG_WITH(x26410b-tree,
2759   [ --with-x26410b-tree=PATH      H264 10-bit encoding module with libx264 (static linking)],[],[])
2760   if test "${with_x26410b_tree}" != "no" -a -n "${with_x26410b_tree}"
2761   then
2762     real_x26410b_tree="̧`cd ${with_x26410b_tree} 2>/dev/null && pwd`"
2763     if test -z "${real_x26410b_tree}"
2764     then
2765       AC_MSG_RESULT(no)
2766       AC_MSG_ERROR([${with_x26410b_tree} directory does not exist])
2767     fi
2768     AC_MSG_CHECKING(for x264.h in ${real_x26410b_tree})
2769     if test -f ${with_x26410b_tree}/x264_config.h
2770     then
2771       AC_MSG_RESULT(yes)
2772       AC_MSG_CHECKING(for 10-bit build of x264)
2773       if grep -q "BIT_DEPTH.*10"  ${with_x26410b_tree}/x264_config.h ;then
2774         AC_MSG_RESULT(yes)
2775         VLC_ADD_PLUGIN([x26410b])
2776         VLC_ADD_CFLAGS([x26410b],[-I${with_x26410b_tree}])
2777         VLC_ADD_LIBS([x26410b],[-L${with_x26410b_tree} -lm -lpthread -lx264])
2778       else
2779         AC_MSG_RESULT(no)
2780         AC_MSG_ERROR([${with_x26410b_tree} isnt build 10-bit])
2781       fi
2782     else
2783       AC_MSG_RESULT(no)
2784       AC_MSG_ERROR([${with_x26410b_tree} doesnt have x264_config.h])
2785     fi
2786   else
2787     PKG_CHECK_MODULES(X26410B, x26410b, [
2788         VLC_ADD_PLUGIN([x26410b])
2789         VLC_ADD_LDFLAGS([x26410b],[${X26410B_LIBS}])
2790         AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2791           VLC_ADD_LIBS([x26410b],[-Wl,-Bsymbolic])
2792         ])
2793         VLC_ADD_CFLAGS([x26410b],[${X26410B_CFLAGS}])
2794         if echo ${X26410B_LIBS} |grep -q 'pthreadGC2'; then
2795           VLC_ADD_CFLAGS([x26410b], [-DPTW32_STATIC_LIB])
2796         fi
2797     ], [
2798        if test "${enable_x26410b}" = "yes"; then
2799         AC_MSG_ERROR([x26410b module doesn't work without staticly compiled libx264.a])
2800        fi
2801     ])
2802   fi
2803 fi
2804
2805
2806 dnl
2807 dnl H264 encoder plugin (using libx264)
2808 dnl
2809 AC_ARG_ENABLE(x264,
2810   [  --enable-x264           H264 encoding support with libx264 (default enabled)])
2811 if test "${enable_x264}" != "no"; then
2812   AC_ARG_WITH(x264-tree,
2813     [  --with-x264-tree=PATH   x264 tree for static linking ],[],[])
2814   if test "${with_x264_tree}" != "no" -a -n "${with_x264_tree}"
2815   then
2816     real_x264_tree="`cd ${with_x264_tree} 2>/dev/null && pwd`"
2817     if test -z "${real_x264_tree}"
2818     then
2819       dnl  The given directory can't be found
2820       AC_MSG_RESULT(no)
2821       AC_MSG_ERROR([${with_x264_tree} directory does not exist])
2822     fi
2823     dnl  Use a custom libx264
2824     AC_MSG_CHECKING(for x264.h in ${real_x264_tree})
2825     if test -f ${real_x264_tree}/x264.h
2826     then
2827       AC_MSG_RESULT(yes)
2828       VLC_ADD_CPPFLAGS([x264],[-I${real_x264_tree}])
2829       VLC_ADD_LIBS([x264],[-L${real_x264_tree}])
2830       PKG_CHECK_MODULES(X264,x264, [
2831         VLC_ADD_PLUGIN([x264])
2832         VLC_ADD_LIBS([x264],[${X264_LIBS}])
2833         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2834         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2835           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2836         fi
2837       ],[
2838         AC_MSG_ERROR([the specified tree has not been compiled])
2839       ])
2840     else
2841       AC_MSG_RESULT(no)
2842       AC_MSG_ERROR([the specified tree does not have x264.h])
2843     fi
2844   else
2845       PKG_CHECK_MODULES(X264,x264 >= 0.86, [
2846         VLC_ADD_PLUGIN([x264])
2847         VLC_ADD_LDFLAGS([x264],[${X264_LIBS}])
2848
2849         AS_IF([test "${ac_cv_ld_bsymbolic}" != "no"], [
2850           VLC_ADD_LIBS([x264],[-Wl,-Bsymbolic])
2851         ])
2852
2853         VLC_ADD_CFLAGS([x264],[${X264_CFLAGS}])
2854         if echo ${X264_LIBS} |grep -q 'pthreadGC2'; then
2855           VLC_ADD_CFLAGS([x264], [-DPTW32_STATIC_LIB])
2856         fi
2857       ],[
2858         if test "${enable_x264}" = "yes"; then
2859             AC_MSG_ERROR([${X264_PKG_ERRORS}: you may get it from http://www.videolan.org/x264.html])
2860           fi
2861       ])
2862   fi
2863 fi
2864
2865 dnl
2866 dnl libfluidsynth (MIDI synthetizer) plugin
2867 dnl
2868 PKG_ENABLE_MODULES_VLC([FLUIDSYNTH], [], [fluidsynth >= 1.1.2], [MIDI synthetiser with libfluidsynth], [auto])
2869
2870 dnl
2871 dnl Teletext Modules
2872 dnl vbi decoder plugin (using libzbvi)
2873 dnl telx module
2874 dnl uncompatible
2875 dnl
2876 AC_ARG_ENABLE(zvbi,
2877   AS_HELP_STRING([--enable-zvbi],[VBI (inc. Teletext) decoding support with
2878                   libzvbi (default enabled)]))
2879 AC_ARG_ENABLE(telx,
2880   AS_HELP_STRING([--enable-telx],[Teletext decoding module (conflicting with
2881                   zvbi) (default enabled if zvbi is absent)]))
2882
2883 AS_IF( [test "${enable_zvbi}" != "no"],[
2884     PKG_CHECK_MODULES(ZVBI, [zvbi-0.2 >= 0.2.28],
2885         [
2886           VLC_ADD_LIBS([zvbi],[$ZVBI_LIBS])
2887           if test "${SYS}" = "mingw32"; then
2888               VLC_ADD_LIBS([zvbi],[ -lpthreadGC2])
2889           fi
2890           VLC_ADD_CFLAGS([zvbi],[$ZVBI_CFLAGS])
2891           VLC_ADD_PLUGIN([zvbi])
2892           AC_DEFINE(ZVBI_COMPILED, 1, [Define if the zvbi module is built])
2893           AS_IF( [test "${enable_telx}" = "yes"],[
2894                   AC_MSG_WARN([The zvbi and telx modules are incompatible. Using zvbi.])
2895                   ])
2896         ],[
2897           AC_MSG_WARN([${ZVBI_PKG_ERRORS}. Enabling the telx module instead.])
2898         ])
2899     ])
2900 AS_IF( [test "${enable_telx}" != "no" ],[
2901   VLC_ADD_PLUGIN([telx])
2902   ])
2903
2904 dnl
2905 dnl libass subtitle rendering module
2906 dnl
2907 AC_ARG_ENABLE(libass,
2908   [  --enable-libass         Subtitle support using libass (default enabled)])
2909 AS_IF( [test "${enable_libass}" != "no"], [
2910   PKG_CHECK_MODULES(LIBASS, [libass >= 0.9.8],
2911       [
2912         VLC_ADD_LIBS([libass],[$LIBASS_LIBS])
2913         VLC_ADD_CFLAGS([libass],[$LIBASS_CFLAGS])
2914         VLC_ADD_PLUGIN([libass])
2915
2916         AC_CHECK_HEADERS(fontconfig/fontconfig.h,
2917           [VLC_ADD_CPPFLAGS([libass],[-DHAVE_FONTCONFIG])
2918            VLC_ADD_LIBS([libass],[-lfontconfig])
2919        ])
2920       ],[
2921         AC_MSG_WARN([${LIBASS_PKG_ERRORS}.])
2922       ])
2923   ])
2924
2925 dnl
2926 dnl  kate decoder plugin
2927 dnl
2928 PKG_ENABLE_MODULES_VLC([KATE], [], [kate >= 0.3.0], [kate codec], [auto])
2929
2930 dnl
2931 dnl  tiger rendering for kate decoder plugin
2932 dnl
2933 AC_ARG_ENABLE(tiger,
2934 [  --enable-tiger          Tiger rendering library for Kate streams (default auto)])
2935 AS_IF([test "${enable_tiger}" != "no"], [
2936   PKG_CHECK_MODULES(TIGER,[tiger >= 0.3.1], [
2937       AC_DEFINE(HAVE_TIGER, 1, [Define if libtiger is available.])
2938       VLC_ADD_CFLAGS([kate],[$TIGER_CFLAGS])
2939       VLC_ADD_LIBS([kate],[$TIGER_LIBS]) ],[
2940         AS_IF([test -n "${enable_tiger}"], [
2941           AC_MSG_ERROR([${TIGER_PKG_ERRORS}.])
2942         ])
2943   ])
2944 ])
2945
2946
2947 dnl
2948 dnl  Video plugins
2949 dnl
2950
2951 EXTEND_HELP_STRING([Video plugins:])
2952
2953 dnl
2954 dnl  OpenGL
2955 dnl
2956 PKG_CHECK_MODULES([GL], [gl], [
2957   have_gl="yes"
2958 ], [
2959   AC_CHECK_HEADER([GL/gl.h], [
2960     have_gl="yes"
2961     GL_CFLAGS=""
2962     GL_LIBS="-lGL"
2963   ], [
2964     have_gl="no"
2965   ])
2966 ])
2967
2968 dnl OpenGL ES 2: depends on EGL 1.1 and is currently unfinished
2969 dnl PKG_ENABLE_MODULES_VLC([GLES2], [], [glesv2], [OpenGL ES v2 support], [auto])
2970 dnl OpenGL ES 1: depends on EGL 1.0 and is currently broken
2971 dnl PKG_ENABLE_MODULES_VLC([GLES1], [], [glesv1_cm], [OpenGL ES v1 support], [auto])
2972
2973 AC_ARG_ENABLE(egl,
2974   [  --enable-egl            OpenGL support through EGL (default disabled)],, [
2975   enable_egl="no"
2976 ])
2977 AS_IF([test "$enable_egl" != "no"], [
2978   PKG_CHECK_MODULES([EGL], [egl], [
2979     VLC_ADD_PLUGIN([gl])
2980     VLC_ADD_PLUGIN([egl])
2981   ])
2982 ])
2983
2984 dnl
2985 dnl  Xlib
2986 dnl
2987
2988 AC_PATH_XTRA()
2989 AC_CHECK_HEADERS(X11/Xlib.h)
2990
2991 dnl
2992 dnl  X C Bindings modules
2993 dnl
2994 AC_ARG_ENABLE(xcb,
2995   [  --enable-xcb            X11 support with XCB (default enabled)],, [
2996   AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [
2997     enable_xcb="yes"
2998   ], [
2999     enable_xcb="no"
3000   ])
3001 ])
3002 AC_ARG_ENABLE(xvideo,
3003   [  --enable-xvideo         XVideo support (default enabled)],, [
3004     enable_xvideo="$enable_xcb"
3005 ])
3006 AC_ARG_ENABLE(glx,
3007   [  --enable-glx            OpenGL support through GLX (default enabled)],, [
3008   enable_glx="$enable_xcb"
3009 ])
3010
3011 have_xcb="no"
3012 AS_IF([test "${enable_xcb}" != "no"], [
3013   dnl libxcb
3014   PKG_CHECK_MODULES(XCB, [xcb >= 1.6])
3015   have_xcb="yes"
3016   PKG_CHECK_MODULES(XCB_SHM, [xcb-shm])
3017   PKG_CHECK_MODULES(XCB_COMPOSITE, [xcb-composite])
3018
3019   AS_IF([test "${enable_xvideo}" != "no"], [
3020     PKG_CHECK_MODULES(XCB_XV, [xcb-xv >= 1.1.90.1], [
3021       VLC_ADD_PLUGIN([xcb_xv])
3022     ])
3023   ])
3024
3025   PKG_CHECK_MODULES(XCB_RANDR, [xcb-randr >= 1.3], [
3026     VLC_ADD_PLUGIN([panoramix])
3027     VLC_ADD_LIBS([panoramix],[${XCB_RANDR_LIBS} ${XCB_LIBS}])
3028     VLC_ADD_CFLAGS([panoramix],[${XCB_RANDR_CFLAGS} ${XCB_CFLAGS}])
3029   ], [
3030     AC_MSG_WARN([${XCB_RANDR_PKG_ERRORS}. Panoramix filter will not be supported.])
3031   ])
3032
3033   dnl xcb-utils
3034   PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [
3035     PKG_CHECK_MODULES(XPROTO, [xproto])
3036     VLC_ADD_PLUGIN([globalhotkeys])
3037     VLC_ADD_CFLAGS([globalhotkeys], [${XCB_KEYSYMS_CFLAGS} ${XCB_CFLAGS}])
3038     VLC_ADD_LIBS([globalhotkeys], [${XCB_KEYSYMS_LIBS} ${XCB_LIBS}])
3039     VLC_ADD_CFLAGS([xcb_window], [-DHAVE_XCB_KEYSYMS])
3040   ], [
3041     AC_MSG_WARN([${XCB_KEYSYMS_PKG_ERRORS}. Hotkeys will not work.])
3042   ])
3043
3044   AS_IF([test "${enable_glx}" != "no"], [
3045     AS_IF([test "${have_gl}" != "yes"], [
3046       AC_MSG_ERROR([${GL_PKG_ERRORS}. Pass --disable-glx if you do not need OpenGL X11 support.])
3047     ])
3048     VLC_ADD_PLUGIN([xcb_glx])
3049   ])
3050 ])
3051 AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
3052
3053 dnl
3054 dnl  SDL module
3055 dnl
3056 AC_ARG_ENABLE(sdl,
3057   [  --enable-sdl            SDL support (default enabled)])
3058 AC_ARG_ENABLE(sdl-image,
3059   [  --enable-sdl-image      SDL image support (default enabled)])
3060 if test "${enable_sdl}" != "no"
3061 then
3062    PKG_CHECK_MODULES(SDL, [sdl >= 1.2.10], [
3063       # SDL on Darwin is heavily patched and can only run SDL_image
3064       if test "${SYS}" != "darwin"; then
3065         VLC_ADD_PLUGIN([vout_sdl])
3066       fi
3067       if test "${SYS}" != "mingw32" -a "${SYS}" != "os2"; then
3068         VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3069       fi
3070       VLC_ADD_CFLAGS([vout_sdl],[${SDL_CFLAGS}])
3071       VLC_ADD_LIBS([vout_sdl],[${SDL_LIBS}])
3072
3073       # SDL_image
3074       AS_IF([ test "${enable_sdl_image}" != "no"],[
3075         PKG_CHECK_MODULES(SDL_IMAGE, [SDL_image >= 1.2.10], [
3076           VLC_ADD_PLUGIN([sdl_image])
3077           VLC_ADD_LIBS([sdl_image],[${SDL_IMAGE_LIBS}])
3078           VLC_ADD_CFLAGS([sdl_image], [${SDL_IMAGE_CFLAGS}])],
3079           [ AC_MSG_WARN([${SDL_IMAGE_PKG_ERRORS}. You should install it alongside your SDL package.])
3080           ])
3081       ])
3082    ],[
3083      AC_MSG_WARN([${SDL_PKG_ERRORS}.])
3084    ])
3085 fi
3086
3087
3088 dnl
3089 dnl Mac Vout
3090 AC_ARG_ENABLE(macosx-vout,
3091   [  --enable-macosx-vout    Mac OS X video output module (default enabled on Mac OS X)])
3092 if test "x${enable_macosx_vout}" != "xno" &&
3093   (test "${SYS}" = "darwin" || test "${enable_macosx_vout}" = "yes")
3094 then
3095   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,Cocoa])
3096   VLC_ADD_LIBS([vout_macosx],[-Wl,-framework,OpenGL])
3097   VLC_ADD_PLUGIN([vout_macosx])
3098 fi
3099
3100
3101 dnl
3102 dnl  freetype module
3103 dnl
3104 AC_ARG_ENABLE(freetype,
3105   [  --enable-freetype       freetype support   (default auto)])
3106 AC_ARG_ENABLE(fribidi,
3107   [  --enable-fribidi        fribidi support    (default auto)])
3108 AC_ARG_ENABLE(fontconfig,
3109   [  --enable-fontconfig     fontconfig support (default auto)])
3110
3111 if test "${enable_freetype}" != "no"; then
3112    PKG_CHECK_MODULES(FREETYPE, freetype2, [
3113       have_freetype=yes
3114       VLC_ADD_PLUGIN([freetype])
3115       VLC_ADD_CPPFLAGS([freetype skins2],[${FREETYPE_CFLAGS}])
3116       if test "${SYS}" = "mingw32"; then
3117         VLC_ADD_LIBS([freetype],[-liconv -lz])
3118       fi
3119       VLC_ADD_LIBS([freetype skins2],[${FREETYPE_LIBS}])
3120
3121       AC_CHECK_HEADERS(Carbon/Carbon.h,
3122                        [VLC_ADD_LIBS([freetype],[-Wl,-framework,Carbon])])
3123
3124       dnl fontconfig support
3125       if test "${SYS}" != "mingw32"; then
3126           if test "${enable_fontconfig}" != "no"; then
3127             AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
3128               VLC_ADD_CPPFLAGS([freetype],[-DHAVE_FONTCONFIG])
3129               VLC_ADD_LIBS([freetype],[-lfontconfig])
3130             ],[AC_MSG_WARN([library fontconfig not found. Styles will be disabled in freetype])])
3131           fi
3132       else
3133           VLC_ADD_LIBS([freetype],[-lgdi32])
3134       fi
3135
3136       dnl fribidi support
3137       if test "${enable_fribidi}" != "no"; then
3138         PKG_CHECK_MODULES(FRIBIDI, fribidi, [
3139           VLC_ADD_CPPFLAGS([freetype skins2], [${FRIBIDI_CFLAGS} -DHAVE_FRIBIDI])
3140           VLC_ADD_LIBS([freetype skins2], [${FRIBIDI_LIBS}])
3141         ],[AC_MSG_WARN([${FRIBIDI_PKG_ERRORS}. Bidirectional support will be disabled in FreeType.])])
3142       fi
3143
3144   ],[
3145   have_freetype=no
3146   AS_IF([test -n "${enable_freetype}"],[
3147     AC_MSG_ERROR([${FREETYPE_PKG_ERRORS}. Install FreeType2 development or configure with --disable-freetype.])
3148     ])
3149   ])
3150 fi
3151
3152
3153 dnl
3154 dnl  QuartzText vout module (iOS/Mac OS)
3155 dnl
3156 AC_ARG_ENABLE(macosx-quartztext,
3157   [  --enable-macosx-quartztext   Mac OS X quartz text module (default enabled on Mac OS X)])
3158 if test "x${enable_macosx_quartztext}" != "xno" &&
3159   (test "${SYS}" = "darwin" || test "${enable_macosx_quartztext}" = "yes")
3160 then
3161   VLC_ADD_PLUGIN([quartztext])
3162   VLC_ADD_LIBS([quartztext],[-Wl,-framework,ApplicationServices])
3163 fi
3164
3165 dnl
3166 dnl  SVG module
3167 dnl
3168 PKG_ENABLE_MODULES_VLC([SVG], [], [librsvg-2.0 >= 2.9.0], [SVG rendering library],[auto])
3169
3170 dnl
3171 dnl  android surface module
3172 dnl
3173 AC_ARG_ENABLE(android-surface,
3174   [  --enable-android-surface   Android Surface video output module (default disabled)])
3175 if test "${enable_android_surface}" = "yes"; then
3176   if test "${HAVE_ANDROID}" = "1"; then
3177      VLC_ADD_PLUGIN([android_surface])
3178      VLC_ADD_LDFLAGS([android_surface], [-ldl])
3179   fi
3180 fi
3181
3182
3183 dnl
3184 dnl  iOS vout module
3185 dnl
3186 AC_ARG_ENABLE(ios-vout,
3187   [  --enable-ios-vout    iOS video output module (default disabled)])
3188 if test "${enable_ios_vout}" = "yes"
3189 then
3190   VLC_ADD_PLUGIN([vout_ios])
3191   VLC_ADD_CFLAGS([vout_ios], [-DUSE_OPENGL_ES=1])
3192   VLC_ADD_LIBS([vout_ios], [-Wl,-framework,OpenGLES,-framework,QuartzCore,-framework,UIKit,-framework,Foundation])
3193 fi
3194
3195 dnl
3196 dnl  Windows DirectX module
3197 dnl
3198
3199 if test "${SYS}" = "mingw32"
3200 then
3201   VLC_ADD_PLUGIN([panoramix])
3202 fi
3203
3204 AC_ARG_ENABLE(directx,
3205   [AS_HELP_STRING([--enable-directx],
3206     [Microsoft DirectX support (default enabled on Windows)])],, [
3207   AS_IF([test "${SYS}" = "mingw32"], [
3208     enable_directx="yes"
3209   ], [
3210     enable_directx="no"
3211   ])
3212 ])
3213 have_directx="no"
3214 AS_IF([test "${enable_directx}" != "no"], [
3215   dnl DirectDraw
3216   AC_CHECK_HEADERS(ddraw.h, [
3217     have_directx="yes"
3218   ], [
3219     AC_MSG_ERROR([Cannot find DirectX headers!])
3220   ])
3221
3222   dnl OpenGL
3223   AC_CHECK_HEADERS(GL/wglew.h, [
3224     VLC_ADD_PLUGIN([glwin32])
3225     VLC_ADD_LIBS([glwin32],[-lopengl32 -lgdi32])
3226    ],, [
3227      #include <windows.h>
3228      #include <GL/gl.h>
3229    ])
3230
3231    dnl Direct3D
3232    AC_CHECK_HEADERS(d3d9.h, [
3233      VLC_ADD_PLUGIN([direct3d])
3234      VLC_ADD_LIBS([direct3d],[-lgdi32])
3235    ])
3236    VLC_ADD_LIBS([direct3d glwin32],[-lole32 -luuid])
3237 ])
3238 AM_CONDITIONAL([HAVE_DIRECTX], [test "$have_directx" = "yes"])
3239
3240 dnl
3241 dnl  Windows Direct2D plugin
3242 dnl
3243 AC_ARG_ENABLE(direct2d,
3244   [  --enable-direct2d       Win7/VistaPU Direct2D support (default auto on Win32)],, [
3245   AS_IF([test "${SYS}" != "mingw32"], [
3246     enable_direct2d="no"
3247   ])
3248 ])
3249 AS_IF([test "${enable_direct2d}" != "no"], [
3250   AC_CHECK_HEADERS(d2d1.h, [
3251     VLC_ADD_PLUGIN([direct2d])
3252     VLC_ADD_LIBS([direct2d],[-lgdi32 -lole32 -luuid])
3253   ], [
3254     AC_MSG_WARN([Cannot find Direct2D headers!])
3255   ])
3256 ])
3257
3258 dnl
3259 dnl  win32 GDI plugin
3260 dnl
3261 AC_ARG_ENABLE(wingdi,
3262   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
3263 if test "${enable_wingdi}" != "no"; then
3264   if test "${SYS}" = "mingw32"; then
3265     VLC_ADD_PLUGIN([wingdi])
3266     VLC_ADD_LIBS([wingdi],[-lgdi32 -lole32 -luuid])
3267   fi
3268 fi
3269
3270
3271 dnl
3272 dnl  Linux framebuffer module
3273 dnl
3274 AC_CHECK_HEADER([linux/fb.h], [
3275   VLC_ADD_PLUGIN([fb])
3276 ])
3277
3278
3279 dnl
3280 dnl  DirectFB module
3281 dnl  try to find using: 1 - given location; 2 - directfb-config; 3 - pkg-config
3282 dnl  TODO: support for static linking
3283 dnl
3284 AC_ARG_ENABLE(directfb,
3285   [  --enable-directfb       DirectFB support (default disabled)])
3286 AC_ARG_WITH(directfb,
3287   [  --with-directfb=PATH    path to DirectFB headers and libraries])
3288
3289 if test "${enable_directfb}" = "yes"; then
3290     have_directfb="false"
3291     CPPFLAGS_mydirectfb=
3292     LIBS_mydirectfb=
3293     if test "${with_directfb}" != "no" -a -n "${with_directfb}"; then
3294         dnl Trying the given location
3295         VLC_SAVE_FLAGS
3296
3297         CPPFLAGS_new="-I${with_directfb}/include -D_REENTRANT -D_GNU_SOURCE"
3298         LIBS_new="-L${with_directfb}/lib/fusion/.libs/ -L${with_directfb}/lib/direct/.libs/ -L${with_directfb}/src/.libs/"
3299
3300         CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_new}"
3301         LIBS="${LIBS} ${LIBS_new}"
3302
3303         dnl FIXME: too obscure
3304         AC_CHECK_HEADER([directfb.h], [
3305             AC_CHECK_LIB([direct],[direct_initialize], [
3306                 AC_CHECK_LIB([fusion], [fusion_enter], [
3307                     AC_CHECK_LIB([directfb], [DirectFBInit], have_directfb="true", have_directfb="false")
3308                 ], have_directfb="false")
3309             ], have_directfb="false")
3310         ], have_directfb="false")
3311
3312         VLC_RESTORE_FLAGS
3313
3314         if test "${have_directfb}" = "true"; then
3315             LIBS_mydirectfb="${LIBS_new} -lz $LIBDL -ldirectfb -lfusion -ldirect -lpthread"
3316             CPPFLAGS_mydirectfb="${CPPFLAGS_new}"
3317         fi
3318     else
3319         dnl Look for directfb-config
3320         AC_PATH_PROG(DIRECTFB_CONFIG, directfb-config, no, ${PATH})
3321         if test "${DIRECTFB_CONFIG}" != "no"; then
3322             CPPFLAGS_mydirectfb="`${DIRECTFB_CONFIG} --cflags`"
3323             LIBS_mydirectfb="`${DIRECTFB_CONFIG} --libs`"
3324             have_directfb="true"
3325         else
3326             dnl Trying with pkg-config
3327             PKG_CHECK_MODULES(DIRECTFB, directfb, [
3328                 CPPFLAGS_mydirectfb="${DIRECTFB_CFLAGS}"
3329                 LIBS_mydirectfb="${DIRECTFB_LIBS}"
3330                 have_directfb="true"
3331                 ], [have_directfb="false"])
3332         fi
3333     fi
3334     if test "${have_directfb}" = "true"; then
3335         VLC_ADD_PLUGIN([directfb])
3336         VLC_ADD_CPPFLAGS([directfb],[${CPPFLAGS_mydirectfb}])
3337         VLC_ADD_LIBS([directfb],[${LIBS_mydirectfb}])
3338     else
3339         AC_MSG_ERROR([${DIRECTFB_PKG_ERRORS}.])
3340     fi
3341 fi
3342
3343 dnl
3344 dnl  AA plugin
3345 dnl
3346 AC_ARG_ENABLE(aa,
3347   [  --enable-aa             aalib output (default disabled)])
3348 if test "${enable_aa}" = "yes"
3349 then
3350   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
3351   if test "${have_aa}" = "true"
3352   then
3353     VLC_ADD_PLUGIN([aa])
3354     VLC_ADD_LIBS([aa],[-laa])
3355     if test "${SYS}" != "mingw32"; then
3356       VLC_ADD_LIBS([aa],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3357     fi
3358   fi
3359 fi
3360
3361 dnl
3362 dnl  libcaca plugin
3363 dnl
3364 PKG_ENABLE_MODULES_VLC([CACA], [], [caca >= 0.99.beta14], [libcaca output],[auto])
3365
3366 dnl
3367 dnl  OS/2 KVA plugin
3368 dnl
3369 AC_ARG_ENABLE(kva,
3370   [AS_HELP_STRING([--enable-kva],
3371     [support the K Video Accelerator KVA (default enabled on OS/2)])],, [
3372   AS_IF([test "$SYS" = "os2"], [
3373     enable_kva="yes"
3374   ])
3375 ])
3376 have_kva="no"
3377 KVA_LIBS=""
3378 AS_IF([test "$enable_kva" != "no"], [
3379   AC_CHECK_HEADERS([kva.h], [
3380     have_kva="yes"
3381     AC_CHECK_LIB(kva, main, [
3382       KVA_LIBS="-lkva"
3383     ])
3384   ])
3385 ])
3386 AC_SUBST(KVA_LIBS)
3387 AM_CONDITIONAL([HAVE_KVA], [test "${have_kva}" = "yes"])
3388
3389 dnl
3390 dnl  Audio plugins
3391 dnl
3392
3393 EXTEND_HELP_STRING([Audio plugins:])
3394
3395 dnl
3396 dnl  Pulseaudio module
3397 dnl
3398 AC_ARG_ENABLE(pulse,
3399   [AS_HELP_STRING([--enable-pulse],
3400     [use the PulseAudio client library (default auto)])])
3401 have_pulse="no"
3402 AS_IF([test "${enable_pulse}" != "no"], [
3403   PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.22], [
3404     have_pulse="yes"
3405   ], [
3406     PKG_CHECK_MODULES([PULSE], [libpulse >= 0.9.16], [
3407       AS_IF([test "${no_x}" != "yes"], [
3408         have_pulse="yes"
3409         PULSE_LIBS="$PULSE_LIBS ${X_LIBS} ${X_PRE_LIBS} -lX11"
3410       ], [
3411         AS_IF([test "${enable_pulse}" = "yes"], [
3412           AC_MSG_ERROR([Xlib is required with PulseAudio pre-0.9.22 versions
3413 (see http://www.pulseaudio.org/ticket/799 for further reference).])
3414         ])
3415       ])
3416     ], [
3417       AS_IF([test "x${enable_pulse}" != "x"], [
3418         AC_MSG_ERROR([$PULSE_PKG_ERRORS. PulseAudio 0.9.22 or later required.])
3419       ])
3420     ])
3421   ])
3422 ])
3423 AM_CONDITIONAL([HAVE_PULSE], [test "${have_pulse}" = "yes"])
3424
3425 dnl
3426 dnl  ALSA module
3427 dnl
3428 AC_ARG_ENABLE(alsa,
3429   [AS_HELP_STRING([--enable-alsa],
3430     [support the Advanced Linux Sound Architecture (default auto)])],, [
3431   AS_IF([test "$SYS" = "linux" -a "${have_pulse}" = "no"], [
3432     enable_alsa="yes"
3433   ])
3434 ])
3435 have_alsa="no"
3436 AS_IF([test "${enable_alsa}" != "no"], [
3437   PKG_CHECK_MODULES([ALSA], [alsa >= 1.0.16], [
3438     have_alsa="yes"
3439   ], [
3440     AS_IF([test "x${enable_alsa}" != "x"], [
3441       AC_MSG_ERROR([$ALSA_PKG_ERRORS. alsa-lib 1.0.16 or later required.])
3442     ])
3443   ])
3444 ])
3445 AM_CONDITIONAL([HAVE_ALSA], [test "${have_alsa}" = "yes"])
3446
3447 dnl
3448 dnl  Open Sound System module
3449 dnl
3450 AC_ARG_ENABLE(oss,
3451   [AS_HELP_STRING([--enable-oss],
3452     [support the Open Sound System OSS (default enabled on FreeBSD/NetBSD/DragonFlyBSD)])],, [
3453   AS_IF([test "$SYS" = "mingw32" -o "$SYS" = "linux" -o "$SYS" = "openbsd"], [
3454     enable_oss="no"
3455   ])
3456 ])
3457 have_oss="no"
3458 OSS_LIBS=""
3459 AS_IF([test "$enable_oss" != "no"], [
3460   AC_CHECK_HEADERS([soundcard.h sys/soundcard.h], [
3461     have_oss="yes"
3462     AC_CHECK_LIB(ossaudio, main, [
3463       OSS_LIBS="-lossaudio"
3464     ])
3465   ])
3466 ])
3467 AC_SUBST(OSS_LIBS)
3468 AM_CONDITIONAL([HAVE_OSS], [test "${have_oss}" = "yes"])
3469
3470 dnl
3471 dnl  OpenBSD sndio module
3472 dnl
3473 AC_ARG_ENABLE([sndio],
3474   [AS_HELP_STRING([--disable-sndio],
3475     [support the OpenBSD sndio (default auto)])],, [
3476   AS_IF([test "$SYS" = "opensd"], [
3477     enable_sndio="yes"
3478   ])
3479 ])
3480 have_sndio="no"
3481 AS_IF([test "$enable_sndio" != "no"], [
3482   AC_CHECK_HEADER([sndio.h], [
3483     have_sndio="yes"
3484   ])
3485 ])
3486 AM_CONDITIONAL([HAVE_SNDIO], [test "${have_sndio}" = "yes"])
3487
3488 dnl
3489 dnl  Windows Audio Session plugin
3490 dnl
3491 AC_ARG_ENABLE([wasapi],
3492   [AS_HELP_STRING([--enable-wasapi],
3493     [use the Windows Audio Session API (default auto)])
3494 ])
3495 have_wasapi="no"
3496 AS_IF([test "$enable_wasapi" != "no"], [
3497   AC_CHECK_HEADER([audioclient.h], [
3498     have_wasapi="yes"
3499   ], [
3500     AS_IF([test "x${enable_wasapi}" != "x"], [
3501       AC_MSG_ERROR([Windows Audio Session API not found.])
3502     ])
3503   ])
3504 ])
3505 AM_CONDITIONAL([HAVE_WASAPI], [test "${have_wasapi}" = "yes"])
3506
3507 dnl
3508 dnl  win32 waveOut plugin
3509 dnl
3510 AC_ARG_ENABLE(waveout,
3511   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
3512 if test "${enable_waveout}" != "no"; then
3513   if test "${SYS}" = "mingw32"; then
3514     VLC_ADD_PLUGIN([waveout])
3515     VLC_ADD_LIBS([waveout],[-lwinmm])
3516   fi
3517 fi
3518
3519 dnl
3520 dnl  CoreAudio plugin
3521 dnl
3522 AC_ARG_ENABLE(macosx-audio,
3523   [  --enable-macosx-audio   Mac OS X audio module (default enabled on MacOS X)])
3524 if test "x${enable_macosx_audio}" != "xno" &&
3525   (test "${SYS}" = "darwin" || test "${enable_macosx_audio}" = "yes")
3526 then
3527   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h,
3528     [ VLC_ADD_PLUGIN([auhal])
3529       VLC_ADD_LIBS([auhal],[-Wl,-framework,CoreAudio,-framework,AudioUnit,-framework,AudioToolbox,-framework,Carbon])
3530     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
3531 fi
3532
3533 dnl
3534 dnl  AudioQueue plugin
3535 dnl
3536 AC_ARG_ENABLE(audioqueue,
3537   [  --enable-audioqueue     AudioQueue audio module (default disabled)])
3538 if test "${enable_audioqueue}" = "yes"
3539 then
3540   VLC_ADD_PLUGIN([audioqueue])
3541   VLC_ADD_LIBS([audioqueue], [-Wl,-framework,AudioToolbox,-framework,CoreFoundation])
3542 fi
3543
3544 dnl
3545 dnl  JACK modules
3546 dnl
3547 PKG_ENABLE_MODULES_VLC([JACK], [jack access_jack], [jack], [JACK audio I/O modules],[auto])
3548
3549 dnl
3550 dnl  OpenSLES Android
3551 dnl
3552 AC_ARG_ENABLE(opensles,
3553   [  --enable-opensles       Android OpenSL ES audio module (default disabled)])
3554 if test "${HAVE_ANDROID}" = "1"; then
3555   if test "${enable_opensles}" = "yes"; then
3556       AC_CHECK_HEADERS(SLES/OpenSLES.h,
3557         [ VLC_ADD_PLUGIN([opensles_android]) ],
3558         [ AC_MSG_ERROR([cannot find OpenSLES headers])] )
3559   fi
3560 fi
3561
3562 dnl
3563 dnl libsamplerate plugin
3564 dnl
3565 PKG_ENABLE_MODULES_VLC([SAMPLERATE], [], [samplerate], [Resampler with libsamplerate], [auto])
3566
3567 dnl
3568 dnl  OS/2 KAI plugin
3569 dnl
3570 AC_ARG_ENABLE(kai,
3571   [AS_HELP_STRING([--enable-kai],
3572     [support the K Audio Interface KAI (default enabled on OS/2)])],, [
3573   AS_IF([test "$SYS" = "os2"], [
3574     enable_kai="yes"
3575   ])
3576 ])
3577 have_kai="no"
3578 KAI_LIBS=""
3579 AS_IF([test "$enable_kai" != "no"], [
3580   AC_CHECK_HEADERS([kai.h], [
3581     have_kai="yes"
3582     AC_CHECK_LIB(kai, main, [
3583       KAI_LIBS="-lkai"
3584     ])
3585   ])
3586 ])
3587 AC_SUBST(KAI_LIBS)
3588 AM_CONDITIONAL([HAVE_KAI], [test "${have_kai}" = "yes"])
3589
3590 dnl
3591 dnl  Interface plugins
3592 dnl
3593
3594 EXTEND_HELP_STRING([Interface plugins:])
3595
3596 dnl
3597 dnl QT
3598 dnl
3599 AC_ARG_ENABLE(qt, [
3600   AS_HELP_STRING([--disable-qt], [Qt UI support (default enabled)])],, [
3601   AS_IF([test "${SYS}" = "darwin"], [
3602     enable_qt="no"
3603   ])
3604 ])
3605 AS_IF([test "${enable_qt}" != "no"], [
3606   PKG_CHECK_MODULES([QT], [QtCore >= 5 QtWidgets QtGui],, [
3607     PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
3608       AS_IF([test -n "${enable_qt}"],[
3609         AC_MSG_ERROR([${QT_PKG_ERRORS}.])
3610       ],[
3611         AC_MSG_WARN([${QT_PKG_ERRORS}.])
3612       ])
3613       enable_qt="no"
3614     ])
3615   ])
3616 ])
3617 AS_IF([test "${enable_qt}" != "no"], [
3618   VLC_ADD_PLUGIN([qt4])
3619   VLC_ADD_LIBS([qt4],[${QT_LIBS}])
3620   VLC_ADD_CXXFLAGS([qt4],[${QT_CFLAGS}])
3621   ALIASES="${ALIASES} qvlc"
3622
3623   AC_LANG_PUSH([C++])
3624   VLC_SAVE_FLAGS
3625
3626   AC_MSG_CHECKING([whether Qt uses Xlib])
3627   CPPFLAGS="${CPPFLAGS} ${QT_CFLAGS}"
3628   AC_PREPROC_IFELSE([AC_LANG_SOURCE([
3629 #include <QWidget>
3630 #if !defined (Q_WS_X11)
3631 # error Fail
3632 #endif
3633   ])], [
3634     AC_MSG_RESULT([yes])
3635     VLC_ADD_LIBS([qt4],[${X_LIBS} ${X_PRE_LIBS} -lX11])
3636     VLC_ADD_CXXFLAGS([qt4],[${X_CFLAGS}])
3637   ], [
3638     AC_MSG_RESULT([no])
3639   ])
3640
3641   VLC_RESTORE_FLAGS
3642   AC_LANG_POP([C++])
3643
3644   AS_IF([test "${SYS}" = "mingw32"], [
3645       VLC_ADD_LIBS([qt4],[-lole32])
3646   ])
3647   AS_IF([test "${SYS}" = "darwin" ],[
3648        VLC_ADD_LIBS([qt4], [-Wl,-framework,Cocoa])
3649   ])
3650
3651   QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
3652   AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, [${QT_PATH}/bin])
3653   AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin])
3654   AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, [${QT_PATH}/bin])
3655 ])
3656 AM_CONDITIONAL(ENABLE_QT4, [test "$enable_qt" != "no"])
3657
3658 dnl
3659 dnl Simple test for skins2 dependency
3660 dnl
3661 AS_IF([test "$enable_qt" = "no"], [
3662   AS_IF([test "${enable_skins2}" = "yes"], [
3663     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.])
3664   ], [
3665     enable_skins2="no"
3666     AC_MSG_WARN([The skins2 module depends on the Qt4 interface, Qt4 is not built so skins2 is disabled.])
3667   ])
3668 ])
3669
3670 dnl
3671 dnl Skins2 module
3672 dnl
3673 AC_ARG_ENABLE(skins2,
3674   [AS_HELP_STRING([--enable-skins2], [skins interface module (default auto)])])
3675 AS_IF([test "${enable_skins2}" != "no"], [
3676   have_skins_deps="yes"
3677
3678   dnl Win32
3679   AS_IF([test "${SYS}" = "mingw32"], [
3680     VLC_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -DWIN32_SKINS])
3681     VLC_ADD_LIBS([skins2],[-lgdi32 -lole32 -luuid -lmsimg32])
3682   dnl MacOS
3683   ], [test "${SYS}" = "darwin"], [
3684     VLC_ADD_CPPFLAGS([skins2],[ -DMACOSX_SKINS])
3685     VLC_ADD_LIBS([skins2],[-Wl,-framework,Carbon])
3686   dnl Linux/Unix
3687   ], [
3688     PKG_CHECK_MODULES([XPM], [xpm],, [have_skins_deps="no"])
3689     PKG_CHECK_MODULES([XINERAMA], [xinerama],, [have_skins_deps="no"])
3690     PKG_CHECK_MODULES([XEXT], [xext],, [have_skins_deps="no"])
3691     VLC_ADD_CPPFLAGS([skins2],[${X_CFLAGS} ${XEXT_CFLAGS} ${XPM_CFLAGS} -DX11_SKINS])
3692     VLC_ADD_LIBS([skins2],[${X_LIBS} ${X_PRE_LIBS} ${XEXT_LIBS} ${XPM_LIBS} ${XINERAMA_LIBS} -lX11])
3693   ])
3694
3695   dnl for All OSes
3696   VLC_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3697
3698   dnl we need freetype
3699   AS_IF([test "${have_freetype}" != "yes"], [
3700     have_skins_deps="no"
3701   ])
3702
3703   AS_IF([test "${have_skins_deps}" = "no"], [
3704     AS_IF([test "x${enable_skins2}" = "x"], [
3705       AC_MSG_WARN([Skins2 interface disabled due to missing dependencies.])
3706     ], [
3707       AC_MSG_ERROR([Skins2 interface requires FreeType, libxpm, libxext and libxinerama])
3708     ])
3709     enable_skins2="no"
3710   ], [
3711     VLC_ADD_PLUGIN([skins2])
3712     ALIASES="${ALIASES} svlc"
3713     enable_skins2="yes"
3714   ])
3715 ])
3716 AM_CONDITIONAL(BUILD_SKINS, [test "${enable_skins2}" = "yes"])
3717
3718 AC_ARG_ENABLE(libtar,
3719   [  --enable-libtar         libtar support for skins2 (default auto)])
3720 AS_IF([test "${enable_skins2}" = "yes" && test "${enable_libtar}" != "no"], [
3721   AC_CHECK_HEADERS(libtar.h, [
3722     VLC_ADD_LIBS([skins2],[-ltar])
3723   ])
3724 ])
3725
3726 dnl
3727 dnl  MacOS X gui module
3728 dnl
3729 AC_ARG_ENABLE(macosx,
3730   [  --enable-macosx         Mac OS X gui support (default enabled on Mac OS X)])
3731 if test "x${enable_macosx}" != "xno" -a "${SYS}" = "darwin"
3732 then
3733   VLC_ADD_LIBS([macosx minimal_macosx], [-Wl,-framework,Cocoa -Wl,-framework,OpenGL -Wl,-framework,Carbon -Wl,-framework,CoreServices -Wl,-framework,AGL])
3734   VLC_ADD_OBJCFLAGS([macosx minimal_macosx], [-fobjc-exceptions] )
3735   VLC_ADD_PLUGIN([macosx minimal_macosx])
3736
3737   VLC_ADD_LIBS([macosx], [-Wl,-framework,QTKit -Wl,-framework,IOKit -Wl,-framework,AddressBook -Wl,-framework,WebKit -Wl,-framework,CoreAudio -Wl,-framework,SystemConfiguration])
3738
3739   if test ! -d ${CONTRIB_DIR}/Sparkle.framework
3740   then
3741     AC_MSG_ERROR([Sparkle framework is required and was not found in ${CONTRIB_DIR}])
3742   fi
3743   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,Sparkle])
3744   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3745
3746   if test ! -d ${CONTRIB_DIR}/BGHUDAppKit.framework
3747   then
3748     AC_MSG_ERROR([BGHUDAppKit framework is required and was not found in ${CONTRIB_DIR}])
3749   fi
3750   VLC_ADD_LIBS([macosx], [-F${CONTRIB_DIR} -Wl,-framework,BGHUDAppKit])
3751   VLC_ADD_OBJCFLAGS([macosx], [-F${CONTRIB_DIR}])
3752
3753 fi
3754
3755 dnl
3756 dnl  MacOS X dialor provider
3757 dnl
3758 AC_ARG_ENABLE(macosx-dialog-provider,
3759   [  --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
3760 if test "x${enable_macosx_dialog_provider}" != "xno" &&
3761   (test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
3762 then
3763   VLC_ADD_LIBS([macosx_dialog_provider],[-Wl,-framework,Cocoa])
3764   VLC_ADD_PLUGIN([macosx_dialog_provider])
3765 fi
3766
3767 dnl
3768 dnl  ncurses module
3769 dnl
3770 AC_ARG_ENABLE(ncurses,
3771 [AS_HELP_STRING([--disable-ncurses],[ncurses text-based interface (default auto)])])
3772 AS_IF([test "${enable_ncurses}" != "no"] ,[
3773   PKG_CHECK_MODULES([NCURSES], [ncursesw], [
3774     VLC_ADD_PLUGIN([ncurses])
3775     VLC_ADD_CFLAGS([ncurses],[${NCURSES_CFLAGS}])
3776     VLC_ADD_LIBS([ncurses],[${NCURSES_LIBS}])
3777     ALIASES="${ALIASES} nvlc"
3778   ], [
3779     AS_IF([test -n "${enable_ncurses}"], [
3780       AC_MSG_ERROR([${NCURSES_PKG_ERRORS}.])
3781     ])
3782   ])
3783 ])
3784
3785 dnl
3786 dnl  Lirc plugin
3787 dnl
3788 AC_ARG_ENABLE(lirc,
3789   [  --enable-lirc           lirc support (default disabled)])
3790 if test "${enable_lirc}" = "yes"
3791 then
3792   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
3793   if test "${have_lirc}" = "true"
3794   then
3795     VLC_ADD_PLUGIN([lirc])
3796     VLC_ADD_LIBS([lirc],[-llirc_client])
3797   fi
3798 fi
3799
3800 EXTEND_HELP_STRING([Visualisations and Video filter plugins:])
3801 dnl
3802 dnl Visualisation plugin
3803 dnl
3804 AC_ARG_ENABLE(visual,
3805   [  --enable-visual         visualisation plugin (default enabled)])
3806 if test "${enable_visual}" != "no"
3807 then
3808     VLC_ADD_PLUGIN([visual])
3809 fi
3810
3811 dnl
3812 dnl  goom visualization plugin
3813 dnl
3814 PKG_ENABLE_MODULES_VLC([GOOM], [], [libgoom2], [goom visualization plugin], [auto])
3815
3816 dnl
3817 dnl libprojectM visualization plugin
3818 dnl
3819 AC_ARG_ENABLE(projectm,
3820   [  --enable-projectm       projectM visualization plugin (default enabled)])
3821 AS_IF([test "${enable_projectm}" != "no"],
3822   [
3823     PKG_CHECK_MODULES(PROJECTM, libprojectM,
3824     [
3825       VLC_ADD_PLUGIN([projectm])
3826       VLC_ADD_CXXFLAGS([projectm],[$PROJECTM_CFLAGS])
3827       VLC_ADD_LIBS([projectm],[$PROJECTM_LIBS])
3828       PKG_CHECK_MODULES(PROJECTM2, [libprojectM >= 2.0.0],
3829         [ AC_DEFINE([HAVE_PROJECTM2], 1, [Define to 1 if using libprojectM 2.x]) ],
3830         [ AC_MSG_WARN( [Using libprojectM version 1] )
3831       ])
3832     ],[
3833       AC_MSG_WARN([${PROJECTM_PKG_ERRORS}.])
3834     ])
3835   ])
3836
3837 dnl
3838 dnl Vovoid VSXu visualization plugin
3839 dnl
3840 AC_ARG_ENABLE(vsxu,
3841   [  --enable-vsxu           Vovoid VSXu visualization plugin (default auto)])
3842 AS_IF([test "${enable_vsxu}" != "no"],
3843   [
3844     PKG_CHECK_MODULES(VSXU, libvsxu,
3845     [
3846       VLC_ADD_PLUGIN([vsxu])
3847       VLC_ADD_CXXFLAGS([vsxu],[$VSXU_CFLAGS])
3848       VLC_ADD_LIBS([vsxu],[$VSXU_LIBS])
3849     ],[
3850       AC_MSG_WARN([${VSXU_PKG_ERRORS}.])
3851     ])
3852   ])
3853
3854 dnl
3855 dnl  AtmoLight (homemade Philips Ambilight clone)
3856 dnl
3857 AC_ARG_ENABLE(atmo,
3858 AS_HELP_STRING([--disable-atmo],[AtmoLight (homemade Philips Ambilight clone)
3859                 (default enabled)]),, [enable_atmo="yes"])
3860 AS_IF([test "${enable_atmo}" != no], [
3861   AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "linux"], [
3862     AC_LANG_PUSH(C++)
3863     VLC_ADD_PLUGIN([atmo])
3864     AC_LANG_POP(C++)
3865   ])
3866 ])
3867
3868 EXTEND_HELP_STRING([Service Discovery plugins:])
3869 dnl
3870 dnl  Bonjour services discovery
3871 PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services discovery], [auto])
3872
3873 dnl
3874 dnl  libudev services discovery
3875 PKG_ENABLE_MODULES_VLC([UDEV], [], [libudev >= 142], [Linux udev services discovery], [auto])
3876
3877 dnl
3878 dnl MTP devices services discovery
3879 PKG_ENABLE_MODULES_VLC([MTP], [mtp access_mtp], [libmtp >= 1.0.0], [MTP devices support], [auto])
3880
3881 dnl
3882 dnl UPnP Plugin (Intel SDK)
3883 dnl
3884 PKG_ENABLE_MODULES_VLC([UPNP], [upnp], [libupnp], [Intel UPNP SDK],[auto])
3885 VLC_ADD_CXXFLAGS([upnp],[${UPNP_CFLAGS}])
3886
3887 EXTEND_HELP_STRING([Misc options:])
3888
3889 dnl
3890 dnl  libxml2 module
3891 dnl
3892 PKG_ENABLE_MODULES_VLC([LIBXML2], [xml], [libxml-2.0 >= 2.5], [libxml2 support],[auto])
3893
3894
3895 dnl
3896 dnl libgcrypt
3897 dnl
3898 AC_ARG_ENABLE(libgcrypt,
3899   [  --disable-libgcrypt     gcrypt support (default enabled)])
3900 AS_IF([test "${enable_libgcrypt}" != "no"], [
3901   AC_CHECK_DECL([GCRYCTL_SET_THREAD_CBS], [
3902     libgcrypt-config --version >/dev/null || \
3903         AC_MSG_ERROR([gcrypt.h present but libgcrypt-config could not be found])
3904     AC_CHECK_LIB(gcrypt, gcry_control, [
3905       have_libgcrypt="yes"
3906       GCRYPT_CFLAGS="`libgcrypt-config --cflags`"
3907       GCRYPT_LIBS="`libgcrypt-config --libs`"
3908     ], [
3909       AC_MSG_ERROR([libgcrypt not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
3910     ], [`libgcrypt-config --libs`])
3911   ], [
3912     AC_MSG_ERROR([libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt. Have a nice day.])
3913   ], [#include <gcrypt.h>]
3914   )
3915 ])
3916
3917 AC_SUBST(GCRYPT_CFLAGS)
3918 AC_SUBST(GCRYPT_LIBS)
3919 AM_CONDITIONAL([HAVE_GCRYPT], [test "${have_libgcrypt}" = "yes"])
3920
3921 dnl
3922 dnl TLS/SSL
3923 dnl
3924 AC_ARG_ENABLE(gnutls,
3925   [  --enable-gnutls         GNU TLS TLS/SSL support (default enabled)])
3926
3927 AS_IF([test "${have_libgcrypt}" != "yes"], [
3928   AS_IF([test "${enable_gnutls}" = "yes"], [
3929     AC_MSG_ERROR([--enable-gnutls and --disable-libgcrypt are mutually exclusive.])
3930   ])
3931   enable_gnutls="no"
3932 ])
3933 AS_IF([test "${enable_gnutls}" != "no"], [
3934   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 2.6.6], [
3935     VLC_ADD_PLUGIN([gnutls])
3936   ], [
3937     AS_IF([test -n "${enable_gnutls}"], [
3938       AC_MSG_ERROR([${GNUTLS_PKG_ERRORS}.)])
3939     ])
3940   ])
3941 ])
3942
3943
3944 dnl
3945 dnl Nokia MCE plugin (Maemo screen unblanking)
3946 dnl
3947 PKG_CHECK_MODULES([MCE], [dbus-1 mce], [VLC_ADD_PLUGIN([mce])], [true])
3948
3949
3950 AS_IF([test -f "/etc/maemo_version"], [
3951   AC_DEFINE([HAVE_MAEMO], 1, [Define to 1 if building for the Maemo platform.])
3952 ])
3953
3954
3955 dnl
3956 dnl Taglib plugin
3957 dnl
3958 AC_ARG_ENABLE(taglib,
3959   [AS_HELP_STRING([--disable-taglib],
3960     [do not use TagLib (default enabled)])])
3961 AS_IF([test "${enable_taglib}" != "no"], [
3962   PKG_CHECK_MODULES(TAGLIB, taglib >= 1.6.1, [
3963     VLC_ADD_PLUGIN([taglib])
3964     VLC_ADD_LIBS([taglib],[$TAGLIB_LIBS -lz])
3965     VLC_ADD_CXXFLAGS([taglib],[$TAGLIB_CFLAGS])
3966   ], [
3967     AC_MSG_WARN([${TAGLIB_PKG_ERRORS}.])])
3968 ])
3969
3970
3971 dnl
3972 dnl update checking system
3973 dnl
3974 AC_ARG_ENABLE(update-check,
3975   [  --enable-update-check   update checking system (default disabled)])
3976 if test "${enable_update_check}" = "yes"
3977 then
3978   if test "${have_libgcrypt}" != "yes"
3979   then
3980     AC_MSG_ERROR([libgcrypt is required for update checking system])
3981   fi
3982   VLC_ADD_LIBS([libvlccore], [${GCRYPT_LIBS}])
3983   VLC_ADD_CFLAGS([libvlccore], [${GCRYPT_CFLAGS}])
3984   AC_DEFINE([UPDATE_CHECK], 1, [Define if you want to use the VLC update mechanism])
3985 fi
3986
3987 dnl
3988 dnl Growl notification plugin
3989 dnl
3990 AC_ARG_ENABLE(growl,
3991   [  --enable-growl          growl notification plugin (default disabled)],,
3992   [enable_growl=no])
3993 AS_IF([test "${enable_growl}" != "no"], [
3994     AC_CHECK_HEADERS(${CONTRIB_DIR}/Growl.framework/Versions/A/Headers/Growl.h, [
3995       VLC_ADD_PLUGIN([growl])
3996       VLC_ADD_LIBS([growl], [-F${CONTRIB_DIR} -Wl,-framework,Growl,-framework,Foundation])
3997       VLC_ADD_OBJCFLAGS([growl], [-F${CONTRIB_DIR}])
3998       VLC_ADD_OBJCFLAGS([growl], [-fobjc-exceptions] )
3999     ])
4000   ]
4001 )
4002
4003 dnl
4004 dnl Libnotify notification plugin
4005 dnl
4006 PKG_ENABLE_MODULES_VLC([NOTIFY], [], [libnotify gtk+-2.0], [libnotify notification], [auto])
4007
4008 dnl
4009 dnl media library
4010 dnl
4011 AC_ARG_ENABLE(media-library,
4012     [  --enable-media-library  media library (default disabled)])
4013 AS_IF([test "${enable_media_library}" = "yes"], [
4014   AC_DEFINE([MEDIA_LIBRARY], 1, [Define if you want to use the VLC media library])
4015   VLC_ADD_CPPFLAGS([qt4],"-DMEDIA_LIBRARY")
4016   VLC_ADD_PLUGIN([media_library])
4017
4018 dnl
4019 dnl SQLite
4020 dnl
4021   AS_IF([test "${SYS}" != "darwin"], [
4022     PKG_ENABLE_MODULES_VLC([SQLITE], [], [sqlite3 >= 3.6.0], [sqlite3], [auto])
4023   ], [
4024     AS_IF([test "${enable_sqlite}" != "no"], [
4025       AC_CHECK_HEADERS(sqlite3.h, [
4026         VLC_ADD_PLUGIN([sqlite])
4027         VLC_ADD_LIBS([sqlite], [-lsqlite3])
4028       ], [
4029         AC_MSG_ERROR([sqlite3 is required for the media library])
4030       ])
4031     ])
4032   ])
4033 ])
4034
4035
4036 dnl
4037 dnl  Endianness check
4038 dnl
4039 AC_C_BIGENDIAN
4040 AS_IF([test "${ac_cv_c_bigendian}" = "yes"], [
4041   DEFS_BIGENDIAN="-DWORDS_BIGENDIAN=1"
4042 ], [
4043   DEFS_BIGENDIAN=""
4044 ])
4045 AC_SUBST(DEFS_BIGENDIAN)
4046
4047 dnl
4048 dnl Where to install KDE solid .desktop
4049 dnl
4050 AC_ARG_VAR([KDE4_CONFIG], [kde4-config utility])
4051 AS_IF([test "x$KDE4_CONFIG" = "x"], [
4052   KDE4_CONFIG="kde4-config"
4053 ])
4054
4055 AC_ARG_WITH(kde-solid,
4056   AS_HELP_STRING([--with-kde-solid=PATH],
4057                  [KDE Solid actions directory (auto)]),, [
4058
4059 if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then
4060   with_kde_solid="yes"
4061 fi
4062 ])
4063 soliddatadir=""
4064 AS_IF([test "${with_kde_solid}" != "no"], [
4065   AS_IF([test "${with_kde_solid}" = "yes"], [
4066     kde4datadir="`${KDE4_CONFIG} --install data`"
4067     AS_IF([test "x$kde4datadir" = "x"], [kde4datadir='${datadir}/kde4/apps'])
4068     soliddatadir="${kde4datadir}/solid/actions"
4069   ], [
4070     soliddatadir="${with_kde_solid}"
4071   ])
4072 ])
4073 AC_SUBST(soliddatadir)
4074 AM_CONDITIONAL(KDE_SOLID, [test "x${soliddatadir}" != "x"])
4075
4076 dnl
4077 dnl  DLL loader copied from MPlayer copied from somewhere else (WINE ?)
4078 dnl
4079 loader=false
4080 AC_ARG_ENABLE(loader,
4081   AS_HELP_STRING([--enable-loader],[build DLL loader for ELF i386 platforms
4082           (default disabled)]))
4083 AM_CONDITIONAL(LOADER, [test "${enable_loader}" = "yes"])
4084 AS_IF([test "${enable_loader}" = "yes"],
4085   [ VLC_ADD_PLUGIN([dmo])
4086     VLC_ADD_CPPFLAGS([dmo quicktime ],[-I\\\${top_srcdir}/modules/codec/loader])
4087     VLC_ADD_LIBS([dmo quicktime ],[\\\${top_builddir}/modules/codec/loader/libloader.la])
4088     VLC_ADD_LIBS([dmo quicktime], [-lpthread])
4089   ])
4090
4091 EXTEND_HELP_STRING([Components:])
4092
4093 dnl
4094 dnl  the VLC binary
4095 dnl
4096 AC_ARG_ENABLE(vlc,
4097   [  --enable-vlc            build the VLC media player (default enabled)])
4098 AM_CONDITIONAL(BUILD_VLC, [test "${enable_vlc}" != "no"])
4099
4100 AC_ARG_ENABLE(macosx-vlc-app,
4101   [  --enable-macosx-vlc-app build the VLC media player (default enabled on Mac OS X)])
4102 AM_CONDITIONAL(BUILD_MACOSX_VLC_APP, [test "${enable_macosx_vlc_app}" != "no" &&
4103     (test "${SYS}" = "darwin" || test "${enable_macosx_vlc_app}" = "yes") ])
4104
4105 dnl
4106 dnl  Stuff used by the program
4107 dnl
4108 VERSION_MESSAGE="${VERSION} ${CODENAME}"
4109 COPYRIGHT_MESSAGE="Copyright © ${COPYRIGHT_YEARS} the VideoLAN team"
4110 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION_MESSAGE}", [Simple version string])
4111 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "${COPYRIGHT_MESSAGE}", [Copyright string])
4112 AC_DEFINE_UNQUOTED(COPYRIGHT_YEARS, "${COPYRIGHT_YEARS}", [The copyright years])
4113 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
4114 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MAJOR,${VERSION_MAJOR}, [version major number])
4115 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_MINOR,${VERSION_MINOR}, [version minor number])
4116 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_REVISION,${VERSION_REVISION}, [version revision number])
4117 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_EXTRA,${VERSION_EXTRA}, [version extra number])
4118 AC_DEFINE_UNQUOTED(PACKAGE_VERSION_DEV,"${VERSION_DEV}", [version development string])
4119 AC_SUBST(COPYRIGHT_MESSAGE)
4120 AC_SUBST(VERSION_MESSAGE)
4121 AC_SUBST(VERSION_MAJOR)
4122 AC_SUBST(VERSION_MINOR)
4123 AC_SUBST(VERSION_REVISION)
4124 AC_SUBST(VERSION_EXTRA)
4125 AC_SUBST(COPYRIGHT_YEARS)
4126 AC_DEFINE_UNQUOTED(VLC_COMPILE_BY, "`whoami|sed -e 's/\\\/\\\\\\\/g'`", [user who ran configure])
4127 AC_DEFINE_UNQUOTED(VLC_COMPILE_HOST, "`hostname -f 2>/dev/null || hostname`", [host which ran configure])
4128 AC_DEFINE_UNQUOTED(VLC_COMPILER, "`$CC -v 2>&1 | tail -n 1 | sed -e 's/ *$//'`", [compiler])
4129 dnl
4130 dnl  Handle substvars that use $(top_srcdir)
4131 dnl
4132 CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir)/include ${CPPFLAGS}"
4133
4134 dnl
4135 dnl  Configuration is finished
4136 dnl
4137 AC_SUBST(SYS)
4138 AC_SUBST(ARCH)
4139 AC_SUBST(ALIASES)
4140 AC_SUBST(ASM)
4141 AC_SUBST(MOC)
4142 AC_SUBST(RCC)
4143 AC_SUBST(UIC)
4144 AC_SUBST(WINDRES)
4145 AC_SUBST(WINE_SDK_PATH)
4146 AC_SUBST(LIBEXT)
4147 AC_SUBST(AM_CPPFLAGS)
4148 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
4149 AC_SUBST(FILE_LIBVLCCORE_DLL)
4150 AC_SUBST(FILE_LIBVLC_DLL)
4151
4152 AC_CONFIG_FILES([
4153   Makefile
4154   doc/Makefile
4155   modules/Makefile
4156   m4/Makefile
4157   po/Makefile.in
4158   share/Makefile
4159   compat/Makefile
4160   src/Makefile
4161   src/test/Makefile
4162   lib/Makefile
4163   bin/Makefile
4164   test/Makefile
4165   modules/access/Makefile
4166   modules/access/bd/Makefile
4167   modules/access/dshow/Makefile
4168   modules/access/mms/Makefile
4169   modules/access/rtp/Makefile
4170   modules/access/rtsp/Makefile
4171   modules/access/vcd/Makefile
4172   modules/access/vcdx/Makefile
4173   modules/access/screen/Makefile
4174   modules/access/zip/Makefile
4175   modules/access/zip/unzip/Makefile
4176   modules/access_output/Makefile
4177   modules/audio_filter/Makefile
4178   modules/audio_mixer/Makefile
4179   modules/audio_output/Makefile
4180   modules/codec/Makefile
4181   modules/codec/avcodec/Makefile
4182   modules/codec/dmo/Makefile
4183   modules/codec/loader/Makefile
4184   modules/codec/omxil/Makefile
4185   modules/codec/shine/Makefile
4186   modules/codec/spudec/Makefile
4187   modules/codec/wmafixed/Makefile
4188   modules/control/Makefile
4189   modules/control/dbus/Makefile
4190   modules/control/globalhotkeys/Makefile
4191   modules/demux/Makefile
4192   modules/demux/asf/Makefile
4193   modules/demux/avformat/Makefile
4194   modules/demux/avi/Makefile
4195   modules/demux/mkv/Makefile
4196   modules/demux/mp4/Makefile
4197   modules/demux/mpeg/Makefile
4198   modules/demux/playlist/Makefile
4199   modules/gui/Makefile
4200   modules/gui/macosx/Makefile
4201   modules/gui/minimal_macosx/Makefile
4202   modules/gui/macosx_dialog_provider/Makefile
4203   modules/gui/qt4/Makefile
4204   modules/gui/skins2/Makefile
4205   modules/lua/Makefile
4206   modules/meta_engine/Makefile
4207   modules/misc/Makefile
4208   modules/misc/playlist/Makefile
4209   modules/misc/osd/Makefile
4210   modules/misc/stats/Makefile
4211   modules/media_library/Makefile
4212   modules/mux/Makefile
4213   modules/mux/mpeg/Makefile
4214   modules/notify/Makefile
4215   modules/packetizer/Makefile
4216   modules/services_discovery/Makefile
4217   modules/stream_filter/Makefile
4218   modules/stream_filter/dash/Makefile
4219   modules/stream_out/Makefile
4220   modules/stream_out/transcode/Makefile
4221   modules/text_renderer/Makefile
4222   modules/video_chroma/Makefile
4223   modules/video_filter/Makefile
4224   modules/video_filter/dynamicoverlay/Makefile
4225   modules/video_output/Makefile
4226   modules/video_output/msw/Makefile
4227   modules/visualization/Makefile
4228   modules/visualization/visual/Makefile
4229   modules/mmx/Makefile
4230   modules/sse2/Makefile
4231   modules/altivec/Makefile
4232   modules/arm_neon/Makefile
4233 ])
4234
4235 AM_COND_IF([HAVE_WIN32], [
4236   AC_CONFIG_FILES([
4237     extras/package/win32/spad.nsi
4238     extras/package/win32/vlc.win32.nsi
4239   ])
4240 ])
4241
4242 AM_COND_IF([HAVE_DARWIN], [
4243   AC_CONFIG_FILES([
4244     extras/package/macosx/Info.plist
4245     extras/package/macosx/Resources/English.lproj/InfoPlist.strings
4246   ])
4247 ])
4248
4249 dnl Generate makefiles
4250 AC_OUTPUT
4251
4252 dnl Do we have to use make or gmake ?
4253 if make --version 2>&1|grep -q GNU
4254 then
4255     # GNU make, all seems good
4256     MAKE=make
4257 else
4258     # Known GNU make alias (on BSD)
4259     MAKE=gmake
4260 fi
4261 dnl Shortcut to nice compile message
4262 if test -n $SHELL; then
4263   SHELL=${CONFIG_SHELL-/bin/sh}
4264 fi
4265 rm -f compile
4266 echo "#! $SHELL
4267 rm -f .error\$\$
4268 ERROR=0
4269 export PATH=\"$PATH\" LANG=C
4270 ($MAKE V=1 \$@ 2>&1 || touch .error\$\$)| `sed -ne \"s/^top_srcdir *= *//p\" < Makefile`/extras/buildsystem/make.pl
4271 test -f .error\$\$ && ERROR=1
4272 rm -f .error\$\$
4273 exit \$ERROR" >compile
4274 chmod a+x compile
4275
4276 echo "
4277 libvlc configuration
4278 --------------------
4279 version               : ${VERSION}
4280 system                : ${SYS}
4281 architecture          : ${ARCH}
4282 optimizations         : ${enable_optimizations}"
4283 if test "${enable_vlc}" != "no"; then
4284 echo "vlc aliases           :${ALIASES}"
4285 else
4286 echo "build vlc executable  : no"
4287 fi
4288 echo "
4289 To build vlc and its plugins, type \`$MAKE', or \`./compile' if you like nice colors."