* ./configure.ac.in: libmad and liba52 need to be explicitely disabled,
[vlc.git] / configure.ac.in
1 dnl Autoconf settings for vlc
2
3 AC_INIT(vlc,0.5.1-cvs)
4
5 CONFIGURE_LINE="$0 $*"
6 CODENAME="Natalya"
7
8 AC_PREREQ(2.50)
9 AC_CONFIG_SRCDIR(src/libvlc.c)
10 AC_CANONICAL_SYSTEM
11
12 dnl XXX: we don't put any flags here, because automake 1.5 doesn't support
13 dnl them. And we need the comma otherwize automake will choke on it.
14 AM_INIT_AUTOMAKE(vlc,0.5.1-cvs)
15 AM_CONFIG_HEADER(config.h)
16
17 dnl
18 dnl  Save *FLAGS
19 dnl
20 CPPFLAGS_save="${CPPFLAGS}"
21 CFLAGS_save="${CFLAGS}"
22 CXXFLAGS_save="${CXXFLAGS}"
23 OBJCFLAGS_save="${OBJCFLAGS}"
24 LDFLAGS_save="${LDFLAGS}"
25
26 dnl
27 dnl Check for tools
28 dnl
29 AC_PROG_CC
30 AM_PROG_CC_C_O
31 AC_PROG_CPP
32 AC_PROG_CXX
33 AC_PROG_MAKE_SET
34 AC_PROG_INSTALL
35
36 dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
37 dnl now otherwise it might be set in an obscure if statement.
38 AC_EGREP_CPP(foo,foo)
39
40 dnl AC_PROG_OBJC doesn't seem to exist, this is the KDE workaround
41 AC_MSG_CHECKING(for an Objective-C compiler)
42 OBJC="${CXX}"
43 AC_SUBST(OBJC)
44 OBJCFLAGS="${CXXFLAGS} -fgnu-runtime -fconstant-string-class=NSConstantString"
45 AC_SUBST(OBJCFLAGS)
46 dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
47 #OBJCDEPMODE="depmode=gcc3"
48 #AC_SUBST(OBJCDEPMODE)
49 _AM_DEPENDENCIES(OBJC)
50 AC_MSG_RESULT(not implemented yet)
51
52 dnl Find the right ranlib, even when cross-compiling
53 AC_CHECK_TOOL(RANLIB, ranlib, :)
54 AC_CHECK_TOOL(STRIP, strip, :)
55 AC_CHECK_TOOL(AR, ar, :)
56 AC_CHECK_TOOL(LD, ld, :)
57
58 dnl AM_PROG_LIBTOOL
59 AC_PROG_INSTALL
60
61 dnl Check for compiler properties
62 AC_C_CONST
63 AC_C_INLINE
64
65 dnl
66 dnl  Set default values
67 dnl
68 LDFLAGS_vlc="${LDFLAGS}"
69 LIBEXT=".so"
70
71 dnl
72 dnl  Check the operating system
73 dnl
74 case "x${target_os}" in
75   x)
76     SYS=unknown
77     ;;
78   xlinux*)
79     SYS=linux
80     ;;
81   xbsdi*)
82     SYS=bsdi
83     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
84     LDFLAGS_dvd="${LDFLAGS_dvd} -ldvd"
85     LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvd"
86     LDFLAGS_vcd="${LDFLAGS_vcd} -ldvd"
87     ;;
88   x*bsd*)
89     SYS="${target_os}"
90     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
91     ;;
92   xdarwin*)
93     SYS=darwin
94     CFLAGS_save="${CFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CFLAGS="${CFLAGS_save}"
95     CXXFLAGS_save="${CXXFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
96     OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; OBJCFLAGS="${OBJCFLAGS_save}"
97     LDFLAGS_vlc="${LDFLAGS_vlc} -all_load"
98     LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -all_load"
99     LIBEXT=".dylib"
100     ;;
101   x*mingw32* | x*cygwin*)
102     AC_CHECK_TOOL(WINDRES, windres, :)
103     LIBEXT=".dll"
104
105     case "x${target_os}" in
106       x*mingw32*)
107         SYS=mingw32
108         ;;
109       x*cygwin*)
110         dnl Check if we are using the mno-cygwin mode in which case we are
111         dnl actually dealing with a mingw32 compiler.
112         AC_EGREP_CPP(yes,
113             [#ifdef WIN32
114              yes
115              #endif],
116             SYS=mingw32, SYS=cygwin)
117         ;;
118     esac
119
120     if test "x$SYS" = "xmingw32"; then
121         # add ws2_32 for closesocket, select, recv
122         CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"
123         CPPFLAGS="${CPPFLAGS_save}"
124         LDFLAGS_vlc="${LDFLAGS_vlc} -lws2_32 -lnetapi32 -mwindows"
125         LDFLAGS_ipv4="${LDFLAGS_ipv4} -lws2_32"
126         LDFLAGS_ipv6="${LDFLAGS_ipv6} -lws2_32"
127         LDFLAGS_access_http="${LDFLAGS_access_http} -lws2_32"
128         LDFLAGS_access_mms="${LDFLAGS_access_mms} -lws2_32"
129         LDFLAGS_access_udp="${LDFLAGS_access_udp} -lws2_32"
130         LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lws2_32"
131         LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lws2_32"
132         LDFLAGS_rc="${LDFLAGS_rc} -lws2_32"
133         LDFLAGS_sap="${LDFLAGS_sap} -lws2_32"
134     fi
135     ;;
136   x*nto*)
137     SYS=nto
138     LDFLAGS_x11="${LDFLAGS_x11} -lsocket"
139     LDFLAGS_xvideo="${LDFLAGS_xvideo} -lsocket"
140     ;;
141   xsolaris*)
142     SYS=solaris
143     ;;
144   xhpux*)
145     SYS=hpux
146     LIBEXT=".sl"
147     ;;
148   xbeos)
149     SYS=beos
150     CFLAGS_save="${CFLAGS_save} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CFLAGS="${CFLAGS_save}"
151     CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CXXFLAGS="${CXXFLAGS_save}"
152     LDFLAGS_vlc="${LDFLAGS_vlc} -lbe"
153     LDFLAGS_plugins="${LDFLAGS_plugins} -nostart"
154     LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -lroot -ltracker -lstdc++.r4 -ltranslation"
155     dnl BONE or not BONE ?
156     AC_CHECK_LIB( bind, inet_ntoa,
157         [ LDFLAGS_access_mms="${LDFLAGS_access_mms} -lbind"
158           LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"],
159         [])
160     ;;
161   x*)
162     SYS="${target_os}"
163     ;;
164 esac
165 AM_CONDITIONAL(HAVE_BEOS, test "x${SYS}" = "xbeos")
166 AM_CONDITIONAL(HAVE_DARWIN, test "x${SYS}" = "xdarwin")
167 AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")
168
169 dnl
170 dnl Gettext stuff
171 dnl
172 ALL_LINGUAS="de en_GB fr it ja no ru nl pl sv"
173 AM_GNU_GETTEXT_VERSION(0.10.40)
174 AM_GNU_GETTEXT
175 if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
176   AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
177   INCLUDES="${INCLUDES} -I\\\$(top_srcdir)/intl"
178 else
179   AC_CHECK_FUNCS(textdomain,,[
180     AC_CHECK_LIB(intl,textdomain,
181       LDFLAGS_vlc="${LDFLAGS_vlc} -lintl"
182       LDFLAGS_plugins="${LDFLAGS_plugins} -lintl"
183     )
184   ])
185 fi
186 AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
187 XGETTEXT="${XGETTEXT} --keyword=_NS"
188
189 AC_MSG_CHECKING(for suffix of libraries)
190 AC_MSG_RESULT(${LIBEXT})
191
192 dnl Check for the need to include the mingwex lib for mingw32
193 if test x$SYS = xmingw32
194 then
195     AC_CHECK_LIB(mingwex,opendir,
196         AC_CHECK_LIB(mingw32,opendir,LDFLAGS_vlc="${LDFLAGS_vlc}",
197             [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
198              LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
199     )
200 fi
201
202 dnl Check for fnative-struct or mms-bitfields support for mingw32
203 if test x$SYS = xmingw32
204 then
205     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
206         [ac_cv_c_mms_bitfields],
207         [CFLAGS="${CFLAGS_save} -mms-bitfields"
208          AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
209     if test x"$ac_cv_c_mms_bitfields" != x"no"; then
210         CFLAGS_save="${CFLAGS_save} -mms-bitfields";
211         CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
212     else
213         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
214             [ac_cv_c_fnative_struct],
215             [CFLAGS="${CFLAGS_save} -fnative-struct"
216              AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
217         if test x"$ac_cv_c_fnative_struct" != x"no"; then
218             CFLAGS_save="${CFLAGS_save} -fnative-struct";
219             CXXFLAGS_save="${CXXFLAGS_save} -fnative-struct";
220         fi
221     fi
222
223     CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
224 fi
225
226 dnl Check for fvtable-thunks support for mingw32
227 if test x$SYS = xmingw32
228 then
229 AC_LANG_PUSH(C++)
230     AC_CACHE_CHECK([if \$CXX accepts -fvtable-thunks],
231         [ac_cv_cxx_fvtable_thunks],
232         [CXXFLAGS="${CXXFLAGS_save} -Wall -Werror -fvtable-thunks"
233          AC_TRY_COMPILE([],,ac_cv_cxx_fvtable_thunks=yes,
234                         ac_cv_cxx_fvtable_thunks=no)])
235     if test x"$ac_cv_cxx_fvtable_thunks" = x"yes"; then
236         CXXFLAGS_mingw32_special="-fvtable-thunks"
237     fi
238
239     CXXFLAGS_save="${CXXFLAGS_save} ${CXXFLAGS_mingw32_special}"
240     CXXFLAGS="${CXXFLAGS_save}"
241 AC_LANG_POP(C++)
242 fi
243
244 dnl Flags for plugin compilation
245 case "x${SYS}" in
246   xmingw32|xcygwin)
247     CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
248     CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
249     OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
250     CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
251     CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
252     OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
253     ;;
254   x*)
255     CFLAGS_pics="${CFLAGS_pics} -fPIC"
256     CXXFLAGS_pics="${CXXFLAGS_pics} -fPIC"
257     OBJCFLAGS_pics="${OBJCFLAGS_pics} -fPIC"
258     CFLAGS_plugins="${CFLAGS_plugins} -fPIC"
259     CXXFLAGS_plugins="${CXXFLAGS_plugins} -fPIC"
260     OBJCFLAGS_plugins="${OBJCFLAGS_plugins} -fPIC"
261     LDFLAGS_plugins="${LDFLAGS_plugins} -fPIC"
262     ;;
263 esac
264
265 dnl The -DSYS_FOO flag
266 CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
267
268 dnl Check for system libs needed
269 need_libc=false
270
271 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv)
272
273 dnl Check for usual libc functions
274 AC_CHECK_FUNCS(strdup strndup atof lseek)
275 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
276 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
277
278 AC_CHECK_FUNCS(connect,,[
279   AC_CHECK_LIB(socket,connect,
280     LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
281     LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
282 )])
283
284 AC_CHECK_FUNCS(send,,[
285   AC_CHECK_LIB(socket,send,
286     LDFLAGS_access_http="${LDFLAGS_access_http} -lsocket"
287     LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket"
288     LDFLAGS_access_udp="${LDFLAGS_access_udp} -lsocket"
289     LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lsocket"
290     LDFLAGS_sap="${LDFLAGS_sap} -lsocket"
291     LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lsocket"
292 )])
293
294 AC_CHECK_FUNCS(gethostbyname,,[
295   AC_CHECK_LIB(nsl,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lnsl",[
296     AC_CHECK_LIB(bind,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind")])
297 ])
298
299 have_nanosleep=false
300 AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
301   AC_CHECK_LIB(rt,nanosleep,
302     [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
303     [AC_CHECK_LIB(posix4,nanosleep,
304         [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
305   )
306 ])
307 if ${have_nanosleep}; then
308   AC_DEFINE(HAVE_NANOSLEEP, 1,
309             Define if nanosleep is available.)
310 fi
311
312 dnl Check for socklen_t
313 AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
314   [AC_TRY_COMPILE(
315      [#include <sys/types.h>
316       #include <sys/socket.h>],
317      [socklen_t len = 42; return len;],
318      ac_cv_type_socklen_t=yes,
319      ac_cv_type_socklen_t=no)])
320 if test x$ac_cv_type_socklen_t != xno; then
321   AC_DEFINE(HAVE_SOCKLEN_T, 1,
322             Define if <sys/socket.h> defines socklen_t.)
323 fi
324
325 dnl HP/UX port
326 AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])
327
328 AC_CHECK_FUNCS(inet_aton,,[
329   AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv")
330 ])
331
332 dnl Check for getopt
333 need_getopt=false
334 AC_CHECK_FUNCS(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
335 [ # FreeBSD has a gnugetopt library for this:
336   AC_CHECK_LIB([gnugetopt],[getopt_long],
337     [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LDFLAGS_vlc="${LDFLAGS_vlc} -lgnugetopt"],
338     [need_getopt=:])])
339 AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
340
341 AC_TYPE_SIGNAL
342 AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
343 AC_CHECK_LIB(m,cos,
344   LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
345   LDFLAGS_adjust="${LDFLAGS_adjust} -lm"
346   LDFLAGS_distort="${LDFLAGS_distort} -lm"
347   LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
348 AC_CHECK_LIB(m,pow,
349   LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm"
350   LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
351   LDFLAGS_imdct3dn="${LDFLAGS_imdct3dn} -lm"
352   LDFLAGS_imdctsse="${LDFLAGS_imdctsse} -lm"
353   LDFLAGS_i420_rgb="${LDFLAGS_i420_rgb} -lm"
354   LDFLAGS_faad="${LDFLAGS_faad} -lm"
355 )
356
357 dnl Check for pthreads - borrowed from XMMS
358 THREAD_LIB=error
359 if test "x${THREAD_LIB}" = "xerror"; then
360   AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
361 fi
362 if test "x${THREAD_LIB}" = "xerror"; then
363   AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
364 fi
365 if test "x${THREAD_LIB}" = "xerror"; then
366   AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
367 fi
368 if test "x${THREAD_LIB}" = "xerror"; then
369   AC_CHECK_FUNCS(pthread_mutex_lock)
370   THREAD_LIB=""
371 fi
372
373 dnl Check for cthreads under GNU/Hurd for instance
374 AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
375
376 dnl Check for misc headers
377 AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
378 AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
379   AC_MSG_RESULT(yes)
380   AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
381             Define if <pthread.h> defines pthread_cond_t.)],[
382   AC_MSG_RESULT(no)])
383
384 AC_MSG_CHECKING(for pthread_once in pthread.h)
385 AC_EGREP_HEADER(pthread_once,pthread.h,[
386   AC_MSG_RESULT(yes)
387   AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
388             Define if <pthread.h> defines pthread_once.)],[
389   AC_MSG_RESULT(no)])
390
391 AC_MSG_CHECKING(for strncasecmp in strings.h)
392 AC_EGREP_HEADER(strncasecmp,strings.h,[
393   AC_MSG_RESULT(yes)
394   AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
395             Define if <strings.h> defines strncasecmp.)],[
396   AC_MSG_RESULT(no)])
397
398 dnl Check for headers
399 AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
400 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h)
401 AC_CHECK_HEADERS(dlfcn.h image.h)
402 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
403 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
404 AC_CHECK_HEADERS(linux/version.h)
405
406 AC_HEADER_TIME
407
408 dnl Check for dirent
409 need_dirent=false
410 AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
411 AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})
412
413 dnl Mac OS X and other OSes don't have declaration for nanosleep
414 AC_MSG_CHECKING(for nanosleep in time.h)
415 AC_EGREP_HEADER(nanosleep,time.h,[
416   AC_MSG_RESULT(yes)
417   AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
418             Define if <time.h> defines nanosleep.)
419 ],[
420   AC_MSG_RESULT(no)
421 ])
422
423 dnl Make sure we have timespecs
424 AC_MSG_CHECKING(for timespec in sys/time.h)
425 AC_EGREP_HEADER(timespec,sys/time.h,[
426   AC_MSG_RESULT(yes)
427   AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
428             Define if <sys/time.h> defines struct timespec.)
429 ],[
430   AC_MSG_RESULT(no)
431 ])
432
433 dnl Check for threads library
434 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
435
436 dnl Default X headers and libraries
437 if test "x${x_includes}" = "xNONE"; then
438   x_includes="/usr/X11R6/include"
439 fi
440 if test "x${x_libraries}" = "xNONE"; then
441   x_libraries="/usr/X11R6/lib"
442 fi
443
444 dnl Build the gtk_main plugins?
445 NEED_GTK_MAIN=no
446 NEED_GNOME_MAIN=no
447
448 dnl build the qte plugin ?
449 NEED_QTE_MAIN=no
450
451 dnl Check for DPMS
452 if test "x${SYS}" != "xmingw32"
453 then
454   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
455   AC_CHECK_HEADERS(X11/extensions/dpms.h, [
456     AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
457     AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
458       AC_MSG_RESULT(yes)
459       AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
460                 Define if <X11/extensions/dpms.h> defines DPMSInfo.)
461     ],[
462       AC_MSG_RESULT(no)
463     ])
464   ],,[
465     #include <X11/Xlib.h>
466   ])
467   CPPFLAGS="${CPPFLAGS_save}"
468 fi
469
470 dnl Check for ntohl, etc.
471 AC_CACHE_CHECK([for ntohl in sys/param.h],
472     [ac_cv_c_ntohl_sys_param_h],
473     [CFLAGS="${CFLAGS_save} -Wall -Werror"
474      AC_TRY_COMPILE([#include <sys/param.h>],
475         [void foo() { int meuh; ntohl(meuh); }],
476         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
477 if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
478     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
479 fi
480
481 dnl Check for inline function size limit
482 AC_CACHE_CHECK([if \$CC accepts -finline-limit],
483     [ac_cv_c_inline_limit],
484     [CFLAGS="${CFLAGS_save} -finline-limit-30000"
485      AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
486 if test "x${ac_cv_c_inline_limit}" != "xno"; then
487     CFLAGS_save="${CFLAGS_save} -finline-limit-30000"; CFLAGS="${CFLAGS_save}"
488     CXXFLAGS_save="${CXXFLAGS_save} -finline-limit-30000"; CXXFLAGS="${CXXFLAGS_save}"
489     OBJCFLAGS_save="${OBJCFLAGS_save} -finline-limit-30000"; OBJCFLAGS="${OBJCFLAGS_save}"
490 fi
491
492 # XXX: do this with an M4 macro?
493 #dnl Check for various -W flags
494 #for flag in "" all unreachable-code conversion sign-compare disabled-optimization
495 #do
496 #    AC_CACHE_CHECK([if \$CC accepts -W${flag}],
497 #        [ac_cv_c_W${flag}],
498 #        [CFLAGS="-W${flag} ${CFLAGS_save}"
499 #         AC_TRY_COMPILE([],,ac_cv_c_W${flag}=yes, ac_cv_c_W${flag}=no)])
500 #    if test "x${ac_cv_c_W${flag}}" != "xno"; then
501 #        CFLAGS_save="-W${flag} ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
502 #        CXXFLAGS_save="-W${flag} ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
503 #        OBJCFLAGS_save="-W${flag} ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
504 #    fi
505 #done
506
507 AC_CACHE_CHECK([if \$CC accepts -Wall],
508     [ac_cv_c_Wall],
509     [CFLAGS="-Wall ${CFLAGS_save}"
510      AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
511
512 AC_CACHE_CHECK([if \$CC accepts -Wconversion],
513     [ac_cv_c_Wconversion],
514     [CFLAGS="-Wconversion ${CFLAGS_save}"
515      AC_TRY_COMPILE([],,ac_cv_c_Wconversion=yes, ac_cv_c_Wconversion=no)])
516
517 AC_CACHE_CHECK([if \$CC accepts -Wunreachable-code],
518     [ac_cv_c_Wunreachable_code],
519     [CFLAGS="-Wunreachable-code ${CFLAGS_save}"
520      AC_TRY_COMPILE([],,ac_cv_c_Wunreachable_code=yes, ac_cv_c_Wunreachable_code=no)])
521
522 AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
523     [ac_cv_c_Wsign_compare],
524     [CFLAGS="-Wsign-compare ${CFLAGS_save}"
525      AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
526
527 AC_CACHE_CHECK([if \$CC accepts -Wdisabled-optimization],
528     [ac_cv_c_Wdisabled_optimization],
529     [CFLAGS="-Wdisabled-optimization ${CFLAGS_save}"
530      AC_TRY_COMPILE([],,ac_cv_c_Wdisabled_optimization=yes, ac_cv_c_Wdisabled_optimization=no)])
531
532 AC_CACHE_CHECK([if \$CC accepts -Winline],
533     [ac_cv_c_Winline],
534     [CFLAGS="-Winline ${CFLAGS_save}"
535      AC_TRY_COMPILE([],,ac_cv_c_Winline=yes, ac_cv_c_Winline=no)])
536
537 if test "x${ac_cv_c_Wall}" != "xno"; then
538     CFLAGS_save="-Wall ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
539     CXXFLAGS_save="-Wall ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
540     OBJCFLAGS_save="-Wall ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
541 fi
542
543 if test "x${ac_cv_c_Wunreachable_code}" != "xno"; then
544 #    CFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
545 #    CXXFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
546 #    OBJCFLAGS_save="-Wunreachable-code ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
547
548     dnl -Wunreachable-code means gcc-3.x, we can use -Wconversion and we can
549     dnl activate -Winline for C++, it won't choke on system headers.
550 #    if test "x${ac_cv_c_Wconversion}" != "xno"; then
551 #        CFLAGS_save="-Wconversion ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
552 #        CXXFLAGS_save="-Wconversion ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
553 #        OBJCFLAGS_save="-Wconversion ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
554 #    fi
555     if test "x${ac_cv_c_Winline}" != "xno"; then
556         CXXFLAGS_save="-Winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
557     fi
558
559 fi
560
561 if test "x${ac_cv_c_Wsign_compare}" != "xno"; then
562     CFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
563     CXXFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
564     OBJCFLAGS_save="-Wsign-compare ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
565 fi
566
567 if test "x${ac_cv_c_Wdisabled_optimization}" != "xno"; then
568     CFLAGS_save="-Wdisabled-optimization ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
569     CXXFLAGS_save="-Wdisabled-optimization ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
570     OBJCFLAGS_save="-Wdisabled-optimization ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
571 fi
572
573 if test "x${ac_cv_c_Winline}" != "xno"; then
574     CFLAGS_save="-Winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
575     OBJCFLAGS_save="-Winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
576 fi
577
578 dnl Check for -pipe
579 AC_CACHE_CHECK([if \$CC accepts -pipe],
580     [ac_cv_c_pipe],
581     [CFLAGS="${CFLAGS_save} -pipe"
582      AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
583 if test "x${ac_cv_c_pipe}" != "xno"; then
584     CFLAGS_save="${CFLAGS_save} -pipe"; CFLAGS="${CFLAGS_save}"
585     CXXFLAGS_save="${CXXFLAGS_save} -pipe"; CXXFLAGS="${CXXFLAGS_save}"
586     OBJCFLAGS_save="${OBJCFLAGS_save} -pipe"; OBJCFLAGS="${OBJCFLAGS_save}"
587 fi
588
589 dnl Check for various optimization flags
590 AC_CACHE_CHECK([if \$CC accepts -O3],
591     [ac_cv_c_o3],
592     [CFLAGS="${CFLAGS_save} -O3"
593      AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
594 if test "x${ac_cv_c_o3}" != "xno"; then
595     CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
596 fi
597
598 AC_CACHE_CHECK([if \$CC accepts -O2],
599     [ac_cv_c_o2],
600     [CFLAGS="${CFLAGS_save} -O2"
601      AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
602 if test "x${ac_cv_c_o2}" != "xno"; then
603     if test "x${ac_cv_c_o3}" = "xno"; then
604         CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
605     fi
606     CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O2"
607 else
608     AC_CACHE_CHECK([if \$CC accepts -O],
609         [ac_cv_c_o],
610         [CFLAGS="${CFLAGS_save} -O"
611          AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
612     if test "x${ac_cv_c_o}" != "xno"; then
613         if test "x${ac_cv_c_o3}" = "xno"; then
614             CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
615         fi
616         CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
617     fi
618 fi
619
620 dnl Check for -ffast-math
621 AC_CACHE_CHECK([if \$CC accepts -ffast-math],
622     [ac_cv_c_fast_math],
623     [CFLAGS="${CFLAGS_save} -ffast-math"
624      AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
625 if test "x${ac_cv_c_fast_math}" != "xno"; then
626     CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
627 fi
628
629 dnl Check for -funroll-loops
630 AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
631     [ac_cv_c_unroll_loops],
632     [CFLAGS="${CFLAGS_save} -funroll-loops"
633      AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
634 if test "x${ac_cv_c_unroll_loops}" != "xno"; then
635     CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
636 fi
637
638 dnl Check for -fomit-frame-pointer
639 AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
640     [ac_cv_c_omit_frame_pointer],
641     [CFLAGS="${CFLAGS_save} -fomit-frame-pointer"
642      AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
643 if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
644     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
645     # this plugin does not compile without -fomit-frame-pointer, damn gcc!
646     CFLAGS_i420_yuy2_mmx="${CFLAGS_i420_yuy2_mmx} -fomit-frame-pointer"
647 fi
648
649 dnl Check for -mdynamic-no-pic
650 AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
651     [ac_cv_c_dynamic_no_pic],
652     [CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
653      AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
654 if test "x${ac_cv_c_dynamic_no_pic}" != "xno"; then
655     CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
656     CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
657 fi
658
659 dnl Check for Darwin plugin linking flags
660 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
661     [ac_cv_ld_darwin],
662     [CFLAGS="${CFLAGS_save} -bundle -undefined error -lcc_dynamic"
663      AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
664 if test "x${ac_cv_ld_darwin}" != "xno"; then
665     LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
666 fi
667
668 dnl Check for standard plugin linking flags
669 AC_CACHE_CHECK([if \$CC accepts -shared],
670     [ac_cv_ld_plugins],
671     [CFLAGS="${CFLAGS_save} -shared"
672      AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
673 if test "x${ac_cv_ld_plugins}" != "xno"; then
674     LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
675 fi
676
677 dnl Check for variadic macros
678 AC_CACHE_CHECK([for variadic cpp macros],
679     [ac_cv_cpp_variadic_macros],
680     [CFLAGS="${CFLAGS_save}"
681      AC_TRY_COMPILE(
682          [#include <stdio.h>
683           #define a(b,c...) printf(b,##c)],
684          [a("foo");a("%s","bar");a("%s%s","baz","quux");],
685          ac_cv_cpp_variadic_macros=yes,
686          ac_cv_cpp_variadic_macros=no)])
687 if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
688     AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
689 fi
690
691 dnl Checks for __attribute__(aligned()) directive
692 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
693     [ac_cv_c_attribute_aligned],
694     [ac_cv_c_attribute_aligned=0
695         CFLAGS="${CFLAGS_save} -Werror"
696     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
697         AC_TRY_COMPILE([],
698         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
699         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
700     done
701         CFLAGS="${CFLAGS_save}"])
702 if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
703     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
704         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
705 fi
706
707 dnl Checks for __attribute__(format()) directive
708 AC_CACHE_CHECK([__attribute__ ((format ())) support with function pointers],
709     [ac_cv_c_attribute_format],
710     [ac_cv_c_attribute_format=no
711         CFLAGS="${CFLAGS_save} -Werror"
712         AC_TRY_COMPILE([],
713         [static void (*pf_printf)(const char *, ...) __attribute__ ((format(printf,1,2)));(void)pf_printf;],
714         [ac_cv_c_attribute_format=yes])
715         CFLAGS="${CFLAGS_save}"])
716 if test "x${ac_cv_c_attribute_format}" != "xno"; then
717     AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
718 fi
719
720 dnl
721 dnl  Check the CPU
722 dnl
723 case "x${target_cpu}" in
724   x)
725     ARCH=unknown
726     ;;
727   *)
728     ARCH="${target_cpu}"
729     ;;
730 esac
731
732 case "${ARCH}" in
733   hppa64)
734     CFLAGS_mpeg_video="${CFLAGS_mpeg_video} -ffunction-sections"
735     ;;
736 esac
737
738 dnl
739 dnl  default modules
740 dnl
741 PLUGINS="${PLUGINS} dummy rc logger access_file memcpy"
742 PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts"
743 PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
744 #PLUGINS="${PLUGINS} a52old imdct downmix imdct3dn downmix3dn imdctsse downmixsse"
745 PLUGINS="${PLUGINS} lpcm a52"
746 PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
747 PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
748 PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler"
749 PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
750 PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
751 PLUGINS="${PLUGINS} aout_file"
752 #PLUGINS="${PLUGINS} scope"
753 PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
754 PLUGINS="${PLUGINS} id3 m3u"
755 PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys"
756 PLUGINS="${PLUGINS} access_udp access_http ipv4 access_mms access_ftp"
757 PLUGINS="${PLUGINS} sap"
758
759 dnl
760 dnl  Accelerated modules
761 dnl
762 MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i420_yuy2_mmx i422_yuy2_mmx i420_ymga_mmx"
763 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
764 THREEDNOW_MODULES="memcpy3dn"
765 SSE_MODULES=""
766 ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
767
768 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
769     [ac_cv_mmx_inline],
770     [CFLAGS="${CFLAGS_save}"
771      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
772                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
773 if test "x${ac_cv_mmx_inline}" != "xno"; then
774   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
775 fi
776
777 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
778     [ac_cv_mmxext_inline],
779     [CFLAGS="${CFLAGS_save}"
780      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
781                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
782 if test "x${ac_cv_mmxext_inline}" != "xno"; then
783   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
784 fi
785
786 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
787     [ac_cv_3dnow_inline],
788     [CFLAGS="${CFLAGS_save}"
789      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
790                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
791 if test "x${ac_cv_3dnow_inline}" != "xno"; then
792   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
793   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
794 fi
795
796 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
797     [ac_cv_sse_inline],
798     [CFLAGS="${CFLAGS_save}"
799      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
800                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
801 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
802   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
803   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
804 fi
805
806 # don't try to grok AltiVec with native mingw32 it doesn't work right now
807 # we should be able to remove this test with future versions of mingw32
808 if test "x${SYS}" != "xmingw32"; then
809 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
810     [ac_cv_altivec_inline],
811     [CFLAGS="${CFLAGS_save}"
812      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
813          ac_cv_altivec_inline=yes,
814          [CFLAGS="${CFLAGS_save} -Wa,-m7400"
815           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
816             [ac_cv_altivec_inline="-Wa,-m7400"],
817             ac_cv_altivec_inline=no)
818          ])])
819 if test "x${ac_cv_altivec_inline}" != "xno"; then
820   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
821   if test "x${ac_cv_altivec_inline}" != "xyes"; then
822     CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_altivec_inline}"
823     CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_altivec_inline}"
824     CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_altivec_inline}"
825     CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_altivec_inline}"
826   fi
827   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
828 fi
829
830 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
831     [ac_cv_c_altivec],
832     [CFLAGS="${CFLAGS_save} -faltivec"
833      # Darwin test
834      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
835         ac_cv_c_altivec=-faltivec, [
836         # Linux/PPC test
837         CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
838         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
839             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
840         ])
841      CFLAGS="${CFLAGS_save}"])
842 if test "x${ac_cv_c_altivec}" != "xno"; then
843   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
844   CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_c_altivec}"
845   CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_c_altivec}"
846   CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_c_altivec}"
847   CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_c_altivec}"
848   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
849 fi
850
851 AC_CACHE_CHECK([if linker needs -framework vecLib],
852     [ac_cv_ld_altivec],
853     [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
854      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
855      LDFLAGS="${LDFLAGS_save}"
856     ])
857 if test "x${ac_cv_ld_altivec}" != "xno"; then
858   LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
859   LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
860   LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
861   LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
862 fi
863 fi # end if mingw32
864
865 AC_ARG_WITH(,[])
866 AC_ARG_WITH(,[Optimization options:])
867
868 dnl
869 dnl  Special arch tuning
870 dnl
871 AC_ARG_WITH(tuning,
872 [  --with-tuning=ARCH      enable special tuning for an architecture
873                           (default i686 on IA-32 and 750 on PPC)])
874 if test "x${with_tuning}" != "x"; then
875     if test "x${target_cpu}" = "xpowerpc"; then
876         CFLAGS_TUNING="-mtune=${with_tuning}"
877     else
878         CFLAGS_TUNING="-mcpu=${with_tuning}"
879     fi
880 else
881     if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then CFLAGS_TUNING="-mcpu=pentiumpro"
882     else
883         if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
884     fi
885 fi
886
887 dnl
888 dnl  x86 accelerations
889 dnl
890 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
891 then
892     ARCH="${ARCH} mmx"
893     PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
894 fi
895
896 dnl
897 dnl  Enable/disable optimizations
898 dnl
899 AC_ARG_ENABLE(optimizations,
900 [  --disable-optimizations disable compiler optimizations (default enabled)])
901 AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
902
903 dnl
904 dnl  AltiVec acceleration
905 dnl
906 AC_ARG_ENABLE(altivec,
907 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
908 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
909     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
910 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
911     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
912
913 dnl
914 dnl  Debugging mode
915 dnl
916 AC_ARG_ENABLE(debug,
917 [  --enable-debug          debug mode (default disabled)])
918 AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
919
920 dnl
921 dnl  Enable release-specific flags
922 dnl
923 AC_ARG_ENABLE(release,
924 [  --enable-release        activate extra optimizations (default disabled)])
925 AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
926
927 dnl
928 dnl Stream output
929 dnl
930 AC_ARG_ENABLE(sout,
931   [  --enable-sout           Stream output modules (default enabled)])
932 if test "x${enable_sout}" != "xno"
933 then
934   PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file"
935   PLUGINS="${PLUGINS} mux_ts mux_ps mux_avi mux_dummy"
936   PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
937   PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
938   PLUGINS="${PLUGINS} packetizer_copy"
939
940   PLUGINS="${PLUGINS} vout_encoder"
941 fi
942
943
944 dnl
945 dnl  Input plugins
946 dnl
947
948 AC_ARG_WITH(,[Input plugins:])
949
950 dnl
951 dnl  DVD module: optionally check for installed libdvdcss
952 dnl
953 AC_ARG_ENABLE(dvd,
954 [  --enable-dvd            DVD input module (default enabled)])
955 if test "x${enable_dvd}" != "xno"
956 then
957   AC_ARG_WITH(dvdcss,
958   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
959   AC_ARG_WITH(dvdcss-tree,
960   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
961   case "x${with_dvdcss}" in
962   x|xyes)
963     if test "x${with_dvdcss_tree}" = x
964     then
965       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
966         [ PLUGINS="${PLUGINS} dvd"
967           LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
968           LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
969         [ 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.])
970           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
971     else
972       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
973       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
974       if test "x${real_dvdcss_tree}" = "x"
975       then
976         dnl  The given directory can't be found
977         AC_MSG_RESULT(no)
978         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
979       fi
980       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
981       then
982         dnl  Use a custom libdvdcss
983         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
984         BUILTINS="${BUILTINS} dvd"
985         LDFLAGS_dvd="${LDFLAGS_dvd} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
986         LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
987         CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
988       else
989         dnl  The given libdvdcss wasn't built
990         AC_MSG_RESULT(no)
991         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
992       fi
993     fi
994   ;;
995   xno)
996     dnl  Compile without dvdcss (dlopen version, works only under Linux)
997     PLUGINS="${PLUGINS} dvd"
998     CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
999     LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
1000   ;;
1001   *)
1002     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
1003     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
1004     then
1005       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
1006       AC_MSG_RESULT(yes)
1007       PLUGINS="${PLUGINS} dvd"
1008       LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
1009       LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${with_dvdcss}/lib -ldvdcss"
1010       CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
1011     else
1012       dnl  No libdvdcss could be found, sorry
1013       AC_MSG_RESULT(no)
1014       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
1015     fi
1016   ;;
1017   esac
1018 fi
1019
1020 dnl
1021 dnl dvdread module: check for libdvdread
1022 dnl
1023 AC_ARG_ENABLE(dvdread,
1024 [  --enable-dvdread        dvdread input module (default disabled)])
1025 if test "x${enable_dvdread}" != "xno"
1026 then
1027   AC_ARG_WITH(dvdread,
1028   [    --with-dvdread=PATH    libdvdread headers and libraries])
1029   AC_ARG_WITH(dvdread-tree,
1030   [    --with-dvdread-tree=PATH libdvdread tree for static linking])
1031   if test "x${with_dvdread}" = x
1032   then
1033     if test "x${with_dvdread_tree}" = x
1034     then
1035       AC_CHECK_HEADERS(dvdread/dvd_reader.h,
1036         [ PLUGINS="${PLUGINS} dvdread"
1037           LDFLAGS_dvdread="${LDFLAGS_dvdread} -ldvdread ${LDFLAGS_dvdcss}" ],
1038         [ if test "x${enable_dvdread}" != "x"
1039           then
1040             AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
1041             AC_MSG_ERROR([cannot find libdvdread headers])
1042           fi ])
1043     else
1044       AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
1045       real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
1046       if test "x${real_dvdread_tree}" = "x"
1047       then
1048         dnl  The given directory can't be found
1049         AC_MSG_RESULT(no)
1050         AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
1051       fi
1052       if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
1053       then
1054         dnl  Use a custom libdvdread
1055         AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
1056         BUILTINS="${BUILTINS} dvdread"
1057         LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${real_dvdread_tree}/dvdread/.libs -ldvdread ${LDFLAGS_dvdcss}"
1058         CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${real_dvdread_tree}"
1059       else
1060         dnl  The given libdvdread wasn't built
1061         AC_MSG_RESULT(no)
1062         AC_MSG_ERROR([cannot find ${real_dvdread_tree}/dvdread/.libs/libdvdread.a, make sure you compiled libdvdread in ${with_dvdread_tree}])
1063       fi
1064     fi
1065   else
1066     AC_MSG_CHECKING(for dvdread headers in ${with_dvdread})
1067     if test -f ${with_dvdread}/include/dvdread/dvd_reader.h
1068     then
1069       dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
1070       AC_MSG_RESULT(yes)
1071       PLUGINS="${PLUGINS} dvdread"
1072       LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${with_dvdread}/lib -ldvdread ${LDFLAGS_dvdcss}"
1073       CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${with_dvdread}/include"
1074     else
1075       dnl  No libdvdread could be found, sorry
1076       AC_MSG_RESULT(no)
1077       AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
1078     fi
1079   fi
1080 fi
1081
1082 dnl
1083 dnl dvdplay module: check for libdvdplay
1084 dnl
1085 AC_ARG_ENABLE(dvdplay,
1086 [  --enable-dvdplay        dvdplay input module (default disabled)])
1087 if test "x${enable_dvdplay}" != "xno"
1088 then
1089   AC_ARG_WITH(dvdplay,
1090   [    --with-dvdplay=PATH    libdvdplay headers and libraries])
1091   AC_ARG_WITH(dvdplay-tree,
1092   [    --with-dvdplay-tree=PATH libdvdplay tree for static linking])
1093   if test "x${with_dvdplay}" = x
1094   then
1095     if test "x${with_dvdplay_tree}" = x
1096     then
1097       AC_CHECK_HEADERS(dvdplay/dvdplay.h,
1098         [ PLUGINS="${PLUGINS} dvdplay"
1099           LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1100           CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread}" ],
1101         [ if test "x${enable_dvdplay}" != "x"
1102           then
1103             AC_MSG_WARN([Please get libdvdplay from http://www.videolan.org/.])
1104             AC_MSG_ERROR([cannot find libdvdplay headers])
1105           fi ])
1106     else
1107       AC_MSG_CHECKING(for libdvdplay.a in ${with_dvdplay_tree})
1108       real_dvdplay_tree="`cd ${with_dvdplay_tree} 2>/dev/null && pwd`"
1109       if test "x${real_dvdplay_tree}" = "x"
1110       then
1111         dnl  The given directory can't be found
1112         AC_MSG_RESULT(no)
1113         AC_MSG_ERROR([cannot cd to ${with_dvdplay_tree}])
1114       fi
1115       if test -f "${real_dvdplay_tree}/src/.libs/libdvdplay.a"
1116       then
1117         dnl  Use a custom libdvdplay
1118         AC_MSG_RESULT(${real_dvdplay_tree}/src/.libs/libdvdplay.a)
1119         BUILTINS="${BUILTINS} dvdplay"
1120         LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${real_dvdplay_tree}/src/.libs -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1121         CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${real_dvdplay_tree}/src"
1122       else
1123         dnl  The given libdvdplay wasn't built
1124         AC_MSG_RESULT(no)
1125         AC_MSG_ERROR([cannot find ${real_dvdplay_tree}/src/.libs/libdvdplay.a, make sure you compiled libdvdplay in ${with_dvdplay_tree}])
1126       fi
1127     fi
1128   else
1129     AC_MSG_CHECKING(for dvdplay headers in ${with_dvdplay})
1130     if test -f ${with_dvdplay}/include/dvdplay/dvdplay.h
1131     then
1132       dnl  Use ${with_dvdplay}/include/dvdplay/dvdplay.h
1133       AC_MSG_RESULT(yes)
1134       PLUGINS="${PLUGINS} dvdplay"
1135       LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${with_dvdplay}/lib -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1136       CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${with_dvdplay}/include"
1137     else
1138       dnl  No libdvdplay could be found, sorry
1139       AC_MSG_RESULT(no)
1140       AC_MSG_ERROR([cannot find ${with_dvdplay}/include/dvdplay/dvdplay.h])
1141     fi
1142   fi
1143 fi
1144
1145 dnl
1146 dnl  libdvbpsi ts demux/mux
1147 dnl
1148 AC_ARG_ENABLE(dvbpsi,
1149 [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
1150 if test "x${enable_dvbpsi}" != "xno"
1151 then
1152   AC_ARG_WITH(dvbpsi,
1153   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
1154   AC_ARG_WITH(dvbpsi,
1155   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
1156   case "x${with_dvbpsi}" in
1157   x|xyes)
1158     if test "x${with_dvbpsi_tree}" = "x"
1159     then
1160       AC_CHECK_HEADERS(dvbpsi/dr.h,
1161         [ PLUGINS="${PLUGINS} ts_dvbpsi"
1162           LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -ldvbpsi" 
1163           PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1164           LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -ldvbpsi" ],
1165         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
1166         [#include <stdint.h>
1167 #include <dvbpsi/dvbpsi.h>
1168 #include <dvbpsi/descriptor.h>
1169 #include <dvbpsi/pat.h>
1170 #include <dvbpsi/pmt.h>])
1171     else
1172       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
1173       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
1174       if test "x${real_dvbpsi_tree}" = "x"
1175       then
1176         dnl  The given directory can't be found
1177         AC_MSG_RESULT(no)
1178         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
1179       fi
1180       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
1181       then
1182         dnl  Use a custom libdvbpsi
1183         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
1184         BUILTINS="${BUILTINS} ts_dvbpsi"
1185         LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1186         CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1187
1188         BUILTINS="${BUILTINS} mux_ts_dvbpsi"
1189         LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1190         CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1191
1192       else
1193         dnl  The given libdvbpsi wasn't built
1194         AC_MSG_RESULT(no)
1195         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
1196       fi
1197     fi
1198   ;;
1199   xno)
1200     dnl  Compile without dvbpsi
1201   ;;
1202   *)
1203     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
1204     if test "x${with_dvbpsi}" = "x"
1205     then
1206       LDFLAGS_test=""
1207       CPPFLAGS_test=""
1208     else
1209       LDFLAGS_test="-L${with_dvbpsi}/lib"
1210       CPPFLAGS_test="-I${with_dvbpsi}/include"
1211     fi
1212     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1213     AC_CHECK_HEADER([dvbpsi/dr.h],[
1214       PLUGINS="${PLUGINS} ts_dvbpsi"
1215       LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1216       CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} ${CPPFLAGS_test}"
1217       PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1218       LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1219       CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} ${CPPFLAGS_test}"
1220
1221       ],[
1222       if test "x${enable_dvbpsi}" != "x"
1223       then
1224         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])
1225       fi
1226     ])
1227     CPPFLAGS="${CPPFLAGS_save}"
1228   ;;
1229   esac
1230 fi
1231
1232 dnl
1233 dnl  Video4Linux plugin
1234 dnl
1235 AC_ARG_ENABLE(v4l,
1236   [  --enable-v4l            Video4Linux input support (default disabled)])
1237 if test "x${enable_v4l}" = "xyes"
1238 then
1239   AC_CHECK_HEADERS(libv4l/v4l.h, [
1240     PLUGINS="${PLUGINS} v4l"
1241    ],[])
1242 fi
1243
1244 dnl
1245 dnl  VCD module
1246 dnl
1247 AC_ARG_ENABLE(vcd,
1248   [  --enable-vcd            VCD support for Linux, FreeBSD, MacOS X and Win32 (default enabled)])
1249
1250 if test "x${enable_vcd}" != "xno"
1251 then
1252   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1253   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1254     AC_MSG_RESULT(yes)
1255     PLUGINS="${PLUGINS} vcd"
1256   ],[
1257     AC_MSG_RESULT(no)
1258   ])
1259
1260   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1261   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1262     AC_MSG_RESULT(yes)
1263     PLUGINS="${PLUGINS} vcd"
1264     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1265   ],[
1266     AC_MSG_RESULT(no)
1267   ])
1268
1269   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1270   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1271     AC_MSG_RESULT(yes)
1272     PLUGINS="${PLUGINS} vcd"
1273     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1274   ],[
1275     AC_MSG_RESULT(no)
1276   ])
1277
1278   if test "x${SYS}" = "xbsdi" -o "x${SYS}" = "xmingw32"
1279   then
1280     PLUGINS="${PLUGINS} vcd"
1281   fi
1282
1283   if test "x${SYS}" = "xdarwin"
1284   then
1285     PLUGINS="${PLUGINS} vcd"
1286     LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation"
1287   fi
1288 fi
1289
1290 dnl
1291 dnl  Satellite input module
1292 dnl
1293 AC_ARG_ENABLE(satellite,
1294   [  --enable-satellite      satellite card support (default disabled)],
1295   [ if test "x${enable_satellite}" = "xyes"
1296     then
1297       PLUGINS="${PLUGINS} satellite"
1298     fi])
1299
1300 dnl
1301 dnl  ipv6 plugin - not for QNX yet
1302 dnl
1303 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
1304 then
1305   have_ipv6=false
1306   AC_CHECK_FUNCS(inet_pton,[have_ipv6=:],[
1307     AC_CHECK_LIB(resolv,inet_pton,
1308       [have_ipv6=:
1309        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lresolv"])
1310   ])
1311   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
1312   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
1313     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=false])
1314   if ${have_ipv6}; then
1315     PLUGINS="${PLUGINS} ipv6"
1316   fi
1317 fi
1318 if test "x${SYS}" = "xmingw32"
1319 then
1320   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
1321   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
1322     PLUGINS="${PLUGINS} ipv6"],[AC_MSG_RESULT(no)])
1323 fi
1324
1325 dnl
1326 dnl  AVI demux plugin
1327 dnl
1328 AC_ARG_ENABLE(avi,
1329   [  --enable-avi            AVI demux module (default enabled)])
1330 if test "x${enable_avi}" != "xno"
1331 then
1332   PLUGINS="${PLUGINS} avi"
1333 fi
1334
1335 dnl
1336 dnl  ASF demux plugin
1337 dnl
1338 AC_ARG_ENABLE(asf,
1339   [  --enable-asf            ASF demux module (default enabled)])
1340 if test "x${enable_asf}" != "xno"
1341 then
1342   PLUGINS="${PLUGINS} asf"
1343 fi
1344
1345 dnl
1346 dnl  AAC demux plugin
1347 dnl
1348 AC_ARG_ENABLE(aac,
1349   [  --enable-aac            AAC demux module (default enabled)])
1350 if test "x${enable_aac}" != "xno"
1351 then
1352   PLUGINS="${PLUGINS} aac"
1353 fi
1354
1355 dnl
1356 dnl  ogg plugin
1357 dnl
1358 AC_ARG_ENABLE(ogg,
1359   [  --enable-ogg            Ogg demux support (default enabled)])
1360 if test "x${enable_ogg}" != "xno"
1361 then
1362   AC_CHECK_HEADERS(ogg/ogg.h, [
1363     AC_CHECK_LIB( ogg, oggpack_read, [
1364       PLUGINS="${PLUGINS} ogg"
1365       LDFLAGS_ogg="${LDFLAGS_ogg} -logg"
1366       AC_CHECK_LIB( ogg, oggpackB_read, [
1367         CPPFLAGS_ogg="${CPPFLAGS_ogg} -DHAVE_OGGPACKB"])])
1368    ],[])
1369 fi
1370
1371 dnl
1372 dnl  raw dv demux plugin
1373 dnl
1374 AC_ARG_ENABLE(rawdv,
1375   [  --enable-rawdv          raw dv demux module (default enabled)])
1376 if test "x${enable_rawdv}" != "xno"
1377 then
1378   PLUGINS="${PLUGINS} rawdv"
1379 fi
1380
1381 dnl
1382 dnl  Codec plugins
1383 dnl
1384
1385 AC_ARG_WITH(,[Codec plugins:])
1386
1387 dnl
1388 dnl  mad plugin
1389 dnl
1390 AC_ARG_ENABLE(mad,
1391   [  --enable-mad            libmad module (default disabled)])
1392 if test "x${enable_mad}" != "xno"
1393 then
1394   AC_ARG_WITH(mad,
1395     [    --with-mad=PATH       path to libmad],[],[])
1396   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
1397   then
1398     CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${with_mad}/include"
1399     LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${with_mad}/lib"
1400   fi
1401
1402   AC_ARG_WITH(mad-tree,
1403     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
1404   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
1405   then
1406     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
1407     if test "x${real_mad_tree}" = "x"
1408     then
1409       dnl  The given directory can't be found
1410       AC_MSG_RESULT(no)
1411       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
1412     fi
1413     dnl  Use a custom libmad
1414     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
1415     if test -f ${real_mad_tree}/libmad/mad.h
1416     then
1417       AC_MSG_RESULT(yes)
1418       CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${real_mad_tree}/libmad"
1419       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${real_mad_tree}/libmad/.libs"
1420       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1421       AC_CHECK_LIB(mad, mad_bit_init, [
1422         BUILTINS="${BUILTINS} mpgatofixed32"
1423         LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad"
1424         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1425       ],[])
1426       LDFLAGS="${LDFLAGS_save}"
1427     else
1428       AC_MSG_RESULT(no)
1429       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1430     fi
1431   else
1432     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mpgatofixed32}"
1433     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1434     AC_CHECK_HEADERS(mad.h, ,
1435       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1436     AC_CHECK_LIB(mad, mad_bit_init, [
1437       PLUGINS="${PLUGINS} mpgatofixed32"
1438       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad" ],
1439       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1440     CPPFLAGS="${CPPFLAGS_save}"
1441     LDFLAGS="${LDFLAGS_save}"
1442   fi
1443 fi
1444
1445 dnl
1446 dnl   libid3tag support
1447 dnl
1448 AC_CHECK_HEADERS(id3tag.h, [
1449   LDFLAGS_id3tag="${LDFLAGS_id3tag} -lz -lid3tag"
1450   PLUGINS="${PLUGINS} id3tag"])
1451
1452 dnl
1453 dnl  ffmpeg decoder plugin
1454 dnl
1455 AC_ARG_ENABLE(ffmpeg,
1456 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1457 if test "x${enable_ffmpeg}" = "xyes"
1458 then
1459   AC_ARG_WITH(ffmpeg,
1460     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1461   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1462   then
1463     CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/ffmpeg"
1464     LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib"
1465   fi
1466
1467   dnl Add postprocessing modules
1468   PLUGINS="${PLUGINS} postprocessing_c"
1469   if test "x${ac_cv_mmx_inline}" != "xno"; then
1470     PLUGINS="${PLUGINS} postprocessing_mmx"
1471   fi
1472
1473   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1474     PLUGINS="${PLUGINS} postprocessing_mmxext"
1475   fi
1476
1477   AC_ARG_WITH(ffmpeg-tree,
1478   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1479   if test "x${with_ffmpeg_tree}" != "x"
1480   then
1481     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1482     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1483     if test "x${real_ffmpeg_tree}" = x
1484     then
1485       dnl  The given directory can't be found
1486       AC_MSG_RESULT(no)
1487       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1488     fi
1489     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1490     then
1491       dnl  Use a custom libffmpeg
1492       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1493       BUILTINS="${BUILTINS} ffmpeg"
1494       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
1495       CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
1496     else
1497       dnl  The given libavcodec wasn't built
1498       AC_MSG_RESULT(no)
1499       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1500     fi
1501   else
1502     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
1503     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
1504     AC_CHECK_LIB(avcodec, avcodec_init, [
1505       BUILTINS="${BUILTINS} ffmpeg"
1506       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" ],
1507       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1508     LDFLAGS="${LDFLAGS_save}"
1509     CPPFLAGS="${CPPFLAGS_save}"
1510   fi
1511 fi
1512
1513 dnl
1514 dnl  faad decoder plugin
1515 dnl
1516 AC_ARG_ENABLE(faad,
1517 [  --enable-faad           faad codec (default disabled)])
1518 if test "x${enable_faad}" = "xyes"
1519 then
1520   AC_ARG_WITH(faad,
1521     [    --with-faad=PATH      path to faad installation],[],[])
1522   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1523   then
1524     CPPFLAGS_faad="${CPPFLAGS_faad} -I${with_faad}/include"
1525     LDFLAGS_faad="${LDFLAGS_faad} -L${with_faad}/lib"
1526   fi
1527   LDFLAGS_faad="${LDFLAGS_faad}"
1528
1529   AC_ARG_WITH(faad-tree,
1530   [    --with-faad-tree=PATH faad tree for static linking])
1531   if test "x${with_faad_tree}" != "x"
1532   then
1533     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1534     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1535     if test "x${real_faad_tree}" = x
1536     then
1537       dnl  The given directory can't be found
1538       AC_MSG_RESULT(no)
1539       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1540     fi
1541     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1542     then
1543       dnl  Use a custom faad
1544       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1545       BUILTINS="${BUILTINS} faad"
1546       LDFLAGS_faad="${LDFLAGS_faad} -L${real_faad_tree}/libfaad/.libs -lfaad"
1547       CPPFLAGS_faad="${CPPFLAGS_faad} -I${real_faad_tree}/include"
1548     else
1549       dnl  The given libfaad wasn't built
1550       AC_MSG_RESULT(no)
1551       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1552     fi
1553   else
1554     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
1555     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_faad}"
1556     AC_CHECK_HEADERS(faad.h, ,
1557       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1558     AC_CHECK_LIB(faad, faacDecOpen, [
1559       PLUGINS="${PLUGINS} faad"
1560       LDFLAGS_faad="${LDFLAGS_faad} -lfaad" ],
1561       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1562     LDFLAGS="${LDFLAGS_save}"
1563     CPPFLAGS="${CPPFLAGS_save}"
1564   fi
1565 fi
1566
1567
1568 dnl
1569 dnl  xvid decoder plugin
1570 dnl
1571 AC_ARG_ENABLE(xvid,
1572 [  --enable-xvid           xvid codec (default disabled)])
1573 if test "x${enable_xvid}" = "xyes"
1574 then
1575   AC_ARG_WITH(xvid,
1576     [    --with-xvid=PATH      path to xvid installation],[],[])
1577   if test "x${with_xvid}" != "xno" -a "x${with_xvid}" != "x"
1578   then
1579     CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${with_xvid}/include"
1580     LDFLAGS_xvid="${LDFLAGS_xvid} -L${with_xvid}/lib"
1581   fi
1582   LDFLAGS_xvid="${LDFLAGS_xvid}"
1583
1584   AC_ARG_WITH(xvid-tree,
1585   [    --with-xvid-tree=PATH xvid tree for static linking])
1586   if test "x${with_xvid_tree}" != "x"
1587   then
1588     AC_MSG_CHECKING(for libxvidcore.a in ${with_xvid_tree})
1589     real_xvid_tree="`cd ${with_xvid_tree} 2>/dev/null && pwd`"
1590     if test "x${real_xvid_tree}" = x
1591     then
1592       dnl  The given directory can't be found
1593       AC_MSG_RESULT(no)
1594       AC_MSG_ERROR([cannot cd to ${with_xvid_tree}])
1595     fi
1596     if test -f "${real_xvid_tree}/build/generic/libxvidcore.a"
1597     then
1598       dnl  Use a custom xvid
1599       AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a)
1600       BUILTINS="${BUILTINS} xvid"
1601       LDFLAGS_xvid="${LDFLAGS_xvid} -L${real_xvid_tree}/build/generic -lxvidcore"
1602       CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src"
1603     else
1604       dnl  The given libxvidcore wasn't built
1605       AC_MSG_RESULT(no)
1606       AC_MSG_ERROR([cannot find ${real_xvid_tree}/build/generic/libxvidcore.a, make sure you compiled libxvidcore in ${with_xvid_tree}])
1607     fi
1608   else
1609     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_xvid}"
1610     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_xvid}"
1611     AC_CHECK_HEADERS(xvid.h, ,
1612       [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
1613     AC_CHECK_LIB(xvid, xvid_init, [
1614       PLUGINS="${PLUGINS} xvid"
1615       LDFLAGS_xvid="${LDFLAGS_xvid} -lxvid" ],
1616       [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
1617     LDFLAGS="${LDFLAGS_save}"
1618     CPPFLAGS="${CPPFLAGS_save}"
1619   fi
1620 fi
1621
1622
1623
1624 dnl
1625 dnl MP4 module
1626 dnl
1627 AC_ARG_ENABLE(mp4,
1628   [  --enable-mp4            MP4 demux module (default enabled)])
1629 if test "x${enable_mp4}" != "xno"
1630 then
1631
1632     PLUGINS="${PLUGINS} mp4"
1633     AC_CHECK_HEADERS(zlib.h,
1634               [ LDFLAGS_mp4="${LDFLAGS_mp4} -lz" ] )
1635 fi
1636
1637 dnl
1638 dnl  a52 AC3 decoder plugin
1639 dnl
1640 AC_ARG_ENABLE(a52,
1641   [  --enable-a52            A/52 support with liba52 (default enabled)])
1642 if test "x${enable_a52}" != "xno"
1643 then
1644   AC_ARG_WITH(a52,
1645     [    --with-a52=PATH       a52 headers and libraries])
1646   AC_ARG_WITH(a52-tree,
1647     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1648   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1649   then
1650     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1651     if test "x${real_a52_tree}" = "x"
1652     then
1653       dnl  The given directory can't be found
1654       AC_MSG_RESULT(no)
1655       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1656     fi
1657     dnl  Use a custom a52dec
1658     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1659     if test -f ${real_a52_tree}/include/a52.h
1660     then
1661       AC_MSG_RESULT(yes)
1662       CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -I${real_a52_tree}"
1663       LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -L${real_a52_tree}/liba52/.libs"
1664       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
1665       AC_CHECK_LIB(a52, a52_free, [
1666         BUILTINS="${BUILTINS} a52tofloat32"
1667         LDFLAGS_a52tofloat32="-la52 ${LDFLAGS_a52tofloat32}"
1668         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -DUSE_A52DEC_TREE"
1669         ],[
1670         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1671         then
1672           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1673         else
1674           AC_MSG_ERROR([the specified tree hasn't been compiled])
1675         fi
1676       ])
1677       LDFLAGS="${LDFLAGS_save}"
1678     else
1679       AC_MSG_RESULT(no)
1680       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1681     fi
1682   else
1683     if test "x${with_a52}" = "x"
1684     then
1685       LDFLAGS_test=""
1686       CPPFLAGS_test=""
1687     else
1688       LDFLAGS_test="-L${with_a52}/lib"
1689       CPPFLAGS_test="-I${with_a52}/include"
1690     fi
1691     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
1692     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LDFLAGS_a52tofloat32}"
1693     AC_CHECK_HEADERS(a52dec/a52.h, [
1694       AC_CHECK_LIB(a52, a52_free, [
1695         PLUGINS="${PLUGINS} a52tofloat32"
1696         LDFLAGS_a52tofloat32="${LDFLAGS_test} -la52 ${LDFLAGS_a52tofloat32}"
1697         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} ${CPPFLAGS_test}"
1698       ],[
1699         AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.])
1700       ])
1701     ])
1702     CPPFLAGS="${CPPFLAGS_save}"
1703     LDFLAGS="${LDFLAGS_save}"
1704   fi
1705 fi
1706
1707 dnl
1708 dnl  cinepak plugin
1709 dnl
1710 AC_ARG_ENABLE(cinepak,
1711   [  --enable-cinepak        Cinepak decoder (default enabled)])
1712 if test "x${enable_cinepak}" != "xno"
1713 then
1714   PLUGINS="${PLUGINS} cinepak"
1715 fi
1716
1717 dnl
1718 dnl  DV plugin
1719 dnl
1720 AC_ARG_ENABLE(dv,
1721   [  --enable-dv             DV decoder support (default disabled)])
1722 if test "x${enable_dv}" = "xyes"
1723 then
1724   AC_CHECK_HEADERS(libdv/dv.h, [
1725     PLUGINS="${PLUGINS} dv"
1726     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1727    ],[])
1728 fi
1729
1730 dnl
1731 dnl  Vorbis plugin
1732 dnl
1733 AC_ARG_ENABLE(vorbis,
1734   [  --enable-vorbis         Vorbis decoder support (default enabled)])
1735 if test "x${enable_vorbis}" != "xno"
1736 then
1737   AC_CHECK_HEADERS(vorbis/codec.h, [
1738     PLUGINS="${PLUGINS} vorbis"
1739     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis -logg"
1740    ],[])
1741 fi
1742
1743 dnl
1744 dnl  Tremor plugin
1745 dnl
1746 AC_ARG_ENABLE(tremor,
1747   [  --enable-tremor         Tremor decoder support (default disabled)])
1748 if test "x${enable_tremor}" = "xyes"
1749 then
1750   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
1751     PLUGINS="${PLUGINS} tremor"
1752     LDFLAGS_tremor="${LDFLAGS_tremor} -lvorbisidec -logg"
1753    ],[])
1754 fi
1755
1756 dnl
1757 dnl  tarkin decoder plugin
1758 dnl
1759 AC_ARG_ENABLE(tarkin,
1760 [  --enable-tarkin         experimental tarkin codec (default disabled)])
1761 if test "x${enable_tarkin}" = "xyes"
1762 then
1763   AC_ARG_WITH(tarkin-tree,
1764   [    --with-tarkin-tree=PATH tarkin tree for static linking])
1765   if test "x${with_tarkin_tree}" != "x"
1766   then
1767     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
1768     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
1769     if test -f "${real_tarkin_tree}/tarkin.o"
1770     then
1771       BUILTINS="${BUILTINS} tarkin"
1772       CPPFLAGS_tarkin="${CPPFLAGS_tarkin} -I${real_tarkin_tree}"
1773       LDFLAGS_tarkin="${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"
1774       AC_MSG_RESULT(yes)
1775     else
1776       dnl  The given tarkin tree wasn't built
1777       AC_MSG_RESULT(no)
1778       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
1779                     make sure you compiled tarkin in ${with_tarkin_tree}])
1780     fi
1781   fi
1782 fi
1783
1784 dnl
1785 dnl  theora decoder plugin
1786 dnl
1787 AC_ARG_ENABLE(theora,
1788 [  --enable-theora         experimental theora codec (default disabled)])
1789 if test "x${enable_theora}" = "xyes"
1790 then
1791   AC_CHECK_HEADERS(theora/theora.h, [
1792     AC_CHECK_LIB(theora, theora_granule_time, [
1793       BUILTINS="${BUILTINS} theora"
1794       LDFLAGS_theora="${LDFLAGS_theora} -ltheora -logg" ],[
1795       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
1796 You also need to check that you have a libogg posterior to the 1.0 release.])],
1797       [-logg])
1798   ])
1799 fi
1800
1801 dnl
1802 dnl  Video plugins
1803 dnl
1804
1805 AC_ARG_WITH(,[Video plugins:])
1806
1807 dnl
1808 dnl  X11 module
1809 dnl  (enabled by default except on win32)
1810 dnl
1811 AC_ARG_ENABLE(x11,
1812   [  --enable-x11            X11 support (default enabled)])
1813 if test "x${enable_x11}" != "xno" &&
1814   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1815   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1816   AC_CHECK_HEADERS(X11/Xlib.h, [
1817     PLUGINS="${PLUGINS} x11"
1818     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
1819     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
1820   ])
1821   CPPFLAGS="${CPPFLAGS_save}"
1822 fi
1823
1824 dnl
1825 dnl  XVideo module
1826 dnl  (enabled by default except on win32)
1827 dnl
1828 AC_ARG_ENABLE(xvideo,
1829   [  --enable-xvideo         XVideo support (default enabled)])
1830 if test "x${enable_xvideo}" != "xno" &&
1831   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1832   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1833   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1834     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
1835     AC_CHECK_LIB(Xv_pic,XvPutImage,
1836       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1837       PLUGINS="${PLUGINS} xvideo"
1838       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
1839       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1840       AC_CHECK_LIB(Xv,XvPutImage,
1841         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1842         PLUGINS="${PLUGINS} xvideo"
1843         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
1844         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1845         # Otherwise... well, do nothing.
1846         :
1847       )
1848     )
1849     CFLAGS="${CFLAGS_save}"
1850   ]
1851   CPPFLAGS="${CPPFLAGS_save}")
1852 fi
1853
1854 dnl
1855 dnl  SDL module
1856 dnl
1857 AC_ARG_ENABLE(sdl,
1858   [  --enable-sdl            SDL support (default enabled)])
1859 if test "x${enable_sdl}" != "xno"
1860 then
1861   SDL_PATH="${PATH}"
1862   AC_ARG_WITH(sdl-config-path,
1863     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1864     [ if test "x${with_sdl_config_path}" != "xno"
1865       then
1866         SDL_PATH="${with_sdl_config_path}:${PATH}"
1867       fi ])
1868   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1869   SDL_CONFIG="${SDL12_CONFIG}"
1870   SDL_HEADER="SDL12/SDL.h"
1871   if test "x${SDL_CONFIG}" = "xno"
1872   then
1873     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1874     SDL_CONFIG=${SDL11_CONFIG}
1875     SDL_HEADER="SDL11/SDL.h"
1876   fi
1877   if test "x${SDL_CONFIG}" = "xno"
1878   then
1879     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1880     SDL_HEADER="SDL/SDL.h"
1881   fi
1882   # check for cross-compiling
1883   SDL_PREFIX=
1884   AC_ARG_WITH(sdl-prefix,
1885     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
1886                                e.g use as:
1887                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
1888   if test "x${with_sdl_prefix}" != "xno" -a "x${with_sdl_prefix}" != "x"
1889   then
1890     SDL_PREFIX="--prefix=${with_sdl_prefix}"
1891   fi
1892   if test "x${SDL_CONFIG}" != "xno"
1893   then
1894     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
1895     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1896     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1897     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1898     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1899     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
1900     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1901       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1902       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
1903           As a last resort we also test for SDL.h presence),
1904       [ AC_MSG_ERROR([The development package for SDL is not installed.
1905 Please install it and try again. Alternatively you can also configure with
1906 --disable-sdl.])
1907       ])])
1908     CPPFLAGS="${CPPFLAGS_save}"
1909     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1910     then
1911       AC_MSG_ERROR([The development package for SDL is not installed.
1912 Please install it and try again. Alternatively you can also configure with
1913 --disable-sdl.])
1914     fi
1915   elif test "x${enable_sdl}" =  "xyes"
1916   then
1917     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1918 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1919     ])
1920   fi
1921 fi
1922
1923 dnl
1924 dnl  Qt Embedded module
1925 dnl  (disabled by default)
1926 dnl
1927 AC_ARG_ENABLE(qte,
1928   [  --enable-qte            QT Embedded support (default disabled)])
1929 if test "x${enable_qte}" = "xyes"
1930 then
1931   AC_ARG_WITH(qte,
1932   [    --with-qte=PATH       Qt Embedded headers and libraries])
1933   if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
1934   then
1935     LDFLAGS_qte="${LDFLAGS_qte} -L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1936     CPPFLAGS_qte="${CPPFLAGS_qte} -I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1937   else
1938     LDFLAGS_qte="${LDFLAGS_qte} -L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1939     CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1940   fi
1941   PLUGINS="${PLUGINS} qte"
1942   NEED_QTE_MAIN=yes
1943   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
1944   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
1945     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
1946   ] )
1947   CPPFLAGS="${CPPFLAGS_save}"
1948 fi
1949
1950 dnl
1951 dnl  Windows DirectX module
1952 dnl
1953 AC_ARG_ENABLE(directx,
1954   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1955 if test "x${enable_directx}" != "xno"
1956 then
1957   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
1958   then
1959     AC_ARG_WITH(directx,
1960     [    --with-directx=PATH   Win32 DirectX headers])
1961     if test "x${with_directx}" = "x"
1962     then
1963       AC_CHECK_HEADERS(ddraw.h,
1964       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
1965         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
1966     else
1967       AC_MSG_CHECKING(for directX headers in ${with_directx})
1968       if test -f ${with_directx}/ddraw.h
1969       then
1970         PLUGINS="${PLUGINS} vout_directx aout_directx"
1971         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
1972         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
1973         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
1974         AC_MSG_RESULT(yes)
1975       else
1976         AC_MSG_RESULT(no)
1977         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1978       fi
1979     fi
1980   fi
1981 fi
1982
1983 dnl
1984 dnl  Linux framebuffer module
1985 dnl
1986 AC_ARG_ENABLE(fb,
1987   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
1988     if test "x${enable_fb}" != "xno"
1989     then
1990       AC_CHECK_HEADERS(linux/fb.h, [
1991         PLUGINS="${PLUGINS} fb"
1992       ])
1993     fi
1994
1995 dnl
1996 dnl  Linux MGA module
1997 dnl
1998 AC_ARG_ENABLE(mga,
1999   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2000   [ if test "x${enable_mga}" = "xyes"
2001     then
2002       PLUGINS="${PLUGINS} mga xmga"
2003     fi ])
2004
2005 dnl
2006 dnl  SVGAlib module
2007 dnl
2008 AC_ARG_ENABLE(svgalib,
2009   [  --enable-svgalib        SVGAlib support (default disabled)])
2010 if test "x${enable_svgalib}" = "xyes"
2011 then
2012   PLUGINS="${PLUGINS} svgalib"
2013   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
2014 fi
2015
2016 dnl
2017 dnl  GGI module
2018 dnl
2019 AC_ARG_ENABLE(ggi,
2020   [  --enable-ggi            GGI support (default disabled)])
2021 if test "x${enable_ggi}" = "xyes"
2022 then
2023   PLUGINS="${PLUGINS} ggi"
2024   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
2025   AC_ARG_WITH(ggi,
2026     [    --with-ggi=PATH       path to libggi],
2027     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
2028       then
2029         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
2030         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
2031       fi ])
2032 fi
2033
2034 dnl
2035 dnl  Glide module
2036 dnl
2037 AC_ARG_ENABLE(glide,
2038   [  --enable-glide          Glide (3dfx) support (default disabled)])
2039 if test "x${enable_glide}" = "xyes"
2040 then
2041   PLUGINS="${PLUGINS} glide"
2042   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
2043   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
2044   AC_ARG_WITH(glide,
2045     [    --with-glide=PATH     path to libglide],
2046     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
2047       then
2048         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
2049         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
2050       fi ])
2051 fi
2052
2053 dnl
2054 dnl  AA plugin
2055 dnl
2056 AC_ARG_ENABLE(aa,
2057   [  --enable-aa             aalib output (default disabled)])
2058 if test "x${enable_aa}" = "xyes"
2059 then
2060   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2061   if test "x${have_aa}" = "xtrue"
2062   then
2063     PLUGINS="${PLUGINS} aa"
2064     LDFLAGS_aa="${LDFLAGS_aa} -laa"
2065   fi
2066 fi
2067
2068 dnl
2069 dnl  win32 GDI plugin
2070 dnl
2071 AC_ARG_ENABLE(wingdi,
2072   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2073 if test "x${enable_wingdi}" != "xno"; then
2074   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2075     PLUGINS="${PLUGINS} wingdi"
2076     LDFLAGS_wingdi="${LDFLAGS_wingdi} -lgdi32"
2077   fi
2078 fi
2079
2080 dnl
2081 dnl  Audio plugins
2082 dnl
2083
2084 AC_ARG_WITH(,[Audio plugins:])
2085
2086 dnl
2087 dnl  OSS /dev/dsp module (enabled by default except on win32)
2088 dnl
2089 AC_ARG_ENABLE(oss,
2090   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2091
2092 if test "x${enable_oss}" != "xno" &&
2093   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
2094 then
2095   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2096     PLUGINS="${PLUGINS} oss"
2097     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
2098   ])
2099 fi
2100
2101 dnl
2102 dnl  Esound module
2103 dnl
2104 AC_ARG_ENABLE(esd,
2105   [  --enable-esd            Esound library support (default disabled)],
2106   [if test "x${enable_esd}" = "xyes"
2107    then
2108      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2109      if test "x${ESD_CONFIG}" != "xno"
2110      then
2111        PLUGINS="${PLUGINS} esd"
2112        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
2113        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
2114      fi
2115    fi])
2116
2117 dnl
2118 dnl  aRts module
2119 dnl
2120 AC_ARG_ENABLE(arts,
2121   [  --enable-arts           aRts sound server (default disabled)],
2122   [if test "x${enable_arts}" = "xyes"
2123    then
2124      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2125      if test "x${ARTS_CONFIG}" != "xno"
2126      then
2127        PLUGINS="${PLUGINS} arts"
2128        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
2129        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
2130      fi
2131    fi])
2132
2133 dnl
2134 dnl  ALSA module
2135 dnl
2136 AC_ARG_ENABLE(alsa,
2137   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2138   [if test "x${enable_alsa}" = "xyes"
2139    then
2140      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2141      if test "x${have_alsa}" = "xtrue"
2142      then
2143        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2144                        #define ALSA_PCM_NEW_SW_PARAMS_API
2145                        #include <alsa/asoundlib.h>],
2146           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2147            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2148        PLUGINS="${PLUGINS} alsa"
2149        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
2150      else
2151        AC_MSG_ERROR([Could not find ALSA development headers])
2152      fi
2153    fi])
2154
2155 dnl
2156 dnl  win32 waveOut plugin
2157 dnl
2158 AC_ARG_ENABLE(waveout,
2159   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2160 if test "x${enable_waveout}" != "xno"; then
2161   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2162     PLUGINS="${PLUGINS} waveout"
2163     LDFLAGS_waveout="-lwinmm"
2164   fi
2165 fi
2166
2167 dnl
2168 dnl  Interface plugins
2169 dnl
2170
2171 AC_ARG_WITH(,[Interface plugins:])
2172
2173 dnl special case for BeOS
2174 if test "x${SYS}" = "xbeos"
2175 then
2176     PLUGINS="${PLUGINS} beos"
2177 fi
2178
2179 dnl
2180 dnl  Gtk+ module
2181 dnl
2182 AC_ARG_ENABLE(gtk,
2183   [  --enable-gtk            Gtk+ support (default enabled)])
2184 if test "x${enable_gtk}" != "xno"
2185 then
2186   GTK_PATH="${PATH}"
2187   AC_ARG_WITH(gtk-config-path,
2188     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2189     [ if test "x${with_gtk_config_path}" != "xno"
2190       then
2191         GTK_PATH="${with_gtk_config_path}:${PATH}"
2192       fi ])
2193   # look for gtk-config
2194   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2195   GTK_CONFIG=${GTK12_CONFIG}
2196   if test "x${GTK_CONFIG}" = "xno"
2197   then
2198     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2199   fi
2200   if test "x${GTK_CONFIG}" != "xno"
2201   then
2202     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2203     then
2204       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.])
2205     fi
2206     if test "x${SYS}" != "xmingw32"; then
2207       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
2208       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
2209     else
2210       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
2211       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
2212     fi
2213     # now look for the gtk.h header
2214     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
2215     ac_cv_gtk_headers=yes
2216     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2217       ac_cv_gtk_headers=no
2218       echo "Cannot find gtk development headers."
2219     ])
2220     if test "x${ac_cv_gtk_headers}" = "xyes"
2221     then
2222       PLUGINS="${PLUGINS} gtk"
2223       if test "x${SYS}" != "xmingw32"; then
2224         NEED_GTK_MAIN=yes
2225       fi
2226       ALIASES="${ALIASES} gvlc"
2227     fi
2228     CPPFLAGS="${CPPFLAGS_save}"
2229   fi
2230 fi
2231
2232 dnl
2233 dnl  Familiar module uses Gtk+ library
2234 dnl
2235 AC_ARG_ENABLE(familiar,
2236   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
2237 if test "x${enable_familiar}" = "xyes"
2238 then
2239   GTK_PATH="${PATH}"
2240   AC_ARG_WITH(gtk-config-path,
2241     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2242     [ if test "x${with_gtk_config_path}" != "xno"
2243       then
2244         GTK_PATH="${with_gtk_config_path}:${PATH}"
2245       fi ])
2246   # look for gtk-config
2247   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2248   GTK_CONFIG=${GTK12_CONFIG}
2249   if test "x${GTK_CONFIG}" = "xno"
2250   then
2251     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2252   fi
2253   # check for cross-compiling
2254   GTK_PREFIX=
2255   AC_ARG_WITH(gtk-prefix,
2256     [    --with-gtk-prefix=PATH path to libgtk (needed for cross-compiling),
2257                           e.g use as:
2258                           --with-gtk-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2259   if test "x${with_gtk_prefix}" != "xno" -a "x${with_gtk_prefix}" != "x"
2260   then
2261     GTK_PREFIX="--prefix=$with_gtk_prefix"
2262   fi
2263   if test "x${GTK_CONFIG}" != "xno"
2264   then
2265     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2266     then
2267       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-familiar.])
2268     fi
2269     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --cflags gtk gthread`"
2270     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --libs gtk gthread | sed 's,-rdynamic,,'`"
2271     # now look for the gtk.h header
2272     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
2273     ac_cv_gtk_headers=yes
2274     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2275       ac_cv_gtk_headers=no
2276       echo "Cannot find gtk development headers."
2277     ])
2278     if test "x${ac_cv_gtk_headers}" = "xyes"
2279     then
2280       PLUGINS="${PLUGINS} familiar"
2281     fi
2282     CPPFLAGS="${CPPFLAGS_save}"
2283
2284     # now look for gpe support
2285     AC_ARG_WITH(gpe-prefix,
2286     [    --with-gpe-prefix=PATH gpe installation path prefix (default search in \$PATH)],[],[])
2287     if test "x$with_gpe_prefix" != "xno"  -a "x$with_gpe_prefix" != "x"
2288     then
2289       CFLAGS_gpe="-I$with_gpe_prefix/include"
2290       LDFLAGS_gpe="-lXi -lgdk_pixbuf -L$with_gpe_prefix/lib -lgpewidget"
2291       # now look for gpe/init.h header file
2292       CFLAGS_save=$CFLAGS
2293       LDFLAGS_save=$LDFLAGS
2294       CFLAGS="${CFLAGS_familiar} ${CFLAGS_gpe}"
2295       LDFLAGS="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2296       CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar} ${CFLAGS_gpe}"
2297       ac_cv_gpe_headers=yes
2298       AC_CHECK_HEADERS(gpe/init.h, ,
2299         [ ac_cv_gpe_headers=no
2300           AC_MSG_ERROR([Cannot find development headers for libgpewidget...]) ])
2301       CFLAGS=$CFLAGS_save
2302       LDFLAGS=$LDFLAG_save
2303       if test "x${ac_cv_gpe_headers}" = "xyes"
2304       then
2305         CFLAGS_familiar="${CFLAGS_familiar} ${CFLAGS_gpe}"
2306         LDFLAGS_familiar="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2307       fi
2308     else
2309           NEED_GTK_MAIN=yes
2310     fi # end gpe support
2311   fi # end gtk+ support
2312 fi
2313
2314 dnl
2315 dnl  Gnome module
2316 dnl
2317 AC_ARG_ENABLE(gnome,
2318   [  --enable-gnome          Gnome interface support (default disabled)],
2319   [if test "x${enable_gnome}" = "xyes"; then
2320     # look for gnome-config
2321     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
2322     if test -x ${GNOME_CONFIG}
2323     then
2324        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
2325        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
2326     fi
2327     # now look for the gnome.h header
2328     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
2329     AC_CHECK_HEADERS(gnome.h, [
2330       PLUGINS="${PLUGINS} gnome"
2331       NEED_GTK_MAIN=yes
2332       NEED_GNOME_MAIN=yes
2333       ALIASES="${ALIASES} gnome-vlc"
2334       dnl We need this because of some moronic gnomesupport.h flavours
2335       AC_MSG_CHECKING(for strndup in gnome.h)
2336       AC_EGREP_HEADER(strndup,gnome.h,[
2337         AC_MSG_RESULT(yes)
2338         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
2339                   Define if <gnome.h> defines strndup.)],[
2340         AC_MSG_RESULT(no)])
2341      ],[
2342       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
2343 developement tools or remove the --enable-gnome option])
2344      ])
2345     CPPFLAGS="${CPPFLAGS_save}"
2346   fi])
2347
2348 dnl
2349 dnl  wxWindows module
2350 dnl
2351 AC_ARG_ENABLE(wxwindows,
2352   [  --enable-wxwindows      wxWindows support (default enabled)])
2353 if test "x${enable_wxwindows}" != "xno"
2354 then
2355   WXWINDOWS_PATH="${PATH}"
2356   AC_ARG_WITH(wx-config-path,
2357     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
2358     [ if test "x${with_wx_config_path}" != "xno"
2359       then
2360         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
2361       fi ])
2362   # look for wx-config
2363   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
2364   if test "x${WX_CONFIG}" != "xno"
2365   then
2366     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
2367     then
2368       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.])
2369     fi
2370     CXXFLAGS_wxwindows="${CXXFLAGS_wxwindows} `${WX_CONFIG} --cxxflags`"
2371     LDFLAGS_wxwindows="${LDFLAGS_wxwindows} `${WX_CONFIG} --libs`"
2372     # now look for the wxprec.h header
2373     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
2374     ac_cv_wx_headers=yes
2375     AC_CHECK_HEADERS(wx/wxprec.h, , [
2376       ac_cv_wx_headers=no
2377       echo "Cannot find wxWindows development headers."
2378     ])
2379     if test "x${ac_cv_wx_headers}" = "xyes"
2380     then
2381       PLUGINS="${PLUGINS} wxwindows"
2382       ALIASES="${ALIASES} wxvlc"
2383     fi
2384     CPPFLAGS="${CPPFLAGS_save}"
2385   fi
2386 fi
2387
2388 dnl
2389 dnl  Qt module
2390 dnl
2391 AC_ARG_ENABLE(qt,
2392   [  --enable-qt             Qt interface support (default disabled)],
2393   [if test "x${enable_qt}" = "xyes"; then
2394      PLUGINS="${PLUGINS} qt"
2395      ALIASES="${ALIASES} qvlc"
2396      LDFLAGS_qt="${LDFLAGS_qt} -lqt -L${QTDIR}/lib"
2397      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt -I${QTDIR}/include"
2398      if test -x ${QTDIR}/bin/moc
2399      then
2400        MOC=${QTDIR}/bin/moc
2401      else
2402        MOC=moc
2403      fi
2404    fi])
2405
2406 dnl
2407 dnl  KDE module
2408 dnl
2409 AC_ARG_ENABLE(kde,
2410   [  --enable-kde            KDE interface support (default disabled)],
2411   [if test "x${enable_kde}" = "xyes"; then
2412      PLUGINS="${PLUGINS} kde"
2413      ALIASES="${ALIASES} kvlc"
2414      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib -lkfile"
2415      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt"
2416      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
2417      if test -x ${QTDIR}/bin/moc
2418      then
2419        MOC=${QTDIR}/bin/moc
2420      else
2421        MOC=moc
2422      fi
2423    fi])
2424
2425 dnl
2426 dnl  Opie QT embedded module
2427 dnl
2428 AC_ARG_ENABLE(opie,
2429   [  --enable-opie           Qt embedded interface support (default disabled)],
2430   [if test "x${enable_opie}" = "xyes"; then
2431      AC_ARG_WITH(qte,
2432      [    --with-qte=PATH       Qt Embedded headers and libraries])
2433      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2434      then
2435        LDFLAGS_qte="-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2436        CPPFLAGS_qte="-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2437      else
2438        LDFLAGS_qte="-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`"
2439        CPPFLAGS_qte="-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`"
2440      fi
2441      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2442      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2443        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2444      ] )
2445      CPPFLAGS="${CPPFLAGS_save}"
2446
2447      PLUGINS="${PLUGINS} opie"
2448      NEED_QTE_MAIN=yes
2449      LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
2450      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
2451      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2452      then
2453        MOC=${with_qte}/bin/moc
2454      else
2455        MOC=${QTDIR}/bin/moc
2456      fi
2457    fi])
2458
2459 dnl
2460 dnl  MacOS X module
2461 dnl
2462 AC_ARG_ENABLE(macosx,
2463   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
2464   [if test "x${enable_macosx}" = "xyes"
2465    then
2466      BUILTINS="${BUILTINS} macosx"
2467      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2468    fi],
2469   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
2470      BUILTINS="${BUILTINS} macosx"
2471      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2472    )])
2473
2474 dnl
2475 dnl  QNX RTOS module
2476 dnl
2477 AC_ARG_ENABLE(qnx,
2478   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
2479     if test "x${enable_qnx}" != "xno"
2480     then
2481       AC_CHECK_HEADERS(Ph.h, [
2482         PLUGINS="${PLUGINS} qnx"
2483         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
2484       ])
2485     fi
2486
2487 dnl
2488 dnl  Windows native interface module, built with Borland C++ Builder
2489 dnl
2490 AC_ARG_ENABLE(intfwin,
2491 [  --enable-intfwin        Win32 interface support (default disabled)],
2492 [ if test "x${enable_intfwin}" != "xno"
2493   then
2494     AC_CHECK_TOOL(BPR2MAK, bpr2mak, AC_ERROR(bpr2mak not found))
2495     AC_CHECK_TOOL(BCMAKE, bcmake, AC_ERROR(bcmake not found))
2496     PLUGINS="${PLUGINS} win32"
2497   fi ])
2498
2499 dnl
2500 dnl  ncurses module
2501 dnl
2502 AC_ARG_ENABLE(ncurses,
2503   [  --enable-ncurses        ncurses interface support (default disabled)],
2504   [if test "x${enable_ncurses}" = "xyes"; then
2505      PLUGINS="${PLUGINS} ncurses"
2506      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
2507    fi])
2508
2509 dnl
2510 dnl  XOSD plugin
2511 dnl
2512 AC_ARG_ENABLE(xosd,
2513   [  --enable-xosd           xosd interface support (default disabled)])
2514 if test "x${enable_xosd}" = "xyes"
2515 then
2516   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2517   AC_CHECK_LIB(xosd,xosd_set_offset,
2518       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
2519     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
2520         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
2521       AC_TRY_COMPILE([#include <xosd.h>],
2522          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2523           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
2524   if test "x${have_xosd}" = "xtrue"
2525   then
2526     PLUGINS="${PLUGINS} xosd"
2527     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2528   fi
2529 fi
2530
2531 dnl
2532 dnl  SLP access plugin
2533 dnl
2534 AC_ARG_ENABLE(slp,
2535   [  --enable-slp            SLP service discovery support (default enabled)])
2536 if test "x${enable_slp}" != "xno"
2537 then
2538   AC_ARG_WITH(slp,
2539   [    --with-slp=PATH       libslp headers and libraries])
2540   if test "x${with_slp}" = x
2541   then
2542     AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
2543     if test "x${have_slp}" = "xtrue"
2544     then
2545       PLUGINS="${PLUGINS} slp"
2546       LDFLAGS_slp="${LDFLAGS_slp} -lslp"
2547     fi
2548   else
2549     AC_MSG_CHECKING(for slp headers in ${with_slp})
2550     if test -f ${with_slp}/slp.h
2551     then
2552       dnl  Use ${with_slp}/libslp/slp.h
2553       AC_MSG_RESULT(yes)
2554       PLUGINS="${PLUGINS} slp"
2555       LDFLAGS_slp="${LDFLAGS_slp} -L${with_slp} -lslp"
2556       CPPFLAGS_slp="${CPPFLAGS_slp} -I${with_slp}"
2557     else
2558       dnl  No libslp could be found, sorry
2559       AC_MSG_RESULT(no)
2560       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
2561     fi
2562   fi
2563 fi
2564
2565 dnl
2566 dnl  Lirc plugin
2567 dnl
2568 AC_ARG_ENABLE(lirc,
2569   [  --enable-lirc           lirc support (default disabled)])
2570 if test "x${enable_lirc}" = "xyes"
2571 then
2572   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2573   if test "x${have_lirc}" = "xtrue"
2574   then
2575     PLUGINS="${PLUGINS} lirc"
2576     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2577   fi
2578 fi
2579
2580 AC_ARG_WITH(,[Misc options:])
2581
2582 dnl
2583 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2584 dnl
2585 dnl  We give the user the opportunity to specify
2586 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2587 dnl
2588 AC_ARG_WITH(words,
2589   [  --with-words=endianness set endianness (big or little)])
2590   case "x${with_words}" in
2591     xbig)
2592       ac_cv_c_bigendian=yes
2593       ;;
2594     xlittle)
2595       ac_cv_c_bigendian=no
2596       ;;
2597     *)
2598       dnl  Try to guess endianness by matching patterns on a compiled
2599       dnl  binary, by looking for an ASCII or EBCDIC string
2600       AC_CACHE_CHECK([whether the byte order is big-endian],
2601         [ac_cv_c_bigendian],
2602         [ac_cv_c_bigendian="unknown"
2603         [cat >conftest.c <<EOF
2604         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2605         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2606         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2607         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2608         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2609         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2610         int main(void) { _a(); _e(); return 0; }
2611 EOF
2612         ]
2613         if test -f conftest.c
2614         then
2615           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2616               && test -f conftest.o
2617           then
2618             if test "`strings conftest.o | grep BIGenDianSyS`"
2619             then
2620               ac_cv_c_bigendian="yes"
2621             fi
2622             if test "`strings conftest.o | grep LiTTleEnDian`"
2623             then
2624               ac_cv_c_bigendian="no"
2625             fi
2626           fi
2627         fi
2628       ])
2629       if test "x${ac_cv_c_bigendian}" = "xunknown"
2630       then
2631         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
2632       fi
2633       ;;
2634   esac
2635 dnl  Now we know what to use for endianness, just put it in the header
2636 if test "${ac_cv_c_bigendian}" = "yes"
2637 then
2638   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
2639 fi
2640
2641 dnl
2642 dnl  Profiling
2643 dnl
2644 AC_ARG_ENABLE(gprof,
2645 [  --enable-gprof          gprof profiling (default disabled)])
2646 AC_ARG_ENABLE(cprof,
2647 [  --enable-cprof          cprof profiling (default disabled)])
2648 AM_CONDITIONAL(GPROF, test "x${enable_gprof}" = "xyes")
2649 AM_CONDITIONAL(CPROF, test "x${enable_gprof}" = "xyes")
2650
2651 dnl
2652 dnl  GNU portable threads
2653 dnl
2654 AC_ARG_ENABLE(pth,
2655   [  --enable-pth            GNU Pth support (default disabled)],
2656   [ if test "x${enable_pth}" = "xyes"; then
2657     AC_CHECK_LIB(pth,pth_init)
2658     AC_MSG_CHECKING(for pth_init in pth.h)
2659     AC_EGREP_HEADER(pth_init,pth.h,[
2660       AC_MSG_RESULT(yes)
2661       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
2662                 Define if <pth.h> defines pth_init)
2663       THREAD_LIB="-lpth"
2664     ],[
2665       AC_MSG_RESULT(no)
2666     ])
2667     fi
2668 ])
2669
2670 dnl
2671 dnl  State Threads
2672 dnl
2673 AC_ARG_ENABLE(st,
2674   [  --enable-st             State Threads (default disabled)],
2675   [ if test "x${enable_st}" = "xyes"; then
2676     AC_CHECK_LIB(st,st_init)
2677     AC_MSG_CHECKING(for st_init in st.h)
2678     AC_EGREP_HEADER(st_init,st.h,[
2679       AC_MSG_RESULT(yes)
2680       AC_DEFINE(ST_INIT_IN_ST_H, 1,
2681                 Define if <st.h> defines st_init)
2682       THREAD_LIB="-lst"
2683     ],[
2684       AC_MSG_RESULT(yes)
2685     ])
2686     fi
2687 ])
2688
2689 if test "x${SYS}" != "xmingw32"; then
2690   LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
2691   LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
2692 fi
2693
2694 dnl
2695 dnl  Mozilla plugin
2696 dnl
2697 mozilla=false
2698 AC_ARG_ENABLE(mozilla,
2699   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2700 if test "x${enable_mozilla}" = "xyes"
2701 then
2702   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2703   if test "x${MOZILLA_CONFIG}" != "xno"
2704   then
2705     if test "x${SYS}" != "xmingw32"; then
2706       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
2707       AC_CHECK_LIB(Xt,XtStrings,[
2708         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
2709       ])
2710       LDFLAGS="${LDFLAGS_save}"
2711     fi
2712     mozilla=:
2713     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2714     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2715     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2716     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2717     dnl Not necessarily in ${PATH}
2718     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
2719     then
2720       XPIDL="/usr/lib/mozilla/xpidl"
2721     fi
2722   fi
2723 fi
2724 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
2725
2726 dnl
2727 dnl  test plugins
2728 dnl
2729 AC_ARG_ENABLE(testsuite,
2730   [  --enable-testsuite      build test modules (default disabled)])
2731 if test "x${enable_testsuite}" = "xyes"
2732 then
2733   TESTS="test1 test2 test3 test4"
2734
2735   dnl  we define those so that bootstrap sets the right linker
2736   CXXFLAGS_test2="${CXXFLAGS_test2}"
2737   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
2738   dnl  this one is needed until automake knows what to do
2739   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
2740
2741   PLUGINS="${PLUGINS} ${TESTS}"
2742   #BUILTINS="${BUILTINS} ${TESTS}"
2743 fi
2744
2745 dnl
2746 dnl  gtk_main plugin
2747 dnl
2748 if test "x${NEED_GTK_MAIN}" != "xno"
2749 then
2750     PLUGINS="${PLUGINS} gtk_main"
2751     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
2752         CFLAGS_familiar="${CFLAGS_familiar} -DNEED_GTK_MAIN"
2753     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
2754     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
2755 fi
2756
2757 if test "x${NEED_GNOME_MAIN}" != "xno"
2758 then
2759     PLUGINS="${PLUGINS} gnome_main"
2760     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
2761     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
2762 fi
2763
2764 dnl
2765 dnl  qte_main plugin
2766 dnl
2767 if test "x${NEED_QTE_MAIN}" != "xno"
2768 then
2769     PLUGINS="${PLUGINS} qte_main"
2770     CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
2771         CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
2772     CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
2773     LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
2774 fi
2775
2776
2777 dnl
2778 dnl  Plugin and builtin checks
2779 dnl
2780 builtin_support=false
2781 plugin_support=:
2782
2783 dnl Support for plugins - this must be AT THE END
2784 AC_ARG_ENABLE(plugins,
2785   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
2786   [if test "x${enable_plugins}" = "xno"
2787    then
2788      plugin_support=false
2789    fi])
2790
2791 dnl Automagically disable plugins if there is no system support for
2792 dnl dynamically loadable files (.so, .dll, .dylib).
2793 dnl don't forget vlc-win32 still can load .dll as plugins
2794 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2795 then
2796   echo "*** Your system doesn't have plugin support. All plugins will be built"
2797   echo "statically."
2798   plugin_support=false
2799 fi
2800
2801 dnl Export automake variables
2802 if ${plugin_support}
2803 then
2804   for plugin in `echo ${PLUGINS}`
2805   do
2806     eval "${plugin}_plugin=yes"
2807   done
2808 else
2809   BUILTINS="${BUILTINS} ${PLUGINS}"
2810   PLUGINS=
2811 fi
2812 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
2813
2814 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
2815 then
2816   builtin_support=:
2817   for builtin in `echo ${BUILTINS}`
2818   do
2819     eval "${builtin}_builtin=yes"
2820   done
2821 fi]
2822 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
2823
2824 dnl do not touch this line (bootstrap needs it)
2825
2826
2827 dnl
2828 dnl  Stuff used by the program
2829 dnl
2830 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
2831 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
2832 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2833
2834 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`"
2835 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2836 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2837 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
2838
2839 DATA_PATH="${ac_tool_prefix}/share/videolan"
2840 AC_SUBST(DATA_PATH)
2841 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
2842 AC_SUBST(PLUGIN_PATH)
2843
2844 dnl
2845 dnl  Restore *FLAGS
2846 dnl
2847 CPPFLAGS="${CPPFLAGS_save}"
2848 CFLAGS="${CFLAGS_save}"
2849 CXXFLAGS="${CXXFLAGS_save}"
2850 OBJCFLAGS="${OBJCFLAGS_save}"
2851 LDFLAGS="${LDFLAGS_save}"
2852
2853 dnl
2854 dnl  Fool automake (see Makefile.am)
2855 dnl
2856 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
2857 AC_SUBST(AUTOMAKE_SUCKS)
2858
2859 dnl
2860 dnl  Create the vlc-config script
2861 dnl
2862 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
2863 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
2864
2865 dnl
2866 dnl  Configuration is finished
2867 dnl
2868 AC_SUBST(SYS)
2869 AC_SUBST(ARCH)
2870 AC_SUBST(PLUGINS)
2871 AC_SUBST(BUILTINS)
2872 AC_SUBST(ALIASES)
2873 AC_SUBST(ASM)
2874 AC_SUBST(MOC)
2875 AC_SUBST(WINDRES)
2876 AC_SUBST(XPIDL)
2877 AC_SUBST(LIBEXT)
2878 AC_SUBST(INCLUDES)
2879
2880 AC_SUBST(CFLAGS_TUNING)
2881 AC_SUBST(CFLAGS_OPTIM)
2882 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2883 AC_SUBST(CFLAGS_NOOPTIM)
2884 AC_SUBST(LDFLAGS)
2885
2886 AC_SUBST(CFLAGS_vlc)
2887 AC_SUBST(CFLAGS_pics)
2888 AC_SUBST(CXXFLAGS_pics)
2889 AC_SUBST(CFLAGS_plugins)
2890 AC_SUBST(CXXFLAGS_plugins)
2891 AC_SUBST(CFLAGS_builtins)
2892 AC_SUBST(CPPFLAGS_mozilla)
2893
2894 AC_SUBST(LDFLAGS_vlc)
2895 AC_SUBST(LDFLAGS_libvlc)
2896 AC_SUBST(LDFLAGS_plugins)
2897 AC_SUBST(LDFLAGS_builtins)
2898 AC_SUBST(LDFLAGS_mozilla)
2899
2900 AC_OUTPUT([
2901   Makefile
2902   debian/Makefile
2903   doc/Makefile
2904   intl/Makefile
2905   ipkg/Makefile
2906   lib/Makefile
2907   m4/Makefile
2908   modules/Makefile
2909   po/Makefile.in
2910   share/Makefile
2911   src/Makefile
2912   vlc-config
2913 ],[
2914   chmod a+x vlc-config
2915 ])
2916
2917 printf "
2918 vlc configuration
2919 --------------------
2920 vlc version           : ${VERSION}
2921 system                : ${SYS}
2922 architecture          : ${ARCH}
2923 build flavour         : "
2924 test "x${DEBUG_TRUE}" = "x" && printf "debug "
2925 test "x${CPROF_TRUE}" = "x" && printf "cprof "
2926 test "x${GPROF_TRUE}" = "x" && printf "gprof "
2927 test "x${OPTIM_TRUE}" = "x" && printf "optim "
2928 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
2929 echo "
2930 vlc aliases           :${ALIASES}
2931
2932 To build vlc and its plugins, type \`make'.
2933 "
2934