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