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