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