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