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