a4c70546cdde1c298dda683cef06506753c2144b
[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(libdv/dv.h, [
1740     PLUGINS="${PLUGINS} dv"
1741     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1742    ],[])
1743 fi
1744
1745 dnl
1746 dnl  Vorbis plugin
1747 dnl
1748 AC_ARG_ENABLE(vorbis,
1749   [  --enable-vorbis         Vorbis decoder support (default enabled)])
1750 if test "x${enable_vorbis}" != "xno"
1751 then
1752   AC_CHECK_HEADERS(vorbis/codec.h, [
1753     PLUGINS="${PLUGINS} vorbis"
1754     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis -logg"
1755    ],[])
1756 fi
1757          
1758 dnl
1759 dnl  Tremor plugin
1760 dnl
1761 AC_ARG_ENABLE(tremor,
1762   [  --enable-tremor         Tremor decoder support (default disabled)])
1763 if test "x${enable_tremor}" = "xyes"
1764 then
1765   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
1766     PLUGINS="${PLUGINS} tremor"
1767     LDFLAGS_tremor="${LDFLAGS_tremor} -lvorbisidec -logg"
1768    ],[])
1769 fi
1770
1771 dnl
1772 dnl  tarkin decoder plugin
1773 dnl
1774 AC_ARG_ENABLE(tarkin,
1775 [  --enable-tarkin         experimental tarkin codec (default disabled)])
1776 if test "x${enable_tarkin}" = "xyes"
1777 then
1778   AC_ARG_WITH(tarkin-tree,
1779   [    --with-tarkin-tree=PATH tarkin tree for static linking])
1780   if test "x${with_tarkin_tree}" != "x"
1781   then
1782     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
1783     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
1784     if test -f "${real_tarkin_tree}/tarkin.o"
1785     then
1786       BUILTINS="${BUILTINS} tarkin"
1787       CPPFLAGS_tarkin="${CPPFLAGS_tarkin} -I${real_tarkin_tree}"
1788       LDFLAGS_tarkin="${LDFLAGS_tarkin} ${real_tarkin_tree}/mem.o ${real_tarkin_tree}/pnm.o ${real_tarkin_tree}/wavelet.o ${real_tarkin_tree}/wavelet_xform.o ${real_tarkin_tree}/wavelet_coeff.o ${real_tarkin_tree}/yuv.o ${real_tarkin_tree}/tarkin.o ${real_tarkin_tree}/info.o -logg"
1789       AC_MSG_RESULT(yes)
1790     else
1791       dnl  The given tarkin tree wasn't built
1792       AC_MSG_RESULT(no)
1793       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
1794                     make sure you compiled tarkin in ${with_tarkin_tree}])
1795     fi
1796   fi
1797 fi
1798
1799 dnl
1800 dnl  theora decoder plugin
1801 dnl
1802 AC_ARG_ENABLE(theora,
1803 [  --enable-theora         experimental theora codec (default disabled)])
1804 if test "x${enable_theora}" = "xyes"
1805 then
1806   AC_CHECK_HEADERS(theora/theora.h, [
1807     AC_CHECK_LIB(theora, theora_granule_time, [
1808       BUILTINS="${BUILTINS} theora"
1809       LDFLAGS_theora="${LDFLAGS_theora} -ltheora -logg" ],[
1810       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
1811 You also need to check that you have a libogg posterior to the 1.0 release.])],
1812       [-logg])
1813   ])
1814 fi
1815
1816 dnl
1817 dnl  Video plugins
1818 dnl
1819
1820 AC_ARG_WITH(,[Video plugins:])
1821
1822 dnl
1823 dnl  X11 module
1824 dnl  (enabled by default except on win32)
1825 dnl
1826 AC_ARG_ENABLE(x11,
1827   [  --enable-x11            X11 support (default enabled)])
1828 if test "x${enable_x11}" != "xno" &&
1829   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1830   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1831   AC_CHECK_HEADERS(X11/Xlib.h, [
1832     PLUGINS="${PLUGINS} x11"
1833     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
1834     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
1835   ])
1836   CPPFLAGS="${CPPFLAGS_save}"
1837 fi
1838
1839 dnl
1840 dnl  XVideo module
1841 dnl  (enabled by default except on win32)
1842 dnl
1843 AC_ARG_ENABLE(xvideo,
1844   [  --enable-xvideo         XVideo support (default enabled)])
1845 if test "x${enable_xvideo}" != "xno" &&
1846   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1847   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1848   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1849     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
1850     AC_CHECK_LIB(Xv_pic,XvPutImage,
1851       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1852       PLUGINS="${PLUGINS} xvideo"
1853       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
1854       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1855       AC_CHECK_LIB(Xv,XvPutImage,
1856         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1857         PLUGINS="${PLUGINS} xvideo"
1858         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
1859         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1860         # Otherwise... well, do nothing.
1861         :
1862       )
1863     )
1864     CFLAGS="${CFLAGS_save}"
1865   ]
1866   CPPFLAGS="${CPPFLAGS_save}")
1867 fi
1868
1869 dnl
1870 dnl  SDL module
1871 dnl
1872 AC_ARG_ENABLE(sdl,
1873   [  --enable-sdl            SDL support (default enabled)])
1874 if test "x${enable_sdl}" != "xno"
1875 then
1876   SDL_PATH="${PATH}"
1877   AC_ARG_WITH(sdl-config-path,
1878     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1879     [ if test "x${with_sdl_config_path}" != "xno"
1880       then
1881         SDL_PATH="${with_sdl_config_path}:${PATH}"
1882       fi ])
1883   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1884   SDL_CONFIG="${SDL12_CONFIG}"
1885   SDL_HEADER="SDL12/SDL.h"
1886   if test "x${SDL_CONFIG}" = "xno"
1887   then
1888     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1889     SDL_CONFIG=${SDL11_CONFIG}
1890     SDL_HEADER="SDL11/SDL.h"
1891   fi
1892   if test "x${SDL_CONFIG}" = "xno"
1893   then
1894     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1895     SDL_HEADER="SDL/SDL.h"
1896   fi
1897   # check for cross-compiling
1898   SDL_PREFIX=
1899   AC_ARG_WITH(sdl-prefix,
1900     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
1901                                e.g use as:
1902                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
1903   if test "x${with_sdl_prefix}" != "xno" -a "x${with_sdl_prefix}" != "x"
1904   then
1905     SDL_PREFIX="--prefix=${with_sdl_prefix}"
1906   fi
1907   if test "x${SDL_CONFIG}" != "xno"
1908   then
1909     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
1910     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1911     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1912     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1913     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1914     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
1915     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1916       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1917       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
1918           As a last resort we also test for SDL.h presence),
1919       [ AC_MSG_ERROR([The development package for SDL is not installed.
1920 Please install it and try again. Alternatively you can also configure with
1921 --disable-sdl.])
1922       ])])
1923     CPPFLAGS="${CPPFLAGS_save}"
1924     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1925     then
1926       AC_MSG_ERROR([The development package for SDL is not installed.
1927 Please install it and try again. Alternatively you can also configure with
1928 --disable-sdl.])
1929     fi
1930   elif test "x${enable_sdl}" =  "xyes"
1931   then
1932     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1933 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1934     ])
1935   fi
1936 fi
1937
1938 dnl
1939 dnl  Qt Embedded module
1940 dnl  (disabled by default)
1941 dnl
1942 AC_ARG_ENABLE(qte,
1943   [  --enable-qte            QT Embedded support (default disabled)])
1944 if test "x${enable_qte}" = "xyes"
1945 then
1946   AC_ARG_WITH(qte,
1947   [    --with-qte=PATH       Qt Embedded headers and libraries])
1948   if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
1949   then
1950     LDFLAGS_qte="${LDFLAGS_qte} -L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1951     CPPFLAGS_qte="${CPPFLAGS_qte} -I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1952   else
1953     LDFLAGS_qte="${LDFLAGS_qte} -L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1954     CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1955   fi
1956   PLUGINS="${PLUGINS} qte"
1957   NEED_QTE_MAIN=yes
1958   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
1959   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
1960     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
1961   ] )
1962   CPPFLAGS="${CPPFLAGS_save}"
1963 fi
1964
1965 dnl
1966 dnl  Windows DirectX module
1967 dnl
1968 AC_ARG_ENABLE(directx,
1969   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1970 if test "x${enable_directx}" != "xno"
1971 then
1972   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
1973   then
1974     AC_ARG_WITH(directx,
1975     [    --with-directx=PATH   Win32 DirectX headers])
1976     if test "x${with_directx}" = "x"
1977     then
1978       AC_CHECK_HEADERS(ddraw.h,
1979       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
1980         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
1981     else
1982       AC_MSG_CHECKING(for directX headers in ${with_directx})
1983       if test -f ${with_directx}/ddraw.h
1984       then
1985         PLUGINS="${PLUGINS} vout_directx aout_directx"
1986         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
1987         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
1988         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
1989         AC_MSG_RESULT(yes)
1990       else
1991         AC_MSG_RESULT(no)
1992         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1993       fi
1994     fi
1995   fi
1996 fi
1997
1998 dnl
1999 dnl  Linux framebuffer module
2000 dnl
2001 AC_ARG_ENABLE(fb,
2002   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
2003     if test "x${enable_fb}" != "xno"
2004     then
2005       AC_CHECK_HEADERS(linux/fb.h, [
2006         PLUGINS="${PLUGINS} fb"
2007       ])
2008     fi
2009
2010 dnl
2011 dnl  Linux MGA module
2012 dnl
2013 AC_ARG_ENABLE(mga,
2014   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2015   [ if test "x${enable_mga}" = "xyes"
2016     then
2017       PLUGINS="${PLUGINS} mga xmga"
2018     fi ])
2019
2020 dnl
2021 dnl  SVGAlib module
2022 dnl
2023 AC_ARG_ENABLE(svgalib,
2024   [  --enable-svgalib        SVGAlib support (default disabled)])
2025 if test "x${enable_svgalib}" = "xyes"
2026 then
2027   PLUGINS="${PLUGINS} svgalib"
2028   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
2029 fi
2030
2031 dnl
2032 dnl  GGI module
2033 dnl
2034 AC_ARG_ENABLE(ggi,
2035   [  --enable-ggi            GGI support (default disabled)])
2036 if test "x${enable_ggi}" = "xyes"
2037 then
2038   PLUGINS="${PLUGINS} ggi"
2039   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
2040   AC_ARG_WITH(ggi,
2041     [    --with-ggi=PATH       path to libggi],
2042     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
2043       then
2044         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
2045         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
2046       fi ])
2047 fi
2048
2049 dnl
2050 dnl  Glide module
2051 dnl
2052 AC_ARG_ENABLE(glide,
2053   [  --enable-glide          Glide (3dfx) support (default disabled)])
2054 if test "x${enable_glide}" = "xyes"
2055 then
2056   PLUGINS="${PLUGINS} glide"
2057   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
2058   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
2059   AC_ARG_WITH(glide,
2060     [    --with-glide=PATH     path to libglide],
2061     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
2062       then
2063         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
2064         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
2065       fi ])
2066 fi
2067
2068 dnl
2069 dnl  AA plugin
2070 dnl
2071 AC_ARG_ENABLE(aa,
2072   [  --enable-aa             aalib output (default disabled)])
2073 if test "x${enable_aa}" = "xyes"
2074 then
2075   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2076   if test "x${have_aa}" = "xtrue"
2077   then
2078     PLUGINS="${PLUGINS} aa"
2079     LDFLAGS_aa="${LDFLAGS_aa} -laa"
2080   fi
2081 fi
2082
2083 dnl
2084 dnl  win32 GDI plugin
2085 dnl
2086 AC_ARG_ENABLE(wingdi,
2087   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2088 if test "x${enable_wingdi}" != "xno"; then
2089   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2090     PLUGINS="${PLUGINS} wingdi"
2091     LDFLAGS_wingdi="${LDFLAGS_wingdi} -lgdi32"
2092   fi
2093 fi
2094
2095 dnl
2096 dnl  Audio plugins
2097 dnl
2098
2099 AC_ARG_WITH(,[Audio plugins:])
2100
2101 dnl
2102 dnl  OSS /dev/dsp module (enabled by default except on win32)
2103 dnl
2104 AC_ARG_ENABLE(oss,
2105   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2106
2107 if test "x${enable_oss}" != "xno" &&
2108   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
2109 then
2110   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2111     PLUGINS="${PLUGINS} oss"
2112     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
2113   ])
2114 fi
2115
2116 dnl
2117 dnl  Esound module
2118 dnl
2119 AC_ARG_ENABLE(esd,
2120   [  --enable-esd            Esound library support (default disabled)],
2121   [if test "x${enable_esd}" = "xyes"
2122    then
2123      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2124      if test "x${ESD_CONFIG}" != "xno"
2125      then
2126        PLUGINS="${PLUGINS} esd"
2127        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
2128        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
2129      fi
2130    fi])
2131
2132 dnl
2133 dnl  aRts module
2134 dnl
2135 AC_ARG_ENABLE(arts,
2136   [  --enable-arts           aRts sound server (default disabled)],
2137   [if test "x${enable_arts}" = "xyes"
2138    then
2139      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2140      if test "x${ARTS_CONFIG}" != "xno"
2141      then
2142        PLUGINS="${PLUGINS} arts"
2143        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
2144        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
2145      fi
2146    fi])
2147
2148 dnl
2149 dnl  ALSA module
2150 dnl
2151 AC_ARG_ENABLE(alsa,
2152   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2153   [if test "x${enable_alsa}" = "xyes"
2154    then
2155      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2156      if test "x${have_alsa}" = "xtrue"
2157      then
2158        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2159                        #define ALSA_PCM_NEW_SW_PARAMS_API
2160                        #include <alsa/asoundlib.h>],
2161           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2162            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2163        PLUGINS="${PLUGINS} alsa"
2164        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
2165      else
2166        AC_MSG_ERROR([Could not find ALSA development headers])
2167      fi
2168    fi])
2169
2170 dnl
2171 dnl  win32 waveOut plugin
2172 dnl
2173 AC_ARG_ENABLE(waveout,
2174   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2175 if test "x${enable_waveout}" != "xno"; then
2176   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2177     PLUGINS="${PLUGINS} waveout"
2178     LDFLAGS_waveout="-lwinmm"
2179   fi
2180 fi
2181
2182 dnl
2183 dnl  Interface plugins
2184 dnl
2185
2186 AC_ARG_WITH(,[Interface plugins:])
2187
2188 dnl special case for BeOS
2189 if test "x${SYS}" = "xbeos"
2190 then
2191     PLUGINS="${PLUGINS} beos"
2192 fi
2193
2194 dnl
2195 dnl  Gtk+ module
2196 dnl
2197 AC_ARG_ENABLE(gtk,
2198   [  --enable-gtk            Gtk+ support (default enabled)])
2199 if test "x${enable_gtk}" != "xno"
2200 then
2201   GTK_PATH="${PATH}"
2202   AC_ARG_WITH(gtk-config-path,
2203     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2204     [ if test "x${with_gtk_config_path}" != "xno"
2205       then
2206         GTK_PATH="${with_gtk_config_path}:${PATH}"
2207       fi ])
2208   # look for gtk-config
2209   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2210   GTK_CONFIG=${GTK12_CONFIG}
2211   if test "x${GTK_CONFIG}" = "xno"
2212   then
2213     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2214   fi
2215   if test "x${GTK_CONFIG}" != "xno"
2216   then
2217     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2218     then
2219       AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-gtk.])
2220     fi
2221     if test "x${SYS}" != "xmingw32"; then
2222       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
2223       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
2224     else
2225       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
2226       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
2227     fi
2228     # now look for the gtk.h header
2229     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
2230     ac_cv_gtk_headers=yes
2231     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2232       ac_cv_gtk_headers=no
2233       echo "Cannot find gtk development headers."
2234     ])
2235     if test "x${ac_cv_gtk_headers}" = "xyes"
2236     then
2237       PLUGINS="${PLUGINS} gtk"
2238       if test "x${SYS}" != "xmingw32"; then
2239         NEED_GTK_MAIN=yes
2240       fi
2241       ALIASES="${ALIASES} gvlc"
2242     fi
2243     CPPFLAGS="${CPPFLAGS_save}"
2244   fi
2245 fi
2246
2247 dnl
2248 dnl  Familiar module uses Gtk+ library
2249 dnl
2250 AC_ARG_ENABLE(familiar,
2251   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
2252 if test "x${enable_familiar}" = "xyes"
2253 then
2254   GTK_PATH="${PATH}"
2255   AC_ARG_WITH(gtk-config-path,
2256     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2257     [ if test "x${with_gtk_config_path}" != "xno"
2258       then
2259         GTK_PATH="${with_gtk_config_path}:${PATH}"
2260       fi ])
2261   # look for gtk-config
2262   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2263   GTK_CONFIG=${GTK12_CONFIG}
2264   if test "x${GTK_CONFIG}" = "xno"
2265   then
2266     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2267   fi
2268   # check for cross-compiling
2269   GTK_PREFIX=
2270   AC_ARG_WITH(gtk-prefix,
2271     [    --with-gtk-prefix=PATH path to libgtk (needed for cross-compiling),
2272                           e.g use as:
2273                           --with-gtk-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2274   if test "x${with_gtk_prefix}" != "xno" -a "x${with_gtk_prefix}" != "x"
2275   then
2276     GTK_PREFIX="--prefix=$with_gtk_prefix"
2277   fi
2278   if test "x${GTK_CONFIG}" != "xno"
2279   then
2280     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2281     then
2282       AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-familiar.])
2283     fi
2284     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --cflags gtk gthread`"
2285     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --libs gtk gthread | sed 's,-rdynamic,,'`"
2286     # now look for the gtk.h header
2287     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
2288     ac_cv_gtk_headers=yes
2289     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2290       ac_cv_gtk_headers=no
2291       echo "Cannot find gtk development headers."
2292     ])
2293     if test "x${ac_cv_gtk_headers}" = "xyes"
2294     then
2295       PLUGINS="${PLUGINS} familiar"
2296     fi
2297     CPPFLAGS="${CPPFLAGS_save}"
2298
2299     # now look for gpe support
2300     AC_ARG_WITH(gpe-prefix,
2301     [    --with-gpe-prefix=PATH gpe installation path prefix (default search in \$PATH)],[],[])
2302     if test "x$with_gpe_prefix" != "xno"  -a "x$with_gpe_prefix" != "x"
2303     then
2304       CFLAGS_gpe="-I$with_gpe_prefix/include"
2305       LDFLAGS_gpe="-lXi -lgdk_pixbuf -L$with_gpe_prefix/lib -lgpewidget"
2306       # now look for gpe/init.h header file
2307       CFLAGS_save=$CFLAGS
2308       LDFLAGS_save=$LDFLAGS
2309       CFLAGS="${CFLAGS_familiar} ${CFLAGS_gpe}"
2310       LDFLAGS="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2311       CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar} ${CFLAGS_gpe}"
2312       ac_cv_gpe_headers=yes
2313       AC_CHECK_HEADERS(gpe/init.h, ,
2314         [ ac_cv_gpe_headers=no
2315           AC_MSG_ERROR([Cannot find development headers for libgpewidget...]) ])
2316       CFLAGS=$CFLAGS_save
2317       LDFLAGS=$LDFLAG_save
2318       if test "x${ac_cv_gpe_headers}" = "xyes"
2319       then
2320         CFLAGS_familiar="${CFLAGS_familiar} ${CFLAGS_gpe}"
2321         LDFLAGS_familiar="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2322       fi
2323     else
2324           NEED_GTK_MAIN=yes
2325     fi # end gpe support
2326   fi # end gtk+ support
2327 fi
2328
2329 dnl
2330 dnl  Gnome module
2331 dnl
2332 AC_ARG_ENABLE(gnome,
2333   [  --enable-gnome          Gnome interface support (default disabled)],
2334   [if test "x${enable_gnome}" = "xyes"; then
2335     # look for gnome-config
2336     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
2337     if test -x ${GNOME_CONFIG}
2338     then
2339        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
2340        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
2341     fi
2342     # now look for the gnome.h header
2343     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
2344     AC_CHECK_HEADERS(gnome.h, [
2345       PLUGINS="${PLUGINS} gnome"
2346       NEED_GTK_MAIN=yes
2347       NEED_GNOME_MAIN=yes
2348       ALIASES="${ALIASES} gnome-vlc"
2349       dnl We need this because of some moronic gnomesupport.h flavours
2350       AC_MSG_CHECKING(for strndup in gnome.h)
2351       AC_EGREP_HEADER(strndup,gnome.h,[
2352         AC_MSG_RESULT(yes)
2353         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
2354                   Define if <gnome.h> defines strndup.)],[
2355         AC_MSG_RESULT(no)])
2356      ],[
2357       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
2358 developement tools or remove the --enable-gnome option])
2359      ])
2360     CPPFLAGS="${CPPFLAGS_save}"
2361   fi])
2362
2363 dnl
2364 dnl  wxWindows module
2365 dnl
2366 AC_ARG_ENABLE(wxwindows,
2367   [  --enable-wxwindows      wxWindows support (default enabled)])
2368 if test "x${enable_wxwindows}" != "xno"
2369 then
2370   WXWINDOWS_PATH="${PATH}"
2371   AC_ARG_WITH(wx-config-path,
2372     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
2373     [ if test "x${with_wx_config_path}" != "xno"
2374       then
2375         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
2376       fi ])
2377   # look for wx-config
2378   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
2379   if test "x${WX_CONFIG}" != "xno"
2380   then
2381     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
2382     then
2383       AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-wxwindows.])
2384     fi
2385     CXXFLAGS_wxwindows="${CXXFLAGS_wxwindows} `${WX_CONFIG} --cxxflags`"
2386     LDFLAGS_wxwindows="${LDFLAGS_wxwindows} `${WX_CONFIG} --libs`"
2387     # now look for the wxprec.h header
2388     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
2389     ac_cv_wx_headers=yes
2390     AC_CHECK_HEADERS(wx/wxprec.h, , [
2391       ac_cv_wx_headers=no
2392       echo "Cannot find wxWindows development headers."
2393     ])
2394     if test "x${ac_cv_wx_headers}" = "xyes"
2395     then
2396       PLUGINS="${PLUGINS} wxwindows"
2397       ALIASES="${ALIASES} wxvlc"
2398     fi
2399     CPPFLAGS="${CPPFLAGS_save}"
2400   fi
2401 fi
2402
2403 dnl
2404 dnl  Qt module
2405 dnl
2406 AC_ARG_ENABLE(qt,
2407   [  --enable-qt             Qt interface support (default disabled)],
2408   [if test "x${enable_qt}" = "xyes"; then
2409      PLUGINS="${PLUGINS} qt"
2410      ALIASES="${ALIASES} qvlc"
2411      LDFLAGS_qt="${LDFLAGS_qt} -lqt -L${QTDIR}/lib"
2412      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt -I${QTDIR}/include"
2413      if test -x ${QTDIR}/bin/moc
2414      then
2415        MOC=${QTDIR}/bin/moc
2416      else
2417        MOC=moc
2418      fi
2419    fi])
2420
2421 dnl
2422 dnl  KDE module
2423 dnl
2424 AC_ARG_ENABLE(kde,
2425   [  --enable-kde            KDE interface support (default disabled)],
2426   [if test "x${enable_kde}" = "xyes"; then
2427      PLUGINS="${PLUGINS} kde"
2428      ALIASES="${ALIASES} kvlc"
2429      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib"
2430      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
2431      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2432      AC_CHECK_LIB(kfile,main,[
2433        LDFLAGS_kde="${LDFLAGS_kde} -lkfile"
2434      ])
2435      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2436      AC_CHECK_LIB(kdeui,main,[
2437        LDFLAGS_kde="${LDFLAGS_kde} -lkdeui"
2438      ])
2439      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2440      AC_CHECK_LIB(kio,main,[
2441        LDFLAGS_kde="${LDFLAGS_kde} -lkio"
2442      ])
2443      LDFLAGS="${LDFLAGS_save}"
2444      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt"
2445      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
2446      if test -x ${QTDIR}/bin/moc
2447      then
2448        MOC=${QTDIR}/bin/moc
2449      else
2450        MOC=moc
2451      fi
2452    fi])
2453
2454 dnl
2455 dnl  Opie QT embedded module
2456 dnl
2457 AC_ARG_ENABLE(opie,
2458   [  --enable-opie           Qt embedded interface support (default disabled)],
2459   [if test "x${enable_opie}" = "xyes"; then
2460      AC_ARG_WITH(qte,
2461      [    --with-qte=PATH       Qt Embedded headers and libraries])
2462      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2463      then
2464        LDFLAGS_qte="-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2465        CPPFLAGS_qte="-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2466      else
2467        LDFLAGS_qte="-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`"
2468        CPPFLAGS_qte="-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`"
2469      fi
2470      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2471      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2472        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2473      ] )
2474      CPPFLAGS="${CPPFLAGS_save}"
2475
2476      PLUGINS="${PLUGINS} opie"
2477      NEED_QTE_MAIN=yes
2478      LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
2479      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
2480      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2481      then
2482        MOC=${with_qte}/bin/moc
2483      else
2484        MOC=${QTDIR}/bin/moc
2485      fi
2486    fi])
2487
2488 dnl
2489 dnl  MacOS X module
2490 dnl
2491 AC_ARG_ENABLE(macosx,
2492   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
2493   [if test "x${enable_macosx}" = "xyes"
2494    then
2495      BUILTINS="${BUILTINS} macosx"
2496      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2497    fi],
2498   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
2499      BUILTINS="${BUILTINS} macosx"
2500      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2501    )])
2502
2503 dnl
2504 dnl  QNX RTOS module
2505 dnl
2506 AC_ARG_ENABLE(qnx,
2507   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
2508     if test "x${enable_qnx}" != "xno"
2509     then
2510       AC_CHECK_HEADERS(Ph.h, [
2511         PLUGINS="${PLUGINS} qnx"
2512         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
2513       ])
2514     fi
2515
2516 dnl
2517 dnl  Windows native interface module, built with Borland C++ Builder
2518 dnl
2519 AC_ARG_ENABLE(intfwin,
2520 [  --enable-intfwin        Win32 interface support (default disabled)],
2521 [ if test "x${enable_intfwin}" != "xno"
2522   then
2523     AC_CHECK_TOOL(BPR2MAK, bpr2mak, AC_ERROR(bpr2mak not found))
2524     AC_CHECK_TOOL(BCMAKE, bcmake, AC_ERROR(bcmake not found))
2525     PLUGINS="${PLUGINS} win32"
2526   fi ])
2527
2528 dnl
2529 dnl  ncurses module
2530 dnl
2531 AC_ARG_ENABLE(ncurses,
2532   [  --enable-ncurses        ncurses interface support (default disabled)],
2533   [if test "x${enable_ncurses}" = "xyes"; then
2534      PLUGINS="${PLUGINS} ncurses"
2535      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
2536    fi])
2537
2538 dnl
2539 dnl  XOSD plugin
2540 dnl
2541 AC_ARG_ENABLE(xosd,
2542   [  --enable-xosd           xosd interface support (default disabled)])
2543 if test "x${enable_xosd}" = "xyes"
2544 then
2545   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2546   AC_CHECK_LIB(xosd,xosd_set_offset,
2547       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
2548     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
2549         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
2550       AC_TRY_COMPILE([#include <xosd.h>],
2551          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2552           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
2553   if test "x${have_xosd}" = "xtrue"
2554   then
2555     PLUGINS="${PLUGINS} xosd"
2556     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2557   fi
2558 fi
2559
2560 dnl
2561 dnl  SLP access plugin
2562 dnl
2563 AC_ARG_ENABLE(slp,
2564   [  --enable-slp            SLP service discovery support (default enabled)])
2565 if test "x${enable_slp}" != "xno"
2566 then
2567   AC_ARG_WITH(slp,
2568   [    --with-slp=PATH       libslp headers and libraries])
2569   if test "x${with_slp}" = x
2570   then
2571     AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
2572     if test "x${have_slp}" = "xtrue"
2573     then
2574       PLUGINS="${PLUGINS} slp"
2575       LDFLAGS_slp="${LDFLAGS_slp} -lslp"
2576     fi
2577   else
2578     AC_MSG_CHECKING(for slp headers in ${with_slp})
2579     if test -f ${with_slp}/slp.h
2580     then
2581       dnl  Use ${with_slp}/libslp/slp.h
2582       AC_MSG_RESULT(yes)
2583       PLUGINS="${PLUGINS} slp"
2584       LDFLAGS_slp="${LDFLAGS_slp} -L${with_slp} -lslp"
2585       CPPFLAGS_slp="${CPPFLAGS_slp} -I${with_slp}"
2586     else
2587       dnl  No libslp could be found, sorry
2588       AC_MSG_RESULT(no)
2589       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
2590     fi
2591   fi
2592 fi
2593
2594 dnl
2595 dnl  Lirc plugin
2596 dnl
2597 AC_ARG_ENABLE(lirc,
2598   [  --enable-lirc           lirc support (default disabled)])
2599 if test "x${enable_lirc}" = "xyes"
2600 then
2601   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2602   if test "x${have_lirc}" = "xtrue"
2603   then
2604     PLUGINS="${PLUGINS} lirc"
2605     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2606   fi
2607 fi
2608
2609 AC_ARG_WITH(,[Misc options:])
2610
2611 dnl
2612 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2613 dnl
2614 dnl  We give the user the opportunity to specify
2615 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2616 dnl
2617 AC_ARG_WITH(words,
2618   [  --with-words=endianness set endianness (big or little)])
2619   case "x${with_words}" in
2620     xbig)
2621       ac_cv_c_bigendian=yes
2622       ;;
2623     xlittle)
2624       ac_cv_c_bigendian=no
2625       ;;
2626     *)
2627       dnl  Try to guess endianness by matching patterns on a compiled
2628       dnl  binary, by looking for an ASCII or EBCDIC string
2629       AC_CACHE_CHECK([whether the byte order is big-endian],
2630         [ac_cv_c_bigendian],
2631         [ac_cv_c_bigendian="unknown"
2632         [cat >conftest.c <<EOF
2633         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2634         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2635         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2636         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2637         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2638         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2639         int main(void) { _a(); _e(); return 0; }
2640 EOF
2641         ]
2642         if test -f conftest.c
2643         then
2644           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2645               && test -f conftest.o
2646           then
2647             if test "`strings conftest.o | grep BIGenDianSyS`"
2648             then
2649               ac_cv_c_bigendian="yes"
2650             fi
2651             if test "`strings conftest.o | grep LiTTleEnDian`"
2652             then
2653               ac_cv_c_bigendian="no"
2654             fi
2655           fi
2656         fi
2657       ])
2658       if test "x${ac_cv_c_bigendian}" = "xunknown"
2659       then
2660         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
2661       fi
2662       ;;
2663   esac
2664 dnl  Now we know what to use for endianness, just put it in the header
2665 if test "${ac_cv_c_bigendian}" = "yes"
2666 then
2667   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
2668 fi
2669
2670 dnl
2671 dnl  GNU portable threads
2672 dnl
2673 AC_ARG_ENABLE(pth,
2674   [  --enable-pth            GNU Pth support (default disabled)],
2675   [ if test "x${enable_pth}" = "xyes"; then
2676     AC_CHECK_LIB(pth,pth_init)
2677     AC_MSG_CHECKING(for pth_init in pth.h)
2678     AC_EGREP_HEADER(pth_init,pth.h,[
2679       AC_MSG_RESULT(yes)
2680       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
2681                 Define if <pth.h> defines pth_init)
2682       THREAD_LIB="-lpth"
2683     ],[
2684       AC_MSG_RESULT(no)
2685     ])
2686     fi
2687 ])
2688
2689 dnl
2690 dnl  State Threads
2691 dnl
2692 AC_ARG_ENABLE(st,
2693   [  --enable-st             State Threads (default disabled)],
2694   [ if test "x${enable_st}" = "xyes"; then
2695     AC_CHECK_LIB(st,st_init)
2696     AC_MSG_CHECKING(for st_init in st.h)
2697     AC_EGREP_HEADER(st_init,st.h,[
2698       AC_MSG_RESULT(yes)
2699       AC_DEFINE(ST_INIT_IN_ST_H, 1,
2700                 Define if <st.h> defines st_init)
2701       THREAD_LIB="-lst"
2702     ],[
2703       AC_MSG_RESULT(yes)
2704     ])
2705     fi
2706 ])
2707
2708 if test "x${SYS}" != "xmingw32"; then
2709   LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
2710   LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
2711 fi
2712
2713 dnl
2714 dnl  Mozilla plugin
2715 dnl
2716 mozilla=false
2717 AC_ARG_ENABLE(mozilla,
2718   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2719 if test "x${enable_mozilla}" = "xyes"
2720 then
2721   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2722   if test "x${MOZILLA_CONFIG}" != "xno"
2723   then
2724     if test "x${SYS}" != "xmingw32"; then
2725       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
2726       AC_CHECK_LIB(Xt,XtStrings,[
2727         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
2728       ])
2729       LDFLAGS="${LDFLAGS_save}"
2730     fi
2731     mozilla=:
2732     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2733     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2734     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2735     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2736     dnl Not necessarily in ${PATH}
2737     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
2738     then
2739       XPIDL="/usr/lib/mozilla/xpidl"
2740     fi
2741   fi
2742 fi
2743 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
2744
2745 dnl
2746 dnl  test plugins
2747 dnl
2748 AC_ARG_ENABLE(testsuite,
2749   [  --enable-testsuite      build test modules (default disabled)])
2750 if test "x${enable_testsuite}" = "xyes"
2751 then
2752   TESTS="test1 test2 test3 test4"
2753
2754   dnl  we define those so that bootstrap sets the right linker
2755   CXXFLAGS_test2="${CXXFLAGS_test2}"
2756   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
2757   dnl  this one is needed until automake knows what to do
2758   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
2759
2760   PLUGINS="${PLUGINS} ${TESTS}"
2761   #BUILTINS="${BUILTINS} ${TESTS}"
2762 fi
2763
2764 dnl
2765 dnl  gtk_main plugin
2766 dnl
2767 if test "x${NEED_GTK_MAIN}" != "xno"
2768 then
2769     PLUGINS="${PLUGINS} gtk_main"
2770     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
2771         CFLAGS_familiar="${CFLAGS_familiar} -DNEED_GTK_MAIN"
2772     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
2773     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
2774 fi
2775
2776 if test "x${NEED_GNOME_MAIN}" != "xno"
2777 then
2778     PLUGINS="${PLUGINS} gnome_main"
2779     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
2780     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
2781 fi
2782
2783 dnl
2784 dnl  qte_main plugin
2785 dnl
2786 if test "x${NEED_QTE_MAIN}" != "xno"
2787 then
2788     PLUGINS="${PLUGINS} qte_main"
2789     CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
2790         CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
2791     CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
2792     LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
2793 fi
2794
2795
2796 dnl
2797 dnl  Plugin and builtin checks
2798 dnl
2799 builtin_support=false
2800 plugin_support=:
2801
2802 dnl Support for plugins - this must be AT THE END
2803 AC_ARG_ENABLE(plugins,
2804   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
2805   [if test "x${enable_plugins}" = "xno"
2806    then
2807      plugin_support=false
2808    fi])
2809
2810 dnl Automagically disable plugins if there is no system support for
2811 dnl dynamically loadable files (.so, .dll, .dylib).
2812 dnl don't forget vlc-win32 still can load .dll as plugins
2813 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2814 then
2815   echo "*** Your system doesn't have plugin support. All plugins will be built"
2816   echo "statically."
2817   plugin_support=false
2818 fi
2819
2820 dnl Export automake variables
2821 if ${plugin_support}
2822 then
2823   for plugin in `echo ${PLUGINS}`
2824   do
2825     eval "${plugin}_plugin=yes"
2826   done
2827 else
2828   BUILTINS="${BUILTINS} ${PLUGINS}"
2829   PLUGINS=
2830 fi
2831 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
2832
2833 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
2834 then
2835   builtin_support=:
2836   for builtin in `echo ${BUILTINS}`
2837   do
2838     eval "${builtin}_builtin=yes"
2839   done
2840 fi]
2841 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
2842
2843 dnl do not touch this line (bootstrap needs it)
2844
2845
2846 dnl
2847 dnl  Stuff used by the program
2848 dnl
2849 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
2850 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
2851 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2852
2853 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`"
2854 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2855 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2856 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
2857
2858 DATA_PATH="${ac_tool_prefix}/share/vlc"
2859 AC_SUBST(DATA_PATH)
2860 PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
2861 AC_SUBST(PLUGIN_PATH)
2862
2863 dnl
2864 dnl  Restore *FLAGS
2865 dnl
2866 CPPFLAGS="${CPPFLAGS_save}"
2867 CFLAGS="${CFLAGS_save}"
2868 CXXFLAGS="${CXXFLAGS_save}"
2869 OBJCFLAGS="${OBJCFLAGS_save}"
2870 LDFLAGS="${LDFLAGS_save}"
2871
2872 dnl
2873 dnl  Fool automake (see Makefile.am)
2874 dnl
2875 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
2876 AC_SUBST(AUTOMAKE_SUCKS)
2877
2878 dnl
2879 dnl  Create the vlc-config script
2880 dnl
2881 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
2882 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
2883
2884 dnl
2885 dnl  Configuration is finished
2886 dnl
2887 AC_SUBST(SYS)
2888 AC_SUBST(ARCH)
2889 AC_SUBST(PLUGINS)
2890 AC_SUBST(BUILTINS)
2891 AC_SUBST(ALIASES)
2892 AC_SUBST(ASM)
2893 AC_SUBST(MOC)
2894 AC_SUBST(WINDRES)
2895 AC_SUBST(XPIDL)
2896 AC_SUBST(LIBEXT)
2897 AC_SUBST(INCLUDES)
2898
2899 AC_SUBST(CFLAGS_TUNING)
2900 AC_SUBST(CFLAGS_OPTIM)
2901 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2902 AC_SUBST(CFLAGS_NOOPTIM)
2903 AC_SUBST(LDFLAGS)
2904
2905 AC_SUBST(CFLAGS_vlc)
2906 AC_SUBST(CFLAGS_pics)
2907 AC_SUBST(CXXFLAGS_pics)
2908 AC_SUBST(CFLAGS_plugins)
2909 AC_SUBST(CXXFLAGS_plugins)
2910 AC_SUBST(CFLAGS_builtins)
2911 AC_SUBST(CPPFLAGS_mozilla)
2912
2913 AC_SUBST(LDFLAGS_vlc)
2914 AC_SUBST(LDFLAGS_libvlc)
2915 AC_SUBST(LDFLAGS_plugins)
2916 AC_SUBST(LDFLAGS_builtins)
2917 AC_SUBST(LDFLAGS_mozilla)
2918
2919 AC_OUTPUT([
2920   Makefile
2921   debian/Makefile
2922   doc/Makefile
2923   intl/Makefile
2924   ipkg/Makefile
2925   lib/Makefile
2926   m4/Makefile
2927   modules/Makefile
2928   po/Makefile.in
2929   share/Makefile
2930   src/Makefile
2931   vlc-config
2932 ],[
2933   chmod a+x vlc-config
2934 ])
2935
2936 printf "
2937 vlc configuration
2938 --------------------
2939 vlc version           : ${VERSION}
2940 system                : ${SYS}
2941 architecture          : ${ARCH}
2942 build flavour         : "
2943 test "x${DEBUG_TRUE}" = "x" && printf "debug "
2944 test "x${CPROF_TRUE}" = "x" && printf "cprof "
2945 test "x${GPROF_TRUE}" = "x" && printf "gprof "
2946 test "x${OPTIM_TRUE}" = "x" && printf "optim "
2947 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
2948 echo "
2949 vlc aliases           :${ALIASES}
2950
2951 To build vlc and its plugins, type \`make'.
2952 "
2953