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