]> git.sesse.net Git - vlc/blob - configure.ac
09b8367dca3f20d8fe02fdc5afde9543d56b44cb
[vlc] / configure.ac
1 dnl Autoconf settings for vlc
2 dnl $Id$
3  
4 AC_INIT(vlc,0.7.3-svn)
5
6 CONFIGURE_LINE="$0 $*"
7 CODENAME="Bond"
8
9 AC_PREREQ(2.50)
10 AC_CONFIG_SRCDIR(src/libvlc.c)
11 AC_CONFIG_AUX_DIR(autotools)
12 AC_CANONICAL_SYSTEM
13
14 dnl XXX: we don't put any flags here, because automake 1.5 doesn't support
15 dnl them. And we need the comma otherwize automake will choke on it.
16 AM_INIT_AUTOMAKE(vlc,0.7.3-svn)
17 AM_CONFIG_HEADER(config.h)
18
19 dnl
20 dnl  Save *FLAGS
21 dnl
22 AX_SAVE_FLAGS
23
24 dnl
25 dnl Check for tools
26 dnl
27 AC_PROG_CC
28 AM_PROG_CC_C_O
29 AC_PROG_CPP
30 AC_PROG_CXX
31 AC_PROG_CXXCPP
32 AC_PROG_MAKE_SET
33 AC_PROG_INSTALL
34
35 dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
36 dnl now otherwise it might be set in an obscure if statement.
37 AC_EGREP_CPP(foo,foo)
38
39 dnl AC_PROG_OBJC doesn't seem to exist, this is the KDE workaround
40 AC_MSG_CHECKING(for an Objective-C compiler)
41 OBJC="${CXX}"
42 AC_SUBST(OBJC)
43 OBJCFLAGS="${CXXFLAGS} -fgnu-runtime -fconstant-string-class=NSConstantString"
44 AC_SUBST(OBJCFLAGS)
45 dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
46 #OBJCDEPMODE="depmode=gcc3"
47 #AC_SUBST(OBJCDEPMODE)
48 _AM_DEPENDENCIES(OBJC)
49 AC_MSG_RESULT(not implemented yet)
50
51 dnl Find the right ranlib, even when cross-compiling
52 AC_CHECK_TOOL(RANLIB, ranlib, :)
53 AC_CHECK_TOOL(STRIP, strip, :)
54 AC_CHECK_TOOL(AR, ar, :)
55 AC_CHECK_TOOL(LD, ld, :)
56 AC_CHECK_TOOL(UPX, upx, "")
57
58 dnl Sam, if you think I didn't see that... --Meuuh
59 dnl AM_PROG_LIBTOOL
60 AC_PROG_INSTALL
61
62 dnl Check for compiler properties
63 AC_C_CONST
64 AC_C_INLINE
65
66 dnl
67 dnl  Check for the contrib directory
68 dnl
69 topdir="`pwd`"
70 if test -d ${topdir}/extras/contrib/lib; then
71   export PATH=${topdir}/extras/contrib/bin:$PATH
72   export LD_LIBRARY_PATH=${topdir}/extras/contrib/lib:$LD_LIBRARY_PATH
73   export DYLD_LIBRARY_PATH=${topdir}/extras/contrib/lib:$DYLD_LIBRARY_PATH
74   CPPFLAGS="${CPPFLAGS} -I${topdir}/extras/contrib/include"
75   CPPFLAGS_save="${CPPFLAGS_save} -I${topdir}/extras/contrib/include"
76   CFLAGS="${CFLAGS} -I${topdir}/extras/contrib/include"
77   CFLAGS_save="${CFLAGS_save} -I${topdir}/extras/contrib/include"
78   CXXFLAGS="${CXXFLAGS} -I${topdir}/extras/contrib/include"
79   CXXFLAGS_save="${CXXFLAGS_save} -I${topdir}/extras/contrib/include"
80   OBJCFLAGS="${OBJCFLAGS} -I${topdir}/extras/contrib/include"
81   OBJCFLAGS_save="${OBJCFLAGS_save} -I${topdir}/extras/contrib/include"
82   if test -d ${topdir}/extras/contrib/vlc-lib; then
83     LDFLAGS="${LDFLAGS} -L${topdir}/extras/contrib/vlc-lib"
84     LDFLAGS_save="${LDFLAGS_save} -L${topdir}/extras/contrib/vlc-lib"
85   fi
86   LDFLAGS="${LDFLAGS} -L${topdir}/extras/contrib/lib"
87   LDFLAGS_save="${LDFLAGS_save} -L${topdir}/extras/contrib/lib"
88   with_livedotcom_tree=${topdir}/extras/contrib/src/live
89   with_goom_tree=${topdir}/extras/contrib/src/goom
90 fi
91
92 dnl
93 dnl  Set default values
94 dnl
95 LDFLAGS_vlc="${LDFLAGS}"
96 LIBEXT=".so"
97
98 dnl
99 dnl  Check the operating system
100 dnl
101 case "${target_os}" in
102   "")
103     SYS=unknown
104     ;;
105   linux*)
106     SYS=linux
107     ;;
108   bsdi*)
109     SYS=bsdi
110     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
111     AX_ADD_LDFLAGS([dvd dvdcss vcd cdda vcdx cddax],[-ldvd])
112     ;;
113   *bsd*)
114     SYS="${target_os}"
115     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
116     ;;
117   darwin*)
118     SYS=darwin
119     CFLAGS_save="${CFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CFLAGS="${CFLAGS_save}"
120     CXXFLAGS_save="${CXXFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
121     OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; OBJCFLAGS="${OBJCFLAGS_save}"
122     AX_ADD_LDFLAGS([vlc ffmpeg],[-all_load])
123     AX_ADD_LDFLAGS([mp4], [-framework IOKit -framework CoreFoundation])
124     AX_ADD_LDFLAGS([vlc],[-Wl,-multiply_defined,suppress])
125     LIBEXT=".dylib"
126     ;;
127   *mingw32* | *cygwin*)
128     AC_CHECK_TOOL(WINDRES, windres, :)
129     LIBEXT=".dll"
130
131     case "${target_os}" in
132       *mingw32*)
133         SYS=mingw32
134         ;;
135       *cygwin*)
136         dnl Check if we are using the mno-cygwin mode in which case we are
137         dnl actually dealing with a mingw32 compiler.
138         AC_EGREP_CPP(yes,
139             [#ifdef WIN32
140              yes
141              #endif],
142             SYS=mingw32, SYS=cygwin)
143         ;;
144     esac
145
146     if test "${SYS}" = "mingw32"; then
147         # add ws2_32 for closesocket, select, recv
148         CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"; CPPFLAGS="${CPPFLAGS_save}"
149         AX_ADD_LDFLAGS([vlc],[-lws2_32 -lnetapi32 -lwinmm -mwindows])
150         AX_ADD_LDFLAGS([vcdx cddax],[-lwinmm])
151         AX_ADD_LDFLAGS([ipv4 ipv6 access_http access_mms access_udp access_tcp access_ftp access_output_udp sap slp http stream_out_standard telnet netsync],[-lws2_32])
152     fi
153     ;;
154   *nto*)
155     SYS=nto
156     AX_ADD_LDFLAGS([x11 xvideo],[-lsocket])
157     ;;
158   solaris*)
159     SYS=solaris
160     # _POSIX_PTHREAD_SEMANTICS is needed to get the POSIX ctime_r
161     # Perhaps it is useful other places as well? 
162     CFLAGS_save="${CFLAGS_save} -D_POSIX_PTHREAD_SEMANTICS"; CFLAGS="${CFLAGS_save}"
163     ;;
164   hpux*)
165     SYS=hpux
166     LIBEXT=".sl"
167     ;;
168   beos)
169     SYS=beos
170     CFLAGS_save="${CFLAGS_save} -Wno-multichar"; CFLAGS="${CFLAGS_save}"
171     CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar"; CXXFLAGS="${CXXFLAGS_save}"
172     AX_ADD_CXXFLAGS([beos],[])
173     AX_ADD_LDFLAGS([vlc beos],[-lbe])
174     AX_ADD_LDFLAGS([beos],[-lmedia -ltranslation -ltracker -lgame])
175
176     dnl Ugly check for Zeta
177     if test -f /boot/beos/system/lib/libzeta.so; then
178         AX_ADD_LDFLAGS([beos],[-lzeta])
179     fi
180     ;;
181   *)
182     SYS="${target_os}"
183     ;;
184 esac
185 AM_CONDITIONAL(HAVE_BEOS, test "${SYS}" = "beos")
186 AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
187 AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
188
189 dnl
190 dnl Gettext stuff
191 dnl
192 ALL_LINGUAS="de en_GB es fr hu it ja nl no pl pt_BR ru sv"
193 AM_GNU_GETTEXT_VERSION(0.11.5)
194 AM_GNU_GETTEXT
195 if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
196   AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
197   INCLUDES="${INCLUDES} -I\$(top_builddir)/intl"
198 else
199   AC_CHECK_FUNCS(textdomain,,[
200     AC_CHECK_LIB(intl,textdomain,
201       AX_ADD_LDFLAGS([vlc],[${LIBINTL}]),,
202       ${LIBINTL}
203     )
204   ])
205 fi
206 AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
207 XGETTEXT="${XGETTEXT} --keyword=_NS --keyword=_ANS"
208
209 AC_ARG_ENABLE(utf8,
210   [  --enable-utf8           unicode utf8 support (default enabled on darwin/beos/win32)])
211 if test "${enable_utf8}" = "yes" || (test "${enable_utf8}" != "no" && (test "${SYS}" = "mingw32" || test "${SYS}" = "beos" || test "${SYS}" = "darwin" ) )
212 then
213   AC_DEFINE(ENABLE_UTF8, 1,
214             Define if you want utf8 support)
215 fi
216
217 AC_MSG_CHECKING(for suffix of libraries)
218 AC_MSG_RESULT(${LIBEXT})
219
220 dnl Check for the need to include the mingwex lib for mingw32
221 if test "${SYS}" = "mingw32"
222 then
223     AC_CHECK_LIB(mingwex,opendir,
224         AC_CHECK_LIB(mingw32,opendir,AX_ADD_LDFLAGS([vlc],[]),
225             [AX_ADD_LDFLAGS([vlc gtk],[-lmingwex])])
226     )
227 fi
228
229 dnl Check for fnative-struct or mms-bitfields support for mingw32
230 if test "${SYS}" = "mingw32"
231 then
232     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
233         [ac_cv_c_mms_bitfields],
234         [CFLAGS="${CFLAGS_save} -mms-bitfields"
235          AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
236     if test "${ac_cv_c_mms_bitfields}" != "no"; then
237         CFLAGS_save="${CFLAGS_save} -mms-bitfields";
238         CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
239     else
240         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
241             [ac_cv_c_fnative_struct],
242             [CFLAGS="${CFLAGS_save} -fnative-struct"
243              AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
244         if test "${ac_cv_c_fnative_struct}" != "no"; then
245             CFLAGS_save="${CFLAGS_save} -fnative-struct";
246             CXXFLAGS_save="${CXXFLAGS_save} -fnative-struct";
247         fi
248     fi
249
250     CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
251 fi
252
253 dnl Check for fvtable-thunks support for mingw32
254 if test "${SYS}" = "mingw32"
255 then
256 AC_LANG_PUSH(C++)
257     AC_CACHE_CHECK([if \$CXX accepts -fvtable-thunks],
258         [ac_cv_cxx_fvtable_thunks],
259         [CXXFLAGS="${CXXFLAGS_save} -Wall -Werror -fvtable-thunks"
260          AC_TRY_COMPILE([],,ac_cv_cxx_fvtable_thunks=yes,
261                         ac_cv_cxx_fvtable_thunks=no)])
262     if test "${ac_cv_cxx_fvtable_thunks}" = "yes"; then
263         CXXFLAGS_mingw32_special="-fvtable-thunks"
264     fi
265
266     CXXFLAGS_save="${CXXFLAGS_save} ${CXXFLAGS_mingw32_special}"; CXXFLAGS="${CXXFLAGS_save}"
267 AC_LANG_POP(C++)
268 fi
269
270 dnl Flags for plugin compilation
271 case "${SYS}" in
272   mingw32|cygwin)
273     AX_ADD_CFLAGS([pic plugin mozilla],[${CFLAGS_mingw32_special}])
274     AX_ADD_CXXFLAGS([pic plugin mozilla],[${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}])
275     AX_ADD_OBJCFLAGS([pic plugin mozilla],[${CFLAGS_mingw32_special}])
276     ;;
277   *)
278     AX_ADD_CFLAGS([pic plugin mozilla],[-fpic -fPIC])
279     AX_ADD_CXXFLAGS([pic plugin mozilla],[-fpic -fPIC])
280     AX_ADD_OBJCFLAGS([pic plugin mozilla],[-fpic -fPIC])
281     AX_ADD_LDFLAGS([plugin mozilla],[-fpic -fPIC])
282     ;;
283 esac
284
285 dnl The -DSYS_FOO flag
286 CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
287
288 dnl Check for system libs needed
289 need_libc=false
290
291 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf asprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 if_nametoindex atoll getenv putenv setenv gmtime_r ctime_r localtime_r lrintf)
292
293 dnl Check for usual libc functions
294 AC_CHECK_FUNCS(strdup strndup atof lseek)
295 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
296 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
297 AC_CHECK_FUNCS(strcasestr,,[AC_CHECK_FUNCS(stristr)])
298
299 dnl Check for setlocal and langinfo
300 AC_CHECK_FUNCS(setlocale)
301 AC_CHECK_HEADERS(langinfo.h)
302 AC_CHECK_FUNCS(nl_langinfo)
303
304 AC_CACHE_CHECK([for nl_langinfo and CODESET], ac_cv_langinfo_codeset,
305   [AC_TRY_LINK([#include <langinfo.h>],
306     [char* cs = nl_langinfo(CODESET);],
307     ac_cv_langinfo_codeset=yes,
308     ac_cv_langinfo_codeset=no)
309   ])
310 if test ${ac_cv_langinfo_codeset} = yes; then
311   AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
312     [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
313 fi
314
315 AC_CHECK_FUNCS(connect,,[
316   AC_CHECK_LIB(socket,connect,[
317     AX_ADD_LDFLAGS([vlc ipv4 cddax],-lsocket)
318   ])
319 ])
320
321 AC_CHECK_FUNCS(send,,[
322   AC_CHECK_LIB(socket,send,[
323     AX_ADD_LDFLAGS([access_http access_mms access_udp access_tcp access_ftp sap access_output_udp stream_out_standard],[-lsocket])
324   ])
325 ])
326
327 AC_CHECK_FUNCS(gethostbyname,,[
328   AC_CHECK_LIB(nsl,gethostbyname,[
329     AX_ADD_LDFLAGS([cddax ipv4 vlc],[-lnsl])
330   ],[
331     AC_CHECK_LIB(bind,gethostbyname,[
332       AX_ADD_LDFLAGS([ipv4 access_mms],[-lbind])
333     ])
334   ])
335 ])
336
337 dnl Check for socklen_t
338 AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
339   [AC_TRY_COMPILE(
340      [#include <sys/types.h>
341       #include <sys/socket.h>],
342      [socklen_t len = 42; return len;],
343      ac_cv_type_socklen_t=yes,
344      ac_cv_type_socklen_t=no)])
345 if test "${ac_cv_type_socklen_t}" != "no"; then
346   AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if <sys/socket.h> defines socklen_t.])
347 fi
348
349 dnl Check for va_copy
350 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
351   AC_TRY_LINK(
352     [#include <stdarg.h>],
353     [va_list ap1, ap2; va_copy(ap1,ap2);],
354     [ac_cv_c_va_copy="yes"],
355     [ac_cv_c_va_copy="no"]))
356 if test "${ac_cv_c_va_copy}" = "yes"; then
357   AC_DEFINE(HAVE_VA_COPY, 1, [Define if <stdarg.h> defines va_copy.])
358 fi
359 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
360   AC_TRY_LINK(
361     [#include <stdarg.h>],
362     [va_list ap1, ap2; __va_copy(ap1,ap2);],
363     [ac_cv_c___va_copy="yes"],
364     [ac_cv_c___va_copy="no"]))
365 if test "${ac_cv_c___va_copy}" = "yes"; then
366   AC_DEFINE(HAVE___VA_COPY, 1, [Define if <stdarg.h> defines __va_copy.])
367 fi
368
369 AC_CHECK_FUNCS(inet_aton,,[
370   AC_CHECK_LIB(resolv,inet_aton,[
371     AX_ADD_LDFLAGS([ipv4 vlc],[-lresolv])
372   ])
373 ])
374
375 dnl Check for getopt (always use builtin one on win32)
376 if test "${SYS}" = "mingw32"; then
377 need_getopt=:
378 else
379 need_getopt=false
380 AC_CHECK_FUNCS(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
381 [ # FreeBSD has a gnugetopt library for this:
382   AC_CHECK_LIB([gnugetopt],[getopt_long],
383     [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support)
384      AX_ADD_LDFLAGS([vlc],[-lgnugetopt])],
385     [need_getopt=:])])
386 fi
387 AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
388
389 if test "${SYS}" != "mingw32"; then
390 AC_TYPE_SIGNAL
391 AC_CHECK_LIB(m,cos,[
392   AX_ADD_LDFLAGS([adjust distort a52tofloat32 dtstofloat32],[-lm])
393 ])
394 AC_CHECK_LIB(m,pow,[
395   AX_ADD_LDFLAGS([ffmpeg stream_out_transcode stream_out_transrate i420_rgb faad vlc],[-lm])
396 ])
397 AC_CHECK_LIB(m,sqrt,[
398   AX_ADD_LDFLAGS([headphone_channel_mixer],[-lm])
399 ])
400 fi # end "${SYS}" != "mingw32"
401
402 dnl Check for dynamic plugins
403 ac_cv_have_plugins=no
404
405 # OS X style
406 AC_CHECK_HEADERS(mach-o/dyld.h,
407   [AC_CHECK_FUNCS(NSLinkModule,
408     [AC_DEFINE(HAVE_DL_DYLD, 1, [Define if you have the Darwin dyld API])
409      ac_cv_have_plugins=yes])])
410
411 # HP-UX style
412 if test "${ac_cv_have_plugins}" = "no"; then
413   AC_CHECK_HEADERS(dl.h)
414   ac_cv_my_have_shl_load=no
415   AC_CHECK_FUNC(shl_load,
416    [ac_cv_my_have_shl_load=yes,
417     AC_CHECK_LIB(dld, shl_load,
418      [ac_cv_my_have_shl_load=yes
419       AX_ADD_LDFLAGS([vlc],[-ldld])])])
420   if test "${ac_cv_my_have_shl_load}" = "yes"; then
421     AC_DEFINE(HAVE_DL_SHL_LOAD, 1, [Define if you have the shl_load API])
422     ac_cv_have_plugins=yes
423   fi
424 fi
425
426 # Whatever style
427 if test "${ac_cv_have_plugins}" = "no"; then
428   AC_CHECK_LIB(dld, dld_link,
429    [AX_ADD_LDFLAGS([vlc],[-ldld])
430     AC_DEFINE(HAVE_DL_DLD_LINK, 1, [Define if you have the GNU dld library])
431     ac_cv_have_plugins=yes])
432 fi
433
434 # Win32 style
435 if test "${ac_cv_have_plugins}" = "no"; then
436   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
437     AC_CHECK_LIB(kernel32, main,
438      [AX_ADD_LDFLAGS([vlc],[-lkernel32])
439       AC_DEFINE(HAVE_DL_WINDOWS, 1, [Define if you have Windows' LoadLibrary])
440       ac_cv_have_plugins=yes])
441   fi
442 fi
443
444 # BeOS style
445 if test "${ac_cv_have_plugins}" = "no"; then
446   AC_CHECK_HEADERS(image.h)
447   AC_CHECK_FUNCS(load_add_on,
448    [AC_DEFINE(HAVE_DL_BEOS, 1, [Define if you have the BeOS dl])
449     ac_cv_have_plugins=yes])
450 fi
451
452 # Only test for dlopen() if the others didn't work
453 if test "${ac_cv_have_plugins}" = "no"; then
454   AC_CHECK_HEADERS(dlfcn.h sys/dl.h)
455   ac_cv_my_have_dlopen=no
456   AC_CHECK_FUNC(dlopen,
457     ac_cv_my_have_dlopen=yes,
458     AC_CHECK_LIB(dl, dlopen,
459       ac_cv_my_have_dlopen=yes
460       AX_ADD_LDFLAGS([vlc],[-ldl]),
461       AC_CHECK_LIB(svld, dlopen,
462         ac_cv_my_have_dlopen=yes
463         AX_ADD_LDFLAGS([vlc],[-lsvld]))))
464   if test "${ac_cv_my_have_dlopen}" = "yes"; then
465     AC_DEFINE(HAVE_DL_DLOPEN, 1, [Define if you have the dlopen API])
466     ac_cv_have_plugins=yes
467   fi
468 fi
469
470 if test "${SYS}" != "mingw32"; then
471 dnl Check for pthreads - borrowed from XMMS
472 THREAD_LIB=error
473 if test "${THREAD_LIB}" = "error"; then
474   AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
475 fi
476 if test "${THREAD_LIB}" = "error"; then
477   AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
478 fi
479 if test "${THREAD_LIB}" = "error"; then
480   AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
481 fi
482 if test "${THREAD_LIB}" = "error"; then
483   AC_CHECK_FUNCS(pthread_mutex_lock)
484   THREAD_LIB=""
485 fi
486
487 dnl Check for cthreads under GNU/Hurd for instance
488 AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
489
490 dnl
491 dnl  GNU portable threads
492 dnl
493 AC_ARG_ENABLE(pth,
494   [  --enable-pth            GNU Pth support (default disabled)],
495   [ if test "${enable_pth}" = "yes"; then
496     AC_CHECK_LIB(pth,pth_init)
497     AC_MSG_CHECKING(for pth_init in pth.h)
498     AC_EGREP_HEADER(pth_init,pth.h,[
499       AC_MSG_RESULT(yes)
500       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
501                 Define if <pth.h> defines pth_init)
502       THREAD_LIB="-lpth"
503     ],[
504       AC_MSG_RESULT(no)
505     ])
506     fi
507 ])
508
509 dnl
510 dnl  State Threads
511 dnl
512 AC_ARG_ENABLE(st,
513   [  --enable-st             State Threads (default disabled)],
514   [ if test "${enable_st}" = "yes"; then
515     AC_CHECK_LIB(st,st_init)
516     AC_MSG_CHECKING(for st_init in st.h)
517     AC_EGREP_HEADER(st_init,st.h,[
518       AC_MSG_RESULT(yes)
519       AC_DEFINE(ST_INIT_IN_ST_H, 1,
520                 Define if <st.h> defines st_init)
521       THREAD_LIB="-lst"
522     ],[
523       AC_MSG_RESULT(yes)
524     ])
525     fi
526 ])
527
528 AX_ADD_LDFLAGS([vlc plugin],[${THREAD_LIB}])
529
530 dnl Don't link with rt when using GNU-pth
531 if test "${THREAD_LIB}" != "-lpth" && test "${THREAD_LIB}" != "-lst"; then
532   dnl HP/UX port
533   AC_CHECK_LIB(rt,sem_init, [AX_ADD_LDFLAGS([vlc],[-lrt])])
534
535   have_nanosleep=false
536   AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
537     AC_CHECK_LIB(rt,nanosleep,
538       [AX_ADD_LDFLAGS([vlc],[-lrt]) have_nanosleep=:],
539       [AC_CHECK_LIB(posix4,nanosleep,
540           [AX_ADD_LDFLAGS([vlc],[-lposix4]) have_nanosleep=:])]
541     )
542   ])
543   if ${have_nanosleep}; then
544     AC_DEFINE(HAVE_NANOSLEEP, 1,
545               Define if nanosleep is available.)
546   fi
547 fi
548
549 dnl Check for misc headers
550 AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
551 AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
552   AC_MSG_RESULT(yes)
553   AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
554             Define if <pthread.h> defines pthread_cond_t.)],[
555   AC_MSG_RESULT(no)])
556
557 AC_MSG_CHECKING(for pthread_once in pthread.h)
558 AC_EGREP_HEADER(pthread_once,pthread.h,[
559   AC_MSG_RESULT(yes)
560   AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
561             Define if <pthread.h> defines pthread_once.)],[
562   AC_MSG_RESULT(no)])
563 fi # end "${SYS}" != "mingw32"
564
565 AC_MSG_CHECKING(for strncasecmp in strings.h)
566 AC_EGREP_HEADER(strncasecmp,strings.h,[
567   AC_MSG_RESULT(yes)
568   AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
569             Define if <strings.h> defines strncasecmp.)],[
570   AC_MSG_RESULT(no)])
571
572 dnl Check for headers
573 AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h stdbool.h getopt.h strings.h inttypes.h sys/int_types.h wchar.h)
574 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h)
575 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
576 if test "${SYS}" != "mingw32"; then
577 AC_CHECK_HEADERS(machine/param.h sys/shm.h altivec.h)
578 AC_CHECK_HEADERS(linux/version.h)
579 fi # end "${SYS}" != "mingw32"
580
581 AC_HEADER_TIME
582
583 dnl Check for dirent
584 need_dirent=false
585 AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
586 AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})
587
588 dnl Mac OS X and other OSes don't have declaration for nanosleep
589 if test "${SYS}" != "mingw32"; then
590 AC_MSG_CHECKING(for nanosleep in time.h)
591 AC_EGREP_HEADER(nanosleep,time.h,[
592   AC_MSG_RESULT(yes)
593   AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
594             Define if <time.h> defines nanosleep.)
595 ],[
596   AC_MSG_RESULT(no)
597 ])
598 fi # end "${SYS}" != "mingw32"
599
600 dnl Make sure we have timespecs
601 AC_MSG_CHECKING(for timespec in sys/time.h)
602 AC_EGREP_HEADER(timespec,sys/time.h,[
603   AC_MSG_RESULT(yes)
604   AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
605             Define if <sys/time.h> defines struct timespec.)
606 ],[
607   AC_MSG_RESULT(no)
608 ])
609
610 dnl Check for threads library
611 if test "${SYS}" != "mingw32"; then
612 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
613 fi # end "${SYS}" != "mingw32"
614
615 dnl Default X headers and libraries
616 if test "${x_includes}" = "NONE"; then
617   x_includes="/usr/X11R6/include"
618 fi
619 if test "${x_libraries}" = "NONE"; then
620   x_libraries="/usr/X11R6/lib"
621 fi
622
623 dnl Build the gtk_main plugins?
624 NEED_GTK_MAIN=no
625 NEED_GNOME_MAIN=no
626 NEED_GTK2_MAIN=no
627 NEED_GNOME2_MAIN=no
628
629 dnl build the qte plugin ?
630 NEED_QTE_MAIN=no
631
632 dnl Check for ntohl, etc.
633 AC_CACHE_CHECK([for ntohl in sys/param.h],
634     [ac_cv_c_ntohl_sys_param_h],
635     [CFLAGS="${CFLAGS_save} -Wall -Werror"
636      AC_TRY_COMPILE([#include <sys/param.h>],
637         [void foo() { int meuh; ntohl(meuh); }],
638         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
639 if test "${ac_cv_c_ntohl_sys_param_h}" != "no"; then
640     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
641 fi
642
643 dnl Check for inline function size limit
644 AC_CACHE_CHECK([if \$CC accepts -finline-limit],
645     [ac_cv_c_inline_limit],
646     [CFLAGS="${CFLAGS_save} -finline-limit-30000"
647      AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
648 if test "${ac_cv_c_inline_limit}" != "no"; then
649     CFLAGS_save="${CFLAGS_save} -finline-limit-30000"; CFLAGS="${CFLAGS_save}"
650     CXXFLAGS_save="${CXXFLAGS_save} -finline-limit-30000"; CXXFLAGS="${CXXFLAGS_save}"
651     OBJCFLAGS_save="${OBJCFLAGS_save} -finline-limit-30000"; OBJCFLAGS="${OBJCFLAGS_save}"
652 fi
653
654 # XXX: do this with an M4 macro?
655 #dnl Check for various -W flags
656 #for flag in "" all unreachable-code conversion sign-compare disabled-optimization
657 #do
658 #    AC_CACHE_CHECK([if \$CC accepts -W${flag}],
659 #        [ac_cv_c_W${flag}],
660 #        [CFLAGS="-W${flag} ${CFLAGS_save}"
661 #         AC_TRY_COMPILE([],,ac_cv_c_W${flag}=yes, ac_cv_c_W${flag}=no)])
662 #    if test "${ac_cv_c_W${flag}}" != "no"; then
663 #        CFLAGS_save="-W${flag} ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
664 #        CXXFLAGS_save="-W${flag} ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
665 #        OBJCFLAGS_save="-W${flag} ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
666 #    fi
667 #done
668
669 AC_CACHE_CHECK([if \$CC accepts -Wall],
670     [ac_cv_c_Wall],
671     [CFLAGS="-Wall ${CFLAGS_save}"
672      AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
673
674 AC_CACHE_CHECK([if \$CC accepts -Wconversion],
675     [ac_cv_c_Wconversion],
676     [CFLAGS="-Wconversion ${CFLAGS_save}"
677      AC_TRY_COMPILE([],,ac_cv_c_Wconversion=yes, ac_cv_c_Wconversion=no)])
678
679 AC_CACHE_CHECK([if \$CC accepts -Wunreachable-code],
680     [ac_cv_c_Wunreachable_code],
681     [CFLAGS="-Wunreachable-code ${CFLAGS_save}"
682      AC_TRY_COMPILE([],,ac_cv_c_Wunreachable_code=yes, ac_cv_c_Wunreachable_code=no)])
683
684 AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
685     [ac_cv_c_Wsign_compare],
686     [CFLAGS="-Wsign-compare ${CFLAGS_save}"
687      AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
688
689 if test "${ac_cv_c_Wall}" != "no"; then
690     CFLAGS_save="-Wall ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
691     CXXFLAGS_save="-Wall ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
692     OBJCFLAGS_save="-Wall ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
693 fi
694
695 if test "${ac_cv_c_Wsign_compare}" != "no"; then
696     CFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
697     CXXFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
698     OBJCFLAGS_save="-Wsign-compare ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
699 fi
700
701 dnl Check for -pipe
702 AC_CACHE_CHECK([if \$CC accepts -pipe],
703     [ac_cv_c_pipe],
704     [CFLAGS="${CFLAGS_save} -pipe"
705      AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
706 if test "${ac_cv_c_pipe}" != "no"; then
707     CFLAGS_save="${CFLAGS_save} -pipe"; CFLAGS="${CFLAGS_save}"
708     CXXFLAGS_save="${CXXFLAGS_save} -pipe"; CXXFLAGS="${CXXFLAGS_save}"
709     OBJCFLAGS_save="${OBJCFLAGS_save} -pipe"; OBJCFLAGS="${OBJCFLAGS_save}"
710 fi
711
712 dnl Check for various optimization flags
713 AC_CACHE_CHECK([if \$CC accepts -Os],
714     [ac_cv_c_os],
715     [CFLAGS="${CFLAGS_save} -Os"
716      AC_TRY_COMPILE([],,ac_cv_c_os=yes, ac_cv_c_os=no)])
717 if test "${ac_cv_c_os}" != "no" -a "${target_cpu}" = "mipsel"; then
718     CFLAGS_OPTIM="${CFLAGS_OPTIM} -Os"
719 fi
720
721 AC_CACHE_CHECK([if \$CC accepts -O3],
722     [ac_cv_c_o3],
723     [CFLAGS="${CFLAGS_save} -O3"
724      AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
725 if test "${ac_cv_c_o3}" != "no" -a "${target_cpu}" != "mipsel"; then
726     CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
727 fi
728
729 AC_CACHE_CHECK([if \$CC accepts -O2],
730     [ac_cv_c_o2],
731     [CFLAGS="${CFLAGS_save} -O2"
732      AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
733 if test "${ac_cv_c_o2}" != "no" -a "${target_cpu}" != "mipsel"; then
734     if test "${ac_cv_c_o3}" = "no"; then
735         CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
736     fi
737     CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O2"
738 else 
739     AC_CACHE_CHECK([if \$CC accepts -O],
740         [ac_cv_c_o],
741         [CFLAGS="${CFLAGS_save} -O"
742          AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
743     if test "${ac_cv_c_o}" != "no" -a "${target_cpu}" != "mipsel"; then
744         if test "${ac_cv_c_o3}" = "no"; then
745             CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
746         fi
747         CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
748     fi
749 fi
750
751 dnl Check for -ffast-math
752 AC_CACHE_CHECK([if \$CC accepts -ffast-math],
753     [ac_cv_c_fast_math],
754     [CFLAGS="${CFLAGS_save} -ffast-math"
755      AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
756 if test "${ac_cv_c_fast_math}" != "no"; then
757     CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
758 fi
759
760 dnl Check for -funroll-loops
761 dnl Disabled on BeOS because BeOS' gcc is buggy and may crash with it
762 if test "${SYS}" != "beos"
763 then
764   AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
765       [ac_cv_c_unroll_loops],
766       [CFLAGS="${CFLAGS_save} -funroll-loops"
767        AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
768   if test "${ac_cv_c_unroll_loops}" != "no"; then
769       CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
770   fi
771 fi
772
773 dnl Check for -fomit-frame-pointer
774 AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
775     [ac_cv_c_omit_frame_pointer],
776     [CFLAGS="${CFLAGS_save} -fomit-frame-pointer"
777      AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
778 if test "${ac_cv_c_omit_frame_pointer}" != "no"; then
779     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
780     # this plugin does not compile without -fomit-frame-pointer, damn gcc!
781     AX_ADD_CFLAGS([i420_yuy2_mmx],[-fomit-frame-pointer])
782 fi
783
784 dnl Check for -mdynamic-no-pic
785 AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
786     [ac_cv_c_dynamic_no_pic],
787     [CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
788      AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
789 if test "${ac_cv_c_dynamic_no_pic}" != "no"; then
790     AX_ADD_CFLAGS([builtin],[-mdynamic-no-pic])
791     AX_ADD_CFLAGS([libvlc],[-mdynamic-no-pic])
792 fi
793
794 dnl Check for Darwin plugin linking flags
795 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
796     [ac_cv_ld_darwin],
797     [CFLAGS="${CFLAGS_save} -bundle -undefined error -lcc_dynamic"
798      AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
799 if test "${ac_cv_ld_darwin}" != "no"; then
800     AX_ADD_LDFLAGS([plugin],[-bundle -undefined error -lcc_dynamic])
801 fi
802
803 dnl Check for standard plugin linking flags
804 dnl BeOS' gcc needs -nostart instead of -shared, even if -shared isn't harmful (just a warning)
805 if test "${SYS}" = "beos"; then
806   AX_ADD_LDFLAGS([plugin mozilla],[-nostart])
807 else
808   AC_CACHE_CHECK([if \$CC accepts -shared],
809       [ac_cv_ld_plugins],
810       [CFLAGS="${CFLAGS_save} -shared"
811        AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
812   if test "${ac_cv_ld_plugins}" != "no"; then
813     AX_ADD_LDFLAGS([plugin mozilla],[-shared])
814   fi
815 fi
816
817 dnl Check for variadic macros
818 AC_CACHE_CHECK([for variadic cpp macros],
819     [ac_cv_cpp_variadic_macros],
820     [CFLAGS="${CFLAGS_save}"
821      AC_TRY_COMPILE(
822          [#include <stdio.h>
823           #define a(b,c...) printf(b,##c)],
824          [a("foo");a("%s","bar");a("%s%s","baz","quux");],
825          ac_cv_cpp_variadic_macros=yes,
826          ac_cv_cpp_variadic_macros=no)])
827 if test "${ac_cv_cpp_variadic_macros}" != "no"; then
828     AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
829 fi
830
831 dnl Checks for __attribute__(aligned()) directive
832 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
833     [ac_cv_c_attribute_aligned],
834     [ac_cv_c_attribute_aligned=0
835         CFLAGS="${CFLAGS_save} -Werror"
836     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
837         AC_TRY_COMPILE([],
838         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
839         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
840     done
841         CFLAGS="${CFLAGS_save}"])
842 if test "${ac_cv_c_attribute_aligned}" != "0"; then
843     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
844         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
845 fi
846
847 dnl Checks for __attribute__(format()) directive
848 AC_CACHE_CHECK([__attribute__ ((format ())) support with function pointers],
849     [ac_cv_c_attribute_format],
850     [ac_cv_c_attribute_format=no
851         CFLAGS="${CFLAGS_save} -Werror"
852         AC_TRY_COMPILE([],
853         [static void (*pf_printf)(const char *, ...) __attribute__ ((format(printf,1,2)));(void)pf_printf;],
854         [ac_cv_c_attribute_format=yes])
855         CFLAGS="${CFLAGS_save}"])
856 if test "${ac_cv_c_attribute_format}" != "no"; then
857     AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
858 fi
859
860 dnl Check for __attribute__(())
861 AC_CACHE_CHECK([for __attribute__((packed))],
862   [ac_cv_c_attribute_packed],
863   [ac_cv_c_attribute_packed=no
864    AC_TRY_COMPILE(, [struct __attribute__((__packed__)) foo { int a; } b;],
865                     [ac_cv_c_attribute_packed=yes])])
866 if test "${ac_cv_c_attribute_packed}" != "no"; then
867   AC_DEFINE(HAVE_ATTRIBUTE_PACKED, 1, Support for __attribute__((packed)) for structs)
868 fi
869
870 dnl
871 dnl  Check the CPU
872 dnl
873 case "${target_cpu}" in
874   "")
875     ARCH=unknown
876     ;;
877   *)
878     ARCH="${target_cpu}"
879     ;;
880 esac
881
882 dnl
883 dnl  Enable profiling
884 dnl
885 AC_ARG_ENABLE(gprof,
886 [  --enable-gprof          gprof profiling (default disabled)])
887 AC_ARG_ENABLE(cprof,
888 [  --enable-cprof          cprof profiling (default disabled)])
889 test "${enable_gprof}" != "yes" && enable_gprof="no"
890 test "${enable_cprof}" != "yes" && enable_cprof="no"
891
892 dnl
893 dnl  default modules
894 dnl
895 AX_ADD_PLUGINS([dummy rc telnet logger gestures memcpy hotkeys netsync])
896 AX_ADD_PLUGINS([mpgv mpga m4v h264 ps pva avi asf aac mp4 rawdv nsv real aiff mjpeg])
897 AX_ADD_PLUGINS([cvdsub svcdsub spudec dvbsub mpeg_audio lpcm a52 dts cinepak])
898 AX_ADD_PLUGINS([deinterlace invert adjust wall transform distort clone crop motionblur])
899 AX_ADD_PLUGINS([float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif fixed32tofloat32 fixed32tos16 s16tofixed32 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32])
900 AX_ADD_PLUGINS([trivial_resampler ugly_resampler linear_resampler bandlimited_resampler])
901 AX_ADD_PLUGINS([trivial_channel_mixer headphone_channel_mixer])
902 AX_ADD_PLUGINS([trivial_mixer spdif_mixer float32_mixer])
903 AX_ADD_PLUGINS([aout_file])
904 AX_ADD_PLUGINS([i420_rgb i420_yuy2 i422_yuy2 i420_ymga])
905 AX_ADD_PLUGINS([m3u playlist export sgimb])
906 AX_ADD_PLUGINS([rawvideo])
907 AX_ADD_PLUGINS([wav araw demuxsub adpcm a52sys dtssys au])
908 AX_ADD_PLUGINS([access_file access_udp access_tcp access_http ipv4 access_mms])
909 AX_ADD_PLUGINS([access_ftp access_directory sap http])
910
911 dnl
912 dnl  Switch to enable a version of VLC where most modules will be builtin
913 dnl
914 AC_ARG_ENABLE(mostly-builtin,
915 [  --enable-mostly-builtin most modules will be built-in (default disabled)])
916 if test "${enable_mostly_builtin}" = "yes"; then
917   AX_ADD_BUILTINS([${PLUGINS}])
918   PLUGINS=""
919 fi
920
921 dnl
922 dnl Some plugins aren't useful on some platforms
923 dnl
924 if test "${SYS}" != "mingw32"; then
925     AX_ADD_PLUGINS([screensaver])
926 else
927     AX_ADD_PLUGINS([ntservice])
928 fi
929
930 dnl
931 dnl  Accelerated modules
932 dnl
933 MMX_MODULES="memcpymmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
934 #MMX_MODULES="${MMX_MODULES} idctmmx motionmmx"
935 MMXEXT_MODULES="memcpymmxext"
936 #MMXEXT_MODULES="${MMXEXT_MODULES} idctmmxext motionmmxext"
937 THREEDNOW_MODULES="memcpy3dn"
938 SSE_MODULES=""
939 ALTIVEC_MODULES="memcpyaltivec i420_yuy2_altivec"
940 #ALTIVEC_MODULES="${ALTIVEC_MODULES} idctaltivec motionaltivec"
941
942 if test "${enable_gprof}" != "yes"
943 then
944   MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
945 fi
946
947 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
948     [ac_cv_mmx_inline],
949     [CFLAGS="${CFLAGS_save}"
950      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
951                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
952 if test "${ac_cv_mmx_inline}" != "no"; then
953   AC_DEFINE(CAN_COMPILE_MMX, 1, Define if \$CC groks MMX inline assembly.)
954   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
955 fi
956
957 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
958     [ac_cv_mmxext_inline],
959     [CFLAGS="${CFLAGS_save}"
960      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
961                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
962 if test "${ac_cv_mmxext_inline}" != "no"; then
963   AC_DEFINE(CAN_COMPILE_MMXEXT, 1, Define if \$CC groks MMX EXT inline assembly.)
964   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
965 fi
966
967 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
968     [ac_cv_3dnow_inline],
969     [CFLAGS="${CFLAGS_save}"
970      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
971                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
972 if test "${ac_cv_3dnow_inline}" != "no"; then
973   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
974   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
975 fi
976
977 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
978     [ac_cv_sse_inline],
979     [CFLAGS="${CFLAGS_save}"
980      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
981                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
982 if test "${ac_cv_sse_inline}" != "no" -a "${SYS}" != "mingw32" -a "${SYS}" != "solaris"; then
983   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
984   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
985 fi
986
987 if test "${SYS}" != "mingw32"; then
988 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
989     [ac_cv_altivec_inline],
990     [CFLAGS="${CFLAGS_save}"
991      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
992          ac_cv_altivec_inline=yes,
993          [CFLAGS="${CFLAGS_save} -Wa,-m7400"
994           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
995             [ac_cv_altivec_inline="-Wa,-m7400"],
996             ac_cv_altivec_inline=no)
997          ])])
998 if test "${ac_cv_altivec_inline}" != "no"; then
999   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
1000   if test "${ac_cv_altivec_inline}" != "yes"; then
1001     AX_ADD_CFLAGS([idctaltivec],[${ac_cv_altivec_inline}])
1002     AX_ADD_CFLAGS([motionaltivec],[${ac_cv_altivec_inline}])
1003     AX_ADD_CFLAGS([memcpyaltivec],[${ac_cv_altivec_inline}])
1004     AX_ADD_CFLAGS([i420_yuy2_altivec],[${ac_cv_altivec_inline}])
1005     AX_ADD_CFLAGS([vlc],[${ac_cv_altivec_inline}])
1006   fi
1007   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
1008 fi
1009
1010 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
1011     [ac_cv_c_altivec],
1012     [# Darwin test
1013      CFLAGS="${CFLAGS_save} -faltivec"
1014      AC_TRY_COMPILE([],
1015        [vec_ld(0, (unsigned char *)0);],
1016        [ac_cv_c_altivec="-faltivec"],
1017        [# Linux/PPC test
1018         CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -maltivec -mabi=altivec"
1019         AC_TRY_COMPILE([#ifdef HAVE_ALTIVEC_H
1020                         #include <altivec.h>
1021                         #endif],
1022           [vec_ld(0, (unsigned char *)0);],
1023           [ac_cv_c_altivec="-maltivec -mabi=altivec"],
1024           [# Linux/PPC test (old GCC versions)
1025            CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
1026            AC_TRY_COMPILE([#ifdef HAVE_ALTIVEC_H
1027                            #include <altivec.h>
1028                            #endif],
1029              [vec_ld(0, (unsigned char *)0);],
1030              [ac_cv_c_altivec="-fvec"],
1031              [ac_cv_c_altivec=no])
1032            ])
1033         ])
1034      CFLAGS="${CFLAGS_save}"])
1035 if test "${ac_cv_c_altivec}" != "no"; then
1036   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
1037   AX_ADD_CFLAGS([vlc idctaltivec motionaltivec memcpyaltivec deinterlace i420_yuy2_altivec],[${ac_cv_c_altivec}])
1038   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
1039 fi
1040
1041 AC_CACHE_CHECK([if linker needs -framework vecLib],
1042     [ac_cv_ld_altivec],
1043     [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
1044      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
1045      LDFLAGS="${LDFLAGS_save}"
1046     ])
1047 if test "${ac_cv_ld_altivec}" != "no"; then
1048   AX_ADD_LDFLAGS([vlc idctaltivec motionaltivec memcpyaltivec],[-framework vecLib])
1049 fi
1050 fi # end "${SYS}" != "mingw32"
1051
1052 AC_ARG_WITH(,[])
1053 AC_ARG_WITH(,[Optimization options:])
1054
1055 dnl
1056 dnl  Special arch tuning
1057 dnl
1058 AC_ARG_WITH(tuning,
1059 [  --with-tuning=ARCH      enable special tuning for an architecture
1060                           (default i686 on IA-32 and 750 on PPC)])
1061 if test -n "${with_tuning}"; then
1062     if test "${target_cpu}" = "powerpc"; then
1063         CFLAGS_TUNING="-mtune=${with_tuning}"
1064     else
1065         CFLAGS_TUNING="-mcpu=${with_tuning}"
1066     fi
1067 else
1068     if test "${target_cpu}" = "i686" -o "${target_cpu}" = "i586" -o "${target_cpu}" = "i486" -o "${target_cpu}" = "i386"; then
1069         CFLAGS_TUNING="-mcpu=pentiumpro"
1070     else
1071         if test "${target_cpu}" = "powerpc"; then CFLAGS_TUNING="-mtune=750"; fi
1072     fi
1073 fi
1074
1075 dnl
1076 dnl  x86 accelerations
1077 dnl
1078 if test "${target_cpu}" = "i686" -o "${target_cpu}" = "i586" -o "${target_cpu}" = "x86" -o "${target_cpu}" = "i386"
1079 then
1080     ARCH="${ARCH} mmx"
1081     AX_ADD_BUILTINS([${ACCEL_MODULES}])
1082 fi
1083
1084 dnl
1085 dnl  Enable/disable optimizations
1086 dnl
1087 AC_ARG_ENABLE(optimizations,
1088 [  --disable-optimizations disable compiler optimizations (default enabled)])
1089 test "${enable_optimizations}" != "no" && enable_optimizations="yes"
1090
1091 dnl
1092 dnl  AltiVec acceleration
1093 dnl
1094 AC_ARG_ENABLE(altivec,
1095 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
1096 [ if test "${enable_altivec}" = "yes"; then ARCH="${ARCH} altivec";
1097     AX_ADD_BUILTINS([${ACCEL_MODULES}]) fi ],
1098 [ if test "${target_cpu}" = "powerpc"; then ARCH="${ARCH} altivec";
1099     AX_ADD_BUILTINS([${ACCEL_MODULES}]) fi ])
1100
1101 dnl
1102 dnl  Debugging mode
1103 dnl
1104 AC_ARG_ENABLE(debug,
1105 [  --enable-debug          debug mode (default disabled)])
1106 test "${enable_debug}" != "yes" && enable_debug="no"
1107
1108 dnl
1109 dnl  Enable release-specific flags
1110 dnl
1111 AC_ARG_ENABLE(release,
1112 [  --enable-release        activate extra optimizations (default disabled)])
1113 test "${enable_release}" != "yes" && enable_release="no"
1114
1115 dnl
1116 dnl Stream output
1117 dnl
1118 AC_ARG_ENABLE(sout,
1119   [  --enable-sout           Stream output modules (default enabled)])
1120 if test "${enable_sout}" != "no"
1121 then
1122   AX_ADD_PLUGINS([access_output_dummy access_output_udp access_output_file access_output_http])
1123   AX_ADD_PLUGINS([mux_ps mux_avi mux_mp4 mux_asf mux_dummy])
1124   AX_ADD_PLUGINS([packetizer_mpegvideo packetizer_h264])
1125   AX_ADD_PLUGINS([packetizer_mpeg4video packetizer_mpeg4audio])
1126   AX_ADD_PLUGINS([packetizer_copy])
1127
1128   AX_ADD_PLUGINS([stream_out_dummy stream_out_standard stream_out_es stream_out_rtp])
1129   AX_ADD_PLUGINS([stream_out_duplicate stream_out_gather])
1130 #  AX_ADD_PLUGINS([stream_out_transrate stream_out_display])
1131
1132   dnl Ogg and vorbis are handled in their respective section
1133 fi
1134
1135
1136 dnl
1137 dnl  Input plugins
1138 dnl
1139
1140 AC_ARG_WITH(,[Input plugins:])
1141
1142 dnl
1143 dnl  live.com input
1144 dnl
1145 AC_ARG_ENABLE(livedotcom,
1146 [  --enable-livedotcom     live.com input plugin (default disabled)])
1147 if test "${enable_livedotcom}" = "yes"; then
1148   AC_ARG_WITH(livedotcom-tree,
1149     [    --with-livedotcom-tree=PATH live.com tree for static linking])
1150
1151   dnl
1152   dnl test for --with-livedotcom-tree
1153   dnl
1154   if test -z "${with_livedotcom_tree}"; then
1155     AC_LANG_PUSH(C++)
1156     CPPFLAGS_save="${CPPFLAGS}"
1157     CPPFLAGS_livedotcom="-I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment"
1158     CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_livedotcom}"
1159     AC_CHECK_HEADERS(liveMedia.hh, [
1160       AX_ADD_CXXFLAGS([livedotcom], [${CPPFLAGS_livedotcom}])
1161       AC_CHECK_LIB(liveMedia_pic, main, [
1162         # We have -lliveMedia_pic, build plugins
1163         AX_ADD_PLUGINS([livedotcom])
1164         AX_ADD_LDFLAGS([livedotcom], [-lliveMedia_pic -lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic])
1165       ], [
1166         AC_CHECK_LIB(liveMedia, main, [
1167           # We only have -lliveMedia, do builtins
1168           AX_ADD_BUILTINS([livedotcom])
1169           AX_ADD_LDFLAGS([livedotcom], [-lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment])
1170         ])
1171       ])
1172       if test "${SYS}" = "mingw32"; then
1173         # add ws2_32 for closesocket, select, recv
1174         AX_ADD_LDFLAGS([livedotcom],[-lws2_32])
1175       fi
1176     ])
1177     CPPFLAGS="${CPPFLAGS_save}"
1178     AC_LANG_POP(C++)
1179   else
1180     AC_MSG_CHECKING(for liveMedia/libliveMedia.a in ${with_livedotcom_tree})
1181     real_livedotcom_tree="`cd ${with_livedotcom_tree} 2>/dev/null && pwd`"
1182     if test -z "${real_livedotcom_tree}"; then
1183       dnl  The given directory can't be found
1184       AC_MSG_RESULT(no)
1185       AC_MSG_ERROR([cannot cd to ${with_livedotcom_tree}])
1186     fi
1187     if test -f "${real_livedotcom_tree}/liveMedia/libliveMedia.a"; then
1188       AC_MSG_RESULT(${real_livedotcom_tree}/liveMedia/libliveMedia.a)
1189
1190       AX_ADD_BUILTINS([livedotcom])
1191
1192       if test "${SYS}" = "mingw32"; then
1193         # add ws2_32 for closesocket, select, recv
1194         AX_ADD_LDFLAGS([livedotcom],[-lws2_32])
1195       fi
1196
1197       AX_ADD_LDFLAGS([livedotcom],[-L${real_livedotcom_tree}/liveMedia -lliveMedia])
1198       AX_ADD_LDFLAGS([livedotcom],[-L${real_livedotcom_tree}/BasicUsageEnvironment -lBasicUsageEnvironment])
1199       AX_ADD_LDFLAGS([livedotcom],[-L${real_livedotcom_tree}/groupsock -lgroupsock])
1200       AX_ADD_LDFLAGS([livedotcom],[-L${real_livedotcom_tree}/UsageEnvironment -lUsageEnvironment])
1201
1202       AX_ADD_CXXFLAGS([livedotcom],[-I${real_livedotcom_tree}/BasicUsageEnvironment/include])
1203       AX_ADD_CXXFLAGS([livedotcom],[-I${real_livedotcom_tree}/groupsock/include])
1204       AX_ADD_CXXFLAGS([livedotcom],[-I${real_livedotcom_tree}/liveMedia/include])
1205       AX_ADD_CXXFLAGS([livedotcom],[-I${real_livedotcom_tree}/UsageEnvironment/include ])
1206     else
1207       dnl  The given live.com wasn't built
1208       AC_MSG_RESULT(no)
1209       AC_MSG_ERROR([cannot find ${real_livedotcom_tree}/liveMedia/libliveMedia.a, make sure you compiled live.com in ${with_livedotcom_tree}])
1210     fi
1211   fi
1212 fi
1213
1214
1215
1216 dnl dnl
1217 dnl dnl  DVD module: optionally check for installed libdvdcss
1218 dnl dnl
1219 dnl AC_ARG_ENABLE(dvd,
1220 dnl [  --enable-dvd            DVD input module (default enabled)])
1221 dnl if test "${enable_dvd}" != "no"
1222 dnl then
1223 dnl   AC_ARG_WITH(dvdcss,
1224 dnl   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
1225 dnl   AC_ARG_WITH(dvdcss-tree,
1226 dnl   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
1227 dnl   case "${with_dvdcss}" in
1228 dnl   ""|yes)
1229 dnl     if test -z "${with_dvdcss_tree}"
1230 dnl     then
1231 dnl       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
1232 dnl         [ AX_ADD_PLUGINS([dvd])
1233 dnl           AX_ADD_LDFLAGS([dvd dvdcss],[-ldvdcss])],
1234 dnl         [ AC_MSG_WARN([libdvdcss is no longer provided with vlc; please get libdvdcss from http://www.videolan.org/libdvdcss/ and build it. Then either use --with-dvdcss=<path/where/libdvdcss/was/installed> for dynamic linking (recommended under Unix) or --with-dvdcss-tree=<path/where/libdvdcss/was/built> for static linking (recommended under BeOS, Windows, MacOS X). Alternatively you can use --disable-dvd to disable the DVD plugin.])
1235 dnl           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
1236 dnl     else
1237 dnl       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
1238 dnl       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
1239 dnl       if test -z "${real_dvdcss_tree}"
1240 dnl       then
1241 dnl         dnl  The given directory can't be found
1242 dnl         AC_MSG_RESULT(no)
1243 dnl         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
1244 dnl       fi
1245 dnl       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
1246 dnl       then
1247 dnl         dnl  Use a custom libdvdcss
1248 dnl         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
1249 dnl         AX_ADD_BUILTINS([dvd])
1250 dnl         AX_ADD_LDFLAGS([dvd dvdcss],[-L${real_dvdcss_tree}/src/.libs -ldvdcss])
1251 dnl         AX_ADD_CPPFLAGS([dvd],[-I${real_dvdcss_tree}/src])
1252 dnl       else
1253 dnl         dnl  The given libdvdcss wasn't built
1254 dnl         AC_MSG_RESULT(no)
1255 dnl         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
1256 dnl       fi
1257 dnl     fi
1258 dnl   ;;
1259 dnl   no)
1260 dnl     dnl  Compile without dvdcss (dlopen version, works only under Linux)
1261 dnl     AX_ADD_PLUGINS([dvd])
1262 dnl     AX_ADD_CPPFLAGS([dvd],[-DGOD_DAMN_DMCA])
1263 dnl     AX_ADD_LDFLAGS([dvd],[-ldl])
1264 dnl   ;;
1265 dnl   *)
1266 dnl     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
1267 dnl     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
1268 dnl     then
1269 dnl       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
1270 dnl       AC_MSG_RESULT(yes)
1271 dnl       AX_ADD_PLUGINS([dvd])
1272 dnl       AX_ADD_LDFLAGS([dvd dvdcss],[-L${with_dvdcss}/lib -ldvdcss])
1273 dnl       AX_ADD_CPPFLAGS([dvd],[-I${with_dvdcss}/include])
1274 dnl     else
1275 dnl       dnl  No libdvdcss could be found, sorry
1276 dnl       AC_MSG_RESULT(no)
1277 dnl       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
1278 dnl     fi
1279 dnl   ;;
1280 dnl   esac
1281 dnl fi
1282 dnl 
1283 dnl dnl
1284 dnl dnl dvdread module: check for libdvdread
1285 dnl dnl
1286 dnl AC_ARG_ENABLE(dvdread,
1287 dnl [  --enable-dvdread        dvdread input module (default disabled)])
1288 dnl if test "${enable_dvdread}" != "no"
1289 dnl then
1290 dnl   AC_ARG_WITH(dvdread,
1291 dnl   [    --with-dvdread=PATH    libdvdread headers and libraries])
1292 dnl   AC_ARG_WITH(dvdread-tree,
1293 dnl   [    --with-dvdread-tree=PATH libdvdread tree for static linking])
1294 dnl   if test -z "${with_dvdread}"
1295 dnl   then
1296 dnl     if test -z "${with_dvdread_tree}"
1297 dnl     then
1298 dnl       AC_CHECK_HEADERS(dvdread/dvd_reader.h,
1299 dnl         [ AX_ADD_PLUGINS([dvdread])
1300 dnl           AX_ADD_LDFLAGS([dvdread],[-ldvdread ${LDFLAGS_dvdcss}])
1301 dnl         ],[
1302 dnl           if test -n "${enable_dvdread}"
1303 dnl           then
1304 dnl             AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
1305 dnl             AC_MSG_ERROR([cannot find libdvdread headers])
1306 dnl           fi
1307 dnl         ])
1308 dnl     else
1309 dnl       AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
1310 dnl       real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
1311 dnl       if test -z "${real_dvdread_tree}"
1312 dnl       then
1313 dnl         dnl  The given directory can't be found
1314 dnl         AC_MSG_RESULT(no)
1315 dnl         AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
1316 dnl       fi
1317 dnl       if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
1318 dnl       then
1319 dnl         dnl  Use a custom libdvdread
1320 dnl         AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
1321 dnl         AX_ADD_BUILTINS([dvdread])
1322 dnl         AX_ADD_LDFLAGS([dvdread],[-L${real_dvdread_tree}/dvdread/.libs -ldvdread ${LDFLAGS_dvdcss}])
1323 dnl         AX_ADD_CPPFLAGS([dvdread],[-I${real_dvdread_tree}])
1324 dnl       else
1325 dnl         dnl  The given libdvdread wasn't built
1326 dnl         AC_MSG_RESULT(no)
1327 dnl         AC_MSG_ERROR([cannot find ${real_dvdread_tree}/dvdread/.libs/libdvdread.a, make sure you compiled libdvdread in ${with_dvdread_tree}])
1328 dnl       fi
1329 dnl     fi
1330 dnl   else
1331 dnl     AC_MSG_CHECKING(for dvdread headers in ${with_dvdread})
1332 dnl     if test -f ${with_dvdread}/include/dvdread/dvd_reader.h
1333 dnl     then
1334 dnl       dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
1335 dnl       AC_MSG_RESULT(yes)
1336 dnl       AX_ADD_PLUGINS([dvdread])
1337 dnl       AX_ADD_LDFLAGS([dvdread],[-L${with_dvdread}/lib -ldvdread ${LDFLAGS_dvdcss}])
1338 dnl       AX_ADD_CPPFLAGS([dvdread],[-I${with_dvdread}/include])
1339 dnl     else
1340 dnl       dnl  No libdvdread could be found, sorry
1341 dnl       AC_MSG_RESULT(no)
1342 dnl       AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
1343 dnl     fi
1344 dnl   fi
1345 dnl fi
1346 dnl 
1347 dnl dnl
1348 dnl dnl dvdplay module: check for libdvdplay
1349 dnl dnl
1350 dnl AC_ARG_ENABLE(dvdplay,
1351 dnl [  --enable-dvdplay        dvdplay input module (default enabled)])
1352 dnl if test "${enable_dvdplay}" != "no"
1353 dnl then
1354 dnl   AC_ARG_WITH(dvdplay,
1355 dnl   [    --with-dvdplay=PATH    libdvdplay headers and libraries])
1356 dnl   AC_ARG_WITH(dvdplay-tree,
1357 dnl   [    --with-dvdplay-tree=PATH libdvdplay tree for static linking])
1358 dnl   if test -z "${with_dvdplay}"
1359 dnl   then
1360 dnl     if test -z "${with_dvdplay_tree}"
1361 dnl     then
1362 dnl       AC_CHECK_HEADERS(dvdplay/dvdplay.h,[
1363 dnl           AX_ADD_PLUGINS([dvdplay])
1364 dnl           AX_ADD_LDFLAGS([dvdplay],[-ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}])
1365 dnl           AX_ADD_CPPFLAGS([dvdplay],[${CPPFLAGS_dvdread}])
1366 dnl         ],[
1367 dnl           if test -n "${enable_dvdplay}"
1368 dnl           then
1369 dnl             AC_MSG_WARN([Please get libdvdplay from http://www.videolan.org/.])
1370 dnl             AC_MSG_ERROR([cannot find libdvdplay headers])
1371 dnl           fi
1372 dnl         ])
1373 dnl     else
1374 dnl       AC_MSG_CHECKING(for libdvdplay.a in ${with_dvdplay_tree})
1375 dnl       real_dvdplay_tree="`cd ${with_dvdplay_tree} 2>/dev/null && pwd`"
1376 dnl       if test -z "${real_dvdplay_tree}"
1377 dnl       then
1378 dnl         dnl  The given directory can't be found
1379 dnl         AC_MSG_RESULT(no)
1380 dnl         AC_MSG_ERROR([cannot cd to ${with_dvdplay_tree}])
1381 dnl       fi
1382 dnl       if test -f "${real_dvdplay_tree}/src/.libs/libdvdplay.a"
1383 dnl       then
1384 dnl         dnl  Use a custom libdvdplay
1385 dnl         AC_MSG_RESULT(${real_dvdplay_tree}/src/.libs/libdvdplay.a)
1386 dnl         AX_ADD_BUILTINS([dvdplay])
1387 dnl         AX_ADD_LDFLAGS([dvdplay],[-L${real_dvdplay_tree}/src/.libs -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}])
1388 dnl         AX_ADD_CPPFLAGS([dvdplay],[${CPPFLAGS_dvdread} -I${real_dvdplay_tree}/src])
1389 dnl       else
1390 dnl         dnl  The given libdvdplay wasn't built
1391 dnl         AC_MSG_RESULT(no)
1392 dnl         AC_MSG_ERROR([cannot find ${real_dvdplay_tree}/src/.libs/libdvdplay.a, make sure you compiled libdvdplay in ${with_dvdplay_tree}])
1393 dnl       fi
1394 dnl     fi
1395 dnl   else
1396 dnl     AC_MSG_CHECKING(for dvdplay headers in ${with_dvdplay})
1397 dnl     if test -f "${with_dvdplay}/include/dvdplay/dvdplay.h"
1398 dnl     then
1399 dnl       dnl  Use ${with_dvdplay}/include/dvdplay/dvdplay.h
1400 dnl       AC_MSG_RESULT(yes)
1401 dnl       AX_ADD_PLUGINS([dvdplay])
1402 dnl       AX_ADD_LDFLAGS([dvdplay],[-L${with_dvdplay}/lib -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}])
1403 dnl       AX_ADD_CPPFLAGS([dvdplay],[${CPPFLAGS_dvdread} -I${with_dvdplay}/include])
1404 dnl     else
1405 dnl       dnl  No libdvdplay could be found, sorry
1406 dnl       AC_MSG_RESULT(no)
1407 dnl       AC_MSG_ERROR([cannot find ${with_dvdplay}/include/dvdplay/dvdplay.h])
1408 dnl     fi
1409 dnl   fi
1410 dnl fi
1411
1412 dnl
1413 dnl  libdvdnav plugin
1414 dnl
1415 AC_ARG_ENABLE(dvdnav,
1416   [  --enable-dvdnav         dvdnav input module (default enabled)])
1417 if test "${enable_dvdnav}" != "no"
1418 then
1419   DVDNAV_PATH="${PATH}"
1420   AC_ARG_WITH(dvdnav-config-path,
1421     [    --with-dvdnav-config-path=PATH dvdnav-config path (default search in \$PATH)],
1422     [ if test "${with_dvdnav_config_path}" != "no"
1423       then
1424         DVDNAV_PATH="${with_dvdnav_config_path}:${PATH}"
1425       fi ])
1426   AC_PATH_PROG(DVDNAV_CONFIG, dvdnav-config, no, ${DVDNAV_PATH})
1427   if test "${DVDNAV_CONFIG}" != "no"
1428   then
1429     AX_ADD_PLUGINS([dvdnav])
1430     AX_ADD_CFLAGS([dvdnav],[`${DVDNAV_CONFIG} --cflags`])
1431     AX_ADD_LDFLAGS([dvdnav],[`${DVDNAV_CONFIG} --libs`])
1432   fi
1433 fi
1434
1435 dnl
1436 dnl  Windows DirectShow access module
1437 dnl
1438 AC_ARG_ENABLE(dshow,
1439   [  --enable-dshow          Win32 DirectShow support (default enabled on Win32)])
1440 if test "${enable_dshow}" != "no"
1441 then
1442   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
1443   then
1444       AC_CHECK_HEADERS(dshow.h,
1445       [ AX_ADD_PLUGINS([dshow])
1446         AX_ADD_CXXFLAGS([dshow],[])
1447         AX_ADD_LDFLAGS([dshow],[-lole32 -loleaut32]) ])
1448   fi
1449 fi
1450
1451 dnl
1452 dnl  libdvbpsi ts demux/mux
1453 dnl
1454 AC_ARG_ENABLE(dvbpsi,
1455 [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
1456 if test "${enable_dvbpsi}" != "no"
1457 then
1458   AC_ARG_WITH(dvbpsi,
1459   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
1460   AC_ARG_WITH(dvbpsi,
1461   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
1462   case "${with_dvbpsi}" in
1463   ""|yes)
1464     if test -z "${with_dvbpsi_tree}"
1465     then
1466       AC_CHECK_HEADERS(dvbpsi/dr.h,
1467         [ AX_ADD_PLUGINS([mux_ts ts])
1468           AX_ADD_LDFLAGS([mux_ts ts],[-ldvbpsi]) ],
1469         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
1470         [#if defined( HAVE_STDINT_H )
1471 #   include <stdint.h>
1472 #elif defined( HAVE_INTTYPES_H )
1473 #   include <inttypes.h>
1474 #endif
1475 #include <dvbpsi/dvbpsi.h>
1476 #include <dvbpsi/descriptor.h>
1477 #include <dvbpsi/pat.h>
1478 #include <dvbpsi/pmt.h>])
1479     else
1480       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
1481       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
1482       if test -z "${real_dvbpsi_tree}"
1483       then
1484         dnl  The given directory can't be found
1485         AC_MSG_RESULT(no)
1486         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
1487       fi
1488       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
1489       then
1490         dnl  Use a custom libdvbpsi
1491         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
1492         AX_ADD_BUILTINS([mux_ts ts])
1493         AX_ADD_CPPFLAGS([mux_ts ts],[-I${real_dvbpsi_tree}/src])
1494         AX_ADD_LDFLAGS([mux_ts ts],[-L${real_dvbpsi_tree}/src/.libs -ldvbpsi])
1495       else
1496         dnl  The given libdvbpsi wasn't built
1497         AC_MSG_RESULT(no)
1498         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
1499       fi
1500     fi
1501   ;;
1502   no)
1503     dnl  Compile without dvbpsi
1504   ;;
1505   *)
1506     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
1507     if test -z "${with_dvbpsi}"
1508     then
1509       LDFLAGS_test=""
1510       CPPFLAGS_test=""
1511     else
1512       LDFLAGS_test="-L${with_dvbpsi}/lib"
1513       CPPFLAGS_test="-I${with_dvbpsi}/include"
1514     fi
1515     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1516     AC_CHECK_HEADERS([dvbpsi/dr.h],[
1517       AX_ADD_PLUGINS([mux_ts ts])
1518       AX_ADD_CPPFLAGS([mux_ts ts],[${CPPFLAGS_test}])
1519       AX_ADD_LDFLAGS([mux_ts ts],[${LDFLAGS_test} -ldvbpsi])
1520
1521     ],[
1522       if test -n "${enable_dvbpsi}"
1523       then
1524         AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.1])
1525       fi
1526     ])
1527     CPPFLAGS="${CPPFLAGS_save}"
1528   ;;
1529   esac
1530 fi
1531
1532 dnl
1533 dnl  Video4Linux plugin
1534 dnl
1535 AC_ARG_ENABLE(v4l,
1536   [  --enable-v4l            Video4Linux input support (default disabled)])
1537 if test "${enable_v4l}" = "yes"
1538 then
1539   AC_ARG_WITH(v4l,
1540     [    --with-v4l=PATH       path to a v4l-enabled kernel tree],[],[])
1541   if test "${with_v4l}" != "no" -a -n "${with_v4l}"
1542   then
1543     AX_ADD_CPPFLAGS([v4l],[-I${with_v4l}/include])
1544   fi
1545
1546   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_v4l}"
1547   AC_CHECK_HEADERS(linux/videodev.h, [
1548     AX_ADD_PLUGINS([v4l])
1549   ],[])
1550   CPPFLAGS="${CPPFLAGS_save}"
1551 fi
1552
1553 dnl
1554 dnl  special access module for Hauppauge PVR cards
1555 dnl
1556 AC_ARG_ENABLE(pvr,
1557   [  --enable-pvr            PVR cards access module (default disabled)])
1558 if test "${enable_pvr}" = "yes"
1559 then
1560   AX_ADD_PLUGINS([pvr])
1561 fi
1562
1563 dnl dnl
1564 dnl dnl  VCDX and CDDAX modules
1565 dnl dnl
1566 dnl AC_ARG_ENABLE(libcdio,
1567 dnl   [  --enable-libcdio        CDDA support via libcdio (default enabled)])
1568 dnl 
1569 dnl AC_ARG_ENABLE(libcddb,
1570 dnl   [  --enable-libcddb        CDDB support for CDDAX (default enabled)])
1571 dnl 
1572 dnl AC_ARG_ENABLE(vcdx,
1573 dnl   [  --enable-vcdx           VCD support with Navigation (default enabled)])
1574 dnl 
1575 dnl AC_ARG_ENABLE(cdda,           
1576 dnl   [  --enable-cdda           CDDA plugin support (default enabled)])
1577 dnl 
1578 dnl AC_ARG_ENABLE(cddax,
1579 dnl   [  --enable-cddax          CDDAX plugin support (default enabled)])
1580 dnl 
1581 dnl if test "${enable_cddax}" != "no"
1582 dnl then
1583 dnl   PKG_CHECK_MODULES(LIBCDIO, libcdio >= 0.65,
1584 dnl    [enable_cddax="no"
1585 dnl     AC_DEFINE(HAVE_CDDAX, [], [Define for the CD-DA plugin using libcdio])
1586 dnl     AX_ADD_LDFLAGS([cddax],[$LIBCDIO_LIBS])
1587 dnl     AX_ADD_CFLAGS([cddax],[$LIBCDIO_CFLAGS])
1588 dnl     AX_ADD_PLUGINS([cddax])], 
1589 dnl    [AC_MSG_WARN(libcdio library not found)
1590 dnl    HAVE_CDDAX=no])
1591 dnl 
1592 dnl   if test x$enable_libcddb != no; then
1593 dnl     PKG_CHECK_MODULES(LIBCDDB, libcddb >= 0.9.4, [
1594 dnl       HAVE_LIBCDDB=yes 
1595 dnl       AC_DEFINE(HAVE_LIBCDDB, [], [Define this if you have libcddb installed])
1596 dnl       AX_ADD_LDFLAGS([cddax],[$LIBCDDB_LIBS])
1597 dnl       AX_ADD_CFLAGS([cddax],[$LIBCDDB_CFLAGS])
1598 dnl       ],
1599 dnl       [AC_MSG_WARN(new enough libcddb not found. CDDB access disabled) 
1600 dnl       HAVE_LIBCDDB=no])
1601 dnl   fi
1602 dnl 
1603 dnl   if test "${enable_vcdx}" != "no"
1604 dnl   then
1605 dnl     PKG_CHECK_MODULES(VCDINFO, libvcdinfo >= 0.7.20,
1606 dnl      [enable_vcd="no"
1607 dnl       AC_DEFINE(HAVE_VCDX, [], 
1608 dnl       [Define for the VCD plugin using libcdio/libvcdinfo])
1609 dnl       AX_ADD_LDFLAGS([vcdx],[$VCDINFO_LIBS])
1610 dnl       AX_ADD_CFLAGS([vcdx],[$VCDINFO_CFLAGS])
1611 dnl       AX_ADD_PLUGINS([vcdx])], 
1612 dnl      [AC_MSG_WARN(vcdinfo library not found)
1613 dnl      HAVE_VCDX=no])
1614 dnl   fi
1615 dnl fi
1616
1617 dnl
1618 dnl  VCD module
1619 dnl
1620 AC_ARG_ENABLE(vcd,
1621   [  --enable-vcd            VCD support for Linux, FreeBSD, MacOS X and Win32 (default enabled)])
1622
1623 if test "${enable_vcd}" != "no"
1624 then
1625   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1626   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1627     AC_MSG_RESULT(yes)
1628     AX_ADD_PLUGINS([vcd cdda])
1629   ],[
1630     AC_MSG_RESULT(no)
1631   ])
1632
1633   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1634   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1635     AC_MSG_RESULT(yes)
1636     AX_ADD_PLUGINS([vcd cdda])
1637     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1638   ],[
1639     AC_MSG_RESULT(no)
1640   ])
1641
1642   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1643   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1644     AC_MSG_RESULT(yes)
1645     AX_ADD_PLUGINS([vcd cdda])
1646     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1647   ],[
1648     AC_MSG_RESULT(no)
1649   ])
1650
1651   if test "${SYS}" = "bsdi" -o "${SYS}" = "mingw32"
1652   then
1653     AX_ADD_PLUGINS([vcd cdda])
1654   fi
1655
1656   if test "${SYS}" = "darwin"
1657   then
1658     AX_ADD_PLUGINS([vcd cdda])
1659     AX_ADD_LDFLAGS([vcd vcdx cdda],[-framework IOKit -framework CoreFoundation])
1660   fi
1661 fi
1662
1663 dnl
1664 dnl  Satellite input module
1665 dnl
1666 AC_ARG_ENABLE(satellite,
1667   [  --enable-satellite      satellite card support (default disabled)],
1668   [ if test "${enable_satellite}" = "yes"
1669     then
1670       AC_DEFINE(HAVE_SATELLITE, [], 
1671       [Define for the VCD plugin using libcdio/libvcdinfo])
1672       AX_ADD_PLUGINS([satellite])
1673     fi])
1674
1675 dnl
1676 dnl  DVB-S/DVB-T/DVB-C satellite/teresterial/cable input using v4l2
1677 dnl
1678 AC_ARG_ENABLE(dvb,
1679   [  --enable-dvb            DVB-S/T/C card support (default disabled)])
1680
1681 if test "${enable_dvb}" = "yes"
1682 then
1683   AC_ARG_WITH(dvb,
1684   [    --with-dvb=PATH       path to a dvb- and v4l2-enabled kernel tree],[],[])
1685   if test "${with_dvb}" != "no" -a -n "${with_dvb}"
1686   then
1687     AX_ADD_CFLAGS([dvb],[-I${with_dvb}/include])
1688   fi
1689   CPPFLAGS="${CPPFLAGS_save} -I${with_dvb}/include"
1690   AC_CHECK_HEADERS(linux/dvb/version.h linux/dvb/frontend.h, [
1691     AX_ADD_PLUGINS([dvb])
1692   ],[])
1693   CPPFLAGS="${CPPFLAGS_save}"
1694 fi
1695
1696 dnl
1697 dnl  ipv6 plugin - not for QNX yet
1698 dnl
1699 if test "${SYS}" != "nto" && test "${SYS}" != "mingw32"
1700 then
1701   have_ipv6=false
1702   AC_CHECK_FUNCS(inet_pton,[have_ipv6=:],[
1703     AC_CHECK_LIB(resolv,inet_pton,
1704       [have_ipv6=:
1705        AX_ADD_LDFLAGS([ipv6],[-lresolv])])
1706   ])
1707   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
1708   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
1709     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) have_ipv6=false])
1710   if ${have_ipv6}; then
1711     AX_ADD_PLUGINS([ipv6])
1712   fi
1713 fi
1714 if test "${SYS}" = "mingw32"
1715 then
1716   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
1717   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
1718     AX_ADD_PLUGINS([ipv6])],[AC_MSG_RESULT(no)])
1719 fi
1720
1721 dnl
1722 dnl  ogg demux plugin
1723 dnl
1724 AC_ARG_ENABLE(ogg,
1725   [  --enable-ogg            Ogg demux support (default enabled)])
1726 if test "${enable_ogg}" != "no"
1727 then
1728   AC_CHECK_HEADERS(ogg/ogg.h, [
1729     AC_CHECK_LIB( ogg, oggpack_read, [
1730       AX_ADD_PLUGINS([ogg mux_ogg])
1731       AX_ADD_LDFLAGS([ogg mux_ogg],[-logg])])
1732    ],[])
1733 fi
1734
1735 dnl
1736 dnl  matroska demux plugin
1737 dnl
1738 AC_ARG_ENABLE(mkv,
1739   [  --enable-mkv            Matroska demux support (default enabled)])
1740 if test "${enable_mkv}" != "no"; then
1741   AC_LANG_PUSH(C++)
1742   AC_CHECK_HEADERS(ebml/EbmlVersion.h, [
1743     AC_CHECK_HEADERS(matroska/KaxVersion.h, [
1744       AC_CHECK_HEADERS(matroska/KaxAttachments.h)
1745       AX_ADD_CXXFLAGS([mkv],[])
1746       AC_CHECK_LIB(ebml_pic, main, [
1747         # We have ebml_pic, that's good, we can build an mkv.so plugin !
1748         AX_ADD_PLUGINS([mkv])
1749         AX_ADD_LDFLAGS([mkv],[-lmatroska_pic -lebml_pic])
1750       ], [
1751         AC_CHECK_LIB(ebml, main, [
1752           # We only have libebml, make mkv.a a builtin
1753           AX_ADD_BUILTINS([mkv])
1754           AX_ADD_LDFLAGS([mkv],[-lmatroska -lebml])
1755         ])
1756       ])
1757     ])
1758   ])
1759   AC_LANG_POP(C++)
1760 fi
1761
1762 dnl
1763 dnl  modplug demux plugin
1764 dnl
1765 AC_ARG_ENABLE(mod,
1766   [  --enable-mod            Mod demux support (default enabled)])
1767 if test "${enable_mod}" != "no"
1768 then
1769   AC_CHECK_HEADERS(libmodplug/modplug.h, [
1770     AX_ADD_PLUGINS([mod])
1771     AX_ADD_CXXFLAGS([mod],[])
1772     AX_ADD_LDFLAGS([mod],[-lmodplug])])
1773 fi
1774
1775 dnl
1776 dnl  Codec plugins
1777 dnl
1778
1779 AC_ARG_WITH(,[Codec plugins:])
1780
1781 dnl
1782 dnl  mad plugin
1783 dnl
1784 AC_ARG_ENABLE(mad,
1785   [  --enable-mad            libmad module (default enabled)])
1786 if test "${enable_mad}" != "no"
1787 then
1788   AC_ARG_WITH(mad,
1789     [    --with-mad=PATH       path to libmad],[],[])
1790   if test "${with_mad}" != "no" -a -n "${with_mad}"
1791   then
1792     AX_ADD_CPPFLAGS([mpgatofixed32],[-I${with_mad}/include])
1793     AX_ADD_LDFLAGS([mpgatofixed32],[-L${with_mad}/lib])
1794   fi
1795
1796   AC_ARG_WITH(mad-tree,
1797     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
1798   if test "${with_mad_tree}" != "no" -a -n "${with_mad_tree}"
1799   then
1800     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
1801     if test -z "${real_mad_tree}"
1802     then
1803       dnl  The given directory can't be found
1804       AC_MSG_RESULT(no)
1805       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
1806     fi
1807     dnl  Use a custom libmad
1808     AC_MSG_CHECKING(for mad.h in ${real_mad_tree})
1809     if test -f ${real_mad_tree}/mad.h
1810     then
1811       AC_MSG_RESULT(yes)
1812       AX_ADD_CPPFLAGS([mpgatofixed32],[-I${real_mad_tree}])
1813       AX_ADD_LDFLAGS([mpgatofixed32],[-L${real_mad_tree}/.libs])
1814       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1815       AC_CHECK_LIB(mad, mad_bit_init, [
1816         AX_ADD_BUILTINS([mpgatofixed32])
1817         AX_ADD_LDFLAGS([mpgatofixed32],[-lmad])
1818         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1819       ],[])
1820       LDFLAGS="${LDFLAGS_save}"
1821     else
1822       AC_MSG_RESULT(no)
1823       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1824     fi
1825   else
1826     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mpgatofixed32}"
1827     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1828     AC_CHECK_HEADERS(mad.h, ,
1829       [ 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.]) ])
1830     AC_CHECK_LIB(mad, mad_bit_init, [
1831       AX_ADD_PLUGINS([mpgatofixed32])
1832       AX_ADD_LDFLAGS([mpgatofixed32],[-lmad])],
1833       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1834     CPPFLAGS="${CPPFLAGS_save}"
1835     LDFLAGS="${LDFLAGS_save}"
1836   fi
1837 fi
1838
1839 dnl
1840 dnl   libid3tag support (FIXME!!! doesn't work with new input)
1841 dnl
1842 dnl AC_CHECK_HEADERS(id3tag.h, [
1843 dnl   AC_CHECK_HEADERS(zlib.h, [
1844 dnl     AX_ADD_LDFLAGS([id3tag],[-lid3tag -lz])
1845 dnl     AX_ADD_PLUGINS([id3tag])]) ])
1846
1847 dnl
1848 dnl  ffmpeg decoder/demuxer plugin
1849 dnl
1850 AC_ARG_ENABLE(ffmpeg,
1851 [  --enable-ffmpeg         ffmpeg codec (default enabled)])
1852 if test "${enable_ffmpeg}" != "no"
1853 then
1854   AC_ARG_WITH(ffmpeg-mp3lame,
1855     [    --with-ffmpeg-mp3lame   if ffmpeg has been compiled with mp3lame support],
1856     [
1857       dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
1858       dnl       linker would miserably barf on multiple definitions.
1859       AX_ADD_LDFLAGS([stream_out_transcode],[])
1860       AX_ADD_LDFLAGS([ffmpeg],[-lmp3lame]) ])
1861
1862   AC_ARG_WITH(ffmpeg-faac,
1863     [    --with-ffmpeg-faac      if ffmpeg has been compiled with faac support],
1864     [
1865       dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
1866       dnl       linker would miserably barf on multiple definitions.
1867       AX_ADD_LDFLAGS([stream_out_transcode],[])
1868       AX_ADD_LDFLAGS([ffmpeg],[-lfaac]) ])
1869
1870   AC_ARG_WITH(ffmpeg-tree,
1871     [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1872
1873   dnl
1874   dnl test for !(--with-ffmpeg-tree)
1875   dnl
1876   if test "${with_ffmpeg_tree}" = "no" -o -z "${with_ffmpeg_tree}"; then
1877     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
1878     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
1879     AC_CHECK_HEADERS(ffmpeg/avcodec.h, [], [AC_MSG_ERROR([Missing header file ffmpeg/avcodec.h.])] )
1880     AC_CHECK_HEADERS(postproc/postprocess.h, [], [AC_MSG_ERROR([Missing header file postproc/postprocess.h.])] )
1881     AC_CHECK_LIB(avcodec, avcodec_init, [
1882       AX_ADD_BUILTINS([ffmpeg stream_out_transcode])
1883       AX_ADD_LDFLAGS([ffmpeg],[-lavcodec])
1884       dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
1885       dnl       linker would miserably barf on multiple definitions.
1886       AX_ADD_LDFLAGS([stream_out_transcode],[]) ],
1887        [ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (cvs version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ])
1888     AC_CHECK_LIB(avformat, av_open_input_stream, [
1889       AC_DEFINE(HAVE_LIBAVFORMAT, 1,
1890       [Define if you have ffmpeg's libavformat.])
1891       AX_ADD_LDFLAGS([ffmpeg],[-lavformat -lz]) ])
1892     LDFLAGS="${LDFLAGS_save}"
1893     CPPFLAGS="${CPPFLAGS_save}"
1894   fi
1895
1896   dnl
1897   dnl test for --with-ffmpeg-tree
1898   dnl
1899   if test "${with_ffmpeg_tree}" != "no" -a -n "${with_ffmpeg_tree}"; then
1900     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1901     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1902     if test -z "${real_ffmpeg_tree}"; then
1903       dnl  The given directory can't be found
1904       AC_MSG_RESULT(no)
1905       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1906     fi
1907     if ! test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
1908       dnl  The given libavcodec wasn't built
1909       AC_MSG_RESULT(no)
1910       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1911     fi
1912     if ! fgrep -s "pp_get_context" "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
1913       dnl  The given libavcodec wasn't built with --enable-pp
1914       AC_MSG_RESULT(no)
1915       AC_MSG_ERROR([${real_ffmpeg_tree}/libavcodec/libavcodec.a was not compiled with postprocessing support, make sure you configured ffmpeg with --enable-pp])
1916     fi
1917     dnl  Use a custom libffmpeg
1918     AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1919     AX_ADD_BUILTINS([ffmpeg stream_out_transcode])
1920     AX_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavcodec -lavcodec])
1921     AX_ADD_CPPFLAGS([ffmpeg],[-I${real_ffmpeg_tree}/libavcodec -I${real_ffmpeg_tree}/libavformat])
1922
1923     if test -f "${real_ffmpeg_tree}/libavformat/libavformat.a"; then
1924       AC_DEFINE(HAVE_LIBAVFORMAT, 1, [Define if you have ffmpeg's libavformat.])
1925       AX_ADD_LDFLAGS([ffmpeg],[-L${real_ffmpeg_tree}/libavformat -lavformat -lz])
1926       AX_ADD_CPPFLAGS([ffmpeg],[-I${real_ffmpeg_tree}/libavformat])
1927     fi
1928
1929     dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
1930     dnl       linker would miserably barf on multiple definitions.
1931     AX_ADD_LDFLAGS([stream_out_transcode],[-L${real_ffmpeg_tree}/libavcodec])
1932     AX_ADD_CPPFLAGS([stream_out_transcode],[-I${real_ffmpeg_tree}/libavcodec -I${real_ffmpeg_tree}/libavformat])
1933   fi
1934 fi
1935
1936 dnl
1937 dnl  faad decoder plugin
1938 dnl
1939 AC_ARG_ENABLE(faad,
1940 [  --enable-faad           faad codec (default disabled)])
1941 if test "${enable_faad}" = "yes"
1942 then
1943   AC_ARG_WITH(faad-tree,
1944   [    --with-faad-tree=PATH faad tree for static linking])
1945   if test -n "${with_faad_tree}"
1946   then
1947     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1948     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1949     if test -z "${real_faad_tree}"
1950     then
1951       dnl  The given directory can't be found
1952       AC_MSG_RESULT(no)
1953       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1954     fi
1955     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1956     then
1957       dnl  Use a custom faad
1958       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1959       AX_ADD_BUILTINS([faad])
1960       AX_ADD_LDFLAGS([faad],[${real_faad_tree}/libfaad/.libs/libfaad.a])
1961       AX_ADD_CPPFLAGS([faad],[-I${real_faad_tree}/include])
1962     else
1963       dnl  The given libfaad wasn't built
1964       AC_MSG_RESULT(no)
1965       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1966     fi
1967   else
1968     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
1969     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_faad}"
1970     AC_CHECK_HEADERS(faad.h, ,
1971       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1972     AC_CHECK_LIB(faad, faacDecOpen, [
1973       AX_ADD_PLUGINS([faad])
1974       AX_ADD_LDFLAGS([faad],[-lfaad]) ],
1975       AC_CHECK_LIB(faad, NeAACDecOpen, [
1976         AX_ADD_PLUGINS([faad])
1977         AX_ADD_LDFLAGS([faad],[-lfaad]) ],
1978         [ AC_MSG_ERROR([Cannot find libfaad library...]) ]))
1979     LDFLAGS="${LDFLAGS_save}"
1980     CPPFLAGS="${CPPFLAGS_save}"
1981   fi
1982 fi
1983
1984
1985 dnl dnl
1986 dnl dnl  xvid decoder plugin
1987 dnl dnl
1988 dnl AC_ARG_ENABLE(xvid,
1989 dnl [  --enable-xvid           xvid codec (default disabled)])
1990 dnl if test "${enable_xvid}" = "yes"
1991 dnl then
1992 dnl   AC_ARG_WITH(xvid,
1993 dnl     [    --with-xvid=PATH      path to xvid installation],[],[])
1994 dnl   if test "${with_xvid}" != "no" -a -n "${with_xvid}"
1995 dnl   then
1996 dnl     AX_ADD_CPPFLAGS([xvid],[-I${with_xvid}/include])
1997 dnl     AX_ADD_LDFLAGS([xvid],[-L${with_xvid}/lib])
1998 dnl   fi
1999 dnl 
2000 dnl   AC_ARG_WITH(xvid-tree,
2001 dnl   [    --with-xvid-tree=PATH xvid tree for static linking])
2002 dnl   if test -n "${with_xvid_tree}"
2003 dnl   then
2004 dnl     AC_MSG_CHECKING(for libxvidcore.a in ${with_xvid_tree})
2005 dnl     real_xvid_tree="`cd ${with_xvid_tree} 2>/dev/null && pwd`"
2006 dnl     if test -z "${real_xvid_tree}"
2007 dnl     then
2008 dnl       dnl  The given directory can't be found
2009 dnl       AC_MSG_RESULT(no)
2010 dnl       AC_MSG_ERROR([cannot cd to ${with_xvid_tree}])
2011 dnl     fi
2012 dnl     if test -f "${real_xvid_tree}/build/generic/libxvidcore.a"
2013 dnl     then
2014 dnl       dnl  Use a custom xvid
2015 dnl       AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a)
2016 dnl       AX_ADD_BUILTINS([xvid])
2017 dnl       AX_ADD_LDFLAGS([xvid],[-L${real_xvid_tree}/build/generic -lxvidcore])
2018 dnl       AX_ADD_CPPFLAGS([xvid],[-I${real_xvid_tree}/src])
2019 dnl     else
2020 dnl       dnl  The given libxvidcore wasn't built
2021 dnl       AC_MSG_RESULT(no)
2022 dnl       AC_MSG_ERROR([cannot find ${real_xvid_tree}/build/generic/libxvidcore.a, make sure you compiled libxvidcore in ${with_xvid_tree}])
2023 dnl     fi
2024 dnl   else
2025 dnl     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_xvid}"
2026 dnl     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_xvid}"
2027 dnl     AC_CHECK_HEADERS(xvid.h, ,
2028 dnl       [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
2029 dnl     AC_CHECK_LIB(xvidcore, xvid_init, [
2030 dnl       AX_ADD_PLUGINS([xvid])
2031 dnl       AX_ADD_LDFLAGS([xvid],[-lxvidcore]) ],
2032 dnl       [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
2033 dnl     LDFLAGS="${LDFLAGS_save}"
2034 dnl     CPPFLAGS="${CPPFLAGS_save}"
2035 dnl   fi
2036 dnl fi
2037
2038 dnl
2039 dnl  QuickTime plugin
2040 dnl
2041 AC_ARG_ENABLE(quicktime,
2042   [  --enable-quicktime      QuickTime module (default enabled on MacOS X)])
2043 if test "${enable_quicktime}" != "no" &&
2044   (test "${SYS}" = "darwin" || test "${enable_quicktime}" = "yes")
2045 then
2046   if test "${SYS}" = "mingw32"; then
2047     AX_ADD_BUILTINS([quicktime])
2048   else
2049   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
2050     [ AX_ADD_BUILTINS([quicktime])
2051       AX_ADD_LDFLAGS([quicktime],[-framework QuickTime -framework Carbon])
2052     ], [ AC_MSG_ERROR([cannot find QuickTime headers]) ])
2053   fi
2054 fi
2055
2056 dnl
2057 dnl MP4 module
2058 dnl
2059 AC_CHECK_HEADERS(zlib.h, [
2060   AX_ADD_LDFLAGS([mp4 skins skins2 sap],[-lz])
2061 ] )
2062
2063 AC_CHECK_HEADERS(sysfs/libsysfs.h, [
2064   AX_ADD_LDFLAGS([mp4],[-lsysfs])
2065 ] )
2066
2067 dnl
2068 dnl skins module
2069 dnl
2070 AC_CHECK_HEADERS(libtar.h, [
2071   AX_ADD_LDFLAGS([skins skins2],[-ltar])
2072 ] )
2073
2074
2075
2076 dnl
2077 dnl A52/AC3 decoder plugin
2078 dnl
2079 AC_ARG_ENABLE(a52,
2080   [  --enable-a52            A/52 support with liba52 (default enabled)])
2081 if test "${enable_a52}" != "no"
2082 then
2083   AC_ARG_WITH(a52,
2084     [    --with-a52=PATH       a52 headers and libraries])
2085   AC_ARG_WITH(a52-tree,
2086     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
2087   if test "${with_a52_tree}" != "no" -a -n "${with_a52_tree}"
2088   then
2089     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
2090     if test -z "${real_a52_tree}"
2091     then
2092       dnl  The given directory can't be found
2093       AC_MSG_RESULT(no)
2094       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
2095     fi
2096     dnl  Use a custom a52dec
2097     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
2098     if test -f ${real_a52_tree}/include/a52.h
2099     then
2100       AC_MSG_RESULT(yes)
2101       AX_ADD_CPPFLAGS([a52tofloat32],[-I${real_a52_tree}])
2102       AX_ADD_LDFLAGS([a52tofloat32],[-L${real_a52_tree}/liba52/.libs])
2103       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
2104       AC_CHECK_LIB(a52, a52_free, [
2105         AX_ADD_BUILTINS([a52tofloat32])
2106         AX_ADD_CPPFLAGS([a52tofloat32],[-DUSE_A52DEC_TREE])
2107         AX_ADD_LDFLAGS([a52tofloat32],[-la52])
2108         ],[
2109         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
2110         then
2111           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
2112         else
2113           AC_MSG_ERROR([the specified tree hasn't been compiled])
2114         fi
2115       ])
2116       LDFLAGS="${LDFLAGS_save}"
2117     else
2118       AC_MSG_RESULT(no)
2119       AC_MSG_ERROR([the specified tree doesn't have a52.h])
2120     fi
2121   else
2122     if test -z "${with_a52}"
2123     then
2124       LDFLAGS_test=""
2125       CPPFLAGS_test=""
2126     else
2127       LDFLAGS_test="-L${with_a52}/lib"
2128       CPPFLAGS_test="-I${with_a52}/include"
2129     fi
2130     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
2131     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LDFLAGS_a52tofloat32}"
2132     AC_CHECK_HEADERS(a52dec/a52.h, [
2133       AC_CHECK_LIB(a52, a52_free, [
2134         AX_ADD_PLUGINS([a52tofloat32])
2135         AX_ADD_LDFLAGS([a52tofloat32],[${LDFLAGS_test} -la52])
2136         AX_ADD_CPPFLAGS([a52tofloat32],[${CPPFLAGS_test}])
2137       ],[
2138         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.])
2139       ])
2140     ])
2141     CPPFLAGS="${CPPFLAGS_save}"
2142     LDFLAGS="${LDFLAGS_save}"
2143   fi
2144 fi
2145
2146 dnl
2147 dnl DTS Coherent Acoustics decoder plugin
2148 dnl
2149 AC_ARG_ENABLE(dts,
2150   [  --enable-dts            DTS Coherent Acoustics support with libdts (default enabled)])
2151 if test "${enable_dts}" != "no"; then
2152   AC_ARG_WITH(dts-tree,
2153     [    --with-dts-tree=PATH  libdts tree for static linking ],[],[])
2154   if test "${with_dts_tree}" != "no" -a -n "${with_dts_tree}"
2155   then
2156     real_dts_tree="`cd ${with_dts_tree} 2>/dev/null && pwd`"
2157     if test -z "${real_dts_tree}"
2158     then
2159       dnl  The given directory can't be found
2160       AC_MSG_RESULT(no)
2161       AC_MSG_ERROR([${with_dts_tree} directory doesn't exist])
2162     fi
2163     dnl  Use a custom libdts
2164     AC_MSG_CHECKING(for dts.h in ${real_dts_tree}/include)
2165     if test -f ${real_dts_tree}/include/dts.h
2166     then
2167       AC_MSG_RESULT(yes)
2168       AX_ADD_CPPFLAGS([dtstofloat32],[-I${real_dts_tree}/include])
2169       AX_ADD_LDFLAGS([dtstofloat32],[-L${real_dts_tree}/libdts])
2170       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_dtstofloat32}"
2171       AC_CHECK_LIB(dts, dts_free, [
2172         AX_ADD_BUILTINS([dtstofloat32])
2173         AX_ADD_LDFLAGS([dtstofloat32],[-ldts])
2174         ],[
2175         if test -f ${real_dts_tree}/libdts/libdts.a
2176         then
2177           AC_MSG_ERROR([make sure you have at least libdts-0.0.2])
2178         else
2179           AC_MSG_ERROR([the specified tree hasn't been compiled])
2180         fi
2181       ])
2182       LDFLAGS="${LDFLAGS_save}"
2183     else
2184       AC_MSG_RESULT(no)
2185       AC_MSG_ERROR([the specified tree doesn't have dts.h])
2186     fi
2187   else
2188     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_dtstofloat32}"
2189     AC_CHECK_HEADERS(dts.h, [
2190       AC_CHECK_LIB(dts, dts_free, [
2191         AX_ADD_PLUGINS([dtstofloat32])
2192         AX_ADD_LDFLAGS([dtstofloat32],[-ldts])
2193       ],[
2194         if test "${enable_dts}" = "yes"; then
2195           AC_MSG_ERROR([Could not find libdts on your system: you may get it from http://www.videolan.org/dtsdec.html])
2196         fi
2197       ])
2198     ])
2199     LDFLAGS="${LDFLAGS_save}"
2200   fi
2201 fi
2202
2203 dnl dnl
2204 dnl dnl  DV plugin
2205 dnl dnl
2206 dnl AC_ARG_ENABLE(dv,
2207 dnl   [  --enable-dv             DV decoder support (deprecated in favor of ffmpeg) (default disabled)])
2208 dnl if test "${enable_dv}" = "yes"
2209 dnl then
2210 dnl   AC_CHECK_HEADERS(libdv/dv.h, [
2211 dnl     AX_ADD_PLUGINS([dv])
2212 dnl     AX_ADD_LDFLAGS([dv],[-ldv])
2213 dnl    ],[])
2214 dnl fi
2215
2216 dnl
2217 dnl  Flac plugin
2218 dnl
2219 AC_ARG_ENABLE(flac,
2220   [  --enable-flac           flac decoder support (default disabled)])
2221 if test "${enable_flac}" = "yes"
2222 then
2223   AC_CHECK_HEADERS(FLAC/stream_decoder.h, [
2224     AX_ADD_PLUGINS([flac flacdec])
2225     AX_ADD_LDFLAGS([flacdec],[-lFLAC])
2226    ],[])
2227 fi
2228
2229 dnl
2230 dnl  Libmpeg2 plugin
2231 dnl
2232 AC_ARG_ENABLE(libmpeg2,
2233   [  --enable-libmpeg2       libmpeg2 decoder support (default enabled)])
2234 if test "${enable_libmpeg2}" != "no"
2235 then
2236   AC_ARG_WITH(libmpeg2-tree,
2237   [    --with-libmpeg2-tree=PATH libmpeg2 tree for static linking])
2238   if test -n "${with_libmpeg2_tree}"
2239   then
2240     AC_MSG_CHECKING(for libmpeg2.a in ${with_libmpeg2_tree})
2241     real_libmpeg2_tree="`cd ${with_libmpeg2_tree} 2>/dev/null && pwd`"
2242     if test -z "${real_libmpeg2_tree}"
2243     then
2244       dnl  The given directory can't be found
2245       AC_MSG_RESULT(no)
2246       AC_MSG_ERROR([cannot cd to ${with_libmpeg2_tree}])
2247     fi
2248     if test -f "${real_libmpeg2_tree}/libmpeg2/.libs/libmpeg2.a"
2249     then
2250       dnl  Use a custom libmpeg2
2251       AC_MSG_RESULT(${real_libmpeg2_tree}/libmpeg2/.libs/libmpeg2.a)
2252       AX_ADD_PLUGINS([libmpeg2])
2253       AX_ADD_LDFLAGS([libmpeg2],[-L${real_libmpeg2_tree}/libmpeg2/.libs -lmpeg2])
2254       AX_ADD_CFLAGS([libmpeg2],[-I${real_libmpeg2_tree}/include])
2255       eval "`cd ${real_libmpeg2_tree}/include && ln -sf . mpeg2dec 2>/dev/null`"
2256     else
2257       dnl  The given libmpeg2 wasn't built
2258       AC_MSG_RESULT(no)
2259       AC_MSG_ERROR([cannot find ${real_libmpeg2_tree}/libmpeg2/.libs/libmpeg2.a, make sure you compiled libmpeg2 in ${with_libmpeg2_tree}])
2260     fi
2261   else
2262     AC_CHECK_HEADERS(mpeg2dec/mpeg2.h, [
2263       AC_MSG_CHECKING(for libmpeg2 version >= 0.3.2)
2264       AC_EGREP_CPP(yes,
2265         [#include <mpeg2dec/mpeg2.h>
2266          #ifdef MPEG2_RELEASE
2267          #if MPEG2_RELEASE >= MPEG2_VERSION(0,3,2)
2268          yes
2269          #endif
2270          #endif],
2271         [AC_MSG_RESULT([yes])
2272           AX_ADD_PLUGINS([libmpeg2])
2273           AX_ADD_LDFLAGS([libmpeg2],[-lmpeg2])],
2274         [AC_MSG_RESULT([no])
2275           AC_MSG_ERROR([Your libmpeg2 is too old (you need the cvs version): you may get a more recent one from http://libmpeg2.sf.net/. Alternatively you can use --disable-libmpeg2 to disable the libmpeg2 plugin.])])],
2276
2277       [AC_MSG_ERROR([Could not find libmpeg2 on your system: you may get it from http://libmpeg2.sf.net/ (you need the cvs version). Alternatively you can use --disable-libmpeg2 to disable the libmpeg2 plugin.])]
2278     )
2279   fi
2280 fi
2281
2282 dnl
2283 dnl  Vorbis plugin
2284 dnl
2285 AC_ARG_ENABLE(vorbis,
2286   [  --enable-vorbis         Vorbis decoder support (default enabled)])
2287 if test "${enable_vorbis}" != "no"
2288 then
2289   AC_CHECK_HEADERS(vorbis/codec.h, [
2290     AX_ADD_PLUGINS([vorbis])
2291     AX_ADD_LDFLAGS([vorbis],[-lvorbis -logg]) ],[])
2292
2293   AC_CHECK_HEADERS(vorbis/vorbisenc.h, [
2294     AX_ADD_LDFLAGS([vorbis],[-lvorbisenc]) ],[])
2295 fi
2296
2297 dnl
2298 dnl  Tremor plugin
2299 dnl
2300 AC_ARG_ENABLE(tremor,
2301   [  --enable-tremor         Tremor decoder support (default disabled)])
2302 if test "${enable_tremor}" = "yes"
2303 then
2304   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
2305     AX_ADD_PLUGINS([tremor])
2306     AX_ADD_LDFLAGS([tremor],[-lvorbisidec -logg])
2307    ],[])
2308 fi
2309
2310 dnl
2311 dnl  Speex plugin
2312 dnl
2313 AC_ARG_ENABLE(speex,
2314   [  --enable-speex          Speex decoder support (default enabled)])
2315 if test "${enable_speex}" != "no"
2316 then
2317   AC_CHECK_HEADERS(speex.h, [
2318     AC_MSG_CHECKING(for libspeex version > 1.1.0)
2319     AC_EGREP_CPP(yes,
2320       [#include <speex.h>
2321        #ifdef SPEEX_SET_SUBMODE_ENCODING
2322        yes
2323        #endif],
2324       [ AC_MSG_RESULT([yes])
2325         AX_ADD_PLUGINS([speex])
2326         AX_ADD_LDFLAGS([speex],[-lspeex]) ],
2327       [ AC_MSG_RESULT([no])
2328         AC_MSG_WARN([Your libspeex is too old, please get the development
2329                      version.]) ] )
2330     ],[])
2331 fi
2332
2333 dnl
2334 dnl  tarkin decoder plugin
2335 dnl
2336 AC_ARG_ENABLE(tarkin,
2337 [  --enable-tarkin         experimental tarkin codec (default disabled)])
2338 if test "${enable_tarkin}" = "yes"
2339 then
2340   AC_ARG_WITH(tarkin-tree,
2341   [    --with-tarkin-tree=PATH tarkin tree for static linking])
2342   if test -n "${with_tarkin_tree}"
2343   then
2344     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
2345     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
2346     if test -f "${real_tarkin_tree}/tarkin.o"
2347     then
2348       AX_ADD_BUILTINS([tarkin])
2349       AX_ADD_CPPFLAGS([tarkin],[-I${real_tarkin_tree}])
2350       AX_ADD_LDFLAGS([tarkin],[${real_tarkin_tree}/mem.o ${real_tarkin_tree}/pnm.o ${real_tarkin_tree}/wavelet.o ${real_tarkin_tree}/wavelet_xform.o ${real_tarkin_tree}/wavelet_coeff.o ${real_tarkin_tree}/yuv.o ${real_tarkin_tree}/tarkin.o ${real_tarkin_tree}/info.o -logg])
2351       AC_MSG_RESULT(yes)
2352     else
2353       dnl  The given tarkin tree wasn't built
2354       AC_MSG_RESULT(no)
2355       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
2356                     make sure you compiled tarkin in ${with_tarkin_tree}])
2357     fi
2358   fi
2359 fi
2360
2361 dnl
2362 dnl  theora decoder plugin
2363 dnl
2364 AC_ARG_ENABLE(theora,
2365 [  --enable-theora         experimental theora codec (default disabled)])
2366 if test "${enable_theora}" = "yes"
2367 then
2368   AC_CHECK_HEADERS(theora/theora.h, [
2369     AC_CHECK_LIB(theora, theora_granule_time, [
2370       if test "${SYS}" = "mingw32"; then
2371         AX_ADD_PLUGINS([theora])
2372       else
2373         AX_ADD_BUILTINS([theora])
2374       fi
2375       theora_libs="-ltheora -logg"
2376       AX_ADD_LDFLAGS([theora],[${theora_libs}]) ],[
2377       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
2378 You also need to check that you have a libogg posterior to the 1.0 release.])],
2379       [-logg])
2380   ])
2381 fi
2382
2383 dnl
2384 dnl   subsdec support
2385 dnl
2386 AX_ADD_LDFLAGS([subsdec],[${LIBICONV}])
2387 AX_ADD_CPPFLAGS([subsdec],[${INCICONV}])
2388 AX_ADD_PLUGINS([subsdec])
2389
2390 dnl
2391 dnl  CMML plugin
2392 dnl
2393 AC_ARG_ENABLE(cmml,
2394   [  --enable-cmml           CMML support (default enabled)])
2395 if test "${enable_cmml}" != "no"
2396 then
2397   AX_ADD_PLUGINS([cmml])
2398 fi
2399
2400
2401 dnl
2402 dnl  Video Filters
2403 dnl
2404
2405 dnl
2406 dnl   png
2407 dnl
2408 AC_CHECK_HEADERS(png.h, [
2409     AX_ADD_LDFLAGS([logo],[-lpng -lz])
2410     AX_ADD_PLUGINS([logo])
2411     AX_ADD_LDFLAGS([svcdsub],[-lpng -lz])
2412     AX_ADD_LDFLAGS([cvdsub],[-lpng -lz -lm])
2413     AC_DEFINE(HAVE_LIBPNG, [], [Define if you have the PNG library: libpng])])
2414
2415 dnl
2416 dnl  Video plugins
2417 dnl
2418
2419 AC_ARG_WITH(,[Video plugins:])
2420
2421 dnl Check for DPMS
2422 if test "${SYS}" != "mingw32"
2423 then
2424   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
2425   AC_CHECK_HEADERS(X11/extensions/dpms.h, [
2426     AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
2427     AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
2428       AC_MSG_RESULT(yes)
2429       AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
2430                 Define if <X11/extensions/dpms.h> defines DPMSInfo.)
2431     ],[
2432       AC_MSG_RESULT(no)
2433     ])
2434   ],,[
2435     #include <X11/Xlib.h>
2436   ])
2437   CPPFLAGS="${CPPFLAGS_save}"
2438 fi
2439
2440 dnl
2441 dnl  X11 module
2442 dnl  (enabled by default except on win32)
2443 dnl
2444 AC_ARG_ENABLE(x11,
2445   [  --enable-x11            X11 support (default enabled)])
2446 if test "${enable_x11}" != "no" &&
2447   (test "${SYS}" != "mingw32" || test "${enable_x11}" = "yes"); then
2448   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
2449   AC_CHECK_HEADERS(X11/Xlib.h, [
2450     AX_ADD_PLUGINS([x11])
2451     AX_ADD_LDFLAGS([x11],[-L${x_libraries} -lX11 -lXext])
2452     AX_ADD_CPPFLAGS([x11],[-I${x_includes}])
2453   ])
2454   CPPFLAGS="${CPPFLAGS_save}"
2455 fi
2456
2457 dnl
2458 dnl  XVideo module
2459 dnl  (enabled by default except on win32)
2460 dnl
2461 AC_ARG_ENABLE(xvideo,
2462   [  --enable-xvideo         XVideo support (default enabled)])
2463 if test "${enable_xvideo}" != "no" &&
2464   (test "${SYS}" != "mingw32" || test "${enable_xvideo}" = "yes"); then
2465   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
2466   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
2467     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
2468     AC_CHECK_LIB(Xv,XvPutImage,[
2469       # If libXv.so is available, xvideo can be a plugin. Otherwise, we
2470       # test for libXv_pic.
2471       if test -f /usr/X11R6/lib/libXv.so -o -f "${x_libraries}"/libXv.so; then
2472         AX_ADD_PLUGINS([xvideo])
2473         AX_ADD_CPPFLAGS([xvideo],[-I${x_includes}])
2474         AX_ADD_LDFLAGS([xvideo],[-L${x_libraries} -lX11 -lXext -lXv])
2475       else
2476         AC_CHECK_LIB(Xv_pic,XvPutImage,[
2477           AX_ADD_PLUGINS([xvideo])
2478           AX_ADD_CPPFLAGS([xvideo],[-I${x_includes}])
2479           AX_ADD_LDFLAGS([xvideo],[-L${x_libraries} -lX11 -lXext -lXv_pic])
2480         ],[
2481           AX_ADD_BUILTINS([xvideo])
2482           AX_ADD_LDFLAGS([xvideo],[-L${x_libraries} -lX11 -lXext -lXv])
2483           AX_ADD_CPPFLAGS([xvideo],[-I${x_includes}])
2484         ])
2485       fi
2486     ])
2487     CFLAGS="${CFLAGS_save}"
2488   ]
2489   CPPFLAGS="${CPPFLAGS_save}")
2490 fi
2491
2492 dnl
2493 dnl  Check for the Xinerama extension
2494 dnl
2495 if test "${enable_xvideo}" != "no" &&
2496   (test "${SYS}" != "mingw32" || test "${enable_xvideo}" = "yes"); then
2497   ac_cv_have_xinerama="no"
2498   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
2499   CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
2500   AC_CHECK_HEADERS(X11/extensions/Xinerama.h,[
2501     AC_CHECK_LIB(Xinerama_pic, XineramaQueryExtension,[
2502       AX_ADD_LDFLAGS([xvideo],[-lXinerama_pic])
2503       AX_ADD_LDFLAGS([x11],[-lXinerama_pic])
2504       ac_cv_have_xinerama="yes"
2505     ],[
2506       AC_CHECK_LIB(Xinerama, XineramaQueryExtension,[
2507         AX_ADD_LDFLAGS([xvideo],[-lXinerama])
2508         AX_ADD_LDFLAGS([x11],[-lXinerama])
2509         ac_cv_have_xinerama="yes"
2510       ])
2511     ])
2512   ])
2513   if test "${ac_cv_have_xinerama}" = "yes"; then
2514     AC_DEFINE(HAVE_XINERAMA, 1, [Define this if you have libXinerama installed])
2515   fi
2516   CFLAGS="${CFLAGS_save}"
2517   CPPFLAGS="${CPPFLAGS_save}"
2518 fi
2519
2520 dnl
2521 dnl  SDL module
2522 dnl
2523 AC_ARG_ENABLE(sdl,
2524   [  --enable-sdl            SDL support (default enabled)])
2525 if test "${enable_sdl}" != "no"
2526 then
2527   SDL_PATH="${PATH}"
2528   AC_ARG_WITH(sdl-config-path,
2529     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
2530     [ if test "${with_sdl_config_path}" != "no"
2531       then
2532         SDL_PATH="${with_sdl_config_path}:${PATH}"
2533       fi ])
2534   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
2535   SDL_CONFIG="${SDL12_CONFIG}"
2536   SDL_HEADER="SDL12/SDL.h"
2537   if test "${SDL_CONFIG}" = "no"
2538   then
2539     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
2540     SDL_CONFIG=${SDL11_CONFIG}
2541     SDL_HEADER="SDL11/SDL.h"
2542   fi
2543   if test "${SDL_CONFIG}" = "no"
2544   then
2545     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
2546     SDL_HEADER="SDL/SDL.h"
2547   fi
2548   # check for cross-compiling
2549   SDL_PREFIX=
2550   AC_ARG_WITH(sdl-prefix,
2551     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
2552                                e.g use as:
2553                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2554   if test "${with_sdl_prefix}" != "no" -a -n "${with_sdl_prefix}"
2555   then
2556     SDL_PREFIX="--prefix=${with_sdl_prefix}"
2557   fi
2558   if test "${SDL_CONFIG}" != "no"
2559   then
2560     AX_ADD_PLUGINS([vout_sdl aout_sdl])
2561     AX_ADD_CFLAGS([vout_sdl aout_sdl],[`${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`])
2562     AX_ADD_LDFLAGS([vout_sdl aout_sdl],[`${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`])
2563     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
2564     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
2565       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
2566       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
2567           As a last resort we also test for SDL.h presence),
2568       [ AC_MSG_ERROR([The development package for SDL is not installed.
2569 Please install it and try again. Alternatively you can also configure with
2570 --disable-sdl.])
2571       ])])
2572     CPPFLAGS="${CPPFLAGS_save}"
2573     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
2574     then
2575       AC_MSG_ERROR([The development package for SDL is not installed.
2576 Please install it and try again. Alternatively you can also configure with
2577 --disable-sdl.])
2578     fi
2579   elif test "${enable_sdl}" =  "yes"
2580   then
2581     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
2582 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
2583     ])
2584   fi
2585 fi
2586
2587 dnl
2588 dnl  freetype module
2589 dnl
2590 AC_ARG_ENABLE(freetype,
2591   [  --enable-freetype       freetype support (default enabled)])
2592 AC_ARG_ENABLE(fribidi,
2593   [  --enable-fribidi        fribidi support (default enabled)])
2594 if test "${enable_freetype}" != "no"
2595 then
2596   FREETYPE_PATH="${PATH}"
2597   AC_ARG_WITH(freetype-config-path,
2598     [    --with-freetype-config-path=PATH freetype-config path (default search in \$PATH)],
2599     [ if test "${with_freetype_config_path}" != "no"
2600       then
2601         FREETYPE_PATH="${with_freetype_config_path}:${PATH}"
2602       fi ])
2603   AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no, ${FREETYPE_PATH})
2604
2605   if test "${FREETYPE_CONFIG}" != "no"
2606   then
2607     AX_ADD_PLUGINS([freetype])
2608     AX_ADD_CFLAGS([freetype],[`${FREETYPE_CONFIG} --cflags` ${INCICONV}])
2609     AX_ADD_LDFLAGS([freetype],[`${FREETYPE_CONFIG} --libs` ${LIBICONV}])
2610     AC_CHECK_HEADERS(Carbon/Carbon.h,
2611       [AX_ADD_LDFLAGS([freetype],[-framework Carbon])])
2612   elif test "${enable_freetype}" =  "yes"
2613   then
2614     AC_MSG_ERROR([I couldn't find the freetype package. You can download libfreetype2
2615 from http://www.freetype.org/, or configure with --disable-freetype. Have a nice day.
2616     ])
2617   fi
2618
2619   dnl fribidi support
2620   if test "${enable_fribidi}" != "no"
2621   then
2622     FRIBIDI_PATH="${PATH}"
2623     AC_ARG_WITH(fribidi-config-path,
2624       [    --with-fribidi-config-path=PATH fribidi-config path (default search in \$PATH)],
2625       [ if test "${with_fribidi_config_path}" != "no"
2626         then
2627           FRIBIDI_PATH="${with_fribidi_config_path}:${PATH}"
2628         fi ])
2629     AC_PATH_PROG(FRIBIDI_CONFIG, fribidi-config, no, ${FRIBIDI_PATH})
2630
2631     if test "${FRIBIDI_CONFIG}" != "no"
2632     then
2633       AX_ADD_CFLAGS([freetype], [`${FRIBIDI_CONFIG} --cflags` -DHAVE_FRIBIDI])
2634       AX_ADD_LDFLAGS([freetype], [`${FRIBIDI_CONFIG} --libs`])
2635     fi
2636   fi
2637 fi
2638
2639 dnl
2640 dnl  SVG module
2641 dnl
2642 AC_ARG_ENABLE(svg,
2643   [  --enable-svg       SVG support (default disabled)])
2644 if test "${enable_svg}" == "yes"
2645 then
2646   PKG_CHECK_MODULES(SVG, 
2647         librsvg-2.0 >= 2.5.0,
2648         [
2649           AX_ADD_LDFLAGS([svg],[$SVG_LIBS])
2650           AX_ADD_CFLAGS([svg],[$SVG_CFLAGS])
2651           AX_ADD_PLUGINS([svg]) ],
2652         [AC_MSG_WARN(SVG library not found)])
2653 fi
2654
2655 dnl
2656 dnl  Qt Embedded module
2657 dnl  (disabled by default)
2658 dnl
2659 AC_ARG_ENABLE(qte,
2660   [  --enable-qte            QT Embedded support (default disabled)])
2661 if test "${enable_qte}" = "yes"
2662 then
2663   AC_ARG_WITH(qte,
2664   [    --with-qte=PATH       Qt Embedded headers and libraries])
2665   if test "${with_qte}" != "no" -a -n "${with_qte}"
2666   then
2667     AX_ADD_LDFLAGS([qte],[-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
2668     AX_ADD_CXXFLAGS([qte],[-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
2669   else
2670     AX_ADD_LDFLAGS([qte],[-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
2671     AX_ADD_CXXFLAGS([qte],[-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
2672   fi
2673   AX_ADD_PLUGINS([qte])
2674   NEED_QTE_MAIN=yes
2675   CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_qte}"
2676   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2677     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2678   ] )
2679   CPPFLAGS="${CPPFLAGS_save}"
2680 fi
2681
2682 dnl
2683 dnl  Qt Video output module
2684 dnl  (disabled by default)
2685 dnl
2686 dnl AC_ARG_ENABLE(qt_video,
2687 dnl   [  --enable-qt_video            QT Video Output support (default disabled)])
2688 dnl if test "${enable_qt_video}" = "yes"
2689 dnl then
2690 dnl  AX_ADD_PLUGINS([qt_video])
2691 dnl  AX_ADD_LDFLAGS([qt_video],[-L${QTDIR}/lib])
2692 dnl  LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt_video}"
2693 dnl   AC_CHECK_LIB(qt-mt,main,[
2694 dnl    AX_ADD_LDFLAGS([qt_video],[-lqt-mt])
2695 dnl  ],[
2696 dnl    AC_CHECK_LIB(qt,main,[
2697 dnl      AX_ADD_LDFLAGS([qt_video],[-lqt])
2698 dnl    ])
2699 dnl  ])
2700 dnl  NEED_QTE_MAIN=yes
2701 dnl  LDFLAGS="${LDFLAGS_save}"
2702 dnl  AX_ADD_CXXFLAGS([qt_video],[-I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include])
2703 dnl fi
2704
2705 dnl
2706 dnl Roku HD1000 Video output module
2707 dnl
2708 AC_ARG_ENABLE(hd1000v,
2709   [  --enable-hd1000v        HD1000 Video Output module (default enabled on HD1000)])
2710 if test "${enable_hd1000v}" != "no" &&
2711   (test "${SYS}" != "mingw32" || test "${enable_hd1000v}" = "yes")
2712 then
2713   AC_LANG_PUSH([C++])
2714   AC_CHECK_HEADERS([cascade/graphics/CascadeScreen.h cascade/graphics/CascadeBitmap.h],
2715   [
2716     can_build_roku="yes"
2717   ],
2718   [
2719     can_build_roku="no"
2720     AC_MSG_WARN([Not building Roku HD1000 compatible video output])
2721   ])
2722   if test "$can_build_roku" = "yes"
2723   then
2724     AX_ADD_PLUGINS([hd1000v])
2725     AX_ADD_LDFLAGS([hd1000v],[-lCascade -ldvbpsi -lmad])
2726   fi
2727   AC_LANG_POP([C++])
2728 fi
2729
2730 dnl
2731 dnl  Windows DirectX module
2732 dnl
2733 AC_ARG_ENABLE(directx,
2734   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
2735 if test "${enable_directx}" != "no"
2736 then
2737   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"
2738   then
2739     AC_ARG_WITH(directx,
2740     [    --with-directx=PATH   Win32 DirectX headers])
2741     if test -z "${with_directx}"
2742     then
2743       AC_CHECK_HEADERS(ddraw.h,
2744       [ AX_ADD_PLUGINS([vout_directx aout_directx])
2745         AX_ADD_LDFLAGS([vout_directx],[-lgdi32]) ])
2746     else
2747       AC_MSG_CHECKING(for directX headers in ${with_directx})
2748       if test -f ${with_directx}/ddraw.h
2749       then
2750         AX_ADD_PLUGINS([vout_directx aout_directx])
2751         AX_ADD_CPPFLAGS([vout_directx aout_directx],[-I${with_directx}])
2752         AX_ADD_LDFLAGS([vout_directx],[-lgdi32])
2753         AC_MSG_RESULT(yes)
2754       else
2755         AC_MSG_RESULT(no)
2756         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
2757       fi
2758     fi
2759   fi
2760 fi
2761
2762 dnl
2763 dnl  Linux framebuffer module
2764 dnl
2765 AC_ARG_ENABLE(fb,
2766   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
2767     if test "${enable_fb}" != "no"
2768     then
2769       AC_CHECK_HEADERS(linux/fb.h, [
2770         AX_ADD_PLUGINS([fb])
2771       ])
2772     fi
2773
2774 dnl
2775 dnl  Linux MGA module
2776 dnl
2777 AC_ARG_ENABLE(mga,
2778   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2779   [ if test "${enable_mga}" = "yes"
2780     then
2781       AX_ADD_PLUGINS([mga])
2782     fi ])
2783
2784 dnl
2785 dnl  SVGAlib module
2786 dnl
2787 AC_ARG_ENABLE(svgalib,
2788   [  --enable-svgalib        SVGAlib support (default disabled)])
2789 if test "${enable_svgalib}" = "yes"
2790 then
2791   AX_ADD_PLUGINS([svgalib])
2792   AX_ADD_LDFLAGS([svgalib],[-lvgagl -lvga])
2793 fi
2794
2795 dnl
2796 dnl  GGI module
2797 dnl
2798 AC_ARG_ENABLE(ggi,
2799   [  --enable-ggi            GGI support (default disabled)])
2800 if test "${enable_ggi}" = "yes"
2801 then
2802   AX_ADD_PLUGINS([ggi])
2803   AX_ADD_LDFLAGS([ggi],[-lggi])
2804   AC_ARG_WITH(ggi,
2805     [    --with-ggi=PATH       path to libggi],
2806     [ if test "${with_ggi}" != "no" -a -n "${with_ggi}"
2807       then
2808         AX_ADD_CPPFLAGS([ggi],[-I${with_ggi}/include])
2809         AX_ADD_LDFLAGS([ggi],[-L${with_ggi}/lib])
2810       fi ])
2811 fi
2812
2813 dnl
2814 dnl  Glide module
2815 dnl
2816 AC_ARG_ENABLE(glide,
2817   [  --enable-glide          Glide (3dfx) support (default disabled)])
2818 if test "${enable_glide}" = "yes"
2819 then
2820   AX_ADD_PLUGINS([glide])
2821   AX_ADD_LDFLAGS([glide],[-lglide2x -lm])
2822   AX_ADD_CPPFLAGS([glide],[-I/usr/include/glide])
2823   AC_ARG_WITH(glide,
2824     [    --with-glide=PATH     path to libglide],
2825     [ if test "${with_glide}" != "no" -a -n "${with_glide}"
2826       then
2827         AX_ADD_CPPFLAGS([glide],[-I${with_glide}/include])
2828         AX_ADD_LDFLAGS([glide],[-L${with_glide}/lib])
2829       fi ])
2830 fi
2831
2832 dnl
2833 dnl  AA plugin
2834 dnl
2835 AC_ARG_ENABLE(aa,
2836   [  --enable-aa             aalib output (default disabled)])
2837 if test "${enable_aa}" = "yes"
2838 then
2839   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2840   if test "${have_aa}" = "true"
2841   then
2842     AX_ADD_PLUGINS([aa])
2843     AX_ADD_LDFLAGS([aa],[-laa])
2844   fi
2845 fi
2846
2847 dnl
2848 dnl  libcaca plugin
2849 dnl
2850 AC_ARG_ENABLE(caca,
2851   [  --enable-caca           libcaca output (default disabled)])
2852 if test "${enable_caca}" = "yes"
2853 then
2854   CACA_PATH="${PATH}"
2855   AC_ARG_WITH(caca-config-path,
2856     [    --with-caca-config-path=PATH caca-config path (default search in \$PATH)],
2857     [ if test "${with_caca_config_path}" != "no"
2858       then
2859         CACA_PATH="${with_caca_config_path}:${PATH}"
2860       fi ])
2861   AC_PATH_PROG(CACA_CONFIG, caca-config, no, ${CACA_PATH})
2862   if test "${CACA_CONFIG}" != "no"
2863   then
2864     AX_ADD_PLUGINS([caca])
2865     AX_ADD_CFLAGS([caca],[`${CACA_CONFIG} --cflags`])
2866     AX_ADD_LDFLAGS([caca],[`${CACA_CONFIG} --plugin-libs`])
2867   fi
2868 fi
2869
2870 dnl
2871 dnl  win32 GDI plugin
2872 dnl
2873 AC_ARG_ENABLE(wingdi,
2874   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2875 if test "${enable_wingdi}" != "no"; then
2876   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
2877     AX_ADD_PLUGINS([wingdi])
2878     AX_ADD_LDFLAGS([wingdi],[-lgdi32])
2879   fi
2880 fi
2881
2882 dnl
2883 dnl  Audio plugins
2884 dnl
2885
2886 AC_ARG_WITH(,[Audio plugins:])
2887
2888 dnl
2889 dnl  OSS /dev/dsp module (enabled by default except on win32)
2890 dnl
2891 AC_ARG_ENABLE(oss,
2892   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2893
2894 if test "${enable_oss}" != "no" &&
2895   (test "${SYS}" != "mingw32" || test "${enable_oss}" = "yes")
2896 then
2897   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2898     AX_ADD_PLUGINS([oss])
2899     AC_CHECK_LIB(ossaudio,main,AX_ADD_LDFLAGS([oss],[-lossaudio]))
2900   ])
2901 fi
2902
2903 dnl
2904 dnl  Esound module
2905 dnl
2906 AC_ARG_ENABLE(esd,
2907   [  --enable-esd            Esound library support (default disabled)],
2908   [if test "${enable_esd}" = "yes"
2909    then
2910      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2911      if test "${ESD_CONFIG}" != "no"
2912      then
2913        AX_ADD_PLUGINS([esd])
2914        AX_ADD_CFLAGS([esd],[`${ESD_CONFIG} --cflags`])
2915        AX_ADD_LDFLAGS([esd],[`${ESD_CONFIG} --libs`])
2916      fi
2917    fi])
2918
2919 dnl
2920 dnl  aRts module
2921 dnl
2922 AC_ARG_ENABLE(arts,
2923   [  --enable-arts           aRts sound server (default disabled)],
2924   [if test "${enable_arts}" = "yes"
2925    then
2926      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2927      if test "${ARTS_CONFIG}" != "no"
2928      then
2929        AX_ADD_PLUGINS([arts])
2930        AX_ADD_CFLAGS([arts],[`${ARTS_CONFIG} --cflags`])
2931        AX_ADD_LDFLAGS([arts],[`${ARTS_CONFIG} --libs `])
2932      fi
2933    fi])
2934
2935 dnl
2936 dnl  ALSA module
2937 dnl
2938 AC_ARG_ENABLE(alsa,
2939   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2940   [if test "${enable_alsa}" = "yes"
2941    then
2942      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2943      if test "${have_alsa}" = "true"
2944      then
2945        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2946                        #define ALSA_PCM_NEW_SW_PARAMS_API
2947                        #include <alsa/asoundlib.h>],
2948           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2949            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2950        AX_ADD_PLUGINS([alsa])
2951        AX_ADD_LDFLAGS([alsa],[-lasound -lm -ldl])
2952      else
2953        AC_MSG_ERROR([Could not find ALSA development headers])
2954      fi
2955    fi])
2956
2957 dnl
2958 dnl  win32 waveOut plugin
2959 dnl
2960 AC_ARG_ENABLE(waveout,
2961   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2962 if test "${enable_waveout}" != "no"; then
2963   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
2964     AX_ADD_PLUGINS([waveout])
2965     AX_ADD_LDFLAGS([waveout],[-lwinmm])
2966   fi
2967 fi
2968
2969 dnl
2970 dnl  CoreAudio plugin
2971 dnl
2972 AC_ARG_ENABLE(coreaudio,
2973   [  --enable-coreaudio      CoreAudio module (default enabled on MacOS X)])
2974 if test "${enable_coreaudio}" != "no" &&
2975   (test "${SYS}" = "darwin" || test "${enable_coreaudio}" = "yes")
2976 then
2977   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h, 
2978     [ AX_ADD_BUILTINS([coreaudio])
2979       AX_ADD_LDFLAGS([coreaudio],[-framework CoreAudio])
2980       AC_MSG_CHECKING(for kAudioConverterPrimeMethod in AudioToolbox/AudioConverter.h)
2981       AC_EGREP_HEADER(kAudioConverterPrimeMethod,AudioToolbox/AudioConverter.h,[
2982         AC_MSG_RESULT(yes)
2983         AX_ADD_PLUGINS([coreaudio_resampler])
2984         AX_ADD_LDFLAGS([coreaudio_resampler],[-framework AudioToolbox])
2985       ],[ AC_MSG_RESULT(no) ])
2986     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
2987 fi
2988
2989 dnl
2990 dnl  Roku HD1000 audio
2991 dnl
2992 AC_ARG_ENABLE(hd1000a,
2993   [  --enable-hd1000a        HD1000 audio module (default enabled on HD1000)])
2994 if test "${enable_hd1000a}" != "no" &&
2995   (test "${SYS}" != "mingw32" || test "${enable_hd1000a}" = "yes")
2996 then
2997   AC_LANG_PUSH([C++])
2998   AC_CHECK_HEADERS(deschutes/libraries/hdmachinex225/PCMAudioPlayer.h, [
2999     AX_ADD_PLUGINS([hd1000a])
3000     AC_CHECK_LIB(HDMachineX225,main,AX_ADD_LDFLAGS([hd1000a],[-lHDMachineX225]))  ])
3001   AC_LANG_POP([C++])
3002 fi
3003
3004 dnl
3005 dnl  Interface plugins
3006 dnl
3007
3008 AC_ARG_WITH(,[Interface plugins:])
3009
3010 dnl special case for BeOS
3011 if test "${SYS}" = "beos"
3012 then
3013     AX_ADD_PLUGINS([beos])
3014 fi
3015
3016 dnl
3017 dnl Skins module
3018 dnl
3019 AC_ARG_ENABLE(skins,
3020   [  --enable-skins          Skins interface module (default enabled on Win32)])
3021 if test "${enable_skins}" != "no"; then
3022   if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
3023
3024     AX_ADD_PLUGINS([skins])
3025     ALIASES="${ALIASES} svlc"
3026     AX_ADD_CPPFLAGS([skins],[-U_OFF_T_ -U_off_t -Imodules/gui/skins])
3027     AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti])
3028     AX_ADD_LDFLAGS([skins],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
3029
3030   else if test "${enable_skins}" = "yes"; then
3031     AX_ADD_PLUGINS([skins])
3032     ALIASES="${ALIASES} svlc"
3033     AX_ADD_CPPFLAGS([skins],[-Imodules/gui/skins -I${x_includes} -I/usr/include/freetype2 -DX11_SKINS])
3034     AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti])
3035     AX_ADD_LDFLAGS([skins],[-L${x_libraries} -lImlib2 -lXext -lX11 -lfreetype -lpng -lz ])
3036   fi fi
3037 fi
3038
3039 dnl
3040 dnl Skins2 module
3041 dnl
3042 AC_ARG_ENABLE(skins2,
3043   [  --enable-skins2         Skins2 interface module (experimental)])
3044 if test "${enable_skins2}" = "yes" || (test "${SYS}" != "darwin" && test "${SYS}" != "beos" && test "${enable_skins2}" != "no"); then
3045
3046   dnl test for the required libraries
3047   skins2_missing_lib="no"
3048
3049   dnl freetype
3050   if test "${FREETYPE_CONFIG}" != "no"; then
3051     AX_ADD_CPPFLAGS([skins2],[`${FREETYPE_CONFIG} --cflags`])
3052     AX_ADD_LDFLAGS([skins2],[`${FREETYPE_CONFIG} --libs`])
3053   else
3054     skins2_missing_lib="yes"
3055     if test "${enable_skins2}" = "yes"; then
3056       AC_MSG_ERROR([Could not find freetype (required for skins2)])
3057     fi
3058   fi
3059
3060   dnl iconv
3061   if test "$am_cv_func_iconv" = "yes"; then
3062     AX_ADD_CPPFLAGS([skins2],[${INCICONV}])
3063     AX_ADD_LDFLAGS([skins2],[${LIBICONV} -lpng])
3064   else
3065     skins2_missing_lib="yes"
3066     if test "${enable_skins2}" = "yes"; then
3067       AC_MSG_ERROR([Could not find iconv (required for skins2)])
3068     fi
3069   fi
3070
3071   dnl libxml2
3072   XML2_PATH="${PATH}"
3073   AC_ARG_WITH(xml2-config-path,
3074     [    --with-xml2-config-path=PATH xml2-config path (default search in \$PATH)],
3075     [ if test "${with_xml2_config_path}" != "no"; then
3076         XML2_PATH="${with_xml2_config_path}:${PATH}"
3077       fi ])
3078   AC_PATH_PROG(XML2_CONFIG, xml2-config, no, ${XML2_PATH})
3079   if test "${XML2_CONFIG}" != "no"; then
3080     AX_ADD_CPPFLAGS([skins2],[`${XML2_CONFIG} --cflags`])
3081     AX_ADD_LDFLAGS([skins2],[`${XML2_CONFIG} --libs`])
3082     dnl skins2 depends on the xmlTextReader extension
3083     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_skins2}"
3084     AC_CHECK_LIB(xml2,xmlTextReaderConstName,[],[
3085       skins2_missing_lib="yes"
3086       AC_MSG_WARN([libxml2 missing the xmlTextReader extension, you should update your version; maybe you are missing libpng.])
3087       if test "${enable_skins2}" = "yes"; then
3088         AC_MSG_ERROR([libxml2 missing the xmlTextReader extension (required for skins2)])
3089       fi])
3090     LDFLAGS="${LDFLAGS_save}"
3091   else
3092     skins2_missing_lib="yes"
3093     if test "${enable_skins2}" = "yes"; then
3094       AC_MSG_ERROR([Could not find libxml2 (required for skins2)])
3095     fi
3096   fi
3097
3098   if test "${skins2_missing_lib}" = "no" && (test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"); then
3099     AX_ADD_PLUGINS([skins2])
3100     ALIASES="${ALIASES} svlc"
3101     AX_ADD_CPPFLAGS([skins2],[-U_OFF_T_ -U_off_t -Imodules/gui/skins2 -DWIN32_SKINS])
3102     AX_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3103     AX_ADD_LDFLAGS([skins2],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
3104
3105   else if test "${skins2_missing_lib}" = "no"; then
3106     AX_ADD_PLUGINS([skins2])
3107     ALIASES="${ALIASES} svlc"
3108     AX_ADD_CPPFLAGS([skins2],[-Imodules/gui/skins2 -I${x_includes} -DX11_SKINS])
3109     AX_ADD_CXXFLAGS([skins2],[-O2 -fno-rtti])
3110     AX_ADD_LDFLAGS([skins2],[-L${x_libraries} -lXext -lX11])
3111   fi fi
3112 fi
3113
3114
3115 dnl dnl
3116 dnl dnl  Gtk+ module
3117 dnl dnl
3118 dnl AC_ARG_ENABLE(gtk,
3119 dnl   [  --enable-gtk            Gtk+ support (default enabled)])
3120 dnl if test "${enable_gtk}" != "no"
3121 dnl then
3122 dnl   GTK_PATH="${PATH}"
3123 dnl   AC_ARG_WITH(gtk-config-path,
3124 dnl     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
3125 dnl     [ if test "${with_gtk_config_path}" != "no"
3126 dnl       then
3127 dnl         GTK_PATH="${with_gtk_config_path}:${PATH}"
3128 dnl       fi ])
3129 dnl   # look for gtk-config
3130 dnl   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
3131 dnl   GTK_CONFIG=${GTK12_CONFIG}
3132 dnl   if test "${GTK_CONFIG}" = "no"
3133 dnl   then
3134 dnl     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
3135 dnl   fi
3136 dnl   if test "${GTK_CONFIG}" != "no"
3137 dnl   then
3138 dnl     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
3139 dnl     then
3140 dnl       AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-gtk.])
3141 dnl     fi
3142 dnl     if test "${SYS}" != "mingw32"; then
3143 dnl       AX_ADD_CFLAGS([gtk],[`${GTK_CONFIG} --cflags gtk gthread`])
3144 dnl       AX_ADD_LDFLAGS([gtk],[`${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`])
3145 dnl     else
3146 dnl       AX_ADD_CFLAGS([gtk],[`${GTK_CONFIG} --cflags gtk`])
3147 dnl       AX_ADD_LDFLAGS([gtk],[`${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`])
3148 dnl     fi
3149 dnl     # now look for the gtk.h header
3150 dnl     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
3151 dnl     ac_cv_gtk_headers=yes
3152 dnl     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
3153 dnl       ac_cv_gtk_headers=no
3154 dnl       echo "Cannot find gtk development headers."
3155 dnl     ])
3156 dnl     if test "${ac_cv_gtk_headers}" = "yes"
3157 dnl     then
3158 dnl       AX_ADD_PLUGINS([gtk])
3159 dnl       if test "${SYS}" != "mingw32"; then
3160 dnl         NEED_GTK_MAIN=yes
3161 dnl       fi
3162 dnl       ALIASES="${ALIASES} gvlc"
3163 dnl     fi
3164 dnl     CPPFLAGS="${CPPFLAGS_save}"
3165 dnl   fi
3166 dnl fi
3167 dnl 
3168 dnl
3169 dnl  Gtk+2 module ! Disabled for now as it is unusable and confuses users
3170 dnl
3171 dnl AC_ARG_ENABLE(gtk2,
3172 dnl   [  --enable-gtk2           Gtk2 support (default disabled)])
3173 dnl if test "${enable_gtk2}" = "yes"
3174 dnl then
3175 dnl   PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
3176 dnl   AX_ADD_CFLAGS([gtk2],[${GTK2_CFLAGS}])
3177 dnl   AX_ADD_LDFLAGS([gtk2],[${GTK2_LIBS}])
3178 dnl   AX_ADD_PLUGINS([gtk2])
3179 dnl   if test "${SYS}" != "mingw32"; then
3180 dnl     NEED_GTK2_MAIN=yes
3181 dnl   fi
3182 dnl fi
3183
3184 dnl
3185 dnl  PDA Gtk+2 module
3186 dnl
3187 AC_ARG_ENABLE(pda,
3188   [  --enable-pda            PDA interface needs Gtk2 support (default disabled)])
3189 if test "x${enable_pda}" = "xyes"
3190 then
3191   PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
3192   AX_ADD_CFLAGS([gtk2],[${GTK2_CFLAGS}])
3193   AX_ADD_LDFLAGS([gtk2],[${GTK2_LIBS}])
3194   AX_ADD_CFLAGS([pda],[${GTK2_CFLAGS} ${CFLAGS_pda}])
3195   AX_ADD_LDFLAGS([pda],[${GTK2_LIBS} ${LDFLAGS_pda}])
3196   AX_ADD_PLUGINS([pda])
3197   if test "${SYS}" != "mingw32"; then
3198     NEED_GTK2_MAIN=yes
3199   fi
3200 fi
3201
3202 dnl dnl
3203 dnl dnl  Gnome module
3204 dnl dnl
3205 dnl AC_ARG_ENABLE(gnome,
3206 dnl   [  --enable-gnome          Gnome interface support (default disabled)],
3207 dnl   [if test "${enable_gnome}" = "yes"; then
3208 dnl     # look for gnome-config
3209 dnl     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
3210 dnl     if test -x ${GNOME_CONFIG}
3211 dnl     then
3212 dnl        AX_ADD_CFLAGS([gnome],[`${GNOME_CONFIG} --cflags gtk gnomeui`])
3213 dnl        AX_ADD_LDFLAGS([gnome],[`${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`])
3214 dnl     fi
3215 dnl     # now look for the gnome.h header
3216 dnl     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
3217 dnl     AC_CHECK_HEADERS(gnome.h, [
3218 dnl       AX_ADD_PLUGINS([gnome])
3219 dnl       NEED_GTK_MAIN=yes
3220 dnl       NEED_GNOME_MAIN=yes
3221 dnl       ALIASES="${ALIASES} gnome-vlc"
3222 dnl       dnl We need this because of some moronic gnomesupport.h flavours
3223 dnl       AC_MSG_CHECKING(for strndup in gnome.h)
3224 dnl       AC_EGREP_HEADER(strndup,gnome.h,[
3225 dnl         AC_MSG_RESULT(yes)
3226 dnl         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
3227 dnl                   Define if <gnome.h> defines strndup.)],[
3228 dnl         AC_MSG_RESULT(no)])
3229 dnl      ],[
3230 dnl       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
3231 dnl developement tools or remove the --enable-gnome option])
3232 dnl      ])
3233 dnl     CPPFLAGS="${CPPFLAGS_save}"
3234 dnl   fi])
3235
3236 dnl
3237 dnl  Gnome2 module ! Disabled for know as it is unuseable and confuses users
3238 dnl
3239 dnl AC_ARG_ENABLE(gnome2,
3240 dnl   [  --enable-gnome2         Gnome2 support (default disabled)])
3241 dnl if test "${enable_gnome2}" = "yes"
3242 dnl then
3243 dnl   PKG_CHECK_MODULES(GNOME2, [libgnomeui-2.0])
3244 dnl   AX_ADD_CFLAGS([gnome2],[${GNOME2_CFLAGS}])
3245 dnl   AX_ADD_LDFLAGS([gnome2],[${GNOME2_LIBS}])
3246 dnl   AX_ADD_PLUGINS([gnome2])
3247 dnl   if test "${SYS}" != "mingw32"; then
3248 dnl     NEED_GNOME2_MAIN=yes
3249 dnl   fi
3250 dnl fi
3251
3252 dnl
3253 dnl  wxWindows module
3254 dnl
3255 AC_ARG_ENABLE(wxwindows,
3256   [  --enable-wxwindows      wxWindows support (default enabled)])
3257 if test "${enable_wxwindows}" != "no"
3258 then
3259   WXWINDOWS_PATH="${PATH}"
3260   AC_ARG_WITH(wx-config-path,
3261     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
3262     [ if test "${with_wx_config_path}" != "no"
3263       then
3264         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
3265       fi ])
3266   # look for wx-config
3267   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
3268   if test "${WX_CONFIG}" != "no"
3269   then
3270     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
3271     then
3272       AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-wxwindows.])
3273     fi
3274     AC_LANG_PUSH(C++)
3275     AX_ADD_CXXFLAGS([wxwindows],[`${WX_CONFIG} --cxxflags`])
3276     AX_ADD_LDFLAGS([wxwindows],[`${WX_CONFIG} --libs`])
3277     # now look for the wxprec.h header
3278     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
3279     ac_cv_wx_headers=yes
3280     AC_CHECK_HEADERS(wx/wxprec.h, , [
3281       ac_cv_wx_headers=no
3282       echo "Cannot find wxWindows development headers."
3283     ])
3284     if test "${ac_cv_wx_headers}" = "yes"
3285     then
3286       AX_ADD_PLUGINS([wxwindows])
3287       ALIASES="${ALIASES} wxvlc"
3288     fi
3289     CPPFLAGS="${CPPFLAGS_save}"
3290     AC_LANG_POP(C++)
3291   fi
3292 fi
3293
3294 dnl dnl
3295 dnl dnl  Qt module
3296 dnl dnl
3297 dnl AC_ARG_ENABLE(qt,
3298 dnl   [  --enable-qt             Qt interface support (default disabled)],
3299 dnl   [if test "${enable_qt}" = "yes"; then
3300 dnl      AX_ADD_PLUGINS([qt])
3301 dnl      ALIASES="${ALIASES} qvlc"
3302 dnl      AX_ADD_LDFLAGS([qt],[-L${QTDIR}/lib])
3303 dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt}"
3304 dnl      AC_CHECK_LIB(qt-mt,main,[
3305 dnl        AX_ADD_LDFLAGS([qt],[-lqt-mt])
3306 dnl      ],[
3307 dnl        AC_CHECK_LIB(qt,main,[
3308 dnl          AX_ADD_LDFLAGS([qt],[-lqt])
3309 dnl        ])
3310 dnl      ])
3311 dnl      LDFLAGS="${LDFLAGS_save}"
3312 dnl      AX_ADD_CXXFLAGS([qt],[-I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include])
3313 dnl      if test -x ${QTDIR}/bin/moc
3314 dnl      then
3315 dnl        MOC=${QTDIR}/bin/moc
3316 dnl      else
3317 dnl        MOC=moc
3318 dnl      fi
3319 dnl    fi])
3320 dnl 
3321 dnl dnl
3322 dnl dnl  KDE module
3323 dnl dnl
3324 dnl AC_ARG_ENABLE(kde,
3325 dnl   [  --enable-kde            KDE interface support (default disabled)],
3326 dnl   [if test "${enable_kde}" = "yes"; then
3327 dnl      AX_ADD_PLUGINS([kde])
3328 dnl      ALIASES="${ALIASES} kvlc"
3329 dnl      AX_ADD_LDFLAGS([kde],[-L${KDEDIR}/lib])
3330 dnl      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
3331 dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
3332 dnl      AC_CHECK_LIB(kfile,main,[
3333 dnl        AX_ADD_LDFLAGS([kde],[-lkfile])
3334 dnl      ])
3335 dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
3336 dnl      AC_CHECK_LIB(kdeui,main,[
3337 dnl        AX_ADD_LDFLAGS([kde],[-lkdeui])
3338 dnl      ])
3339 dnl      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
3340 dnl      AC_CHECK_LIB(kio,main,[
3341 dnl        AX_ADD_LDFLAGS([kde],[-lkio])
3342 dnl      ])
3343 dnl      LDFLAGS="${LDFLAGS_save}"
3344 dnl      AX_ADD_CXXFLAGS([kde],[-I/usr/include/kde -I/usr/include/qt3 -I/usr/include/qt])
3345 dnl      AX_ADD_CXXFLAGS([kde],[-I${KDEDIR}/include -I${QTDIR}/include])
3346 dnl      if test -x ${QTDIR}/bin/moc
3347 dnl      then
3348 dnl        MOC=${QTDIR}/bin/moc
3349 dnl      else
3350 dnl        MOC=moc
3351 dnl      fi
3352 dnl    fi])
3353
3354 dnl
3355 dnl  Opie QT embedded module
3356 dnl
3357 AC_ARG_ENABLE(opie,
3358   [  --enable-opie           Qt embedded interface support (default disabled)],
3359   [if test "${enable_opie}" = "yes"; then
3360      AC_ARG_WITH(qte,
3361      [    --with-qte=PATH       Qt Embedded headers and libraries])
3362      if test "${with_qte}" != "no" -a -n "${with_qte}"
3363      then
3364        AX_ADD_LDFLAGS([qte],[-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte])
3365        AX_ADD_CXXFLAGS([qte],[-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti])
3366      else
3367        AX_ADD_LDFLAGS([qte],[-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`])
3368        AX_ADD_CXXFLAGS([qte],[-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`])
3369      fi
3370      CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_qte}"
3371      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
3372        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
3373      ] )
3374      CPPFLAGS="${CPPFLAGS_save}"
3375
3376      AX_ADD_PLUGINS([opie])
3377      NEED_QTE_MAIN=yes
3378      AX_ADD_LDFLAGS([opie],[-lqpe ${LDFLAGS_qte}])
3379      AX_ADD_CXXFLAGS([opie],[${CXXFLAGS_qte}])
3380      if test "${with_qte}" != "no" -a -n "${with_qte}"
3381      then
3382        MOC=${with_qte}/bin/moc
3383      else
3384        MOC=${QTDIR}/bin/moc
3385      fi
3386    fi])
3387
3388 dnl
3389 dnl  MacOS X module
3390 dnl
3391 AC_ARG_ENABLE(macosx,
3392   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
3393   [if test "${enable_macosx}" = "yes"
3394    then
3395      AX_ADD_BUILTINS([macosx])
3396      AX_ADD_LDFLAGS([macosx],[-framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC -framework OpenGL])
3397    fi],
3398   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
3399      AX_ADD_BUILTINS([macosx])
3400      AX_ADD_LDFLAGS([macosx],[-framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC -framework OpenGL])
3401    )])
3402
3403 dnl
3404 dnl  QNX RTOS module
3405 dnl
3406 AC_ARG_ENABLE(qnx,
3407   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
3408     if test "${enable_qnx}" != "no"
3409     then
3410       AC_CHECK_HEADERS(Ph.h, [
3411         AX_ADD_PLUGINS([qnx])
3412         AX_ADD_LDFLAGS([qnx],[-lasound -lph])
3413       ])
3414     fi
3415
3416 dnl
3417 dnl  ncurses module
3418 dnl
3419 AC_ARG_ENABLE(ncurses,
3420   [  --enable-ncurses        ncurses interface support (default disabled)],
3421   [if test "${enable_ncurses}" = "yes"; then
3422      AX_ADD_PLUGINS([ncurses])
3423      AX_ADD_LDFLAGS([ncurses],[-lncurses])
3424    fi])
3425
3426 dnl
3427 dnl  XOSD plugin
3428 dnl
3429 AC_ARG_ENABLE(xosd,
3430   [  --enable-xosd           xosd interface support (default disabled)])
3431 if test "${enable_xosd}" = "yes"
3432 then
3433   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
3434   AC_CHECK_LIB(xosd,xosd_set_offset,
3435       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
3436     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
3437         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
3438       AC_TRY_COMPILE([#include <xosd.h>],
3439          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
3440           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
3441   if test "${have_xosd}" = "true"
3442   then
3443     AX_ADD_PLUGINS([xosd])
3444     AX_ADD_LDFLAGS([xosd],[-lxosd])
3445   fi
3446 fi
3447
3448 dnl
3449 dnl Visualisation plugin
3450 dnl
3451 AC_ARG_ENABLE(visual,
3452   [  --enable-visual          visualisation plugin (default enabled)])
3453 if test "${enable_visual}" != "no"
3454 then
3455     AX_ADD_PLUGINS([visual])
3456 fi
3457
3458 dnl
3459 dnl  goom visualization plugin
3460 dnl
3461 AC_ARG_ENABLE(goom,
3462 [  --enable-goom           goom visualisation plugin (default disabled)])
3463 if test "${enable_goom}" = "yes"
3464 then
3465   AC_ARG_WITH(goom-tree,
3466     [    --with-goom-tree=PATH goom tree for static linking (required)])
3467
3468   dnl
3469   dnl test for --with-goom-tree
3470   dnl
3471   if test "${with_goom_tree}" != "no" -a -n "${with_goom_tree}"; then
3472     AC_MSG_CHECKING(for libgoom2.a in ${with_goom_tree})
3473     real_goom_tree="`cd ${with_goom_tree} 2>/dev/null && pwd`"
3474     if test -z "${real_goom_tree}"; then
3475       dnl  The given directory can't be found
3476       AC_MSG_RESULT(no)
3477       AC_MSG_ERROR([cannot cd to ${with_goom_tree}])
3478     fi
3479     if test -f "${real_goom_tree}/src/.libs/libgoom2.a"; then
3480       AC_MSG_RESULT(${real_goom_tree}/src/.libs/libgoom2.a)
3481       AX_ADD_BUILTINS([goom])
3482       AX_ADD_LDFLAGS([goom],[-L${real_goom_tree}/src/.libs -lgoom2])
3483       AX_ADD_CPPFLAGS([goom],[-I${real_goom_tree}/src -DUSE_GOOM_TREE])
3484     else
3485       dnl  The given libgoom2 wasn't built, try to look for the old goom
3486       AC_MSG_RESULT(no)
3487       AC_MSG_CHECKING(for libgoom.a in ${with_goom_tree})
3488       if test -f "${real_goom_tree}/libgoom.a"; then
3489         AC_MSG_RESULT(${real_goom_tree}/libgoom.a)
3490         AX_ADD_BUILTINS([goom])
3491         AX_ADD_LDFLAGS([goom],[-L${real_goom_tree} -lgoom])
3492         AX_ADD_CPPFLAGS([goom],[-I${real_goom_tree} -DUSE_GOOM_TREE -DOLD_GOOM])
3493       else
3494         dnl  The given libgoom wasn't built
3495         AC_MSG_RESULT(no)
3496         AC_MSG_ERROR([cannot find ${real_goom_tree}/src/.libs/libgoom2.a, make sure you compiled goom in ${with_goom_tree}])
3497       fi
3498     fi
3499   else
3500     AC_CHECK_HEADERS(goom/goom.h, [
3501       AC_CHECK_LIB(goom2, goom_init, [
3502         AX_ADD_PLUGINS([goom])
3503         AX_ADD_LDFLAGS([goom],[-lgoom2])
3504       ],[
3505         AC_MSG_ERROR([Could not find goom on your system: you may get it from http://www.ios-software.com/.])
3506       ])
3507     ])
3508   fi
3509 fi
3510
3511 dnl
3512 dnl  SLP access plugin
3513 dnl
3514 AC_ARG_ENABLE(slp,
3515   [  --enable-slp            SLP service discovery support (default disabled)])
3516 if test "${enable_slp}" = "yes"
3517 then
3518   AC_ARG_WITH(slp,
3519   [    --with-slp=PATH       libslp headers and libraries])
3520   if test -z "${with_slp}"
3521   then
3522     AC_CHECK_HEADERS(slp.h, have_slp="true", have_slp="false")
3523     if test "${have_slp}" = "true"
3524     then
3525       AX_ADD_PLUGINS([slp])
3526       AX_ADD_LDFLAGS([slp],[-lslp])
3527       AX_ADD_LDFLAGS([stream_out_standard],[-lslp])
3528     fi
3529   else
3530     AC_MSG_CHECKING(for slp headers in ${with_slp})
3531     if test -f ${with_slp}/slp.h
3532     then
3533       dnl  Use ${with_slp}/libslp/slp.h
3534       AC_MSG_RESULT(yes)
3535       AX_ADD_PLUGINS([slp])
3536       AX_ADD_LDFLAGS([slp],[-L${with_slp} -lslp])
3537       AX_ADD_LDFLAGS([stream_out_standard],[-L${with_slp} -lslp])
3538       AX_ADD_CPPFLAGS([slp],[-I${with_slp}])
3539       AC_DEFINE(HAVE_SLP_H)
3540     else
3541       dnl  No libslp could be found, sorry
3542       AC_MSG_RESULT(no)
3543       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
3544     fi
3545   fi
3546 fi
3547
3548 dnl
3549 dnl  Lirc plugin
3550 dnl
3551 AC_ARG_ENABLE(lirc,
3552   [  --enable-lirc           lirc support (default disabled)])
3553 if test "${enable_lirc}" = "yes"
3554 then
3555   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
3556   if test "${have_lirc}" = "true"
3557   then
3558     AX_ADD_PLUGINS([lirc])
3559     AX_ADD_LDFLAGS([lirc],[-llirc_client])
3560   fi
3561 fi
3562
3563 dnl 
3564 dnl  Joystick plugin
3565 dnl
3566 AC_ARG_ENABLE(joystick,
3567   [  --enable-joystick       joystick control (default disabled)])
3568 if test "${enable_joystick}" = "yes"
3569 then
3570  AC_CHECK_HEADER( linux/joystick.h, 
3571                 [AX_ADD_PLUGINS([joystick])]
3572                 )
3573 fi
3574
3575 dnl
3576 dnl corba (ORBit) plugin
3577 dnl
3578 dnl Default: do not enable corba
3579 enablecorba=false
3580 AC_ARG_ENABLE(corba,
3581   [  --enable-corba          corba interface support (default disabled)])
3582 if test "${enable_corba}" = "yes"; then
3583       GLIB_VERSION=2.3.2
3584       PKG_CHECK_MODULES(CORBA, 
3585         ORBit-2.0 >= 2.8.0 \
3586         glib-2.0 >= $GLIB_VERSION \
3587         gobject-2.0 >= $GLIB_VERSION \
3588         gthread-2.0 >= $GLIB_VERSION,
3589         [
3590           enablecorba=true
3591           AX_ADD_LDFLAGS([corba],[$CORBA_LIBS])
3592           AX_ADD_CFLAGS([corba],[$CORBA_CFLAGS])
3593           AX_ADD_PLUGINS([corba snapshot]) ],
3594         [ enablecorba=false
3595           AC_MSG_WARN(corba library not found) ])
3596 fi
3597 AM_CONDITIONAL(ENABLE_CORBA, test x$enablecorba = xtrue)
3598
3599 AC_ARG_WITH(,[Misc options:])
3600
3601 dnl
3602 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
3603 dnl
3604 dnl  We give the user the opportunity to specify
3605 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
3606 dnl
3607 AC_ARG_WITH(words,
3608   [  --with-words=endianness set endianness (big or little)])
3609   case "${with_words}" in
3610     big)
3611       ac_cv_c_bigendian=yes
3612       ;;
3613     little)
3614       ac_cv_c_bigendian=no
3615       ;;
3616     *)
3617       dnl  Try to guess endianness by matching patterns on a compiled
3618       dnl  binary, by looking for an ASCII or EBCDIC string
3619       AC_CACHE_CHECK([whether the byte order is big-endian],
3620         [ac_cv_c_bigendian],
3621         [ac_cv_c_bigendian="unknown"
3622         [cat >conftest.c <<EOF
3623         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
3624         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
3625         void _a(void) { char*s = (char*)am; s = (char *)ai; }
3626         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
3627         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
3628         void _e(void) { char*s = (char*)em; s = (char*)ei; }
3629         int main(void) { _a(); _e(); return 0; }
3630 EOF
3631         ]
3632         if test -f conftest.c
3633         then
3634           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
3635               && test -f conftest.o
3636           then
3637             if test "`strings conftest.o | grep BIGenDianSyS`"
3638             then
3639               ac_cv_c_bigendian="yes"
3640             fi
3641             if test "`strings conftest.o | grep LiTTleEnDian`"
3642             then
3643               ac_cv_c_bigendian="no"
3644             fi
3645           fi
3646         fi
3647       ])
3648       if test "${ac_cv_c_bigendian}" = "unknown"
3649       then
3650         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
3651       fi
3652       ;;
3653   esac
3654 dnl  Now we know what to use for endianness, just put it in the header
3655 if test "${ac_cv_c_bigendian}" = "yes"
3656 then
3657   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
3658 fi
3659
3660 dnl
3661 dnl  Mozilla plugin
3662 dnl
3663 mozilla=false
3664 AC_ARG_ENABLE(mozilla,
3665   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
3666 if test "${enable_mozilla}" = "yes" -a "${SYS}" != "mingw32"
3667 then
3668   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
3669   if test "${MOZILLA_CONFIG}" = "no"
3670   then
3671     AC_MSG_ERROR([Please install the Mozilla development tools, mozilla-config was not found.])
3672   else
3673     if test "${SYS}" != "mingw32"; then
3674       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
3675       AC_CHECK_LIB(Xt,XtStrings,[
3676         AX_ADD_LDFLAGS([mozilla],[-L${x_libraries} -lXt])
3677       ])
3678       LDFLAGS="${LDFLAGS_save}"
3679     fi
3680     mozilla=:
3681     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
3682     AX_ADD_CPPFLAGS([mozilla],[[`${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`]])
3683     AX_ADD_LDFLAGS([mozilla],[`${MOZILLA_CONFIG} --libs plugin xpcom`])
3684     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mozilla}"
3685     AC_CHECK_HEADERS(mozilla-config.h)
3686     CPPFLAGS="${CPPFLAGS_save}"
3687   fi
3688
3689 dnl special case for mingw32
3690 elif test "${enable_mozilla}" = "yes"
3691 then
3692   AC_CHECK_TOOL(CYGPATH, cygpath, "")
3693   AC_ARG_WITH(mozilla-sdk-path,
3694     [    --with-mozilla-sdk-path=PATH path to win32 mozilla sdk], [
3695     real_mozilla_sdk="`cd ${with_mozilla_sdk_path} 2>/dev/null && pwd`"
3696     CPPFLAGS="${CPPFLAGS_save} ${real_mozilla_sdk}"
3697     AC_CHECK_HEADERS(mozilla-config.h, [
3698       mozilla=:
3699       AX_ADD_CPPFLAGS([mozilla],[-DXPCOM_GLUE -I${real_mozilla_sdk} -I${real_mozilla_sdk}/embedstring/include -I${real_mozilla_sdk}/xpcom/include -I${real_mozilla_sdk}/nspr/include -I${real_mozilla_sdk}/string/include -I${real_mozilla_sdk}/plugin/include -I${real_mozilla_sdk}/java/include])
3700       AX_ADD_LDFLAGS([mozilla],[-L${real_mozilla_sdk}/embedstring/bin -L${real_mozilla_sdk}/xpcom/bin -L${real_mozilla_sdk}/nspr/bin -L${real_mozilla_sdk}/string/bin -lnspr4 -lplds4 -lplc4 -lembedstring -lxpcomglue -Wl,--kill-at])
3701       XPIDL_INCL="-I${real_mozilla_sdk}/xpcom/idl"
3702       if test -n "${CYGPATH}"; then
3703         XPIDL="${real_mozilla_sdk}/xpcom/bin/xpidl"
3704         real_mozilla_sdk="`${CYGPATH} -w ${real_mozilla_sdk}`"
3705         XPIDL_INCL="${XPIDL_INCL} -I\"${real_mozilla_sdk}/xpcom/idl\""
3706       fi ])
3707     CPPFLAGS="${CPPFLAGS_save}"
3708   ])
3709 fi
3710
3711 dnl Not necessarily in ${PATH}
3712 if test -z "${XPIDL}" -o ! -x "${XPIDL}"; then
3713   XPIDL="/usr/lib/mozilla/xpidl"
3714 fi
3715 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
3716
3717 dnl
3718 dnl  test plugins
3719 dnl
3720 AC_ARG_ENABLE(testsuite,
3721   [  --enable-testsuite      build test modules (default disabled)])
3722 if test "${enable_testsuite}" = "yes"
3723 then
3724   TESTS="test1 test2 test3 test4"
3725
3726   dnl  we define those so that bootstrap sets the right linker
3727   AX_ADD_CXXFLAGS([test2],[])
3728   AX_ADD_OBJCFLAGS([test3],[])
3729   dnl  this one is needed until automake knows what to do
3730   AX_ADD_LDFLAGS([test3],[-lobjc])
3731
3732   AX_ADD_PLUGINS([${TESTS}])
3733   #AX_ADD_BUILTINS([${TESTS}])
3734 fi
3735
3736 dnl
3737 dnl  gtk_main plugin
3738 dnl
3739 if test "${NEED_GTK_MAIN}" != "no"
3740 then
3741     AX_ADD_PLUGINS([gtk_main])
3742     AX_ADD_CFLAGS([gtk_main],[${CFLAGS_gtk}])
3743     AX_ADD_LDFLAGS([gtk_main],[${LDFLAGS_gtk}])
3744 fi
3745
3746 if test "${NEED_GNOME_MAIN}" != "no"
3747 then
3748     AX_ADD_PLUGINS([gnome_main])
3749     AX_ADD_CFLAGS([gnome_main],[${CFLAGS_gtk} ${CFLAGS_gnome}])
3750     AX_ADD_LDFLAGS([gnome_main],[${LDFLAGS_gtk} ${LDFLAGS_gnome}])
3751 fi
3752
3753 if test "${NEED_GTK2_MAIN}" != "no"
3754 then
3755     AX_ADD_PLUGINS([gtk2_main])
3756     AX_ADD_CFLAGS([gtk2],[-DNEED_GTK2_MAIN])
3757     AX_ADD_CFLAGS([pda],[-DNEED_GTK2_MAIN])
3758     AX_ADD_CFLAGS([gtk2_main],[${CFLAGS_gtk2} ${CFLAGS_pda}])
3759     AX_ADD_LDFLAGS([gtk2_main],[${LDFLAGS_gtk2} ${LDFLAGS_pda}])
3760 fi
3761
3762 if test "${NEED_GNOME2_MAIN}" != "no"
3763 then
3764     AX_ADD_PLUGINS([gnome2_main])
3765     AX_ADD_CFLAGS([gnome2_main],[${CFLAGS_gtk2} ${CFLAGS_gnome2}])
3766     AX_ADD_LDFLAGS([gnome2_main],[${LDFLAGS_gtk2} ${LDFLAGS_gnome2}])
3767 fi
3768
3769 dnl
3770 dnl  qte_main plugin
3771 dnl
3772 if test "${NEED_QTE_MAIN}" != "no"
3773 then
3774     AX_ADD_PLUGINS([qte_main])
3775     AX_ADD_CXXFLAGS([opie qte qt_video],[-DNEED_QTE_MAIN])
3776     AX_ADD_CXXFLAGS([qte_main],[${CXXFLAGS_qte} ${CXXFLAGS_qt_video}])
3777     AX_ADD_LDFLAGS([qte_main],[${LDFLAGS_qte} ${LDFLAGS_qt_video}])
3778 fi
3779
3780
3781 dnl
3782 dnl  Plugin and builtin checks
3783 dnl
3784 builtin_support=false
3785 plugin_support=:
3786
3787 dnl Support for plugins - this must be AT THE END
3788 AC_ARG_ENABLE(plugins,
3789   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
3790   [if test "${enable_plugins}" = "no"
3791    then
3792      plugin_support=false
3793    fi])
3794
3795 dnl Automagically disable plugins if there is no system support for
3796 dnl dynamically loadable files (.so, .dll, .dylib).
3797 dnl don't forget vlc-win32 still can load .dll as plugins
3798 if test "${ac_cv_have_plugins}" = "no"
3799 then
3800   echo "*** Your system doesn't have plugin support. All plugins will be built"
3801   echo "statically."
3802   plugin_support=false
3803 fi
3804
3805 dnl Export automake variables
3806 if ${plugin_support}
3807 then
3808   for plugin in `echo ${PLUGINS}`
3809   do
3810     eval "${plugin}_p=yes"
3811   done
3812 else
3813   AX_ADD_BUILTINS([${PLUGINS}])
3814   PLUGINS=""
3815 fi
3816 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
3817
3818 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
3819 then
3820   builtin_support=:
3821   for builtin in `echo ${BUILTINS}`
3822   do
3823     eval "${builtin}_b=yes"
3824   done
3825 fi]
3826 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
3827
3828 dnl Import conditional variables generated by bootstrap
3829 AX_VLC_CONDITIONALS
3830
3831 dnl
3832 dnl  Stuff used by the program
3833 dnl
3834 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
3835 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2004 VideoLAN", [Copyright string])
3836 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
3837
3838 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-+/___/'`"
3839 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
3840 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
3841 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
3842
3843 DATA_PATH="${ac_tool_prefix}/share/vlc"
3844 AC_SUBST(DATA_PATH)
3845 PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
3846 AC_SUBST(PLUGIN_PATH)
3847
3848 dnl
3849 dnl  Handle substvars that use $(top_srcdir)
3850 dnl
3851 VLC_CONFIG="top_builddir=\"\$(top_builddir)\" \$(top_builddir)/vlc-config"
3852 AC_SUBST(VLC_CONFIG)
3853 CPPFLAGS_save="${CPPFLAGS_save} -I\$(top_srcdir)/include"
3854
3855 dnl
3856 dnl  Restore *FLAGS
3857 dnl
3858 AX_RESTORE_FLAGS
3859
3860 dnl
3861 dnl  Create the vlc-config script
3862 dnl
3863 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtin}"
3864 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
3865
3866 dnl
3867 dnl  Configuration is finished
3868 dnl
3869 AC_SUBST(SYS)
3870 AC_SUBST(ARCH)
3871 AC_SUBST(ALIASES)
3872 AC_SUBST(ASM)
3873 AC_SUBST(MOC)
3874 AC_SUBST(WINDRES)
3875 AC_SUBST(XPIDL)
3876 AC_SUBST(XPIDL_INCL)
3877 AC_SUBST(LIBEXT)
3878 AC_SUBST(INCLUDES)
3879 AC_SUBST(ALL_LINGUAS)
3880
3881 dnl Import substitutions generated by bootstrap
3882 AX_VLC_SUBSTS
3883
3884 dnl Create vlc-config.in
3885 AX_OUTPUT_VLC_CONFIG_IN
3886
3887 AC_CONFIG_FILES([
3888   Makefile
3889   autotools/Makefile
3890   debian/Makefile
3891   doc/Makefile
3892   intl/Makefile
3893   ipkg/Makefile
3894   lib/Makefile
3895   modules/Makefile
3896   mozilla/Makefile
3897   m4/Makefile
3898   po/Makefile.in
3899   share/Makefile
3900   src/Makefile
3901 ])
3902
3903 AC_CONFIG_FILES([
3904   modules/access/Makefile
3905   modules/access/dshow/Makefile
3906   modules/access/dvb/Makefile
3907   modules/access/dvd/Makefile
3908   modules/access/dvdplay/Makefile
3909   modules/access/dvdread/Makefile
3910   modules/access/mms/Makefile
3911   modules/access/pvr/Makefile
3912   modules/access/satellite/Makefile
3913   modules/access/v4l/Makefile
3914   modules/access/cdda/Makefile
3915   modules/access/vcd/Makefile
3916   modules/access/vcdx/Makefile
3917   modules/access_output/Makefile
3918   modules/audio_filter/Makefile
3919   modules/audio_filter/channel_mixer/Makefile
3920   modules/audio_filter/converter/Makefile
3921   modules/audio_filter/resampler/Makefile
3922   modules/audio_mixer/Makefile
3923   modules/audio_output/Makefile
3924   modules/codec/Makefile
3925   modules/codec/cmml/Makefile
3926   modules/codec/ffmpeg/Makefile
3927   modules/codec/ffmpeg/postprocessing/Makefile
3928   modules/codec/ogt/Makefile
3929   modules/codec/spudec/Makefile
3930   modules/control/Makefile
3931   modules/control/corba/Makefile
3932   modules/demux/Makefile
3933   modules/demux/asf/Makefile
3934   modules/demux/avi/Makefile
3935   modules/demux/mp4/Makefile
3936   modules/demux/mpeg/Makefile
3937   modules/demux/playlist/Makefile
3938   modules/demux/util/Makefile
3939   modules/gui/Makefile
3940   modules/gui/beos/Makefile
3941   modules/gui/pda/Makefile
3942   modules/gui/gtk/Makefile
3943   modules/gui/gtk2/Makefile
3944   modules/gui/kde/Makefile
3945   modules/gui/macosx/Makefile
3946   modules/gui/qnx/Makefile
3947   modules/gui/qt/Makefile
3948   modules/gui/skins/Makefile
3949   modules/gui/skins2/Makefile
3950   modules/gui/wxwindows/Makefile
3951   modules/misc/Makefile
3952   modules/misc/dummy/Makefile
3953   modules/misc/memcpy/Makefile
3954   modules/misc/network/Makefile
3955   modules/misc/testsuite/Makefile
3956   modules/misc/playlist/Makefile
3957   modules/mux/Makefile
3958   modules/mux/mpeg/Makefile
3959   modules/packetizer/Makefile
3960   modules/stream_out/Makefile
3961   modules/stream_out/transrate/Makefile
3962   modules/video_chroma/Makefile
3963   modules/video_filter/Makefile
3964   modules/video_output/Makefile
3965   modules/video_output/directx/Makefile
3966   modules/video_output/qte/Makefile
3967   modules/video_output/x11/Makefile
3968   modules/visualization/Makefile
3969   modules/visualization/visual/Makefile
3970 ])
3971
3972 AC_CONFIG_FILES([vlc-config], [chmod 0755 vlc-config])
3973
3974 dnl Generate makefiles
3975 AC_OUTPUT
3976
3977 printf "
3978 vlc configuration
3979 --------------------
3980 vlc version           : ${VERSION}
3981 system                : ${SYS}
3982 architecture          : ${ARCH}
3983 build flavour         : "
3984 test "${enable_debug}" = "yes" && printf "debug "
3985 test "${enable_cprof}" = "yes" && printf "cprof "
3986 test "${enable_gprof}" = "yes" && printf "gprof "
3987 test "${enable_optimizations}" = "yes" && printf "optim "
3988 test "${enable_release}" = "yes" && printf "release " || printf "devel "
3989 echo "
3990 vlc aliases           :${ALIASES}
3991
3992 You can tune the compiler flags in vlc-config.
3993 To build vlc and its plugins, type \`make'.
3994 "
3995