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