Now 0.5.2-cvs (estimated release date in two weeks from now).
[vlc.git] / configure.ac.in
1 dnl Autoconf settings for vlc
2
3 AC_INIT(vlc,0.5.2-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.2-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  Enable profiling
740 dnl
741 AC_ARG_ENABLE(gprof,
742 [  --enable-gprof          gprof profiling (default disabled)])
743 AC_ARG_ENABLE(cprof,
744 [  --enable-cprof          cprof profiling (default disabled)])
745 AM_CONDITIONAL(GPROF, test "${enable_gprof}" = "yes")
746 AM_CONDITIONAL(CPROF, test "${enable_gprof}" = "yes")
747
748 dnl
749 dnl  default modules
750 dnl
751 PLUGINS="${PLUGINS} dummy rc logger gestures access_file memcpy"
752 PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts"
753 PLUGINS="${PLUGINS} idct idctclassic motion mpeg_video spudec mpeg_audio"
754 #PLUGINS="${PLUGINS} a52old imdct downmix imdct3dn downmix3dn imdctsse downmixsse"
755 PLUGINS="${PLUGINS} lpcm a52"
756 PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
757 PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif fixed32tofloat32 fixed32tos16 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
758 PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler"
759 PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
760 PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
761 PLUGINS="${PLUGINS} aout_file"
762 #PLUGINS="${PLUGINS} scope"
763 PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
764 PLUGINS="${PLUGINS} id3 m3u"
765 PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys"
766 PLUGINS="${PLUGINS} access_udp access_http ipv4 access_mms access_ftp"
767 PLUGINS="${PLUGINS} sap screensaver"
768
769 dnl
770 dnl  Accelerated modules
771 dnl
772 MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
773 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
774 THREEDNOW_MODULES="memcpy3dn"
775 SSE_MODULES=""
776 ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
777
778 if test "${enable_gprof}" != "yes"
779 then
780   MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
781 fi
782
783 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
784     [ac_cv_mmx_inline],
785     [CFLAGS="${CFLAGS_save}"
786      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
787                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
788 if test "x${ac_cv_mmx_inline}" != "xno"; then
789   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
790 fi
791
792 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
793     [ac_cv_mmxext_inline],
794     [CFLAGS="${CFLAGS_save}"
795      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
796                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
797 if test "x${ac_cv_mmxext_inline}" != "xno"; then
798   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
799 fi
800
801 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
802     [ac_cv_3dnow_inline],
803     [CFLAGS="${CFLAGS_save}"
804      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
805                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
806 if test "x${ac_cv_3dnow_inline}" != "xno"; then
807   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
808   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
809 fi
810
811 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
812     [ac_cv_sse_inline],
813     [CFLAGS="${CFLAGS_save}"
814      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
815                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
816 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
817   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
818   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
819 fi
820
821 # don't try to grok AltiVec with native mingw32 it doesn't work right now
822 # we should be able to remove this test with future versions of mingw32
823 if test "x${SYS}" != "xmingw32"; then
824 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
825     [ac_cv_altivec_inline],
826     [CFLAGS="${CFLAGS_save}"
827      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
828          ac_cv_altivec_inline=yes,
829          [CFLAGS="${CFLAGS_save} -Wa,-m7400"
830           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
831             [ac_cv_altivec_inline="-Wa,-m7400"],
832             ac_cv_altivec_inline=no)
833          ])])
834 if test "x${ac_cv_altivec_inline}" != "xno"; then
835   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
836   if test "x${ac_cv_altivec_inline}" != "xyes"; then
837     CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_altivec_inline}"
838     CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_altivec_inline}"
839     CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_altivec_inline}"
840     CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_altivec_inline}"
841   fi
842   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
843 fi
844
845 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
846     [ac_cv_c_altivec],
847     [CFLAGS="${CFLAGS_save} -faltivec"
848      # Darwin test
849      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
850         ac_cv_c_altivec=-faltivec, [
851         # Linux/PPC test
852         CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
853         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
854             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
855         ])
856      CFLAGS="${CFLAGS_save}"])
857 if test "x${ac_cv_c_altivec}" != "xno"; then
858   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
859   CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_c_altivec}"
860   CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_c_altivec}"
861   CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_c_altivec}"
862   CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_c_altivec}"
863   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
864 fi
865
866 AC_CACHE_CHECK([if linker needs -framework vecLib],
867     [ac_cv_ld_altivec],
868     [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
869      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
870      LDFLAGS="${LDFLAGS_save}"
871     ])
872 if test "x${ac_cv_ld_altivec}" != "xno"; then
873   LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
874   LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
875   LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
876   LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
877 fi
878 fi # end if mingw32
879
880 AC_ARG_WITH(,[])
881 AC_ARG_WITH(,[Optimization options:])
882
883 dnl
884 dnl  Special arch tuning
885 dnl
886 AC_ARG_WITH(tuning,
887 [  --with-tuning=ARCH      enable special tuning for an architecture
888                           (default i686 on IA-32 and 750 on PPC)])
889 if test "x${with_tuning}" != "x"; then
890     if test "x${target_cpu}" = "xpowerpc"; then
891         CFLAGS_TUNING="-mtune=${with_tuning}"
892     else
893         CFLAGS_TUNING="-mcpu=${with_tuning}"
894     fi
895 else
896     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"
897     else
898         if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
899     fi
900 fi
901
902 dnl
903 dnl  x86 accelerations
904 dnl
905 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
906 then
907     ARCH="${ARCH} mmx"
908     PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
909 fi
910
911 dnl
912 dnl  Enable/disable optimizations
913 dnl
914 AC_ARG_ENABLE(optimizations,
915 [  --disable-optimizations disable compiler optimizations (default enabled)])
916 AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
917
918 dnl
919 dnl  AltiVec acceleration
920 dnl
921 AC_ARG_ENABLE(altivec,
922 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
923 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
924     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
925 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
926     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
927
928 dnl
929 dnl  Debugging mode
930 dnl
931 AC_ARG_ENABLE(debug,
932 [  --enable-debug          debug mode (default disabled)])
933 AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
934
935 dnl
936 dnl  Enable release-specific flags
937 dnl
938 AC_ARG_ENABLE(release,
939 [  --enable-release        activate extra optimizations (default disabled)])
940 AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
941
942 dnl
943 dnl Stream output
944 dnl
945 AC_ARG_ENABLE(sout,
946   [  --enable-sout           Stream output modules (default enabled)])
947 if test "x${enable_sout}" != "xno"
948 then
949   PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file"
950   PLUGINS="${PLUGINS} mux_ts mux_ps mux_avi mux_dummy"
951   PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
952   PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
953   PLUGINS="${PLUGINS} packetizer_copy"
954
955   PLUGINS="${PLUGINS} vout_encoder"
956 fi
957
958
959 dnl
960 dnl  Input plugins
961 dnl
962
963 AC_ARG_WITH(,[Input plugins:])
964
965 dnl
966 dnl  DVD module: optionally check for installed libdvdcss
967 dnl
968 AC_ARG_ENABLE(dvd,
969 [  --enable-dvd            DVD input module (default enabled)])
970 if test "x${enable_dvd}" != "xno"
971 then
972   AC_ARG_WITH(dvdcss,
973   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
974   AC_ARG_WITH(dvdcss-tree,
975   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
976   case "x${with_dvdcss}" in
977   x|xyes)
978     if test "x${with_dvdcss_tree}" = x
979     then
980       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
981         [ PLUGINS="${PLUGINS} dvd"
982           LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
983           LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
984         [ 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.])
985           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
986     else
987       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
988       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
989       if test "x${real_dvdcss_tree}" = "x"
990       then
991         dnl  The given directory can't be found
992         AC_MSG_RESULT(no)
993         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
994       fi
995       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
996       then
997         dnl  Use a custom libdvdcss
998         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
999         BUILTINS="${BUILTINS} dvd"
1000         LDFLAGS_dvd="${LDFLAGS_dvd} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
1001         LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
1002         CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
1003       else
1004         dnl  The given libdvdcss wasn't built
1005         AC_MSG_RESULT(no)
1006         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
1007       fi
1008     fi
1009   ;;
1010   xno)
1011     dnl  Compile without dvdcss (dlopen version, works only under Linux)
1012     PLUGINS="${PLUGINS} dvd"
1013     CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
1014     LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
1015   ;;
1016   *)
1017     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
1018     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
1019     then
1020       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
1021       AC_MSG_RESULT(yes)
1022       PLUGINS="${PLUGINS} dvd"
1023       LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
1024       LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${with_dvdcss}/lib -ldvdcss"
1025       CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
1026     else
1027       dnl  No libdvdcss could be found, sorry
1028       AC_MSG_RESULT(no)
1029       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
1030     fi
1031   ;;
1032   esac
1033 fi
1034
1035 dnl
1036 dnl dvdread module: check for libdvdread
1037 dnl
1038 AC_ARG_ENABLE(dvdread,
1039 [  --enable-dvdread        dvdread input module (default disabled)])
1040 if test "x${enable_dvdread}" != "xno"
1041 then
1042   AC_ARG_WITH(dvdread,
1043   [    --with-dvdread=PATH    libdvdread headers and libraries])
1044   AC_ARG_WITH(dvdread-tree,
1045   [    --with-dvdread-tree=PATH libdvdread tree for static linking])
1046   if test "x${with_dvdread}" = x
1047   then
1048     if test "x${with_dvdread_tree}" = x
1049     then
1050       AC_CHECK_HEADERS(dvdread/dvd_reader.h,
1051         [ PLUGINS="${PLUGINS} dvdread"
1052           LDFLAGS_dvdread="${LDFLAGS_dvdread} -ldvdread ${LDFLAGS_dvdcss}" ],
1053         [ if test "x${enable_dvdread}" != "x"
1054           then
1055             AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
1056             AC_MSG_ERROR([cannot find libdvdread headers])
1057           fi ])
1058     else
1059       AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
1060       real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
1061       if test "x${real_dvdread_tree}" = "x"
1062       then
1063         dnl  The given directory can't be found
1064         AC_MSG_RESULT(no)
1065         AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
1066       fi
1067       if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
1068       then
1069         dnl  Use a custom libdvdread
1070         AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
1071         BUILTINS="${BUILTINS} dvdread"
1072         LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${real_dvdread_tree}/dvdread/.libs -ldvdread ${LDFLAGS_dvdcss}"
1073         CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${real_dvdread_tree}"
1074       else
1075         dnl  The given libdvdread wasn't built
1076         AC_MSG_RESULT(no)
1077         AC_MSG_ERROR([cannot find ${real_dvdread_tree}/dvdread/.libs/libdvdread.a, make sure you compiled libdvdread in ${with_dvdread_tree}])
1078       fi
1079     fi
1080   else
1081     AC_MSG_CHECKING(for dvdread headers in ${with_dvdread})
1082     if test -f ${with_dvdread}/include/dvdread/dvd_reader.h
1083     then
1084       dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
1085       AC_MSG_RESULT(yes)
1086       PLUGINS="${PLUGINS} dvdread"
1087       LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${with_dvdread}/lib -ldvdread ${LDFLAGS_dvdcss}"
1088       CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${with_dvdread}/include"
1089     else
1090       dnl  No libdvdread could be found, sorry
1091       AC_MSG_RESULT(no)
1092       AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
1093     fi
1094   fi
1095 fi
1096
1097 dnl
1098 dnl dvdplay module: check for libdvdplay
1099 dnl
1100 AC_ARG_ENABLE(dvdplay,
1101 [  --enable-dvdplay        dvdplay input module (default disabled)])
1102 if test "x${enable_dvdplay}" != "xno"
1103 then
1104   AC_ARG_WITH(dvdplay,
1105   [    --with-dvdplay=PATH    libdvdplay headers and libraries])
1106   AC_ARG_WITH(dvdplay-tree,
1107   [    --with-dvdplay-tree=PATH libdvdplay tree for static linking])
1108   if test "x${with_dvdplay}" = x
1109   then
1110     if test "x${with_dvdplay_tree}" = x
1111     then
1112       AC_CHECK_HEADERS(dvdplay/dvdplay.h,
1113         [ PLUGINS="${PLUGINS} dvdplay"
1114           LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1115           CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread}" ],
1116         [ if test "x${enable_dvdplay}" != "x"
1117           then
1118             AC_MSG_WARN([Please get libdvdplay from http://www.videolan.org/.])
1119             AC_MSG_ERROR([cannot find libdvdplay headers])
1120           fi ])
1121     else
1122       AC_MSG_CHECKING(for libdvdplay.a in ${with_dvdplay_tree})
1123       real_dvdplay_tree="`cd ${with_dvdplay_tree} 2>/dev/null && pwd`"
1124       if test "x${real_dvdplay_tree}" = "x"
1125       then
1126         dnl  The given directory can't be found
1127         AC_MSG_RESULT(no)
1128         AC_MSG_ERROR([cannot cd to ${with_dvdplay_tree}])
1129       fi
1130       if test -f "${real_dvdplay_tree}/src/.libs/libdvdplay.a"
1131       then
1132         dnl  Use a custom libdvdplay
1133         AC_MSG_RESULT(${real_dvdplay_tree}/src/.libs/libdvdplay.a)
1134         BUILTINS="${BUILTINS} dvdplay"
1135         LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${real_dvdplay_tree}/src/.libs -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1136         CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${real_dvdplay_tree}/src"
1137       else
1138         dnl  The given libdvdplay wasn't built
1139         AC_MSG_RESULT(no)
1140         AC_MSG_ERROR([cannot find ${real_dvdplay_tree}/src/.libs/libdvdplay.a, make sure you compiled libdvdplay in ${with_dvdplay_tree}])
1141       fi
1142     fi
1143   else
1144     AC_MSG_CHECKING(for dvdplay headers in ${with_dvdplay})
1145     if test -f ${with_dvdplay}/include/dvdplay/dvdplay.h
1146     then
1147       dnl  Use ${with_dvdplay}/include/dvdplay/dvdplay.h
1148       AC_MSG_RESULT(yes)
1149       PLUGINS="${PLUGINS} dvdplay"
1150       LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${with_dvdplay}/lib -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1151       CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${with_dvdplay}/include"
1152     else
1153       dnl  No libdvdplay could be found, sorry
1154       AC_MSG_RESULT(no)
1155       AC_MSG_ERROR([cannot find ${with_dvdplay}/include/dvdplay/dvdplay.h])
1156     fi
1157   fi
1158 fi
1159
1160 dnl
1161 dnl  libdvbpsi ts demux/mux
1162 dnl
1163 AC_ARG_ENABLE(dvbpsi,
1164 [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
1165 if test "x${enable_dvbpsi}" != "xno"
1166 then
1167   AC_ARG_WITH(dvbpsi,
1168   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
1169   AC_ARG_WITH(dvbpsi,
1170   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
1171   case "x${with_dvbpsi}" in
1172   x|xyes)
1173     if test "x${with_dvbpsi_tree}" = "x"
1174     then
1175       AC_CHECK_HEADERS(dvbpsi/dr.h,
1176         [ PLUGINS="${PLUGINS} ts_dvbpsi"
1177           LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -ldvbpsi" 
1178           PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1179           LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -ldvbpsi" ],
1180         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
1181         [#include <stdint.h>
1182 #include <dvbpsi/dvbpsi.h>
1183 #include <dvbpsi/descriptor.h>
1184 #include <dvbpsi/pat.h>
1185 #include <dvbpsi/pmt.h>])
1186     else
1187       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
1188       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
1189       if test "x${real_dvbpsi_tree}" = "x"
1190       then
1191         dnl  The given directory can't be found
1192         AC_MSG_RESULT(no)
1193         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
1194       fi
1195       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
1196       then
1197         dnl  Use a custom libdvbpsi
1198         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
1199         BUILTINS="${BUILTINS} ts_dvbpsi"
1200         LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1201         CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1202
1203         BUILTINS="${BUILTINS} mux_ts_dvbpsi"
1204         LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1205         CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1206
1207       else
1208         dnl  The given libdvbpsi wasn't built
1209         AC_MSG_RESULT(no)
1210         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
1211       fi
1212     fi
1213   ;;
1214   xno)
1215     dnl  Compile without dvbpsi
1216   ;;
1217   *)
1218     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
1219     if test "x${with_dvbpsi}" = "x"
1220     then
1221       LDFLAGS_test=""
1222       CPPFLAGS_test=""
1223     else
1224       LDFLAGS_test="-L${with_dvbpsi}/lib"
1225       CPPFLAGS_test="-I${with_dvbpsi}/include"
1226     fi
1227     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1228     AC_CHECK_HEADER([dvbpsi/dr.h],[
1229       PLUGINS="${PLUGINS} ts_dvbpsi"
1230       LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1231       CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} ${CPPFLAGS_test}"
1232       PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1233       LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1234       CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} ${CPPFLAGS_test}"
1235
1236       ],[
1237       if test "x${enable_dvbpsi}" != "x"
1238       then
1239         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])
1240       fi
1241     ])
1242     CPPFLAGS="${CPPFLAGS_save}"
1243   ;;
1244   esac
1245 fi
1246
1247 dnl
1248 dnl  Video4Linux plugin
1249 dnl
1250 AC_ARG_ENABLE(v4l,
1251   [  --enable-v4l            Video4Linux input support (default disabled)])
1252 if test "x${enable_v4l}" = "xyes"
1253 then
1254   AC_CHECK_HEADERS(libv4l/v4l.h, [
1255     PLUGINS="${PLUGINS} v4l"
1256    ],[])
1257 fi
1258
1259 dnl
1260 dnl  VCD module
1261 dnl
1262 AC_ARG_ENABLE(vcd,
1263   [  --enable-vcd            VCD support for Linux, FreeBSD, MacOS X and Win32 (default enabled)])
1264
1265 if test "x${enable_vcd}" != "xno"
1266 then
1267   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1268   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1269     AC_MSG_RESULT(yes)
1270     PLUGINS="${PLUGINS} vcd"
1271   ],[
1272     AC_MSG_RESULT(no)
1273   ])
1274
1275   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1276   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1277     AC_MSG_RESULT(yes)
1278     PLUGINS="${PLUGINS} vcd"
1279     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1280   ],[
1281     AC_MSG_RESULT(no)
1282   ])
1283
1284   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1285   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1286     AC_MSG_RESULT(yes)
1287     PLUGINS="${PLUGINS} vcd"
1288     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1289   ],[
1290     AC_MSG_RESULT(no)
1291   ])
1292
1293   if test "x${SYS}" = "xbsdi" -o "x${SYS}" = "xmingw32"
1294   then
1295     PLUGINS="${PLUGINS} vcd"
1296   fi
1297
1298   if test "x${SYS}" = "xdarwin"
1299   then
1300     PLUGINS="${PLUGINS} vcd"
1301     LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation"
1302   fi
1303 fi
1304
1305 dnl
1306 dnl  Satellite input module
1307 dnl
1308 AC_ARG_ENABLE(satellite,
1309   [  --enable-satellite      satellite card support (default disabled)],
1310   [ if test "x${enable_satellite}" = "xyes"
1311     then
1312       PLUGINS="${PLUGINS} satellite"
1313     fi])
1314
1315 dnl
1316 dnl  ipv6 plugin - not for QNX yet
1317 dnl
1318 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
1319 then
1320   have_ipv6=false
1321   AC_CHECK_FUNCS(inet_pton,[have_ipv6=:],[
1322     AC_CHECK_LIB(resolv,inet_pton,
1323       [have_ipv6=:
1324        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lresolv"])
1325   ])
1326   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
1327   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
1328     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=false])
1329   if ${have_ipv6}; then
1330     PLUGINS="${PLUGINS} ipv6"
1331   fi
1332 fi
1333 if test "x${SYS}" = "xmingw32"
1334 then
1335   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
1336   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
1337     PLUGINS="${PLUGINS} ipv6"],[AC_MSG_RESULT(no)])
1338 fi
1339
1340 dnl
1341 dnl  AVI demux plugin
1342 dnl
1343 AC_ARG_ENABLE(avi,
1344   [  --enable-avi            AVI demux module (default enabled)])
1345 if test "x${enable_avi}" != "xno"
1346 then
1347   PLUGINS="${PLUGINS} avi"
1348 fi
1349
1350 dnl
1351 dnl  ASF demux plugin
1352 dnl
1353 AC_ARG_ENABLE(asf,
1354   [  --enable-asf            ASF demux module (default enabled)])
1355 if test "x${enable_asf}" != "xno"
1356 then
1357   PLUGINS="${PLUGINS} asf"
1358 fi
1359
1360 dnl
1361 dnl  AAC demux plugin
1362 dnl
1363 AC_ARG_ENABLE(aac,
1364   [  --enable-aac            AAC demux module (default enabled)])
1365 if test "x${enable_aac}" != "xno"
1366 then
1367   PLUGINS="${PLUGINS} aac"
1368 fi
1369
1370 dnl
1371 dnl  ogg plugin
1372 dnl
1373 AC_ARG_ENABLE(ogg,
1374   [  --enable-ogg            Ogg demux support (default enabled)])
1375 if test "x${enable_ogg}" != "xno"
1376 then
1377   AC_CHECK_HEADERS(ogg/ogg.h, [
1378     AC_CHECK_LIB( ogg, oggpack_read, [
1379       PLUGINS="${PLUGINS} ogg"
1380       LDFLAGS_ogg="${LDFLAGS_ogg} -logg"
1381       AC_CHECK_LIB( ogg, oggpackB_read, [
1382         CPPFLAGS_ogg="${CPPFLAGS_ogg} -DHAVE_OGGPACKB"])])
1383    ],[])
1384 fi
1385
1386 dnl
1387 dnl  raw dv demux plugin
1388 dnl
1389 AC_ARG_ENABLE(rawdv,
1390   [  --enable-rawdv          raw dv demux module (default enabled)])
1391 if test "x${enable_rawdv}" != "xno"
1392 then
1393   PLUGINS="${PLUGINS} rawdv"
1394 fi
1395
1396 dnl
1397 dnl  Codec plugins
1398 dnl
1399
1400 AC_ARG_WITH(,[Codec plugins:])
1401
1402 dnl
1403 dnl  mad plugin
1404 dnl
1405 AC_ARG_ENABLE(mad,
1406   [  --enable-mad            libmad module (default disabled)])
1407 if test "x${enable_mad}" != "xno"
1408 then
1409   AC_ARG_WITH(mad,
1410     [    --with-mad=PATH       path to libmad],[],[])
1411   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
1412   then
1413     CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${with_mad}/include"
1414     LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${with_mad}/lib"
1415   fi
1416
1417   AC_ARG_WITH(mad-tree,
1418     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
1419   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
1420   then
1421     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
1422     if test "x${real_mad_tree}" = "x"
1423     then
1424       dnl  The given directory can't be found
1425       AC_MSG_RESULT(no)
1426       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
1427     fi
1428     dnl  Use a custom libmad
1429     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
1430     if test -f ${real_mad_tree}/libmad/mad.h
1431     then
1432       AC_MSG_RESULT(yes)
1433       CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${real_mad_tree}/libmad"
1434       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${real_mad_tree}/libmad/.libs"
1435       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1436       AC_CHECK_LIB(mad, mad_bit_init, [
1437         BUILTINS="${BUILTINS} mpgatofixed32"
1438         LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad"
1439         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1440       ],[])
1441       LDFLAGS="${LDFLAGS_save}"
1442     else
1443       AC_MSG_RESULT(no)
1444       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1445     fi
1446   else
1447     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mpgatofixed32}"
1448     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1449     AC_CHECK_HEADERS(mad.h, ,
1450       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1451     AC_CHECK_LIB(mad, mad_bit_init, [
1452       PLUGINS="${PLUGINS} mpgatofixed32"
1453       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad" ],
1454       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1455     CPPFLAGS="${CPPFLAGS_save}"
1456     LDFLAGS="${LDFLAGS_save}"
1457   fi
1458 fi
1459
1460 dnl
1461 dnl   libid3tag support
1462 dnl
1463 AC_CHECK_HEADERS(id3tag.h, [
1464   LDFLAGS_id3tag="${LDFLAGS_id3tag} -lz -lid3tag"
1465   PLUGINS="${PLUGINS} id3tag"])
1466
1467 dnl
1468 dnl  ffmpeg decoder plugin
1469 dnl
1470 AC_ARG_ENABLE(ffmpeg,
1471 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1472 if test "x${enable_ffmpeg}" = "xyes"
1473 then
1474   AC_ARG_WITH(ffmpeg,
1475     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1476   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1477   then
1478     CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/ffmpeg"
1479     LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib"
1480   fi
1481
1482   dnl Add postprocessing modules
1483   PLUGINS="${PLUGINS} postprocessing_c"
1484   if test "x${ac_cv_mmx_inline}" != "xno"; then
1485     PLUGINS="${PLUGINS} postprocessing_mmx"
1486   fi
1487
1488   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1489     PLUGINS="${PLUGINS} postprocessing_mmxext"
1490   fi
1491
1492   AC_ARG_WITH(ffmpeg-tree,
1493   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1494   if test "x${with_ffmpeg_tree}" != "x"
1495   then
1496     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1497     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1498     if test "x${real_ffmpeg_tree}" = x
1499     then
1500       dnl  The given directory can't be found
1501       AC_MSG_RESULT(no)
1502       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1503     fi
1504     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1505     then
1506       dnl  Use a custom libffmpeg
1507       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1508       BUILTINS="${BUILTINS} ffmpeg"
1509       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
1510       CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
1511     else
1512       dnl  The given libavcodec wasn't built
1513       AC_MSG_RESULT(no)
1514       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1515     fi
1516   else
1517     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
1518     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
1519     AC_CHECK_LIB(avcodec, avcodec_init, [
1520       BUILTINS="${BUILTINS} ffmpeg"
1521       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" ],
1522       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1523     LDFLAGS="${LDFLAGS_save}"
1524     CPPFLAGS="${CPPFLAGS_save}"
1525   fi
1526 fi
1527
1528 dnl
1529 dnl  faad decoder plugin
1530 dnl
1531 AC_ARG_ENABLE(faad,
1532 [  --enable-faad           faad codec (default disabled)])
1533 if test "x${enable_faad}" = "xyes"
1534 then
1535   AC_ARG_WITH(faad,
1536     [    --with-faad=PATH      path to faad installation],[],[])
1537   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1538   then
1539     CPPFLAGS_faad="${CPPFLAGS_faad} -I${with_faad}/include"
1540     LDFLAGS_faad="${LDFLAGS_faad} -L${with_faad}/lib"
1541   fi
1542   LDFLAGS_faad="${LDFLAGS_faad}"
1543
1544   AC_ARG_WITH(faad-tree,
1545   [    --with-faad-tree=PATH faad tree for static linking])
1546   if test "x${with_faad_tree}" != "x"
1547   then
1548     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1549     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1550     if test "x${real_faad_tree}" = x
1551     then
1552       dnl  The given directory can't be found
1553       AC_MSG_RESULT(no)
1554       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1555     fi
1556     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1557     then
1558       dnl  Use a custom faad
1559       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1560       BUILTINS="${BUILTINS} faad"
1561       LDFLAGS_faad="${LDFLAGS_faad} -L${real_faad_tree}/libfaad/.libs -lfaad"
1562       CPPFLAGS_faad="${CPPFLAGS_faad} -I${real_faad_tree}/include"
1563     else
1564       dnl  The given libfaad wasn't built
1565       AC_MSG_RESULT(no)
1566       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1567     fi
1568   else
1569     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
1570     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_faad}"
1571     AC_CHECK_HEADERS(faad.h, ,
1572       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1573     AC_CHECK_LIB(faad, faacDecOpen, [
1574       PLUGINS="${PLUGINS} faad"
1575       LDFLAGS_faad="${LDFLAGS_faad} -lfaad" ],
1576       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1577     LDFLAGS="${LDFLAGS_save}"
1578     CPPFLAGS="${CPPFLAGS_save}"
1579   fi
1580 fi
1581
1582
1583 dnl
1584 dnl  xvid decoder plugin
1585 dnl
1586 AC_ARG_ENABLE(xvid,
1587 [  --enable-xvid           xvid codec (default disabled)])
1588 if test "x${enable_xvid}" = "xyes"
1589 then
1590   AC_ARG_WITH(xvid,
1591     [    --with-xvid=PATH      path to xvid installation],[],[])
1592   if test "x${with_xvid}" != "xno" -a "x${with_xvid}" != "x"
1593   then
1594     CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${with_xvid}/include"
1595     LDFLAGS_xvid="${LDFLAGS_xvid} -L${with_xvid}/lib"
1596   fi
1597   LDFLAGS_xvid="${LDFLAGS_xvid}"
1598
1599   AC_ARG_WITH(xvid-tree,
1600   [    --with-xvid-tree=PATH xvid tree for static linking])
1601   if test "x${with_xvid_tree}" != "x"
1602   then
1603     AC_MSG_CHECKING(for libxvidcore.a in ${with_xvid_tree})
1604     real_xvid_tree="`cd ${with_xvid_tree} 2>/dev/null && pwd`"
1605     if test "x${real_xvid_tree}" = x
1606     then
1607       dnl  The given directory can't be found
1608       AC_MSG_RESULT(no)
1609       AC_MSG_ERROR([cannot cd to ${with_xvid_tree}])
1610     fi
1611     if test -f "${real_xvid_tree}/build/generic/libxvidcore.a"
1612     then
1613       dnl  Use a custom xvid
1614       AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a)
1615       BUILTINS="${BUILTINS} xvid"
1616       LDFLAGS_xvid="${LDFLAGS_xvid} -L${real_xvid_tree}/build/generic -lxvidcore"
1617       CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src"
1618     else
1619       dnl  The given libxvidcore wasn't built
1620       AC_MSG_RESULT(no)
1621       AC_MSG_ERROR([cannot find ${real_xvid_tree}/build/generic/libxvidcore.a, make sure you compiled libxvidcore in ${with_xvid_tree}])
1622     fi
1623   else
1624     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_xvid}"
1625     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_xvid}"
1626     AC_CHECK_HEADERS(xvid.h, ,
1627       [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
1628     AC_CHECK_LIB(xvidcore, xvid_init, [
1629       PLUGINS="${PLUGINS} xvid"
1630       LDFLAGS_xvid="${LDFLAGS_xvid} -lxvidcore" ],
1631       [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
1632     LDFLAGS="${LDFLAGS_save}"
1633     CPPFLAGS="${CPPFLAGS_save}"
1634   fi
1635 fi
1636
1637
1638
1639 dnl
1640 dnl MP4 module
1641 dnl
1642 AC_ARG_ENABLE(mp4,
1643   [  --enable-mp4            MP4 demux module (default enabled)])
1644 if test "x${enable_mp4}" != "xno"
1645 then
1646
1647     PLUGINS="${PLUGINS} mp4"
1648     AC_CHECK_HEADERS(zlib.h,
1649               [ LDFLAGS_mp4="${LDFLAGS_mp4} -lz" ] )
1650 fi
1651
1652 dnl
1653 dnl  a52 AC3 decoder plugin
1654 dnl
1655 AC_ARG_ENABLE(a52,
1656   [  --enable-a52            A/52 support with liba52 (default enabled)])
1657 if test "x${enable_a52}" != "xno"
1658 then
1659   AC_ARG_WITH(a52,
1660     [    --with-a52=PATH       a52 headers and libraries])
1661   AC_ARG_WITH(a52-tree,
1662     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1663   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1664   then
1665     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1666     if test "x${real_a52_tree}" = "x"
1667     then
1668       dnl  The given directory can't be found
1669       AC_MSG_RESULT(no)
1670       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1671     fi
1672     dnl  Use a custom a52dec
1673     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1674     if test -f ${real_a52_tree}/include/a52.h
1675     then
1676       AC_MSG_RESULT(yes)
1677       CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -I${real_a52_tree}"
1678       LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -L${real_a52_tree}/liba52/.libs"
1679       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
1680       AC_CHECK_LIB(a52, a52_free, [
1681         BUILTINS="${BUILTINS} a52tofloat32"
1682         LDFLAGS_a52tofloat32="-la52 ${LDFLAGS_a52tofloat32}"
1683         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -DUSE_A52DEC_TREE"
1684         ],[
1685         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1686         then
1687           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1688         else
1689           AC_MSG_ERROR([the specified tree hasn't been compiled])
1690         fi
1691       ])
1692       LDFLAGS="${LDFLAGS_save}"
1693     else
1694       AC_MSG_RESULT(no)
1695       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1696     fi
1697   else
1698     if test "x${with_a52}" = "x"
1699     then
1700       LDFLAGS_test=""
1701       CPPFLAGS_test=""
1702     else
1703       LDFLAGS_test="-L${with_a52}/lib"
1704       CPPFLAGS_test="-I${with_a52}/include"
1705     fi
1706     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
1707     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LDFLAGS_a52tofloat32}"
1708     AC_CHECK_HEADERS(a52dec/a52.h, [
1709       AC_CHECK_LIB(a52, a52_free, [
1710         PLUGINS="${PLUGINS} a52tofloat32"
1711         LDFLAGS_a52tofloat32="${LDFLAGS_test} -la52 ${LDFLAGS_a52tofloat32}"
1712         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} ${CPPFLAGS_test}"
1713       ],[
1714         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.])
1715       ])
1716     ])
1717     CPPFLAGS="${CPPFLAGS_save}"
1718     LDFLAGS="${LDFLAGS_save}"
1719   fi
1720 fi
1721
1722 dnl
1723 dnl  cinepak plugin
1724 dnl
1725 AC_ARG_ENABLE(cinepak,
1726   [  --enable-cinepak        Cinepak decoder (default enabled)])
1727 if test "x${enable_cinepak}" != "xno"
1728 then
1729   PLUGINS="${PLUGINS} cinepak"
1730 fi
1731
1732 dnl
1733 dnl  DV plugin
1734 dnl
1735 AC_ARG_ENABLE(dv,
1736   [  --enable-dv             DV decoder support (default disabled)])
1737 if test "x${enable_dv}" = "xyes"
1738 then
1739   AC_CHECK_HEADERS(libdv/dv.h, [
1740     PLUGINS="${PLUGINS} dv"
1741     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1742    ],[])
1743 fi
1744
1745 dnl
1746 dnl  Vorbis plugin
1747 dnl
1748 AC_ARG_ENABLE(vorbis,
1749   [  --enable-vorbis         Vorbis decoder support (default enabled)])
1750 if test "x${enable_vorbis}" != "xno"
1751 then
1752   AC_CHECK_HEADERS(vorbis/codec.h, [
1753     PLUGINS="${PLUGINS} vorbis"
1754     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis -logg"
1755    ],[])
1756 fi
1757
1758 dnl
1759 dnl  Tremor plugin
1760 dnl
1761 AC_ARG_ENABLE(tremor,
1762   [  --enable-tremor         Tremor decoder support (default disabled)])
1763 if test "x${enable_tremor}" = "xyes"
1764 then
1765   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
1766     PLUGINS="${PLUGINS} tremor"
1767     LDFLAGS_tremor="${LDFLAGS_tremor} -lvorbisidec -logg"
1768    ],[])
1769 fi
1770
1771 dnl
1772 dnl  tarkin decoder plugin
1773 dnl
1774 AC_ARG_ENABLE(tarkin,
1775 [  --enable-tarkin         experimental tarkin codec (default disabled)])
1776 if test "x${enable_tarkin}" = "xyes"
1777 then
1778   AC_ARG_WITH(tarkin-tree,
1779   [    --with-tarkin-tree=PATH tarkin tree for static linking])
1780   if test "x${with_tarkin_tree}" != "x"
1781   then
1782     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
1783     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
1784     if test -f "${real_tarkin_tree}/tarkin.o"
1785     then
1786       BUILTINS="${BUILTINS} tarkin"
1787       CPPFLAGS_tarkin="${CPPFLAGS_tarkin} -I${real_tarkin_tree}"
1788       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"
1789       AC_MSG_RESULT(yes)
1790     else
1791       dnl  The given tarkin tree wasn't built
1792       AC_MSG_RESULT(no)
1793       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
1794                     make sure you compiled tarkin in ${with_tarkin_tree}])
1795     fi
1796   fi
1797 fi
1798
1799 dnl
1800 dnl  theora decoder plugin
1801 dnl
1802 AC_ARG_ENABLE(theora,
1803 [  --enable-theora         experimental theora codec (default disabled)])
1804 if test "x${enable_theora}" = "xyes"
1805 then
1806   AC_CHECK_HEADERS(theora/theora.h, [
1807     AC_CHECK_LIB(theora, theora_granule_time, [
1808       BUILTINS="${BUILTINS} theora"
1809       LDFLAGS_theora="${LDFLAGS_theora} -ltheora -logg" ],[
1810       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
1811 You also need to check that you have a libogg posterior to the 1.0 release.])],
1812       [-logg])
1813   ])
1814 fi
1815
1816 dnl
1817 dnl  Video plugins
1818 dnl
1819
1820 AC_ARG_WITH(,[Video plugins:])
1821
1822 dnl
1823 dnl  X11 module
1824 dnl  (enabled by default except on win32)
1825 dnl
1826 AC_ARG_ENABLE(x11,
1827   [  --enable-x11            X11 support (default enabled)])
1828 if test "x${enable_x11}" != "xno" &&
1829   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1830   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1831   AC_CHECK_HEADERS(X11/Xlib.h, [
1832     PLUGINS="${PLUGINS} x11"
1833     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
1834     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
1835   ])
1836   CPPFLAGS="${CPPFLAGS_save}"
1837 fi
1838
1839 dnl
1840 dnl  XVideo module
1841 dnl  (enabled by default except on win32)
1842 dnl
1843 AC_ARG_ENABLE(xvideo,
1844   [  --enable-xvideo         XVideo support (default enabled)])
1845 if test "x${enable_xvideo}" != "xno" &&
1846   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1847   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1848   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1849     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
1850     AC_CHECK_LIB(Xv_pic,XvPutImage,
1851       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1852       PLUGINS="${PLUGINS} xvideo"
1853       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
1854       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1855       AC_CHECK_LIB(Xv,XvPutImage,
1856         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1857         PLUGINS="${PLUGINS} xvideo"
1858         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
1859         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1860         # Otherwise... well, do nothing.
1861         :
1862       )
1863     )
1864     CFLAGS="${CFLAGS_save}"
1865   ]
1866   CPPFLAGS="${CPPFLAGS_save}")
1867 fi
1868
1869 dnl
1870 dnl  SDL module
1871 dnl
1872 AC_ARG_ENABLE(sdl,
1873   [  --enable-sdl            SDL support (default enabled)])
1874 if test "x${enable_sdl}" != "xno"
1875 then
1876   SDL_PATH="${PATH}"
1877   AC_ARG_WITH(sdl-config-path,
1878     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1879     [ if test "x${with_sdl_config_path}" != "xno"
1880       then
1881         SDL_PATH="${with_sdl_config_path}:${PATH}"
1882       fi ])
1883   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1884   SDL_CONFIG="${SDL12_CONFIG}"
1885   SDL_HEADER="SDL12/SDL.h"
1886   if test "x${SDL_CONFIG}" = "xno"
1887   then
1888     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1889     SDL_CONFIG=${SDL11_CONFIG}
1890     SDL_HEADER="SDL11/SDL.h"
1891   fi
1892   if test "x${SDL_CONFIG}" = "xno"
1893   then
1894     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1895     SDL_HEADER="SDL/SDL.h"
1896   fi
1897   # check for cross-compiling
1898   SDL_PREFIX=
1899   AC_ARG_WITH(sdl-prefix,
1900     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
1901                                e.g use as:
1902                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
1903   if test "x${with_sdl_prefix}" != "xno" -a "x${with_sdl_prefix}" != "x"
1904   then
1905     SDL_PREFIX="--prefix=${with_sdl_prefix}"
1906   fi
1907   if test "x${SDL_CONFIG}" != "xno"
1908   then
1909     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
1910     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1911     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1912     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1913     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1914     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
1915     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1916       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1917       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
1918           As a last resort we also test for SDL.h presence),
1919       [ AC_MSG_ERROR([The development package for SDL is not installed.
1920 Please install it and try again. Alternatively you can also configure with
1921 --disable-sdl.])
1922       ])])
1923     CPPFLAGS="${CPPFLAGS_save}"
1924     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1925     then
1926       AC_MSG_ERROR([The development package for SDL is not installed.
1927 Please install it and try again. Alternatively you can also configure with
1928 --disable-sdl.])
1929     fi
1930   elif test "x${enable_sdl}" =  "xyes"
1931   then
1932     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1933 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1934     ])
1935   fi
1936 fi
1937
1938 dnl
1939 dnl  Qt Embedded module
1940 dnl  (disabled by default)
1941 dnl
1942 AC_ARG_ENABLE(qte,
1943   [  --enable-qte            QT Embedded support (default disabled)])
1944 if test "x${enable_qte}" = "xyes"
1945 then
1946   AC_ARG_WITH(qte,
1947   [    --with-qte=PATH       Qt Embedded headers and libraries])
1948   if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
1949   then
1950     LDFLAGS_qte="${LDFLAGS_qte} -L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1951     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"
1952   else
1953     LDFLAGS_qte="${LDFLAGS_qte} -L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1954     CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1955   fi
1956   PLUGINS="${PLUGINS} qte"
1957   NEED_QTE_MAIN=yes
1958   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
1959   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
1960     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
1961   ] )
1962   CPPFLAGS="${CPPFLAGS_save}"
1963 fi
1964
1965 dnl
1966 dnl  Windows DirectX module
1967 dnl
1968 AC_ARG_ENABLE(directx,
1969   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1970 if test "x${enable_directx}" != "xno"
1971 then
1972   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
1973   then
1974     AC_ARG_WITH(directx,
1975     [    --with-directx=PATH   Win32 DirectX headers])
1976     if test "x${with_directx}" = "x"
1977     then
1978       AC_CHECK_HEADERS(ddraw.h,
1979       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
1980         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
1981     else
1982       AC_MSG_CHECKING(for directX headers in ${with_directx})
1983       if test -f ${with_directx}/ddraw.h
1984       then
1985         PLUGINS="${PLUGINS} vout_directx aout_directx"
1986         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
1987         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
1988         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
1989         AC_MSG_RESULT(yes)
1990       else
1991         AC_MSG_RESULT(no)
1992         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1993       fi
1994     fi
1995   fi
1996 fi
1997
1998 dnl
1999 dnl  Linux framebuffer module
2000 dnl
2001 AC_ARG_ENABLE(fb,
2002   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
2003     if test "x${enable_fb}" != "xno"
2004     then
2005       AC_CHECK_HEADERS(linux/fb.h, [
2006         PLUGINS="${PLUGINS} fb"
2007       ])
2008     fi
2009
2010 dnl
2011 dnl  Linux MGA module
2012 dnl
2013 AC_ARG_ENABLE(mga,
2014   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2015   [ if test "x${enable_mga}" = "xyes"
2016     then
2017       PLUGINS="${PLUGINS} mga xmga"
2018     fi ])
2019
2020 dnl
2021 dnl  SVGAlib module
2022 dnl
2023 AC_ARG_ENABLE(svgalib,
2024   [  --enable-svgalib        SVGAlib support (default disabled)])
2025 if test "x${enable_svgalib}" = "xyes"
2026 then
2027   PLUGINS="${PLUGINS} svgalib"
2028   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
2029 fi
2030
2031 dnl
2032 dnl  GGI module
2033 dnl
2034 AC_ARG_ENABLE(ggi,
2035   [  --enable-ggi            GGI support (default disabled)])
2036 if test "x${enable_ggi}" = "xyes"
2037 then
2038   PLUGINS="${PLUGINS} ggi"
2039   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
2040   AC_ARG_WITH(ggi,
2041     [    --with-ggi=PATH       path to libggi],
2042     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
2043       then
2044         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
2045         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
2046       fi ])
2047 fi
2048
2049 dnl
2050 dnl  Glide module
2051 dnl
2052 AC_ARG_ENABLE(glide,
2053   [  --enable-glide          Glide (3dfx) support (default disabled)])
2054 if test "x${enable_glide}" = "xyes"
2055 then
2056   PLUGINS="${PLUGINS} glide"
2057   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
2058   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
2059   AC_ARG_WITH(glide,
2060     [    --with-glide=PATH     path to libglide],
2061     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
2062       then
2063         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
2064         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
2065       fi ])
2066 fi
2067
2068 dnl
2069 dnl  AA plugin
2070 dnl
2071 AC_ARG_ENABLE(aa,
2072   [  --enable-aa             aalib output (default disabled)])
2073 if test "x${enable_aa}" = "xyes"
2074 then
2075   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2076   if test "x${have_aa}" = "xtrue"
2077   then
2078     PLUGINS="${PLUGINS} aa"
2079     LDFLAGS_aa="${LDFLAGS_aa} -laa"
2080   fi
2081 fi
2082
2083 dnl
2084 dnl  win32 GDI plugin
2085 dnl
2086 AC_ARG_ENABLE(wingdi,
2087   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2088 if test "x${enable_wingdi}" != "xno"; then
2089   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2090     PLUGINS="${PLUGINS} wingdi"
2091     LDFLAGS_wingdi="${LDFLAGS_wingdi} -lgdi32"
2092   fi
2093 fi
2094
2095 dnl
2096 dnl  Audio plugins
2097 dnl
2098
2099 AC_ARG_WITH(,[Audio plugins:])
2100
2101 dnl
2102 dnl  OSS /dev/dsp module (enabled by default except on win32)
2103 dnl
2104 AC_ARG_ENABLE(oss,
2105   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2106
2107 if test "x${enable_oss}" != "xno" &&
2108   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
2109 then
2110   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2111     PLUGINS="${PLUGINS} oss"
2112     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
2113   ])
2114 fi
2115
2116 dnl
2117 dnl  Esound module
2118 dnl
2119 AC_ARG_ENABLE(esd,
2120   [  --enable-esd            Esound library support (default disabled)],
2121   [if test "x${enable_esd}" = "xyes"
2122    then
2123      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2124      if test "x${ESD_CONFIG}" != "xno"
2125      then
2126        PLUGINS="${PLUGINS} esd"
2127        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
2128        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
2129      fi
2130    fi])
2131
2132 dnl
2133 dnl  aRts module
2134 dnl
2135 AC_ARG_ENABLE(arts,
2136   [  --enable-arts           aRts sound server (default disabled)],
2137   [if test "x${enable_arts}" = "xyes"
2138    then
2139      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2140      if test "x${ARTS_CONFIG}" != "xno"
2141      then
2142        PLUGINS="${PLUGINS} arts"
2143        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
2144        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
2145      fi
2146    fi])
2147
2148 dnl
2149 dnl  ALSA module
2150 dnl
2151 AC_ARG_ENABLE(alsa,
2152   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2153   [if test "x${enable_alsa}" = "xyes"
2154    then
2155      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2156      if test "x${have_alsa}" = "xtrue"
2157      then
2158        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2159                        #define ALSA_PCM_NEW_SW_PARAMS_API
2160                        #include <alsa/asoundlib.h>],
2161           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2162            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2163        PLUGINS="${PLUGINS} alsa"
2164        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
2165      else
2166        AC_MSG_ERROR([Could not find ALSA development headers])
2167      fi
2168    fi])
2169
2170 dnl
2171 dnl  win32 waveOut plugin
2172 dnl
2173 AC_ARG_ENABLE(waveout,
2174   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2175 if test "x${enable_waveout}" != "xno"; then
2176   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2177     PLUGINS="${PLUGINS} waveout"
2178     LDFLAGS_waveout="-lwinmm"
2179   fi
2180 fi
2181
2182 dnl
2183 dnl  Interface plugins
2184 dnl
2185
2186 AC_ARG_WITH(,[Interface plugins:])
2187
2188 dnl special case for BeOS
2189 if test "x${SYS}" = "xbeos"
2190 then
2191     PLUGINS="${PLUGINS} beos"
2192 fi
2193
2194 dnl
2195 dnl  Gtk+ module
2196 dnl
2197 AC_ARG_ENABLE(gtk,
2198   [  --enable-gtk            Gtk+ support (default enabled)])
2199 if test "x${enable_gtk}" != "xno"
2200 then
2201   GTK_PATH="${PATH}"
2202   AC_ARG_WITH(gtk-config-path,
2203     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2204     [ if test "x${with_gtk_config_path}" != "xno"
2205       then
2206         GTK_PATH="${with_gtk_config_path}:${PATH}"
2207       fi ])
2208   # look for gtk-config
2209   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2210   GTK_CONFIG=${GTK12_CONFIG}
2211   if test "x${GTK_CONFIG}" = "xno"
2212   then
2213     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2214   fi
2215   if test "x${GTK_CONFIG}" != "xno"
2216   then
2217     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2218     then
2219       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.])
2220     fi
2221     if test "x${SYS}" != "xmingw32"; then
2222       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
2223       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
2224     else
2225       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
2226       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
2227     fi
2228     # now look for the gtk.h header
2229     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
2230     ac_cv_gtk_headers=yes
2231     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2232       ac_cv_gtk_headers=no
2233       echo "Cannot find gtk development headers."
2234     ])
2235     if test "x${ac_cv_gtk_headers}" = "xyes"
2236     then
2237       PLUGINS="${PLUGINS} gtk"
2238       if test "x${SYS}" != "xmingw32"; then
2239         NEED_GTK_MAIN=yes
2240       fi
2241       ALIASES="${ALIASES} gvlc"
2242     fi
2243     CPPFLAGS="${CPPFLAGS_save}"
2244   fi
2245 fi
2246
2247 dnl
2248 dnl  Familiar module uses Gtk+ library
2249 dnl
2250 AC_ARG_ENABLE(familiar,
2251   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
2252 if test "x${enable_familiar}" = "xyes"
2253 then
2254   GTK_PATH="${PATH}"
2255   AC_ARG_WITH(gtk-config-path,
2256     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2257     [ if test "x${with_gtk_config_path}" != "xno"
2258       then
2259         GTK_PATH="${with_gtk_config_path}:${PATH}"
2260       fi ])
2261   # look for gtk-config
2262   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2263   GTK_CONFIG=${GTK12_CONFIG}
2264   if test "x${GTK_CONFIG}" = "xno"
2265   then
2266     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2267   fi
2268   # check for cross-compiling
2269   GTK_PREFIX=
2270   AC_ARG_WITH(gtk-prefix,
2271     [    --with-gtk-prefix=PATH path to libgtk (needed for cross-compiling),
2272                           e.g use as:
2273                           --with-gtk-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2274   if test "x${with_gtk_prefix}" != "xno" -a "x${with_gtk_prefix}" != "x"
2275   then
2276     GTK_PREFIX="--prefix=$with_gtk_prefix"
2277   fi
2278   if test "x${GTK_CONFIG}" != "xno"
2279   then
2280     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2281     then
2282       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.])
2283     fi
2284     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --cflags gtk gthread`"
2285     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --libs gtk gthread | sed 's,-rdynamic,,'`"
2286     # now look for the gtk.h header
2287     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
2288     ac_cv_gtk_headers=yes
2289     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2290       ac_cv_gtk_headers=no
2291       echo "Cannot find gtk development headers."
2292     ])
2293     if test "x${ac_cv_gtk_headers}" = "xyes"
2294     then
2295       PLUGINS="${PLUGINS} familiar"
2296     fi
2297     CPPFLAGS="${CPPFLAGS_save}"
2298
2299     # now look for gpe support
2300     AC_ARG_WITH(gpe-prefix,
2301     [    --with-gpe-prefix=PATH gpe installation path prefix (default search in \$PATH)],[],[])
2302     if test "x$with_gpe_prefix" != "xno"  -a "x$with_gpe_prefix" != "x"
2303     then
2304       CFLAGS_gpe="-I$with_gpe_prefix/include"
2305       LDFLAGS_gpe="-lXi -lgdk_pixbuf -L$with_gpe_prefix/lib -lgpewidget"
2306       # now look for gpe/init.h header file
2307       CFLAGS_save=$CFLAGS
2308       LDFLAGS_save=$LDFLAGS
2309       CFLAGS="${CFLAGS_familiar} ${CFLAGS_gpe}"
2310       LDFLAGS="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2311       CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar} ${CFLAGS_gpe}"
2312       ac_cv_gpe_headers=yes
2313       AC_CHECK_HEADERS(gpe/init.h, ,
2314         [ ac_cv_gpe_headers=no
2315           AC_MSG_ERROR([Cannot find development headers for libgpewidget...]) ])
2316       CFLAGS=$CFLAGS_save
2317       LDFLAGS=$LDFLAG_save
2318       if test "x${ac_cv_gpe_headers}" = "xyes"
2319       then
2320         CFLAGS_familiar="${CFLAGS_familiar} ${CFLAGS_gpe}"
2321         LDFLAGS_familiar="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2322       fi
2323     else
2324           NEED_GTK_MAIN=yes
2325     fi # end gpe support
2326   fi # end gtk+ support
2327 fi
2328
2329 dnl
2330 dnl  Gnome module
2331 dnl
2332 AC_ARG_ENABLE(gnome,
2333   [  --enable-gnome          Gnome interface support (default disabled)],
2334   [if test "x${enable_gnome}" = "xyes"; then
2335     # look for gnome-config
2336     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
2337     if test -x ${GNOME_CONFIG}
2338     then
2339        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
2340        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
2341     fi
2342     # now look for the gnome.h header
2343     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
2344     AC_CHECK_HEADERS(gnome.h, [
2345       PLUGINS="${PLUGINS} gnome"
2346       NEED_GTK_MAIN=yes
2347       NEED_GNOME_MAIN=yes
2348       ALIASES="${ALIASES} gnome-vlc"
2349       dnl We need this because of some moronic gnomesupport.h flavours
2350       AC_MSG_CHECKING(for strndup in gnome.h)
2351       AC_EGREP_HEADER(strndup,gnome.h,[
2352         AC_MSG_RESULT(yes)
2353         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
2354                   Define if <gnome.h> defines strndup.)],[
2355         AC_MSG_RESULT(no)])
2356      ],[
2357       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
2358 developement tools or remove the --enable-gnome option])
2359      ])
2360     CPPFLAGS="${CPPFLAGS_save}"
2361   fi])
2362
2363 dnl
2364 dnl  wxWindows module
2365 dnl
2366 AC_ARG_ENABLE(wxwindows,
2367   [  --enable-wxwindows      wxWindows support (default enabled)])
2368 if test "x${enable_wxwindows}" != "xno"
2369 then
2370   WXWINDOWS_PATH="${PATH}"
2371   AC_ARG_WITH(wx-config-path,
2372     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
2373     [ if test "x${with_wx_config_path}" != "xno"
2374       then
2375         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
2376       fi ])
2377   # look for wx-config
2378   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
2379   if test "x${WX_CONFIG}" != "xno"
2380   then
2381     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
2382     then
2383       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.])
2384     fi
2385     CXXFLAGS_wxwindows="${CXXFLAGS_wxwindows} `${WX_CONFIG} --cxxflags`"
2386     LDFLAGS_wxwindows="${LDFLAGS_wxwindows} `${WX_CONFIG} --libs`"
2387     # now look for the wxprec.h header
2388     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
2389     ac_cv_wx_headers=yes
2390     AC_CHECK_HEADERS(wx/wxprec.h, , [
2391       ac_cv_wx_headers=no
2392       echo "Cannot find wxWindows development headers."
2393     ])
2394     if test "x${ac_cv_wx_headers}" = "xyes"
2395     then
2396       PLUGINS="${PLUGINS} wxwindows"
2397       ALIASES="${ALIASES} wxvlc"
2398     fi
2399     CPPFLAGS="${CPPFLAGS_save}"
2400   fi
2401 fi
2402
2403 dnl
2404 dnl  Qt module
2405 dnl
2406 AC_ARG_ENABLE(qt,
2407   [  --enable-qt             Qt interface support (default disabled)],
2408   [if test "x${enable_qt}" = "xyes"; then
2409      PLUGINS="${PLUGINS} qt"
2410      ALIASES="${ALIASES} qvlc"
2411      LDFLAGS_qt="${LDFLAGS_qt} -lqt -L${QTDIR}/lib"
2412      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt -I${QTDIR}/include"
2413      if test -x ${QTDIR}/bin/moc
2414      then
2415        MOC=${QTDIR}/bin/moc
2416      else
2417        MOC=moc
2418      fi
2419    fi])
2420
2421 dnl
2422 dnl  KDE module
2423 dnl
2424 AC_ARG_ENABLE(kde,
2425   [  --enable-kde            KDE interface support (default disabled)],
2426   [if test "x${enable_kde}" = "xyes"; then
2427      PLUGINS="${PLUGINS} kde"
2428      ALIASES="${ALIASES} kvlc"
2429      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib"
2430      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
2431      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2432      AC_CHECK_LIB(kfile,main,[
2433        LDFLAGS_kde="${LDFLAGS_kde} -lkfile"
2434      ])
2435      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2436      AC_CHECK_LIB(kdeui,main,[
2437        LDFLAGS_kde="${LDFLAGS_kde} -lkdeui"
2438      ])
2439      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2440      AC_CHECK_LIB(kio,main,[
2441        LDFLAGS_kde="${LDFLAGS_kde} -lkio"
2442      ])
2443      LDFLAGS="${LDFLAGS_save}"
2444      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt"
2445      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
2446      if test -x ${QTDIR}/bin/moc
2447      then
2448        MOC=${QTDIR}/bin/moc
2449      else
2450        MOC=moc
2451      fi
2452    fi])
2453
2454 dnl
2455 dnl  Opie QT embedded module
2456 dnl
2457 AC_ARG_ENABLE(opie,
2458   [  --enable-opie           Qt embedded interface support (default disabled)],
2459   [if test "x${enable_opie}" = "xyes"; then
2460      AC_ARG_WITH(qte,
2461      [    --with-qte=PATH       Qt Embedded headers and libraries])
2462      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2463      then
2464        LDFLAGS_qte="-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2465        CPPFLAGS_qte="-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2466      else
2467        LDFLAGS_qte="-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`"
2468        CPPFLAGS_qte="-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`"
2469      fi
2470      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2471      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2472        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2473      ] )
2474      CPPFLAGS="${CPPFLAGS_save}"
2475
2476      PLUGINS="${PLUGINS} opie"
2477      NEED_QTE_MAIN=yes
2478      LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
2479      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
2480      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2481      then
2482        MOC=${with_qte}/bin/moc
2483      else
2484        MOC=${QTDIR}/bin/moc
2485      fi
2486    fi])
2487
2488 dnl
2489 dnl  MacOS X module
2490 dnl
2491 AC_ARG_ENABLE(macosx,
2492   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
2493   [if test "x${enable_macosx}" = "xyes"
2494    then
2495      BUILTINS="${BUILTINS} macosx"
2496      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2497    fi],
2498   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
2499      BUILTINS="${BUILTINS} macosx"
2500      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2501    )])
2502
2503 dnl
2504 dnl  QNX RTOS module
2505 dnl
2506 AC_ARG_ENABLE(qnx,
2507   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
2508     if test "x${enable_qnx}" != "xno"
2509     then
2510       AC_CHECK_HEADERS(Ph.h, [
2511         PLUGINS="${PLUGINS} qnx"
2512         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
2513       ])
2514     fi
2515
2516 dnl
2517 dnl  Windows native interface module, built with Borland C++ Builder
2518 dnl
2519 AC_ARG_ENABLE(intfwin,
2520 [  --enable-intfwin        Win32 interface support (default disabled)],
2521 [ if test "x${enable_intfwin}" != "xno"
2522   then
2523     AC_CHECK_TOOL(BPR2MAK, bpr2mak, AC_ERROR(bpr2mak not found))
2524     AC_CHECK_TOOL(BCMAKE, bcmake, AC_ERROR(bcmake not found))
2525     PLUGINS="${PLUGINS} win32"
2526   fi ])
2527
2528 dnl
2529 dnl  ncurses module
2530 dnl
2531 AC_ARG_ENABLE(ncurses,
2532   [  --enable-ncurses        ncurses interface support (default disabled)],
2533   [if test "x${enable_ncurses}" = "xyes"; then
2534      PLUGINS="${PLUGINS} ncurses"
2535      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
2536    fi])
2537
2538 dnl
2539 dnl  XOSD plugin
2540 dnl
2541 AC_ARG_ENABLE(xosd,
2542   [  --enable-xosd           xosd interface support (default disabled)])
2543 if test "x${enable_xosd}" = "xyes"
2544 then
2545   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2546   AC_CHECK_LIB(xosd,xosd_set_offset,
2547       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
2548     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
2549         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
2550       AC_TRY_COMPILE([#include <xosd.h>],
2551          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2552           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
2553   if test "x${have_xosd}" = "xtrue"
2554   then
2555     PLUGINS="${PLUGINS} xosd"
2556     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2557   fi
2558 fi
2559
2560 dnl
2561 dnl  SLP access plugin
2562 dnl
2563 AC_ARG_ENABLE(slp,
2564   [  --enable-slp            SLP service discovery support (default enabled)])
2565 if test "x${enable_slp}" != "xno"
2566 then
2567   AC_ARG_WITH(slp,
2568   [    --with-slp=PATH       libslp headers and libraries])
2569   if test "x${with_slp}" = x
2570   then
2571     AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
2572     if test "x${have_slp}" = "xtrue"
2573     then
2574       PLUGINS="${PLUGINS} slp"
2575       LDFLAGS_slp="${LDFLAGS_slp} -lslp"
2576     fi
2577   else
2578     AC_MSG_CHECKING(for slp headers in ${with_slp})
2579     if test -f ${with_slp}/slp.h
2580     then
2581       dnl  Use ${with_slp}/libslp/slp.h
2582       AC_MSG_RESULT(yes)
2583       PLUGINS="${PLUGINS} slp"
2584       LDFLAGS_slp="${LDFLAGS_slp} -L${with_slp} -lslp"
2585       CPPFLAGS_slp="${CPPFLAGS_slp} -I${with_slp}"
2586     else
2587       dnl  No libslp could be found, sorry
2588       AC_MSG_RESULT(no)
2589       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
2590     fi
2591   fi
2592 fi
2593
2594 dnl
2595 dnl  Lirc plugin
2596 dnl
2597 AC_ARG_ENABLE(lirc,
2598   [  --enable-lirc           lirc support (default disabled)])
2599 if test "x${enable_lirc}" = "xyes"
2600 then
2601   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2602   if test "x${have_lirc}" = "xtrue"
2603   then
2604     PLUGINS="${PLUGINS} lirc"
2605     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2606   fi
2607 fi
2608
2609 AC_ARG_WITH(,[Misc options:])
2610
2611 dnl
2612 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2613 dnl
2614 dnl  We give the user the opportunity to specify
2615 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2616 dnl
2617 AC_ARG_WITH(words,
2618   [  --with-words=endianness set endianness (big or little)])
2619   case "x${with_words}" in
2620     xbig)
2621       ac_cv_c_bigendian=yes
2622       ;;
2623     xlittle)
2624       ac_cv_c_bigendian=no
2625       ;;
2626     *)
2627       dnl  Try to guess endianness by matching patterns on a compiled
2628       dnl  binary, by looking for an ASCII or EBCDIC string
2629       AC_CACHE_CHECK([whether the byte order is big-endian],
2630         [ac_cv_c_bigendian],
2631         [ac_cv_c_bigendian="unknown"
2632         [cat >conftest.c <<EOF
2633         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2634         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2635         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2636         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2637         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2638         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2639         int main(void) { _a(); _e(); return 0; }
2640 EOF
2641         ]
2642         if test -f conftest.c
2643         then
2644           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2645               && test -f conftest.o
2646           then
2647             if test "`strings conftest.o | grep BIGenDianSyS`"
2648             then
2649               ac_cv_c_bigendian="yes"
2650             fi
2651             if test "`strings conftest.o | grep LiTTleEnDian`"
2652             then
2653               ac_cv_c_bigendian="no"
2654             fi
2655           fi
2656         fi
2657       ])
2658       if test "x${ac_cv_c_bigendian}" = "xunknown"
2659       then
2660         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
2661       fi
2662       ;;
2663   esac
2664 dnl  Now we know what to use for endianness, just put it in the header
2665 if test "${ac_cv_c_bigendian}" = "yes"
2666 then
2667   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
2668 fi
2669
2670 dnl
2671 dnl  GNU portable threads
2672 dnl
2673 AC_ARG_ENABLE(pth,
2674   [  --enable-pth            GNU Pth support (default disabled)],
2675   [ if test "x${enable_pth}" = "xyes"; then
2676     AC_CHECK_LIB(pth,pth_init)
2677     AC_MSG_CHECKING(for pth_init in pth.h)
2678     AC_EGREP_HEADER(pth_init,pth.h,[
2679       AC_MSG_RESULT(yes)
2680       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
2681                 Define if <pth.h> defines pth_init)
2682       THREAD_LIB="-lpth"
2683     ],[
2684       AC_MSG_RESULT(no)
2685     ])
2686     fi
2687 ])
2688
2689 dnl
2690 dnl  State Threads
2691 dnl
2692 AC_ARG_ENABLE(st,
2693   [  --enable-st             State Threads (default disabled)],
2694   [ if test "x${enable_st}" = "xyes"; then
2695     AC_CHECK_LIB(st,st_init)
2696     AC_MSG_CHECKING(for st_init in st.h)
2697     AC_EGREP_HEADER(st_init,st.h,[
2698       AC_MSG_RESULT(yes)
2699       AC_DEFINE(ST_INIT_IN_ST_H, 1,
2700                 Define if <st.h> defines st_init)
2701       THREAD_LIB="-lst"
2702     ],[
2703       AC_MSG_RESULT(yes)
2704     ])
2705     fi
2706 ])
2707
2708 if test "x${SYS}" != "xmingw32"; then
2709   LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
2710   LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
2711 fi
2712
2713 dnl
2714 dnl  Mozilla plugin
2715 dnl
2716 mozilla=false
2717 AC_ARG_ENABLE(mozilla,
2718   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2719 if test "x${enable_mozilla}" = "xyes"
2720 then
2721   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2722   if test "x${MOZILLA_CONFIG}" != "xno"
2723   then
2724     if test "x${SYS}" != "xmingw32"; then
2725       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
2726       AC_CHECK_LIB(Xt,XtStrings,[
2727         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
2728       ])
2729       LDFLAGS="${LDFLAGS_save}"
2730     fi
2731     mozilla=:
2732     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2733     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2734     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2735     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2736     dnl Not necessarily in ${PATH}
2737     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
2738     then
2739       XPIDL="/usr/lib/mozilla/xpidl"
2740     fi
2741   fi
2742 fi
2743 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
2744
2745 dnl
2746 dnl  test plugins
2747 dnl
2748 AC_ARG_ENABLE(testsuite,
2749   [  --enable-testsuite      build test modules (default disabled)])
2750 if test "x${enable_testsuite}" = "xyes"
2751 then
2752   TESTS="test1 test2 test3 test4"
2753
2754   dnl  we define those so that bootstrap sets the right linker
2755   CXXFLAGS_test2="${CXXFLAGS_test2}"
2756   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
2757   dnl  this one is needed until automake knows what to do
2758   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
2759
2760   PLUGINS="${PLUGINS} ${TESTS}"
2761   #BUILTINS="${BUILTINS} ${TESTS}"
2762 fi
2763
2764 dnl
2765 dnl  gtk_main plugin
2766 dnl
2767 if test "x${NEED_GTK_MAIN}" != "xno"
2768 then
2769     PLUGINS="${PLUGINS} gtk_main"
2770     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
2771         CFLAGS_familiar="${CFLAGS_familiar} -DNEED_GTK_MAIN"
2772     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
2773     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
2774 fi
2775
2776 if test "x${NEED_GNOME_MAIN}" != "xno"
2777 then
2778     PLUGINS="${PLUGINS} gnome_main"
2779     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
2780     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
2781 fi
2782
2783 dnl
2784 dnl  qte_main plugin
2785 dnl
2786 if test "x${NEED_QTE_MAIN}" != "xno"
2787 then
2788     PLUGINS="${PLUGINS} qte_main"
2789     CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
2790         CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
2791     CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
2792     LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
2793 fi
2794
2795
2796 dnl
2797 dnl  Plugin and builtin checks
2798 dnl
2799 builtin_support=false
2800 plugin_support=:
2801
2802 dnl Support for plugins - this must be AT THE END
2803 AC_ARG_ENABLE(plugins,
2804   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
2805   [if test "x${enable_plugins}" = "xno"
2806    then
2807      plugin_support=false
2808    fi])
2809
2810 dnl Automagically disable plugins if there is no system support for
2811 dnl dynamically loadable files (.so, .dll, .dylib).
2812 dnl don't forget vlc-win32 still can load .dll as plugins
2813 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2814 then
2815   echo "*** Your system doesn't have plugin support. All plugins will be built"
2816   echo "statically."
2817   plugin_support=false
2818 fi
2819
2820 dnl Export automake variables
2821 if ${plugin_support}
2822 then
2823   for plugin in `echo ${PLUGINS}`
2824   do
2825     eval "${plugin}_plugin=yes"
2826   done
2827 else
2828   BUILTINS="${BUILTINS} ${PLUGINS}"
2829   PLUGINS=
2830 fi
2831 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
2832
2833 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
2834 then
2835   builtin_support=:
2836   for builtin in `echo ${BUILTINS}`
2837   do
2838     eval "${builtin}_builtin=yes"
2839   done
2840 fi]
2841 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
2842
2843 dnl do not touch this line (bootstrap needs it)
2844
2845
2846 dnl
2847 dnl  Stuff used by the program
2848 dnl
2849 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
2850 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
2851 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2852
2853 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`"
2854 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2855 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2856 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
2857
2858 DATA_PATH="${ac_tool_prefix}/share/vlc"
2859 AC_SUBST(DATA_PATH)
2860 PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
2861 AC_SUBST(PLUGIN_PATH)
2862
2863 dnl
2864 dnl  Restore *FLAGS
2865 dnl
2866 CPPFLAGS="${CPPFLAGS_save}"
2867 CFLAGS="${CFLAGS_save}"
2868 CXXFLAGS="${CXXFLAGS_save}"
2869 OBJCFLAGS="${OBJCFLAGS_save}"
2870 LDFLAGS="${LDFLAGS_save}"
2871
2872 dnl
2873 dnl  Fool automake (see Makefile.am)
2874 dnl
2875 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
2876 AC_SUBST(AUTOMAKE_SUCKS)
2877
2878 dnl
2879 dnl  Create the vlc-config script
2880 dnl
2881 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
2882 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
2883
2884 dnl
2885 dnl  Configuration is finished
2886 dnl
2887 AC_SUBST(SYS)
2888 AC_SUBST(ARCH)
2889 AC_SUBST(PLUGINS)
2890 AC_SUBST(BUILTINS)
2891 AC_SUBST(ALIASES)
2892 AC_SUBST(ASM)
2893 AC_SUBST(MOC)
2894 AC_SUBST(WINDRES)
2895 AC_SUBST(XPIDL)
2896 AC_SUBST(LIBEXT)
2897 AC_SUBST(INCLUDES)
2898
2899 AC_SUBST(CFLAGS_TUNING)
2900 AC_SUBST(CFLAGS_OPTIM)
2901 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2902 AC_SUBST(CFLAGS_NOOPTIM)
2903 AC_SUBST(LDFLAGS)
2904
2905 AC_SUBST(CFLAGS_vlc)
2906 AC_SUBST(CFLAGS_pics)
2907 AC_SUBST(CXXFLAGS_pics)
2908 AC_SUBST(CFLAGS_plugins)
2909 AC_SUBST(CXXFLAGS_plugins)
2910 AC_SUBST(CFLAGS_builtins)
2911 AC_SUBST(CPPFLAGS_mozilla)
2912
2913 AC_SUBST(LDFLAGS_vlc)
2914 AC_SUBST(LDFLAGS_libvlc)
2915 AC_SUBST(LDFLAGS_plugins)
2916 AC_SUBST(LDFLAGS_builtins)
2917 AC_SUBST(LDFLAGS_mozilla)
2918
2919 AC_OUTPUT([
2920   Makefile
2921   debian/Makefile
2922   doc/Makefile
2923   intl/Makefile
2924   ipkg/Makefile
2925   lib/Makefile
2926   m4/Makefile
2927   modules/Makefile
2928   po/Makefile.in
2929   share/Makefile
2930   src/Makefile
2931   vlc-config
2932 ],[
2933   chmod a+x vlc-config
2934 ])
2935
2936 printf "
2937 vlc configuration
2938 --------------------
2939 vlc version           : ${VERSION}
2940 system                : ${SYS}
2941 architecture          : ${ARCH}
2942 build flavour         : "
2943 test "x${DEBUG_TRUE}" = "x" && printf "debug "
2944 test "x${CPROF_TRUE}" = "x" && printf "cprof "
2945 test "x${GPROF_TRUE}" = "x" && printf "gprof "
2946 test "x${OPTIM_TRUE}" = "x" && printf "optim "
2947 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
2948 echo "
2949 vlc aliases           :${ALIASES}
2950
2951 To build vlc and its plugins, type \`make'.
2952 "
2953