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