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