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