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