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