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