Keep quiet, explanations will follow.
[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   LDFLAGS_skins="${LDFLAGS_skins} -lz"
1673 ] )
1674
1675
1676 dnl
1677 dnl skins module
1678 dnl
1679 AC_CHECK_HEADERS(libtar.h, [
1680   LDFLAGS_skins="${LDFLAGS_skins} -ltar"
1681 ] )
1682
1683
1684
1685 dnl
1686 dnl  a52 AC3 decoder plugin
1687 dnl
1688 AC_ARG_ENABLE(a52,
1689   [  --enable-a52            A/52 support with liba52 (default enabled)])
1690 if test "x${enable_a52}" != "xno"
1691 then
1692   AC_ARG_WITH(a52,
1693     [    --with-a52=PATH       a52 headers and libraries])
1694   AC_ARG_WITH(a52-tree,
1695     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1696   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1697   then
1698     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1699     if test "x${real_a52_tree}" = "x"
1700     then
1701       dnl  The given directory can't be found
1702       AC_MSG_RESULT(no)
1703       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1704     fi
1705     dnl  Use a custom a52dec
1706     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1707     if test -f ${real_a52_tree}/include/a52.h
1708     then
1709       AC_MSG_RESULT(yes)
1710       CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -I${real_a52_tree}"
1711       LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -L${real_a52_tree}/liba52/.libs"
1712       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
1713       AC_CHECK_LIB(a52, a52_free, [
1714         BUILTINS="${BUILTINS} a52tofloat32"
1715         LDFLAGS_a52tofloat32="-la52 ${LDFLAGS_a52tofloat32}"
1716         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -DUSE_A52DEC_TREE"
1717         ],[
1718         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1719         then
1720           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1721         else
1722           AC_MSG_ERROR([the specified tree hasn't been compiled])
1723         fi
1724       ])
1725       LDFLAGS="${LDFLAGS_save}"
1726     else
1727       AC_MSG_RESULT(no)
1728       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1729     fi
1730   else
1731     if test "x${with_a52}" = "x"
1732     then
1733       LDFLAGS_test=""
1734       CPPFLAGS_test=""
1735     else
1736       LDFLAGS_test="-L${with_a52}/lib"
1737       CPPFLAGS_test="-I${with_a52}/include"
1738     fi
1739     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
1740     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LDFLAGS_a52tofloat32}"
1741     AC_CHECK_HEADERS(a52dec/a52.h, [
1742       AC_CHECK_LIB(a52, a52_free, [
1743         PLUGINS="${PLUGINS} a52tofloat32"
1744         LDFLAGS_a52tofloat32="${LDFLAGS_test} -la52 ${LDFLAGS_a52tofloat32}"
1745         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} ${CPPFLAGS_test}"
1746       ],[
1747         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.])
1748       ])
1749     ])
1750     CPPFLAGS="${CPPFLAGS_save}"
1751     LDFLAGS="${LDFLAGS_save}"
1752   fi
1753 fi
1754
1755 dnl
1756 dnl  DV plugin
1757 dnl
1758 AC_ARG_ENABLE(dv,
1759   [  --enable-dv             DV decoder support (default disabled)])
1760 if test "x${enable_dv}" = "xyes"
1761 then
1762   AC_CHECK_HEADERS(libdv/dv.h, [
1763     PLUGINS="${PLUGINS} dv"
1764     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1765    ],[])
1766 fi
1767
1768 dnl
1769 dnl  Flac plugin
1770 dnl
1771 AC_ARG_ENABLE(flac,
1772   [  --enable-flac           flac decoder support (default disabled)])
1773 if test "x${enable_flac}" = "xyes"
1774 then
1775   AC_CHECK_HEADERS(FLAC/stream_decoder.h, [
1776     PLUGINS="${PLUGINS} flac flacdec"
1777     LDFLAGS_flacdec="${LDFLAGS_flacdec} -lFLAC"
1778    ],[])
1779 fi
1780
1781 dnl
1782 dnl  Libmpeg2 plugin
1783 dnl
1784 AC_ARG_ENABLE(libmpeg2,
1785   [  --enable-libmpeg2       libmpeg2 decoder support (default disabled)])
1786 if test "x${enable_libmpeg2}" = "xyes"
1787 then
1788   AC_CHECK_HEADERS(mpeg2dec/mpeg2.h, [
1789     PLUGINS="${PLUGINS} libmpeg2"
1790     LDFLAGS_libmpeg2="${LDFLAGS_libmpeg2} -lmpeg2"
1791    ],[])
1792 fi
1793
1794 dnl
1795 dnl  Vorbis plugin
1796 dnl
1797 AC_ARG_ENABLE(vorbis,
1798   [  --enable-vorbis         Vorbis decoder support (default enabled)])
1799 if test "x${enable_vorbis}" != "xno"
1800 then
1801   AC_CHECK_HEADERS(vorbis/codec.h, [
1802     PLUGINS="${PLUGINS} vorbis"
1803     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis -logg"
1804    ],[])
1805 fi
1806          
1807 dnl
1808 dnl  Tremor plugin
1809 dnl
1810 AC_ARG_ENABLE(tremor,
1811   [  --enable-tremor         Tremor decoder support (default disabled)])
1812 if test "x${enable_tremor}" = "xyes"
1813 then
1814   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
1815     PLUGINS="${PLUGINS} tremor"
1816     LDFLAGS_tremor="${LDFLAGS_tremor} -lvorbisidec -logg"
1817    ],[])
1818 fi
1819
1820 dnl
1821 dnl  tarkin decoder plugin
1822 dnl
1823 AC_ARG_ENABLE(tarkin,
1824 [  --enable-tarkin         experimental tarkin codec (default disabled)])
1825 if test "x${enable_tarkin}" = "xyes"
1826 then
1827   AC_ARG_WITH(tarkin-tree,
1828   [    --with-tarkin-tree=PATH tarkin tree for static linking])
1829   if test "x${with_tarkin_tree}" != "x"
1830   then
1831     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
1832     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
1833     if test -f "${real_tarkin_tree}/tarkin.o"
1834     then
1835       BUILTINS="${BUILTINS} tarkin"
1836       CPPFLAGS_tarkin="${CPPFLAGS_tarkin} -I${real_tarkin_tree}"
1837       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"
1838       AC_MSG_RESULT(yes)
1839     else
1840       dnl  The given tarkin tree wasn't built
1841       AC_MSG_RESULT(no)
1842       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
1843                     make sure you compiled tarkin in ${with_tarkin_tree}])
1844     fi
1845   fi
1846 fi
1847
1848 dnl
1849 dnl  theora decoder plugin
1850 dnl
1851 AC_ARG_ENABLE(theora,
1852 [  --enable-theora         experimental theora codec (default disabled)])
1853 if test "x${enable_theora}" = "xyes"
1854 then
1855   AC_CHECK_HEADERS(theora/theora.h, [
1856     AC_CHECK_LIB(theora, theora_granule_time, [
1857       BUILTINS="${BUILTINS} theora"
1858       LDFLAGS_theora="${LDFLAGS_theora} -ltheora -logg" ],[
1859       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
1860 You also need to check that you have a libogg posterior to the 1.0 release.])],
1861       [-logg])
1862   ])
1863 fi
1864
1865 dnl
1866 dnl  Video plugins
1867 dnl
1868
1869 AC_ARG_WITH(,[Video plugins:])
1870
1871 dnl
1872 dnl  X11 module
1873 dnl  (enabled by default except on win32)
1874 dnl
1875 AC_ARG_ENABLE(x11,
1876   [  --enable-x11            X11 support (default enabled)])
1877 if test "x${enable_x11}" != "xno" &&
1878   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1879   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1880   AC_CHECK_HEADERS(X11/Xlib.h, [
1881     PLUGINS="${PLUGINS} x11"
1882     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
1883     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
1884   ])
1885   CPPFLAGS="${CPPFLAGS_save}"
1886 fi
1887
1888 dnl
1889 dnl  XVideo module
1890 dnl  (enabled by default except on win32)
1891 dnl
1892 AC_ARG_ENABLE(xvideo,
1893   [  --enable-xvideo         XVideo support (default enabled)])
1894 if test "x${enable_xvideo}" != "xno" &&
1895   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1896   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1897   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1898     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
1899     AC_CHECK_LIB(Xv_pic,XvPutImage,
1900       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1901       PLUGINS="${PLUGINS} xvideo"
1902       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
1903       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1904       AC_CHECK_LIB(Xv,XvPutImage,
1905         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1906         PLUGINS="${PLUGINS} xvideo"
1907         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
1908         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1909         # Otherwise... well, do nothing.
1910         :
1911       )
1912     )
1913     CFLAGS="${CFLAGS_save}"
1914   ]
1915   CPPFLAGS="${CPPFLAGS_save}")
1916 fi
1917
1918 dnl
1919 dnl  SDL module
1920 dnl
1921 AC_ARG_ENABLE(sdl,
1922   [  --enable-sdl            SDL support (default enabled)])
1923 if test "x${enable_sdl}" != "xno"
1924 then
1925   SDL_PATH="${PATH}"
1926   AC_ARG_WITH(sdl-config-path,
1927     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1928     [ if test "x${with_sdl_config_path}" != "xno"
1929       then
1930         SDL_PATH="${with_sdl_config_path}:${PATH}"
1931       fi ])
1932   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1933   SDL_CONFIG="${SDL12_CONFIG}"
1934   SDL_HEADER="SDL12/SDL.h"
1935   if test "x${SDL_CONFIG}" = "xno"
1936   then
1937     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1938     SDL_CONFIG=${SDL11_CONFIG}
1939     SDL_HEADER="SDL11/SDL.h"
1940   fi
1941   if test "x${SDL_CONFIG}" = "xno"
1942   then
1943     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1944     SDL_HEADER="SDL/SDL.h"
1945   fi
1946   # check for cross-compiling
1947   SDL_PREFIX=
1948   AC_ARG_WITH(sdl-prefix,
1949     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
1950                                e.g use as:
1951                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
1952   if test "x${with_sdl_prefix}" != "xno" -a "x${with_sdl_prefix}" != "x"
1953   then
1954     SDL_PREFIX="--prefix=${with_sdl_prefix}"
1955   fi
1956   if test "x${SDL_CONFIG}" != "xno"
1957   then
1958     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
1959     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1960     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1961     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
1962     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
1963     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
1964     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1965       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1966       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
1967           As a last resort we also test for SDL.h presence),
1968       [ AC_MSG_ERROR([The development package for SDL is not installed.
1969 Please install it and try again. Alternatively you can also configure with
1970 --disable-sdl.])
1971       ])])
1972     CPPFLAGS="${CPPFLAGS_save}"
1973     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1974     then
1975       AC_MSG_ERROR([The development package for SDL is not installed.
1976 Please install it and try again. Alternatively you can also configure with
1977 --disable-sdl.])
1978     fi
1979   elif test "x${enable_sdl}" =  "xyes"
1980   then
1981     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1982 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1983     ])
1984   fi
1985 fi
1986
1987 dnl
1988 dnl  Qt Embedded module
1989 dnl  (disabled by default)
1990 dnl
1991 AC_ARG_ENABLE(qte,
1992   [  --enable-qte            QT Embedded support (default disabled)])
1993 if test "x${enable_qte}" = "xyes"
1994 then
1995   AC_ARG_WITH(qte,
1996   [    --with-qte=PATH       Qt Embedded headers and libraries])
1997   if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
1998   then
1999     LDFLAGS_qte="${LDFLAGS_qte} -L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2000     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"
2001   else
2002     LDFLAGS_qte="${LDFLAGS_qte} -L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2003     CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2004   fi
2005   PLUGINS="${PLUGINS} qte"
2006   NEED_QTE_MAIN=yes
2007   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2008   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2009     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2010   ] )
2011   CPPFLAGS="${CPPFLAGS_save}"
2012 fi
2013
2014 dnl
2015 dnl  Windows DirectX module
2016 dnl
2017 AC_ARG_ENABLE(directx,
2018   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
2019 if test "x${enable_directx}" != "xno"
2020 then
2021   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
2022   then
2023     AC_ARG_WITH(directx,
2024     [    --with-directx=PATH   Win32 DirectX headers])
2025     if test "x${with_directx}" = "x"
2026     then
2027       AC_CHECK_HEADERS(ddraw.h,
2028       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
2029         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
2030     else
2031       AC_MSG_CHECKING(for directX headers in ${with_directx})
2032       if test -f ${with_directx}/ddraw.h
2033       then
2034         PLUGINS="${PLUGINS} vout_directx aout_directx"
2035         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
2036         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
2037         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
2038         AC_MSG_RESULT(yes)
2039       else
2040         AC_MSG_RESULT(no)
2041         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
2042       fi
2043     fi
2044   fi
2045 fi
2046
2047 dnl
2048 dnl  Linux framebuffer module
2049 dnl
2050 AC_ARG_ENABLE(fb,
2051   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
2052     if test "x${enable_fb}" != "xno"
2053     then
2054       AC_CHECK_HEADERS(linux/fb.h, [
2055         PLUGINS="${PLUGINS} fb"
2056       ])
2057     fi
2058
2059 dnl
2060 dnl  Linux MGA module
2061 dnl
2062 AC_ARG_ENABLE(mga,
2063   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2064   [ if test "x${enable_mga}" = "xyes"
2065     then
2066       PLUGINS="${PLUGINS} mga xmga"
2067     fi ])
2068
2069 dnl
2070 dnl  SVGAlib module
2071 dnl
2072 AC_ARG_ENABLE(svgalib,
2073   [  --enable-svgalib        SVGAlib support (default disabled)])
2074 if test "x${enable_svgalib}" = "xyes"
2075 then
2076   PLUGINS="${PLUGINS} svgalib"
2077   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
2078 fi
2079
2080 dnl
2081 dnl  GGI module
2082 dnl
2083 AC_ARG_ENABLE(ggi,
2084   [  --enable-ggi            GGI support (default disabled)])
2085 if test "x${enable_ggi}" = "xyes"
2086 then
2087   PLUGINS="${PLUGINS} ggi"
2088   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
2089   AC_ARG_WITH(ggi,
2090     [    --with-ggi=PATH       path to libggi],
2091     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
2092       then
2093         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
2094         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
2095       fi ])
2096 fi
2097
2098 dnl
2099 dnl  Glide module
2100 dnl
2101 AC_ARG_ENABLE(glide,
2102   [  --enable-glide          Glide (3dfx) support (default disabled)])
2103 if test "x${enable_glide}" = "xyes"
2104 then
2105   PLUGINS="${PLUGINS} glide"
2106   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
2107   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
2108   AC_ARG_WITH(glide,
2109     [    --with-glide=PATH     path to libglide],
2110     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
2111       then
2112         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
2113         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
2114       fi ])
2115 fi
2116
2117 dnl
2118 dnl  AA plugin
2119 dnl
2120 AC_ARG_ENABLE(aa,
2121   [  --enable-aa             aalib output (default disabled)])
2122 if test "x${enable_aa}" = "xyes"
2123 then
2124   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2125   if test "x${have_aa}" = "xtrue"
2126   then
2127     PLUGINS="${PLUGINS} aa"
2128     LDFLAGS_aa="${LDFLAGS_aa} -laa"
2129   fi
2130 fi
2131
2132 dnl
2133 dnl  win32 GDI plugin
2134 dnl
2135 AC_ARG_ENABLE(wingdi,
2136   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2137 if test "x${enable_wingdi}" != "xno"; then
2138   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2139     PLUGINS="${PLUGINS} wingdi"
2140     LDFLAGS_wingdi="${LDFLAGS_wingdi} -lgdi32"
2141   fi
2142 fi
2143
2144 dnl
2145 dnl  Audio plugins
2146 dnl
2147
2148 AC_ARG_WITH(,[Audio plugins:])
2149
2150 dnl
2151 dnl  OSS /dev/dsp module (enabled by default except on win32)
2152 dnl
2153 AC_ARG_ENABLE(oss,
2154   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2155
2156 if test "x${enable_oss}" != "xno" &&
2157   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
2158 then
2159   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2160     PLUGINS="${PLUGINS} oss"
2161     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
2162   ])
2163 fi
2164
2165 dnl
2166 dnl  Esound module
2167 dnl
2168 AC_ARG_ENABLE(esd,
2169   [  --enable-esd            Esound library support (default disabled)],
2170   [if test "x${enable_esd}" = "xyes"
2171    then
2172      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2173      if test "x${ESD_CONFIG}" != "xno"
2174      then
2175        PLUGINS="${PLUGINS} esd"
2176        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
2177        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
2178      fi
2179    fi])
2180
2181 dnl
2182 dnl  aRts module
2183 dnl
2184 AC_ARG_ENABLE(arts,
2185   [  --enable-arts           aRts sound server (default disabled)],
2186   [if test "x${enable_arts}" = "xyes"
2187    then
2188      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2189      if test "x${ARTS_CONFIG}" != "xno"
2190      then
2191        PLUGINS="${PLUGINS} arts"
2192        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
2193        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
2194      fi
2195    fi])
2196
2197 dnl
2198 dnl  ALSA module
2199 dnl
2200 AC_ARG_ENABLE(alsa,
2201   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2202   [if test "x${enable_alsa}" = "xyes"
2203    then
2204      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2205      if test "x${have_alsa}" = "xtrue"
2206      then
2207        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2208                        #define ALSA_PCM_NEW_SW_PARAMS_API
2209                        #include <alsa/asoundlib.h>],
2210           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2211            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2212        PLUGINS="${PLUGINS} alsa"
2213        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
2214      else
2215        AC_MSG_ERROR([Could not find ALSA development headers])
2216      fi
2217    fi])
2218
2219 dnl
2220 dnl  win32 waveOut plugin
2221 dnl
2222 AC_ARG_ENABLE(waveout,
2223   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2224 if test "x${enable_waveout}" != "xno"; then
2225   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2226     PLUGINS="${PLUGINS} waveout"
2227     LDFLAGS_waveout="-lwinmm"
2228   fi
2229 fi
2230
2231 dnl
2232 dnl  Interface plugins
2233 dnl
2234
2235 AC_ARG_WITH(,[Interface plugins:])
2236
2237 dnl special case for BeOS
2238 if test "x${SYS}" = "xbeos"
2239 then
2240     PLUGINS="${PLUGINS} beos"
2241 fi
2242
2243 dnl
2244 dnl Skins module
2245 dnl
2246 AC_ARG_ENABLE(skins,
2247   [  --enable-skins         Win32 skins module (default enabled on Win32)])
2248 if test "x${enable_skins}" != "xno"; then
2249   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2250     PLUGINS="${PLUGINS} skins"
2251     CPPFLAGS_skins="${CPPFLAGS_skins} -Imodules/gui/skins -Imodules/gui/skins/src -Imodules/gui/skins/win32 -Imodules/gui/skins/controls"
2252     LDFLAGS_skins="${LDFLAGS_skins} -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32 -lmsimg32"
2253   fi
2254 fi
2255
2256 dnl
2257 dnl  Gtk+ module
2258 dnl
2259 AC_ARG_ENABLE(gtk,
2260   [  --enable-gtk            Gtk+ support (default enabled)])
2261 if test "x${enable_gtk}" != "xno"
2262 then
2263   GTK_PATH="${PATH}"
2264   AC_ARG_WITH(gtk-config-path,
2265     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2266     [ if test "x${with_gtk_config_path}" != "xno"
2267       then
2268         GTK_PATH="${with_gtk_config_path}:${PATH}"
2269       fi ])
2270   # look for gtk-config
2271   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2272   GTK_CONFIG=${GTK12_CONFIG}
2273   if test "x${GTK_CONFIG}" = "xno"
2274   then
2275     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2276   fi
2277   if test "x${GTK_CONFIG}" != "xno"
2278   then
2279     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2280     then
2281       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.])
2282     fi
2283     if test "x${SYS}" != "xmingw32"; then
2284       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
2285       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
2286     else
2287       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
2288       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
2289     fi
2290     # now look for the gtk.h header
2291     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
2292     ac_cv_gtk_headers=yes
2293     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2294       ac_cv_gtk_headers=no
2295       echo "Cannot find gtk development headers."
2296     ])
2297     if test "x${ac_cv_gtk_headers}" = "xyes"
2298     then
2299       PLUGINS="${PLUGINS} gtk"
2300       if test "x${SYS}" != "xmingw32"; then
2301         NEED_GTK_MAIN=yes
2302       fi
2303       ALIASES="${ALIASES} gvlc"
2304     fi
2305     CPPFLAGS="${CPPFLAGS_save}"
2306   fi
2307 fi
2308
2309 dnl
2310 dnl  Gtk+2 module
2311 dnl
2312 AC_ARG_ENABLE(gtk2,
2313   [  --enable-gtk2           Gtk2 support (default disabled)])
2314 if test "x${enable_gtk2}" = "xyes"
2315 then
2316   PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
2317   CFLAGS_gtk2="${CFLAGS_gtk2} ${GTK2_CFLAGS}"
2318   LDFLAGS_gtk2="${LDFLAGS_gtk2} ${GTK2_LIBS}"
2319   PLUGINS="${PLUGINS} gtk2"
2320   if test "x${SYS}" != "xmingw32"; then
2321     NEED_GTK2_MAIN=yes
2322   fi
2323 fi
2324
2325 dnl
2326 dnl  Familiar module uses Gtk+ library
2327 dnl
2328 AC_ARG_ENABLE(familiar,
2329   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
2330 if test "x${enable_familiar}" = "xyes"
2331 then
2332   GTK_PATH="${PATH}"
2333   AC_ARG_WITH(gtk-config-path,
2334     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2335     [ if test "x${with_gtk_config_path}" != "xno"
2336       then
2337         GTK_PATH="${with_gtk_config_path}:${PATH}"
2338       fi ])
2339   # look for gtk-config
2340   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2341   GTK_CONFIG=${GTK12_CONFIG}
2342   if test "x${GTK_CONFIG}" = "xno"
2343   then
2344     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2345   fi
2346   # check for cross-compiling
2347   GTK_PREFIX=
2348   AC_ARG_WITH(gtk-prefix,
2349     [    --with-gtk-prefix=PATH path to libgtk (needed for cross-compiling),
2350                           e.g use as:
2351                           --with-gtk-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2352   if test "x${with_gtk_prefix}" != "xno" -a "x${with_gtk_prefix}" != "x"
2353   then
2354     GTK_PREFIX="--prefix=$with_gtk_prefix"
2355   fi
2356   if test "x${GTK_CONFIG}" != "xno"
2357   then
2358     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2359     then
2360       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.])
2361     fi
2362     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --cflags gtk gthread`"
2363     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --libs gtk gthread | sed 's,-rdynamic,,'`"
2364     # now look for the gtk.h header
2365     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
2366     ac_cv_gtk_headers=yes
2367     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2368       ac_cv_gtk_headers=no
2369       echo "Cannot find gtk development headers."
2370     ])
2371     if test "x${ac_cv_gtk_headers}" = "xyes"
2372     then
2373       PLUGINS="${PLUGINS} familiar"
2374     fi
2375     CPPFLAGS="${CPPFLAGS_save}"
2376
2377     # now look for gpe support
2378     AC_ARG_WITH(gpe-prefix,
2379     [    --with-gpe-prefix=PATH gpe installation path prefix (default search in \$PATH)],[],[])
2380     if test "x$with_gpe_prefix" != "xno"  -a "x$with_gpe_prefix" != "x"
2381     then
2382       CFLAGS_gpe="-I$with_gpe_prefix/include"
2383       LDFLAGS_gpe="-lXi -lgdk_pixbuf -L$with_gpe_prefix/lib -lgpewidget"
2384       # now look for gpe/init.h header file
2385       CFLAGS_save=$CFLAGS
2386       LDFLAGS_save=$LDFLAGS
2387       CFLAGS="${CFLAGS_familiar} ${CFLAGS_gpe}"
2388       LDFLAGS="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2389       CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar} ${CFLAGS_gpe}"
2390       ac_cv_gpe_headers=yes
2391       AC_CHECK_HEADERS(gpe/init.h, ,
2392         [ ac_cv_gpe_headers=no
2393           AC_MSG_ERROR([Cannot find development headers for libgpewidget...]) ])
2394       CFLAGS=$CFLAGS_save
2395       LDFLAGS=$LDFLAG_save
2396       if test "x${ac_cv_gpe_headers}" = "xyes"
2397       then
2398         CFLAGS_familiar="${CFLAGS_familiar} ${CFLAGS_gpe}"
2399         LDFLAGS_familiar="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2400       fi
2401     else
2402           NEED_GTK_MAIN=yes
2403     fi # end gpe support
2404   fi # end gtk+ support
2405 fi
2406
2407 dnl
2408 dnl  Gnome module
2409 dnl
2410 AC_ARG_ENABLE(gnome,
2411   [  --enable-gnome          Gnome interface support (default disabled)],
2412   [if test "x${enable_gnome}" = "xyes"; then
2413     # look for gnome-config
2414     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
2415     if test -x ${GNOME_CONFIG}
2416     then
2417        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
2418        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
2419     fi
2420     # now look for the gnome.h header
2421     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
2422     AC_CHECK_HEADERS(gnome.h, [
2423       PLUGINS="${PLUGINS} gnome"
2424       NEED_GTK_MAIN=yes
2425       NEED_GNOME_MAIN=yes
2426       ALIASES="${ALIASES} gnome-vlc"
2427       dnl We need this because of some moronic gnomesupport.h flavours
2428       AC_MSG_CHECKING(for strndup in gnome.h)
2429       AC_EGREP_HEADER(strndup,gnome.h,[
2430         AC_MSG_RESULT(yes)
2431         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
2432                   Define if <gnome.h> defines strndup.)],[
2433         AC_MSG_RESULT(no)])
2434      ],[
2435       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
2436 developement tools or remove the --enable-gnome option])
2437      ])
2438     CPPFLAGS="${CPPFLAGS_save}"
2439   fi])
2440
2441 dnl
2442 dnl  Gnome2 module
2443 dnl
2444 AC_ARG_ENABLE(gnome2,
2445   [  --enable-gnome2         Gnome2 support (default disabled)])
2446 if test "x${enable_gnome2}" = "xyes"
2447 then
2448   PKG_CHECK_MODULES(GNOME2, [libgnomeui-2.0])
2449   CFLAGS_gnome2="${CFLAGS_gnome2} ${GNOME2_CFLAGS}"
2450   LDFLAGS_gnome2="${LDFLAGS_gnome2} ${GNOME2_LIBS}"
2451   PLUGINS="${PLUGINS} gnome2"
2452   if test "x${SYS}" != "xmingw32"; then
2453     NEED_GNOME2_MAIN=yes
2454   fi
2455 fi
2456
2457 dnl
2458 dnl  wxWindows module
2459 dnl
2460 AC_ARG_ENABLE(wxwindows,
2461   [  --enable-wxwindows      wxWindows support (default enabled)])
2462 if test "x${enable_wxwindows}" != "xno"
2463 then
2464   WXWINDOWS_PATH="${PATH}"
2465   AC_ARG_WITH(wx-config-path,
2466     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
2467     [ if test "x${with_wx_config_path}" != "xno"
2468       then
2469         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
2470       fi ])
2471   # look for wx-config
2472   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
2473   if test "x${WX_CONFIG}" != "xno"
2474   then
2475     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
2476     then
2477       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.])
2478     fi
2479     CXXFLAGS_wxwindows="${CXXFLAGS_wxwindows} `${WX_CONFIG} --cxxflags`"
2480     LDFLAGS_wxwindows="${LDFLAGS_wxwindows} `${WX_CONFIG} --libs`"
2481     # now look for the wxprec.h header
2482     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
2483     ac_cv_wx_headers=yes
2484     AC_CHECK_HEADERS(wx/wxprec.h, , [
2485       ac_cv_wx_headers=no
2486       echo "Cannot find wxWindows development headers."
2487     ])
2488     if test "x${ac_cv_wx_headers}" = "xyes"
2489     then
2490       PLUGINS="${PLUGINS} wxwindows"
2491       ALIASES="${ALIASES} wxvlc"
2492     fi
2493     CPPFLAGS="${CPPFLAGS_save}"
2494   fi
2495 fi
2496
2497 dnl
2498 dnl  Qt module
2499 dnl
2500 AC_ARG_ENABLE(qt,
2501   [  --enable-qt             Qt interface support (default disabled)],
2502   [if test "x${enable_qt}" = "xyes"; then
2503      PLUGINS="${PLUGINS} qt"
2504      ALIASES="${ALIASES} qvlc"
2505      LDFLAGS_qt="${LDFLAGS_qt} -L${QTDIR}/lib"
2506      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt}"
2507      AC_CHECK_LIB(qt-mt,main,[
2508        LDFLAGS_qt="${LDFLAGS_qt} -lqt-mt"
2509      ],[
2510        AC_CHECK_LIB(qt,main,[
2511          LDFLAGS_qt="${LDFLAGS_qt} -lqt"
2512        ])
2513      ])
2514      LDFLAGS="${LDFLAGS_save}"
2515      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include"
2516      if test -x ${QTDIR}/bin/moc
2517      then
2518        MOC=${QTDIR}/bin/moc
2519      else
2520        MOC=moc
2521      fi
2522    fi])
2523
2524 dnl
2525 dnl  KDE module
2526 dnl
2527 AC_ARG_ENABLE(kde,
2528   [  --enable-kde            KDE interface support (default disabled)],
2529   [if test "x${enable_kde}" = "xyes"; then
2530      PLUGINS="${PLUGINS} kde"
2531      ALIASES="${ALIASES} kvlc"
2532      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib"
2533      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
2534      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2535      AC_CHECK_LIB(kfile,main,[
2536        LDFLAGS_kde="${LDFLAGS_kde} -lkfile"
2537      ])
2538      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2539      AC_CHECK_LIB(kdeui,main,[
2540        LDFLAGS_kde="${LDFLAGS_kde} -lkdeui"
2541      ])
2542      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2543      AC_CHECK_LIB(kio,main,[
2544        LDFLAGS_kde="${LDFLAGS_kde} -lkio"
2545      ])
2546      LDFLAGS="${LDFLAGS_save}"
2547      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt3 -I/usr/include/qt"
2548      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
2549      if test -x ${QTDIR}/bin/moc
2550      then
2551        MOC=${QTDIR}/bin/moc
2552      else
2553        MOC=moc
2554      fi
2555    fi])
2556
2557 dnl
2558 dnl  Opie QT embedded module
2559 dnl
2560 AC_ARG_ENABLE(opie,
2561   [  --enable-opie           Qt embedded interface support (default disabled)],
2562   [if test "x${enable_opie}" = "xyes"; then
2563      AC_ARG_WITH(qte,
2564      [    --with-qte=PATH       Qt Embedded headers and libraries])
2565      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2566      then
2567        LDFLAGS_qte="-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2568        CPPFLAGS_qte="-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2569      else
2570        LDFLAGS_qte="-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`"
2571        CPPFLAGS_qte="-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`"
2572      fi
2573      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2574      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2575        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2576      ] )
2577      CPPFLAGS="${CPPFLAGS_save}"
2578
2579      PLUGINS="${PLUGINS} opie"
2580      NEED_QTE_MAIN=yes
2581      LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
2582      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
2583      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2584      then
2585        MOC=${with_qte}/bin/moc
2586      else
2587        MOC=${QTDIR}/bin/moc
2588      fi
2589    fi])
2590
2591 dnl
2592 dnl  MacOS X module
2593 dnl
2594 AC_ARG_ENABLE(macosx,
2595   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
2596   [if test "x${enable_macosx}" = "xyes"
2597    then
2598      BUILTINS="${BUILTINS} macosx"
2599      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2600    fi],
2601   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
2602      BUILTINS="${BUILTINS} macosx"
2603      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2604    )])
2605
2606 dnl
2607 dnl  QNX RTOS module
2608 dnl
2609 AC_ARG_ENABLE(qnx,
2610   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
2611     if test "x${enable_qnx}" != "xno"
2612     then
2613       AC_CHECK_HEADERS(Ph.h, [
2614         PLUGINS="${PLUGINS} qnx"
2615         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
2616       ])
2617     fi
2618
2619 dnl
2620 dnl  Windows native interface module, built with Borland C++ Builder
2621 dnl
2622 AC_ARG_ENABLE(intfwin,
2623 [  --enable-intfwin        Win32 interface support (default disabled)],
2624 [ if test "x${enable_intfwin}" != "xno"
2625   then
2626     AC_CHECK_TOOL(BPR2MAK, bpr2mak, AC_ERROR(bpr2mak not found))
2627     AC_CHECK_TOOL(BCMAKE, bcmake, AC_ERROR(bcmake not found))
2628     PLUGINS="${PLUGINS} win32"
2629   fi ])
2630
2631 dnl
2632 dnl  ncurses module
2633 dnl
2634 AC_ARG_ENABLE(ncurses,
2635   [  --enable-ncurses        ncurses interface support (default disabled)],
2636   [if test "x${enable_ncurses}" = "xyes"; then
2637      PLUGINS="${PLUGINS} ncurses"
2638      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
2639    fi])
2640
2641 dnl
2642 dnl  XOSD plugin
2643 dnl
2644 AC_ARG_ENABLE(xosd,
2645   [  --enable-xosd           xosd interface support (default disabled)])
2646 if test "x${enable_xosd}" = "xyes"
2647 then
2648   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2649   AC_CHECK_LIB(xosd,xosd_set_offset,
2650       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
2651     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
2652         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
2653       AC_TRY_COMPILE([#include <xosd.h>],
2654          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2655           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
2656   if test "x${have_xosd}" = "xtrue"
2657   then
2658     PLUGINS="${PLUGINS} xosd"
2659     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2660   fi
2661 fi
2662
2663 dnl
2664 dnl  SLP access plugin
2665 dnl
2666 AC_ARG_ENABLE(slp,
2667   [  --enable-slp            SLP service discovery support (default enabled)])
2668 if test "x${enable_slp}" != "xno"
2669 then
2670   AC_ARG_WITH(slp,
2671   [    --with-slp=PATH       libslp headers and libraries])
2672   if test "x${with_slp}" = x
2673   then
2674     AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
2675     if test "x${have_slp}" = "xtrue"
2676     then
2677       PLUGINS="${PLUGINS} slp"
2678       LDFLAGS_slp="${LDFLAGS_slp} -lslp"
2679     fi
2680   else
2681     AC_MSG_CHECKING(for slp headers in ${with_slp})
2682     if test -f ${with_slp}/slp.h
2683     then
2684       dnl  Use ${with_slp}/libslp/slp.h
2685       AC_MSG_RESULT(yes)
2686       PLUGINS="${PLUGINS} slp"
2687       LDFLAGS_slp="${LDFLAGS_slp} -L${with_slp} -lslp"
2688       CPPFLAGS_slp="${CPPFLAGS_slp} -I${with_slp}"
2689     else
2690       dnl  No libslp could be found, sorry
2691       AC_MSG_RESULT(no)
2692       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
2693     fi
2694   fi
2695 fi
2696
2697 dnl
2698 dnl  Lirc plugin
2699 dnl
2700 AC_ARG_ENABLE(lirc,
2701   [  --enable-lirc           lirc support (default disabled)])
2702 if test "x${enable_lirc}" = "xyes"
2703 then
2704   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2705   if test "x${have_lirc}" = "xtrue"
2706   then
2707     PLUGINS="${PLUGINS} lirc"
2708     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2709   fi
2710 fi
2711
2712 AC_ARG_WITH(,[Misc options:])
2713
2714 dnl
2715 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2716 dnl
2717 dnl  We give the user the opportunity to specify
2718 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2719 dnl
2720 AC_ARG_WITH(words,
2721   [  --with-words=endianness set endianness (big or little)])
2722   case "x${with_words}" in
2723     xbig)
2724       ac_cv_c_bigendian=yes
2725       ;;
2726     xlittle)
2727       ac_cv_c_bigendian=no
2728       ;;
2729     *)
2730       dnl  Try to guess endianness by matching patterns on a compiled
2731       dnl  binary, by looking for an ASCII or EBCDIC string
2732       AC_CACHE_CHECK([whether the byte order is big-endian],
2733         [ac_cv_c_bigendian],
2734         [ac_cv_c_bigendian="unknown"
2735         [cat >conftest.c <<EOF
2736         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2737         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2738         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2739         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2740         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2741         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2742         int main(void) { _a(); _e(); return 0; }
2743 EOF
2744         ]
2745         if test -f conftest.c
2746         then
2747           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2748               && test -f conftest.o
2749           then
2750             if test "`strings conftest.o | grep BIGenDianSyS`"
2751             then
2752               ac_cv_c_bigendian="yes"
2753             fi
2754             if test "`strings conftest.o | grep LiTTleEnDian`"
2755             then
2756               ac_cv_c_bigendian="no"
2757             fi
2758           fi
2759         fi
2760       ])
2761       if test "x${ac_cv_c_bigendian}" = "xunknown"
2762       then
2763         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
2764       fi
2765       ;;
2766   esac
2767 dnl  Now we know what to use for endianness, just put it in the header
2768 if test "${ac_cv_c_bigendian}" = "yes"
2769 then
2770   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
2771 fi
2772
2773 dnl
2774 dnl  Mozilla plugin
2775 dnl
2776 mozilla=false
2777 AC_ARG_ENABLE(mozilla,
2778   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2779 if test "x${enable_mozilla}" = "xyes"
2780 then
2781   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2782   if test "x${MOZILLA_CONFIG}" != "xno"
2783   then
2784     if test "x${SYS}" != "xmingw32"; then
2785       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
2786       AC_CHECK_LIB(Xt,XtStrings,[
2787         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
2788       ])
2789       LDFLAGS="${LDFLAGS_save}"
2790     fi
2791     mozilla=:
2792     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2793     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2794     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2795     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2796     dnl Not necessarily in ${PATH}
2797     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
2798     then
2799       XPIDL="/usr/lib/mozilla/xpidl"
2800     fi
2801   fi
2802 fi
2803 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
2804
2805 dnl
2806 dnl  test plugins
2807 dnl
2808 AC_ARG_ENABLE(testsuite,
2809   [  --enable-testsuite      build test modules (default disabled)])
2810 if test "x${enable_testsuite}" = "xyes"
2811 then
2812   TESTS="test1 test2 test3 test4"
2813
2814   dnl  we define those so that bootstrap sets the right linker
2815   CXXFLAGS_test2="${CXXFLAGS_test2}"
2816   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
2817   dnl  this one is needed until automake knows what to do
2818   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
2819
2820   PLUGINS="${PLUGINS} ${TESTS}"
2821   #BUILTINS="${BUILTINS} ${TESTS}"
2822 fi
2823
2824 dnl
2825 dnl  gtk_main plugin
2826 dnl
2827 if test "x${NEED_GTK_MAIN}" != "xno"
2828 then
2829     PLUGINS="${PLUGINS} gtk_main"
2830     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
2831     CFLAGS_familiar="${CFLAGS_familiar} -DNEED_GTK_MAIN"
2832     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
2833     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
2834 fi
2835
2836 if test "x${NEED_GNOME_MAIN}" != "xno"
2837 then
2838     PLUGINS="${PLUGINS} gnome_main"
2839     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
2840     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
2841 fi
2842
2843 if test "x${NEED_GTK2_MAIN}" != "xno"
2844 then
2845     PLUGINS="${PLUGINS} gtk2_main"
2846     CFLAGS_gtk2="${CFLAGS_gtk2} -DNEED_GTK2_MAIN"
2847     CFLAGS_gtk2_main="${CFLAGS_gtk2_main} ${CFLAGS_gtk2}"
2848     LDFLAGS_gtk2_main="${LDFLAGS_gtk2_main} ${LDFLAGS_gtk2}"
2849 fi
2850
2851 if test "x${NEED_GNOME2_MAIN}" != "xno"
2852 then
2853     PLUGINS="${PLUGINS} gnome2_main"
2854     CFLAGS_gnome2_main="${CFLAGS_gnome2_main} ${CFLAGS_gtk2} ${CFLAGS_gnome2}"
2855     LDFLAGS_gnome2_main="${LDFLAGS_gnome2_main} ${LDFLAGS_gtk2} ${LDFLAGS_gnome2}"
2856 fi
2857
2858 dnl
2859 dnl  qte_main plugin
2860 dnl
2861 if test "x${NEED_QTE_MAIN}" != "xno"
2862 then
2863     PLUGINS="${PLUGINS} qte_main"
2864     CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
2865         CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
2866     CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
2867     LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
2868 fi
2869
2870
2871 dnl
2872 dnl  Plugin and builtin checks
2873 dnl
2874 builtin_support=false
2875 plugin_support=:
2876
2877 dnl Support for plugins - this must be AT THE END
2878 AC_ARG_ENABLE(plugins,
2879   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
2880   [if test "x${enable_plugins}" = "xno"
2881    then
2882      plugin_support=false
2883    fi])
2884
2885 dnl Automagically disable plugins if there is no system support for
2886 dnl dynamically loadable files (.so, .dll, .dylib).
2887 dnl don't forget vlc-win32 still can load .dll as plugins
2888 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2889 then
2890   echo "*** Your system doesn't have plugin support. All plugins will be built"
2891   echo "statically."
2892   plugin_support=false
2893 fi
2894
2895 dnl Export automake variables
2896 if ${plugin_support}
2897 then
2898   for plugin in `echo ${PLUGINS}`
2899   do
2900     eval "${plugin}_plugin=yes"
2901   done
2902 else
2903   BUILTINS="${BUILTINS} ${PLUGINS}"
2904   PLUGINS=
2905 fi
2906 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
2907
2908 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
2909 then
2910   builtin_support=:
2911   for builtin in `echo ${BUILTINS}`
2912   do
2913     eval "${builtin}_builtin=yes"
2914   done
2915 fi]
2916 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
2917
2918 dnl do not touch this line (bootstrap needs it)
2919
2920
2921 dnl
2922 dnl  Stuff used by the program
2923 dnl
2924 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
2925 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
2926 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2927
2928 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`"
2929 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2930 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2931 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
2932
2933 DATA_PATH="${ac_tool_prefix}/share/vlc"
2934 AC_SUBST(DATA_PATH)
2935 PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
2936 AC_SUBST(PLUGIN_PATH)
2937
2938 dnl
2939 dnl  Restore *FLAGS
2940 dnl
2941 CPPFLAGS="${CPPFLAGS_save}"
2942 CFLAGS="${CFLAGS_save}"
2943 CXXFLAGS="${CXXFLAGS_save}"
2944 OBJCFLAGS="${OBJCFLAGS_save}"
2945 LDFLAGS="${LDFLAGS_save}"
2946
2947 dnl
2948 dnl  Fool automake (see Makefile.am)
2949 dnl
2950 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
2951 AC_SUBST(AUTOMAKE_SUCKS)
2952
2953 dnl
2954 dnl  Create the vlc-config script
2955 dnl
2956 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
2957 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
2958
2959 dnl
2960 dnl  Configuration is finished
2961 dnl
2962 AC_SUBST(SYS)
2963 AC_SUBST(ARCH)
2964 AC_SUBST(PLUGINS)
2965 AC_SUBST(BUILTINS)
2966 AC_SUBST(ALIASES)
2967 AC_SUBST(ASM)
2968 AC_SUBST(MOC)
2969 AC_SUBST(WINDRES)
2970 AC_SUBST(XPIDL)
2971 AC_SUBST(LIBEXT)
2972 AC_SUBST(INCLUDES)
2973 AC_SUBST(ALL_LINGUAS)
2974
2975 AC_SUBST(CFLAGS_TUNING)
2976 AC_SUBST(CFLAGS_OPTIM)
2977 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2978 AC_SUBST(CFLAGS_NOOPTIM)
2979 AC_SUBST(LDFLAGS)
2980
2981 AC_SUBST(CFLAGS_vlc)
2982 AC_SUBST(CFLAGS_pics)
2983 AC_SUBST(CXXFLAGS_pics)
2984 AC_SUBST(CFLAGS_plugins)
2985 AC_SUBST(CXXFLAGS_plugins)
2986 AC_SUBST(CFLAGS_builtins)
2987 AC_SUBST(CPPFLAGS_mozilla)
2988
2989 AC_SUBST(LDFLAGS_vlc)
2990 AC_SUBST(LDFLAGS_libvlc)
2991 AC_SUBST(LDFLAGS_plugins)
2992 AC_SUBST(LDFLAGS_builtins)
2993 AC_SUBST(LDFLAGS_mozilla)
2994
2995 AC_OUTPUT([
2996   Makefile
2997   autotools/Makefile
2998   debian/Makefile
2999   doc/Makefile
3000   intl/Makefile
3001   ipkg/Makefile
3002   lib/Makefile
3003   m4/Makefile
3004   modules/Makefile
3005   po/Makefile.in
3006   share/Makefile
3007   src/Makefile
3008   vlc-config
3009 ],[
3010   chmod a+x vlc-config
3011 ])
3012
3013 printf "
3014 vlc configuration
3015 --------------------
3016 vlc version           : ${VERSION}
3017 system                : ${SYS}
3018 architecture          : ${ARCH}
3019 build flavour         : "
3020 test "x${DEBUG_TRUE}" = "x" && printf "debug "
3021 test "x${CPROF_TRUE}" = "x" && printf "cprof "
3022 test "x${GPROF_TRUE}" = "x" && printf "gprof "
3023 test "x${OPTIM_TRUE}" = "x" && printf "optim "
3024 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
3025 echo "
3026 vlc aliases           :${ALIASES}
3027
3028 To build vlc and its plugins, type \`make'.
3029 "
3030