4f97cf1f245e430054f01b24cda35ed958f01b0d
[vlc.git] / configure.ac.in
1 dnl Autoconf settings for vlc
2
3 AC_INIT(vlc,0.5.3-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.3-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 -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 ?
158     AC_CHECK_LIB( bind, inet_ntoa,
159         [ LDFLAGS_access_mms="${LDFLAGS_access_mms} -lbind"
160           LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind"
161           LDFLAGS_httpd="${LDFLAGS_httpd} -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.10.40)
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 AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
685     [ac_cv_c_unroll_loops],
686     [CFLAGS="${CFLAGS_save} -funroll-loops"
687      AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
688 if test "x${ac_cv_c_unroll_loops}" != "xno"; then
689     CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
690 fi
691
692 dnl Check for -fomit-frame-pointer
693 AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
694     [ac_cv_c_omit_frame_pointer],
695     [CFLAGS="${CFLAGS_save} -fomit-frame-pointer"
696      AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
697 if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
698     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
699     # this plugin does not compile without -fomit-frame-pointer, damn gcc!
700     CFLAGS_i420_yuy2_mmx="${CFLAGS_i420_yuy2_mmx} -fomit-frame-pointer"
701 fi
702
703 dnl Check for -mdynamic-no-pic
704 AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
705     [ac_cv_c_dynamic_no_pic],
706     [CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
707      AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
708 if test "x${ac_cv_c_dynamic_no_pic}" != "xno"; then
709     CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
710     CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
711 fi
712
713 dnl Check for Darwin plugin linking flags
714 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
715     [ac_cv_ld_darwin],
716     [CFLAGS="${CFLAGS_save} -bundle -undefined error -lcc_dynamic"
717      AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
718 if test "x${ac_cv_ld_darwin}" != "xno"; then
719     LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
720 fi
721
722 dnl Check for standard plugin linking flags
723 AC_CACHE_CHECK([if \$CC accepts -shared],
724     [ac_cv_ld_plugins],
725     [CFLAGS="${CFLAGS_save} -shared"
726      AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
727 if test "x${ac_cv_ld_plugins}" != "xno"; then
728     LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
729 fi
730
731 dnl Check for variadic macros
732 AC_CACHE_CHECK([for variadic cpp macros],
733     [ac_cv_cpp_variadic_macros],
734     [CFLAGS="${CFLAGS_save}"
735      AC_TRY_COMPILE(
736          [#include <stdio.h>
737           #define a(b,c...) printf(b,##c)],
738          [a("foo");a("%s","bar");a("%s%s","baz","quux");],
739          ac_cv_cpp_variadic_macros=yes,
740          ac_cv_cpp_variadic_macros=no)])
741 if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
742     AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
743 fi
744
745 dnl Checks for __attribute__(aligned()) directive
746 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
747     [ac_cv_c_attribute_aligned],
748     [ac_cv_c_attribute_aligned=0
749         CFLAGS="${CFLAGS_save} -Werror"
750     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
751         AC_TRY_COMPILE([],
752         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
753         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
754     done
755         CFLAGS="${CFLAGS_save}"])
756 if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
757     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
758         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
759 fi
760
761 dnl Checks for __attribute__(format()) directive
762 AC_CACHE_CHECK([__attribute__ ((format ())) support with function pointers],
763     [ac_cv_c_attribute_format],
764     [ac_cv_c_attribute_format=no
765         CFLAGS="${CFLAGS_save} -Werror"
766         AC_TRY_COMPILE([],
767         [static void (*pf_printf)(const char *, ...) __attribute__ ((format(printf,1,2)));(void)pf_printf;],
768         [ac_cv_c_attribute_format=yes])
769         CFLAGS="${CFLAGS_save}"])
770 if test "x${ac_cv_c_attribute_format}" != "xno"; then
771     AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
772 fi
773
774 dnl
775 dnl  Check the CPU
776 dnl
777 case "x${target_cpu}" in
778   x)
779     ARCH=unknown
780     ;;
781   *)
782     ARCH="${target_cpu}"
783     ;;
784 esac
785
786 case "${ARCH}" in
787   hppa64)
788     CFLAGS_mpeg_video="${CFLAGS_mpeg_video} -ffunction-sections"
789     ;;
790 esac
791
792 dnl
793 dnl  Enable profiling
794 dnl
795 AC_ARG_ENABLE(gprof,
796 [  --enable-gprof          gprof profiling (default disabled)])
797 AC_ARG_ENABLE(cprof,
798 [  --enable-cprof          cprof profiling (default disabled)])
799 AM_CONDITIONAL(GPROF, test "${enable_gprof}" = "yes")
800 AM_CONDITIONAL(CPROF, test "${enable_gprof}" = "yes")
801
802 dnl
803 dnl  default modules
804 dnl
805 BUILTINS="${BUILTINS} mpeg_video idct idctclassic motion"
806 PLUGINS="${PLUGINS} dummy rc logger gestures access_file memcpy"
807 PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts avi asf aac mp4 rawdv"
808 PLUGINS="${PLUGINS} spudec mpeg_audio lpcm a52 dts cinepak"
809 PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
810 PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif fixed32tofloat32 fixed32tos16 s16tofixed32 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
811 PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler bandlimited_resampler"
812 PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
813 PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
814 PLUGINS="${PLUGINS} aout_file"
815 #PLUGINS="${PLUGINS} scope"
816 PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
817 PLUGINS="${PLUGINS} id3 m3u"
818 PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys au"
819 PLUGINS="${PLUGINS} access_udp access_http ipv4 access_mms access_ftp"
820 PLUGINS="${PLUGINS} sap httpd"
821
822 dnl
823 dnl Some plugins aren't useful on some platforms
824 dnl
825 if test "x${SYS}" != "xmingw32"; then
826     PLUGINS="${PLUGINS} screensaver"
827 fi
828
829 dnl
830 dnl  Accelerated modules
831 dnl
832 MMX_MODULES="memcpymmx idctmmx motionmmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
833 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
834 THREEDNOW_MODULES="memcpy3dn"
835 SSE_MODULES=""
836 ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
837
838 if test "${enable_gprof}" != "yes"
839 then
840   MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
841 fi
842
843 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
844     [ac_cv_mmx_inline],
845     [CFLAGS="${CFLAGS_save}"
846      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
847                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
848 if test "x${ac_cv_mmx_inline}" != "xno"; then
849   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
850 fi
851
852 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
853     [ac_cv_mmxext_inline],
854     [CFLAGS="${CFLAGS_save}"
855      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
856                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
857 if test "x${ac_cv_mmxext_inline}" != "xno"; then
858   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
859 fi
860
861 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
862     [ac_cv_3dnow_inline],
863     [CFLAGS="${CFLAGS_save}"
864      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
865                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
866 if test "x${ac_cv_3dnow_inline}" != "xno"; then
867   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
868   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
869 fi
870
871 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
872     [ac_cv_sse_inline],
873     [CFLAGS="${CFLAGS_save}"
874      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
875                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
876 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
877   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
878   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
879 fi
880
881 # don't try to grok AltiVec with native mingw32 it doesn't work right now
882 # we should be able to remove this test with future versions of mingw32
883 if test "x${SYS}" != "xmingw32"; then
884 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
885     [ac_cv_altivec_inline],
886     [CFLAGS="${CFLAGS_save}"
887      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
888          ac_cv_altivec_inline=yes,
889          [CFLAGS="${CFLAGS_save} -Wa,-m7400"
890           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
891             [ac_cv_altivec_inline="-Wa,-m7400"],
892             ac_cv_altivec_inline=no)
893          ])])
894 if test "x${ac_cv_altivec_inline}" != "xno"; then
895   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
896   if test "x${ac_cv_altivec_inline}" != "xyes"; then
897     CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_altivec_inline}"
898     CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_altivec_inline}"
899     CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_altivec_inline}"
900     CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_altivec_inline}"
901   fi
902   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
903 fi
904
905 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
906     [ac_cv_c_altivec],
907     [CFLAGS="${CFLAGS_save} -faltivec"
908      # Darwin test
909      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
910         ac_cv_c_altivec=-faltivec, [
911         # Linux/PPC test
912         CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
913         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
914             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
915         ])
916      CFLAGS="${CFLAGS_save}"])
917 if test "x${ac_cv_c_altivec}" != "xno"; then
918   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
919   CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_c_altivec}"
920   CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_c_altivec}"
921   CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_c_altivec}"
922   CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_c_altivec}"
923   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
924 fi
925
926 AC_CACHE_CHECK([if linker needs -framework vecLib],
927     [ac_cv_ld_altivec],
928     [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
929      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
930      LDFLAGS="${LDFLAGS_save}"
931     ])
932 if test "x${ac_cv_ld_altivec}" != "xno"; then
933   LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
934   LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
935   LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
936   LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
937 fi
938 fi # end if mingw32
939
940 AC_ARG_WITH(,[])
941 AC_ARG_WITH(,[Optimization options:])
942
943 dnl
944 dnl  Special arch tuning
945 dnl
946 AC_ARG_WITH(tuning,
947 [  --with-tuning=ARCH      enable special tuning for an architecture
948                           (default i686 on IA-32 and 750 on PPC)])
949 if test "x${with_tuning}" != "x"; then
950     if test "x${target_cpu}" = "xpowerpc"; then
951         CFLAGS_TUNING="-mtune=${with_tuning}"
952     else
953         CFLAGS_TUNING="-mcpu=${with_tuning}"
954     fi
955 else
956     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"
957     else
958         if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
959     fi
960 fi
961
962 dnl
963 dnl  x86 accelerations
964 dnl
965 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
966 then
967     ARCH="${ARCH} mmx"
968     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"
969 fi
970
971 dnl
972 dnl  Enable/disable optimizations
973 dnl
974 AC_ARG_ENABLE(optimizations,
975 [  --disable-optimizations disable compiler optimizations (default enabled)])
976 AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
977
978 dnl
979 dnl  AltiVec acceleration
980 dnl
981 AC_ARG_ENABLE(altivec,
982 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
983 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
984     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
985 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
986     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
987
988 dnl
989 dnl  Debugging mode
990 dnl
991 AC_ARG_ENABLE(debug,
992 [  --enable-debug          debug mode (default disabled)])
993 AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
994
995 dnl
996 dnl  Enable release-specific flags
997 dnl
998 AC_ARG_ENABLE(release,
999 [  --enable-release        activate extra optimizations (default disabled)])
1000 AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
1001
1002 dnl
1003 dnl Stream output
1004 dnl
1005 AC_ARG_ENABLE(sout,
1006   [  --enable-sout           Stream output modules (default enabled)])
1007 if test "x${enable_sout}" != "xno"
1008 then
1009   PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file access_output_http"
1010   PLUGINS="${PLUGINS} mux_ts mux_ps mux_avi mux_dummy"
1011   PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
1012   PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
1013   PLUGINS="${PLUGINS} packetizer_copy"
1014
1015   PLUGINS="${PLUGINS} vout_encoder"
1016
1017     dnl Ogg/ogm
1018     AC_CHECK_HEADERS(ogg/ogg.h, [
1019       AC_CHECK_LIB( ogg, ogg_stream_packetin, [
1020         PLUGINS="${PLUGINS} mux_ogg"
1021         LDFLAGS_mux_ogg="${LDFLAGS_mux_ogg} -logg" ])
1022     ],[])
1023 fi
1024
1025
1026 dnl
1027 dnl  Input plugins
1028 dnl
1029
1030 AC_ARG_WITH(,[Input plugins:])
1031
1032 dnl
1033 dnl  DVD module: optionally check for installed libdvdcss
1034 dnl
1035 AC_ARG_ENABLE(dvd,
1036 [  --enable-dvd            DVD input module (default enabled)])
1037 if test "x${enable_dvd}" != "xno"
1038 then
1039   AC_ARG_WITH(dvdcss,
1040   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
1041   AC_ARG_WITH(dvdcss-tree,
1042   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
1043   case "x${with_dvdcss}" in
1044   x|xyes)
1045     if test "x${with_dvdcss_tree}" = x
1046     then
1047       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
1048         [ PLUGINS="${PLUGINS} dvd"
1049           LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
1050           LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
1051         [ 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.])
1052           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
1053     else
1054       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
1055       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
1056       if test "x${real_dvdcss_tree}" = "x"
1057       then
1058         dnl  The given directory can't be found
1059         AC_MSG_RESULT(no)
1060         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
1061       fi
1062       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
1063       then
1064         dnl  Use a custom libdvdcss
1065         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
1066         BUILTINS="${BUILTINS} dvd"
1067         LDFLAGS_dvd="${LDFLAGS_dvd} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
1068         LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
1069         CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
1070       else
1071         dnl  The given libdvdcss wasn't built
1072         AC_MSG_RESULT(no)
1073         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
1074       fi
1075     fi
1076   ;;
1077   xno)
1078     dnl  Compile without dvdcss (dlopen version, works only under Linux)
1079     PLUGINS="${PLUGINS} dvd"
1080     CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
1081     LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
1082   ;;
1083   *)
1084     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
1085     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
1086     then
1087       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
1088       AC_MSG_RESULT(yes)
1089       PLUGINS="${PLUGINS} dvd"
1090       LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
1091       LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${with_dvdcss}/lib -ldvdcss"
1092       CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
1093     else
1094       dnl  No libdvdcss could be found, sorry
1095       AC_MSG_RESULT(no)
1096       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
1097     fi
1098   ;;
1099   esac
1100 fi
1101
1102 dnl
1103 dnl dvdread module: check for libdvdread
1104 dnl
1105 AC_ARG_ENABLE(dvdread,
1106 [  --enable-dvdread        dvdread input module (default disabled)])
1107 if test "x${enable_dvdread}" != "xno"
1108 then
1109   AC_ARG_WITH(dvdread,
1110   [    --with-dvdread=PATH    libdvdread headers and libraries])
1111   AC_ARG_WITH(dvdread-tree,
1112   [    --with-dvdread-tree=PATH libdvdread tree for static linking])
1113   if test "x${with_dvdread}" = x
1114   then
1115     if test "x${with_dvdread_tree}" = x
1116     then
1117       AC_CHECK_HEADERS(dvdread/dvd_reader.h,
1118         [ PLUGINS="${PLUGINS} dvdread"
1119           LDFLAGS_dvdread="${LDFLAGS_dvdread} -ldvdread ${LDFLAGS_dvdcss}" ],
1120         [ if test "x${enable_dvdread}" != "x"
1121           then
1122             AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
1123             AC_MSG_ERROR([cannot find libdvdread headers])
1124           fi ])
1125     else
1126       AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
1127       real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
1128       if test "x${real_dvdread_tree}" = "x"
1129       then
1130         dnl  The given directory can't be found
1131         AC_MSG_RESULT(no)
1132         AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
1133       fi
1134       if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
1135       then
1136         dnl  Use a custom libdvdread
1137         AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
1138         BUILTINS="${BUILTINS} dvdread"
1139         LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${real_dvdread_tree}/dvdread/.libs -ldvdread ${LDFLAGS_dvdcss}"
1140         CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${real_dvdread_tree}"
1141       else
1142         dnl  The given libdvdread wasn't built
1143         AC_MSG_RESULT(no)
1144         AC_MSG_ERROR([cannot find ${real_dvdread_tree}/dvdread/.libs/libdvdread.a, make sure you compiled libdvdread in ${with_dvdread_tree}])
1145       fi
1146     fi
1147   else
1148     AC_MSG_CHECKING(for dvdread headers in ${with_dvdread})
1149     if test -f ${with_dvdread}/include/dvdread/dvd_reader.h
1150     then
1151       dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
1152       AC_MSG_RESULT(yes)
1153       PLUGINS="${PLUGINS} dvdread"
1154       LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${with_dvdread}/lib -ldvdread ${LDFLAGS_dvdcss}"
1155       CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${with_dvdread}/include"
1156     else
1157       dnl  No libdvdread could be found, sorry
1158       AC_MSG_RESULT(no)
1159       AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
1160     fi
1161   fi
1162 fi
1163
1164 dnl
1165 dnl dvdplay module: check for libdvdplay
1166 dnl
1167 AC_ARG_ENABLE(dvdplay,
1168 [  --enable-dvdplay        dvdplay input module (default disabled)])
1169 if test "x${enable_dvdplay}" != "xno"
1170 then
1171   AC_ARG_WITH(dvdplay,
1172   [    --with-dvdplay=PATH    libdvdplay headers and libraries])
1173   AC_ARG_WITH(dvdplay-tree,
1174   [    --with-dvdplay-tree=PATH libdvdplay tree for static linking])
1175   if test "x${with_dvdplay}" = x
1176   then
1177     if test "x${with_dvdplay_tree}" = x
1178     then
1179       AC_CHECK_HEADERS(dvdplay/dvdplay.h,
1180         [ PLUGINS="${PLUGINS} dvdplay"
1181           LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1182           CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread}" ],
1183         [ if test "x${enable_dvdplay}" != "x"
1184           then
1185             AC_MSG_WARN([Please get libdvdplay from http://www.videolan.org/.])
1186             AC_MSG_ERROR([cannot find libdvdplay headers])
1187           fi ])
1188     else
1189       AC_MSG_CHECKING(for libdvdplay.a in ${with_dvdplay_tree})
1190       real_dvdplay_tree="`cd ${with_dvdplay_tree} 2>/dev/null && pwd`"
1191       if test "x${real_dvdplay_tree}" = "x"
1192       then
1193         dnl  The given directory can't be found
1194         AC_MSG_RESULT(no)
1195         AC_MSG_ERROR([cannot cd to ${with_dvdplay_tree}])
1196       fi
1197       if test -f "${real_dvdplay_tree}/src/.libs/libdvdplay.a"
1198       then
1199         dnl  Use a custom libdvdplay
1200         AC_MSG_RESULT(${real_dvdplay_tree}/src/.libs/libdvdplay.a)
1201         BUILTINS="${BUILTINS} dvdplay"
1202         LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${real_dvdplay_tree}/src/.libs -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1203         CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${real_dvdplay_tree}/src"
1204       else
1205         dnl  The given libdvdplay wasn't built
1206         AC_MSG_RESULT(no)
1207         AC_MSG_ERROR([cannot find ${real_dvdplay_tree}/src/.libs/libdvdplay.a, make sure you compiled libdvdplay in ${with_dvdplay_tree}])
1208       fi
1209     fi
1210   else
1211     AC_MSG_CHECKING(for dvdplay headers in ${with_dvdplay})
1212     if test -f ${with_dvdplay}/include/dvdplay/dvdplay.h
1213     then
1214       dnl  Use ${with_dvdplay}/include/dvdplay/dvdplay.h
1215       AC_MSG_RESULT(yes)
1216       PLUGINS="${PLUGINS} dvdplay"
1217       LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${with_dvdplay}/lib -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1218       CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${with_dvdplay}/include"
1219     else
1220       dnl  No libdvdplay could be found, sorry
1221       AC_MSG_RESULT(no)
1222       AC_MSG_ERROR([cannot find ${with_dvdplay}/include/dvdplay/dvdplay.h])
1223     fi
1224   fi
1225 fi
1226
1227 dnl
1228 dnl  libdvbpsi ts demux/mux
1229 dnl
1230 AC_ARG_ENABLE(dvbpsi,
1231 [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
1232 if test "x${enable_dvbpsi}" != "xno"
1233 then
1234   AC_ARG_WITH(dvbpsi,
1235   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
1236   AC_ARG_WITH(dvbpsi,
1237   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
1238   case "x${with_dvbpsi}" in
1239   x|xyes)
1240     if test "x${with_dvbpsi_tree}" = "x"
1241     then
1242       AC_CHECK_HEADERS(dvbpsi/dr.h,
1243         [ PLUGINS="${PLUGINS} ts_dvbpsi"
1244           LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -ldvbpsi" 
1245           PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1246           LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -ldvbpsi" ],
1247         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
1248         [#include <stdint.h>
1249 #include <dvbpsi/dvbpsi.h>
1250 #include <dvbpsi/descriptor.h>
1251 #include <dvbpsi/pat.h>
1252 #include <dvbpsi/pmt.h>])
1253     else
1254       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
1255       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
1256       if test "x${real_dvbpsi_tree}" = "x"
1257       then
1258         dnl  The given directory can't be found
1259         AC_MSG_RESULT(no)
1260         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
1261       fi
1262       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
1263       then
1264         dnl  Use a custom libdvbpsi
1265         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
1266         BUILTINS="${BUILTINS} ts_dvbpsi"
1267         LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1268         CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1269
1270         BUILTINS="${BUILTINS} mux_ts_dvbpsi"
1271         LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1272         CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1273
1274       else
1275         dnl  The given libdvbpsi wasn't built
1276         AC_MSG_RESULT(no)
1277         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
1278       fi
1279     fi
1280   ;;
1281   xno)
1282     dnl  Compile without dvbpsi
1283   ;;
1284   *)
1285     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
1286     if test "x${with_dvbpsi}" = "x"
1287     then
1288       LDFLAGS_test=""
1289       CPPFLAGS_test=""
1290     else
1291       LDFLAGS_test="-L${with_dvbpsi}/lib"
1292       CPPFLAGS_test="-I${with_dvbpsi}/include"
1293     fi
1294     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1295     AC_CHECK_HEADER([dvbpsi/dr.h],[
1296       PLUGINS="${PLUGINS} ts_dvbpsi"
1297       LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1298       CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} ${CPPFLAGS_test}"
1299       PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1300       LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1301       CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} ${CPPFLAGS_test}"
1302
1303       ],[
1304       if test "x${enable_dvbpsi}" != "x"
1305       then
1306         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])
1307       fi
1308     ])
1309     CPPFLAGS="${CPPFLAGS_save}"
1310   ;;
1311   esac
1312 fi
1313
1314 dnl
1315 dnl  Video4Linux plugin
1316 dnl
1317 AC_ARG_ENABLE(v4l,
1318   [  --enable-v4l            Video4Linux input support (default disabled)])
1319 if test "x${enable_v4l}" = "xyes"
1320 then
1321   AC_CHECK_HEADERS(libv4l/v4l.h, [
1322     PLUGINS="${PLUGINS} v4l"
1323    ],[])
1324 fi
1325
1326 dnl
1327 dnl  VCD module
1328 dnl
1329 AC_ARG_ENABLE(vcd,
1330   [  --enable-vcd            VCD support for Linux, FreeBSD, MacOS X and Win32 (default enabled)])
1331
1332 if test "x${enable_vcd}" != "xno"
1333 then
1334   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1335   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1336     AC_MSG_RESULT(yes)
1337     PLUGINS="${PLUGINS} vcd"
1338   ],[
1339     AC_MSG_RESULT(no)
1340   ])
1341
1342   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1343   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1344     AC_MSG_RESULT(yes)
1345     PLUGINS="${PLUGINS} vcd"
1346     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1347   ],[
1348     AC_MSG_RESULT(no)
1349   ])
1350
1351   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1352   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1353     AC_MSG_RESULT(yes)
1354     PLUGINS="${PLUGINS} vcd"
1355     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1356   ],[
1357     AC_MSG_RESULT(no)
1358   ])
1359
1360   if test "x${SYS}" = "xbsdi" -o "x${SYS}" = "xmingw32"
1361   then
1362     PLUGINS="${PLUGINS} vcd"
1363   fi
1364
1365   if test "x${SYS}" = "xdarwin"
1366   then
1367     PLUGINS="${PLUGINS} vcd"
1368     LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation"
1369   fi
1370 fi
1371
1372 dnl
1373 dnl  Satellite input module
1374 dnl
1375 AC_ARG_ENABLE(satellite,
1376   [  --enable-satellite      satellite card support (default disabled)],
1377   [ if test "x${enable_satellite}" = "xyes"
1378     then
1379       PLUGINS="${PLUGINS} satellite"
1380     fi])
1381
1382 dnl
1383 dnl  ipv6 plugin - not for QNX yet
1384 dnl
1385 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
1386 then
1387   have_ipv6=false
1388   AC_CHECK_FUNCS(inet_pton,[have_ipv6=:],[
1389     AC_CHECK_LIB(resolv,inet_pton,
1390       [have_ipv6=:
1391        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lresolv"])
1392   ])
1393   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
1394   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
1395     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=false])
1396   if ${have_ipv6}; then
1397     PLUGINS="${PLUGINS} ipv6"
1398   fi
1399 fi
1400 if test "x${SYS}" = "xmingw32"
1401 then
1402   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
1403   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
1404     PLUGINS="${PLUGINS} ipv6"],[AC_MSG_RESULT(no)])
1405 fi
1406
1407 dnl
1408 dnl  ogg plugin
1409 dnl
1410 AC_ARG_ENABLE(ogg,
1411   [  --enable-ogg            Ogg demux support (default enabled)])
1412 if test "x${enable_ogg}" != "xno"
1413 then
1414   AC_CHECK_HEADERS(ogg/ogg.h, [
1415     AC_CHECK_LIB( ogg, oggpack_read, [
1416       PLUGINS="${PLUGINS} ogg"
1417       LDFLAGS_ogg="${LDFLAGS_ogg} -logg"
1418       AC_CHECK_LIB( ogg, oggpackB_read, [
1419         CPPFLAGS_ogg="${CPPFLAGS_ogg} -DHAVE_OGGPACKB"])])
1420    ],[])
1421 fi
1422
1423 dnl
1424 dnl  Codec plugins
1425 dnl
1426
1427 AC_ARG_WITH(,[Codec plugins:])
1428
1429 dnl
1430 dnl  mad plugin
1431 dnl
1432 AC_ARG_ENABLE(mad,
1433   [  --enable-mad            libmad module (default disabled)])
1434 if test "x${enable_mad}" != "xno"
1435 then
1436   AC_ARG_WITH(mad,
1437     [    --with-mad=PATH       path to libmad],[],[])
1438   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
1439   then
1440     CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${with_mad}/include"
1441     LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${with_mad}/lib"
1442   fi
1443
1444   AC_ARG_WITH(mad-tree,
1445     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
1446   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
1447   then
1448     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
1449     if test "x${real_mad_tree}" = "x"
1450     then
1451       dnl  The given directory can't be found
1452       AC_MSG_RESULT(no)
1453       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
1454     fi
1455     dnl  Use a custom libmad
1456     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
1457     if test -f ${real_mad_tree}/libmad/mad.h
1458     then
1459       AC_MSG_RESULT(yes)
1460       CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${real_mad_tree}/libmad"
1461       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${real_mad_tree}/libmad/.libs"
1462       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1463       AC_CHECK_LIB(mad, mad_bit_init, [
1464         BUILTINS="${BUILTINS} mpgatofixed32"
1465         LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad"
1466         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1467       ],[])
1468       LDFLAGS="${LDFLAGS_save}"
1469     else
1470       AC_MSG_RESULT(no)
1471       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1472     fi
1473   else
1474     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mpgatofixed32}"
1475     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1476     AC_CHECK_HEADERS(mad.h, ,
1477       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1478     AC_CHECK_LIB(mad, mad_bit_init, [
1479       PLUGINS="${PLUGINS} mpgatofixed32"
1480       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad" ],
1481       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1482     CPPFLAGS="${CPPFLAGS_save}"
1483     LDFLAGS="${LDFLAGS_save}"
1484   fi
1485 fi
1486
1487 dnl
1488 dnl   libid3tag support
1489 dnl
1490 AC_CHECK_HEADERS(id3tag.h, [
1491   AC_CHECK_HEADERS(zlib.h, [
1492     LDFLAGS_id3tag="${LDFLAGS_id3tag} -lid3tag -lz"
1493     PLUGINS="${PLUGINS} id3tag"]) ])
1494
1495 dnl
1496 dnl  ffmpeg decoder plugin
1497 dnl
1498 AC_ARG_ENABLE(ffmpeg,
1499 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1500 if test "x${enable_ffmpeg}" = "xyes"
1501 then
1502   AC_ARG_WITH(ffmpeg,
1503     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1504   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1505   then
1506     CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/ffmpeg"
1507     LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib"
1508   fi
1509
1510   dnl Add postprocessing modules
1511   PLUGINS="${PLUGINS} postprocessing_c"
1512   if test "x${ac_cv_mmx_inline}" != "xno"; then
1513     PLUGINS="${PLUGINS} postprocessing_mmx"
1514   fi
1515
1516   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1517     PLUGINS="${PLUGINS} postprocessing_mmxext"
1518   fi
1519
1520   AC_ARG_WITH(ffmpeg-tree,
1521   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1522   if test "x${with_ffmpeg_tree}" != "x"
1523   then
1524     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1525     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1526     if test "x${real_ffmpeg_tree}" = x
1527     then
1528       dnl  The given directory can't be found
1529       AC_MSG_RESULT(no)
1530       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1531     fi
1532     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1533     then
1534       dnl  Use a custom libffmpeg
1535       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1536       BUILTINS="${BUILTINS} ffmpeg"
1537       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
1538       CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
1539     else
1540       dnl  The given libavcodec wasn't built
1541       AC_MSG_RESULT(no)
1542       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1543     fi
1544   else
1545     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
1546     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
1547     AC_CHECK_LIB(avcodec, avcodec_init, [
1548       BUILTINS="${BUILTINS} ffmpeg"
1549       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" ],
1550       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1551     LDFLAGS="${LDFLAGS_save}"
1552     CPPFLAGS="${CPPFLAGS_save}"
1553   fi
1554 fi
1555
1556 dnl
1557 dnl  faad decoder plugin
1558 dnl
1559 AC_ARG_ENABLE(faad,
1560 [  --enable-faad           faad codec (default disabled)])
1561 if test "x${enable_faad}" = "xyes"
1562 then
1563   AC_ARG_WITH(faad,
1564     [    --with-faad=PATH      path to faad installation],[],[])
1565   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1566   then
1567     CPPFLAGS_faad="${CPPFLAGS_faad} -I${with_faad}/include"
1568     LDFLAGS_faad="${LDFLAGS_faad} -L${with_faad}/lib"
1569   fi
1570   LDFLAGS_faad="${LDFLAGS_faad}"
1571
1572   AC_ARG_WITH(faad-tree,
1573   [    --with-faad-tree=PATH faad tree for static linking])
1574   if test "x${with_faad_tree}" != "x"
1575   then
1576     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1577     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1578     if test "x${real_faad_tree}" = x
1579     then
1580       dnl  The given directory can't be found
1581       AC_MSG_RESULT(no)
1582       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1583     fi
1584     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1585     then
1586       dnl  Use a custom faad
1587       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1588       BUILTINS="${BUILTINS} faad"
1589       LDFLAGS_faad="${LDFLAGS_faad} -L${real_faad_tree}/libfaad/.libs -lfaad"
1590       CPPFLAGS_faad="${CPPFLAGS_faad} -I${real_faad_tree}/include"
1591     else
1592       dnl  The given libfaad wasn't built
1593       AC_MSG_RESULT(no)
1594       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1595     fi
1596   else
1597     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
1598     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_faad}"
1599     AC_CHECK_HEADERS(faad.h, ,
1600       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1601     AC_CHECK_LIB(faad, faacDecOpen, [
1602       PLUGINS="${PLUGINS} faad"
1603       LDFLAGS_faad="${LDFLAGS_faad} -lfaad" ],
1604       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1605     LDFLAGS="${LDFLAGS_save}"
1606     CPPFLAGS="${CPPFLAGS_save}"
1607   fi
1608 fi
1609
1610
1611 dnl
1612 dnl  xvid decoder plugin
1613 dnl
1614 AC_ARG_ENABLE(xvid,
1615 [  --enable-xvid           xvid codec (default disabled)])
1616 if test "x${enable_xvid}" = "xyes"
1617 then
1618   AC_ARG_WITH(xvid,
1619     [    --with-xvid=PATH      path to xvid installation],[],[])
1620   if test "x${with_xvid}" != "xno" -a "x${with_xvid}" != "x"
1621   then
1622     CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${with_xvid}/include"
1623     LDFLAGS_xvid="${LDFLAGS_xvid} -L${with_xvid}/lib"
1624   fi
1625   LDFLAGS_xvid="${LDFLAGS_xvid}"
1626
1627   AC_ARG_WITH(xvid-tree,
1628   [    --with-xvid-tree=PATH xvid tree for static linking])
1629   if test "x${with_xvid_tree}" != "x"
1630   then
1631     AC_MSG_CHECKING(for libxvidcore.a in ${with_xvid_tree})
1632     real_xvid_tree="`cd ${with_xvid_tree} 2>/dev/null && pwd`"
1633     if test "x${real_xvid_tree}" = x
1634     then
1635       dnl  The given directory can't be found
1636       AC_MSG_RESULT(no)
1637       AC_MSG_ERROR([cannot cd to ${with_xvid_tree}])
1638     fi
1639     if test -f "${real_xvid_tree}/build/generic/libxvidcore.a"
1640     then
1641       dnl  Use a custom xvid
1642       AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a)
1643       BUILTINS="${BUILTINS} xvid"
1644       LDFLAGS_xvid="${LDFLAGS_xvid} -L${real_xvid_tree}/build/generic -lxvidcore"
1645       CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src"
1646     else
1647       dnl  The given libxvidcore wasn't built
1648       AC_MSG_RESULT(no)
1649       AC_MSG_ERROR([cannot find ${real_xvid_tree}/build/generic/libxvidcore.a, make sure you compiled libxvidcore in ${with_xvid_tree}])
1650     fi
1651   else
1652     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_xvid}"
1653     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_xvid}"
1654     AC_CHECK_HEADERS(xvid.h, ,
1655       [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
1656     AC_CHECK_LIB(xvidcore, xvid_init, [
1657       PLUGINS="${PLUGINS} xvid"
1658       LDFLAGS_xvid="${LDFLAGS_xvid} -lxvidcore" ],
1659       [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
1660     LDFLAGS="${LDFLAGS_save}"
1661     CPPFLAGS="${CPPFLAGS_save}"
1662   fi
1663 fi
1664
1665
1666
1667 dnl
1668 dnl MP4 module
1669 dnl
1670 AC_CHECK_HEADERS(zlib.h, [
1671   LDFLAGS_mp4="${LDFLAGS_mp4} -lz"
1672 ] )
1673
1674 dnl
1675 dnl  a52 AC3 decoder plugin
1676 dnl
1677 AC_ARG_ENABLE(a52,
1678   [  --enable-a52            A/52 support with liba52 (default enabled)])
1679 if test "x${enable_a52}" != "xno"
1680 then
1681   AC_ARG_WITH(a52,
1682     [    --with-a52=PATH       a52 headers and libraries])
1683   AC_ARG_WITH(a52-tree,
1684     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1685   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1686   then
1687     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1688     if test "x${real_a52_tree}" = "x"
1689     then
1690       dnl  The given directory can't be found
1691       AC_MSG_RESULT(no)
1692       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1693     fi
1694     dnl  Use a custom a52dec
1695     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1696     if test -f ${real_a52_tree}/include/a52.h
1697     then
1698       AC_MSG_RESULT(yes)
1699       CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -I${real_a52_tree}"
1700       LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -L${real_a52_tree}/liba52/.libs"
1701       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
1702       AC_CHECK_LIB(a52, a52_free, [
1703         BUILTINS="${BUILTINS} a52tofloat32"
1704         LDFLAGS_a52tofloat32="-la52 ${LDFLAGS_a52tofloat32}"
1705         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -DUSE_A52DEC_TREE"
1706         ],[
1707         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1708         then
1709           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1710         else
1711           AC_MSG_ERROR([the specified tree hasn't been compiled])
1712         fi
1713       ])
1714       LDFLAGS="${LDFLAGS_save}"
1715     else
1716       AC_MSG_RESULT(no)
1717       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1718     fi
1719   else
1720     if test "x${with_a52}" = "x"
1721     then
1722       LDFLAGS_test=""
1723       CPPFLAGS_test=""
1724     else
1725       LDFLAGS_test="-L${with_a52}/lib"
1726       CPPFLAGS_test="-I${with_a52}/include"
1727     fi
1728     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
1729     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LDFLAGS_a52tofloat32}"
1730     AC_CHECK_HEADERS(a52dec/a52.h, [
1731       AC_CHECK_LIB(a52, a52_free, [
1732         PLUGINS="${PLUGINS} a52tofloat32"
1733         LDFLAGS_a52tofloat32="${LDFLAGS_test} -la52 ${LDFLAGS_a52tofloat32}"
1734         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} ${CPPFLAGS_test}"
1735       ],[
1736         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.])
1737       ])
1738     ])
1739     CPPFLAGS="${CPPFLAGS_save}"
1740     LDFLAGS="${LDFLAGS_save}"
1741   fi
1742 fi
1743
1744 dnl
1745 dnl  DV plugin
1746 dnl
1747 AC_ARG_ENABLE(dv,
1748   [  --enable-dv             DV decoder support (default disabled)])
1749 if test "x${enable_dv}" = "xyes"
1750 then
1751   AC_CHECK_HEADERS(libdv/dv.h, [
1752     PLUGINS="${PLUGINS} dv"
1753     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1754    ],[])
1755 fi
1756
1757 dnl
1758 dnl  Flac plugin
1759 dnl
1760 AC_ARG_ENABLE(flac,
1761   [  --enable-flac           flac decoder support (default disabled)])
1762 if test "x${enable_flac}" = "xyes"
1763 then
1764   AC_CHECK_HEADERS(FLAC/stream_decoder.h, [
1765     PLUGINS="${PLUGINS} flac flacdec"
1766     LDFLAGS_flacdec="${LDFLAGS_flacdec} -lFLAC"
1767    ],[])
1768 fi
1769
1770 dnl
1771 dnl  Libmpeg2 plugin
1772 dnl
1773 AC_ARG_ENABLE(libmpeg2,
1774   [  --enable-libmpeg2       libmpeg2 decoder support (default disabled)])
1775 if test "x${enable_libmpeg2}" = "xyes"
1776 then
1777   AC_CHECK_HEADERS(mpeg2dec/mpeg2.h, [
1778     PLUGINS="${PLUGINS} libmpeg2"
1779     LDFLAGS_libmpeg2="${LDFLAGS_libmpeg2} -lmpeg2"
1780    ],[])
1781 fi
1782
1783 dnl
1784 dnl  Vorbis plugin
1785 dnl
1786 AC_ARG_ENABLE(vorbis,
1787   [  --enable-vorbis         Vorbis decoder support (default enabled)])
1788 if test "x${enable_vorbis}" != "xno"
1789 then
1790   AC_CHECK_HEADERS(vorbis/codec.h, [
1791     PLUGINS="${PLUGINS} vorbis"
1792     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis -logg"
1793    ],[])
1794 fi
1795          
1796 dnl
1797 dnl  Tremor plugin
1798 dnl
1799 AC_ARG_ENABLE(tremor,
1800   [  --enable-tremor         Tremor decoder support (default disabled)])
1801 if test "x${enable_tremor}" = "xyes"
1802 then
1803   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
1804     PLUGINS="${PLUGINS} tremor"
1805     LDFLAGS_tremor="${LDFLAGS_tremor} -lvorbisidec -logg"
1806    ],[])
1807 fi
1808
1809 dnl
1810 dnl  tarkin decoder plugin
1811 dnl
1812 AC_ARG_ENABLE(tarkin,
1813 [  --enable-tarkin         experimental tarkin codec (default disabled)])
1814 if test "x${enable_tarkin}" = "xyes"
1815 then
1816   AC_ARG_WITH(tarkin-tree,
1817   [    --with-tarkin-tree=PATH tarkin tree for static linking])
1818   if test "x${with_tarkin_tree}" != "x"
1819   then
1820     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
1821     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
1822     if test -f "${real_tarkin_tree}/tarkin.o"
1823     then
1824       BUILTINS="${BUILTINS} tarkin"
1825       CPPFLAGS_tarkin="${CPPFLAGS_tarkin} -I${real_tarkin_tree}"
1826       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"
1827       AC_MSG_RESULT(yes)
1828     else
1829       dnl  The given tarkin tree wasn't built
1830       AC_MSG_RESULT(no)
1831       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
1832                     make sure you compiled tarkin in ${with_tarkin_tree}])
1833     fi
1834   fi
1835 fi
1836
1837 dnl
1838 dnl  theora decoder plugin
1839 dnl
1840 AC_ARG_ENABLE(theora,
1841 [  --enable-theora         experimental theora codec (default disabled)])
1842 if test "x${enable_theora}" = "xyes"
1843 then
1844   AC_CHECK_HEADERS(theora/theora.h, [
1845     AC_CHECK_LIB(theora, theora_granule_time, [
1846       BUILTINS="${BUILTINS} theora"
1847       LDFLAGS_theora="${LDFLAGS_theora} -ltheora -logg" ],[
1848       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
1849 You also need to check that you have a libogg posterior to the 1.0 release.])],
1850       [-logg])
1851   ])
1852 fi
1853
1854 dnl
1855 dnl  Video plugins
1856 dnl
1857
1858 AC_ARG_WITH(,[Video plugins:])
1859
1860 dnl
1861 dnl  X11 module
1862 dnl  (enabled by default except on win32)
1863 dnl
1864 AC_ARG_ENABLE(x11,
1865   [  --enable-x11            X11 support (default enabled)])
1866 if test "x${enable_x11}" != "xno" &&
1867   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1868   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1869   AC_CHECK_HEADERS(X11/Xlib.h, [
1870     PLUGINS="${PLUGINS} x11"
1871     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
1872     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
1873   ])
1874   CPPFLAGS="${CPPFLAGS_save}"
1875 fi
1876
1877 dnl
1878 dnl  XVideo module
1879 dnl  (enabled by default except on win32)
1880 dnl
1881 AC_ARG_ENABLE(xvideo,
1882   [  --enable-xvideo         XVideo support (default enabled)])
1883 if test "x${enable_xvideo}" != "xno" &&
1884   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1885   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1886   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1887     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
1888     AC_CHECK_LIB(Xv_pic,XvPutImage,
1889       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1890       PLUGINS="${PLUGINS} xvideo"
1891       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
1892       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1893       AC_CHECK_LIB(Xv,XvPutImage,
1894         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1895         PLUGINS="${PLUGINS} xvideo"
1896         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
1897         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1898         # Otherwise... well, do nothing.
1899         :
1900       )
1901     )
1902     CFLAGS="${CFLAGS_save}"
1903   ]
1904   CPPFLAGS="${CPPFLAGS_save}")
1905 fi
1906
1907 dnl
1908 dnl  SDL module
1909 dnl
1910 AC_ARG_ENABLE(sdl,
1911   [  --enable-sdl            SDL support (default enabled)])
1912 if test "x${enable_sdl}" != "xno"
1913 then
1914   SDL_PATH="${PATH}"
1915   AC_ARG_WITH(sdl-config-path,
1916     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1917     [ if test "x${with_sdl_config_path}" != "xno"
1918       then
1919         SDL_PATH="${with_sdl_config_path}:${PATH}"
1920       fi ])
1921   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1922   SDL_CONFIG="${SDL12_CONFIG}"
1923   SDL_HEADER="SDL12/SDL.h"
1924   if test "x${SDL_CONFIG}" = "xno"
1925   then
1926     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1927     SDL_CONFIG=${SDL11_CONFIG}
1928     SDL_HEADER="SDL11/SDL.h"
1929   fi
1930   if test "x${SDL_CONFIG}" = "xno"
1931   then
1932     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1933     SDL_HEADER="SDL/SDL.h"
1934   fi
1935   # check for cross-compiling
1936   SDL_PREFIX=
1937   AC_ARG_WITH(sdl-prefix,
1938     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
1939                                e.g use as:
1940                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
1941   if test "x${with_sdl_prefix}" != "xno" -a "x${with_sdl_prefix}" != "x"
1942   then
1943     SDL_PREFIX="--prefix=${with_sdl_prefix}"
1944   fi
1945   if test "x${SDL_CONFIG}" != "xno"
1946   then
1947     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
1948     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1949     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1950     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1951     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1952     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
1953     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1954       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1955       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
1956           As a last resort we also test for SDL.h presence),
1957       [ AC_MSG_ERROR([The development package for SDL is not installed.
1958 Please install it and try again. Alternatively you can also configure with
1959 --disable-sdl.])
1960       ])])
1961     CPPFLAGS="${CPPFLAGS_save}"
1962     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1963     then
1964       AC_MSG_ERROR([The development package for SDL is not installed.
1965 Please install it and try again. Alternatively you can also configure with
1966 --disable-sdl.])
1967     fi
1968   elif test "x${enable_sdl}" =  "xyes"
1969   then
1970     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1971 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1972     ])
1973   fi
1974 fi
1975
1976 dnl
1977 dnl  Qt Embedded module
1978 dnl  (disabled by default)
1979 dnl
1980 AC_ARG_ENABLE(qte,
1981   [  --enable-qte            QT Embedded support (default disabled)])
1982 if test "x${enable_qte}" = "xyes"
1983 then
1984   AC_ARG_WITH(qte,
1985   [    --with-qte=PATH       Qt Embedded headers and libraries])
1986   if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
1987   then
1988     LDFLAGS_qte="${LDFLAGS_qte} -L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1989     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"
1990   else
1991     LDFLAGS_qte="${LDFLAGS_qte} -L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
1992     CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1993   fi
1994   PLUGINS="${PLUGINS} qte"
1995   NEED_QTE_MAIN=yes
1996   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
1997   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
1998     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
1999   ] )
2000   CPPFLAGS="${CPPFLAGS_save}"
2001 fi
2002
2003 dnl
2004 dnl  Windows DirectX module
2005 dnl
2006 AC_ARG_ENABLE(directx,
2007   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
2008 if test "x${enable_directx}" != "xno"
2009 then
2010   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
2011   then
2012     AC_ARG_WITH(directx,
2013     [    --with-directx=PATH   Win32 DirectX headers])
2014     if test "x${with_directx}" = "x"
2015     then
2016       AC_CHECK_HEADERS(ddraw.h,
2017       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
2018         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
2019     else
2020       AC_MSG_CHECKING(for directX headers in ${with_directx})
2021       if test -f ${with_directx}/ddraw.h
2022       then
2023         PLUGINS="${PLUGINS} vout_directx aout_directx"
2024         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
2025         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
2026         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
2027         AC_MSG_RESULT(yes)
2028       else
2029         AC_MSG_RESULT(no)
2030         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
2031       fi
2032     fi
2033   fi
2034 fi
2035
2036 dnl
2037 dnl  Linux framebuffer module
2038 dnl
2039 AC_ARG_ENABLE(fb,
2040   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
2041     if test "x${enable_fb}" != "xno"
2042     then
2043       AC_CHECK_HEADERS(linux/fb.h, [
2044         PLUGINS="${PLUGINS} fb"
2045       ])
2046     fi
2047
2048 dnl
2049 dnl  Linux MGA module
2050 dnl
2051 AC_ARG_ENABLE(mga,
2052   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2053   [ if test "x${enable_mga}" = "xyes"
2054     then
2055       PLUGINS="${PLUGINS} mga xmga"
2056     fi ])
2057
2058 dnl
2059 dnl  SVGAlib module
2060 dnl
2061 AC_ARG_ENABLE(svgalib,
2062   [  --enable-svgalib        SVGAlib support (default disabled)])
2063 if test "x${enable_svgalib}" = "xyes"
2064 then
2065   PLUGINS="${PLUGINS} svgalib"
2066   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
2067 fi
2068
2069 dnl
2070 dnl  GGI module
2071 dnl
2072 AC_ARG_ENABLE(ggi,
2073   [  --enable-ggi            GGI support (default disabled)])
2074 if test "x${enable_ggi}" = "xyes"
2075 then
2076   PLUGINS="${PLUGINS} ggi"
2077   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
2078   AC_ARG_WITH(ggi,
2079     [    --with-ggi=PATH       path to libggi],
2080     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
2081       then
2082         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
2083         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
2084       fi ])
2085 fi
2086
2087 dnl
2088 dnl  Glide module
2089 dnl
2090 AC_ARG_ENABLE(glide,
2091   [  --enable-glide          Glide (3dfx) support (default disabled)])
2092 if test "x${enable_glide}" = "xyes"
2093 then
2094   PLUGINS="${PLUGINS} glide"
2095   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
2096   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
2097   AC_ARG_WITH(glide,
2098     [    --with-glide=PATH     path to libglide],
2099     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
2100       then
2101         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
2102         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
2103       fi ])
2104 fi
2105
2106 dnl
2107 dnl  AA plugin
2108 dnl
2109 AC_ARG_ENABLE(aa,
2110   [  --enable-aa             aalib output (default disabled)])
2111 if test "x${enable_aa}" = "xyes"
2112 then
2113   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2114   if test "x${have_aa}" = "xtrue"
2115   then
2116     PLUGINS="${PLUGINS} aa"
2117     LDFLAGS_aa="${LDFLAGS_aa} -laa"
2118   fi
2119 fi
2120
2121 dnl
2122 dnl  win32 GDI plugin
2123 dnl
2124 AC_ARG_ENABLE(wingdi,
2125   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2126 if test "x${enable_wingdi}" != "xno"; then
2127   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2128     PLUGINS="${PLUGINS} wingdi"
2129     LDFLAGS_wingdi="${LDFLAGS_wingdi} -lgdi32"
2130   fi
2131 fi
2132
2133 dnl
2134 dnl  Audio plugins
2135 dnl
2136
2137 AC_ARG_WITH(,[Audio plugins:])
2138
2139 dnl
2140 dnl  OSS /dev/dsp module (enabled by default except on win32)
2141 dnl
2142 AC_ARG_ENABLE(oss,
2143   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2144
2145 if test "x${enable_oss}" != "xno" &&
2146   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
2147 then
2148   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2149     PLUGINS="${PLUGINS} oss"
2150     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
2151   ])
2152 fi
2153
2154 dnl
2155 dnl  Esound module
2156 dnl
2157 AC_ARG_ENABLE(esd,
2158   [  --enable-esd            Esound library support (default disabled)],
2159   [if test "x${enable_esd}" = "xyes"
2160    then
2161      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2162      if test "x${ESD_CONFIG}" != "xno"
2163      then
2164        PLUGINS="${PLUGINS} esd"
2165        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
2166        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
2167      fi
2168    fi])
2169
2170 dnl
2171 dnl  aRts module
2172 dnl
2173 AC_ARG_ENABLE(arts,
2174   [  --enable-arts           aRts sound server (default disabled)],
2175   [if test "x${enable_arts}" = "xyes"
2176    then
2177      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2178      if test "x${ARTS_CONFIG}" != "xno"
2179      then
2180        PLUGINS="${PLUGINS} arts"
2181        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
2182        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
2183      fi
2184    fi])
2185
2186 dnl
2187 dnl  ALSA module
2188 dnl
2189 AC_ARG_ENABLE(alsa,
2190   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2191   [if test "x${enable_alsa}" = "xyes"
2192    then
2193      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2194      if test "x${have_alsa}" = "xtrue"
2195      then
2196        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2197                        #define ALSA_PCM_NEW_SW_PARAMS_API
2198                        #include <alsa/asoundlib.h>],
2199           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2200            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2201        PLUGINS="${PLUGINS} alsa"
2202        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
2203      else
2204        AC_MSG_ERROR([Could not find ALSA development headers])
2205      fi
2206    fi])
2207
2208 dnl
2209 dnl  win32 waveOut plugin
2210 dnl
2211 AC_ARG_ENABLE(waveout,
2212   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2213 if test "x${enable_waveout}" != "xno"; then
2214   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2215     PLUGINS="${PLUGINS} waveout"
2216     LDFLAGS_waveout="-lwinmm"
2217   fi
2218 fi
2219
2220 dnl
2221 dnl  Interface plugins
2222 dnl
2223
2224 AC_ARG_WITH(,[Interface plugins:])
2225
2226 dnl special case for BeOS
2227 if test "x${SYS}" = "xbeos"
2228 then
2229     PLUGINS="${PLUGINS} beos"
2230 fi
2231
2232 dnl
2233 dnl  Gtk+ module
2234 dnl
2235 AC_ARG_ENABLE(gtk,
2236   [  --enable-gtk            Gtk+ support (default enabled)])
2237 if test "x${enable_gtk}" != "xno"
2238 then
2239   GTK_PATH="${PATH}"
2240   AC_ARG_WITH(gtk-config-path,
2241     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2242     [ if test "x${with_gtk_config_path}" != "xno"
2243       then
2244         GTK_PATH="${with_gtk_config_path}:${PATH}"
2245       fi ])
2246   # look for gtk-config
2247   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2248   GTK_CONFIG=${GTK12_CONFIG}
2249   if test "x${GTK_CONFIG}" = "xno"
2250   then
2251     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2252   fi
2253   if test "x${GTK_CONFIG}" != "xno"
2254   then
2255     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2256     then
2257       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.])
2258     fi
2259     if test "x${SYS}" != "xmingw32"; then
2260       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
2261       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
2262     else
2263       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
2264       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
2265     fi
2266     # now look for the gtk.h header
2267     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
2268     ac_cv_gtk_headers=yes
2269     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2270       ac_cv_gtk_headers=no
2271       echo "Cannot find gtk development headers."
2272     ])
2273     if test "x${ac_cv_gtk_headers}" = "xyes"
2274     then
2275       PLUGINS="${PLUGINS} gtk"
2276       if test "x${SYS}" != "xmingw32"; then
2277         NEED_GTK_MAIN=yes
2278       fi
2279       ALIASES="${ALIASES} gvlc"
2280     fi
2281     CPPFLAGS="${CPPFLAGS_save}"
2282   fi
2283 fi
2284
2285 dnl
2286 dnl  Gtk+2 module
2287 dnl
2288 AC_ARG_ENABLE(gtk2,
2289   [  --enable-gtk2           Gtk2 support (default disabled)])
2290 if test "x${enable_gtk2}" = "xyes"
2291 then
2292   PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
2293   CFLAGS_gtk2="${CFLAGS_gtk2} ${GTK2_CFLAGS}"
2294   LDFLAGS_gtk2="${LDFLAGS_gtk2} ${GTK2_LIBS}"
2295   PLUGINS="${PLUGINS} gtk2"
2296   if test "x${SYS}" != "xmingw32"; then
2297     NEED_GTK2_MAIN=yes
2298   fi
2299 fi
2300
2301 dnl
2302 dnl  Familiar module uses Gtk+ library
2303 dnl
2304 AC_ARG_ENABLE(familiar,
2305   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
2306 if test "x${enable_familiar}" = "xyes"
2307 then
2308   GTK_PATH="${PATH}"
2309   AC_ARG_WITH(gtk-config-path,
2310     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2311     [ if test "x${with_gtk_config_path}" != "xno"
2312       then
2313         GTK_PATH="${with_gtk_config_path}:${PATH}"
2314       fi ])
2315   # look for gtk-config
2316   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2317   GTK_CONFIG=${GTK12_CONFIG}
2318   if test "x${GTK_CONFIG}" = "xno"
2319   then
2320     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2321   fi
2322   # check for cross-compiling
2323   GTK_PREFIX=
2324   AC_ARG_WITH(gtk-prefix,
2325     [    --with-gtk-prefix=PATH path to libgtk (needed for cross-compiling),
2326                           e.g use as:
2327                           --with-gtk-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2328   if test "x${with_gtk_prefix}" != "xno" -a "x${with_gtk_prefix}" != "x"
2329   then
2330     GTK_PREFIX="--prefix=$with_gtk_prefix"
2331   fi
2332   if test "x${GTK_CONFIG}" != "xno"
2333   then
2334     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2335     then
2336       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.])
2337     fi
2338     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --cflags gtk gthread`"
2339     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --libs gtk gthread | sed 's,-rdynamic,,'`"
2340     # now look for the gtk.h header
2341     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
2342     ac_cv_gtk_headers=yes
2343     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2344       ac_cv_gtk_headers=no
2345       echo "Cannot find gtk development headers."
2346     ])
2347     if test "x${ac_cv_gtk_headers}" = "xyes"
2348     then
2349       PLUGINS="${PLUGINS} familiar"
2350     fi
2351     CPPFLAGS="${CPPFLAGS_save}"
2352
2353     # now look for gpe support
2354     AC_ARG_WITH(gpe-prefix,
2355     [    --with-gpe-prefix=PATH gpe installation path prefix (default search in \$PATH)],[],[])
2356     if test "x$with_gpe_prefix" != "xno"  -a "x$with_gpe_prefix" != "x"
2357     then
2358       CFLAGS_gpe="-I$with_gpe_prefix/include"
2359       LDFLAGS_gpe="-lXi -lgdk_pixbuf -L$with_gpe_prefix/lib -lgpewidget"
2360       # now look for gpe/init.h header file
2361       CFLAGS_save=$CFLAGS
2362       LDFLAGS_save=$LDFLAGS
2363       CFLAGS="${CFLAGS_familiar} ${CFLAGS_gpe}"
2364       LDFLAGS="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2365       CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar} ${CFLAGS_gpe}"
2366       ac_cv_gpe_headers=yes
2367       AC_CHECK_HEADERS(gpe/init.h, ,
2368         [ ac_cv_gpe_headers=no
2369           AC_MSG_ERROR([Cannot find development headers for libgpewidget...]) ])
2370       CFLAGS=$CFLAGS_save
2371       LDFLAGS=$LDFLAG_save
2372       if test "x${ac_cv_gpe_headers}" = "xyes"
2373       then
2374         CFLAGS_familiar="${CFLAGS_familiar} ${CFLAGS_gpe}"
2375         LDFLAGS_familiar="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2376       fi
2377     else
2378           NEED_GTK_MAIN=yes
2379     fi # end gpe support
2380   fi # end gtk+ support
2381 fi
2382
2383 dnl
2384 dnl  Gnome module
2385 dnl
2386 AC_ARG_ENABLE(gnome,
2387   [  --enable-gnome          Gnome interface support (default disabled)],
2388   [if test "x${enable_gnome}" = "xyes"; then
2389     # look for gnome-config
2390     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
2391     if test -x ${GNOME_CONFIG}
2392     then
2393        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
2394        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
2395     fi
2396     # now look for the gnome.h header
2397     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
2398     AC_CHECK_HEADERS(gnome.h, [
2399       PLUGINS="${PLUGINS} gnome"
2400       NEED_GTK_MAIN=yes
2401       NEED_GNOME_MAIN=yes
2402       ALIASES="${ALIASES} gnome-vlc"
2403       dnl We need this because of some moronic gnomesupport.h flavours
2404       AC_MSG_CHECKING(for strndup in gnome.h)
2405       AC_EGREP_HEADER(strndup,gnome.h,[
2406         AC_MSG_RESULT(yes)
2407         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
2408                   Define if <gnome.h> defines strndup.)],[
2409         AC_MSG_RESULT(no)])
2410      ],[
2411       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
2412 developement tools or remove the --enable-gnome option])
2413      ])
2414     CPPFLAGS="${CPPFLAGS_save}"
2415   fi])
2416
2417 dnl
2418 dnl  Gnome2 module
2419 dnl
2420 AC_ARG_ENABLE(gnome2,
2421   [  --enable-gnome2         Gnome2 support (default disabled)])
2422 if test "x${enable_gnome2}" = "xyes"
2423 then
2424   PKG_CHECK_MODULES(GNOME2, [libgnomeui-2.0])
2425   CFLAGS_gnome2="${CFLAGS_gnome2} ${GNOME2_CFLAGS}"
2426   LDFLAGS_gnome2="${LDFLAGS_gnome2} ${GNOME2_LIBS}"
2427   PLUGINS="${PLUGINS} gnome2"
2428   if test "x${SYS}" != "xmingw32"; then
2429     NEED_GNOME2_MAIN=yes
2430   fi
2431 fi
2432
2433 dnl
2434 dnl  wxWindows module
2435 dnl
2436 AC_ARG_ENABLE(wxwindows,
2437   [  --enable-wxwindows      wxWindows support (default enabled)])
2438 if test "x${enable_wxwindows}" != "xno"
2439 then
2440   WXWINDOWS_PATH="${PATH}"
2441   AC_ARG_WITH(wx-config-path,
2442     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
2443     [ if test "x${with_wx_config_path}" != "xno"
2444       then
2445         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
2446       fi ])
2447   # look for wx-config
2448   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
2449   if test "x${WX_CONFIG}" != "xno"
2450   then
2451     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
2452     then
2453       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.])
2454     fi
2455     CXXFLAGS_wxwindows="${CXXFLAGS_wxwindows} `${WX_CONFIG} --cxxflags`"
2456     LDFLAGS_wxwindows="${LDFLAGS_wxwindows} `${WX_CONFIG} --libs`"
2457     # now look for the wxprec.h header
2458     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
2459     ac_cv_wx_headers=yes
2460     AC_CHECK_HEADERS(wx/wxprec.h, , [
2461       ac_cv_wx_headers=no
2462       echo "Cannot find wxWindows development headers."
2463     ])
2464     if test "x${ac_cv_wx_headers}" = "xyes"
2465     then
2466       PLUGINS="${PLUGINS} wxwindows"
2467       ALIASES="${ALIASES} wxvlc"
2468     fi
2469     CPPFLAGS="${CPPFLAGS_save}"
2470   fi
2471 fi
2472
2473 dnl
2474 dnl  Qt module
2475 dnl
2476 AC_ARG_ENABLE(qt,
2477   [  --enable-qt             Qt interface support (default disabled)],
2478   [if test "x${enable_qt}" = "xyes"; then
2479      PLUGINS="${PLUGINS} qt"
2480      ALIASES="${ALIASES} qvlc"
2481      LDFLAGS_qt="${LDFLAGS_qt} -L${QTDIR}/lib"
2482      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt}"
2483      AC_CHECK_LIB(qt-mt,main,[
2484        LDFLAGS_qt="${LDFLAGS_qt} -lqt-mt"
2485      ],[
2486        AC_CHECK_LIB(qt,main,[
2487          LDFLAGS_qt="${LDFLAGS_qt} -lqt"
2488        ])
2489      ])
2490      LDFLAGS="${LDFLAGS_save}"
2491      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include"
2492      if test -x ${QTDIR}/bin/moc
2493      then
2494        MOC=${QTDIR}/bin/moc
2495      else
2496        MOC=moc
2497      fi
2498    fi])
2499
2500 dnl
2501 dnl  KDE module
2502 dnl
2503 AC_ARG_ENABLE(kde,
2504   [  --enable-kde            KDE interface support (default disabled)],
2505   [if test "x${enable_kde}" = "xyes"; then
2506      PLUGINS="${PLUGINS} kde"
2507      ALIASES="${ALIASES} kvlc"
2508      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib"
2509      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
2510      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2511      AC_CHECK_LIB(kfile,main,[
2512        LDFLAGS_kde="${LDFLAGS_kde} -lkfile"
2513      ])
2514      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2515      AC_CHECK_LIB(kdeui,main,[
2516        LDFLAGS_kde="${LDFLAGS_kde} -lkdeui"
2517      ])
2518      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2519      AC_CHECK_LIB(kio,main,[
2520        LDFLAGS_kde="${LDFLAGS_kde} -lkio"
2521      ])
2522      LDFLAGS="${LDFLAGS_save}"
2523      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt3 -I/usr/include/qt"
2524      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
2525      if test -x ${QTDIR}/bin/moc
2526      then
2527        MOC=${QTDIR}/bin/moc
2528      else
2529        MOC=moc
2530      fi
2531    fi])
2532
2533 dnl
2534 dnl  Opie QT embedded module
2535 dnl
2536 AC_ARG_ENABLE(opie,
2537   [  --enable-opie           Qt embedded interface support (default disabled)],
2538   [if test "x${enable_opie}" = "xyes"; then
2539      AC_ARG_WITH(qte,
2540      [    --with-qte=PATH       Qt Embedded headers and libraries])
2541      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2542      then
2543        LDFLAGS_qte="-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2544        CPPFLAGS_qte="-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2545      else
2546        LDFLAGS_qte="-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`"
2547        CPPFLAGS_qte="-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`"
2548      fi
2549      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2550      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2551        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2552      ] )
2553      CPPFLAGS="${CPPFLAGS_save}"
2554
2555      PLUGINS="${PLUGINS} opie"
2556      NEED_QTE_MAIN=yes
2557      LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
2558      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
2559      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2560      then
2561        MOC=${with_qte}/bin/moc
2562      else
2563        MOC=${QTDIR}/bin/moc
2564      fi
2565    fi])
2566
2567 dnl
2568 dnl  MacOS X module
2569 dnl
2570 AC_ARG_ENABLE(macosx,
2571   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
2572   [if test "x${enable_macosx}" = "xyes"
2573    then
2574      BUILTINS="${BUILTINS} macosx"
2575      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2576    fi],
2577   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
2578      BUILTINS="${BUILTINS} macosx"
2579      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2580    )])
2581
2582 dnl
2583 dnl  QNX RTOS module
2584 dnl
2585 AC_ARG_ENABLE(qnx,
2586   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
2587     if test "x${enable_qnx}" != "xno"
2588     then
2589       AC_CHECK_HEADERS(Ph.h, [
2590         PLUGINS="${PLUGINS} qnx"
2591         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
2592       ])
2593     fi
2594
2595 dnl
2596 dnl  Windows native interface module, built with Borland C++ Builder
2597 dnl
2598 AC_ARG_ENABLE(intfwin,
2599 [  --enable-intfwin        Win32 interface support (default disabled)],
2600 [ if test "x${enable_intfwin}" != "xno"
2601   then
2602     AC_CHECK_TOOL(BPR2MAK, bpr2mak, AC_ERROR(bpr2mak not found))
2603     AC_CHECK_TOOL(BCMAKE, bcmake, AC_ERROR(bcmake not found))
2604     PLUGINS="${PLUGINS} win32"
2605   fi ])
2606
2607 dnl
2608 dnl  ncurses module
2609 dnl
2610 AC_ARG_ENABLE(ncurses,
2611   [  --enable-ncurses        ncurses interface support (default disabled)],
2612   [if test "x${enable_ncurses}" = "xyes"; then
2613      PLUGINS="${PLUGINS} ncurses"
2614      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
2615    fi])
2616
2617 dnl
2618 dnl  XOSD plugin
2619 dnl
2620 AC_ARG_ENABLE(xosd,
2621   [  --enable-xosd           xosd interface support (default disabled)])
2622 if test "x${enable_xosd}" = "xyes"
2623 then
2624   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2625   AC_CHECK_LIB(xosd,xosd_set_offset,
2626       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
2627     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
2628         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
2629       AC_TRY_COMPILE([#include <xosd.h>],
2630          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2631           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
2632   if test "x${have_xosd}" = "xtrue"
2633   then
2634     PLUGINS="${PLUGINS} xosd"
2635     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2636   fi
2637 fi
2638
2639 dnl
2640 dnl  SLP access plugin
2641 dnl
2642 AC_ARG_ENABLE(slp,
2643   [  --enable-slp            SLP service discovery support (default enabled)])
2644 if test "x${enable_slp}" != "xno"
2645 then
2646   AC_ARG_WITH(slp,
2647   [    --with-slp=PATH       libslp headers and libraries])
2648   if test "x${with_slp}" = x
2649   then
2650     AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
2651     if test "x${have_slp}" = "xtrue"
2652     then
2653       PLUGINS="${PLUGINS} slp"
2654       LDFLAGS_slp="${LDFLAGS_slp} -lslp"
2655     fi
2656   else
2657     AC_MSG_CHECKING(for slp headers in ${with_slp})
2658     if test -f ${with_slp}/slp.h
2659     then
2660       dnl  Use ${with_slp}/libslp/slp.h
2661       AC_MSG_RESULT(yes)
2662       PLUGINS="${PLUGINS} slp"
2663       LDFLAGS_slp="${LDFLAGS_slp} -L${with_slp} -lslp"
2664       CPPFLAGS_slp="${CPPFLAGS_slp} -I${with_slp}"
2665     else
2666       dnl  No libslp could be found, sorry
2667       AC_MSG_RESULT(no)
2668       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
2669     fi
2670   fi
2671 fi
2672
2673 dnl
2674 dnl  Lirc plugin
2675 dnl
2676 AC_ARG_ENABLE(lirc,
2677   [  --enable-lirc           lirc support (default disabled)])
2678 if test "x${enable_lirc}" = "xyes"
2679 then
2680   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2681   if test "x${have_lirc}" = "xtrue"
2682   then
2683     PLUGINS="${PLUGINS} lirc"
2684     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2685   fi
2686 fi
2687
2688 AC_ARG_WITH(,[Misc options:])
2689
2690 dnl
2691 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2692 dnl
2693 dnl  We give the user the opportunity to specify
2694 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2695 dnl
2696 AC_ARG_WITH(words,
2697   [  --with-words=endianness set endianness (big or little)])
2698   case "x${with_words}" in
2699     xbig)
2700       ac_cv_c_bigendian=yes
2701       ;;
2702     xlittle)
2703       ac_cv_c_bigendian=no
2704       ;;
2705     *)
2706       dnl  Try to guess endianness by matching patterns on a compiled
2707       dnl  binary, by looking for an ASCII or EBCDIC string
2708       AC_CACHE_CHECK([whether the byte order is big-endian],
2709         [ac_cv_c_bigendian],
2710         [ac_cv_c_bigendian="unknown"
2711         [cat >conftest.c <<EOF
2712         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2713         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2714         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2715         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2716         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2717         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2718         int main(void) { _a(); _e(); return 0; }
2719 EOF
2720         ]
2721         if test -f conftest.c
2722         then
2723           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2724               && test -f conftest.o
2725           then
2726             if test "`strings conftest.o | grep BIGenDianSyS`"
2727             then
2728               ac_cv_c_bigendian="yes"
2729             fi
2730             if test "`strings conftest.o | grep LiTTleEnDian`"
2731             then
2732               ac_cv_c_bigendian="no"
2733             fi
2734           fi
2735         fi
2736       ])
2737       if test "x${ac_cv_c_bigendian}" = "xunknown"
2738       then
2739         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
2740       fi
2741       ;;
2742   esac
2743 dnl  Now we know what to use for endianness, just put it in the header
2744 if test "${ac_cv_c_bigendian}" = "yes"
2745 then
2746   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
2747 fi
2748
2749 dnl
2750 dnl  Mozilla plugin
2751 dnl
2752 mozilla=false
2753 AC_ARG_ENABLE(mozilla,
2754   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2755 if test "x${enable_mozilla}" = "xyes"
2756 then
2757   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2758   if test "x${MOZILLA_CONFIG}" != "xno"
2759   then
2760     if test "x${SYS}" != "xmingw32"; then
2761       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
2762       AC_CHECK_LIB(Xt,XtStrings,[
2763         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
2764       ])
2765       LDFLAGS="${LDFLAGS_save}"
2766     fi
2767     mozilla=:
2768     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2769     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2770     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2771     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2772     dnl Not necessarily in ${PATH}
2773     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
2774     then
2775       XPIDL="/usr/lib/mozilla/xpidl"
2776     fi
2777   fi
2778 fi
2779 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
2780
2781 dnl
2782 dnl  test plugins
2783 dnl
2784 AC_ARG_ENABLE(testsuite,
2785   [  --enable-testsuite      build test modules (default disabled)])
2786 if test "x${enable_testsuite}" = "xyes"
2787 then
2788   TESTS="test1 test2 test3 test4"
2789
2790   dnl  we define those so that bootstrap sets the right linker
2791   CXXFLAGS_test2="${CXXFLAGS_test2}"
2792   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
2793   dnl  this one is needed until automake knows what to do
2794   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
2795
2796   PLUGINS="${PLUGINS} ${TESTS}"
2797   #BUILTINS="${BUILTINS} ${TESTS}"
2798 fi
2799
2800 dnl
2801 dnl  gtk_main plugin
2802 dnl
2803 if test "x${NEED_GTK_MAIN}" != "xno"
2804 then
2805     PLUGINS="${PLUGINS} gtk_main"
2806     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
2807     CFLAGS_familiar="${CFLAGS_familiar} -DNEED_GTK_MAIN"
2808     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
2809     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
2810 fi
2811
2812 if test "x${NEED_GNOME_MAIN}" != "xno"
2813 then
2814     PLUGINS="${PLUGINS} gnome_main"
2815     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
2816     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
2817 fi
2818
2819 if test "x${NEED_GTK2_MAIN}" != "xno"
2820 then
2821     PLUGINS="${PLUGINS} gtk2_main"
2822     CFLAGS_gtk2="${CFLAGS_gtk2} -DNEED_GTK2_MAIN"
2823     CFLAGS_gtk2_main="${CFLAGS_gtk2_main} ${CFLAGS_gtk2}"
2824     LDFLAGS_gtk2_main="${LDFLAGS_gtk2_main} ${LDFLAGS_gtk2}"
2825 fi
2826
2827 if test "x${NEED_GNOME2_MAIN}" != "xno"
2828 then
2829     PLUGINS="${PLUGINS} gnome2_main"
2830     CFLAGS_gnome2_main="${CFLAGS_gnome2_main} ${CFLAGS_gtk2} ${CFLAGS_gnome2}"
2831     LDFLAGS_gnome2_main="${LDFLAGS_gnome2_main} ${LDFLAGS_gtk2} ${LDFLAGS_gnome2}"
2832 fi
2833
2834 dnl
2835 dnl  qte_main plugin
2836 dnl
2837 if test "x${NEED_QTE_MAIN}" != "xno"
2838 then
2839     PLUGINS="${PLUGINS} qte_main"
2840     CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
2841         CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
2842     CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
2843     LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
2844 fi
2845
2846
2847 dnl
2848 dnl  Plugin and builtin checks
2849 dnl
2850 builtin_support=false
2851 plugin_support=:
2852
2853 dnl Support for plugins - this must be AT THE END
2854 AC_ARG_ENABLE(plugins,
2855   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
2856   [if test "x${enable_plugins}" = "xno"
2857    then
2858      plugin_support=false
2859    fi])
2860
2861 dnl Automagically disable plugins if there is no system support for
2862 dnl dynamically loadable files (.so, .dll, .dylib).
2863 dnl don't forget vlc-win32 still can load .dll as plugins
2864 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2865 then
2866   echo "*** Your system doesn't have plugin support. All plugins will be built"
2867   echo "statically."
2868   plugin_support=false
2869 fi
2870
2871 dnl Export automake variables
2872 if ${plugin_support}
2873 then
2874   for plugin in `echo ${PLUGINS}`
2875   do
2876     eval "${plugin}_plugin=yes"
2877   done
2878 else
2879   BUILTINS="${BUILTINS} ${PLUGINS}"
2880   PLUGINS=
2881 fi
2882 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
2883
2884 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
2885 then
2886   builtin_support=:
2887   for builtin in `echo ${BUILTINS}`
2888   do
2889     eval "${builtin}_builtin=yes"
2890   done
2891 fi]
2892 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
2893
2894 dnl do not touch this line (bootstrap needs it)
2895
2896
2897 dnl
2898 dnl  Stuff used by the program
2899 dnl
2900 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
2901 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
2902 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2903
2904 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`"
2905 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2906 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2907 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
2908
2909 DATA_PATH="${ac_tool_prefix}/share/vlc"
2910 AC_SUBST(DATA_PATH)
2911 PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
2912 AC_SUBST(PLUGIN_PATH)
2913
2914 dnl
2915 dnl  Restore *FLAGS
2916 dnl
2917 CPPFLAGS="${CPPFLAGS_save}"
2918 CFLAGS="${CFLAGS_save}"
2919 CXXFLAGS="${CXXFLAGS_save}"
2920 OBJCFLAGS="${OBJCFLAGS_save}"
2921 LDFLAGS="${LDFLAGS_save}"
2922
2923 dnl
2924 dnl  Fool automake (see Makefile.am)
2925 dnl
2926 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
2927 AC_SUBST(AUTOMAKE_SUCKS)
2928
2929 dnl
2930 dnl  Create the vlc-config script
2931 dnl
2932 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
2933 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
2934
2935 dnl
2936 dnl  Configuration is finished
2937 dnl
2938 AC_SUBST(SYS)
2939 AC_SUBST(ARCH)
2940 AC_SUBST(PLUGINS)
2941 AC_SUBST(BUILTINS)
2942 AC_SUBST(ALIASES)
2943 AC_SUBST(ASM)
2944 AC_SUBST(MOC)
2945 AC_SUBST(WINDRES)
2946 AC_SUBST(XPIDL)
2947 AC_SUBST(LIBEXT)
2948 AC_SUBST(INCLUDES)
2949 AC_SUBST(ALL_LINGUAS)
2950
2951 AC_SUBST(CFLAGS_TUNING)
2952 AC_SUBST(CFLAGS_OPTIM)
2953 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2954 AC_SUBST(CFLAGS_NOOPTIM)
2955 AC_SUBST(LDFLAGS)
2956
2957 AC_SUBST(CFLAGS_vlc)
2958 AC_SUBST(CFLAGS_pics)
2959 AC_SUBST(CXXFLAGS_pics)
2960 AC_SUBST(CFLAGS_plugins)
2961 AC_SUBST(CXXFLAGS_plugins)
2962 AC_SUBST(CFLAGS_builtins)
2963 AC_SUBST(CPPFLAGS_mozilla)
2964
2965 AC_SUBST(LDFLAGS_vlc)
2966 AC_SUBST(LDFLAGS_libvlc)
2967 AC_SUBST(LDFLAGS_plugins)
2968 AC_SUBST(LDFLAGS_builtins)
2969 AC_SUBST(LDFLAGS_mozilla)
2970
2971 AC_OUTPUT([
2972   Makefile
2973   autotools/Makefile
2974   debian/Makefile
2975   doc/Makefile
2976   intl/Makefile
2977   ipkg/Makefile
2978   lib/Makefile
2979   m4/Makefile
2980   modules/Makefile
2981   po/Makefile.in
2982   share/Makefile
2983   src/Makefile
2984   vlc-config
2985 ],[
2986   chmod a+x vlc-config
2987 ])
2988
2989 printf "
2990 vlc configuration
2991 --------------------
2992 vlc version           : ${VERSION}
2993 system                : ${SYS}
2994 architecture          : ${ARCH}
2995 build flavour         : "
2996 test "x${DEBUG_TRUE}" = "x" && printf "debug "
2997 test "x${CPROF_TRUE}" = "x" && printf "cprof "
2998 test "x${GPROF_TRUE}" = "x" && printf "gprof "
2999 test "x${OPTIM_TRUE}" = "x" && printf "optim "
3000 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
3001 echo "
3002 vlc aliases           :${ALIASES}
3003
3004 To build vlc and its plugins, type \`make'.
3005 "
3006