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