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