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