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