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