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