* ./configure.in: we now require autoconf 2.5x because previous versions
[vlc.git] / configure.in
1 dnl Autoconf settings for vlc
2 AC_INIT(configure.in)
3
4 AC_PREREQ(2.50)
5 AC_CANONICAL_SYSTEM
6
7 CONFIGURE_LINE="$0 $*"
8
9 PACKAGE="vlc"
10 VERSION="0.5.0-cvs"
11 CODENAME="Natalya"
12
13 AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
14 AM_CONFIG_HEADER(config.h)
15
16 dnl
17 dnl  Save *FLAGS
18 dnl
19 save_CPPFLAGS="${CPPFLAGS}"
20 save_CFLAGS="${CFLAGS}"
21 save_LDFLAGS="${LDFLAGS}"
22
23 dnl
24 dnl Check for tools
25 dnl
26 AC_PROG_CC
27 AC_PROG_CPP
28 AC_PROG_MAKE_SET
29 AC_PROG_INSTALL
30
31 dnl Find the right ranlib, even when cross-compiling
32 AC_CHECK_TOOL(RANLIB, ranlib, :)
33 AC_CHECK_TOOL(STRIP, strip, :)
34
35 dnl
36 dnl Check for GNU make
37 dnl
38 AC_PATH_PROG(GMAKE, gmake, no)
39 if test "x${GMAKE}" = "xno"; then
40   AC_CACHE_CHECK([whether GNU make is installed],
41       [ac_cv_gmake],
42       [if make --version | grep -q -i gnu; then
43          ac_cv_gmake="yes"
44        else
45          echo "This software needs you to install GNU make to compile properly."
46          echo "You can get it from http://www.gnu.org/."
47          exit
48        fi])
49   VLC_MAKE="make"
50 else
51   VLC_MAKE="gmake"
52 fi
53
54 dnl Gettext stuff
55 ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
56
57 AC_DEFINE_UNQUOTED(VLC_PACKAGE, "${PACKAGE}", [Package name])
58 AC_DEFINE_UNQUOTED(VLC_VERSION, "${VERSION}", [Package version])
59 AM_GNU_GETTEXT_VERSION(0.10.40)
60 AM_GNU_GETTEXT
61
62 dnl AM_PROG_LIBTOOL
63 AC_PROG_INSTALL
64
65 dnl Check for compiler properties
66 AC_C_CONST
67 AC_C_INLINE
68
69 dnl
70 dnl  Set default LDFLAGS
71 dnl
72 vlc_LDFLAGS="${LDFLAGS}"
73
74 dnl
75 dnl  Check the operating system
76 dnl
77 case "x${target_os}" in
78   x)
79     SYS=unknown
80     ;;
81   xlinux*)
82     SYS=linux
83     ;;
84   xbsdi*)
85     SYS=bsdi
86     save_CFLAGS="${save_CFLAGS} -pthread"; CFLAGS="${save_CFLAGS}"
87     dvd_LDFLAGS="${dvd_LDFLAGS} -ldvd"
88     vcd_LDFLAGS="${vcd_LDFLAGS} -ldvd"
89     ;;
90   x*bsd*)
91     SYS="${target_os}"
92     save_CFLAGS="${save_CFLAGS} -pthread"; CFLAGS="${save_CFLAGS}"
93     ;;
94   xdarwin*)
95     SYS=darwin
96     save_CFLAGS="${save_CFLAGS} -no-cpp-precomp"; CFLAGS="${save_CFLAGS}"
97     vlc_LDFLAGS="${vlc_LDFLAGS} -all_load"
98     ;;
99   x*mingw32*)
100     SYS=mingw32
101     AC_CHECK_TOOL(WINDRES, windres, :)
102     save_CFLAGS="${save_CFLAGS} -fnative-struct -D_OFF_T_ -D_off_t=long"; CFLAGS="${save_CFLAGS}"
103     vlc_LDFLAGS="${vlc_LDFLAGS} -mwindows -Xlinker --force-exe-suffix"
104     vlc_LDFLAGS="${vlc_LDFLAGS} -lws2_32 -lnetapi32"
105     ipv4_LDFLAGS="${ipv4_LDFLAGS} -lws2_32"
106     ipv6_LDFLAGS="${ipv6_LDFLAGS} -lws2_32"
107     http_LDFLAGS="${http_LDFLAGS} -lws2_32"
108     rc_LDFLAGS="${rc_LDFLAGS} -lws2_32"
109     ;;
110   x*nto*)
111     SYS=nto
112     x11_LDFLAGS="${x11_LDFLAGS} -lsocket"
113     xvideo_LDFLAGS="${xvideo_LDFLAGS} -lsocket"
114     ;;
115   xsolaris*)
116     SYS=solaris
117     ;;
118   xbeos)
119     SYS=beos
120     save_CFLAGS="${save_CFLAGS} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CFLAGS="${save_CFLAGS}"
121     vlc_LDFLAGS="${vlc_LDFLAGS} -lbe"
122     plugins_LDFLAGS="${plugins_LDFLAGS} -nostart"
123     beos_LDFLAGS="${beos_LDFLAGS} -lbe -lgame -lroot -ltracker -lstdc++.r4"
124     ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind"
125     ;;
126   x*)
127     SYS="${target_os}"
128     ;;
129 esac
130
131 dnl Flags for plugin compilation
132 if test "x${SYS}" = "xmingw32"
133 then
134   plugins_CFLAGS="${plugins_CFLAGS} -fnative-struct"
135 else
136   plugins_CFLAGS="${plugins_CFLAGS} -fPIC"
137   plugins_LDFLAGS="${plugins_LDFLAGS} -fPIC"
138 fi
139
140 dnl The -DSYS_FOO flag
141 save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CFLAGS="${save_CFLAGS}"
142
143 dnl Check for system libs needed
144 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll strndup)
145
146 AC_CHECK_FUNC(connect,,[
147   AC_CHECK_LIB(socket,connect,
148     ipv4_LDFLAGS="${ipv4_LDFLAGS} -lsocket"
149     vlc_LDFLAGS="${vlc_LDFLAGS} -lsocket"
150 )])
151 AC_CHECK_FUNC(send,,[
152   AC_CHECK_LIB(socket,send,
153     http_LDFLAGS="${http_LDFLAGS} -lsocket"
154 )])
155 AC_CHECK_FUNC(gethostbyname,,[
156   AC_CHECK_LIB(nsl,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lnsl",[
157     AC_CHECK_LIB(bind,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind")])
158 ])
159 have_nanosleep=0
160 AC_CHECK_FUNC(nanosleep,have_nanosleep=1,[
161   AC_CHECK_LIB(rt,nanosleep,
162     [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"; have_nanosleep=1],
163     [AC_CHECK_LIB(posix4,nanosleep,
164         [vlc_LDFLAGS="${vlc_LDFLAGS} -lposix4"; have_nanosleep=1])]
165   )
166 ])
167 if test x$have_nanosleep = x1; then
168   AC_DEFINE(HAVE_NANOSLEEP, 1,
169             Define if nanosleep is available.)
170 fi
171 # HP/UX port
172 AC_CHECK_LIB(rt,sem_init, [vlc_LDFLAGS="${vlc_LDFLAGS} -lrt"])
173
174 AC_CHECK_FUNC(inet_aton,,[
175   AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
176 ])
177 AC_CHECK_FUNC(textdomain,,[
178   AC_CHECK_LIB(intl,textdomain,
179     vlc_LDFLAGS="${vlc_LDFLAGS} -lintl"
180     plugins_LDFLAGS="${plugins_LDFLAGS} -lintl"
181   )
182 ])
183
184 dnl Check for getopt
185 NEED_GETOPT=0
186 AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
187 [ # FreeBSD has a gnugetopt library for this:
188   AC_CHECK_LIB([gnugetopt],[getopt_long],
189     [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) vlc_LDFLAGS="${vlc_LDFLAGS} -lgnugetopt"],
190     [NEED_GETOPT=1])])
191
192 AC_TYPE_SIGNAL
193 AC_CHECK_LIB(dl,dlopen,vlc_LDFLAGS="${vlc_LDFLAGS} -ldl")
194 AC_CHECK_LIB(m,cos,
195   imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
196   filter_distort_LDFLAGS="${filter_distort_LDFLAGS} -lm")
197 AC_CHECK_LIB(m,pow,
198   ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lm"
199   imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
200   imdct3dn_LDFLAGS="${imdct3dn_LDFLAGS} -lm"
201   imdctsse_LDFLAGS="${imdctsse_LDFLAGS} -lm"
202   i420_rgb_LDFLAGS="${i420_rgb_LDFLAGS} -lm"
203   faad_LDFLAGS="${faad_LDFLAGS} -lm"
204 )
205
206 dnl Check for pthreads - borrowed from XMMS
207 THREAD_LIB=error
208 if test "x${THREAD_LIB}" = "xerror"; then
209   AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
210 fi
211 if test "x${THREAD_LIB}" = "xerror"; then
212   AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
213 fi
214 if test "x${THREAD_LIB}" = "xerror"; then
215   AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
216 fi
217 if test "x${THREAD_LIB}" = "xerror"; then
218   AC_CHECK_FUNC(pthread_mutex_lock)
219   THREAD_LIB=""
220 fi
221
222 dnl Check for cthreads under GNU/Hurd for instance
223 AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
224
225 dnl Check for misc headers
226 AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
227   AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
228             Define if <pthread.h> defines pthread_cond_t.)])
229 AC_EGREP_HEADER(pthread_once,pthread.h,[
230   AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
231             Define if <pthread.h> defines pthread_once.)])
232 AC_EGREP_HEADER(strncasecmp,strings.h,[
233   AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
234             Define if <strings.h> defines strncasecmp.)])
235
236 dnl Check for headers
237 AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
238 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
239 AC_CHECK_HEADERS(dlfcn.h image.h)
240 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
241 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
242 AC_CHECK_HEADERS(linux/version.h)
243
244 AC_HEADER_TIME
245
246 dnl Mac OS X and other OSes don't have declaration for nanosleep
247 AC_EGREP_HEADER(nanosleep,time.h,[
248   AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
249             Define if <time.h> defines nanosleep.)
250 ])
251
252 dnl Make sure we have timespecs
253 AC_EGREP_HEADER(timespec,sys/time.h,[
254   AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
255             Define if <sys/time.h> defines struct timespec.)
256 ])
257
258 dnl Check for threads library
259 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
260
261 dnl Default X headers and libraries
262 if test "x${x_includes}" = "xNONE"; then
263   x_includes="/usr/X11R6/include"
264 fi
265 if test "x${x_libraries}" = "xNONE"; then
266   x_libraries="/usr/X11R6/lib"
267 fi
268
269 dnl Build the gtk_main plugin?
270 NEED_GTK_MAIN=no
271
272 dnl Check for DPMS
273 if test "x${SYS}" != "xmingw32"
274 then
275   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
276   AC_CHECK_HEADERS(X11/extensions/dpms.h, [
277     AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
278       AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
279                 Define if <X11/extensions/dpms.h> defines DPMSInfo.)
280     ])
281   ])
282   CPPFLAGS="${save_CPPFLAGS}"
283 fi
284
285 dnl Check for ntohl, etc.
286 AC_CACHE_CHECK([for ntohl in sys/param.h],
287     [ac_cv_c_ntohl_sys_param_h],
288     [CFLAGS="${save_CFLAGS} -Wall -Werror"
289      AC_TRY_COMPILE([#include <sys/param.h>],
290         [void foo() { int meuh; ntohl(meuh); }],
291         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
292 if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
293     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
294 fi
295
296 dnl Check for inline function size limit
297 AC_CACHE_CHECK([if \$CC accepts -finline-limit],
298     [ac_cv_c_inline_limit],
299     [CFLAGS="${save_CFLAGS} -finline-limit-30000"
300      AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
301 if test "x${ac_cv_c_inline_limit}" != "xno"; then
302     save_CFLAGS="${save_CFLAGS} -finline-limit-30000"; CFLAGS="${save_CFLAGS}"
303 fi
304
305 dnl Check for -W or -w flags
306 AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
307     [ac_cv_c_Wall_Winline],
308     [CFLAGS="-Wall -Winline ${save_CFLAGS}"
309      AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
310 if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
311     save_CFLAGS="-Wall -Winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
312 else
313     AC_CACHE_CHECK([if \$CC accepts -wall -winline],
314         [ac_cv_c_wall_winline],
315         [CFLAGS="-wall -winline ${save_CFLAGS}"
316          AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
317     if test "x${ac_cv_c_wall_winline}" != "xno"; then
318         save_CFLAGS="-wall -winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
319     fi
320 fi
321
322 dnl Check for -pipe
323 AC_CACHE_CHECK([if \$CC accepts -pipe],
324     [ac_cv_c_pipe],
325     [CFLAGS="${save_CFLAGS} -pipe"
326      AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
327 if test "x${ac_cv_c_pipe}" != "xno"; then
328     save_CFLAGS="${save_CFLAGS} -pipe"; CFLAGS="${save_CFLAGS}"
329 fi
330
331 dnl Check for various optimization flags
332 AC_CACHE_CHECK([if \$CC accepts -O3],
333     [ac_cv_c_o3],
334     [CFLAGS="${save_CFLAGS} -O3"
335      AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
336 if test "x${ac_cv_c_o3}" != "xno"; then
337     CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
338 else
339     AC_CACHE_CHECK([if \$CC accepts -O2],
340         [ac_cv_c_o2],
341         [CFLAGS="${save_CFLAGS} -O2"
342          AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
343     if test "x${ac_cv_c_o2}" != "xno"; then
344         CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
345     else
346         AC_CACHE_CHECK([if \$CC accepts -O],
347             [ac_cv_c_o],
348             [CFLAGS="${save_CFLAGS} -O"
349              AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
350         if test "x${ac_cv_c_o}" != "xno"; then
351             CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
352         fi
353     fi
354 fi
355
356 dnl Check for -ffast-math
357 AC_CACHE_CHECK([if \$CC accepts -ffast-math],
358     [ac_cv_c_fast_math],
359     [CFLAGS="${save_CFLAGS} -ffast-math"
360      AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
361 if test "x${ac_cv_c_fast_math}" != "xno"; then
362     CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
363 fi
364
365 dnl Check for -funroll-loops
366 AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
367     [ac_cv_c_unroll_loops],
368     [CFLAGS="${save_CFLAGS} -funroll-loops"
369      AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
370 if test "x${ac_cv_c_unroll_loops}" != "xno"; then
371     CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
372 fi
373
374 dnl Check for -fomit-frame-pointer
375 AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
376     [ac_cv_c_omit_frame_pointer],
377     [CFLAGS="${save_CFLAGS} -fomit-frame-pointer"
378      AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
379 if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
380     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
381     # this plugin does not compile without -fomit-frame-pointer, damn gcc!
382     i420_yuy2_mmx_CFLAGS="${i420_yuy2_mmx_CFLAGS} -fomit-frame-pointer"
383 fi
384
385 dnl Check for Darwin plugin linking flags
386 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
387     [ac_cv_ld_darwin],
388     [CFLAGS="${save_CFLAGS} -bundle -undefined error -lcc_dynamic"
389      AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
390 if test "x${ac_cv_ld_darwin}" != "xno"; then
391     plugins_LDFLAGS="${plugins_LDFLAGS} -bundle -undefined error -lcc_dynamic"
392 fi
393
394 dnl Check for standard plugin linking flags
395 AC_CACHE_CHECK([if \$CC accepts -shared],
396     [ac_cv_ld_plugins],
397     [CFLAGS="${save_CFLAGS} -shared"
398      AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
399 if test "x${ac_cv_ld_plugins}" != "xno"; then
400     plugins_LDFLAGS="${plugins_LDFLAGS} -shared"
401 fi
402         
403 dnl Check for variadic macros
404 AC_CACHE_CHECK([for variadic cpp macros],
405     [ac_cv_cpp_variadic_macros],
406     [CFLAGS="${save_CFLAGS}"
407      AC_TRY_COMPILE(
408          [#include <stdio.h>
409           #define a(b,c...) printf(b,##c)],
410          [a("foo");a("%s","bar");a("%s%s","baz","quux");],
411          ac_cv_cpp_variadic_macros=yes,
412          ac_cv_cpp_variadic_macros=no)])
413 if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
414     AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
415 fi
416
417 dnl Checks for __attribute__(aligned()) directive
418 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
419     [ac_cv_c_attribute_aligned],
420     [ac_cv_c_attribute_aligned=0
421         CFLAGS="${save_CFLAGS} -Werror"
422     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
423         AC_TRY_COMPILE([],
424         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
425         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
426     done
427         CFLAGS="${save_CFLAGS}"])
428 if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
429     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
430         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
431 fi
432
433 dnl
434 dnl  Check the CPU
435 dnl
436 case "x${target_cpu}" in
437   x)
438     ARCH=unknown
439     ;;
440   *)
441     ARCH="${target_cpu}"
442     ;;
443 esac
444
445 dnl
446 dnl  default modules
447 dnl
448 BUILTINS="${BUILTINS}"
449 PLUGINS="${PLUGINS} misc/dummy/dummy misc/null"
450 PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file misc/memcpy/memcpy"
451 PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
452 PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif codec/mpeg_audio/mpeg_audio"
453 PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old"
454 #PLUGINS="${PLUGINS} codec/lpcm/lpcm"
455 PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop"
456 PLUGINS="${PLUGINS} audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif audio_filter/converter/fixed32tofloat32 audio_filter/converter/fixed32tos16 audio_filter/converter/s16tofloat32"
457 PLUGINS="${PLUGINS} audio_filter/resampler/trivial audio_filter/resampler/ugly"
458 PLUGINS="${PLUGINS} audio_filter/channel_mixer/trivial"
459 PLUGINS="${PLUGINS} audio_mixer/trivial audio_mixer/spdif"
460 PLUGINS="${PLUGINS} audio_output/file"
461 #PLUGINS="${PLUGINS} visualization/scope/scope"
462 PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga"
463 PLUGINS="${PLUGINS} demux/util/id3"
464 dnl
465 dnl  Network modules
466 dnl
467 NETWORK_MODULES="access/udp access/http access/rtp misc/network/ipv4"
468
469 dnl
470 dnl  Accelerated modules
471 dnl
472 MMX_MODULES="misc/memcpy/memcpymmx codec/mpeg_video/idct/idctmmx codec/mpeg_video/motion/motionmmx video_chroma/i420_rgb_mmx video_chroma/i420_yuy2_mmx video_chroma/i422_yuy2_mmx video_chroma/i420_ymga_mmx"
473 MMXEXT_MODULES="misc/memcpy/memcpymmxext codec/mpeg_video/idct/idctmmxext codec/mpeg_video/motion/motionmmxext"
474 THREEDNOW_MODULES="misc/memcpy/memcpy3dn codec/a52old/imdct/imdct3dn codec/a52old/downmix/downmix3dn"
475 SSE_MODULES="codec/a52old/imdct/imdctsse codec/a52old/downmix/downmixsse"
476 ALTIVEC_MODULES="codec/mpeg_video/idct/idctaltivec codec/mpeg_video/motion/motionaltivec misc/memcpy/memcpyaltivec"
477
478 if test x$SYS != xbeos
479 then
480   PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
481 fi
482
483 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
484     [ac_cv_mmx_inline],
485     [CFLAGS="${save_CFLAGS}"
486      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
487                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
488 if test "x${ac_cv_mmx_inline}" != "xno"; then
489   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
490 fi
491
492 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
493     [ac_cv_mmxext_inline],
494     [CFLAGS="${save_CFLAGS}"
495      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
496                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
497 if test "x${ac_cv_mmxext_inline}" != "xno"; then
498   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
499 fi
500
501 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
502     [ac_cv_3dnow_inline],
503     [CFLAGS="${save_CFLAGS}"
504      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
505                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
506 if test "x${ac_cv_3dnow_inline}" != "xno"; then
507   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
508   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
509 fi
510
511 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
512     [ac_cv_sse_inline],
513     [CFLAGS="${save_CFLAGS}"
514      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
515                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
516 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
517   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
518   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
519 fi
520
521 # don't try to grok AltiVec with native mingw32 it doesn't work right now
522 # we should be able to remove this test with future versions of mingw32
523 if test "x${SYS}" != "xmingw32"; then
524 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
525     [ac_cv_altivec_inline],
526     [CFLAGS="${save_CFLAGS}"
527      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
528          ac_cv_altivec_inline=yes,
529          [CFLAGS="${save_CFLAGS} -Wa,-m7400"
530           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
531             [ac_cv_altivec_inline="-Wa,-m7400"],
532             ac_cv_altivec_inline=no)
533          ])])
534 if test "x${ac_cv_altivec_inline}" != "xno"; then
535   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
536   if test "x${ac_cv_altivec_inline}" != "xyes"; then
537     idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_altivec_inline}"
538     motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_altivec_inline}"
539     memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_altivec_inline}"
540     vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_altivec_inline}"
541   fi
542   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
543 fi
544
545 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
546     [ac_cv_c_altivec],
547     [CFLAGS="${save_CFLAGS} -faltivec"
548      # Darwin test
549      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
550         ac_cv_c_altivec=-faltivec, [
551         # Linux/PPC test
552         CFLAGS="${save_CFLAGS} ${idctaltivec_CFLAGS} -fvec"
553         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
554             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
555         ])
556      CFLAGS="${save_CFLAGS}"])
557 if test "x${ac_cv_c_altivec}" != "xno"; then
558   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
559   idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_c_altivec}"
560   motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_c_altivec}"
561   memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_c_altivec}"
562   vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_c_altivec}"
563   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
564 fi
565
566 AC_CACHE_CHECK([if linker needs -framework vecLib],
567     [ac_cv_ld_altivec],
568     [LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
569      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
570      LDFLAGS="${save_LDFLAGS}"
571     ])
572 if test "x${ac_cv_ld_altivec}" != "xno"; then
573   idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
574   motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
575   memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
576   vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
577 fi
578 fi # end if mingw32
579
580
581 AC_ARG_WITH(,[])
582 AC_ARG_WITH(,[Optimization options:])
583
584 dnl
585 dnl  Special arch tuning
586 dnl
587 AC_ARG_WITH(tuning,
588 [  --with-tuning=ARCH      enable special tuning for an architecture
589                           (default i686 on IA-32 and 750 on PPC)])
590 if test "x${with_tuning}" != "x"; then
591     TUNING="${with_tuning}"
592 else
593     if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then TUNING="pentiumpro"
594     else
595         if test "x${target_cpu}" = "xpowerpc"; then TUNING="750"; fi
596     fi
597 fi
598
599 dnl
600 dnl  x86 accelerations
601 dnl
602 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
603 then
604     ARCH="${ARCH} mmx"
605     PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
606 fi
607
608 dnl
609 dnl  Enable/disable optimizations
610 dnl
611 AC_ARG_ENABLE(optimizations,
612 [  --disable-optimizations disable compiler optimizations (default enabled)],
613 [ if test "x${enable_optimizations}" = "xno"; then OPTIMS=0; fi ],
614 [ OPTIMS=1 ])
615
616 dnl
617 dnl  AltiVec acceleration
618 dnl
619 AC_ARG_ENABLE(altivec,
620 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
621 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
622     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
623 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
624     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
625
626 dnl
627 dnl  Debugging mode
628 dnl
629 DEBUG=0
630 AC_ARG_ENABLE(debug,
631 [  --enable-debug          debug mode (default disabled)],
632 [ if test "x${enable_debug}" = "xyes"; then DEBUG=1; fi ])
633
634 dnl
635 dnl  Enable release-specific flags
636 dnl
637 RELEASE=0
638 AC_ARG_ENABLE(release,
639 [  --enable-release        activate extra optimizations (default disabled)],
640 [ if test "x${enable_release}" = "xyes"; then RELEASE=1; fi ],
641 [ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
642
643 dnl
644 dnl  Input plugins
645 dnl
646
647 AC_ARG_WITH(,[Input plugins:])
648
649 dnl
650 dnl  DVD module: optionally check for installed libdvdcss
651 dnl
652 AC_ARG_ENABLE(dvd,
653 [  --enable-dvd            DVD input module (default enabled)])
654 if test "x${enable_dvd}" != "xno"
655 then
656   AC_ARG_WITH(dvdcss, 
657   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
658   AC_ARG_WITH(dvdcss-tree, 
659   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
660   case "x${with_dvdcss}" in
661   x|xyes)
662     if test "x${with_dvdcss_tree}" = x
663     then
664       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
665         [ PLUGINS="${PLUGINS} access/dvd/dvd"
666           dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
667         [ 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.])
668           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
669     else
670       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
671       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
672       if test "x${real_dvdcss_tree}" = "x"
673       then
674         dnl  The given directory can't be found
675         AC_MSG_RESULT(no)
676         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
677       fi
678       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
679       then
680         dnl  Use a custom libdvdcss
681         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
682         BUILTINS="${BUILTINS} access/dvd/dvd"
683         dvd_LDFLAGS="${dvd_LDFLAGS} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
684         dvd_CFLAGS="${dvd_CFLAGS} -I${real_dvdcss_tree}/src"
685       else
686         dnl  The given libdvdcss wasn't built
687         AC_MSG_RESULT(no)
688         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
689       fi
690     fi
691   ;;
692   xno)
693     dnl  Compile without dvdcss (dlopen version, works only under Linux)
694     PLUGINS="${PLUGINS} access/dvd/dvd"
695     dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
696     dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
697   ;;
698   *)
699     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
700     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
701     then
702       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
703       AC_MSG_RESULT(yes)
704       PLUGINS="${PLUGINS} access/dvd/dvd"
705       dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
706       dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
707     else
708       dnl  No libdvdcss could be found, sorry
709       AC_MSG_RESULT(no)
710       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
711     fi
712   ;;
713   esac
714 fi
715
716 dnl
717 dnl dvdread module: check for libdvdread plugin
718 dnl
719 AC_ARG_ENABLE(dvdread,
720 [  --enable-dvdread        dvdread input module (default disabled)])
721 if test "x${enable_dvdread}" != "xno"
722 then
723   AC_ARG_WITH(dvdread, 
724   [    --with-dvdread=PATH   libdvdread headers and libraries])
725   if test "x${with_dvdread}" = "x"
726   then
727     test_LDFLAGS=""
728     test_CFLAGS=""
729   else
730     test_LDFLAGS="-L${with_dvdread}/lib"
731     test_CFLAGS="-I${with_dvdread}/include"
732   fi
733   CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
734   AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
735      AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
736         [int foo() { return DVD_VIDEO_LB_LEN; }],[
737           PLUGINS="${PLUGINS} access/dvdread/dvdread"
738           dvdread_LDFLAGS="${dvdread_LDFLAGS} ${test_LDFLAGS} -ldvdread"
739           dvdread_CFLAGS="${dvdread_CFLAGS} ${test_CFLAGS}"
740         ],[
741           if test "x${enable_dvdread}" != "x"
742           then
743             AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
744           fi
745         ])
746   ],[
747     if test "x${enable_dvdread}" != "x"
748     then
749       if test "x${with_dvdread}" != "x"
750       then
751         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
752       else
753         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
754       fi
755     fi
756   ])
757   CPPFLAGS="$save_CPPFLAGS"
758 fi
759
760 dnl
761 dnl dvdplay module: check for libdvdplay
762 dnl
763 AC_ARG_ENABLE(dvdplay,
764 [  --enable-dvdplay        dvdplay input module (default disabled)])
765 if test "x$enable_dvdplay" != "xno"
766 then
767   AC_ARG_WITH(dvdplay, 
768   [    --with-dvdplay=PATH   libdvdplay headers and libraries])
769   if test "x$with_dvdplay" = x
770   then
771     test_LDFLAGS=""
772     test_CFLAGS=""
773   else
774     test_LDFLAGS="-L${with_dvdplay}/lib"
775     test_CFLAGS="-I${with_dvdplay}/include"
776   fi
777   CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
778   AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
779       PLUGINS="${PLUGINS} access/dvdplay/dvdplay"
780       dvdplay_LDFLAGS="${dvdplay_LDFLAGS} ${test_LDFLAGS} -ldvdplay -ldvdread"
781       dvdplay_CFLAGS="${dvdplay_CFLAGS} ${test_CFLAGS}"
782     ],[
783     if test "x$enable_dvdplay" != x
784     then
785       if test "x$with_dvdplay" != x
786       then
787         AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
788       else
789         AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
790       fi
791     fi
792   ])
793   CPPFLAGS="${save_CPPFLAGS}"
794 fi
795
796
797 dnl
798 dnl  libdvbpsi ts demux
799 dnl
800 AC_ARG_ENABLE(dvbpsi,
801 [  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
802 if test "x${enable_dvbpsi}" != "xno"
803 then
804   AC_ARG_WITH(dvbpsi, 
805   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
806   AC_ARG_WITH(dvbpsi,
807   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
808   case "x${with_dvbpsi}" in
809   x|xyes)
810     if test "x${with_dvbpsi_tree}" = "x"
811     then
812       AC_CHECK_HEADERS(dvbpsi/dr.h,
813         [ PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
814           ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} -ldvbpsi" ], [],
815         [  AC_MSG_ERROR([cannot find libdvbpsi headers]) ])
816     else
817       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
818       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
819       if test "x${real_dvbpsi_tree}" = "x"
820       then
821         dnl  The given directory can't be found
822         AC_MSG_RESULT(no)
823         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
824       fi
825       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
826       then
827         dnl  Use a custom libdvbpsi
828         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
829         BUILTINS="${BUILTINS} demux/mpeg/ts_dvbpsi"
830         ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
831         ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} -I${real_dvbpsi_tree}/src"
832       else
833         dnl  The given libdvbpsi wasn't built
834         AC_MSG_RESULT(no)
835         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
836       fi
837     fi
838   ;;
839   xno)
840     dnl  Compile without dvbpsi
841   ;;
842   *)
843     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
844     if test "x${with_dvbpsi}" = "x"
845     then
846       test_LDFLAGS=""
847       test_CFLAGS=""
848     else
849       test_LDFLAGS="-L${with_dvbpsi}/lib"
850       test_CFLAGS="-I${with_dvbpsi}/include"
851     fi
852     CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
853     AC_CHECK_HEADER([dvbpsi/dr.h],[
854       PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
855       ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${test_LDFLAGS} -ldvbpsi"
856       ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} ${test_CFLAGS}"
857       ],[
858       if test "x${enable_dvbpsi}" != "x"
859       then
860         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])
861       fi
862     ])
863     CPPFLAGS="${save_CPPFLAGS}"
864   ;;
865   esac
866 fi
867
868 dnl
869 dnl  Video4Linux plugin
870 dnl
871 AC_ARG_ENABLE(v4l,
872   [  --enable-v4l            Video4Linux input support (default disabled)])
873 if test "x${enable_v4l}" = "xyes"
874 then
875   AC_CHECK_HEADERS(libv4l/v4l.h, [
876     PLUGINS="${PLUGINS} access/v4l/v4l"
877    ],[])
878 fi
879
880 dnl
881 dnl  VCD module
882 dnl
883 AC_ARG_ENABLE(vcd,
884   [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
885
886 if test "x${enable_vcd}" != "xno"
887 then
888   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
889     PLUGINS="${PLUGINS} access/vcd/vcd"
890   ])
891   
892   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
893     PLUGINS="${PLUGINS} access/vcd/vcd"
894     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
895   ])
896   
897   if test "x${SYS}" = "xbsdi"
898   then
899     PLUGINS="${PLUGINS} access/vcd/vcd"
900   fi
901
902   if test "x${SYS}" = "xdarwin"
903   then
904     # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
905     vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
906   fi
907 fi
908
909 dnl
910 dnl  Satellite input module
911 dnl
912 AC_ARG_ENABLE(satellite,
913   [  --enable-satellite      satellite card support (default disabled)],
914   [ if test "x${enable_satellite}" = "xyes"
915     then
916       PLUGINS="${PLUGINS} access/satellite/satellite"
917     fi])
918
919 dnl
920 dnl  ipv6 plugin - not for QNX yet
921 dnl
922 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
923 then
924   have_ipv6=0
925   AC_CHECK_FUNC(inet_pton,[have_ipv6=1],[
926     AC_CHECK_LIB(resolv,inet_pton,
927       [have_ipv6=1
928        ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
929   ])
930   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
931   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
932     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=0])
933   if test x$have_ipv6 = x1; then
934     PLUGINS="${PLUGINS} misc/network/ipv6"
935   fi
936 fi
937 if test "x${SYS}" = "xmingw32"
938 then
939   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
940   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
941     PLUGINS="${PLUGINS} misc/network/ipv6"],[AC_MSG_RESULT(no)])
942 fi
943
944 dnl
945 dnl  AVI demux plugin
946 dnl
947 AC_ARG_ENABLE(avi,
948   [  --enable-avi            AVI demux module (default enabled)])
949 if test "x${enable_avi}" != "xno"
950 then
951   PLUGINS="${PLUGINS} demux/avi/avi"
952 fi
953
954 dnl
955 dnl  AAC demux plugin
956 dnl
957 AC_ARG_ENABLE(aac,
958   [  --enable-aac            AAC demux module (default enabled)])
959 if test "x${enable_aac}" != "xno"
960 then
961   PLUGINS="${PLUGINS} demux/aac/aac"
962 fi
963
964 dnl
965 dnl  Codec plugins
966 dnl
967
968 AC_ARG_WITH(,[Codec plugins:])
969
970 dnl
971 dnl  mad plugin
972 dnl
973 AC_ARG_ENABLE(mad,
974   [  --enable-mad            libmad module (default disabled)])
975 if test "x${enable_mad}" = "xyes"
976 then
977   AC_ARG_WITH(mad,
978     [    --with-mad=PATH       path to libmad],[],[])
979   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
980   then
981     mad_CFLAGS="${mad_CFLAGS} -I${with_mad}/include"
982     mad_LDFLAGS="${mad_LDFLAGS} -L${with_mad}/lib"
983   fi
984
985   AC_ARG_WITH(mad-tree,
986     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
987   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
988   then
989     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
990     if test "x${real_mad_tree}" = "x"
991     then
992       dnl  The given directory can't be found
993       AC_MSG_RESULT(no)
994       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
995     fi
996     dnl  Use a custom libmad
997     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
998     if test -f ${real_mad_tree}/libmad/mad.h
999     then
1000       AC_MSG_RESULT(yes)
1001       mad_CFLAGS="${mad_CFLAGS} -I${real_mad_tree}/libmad"
1002       mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs"
1003       LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
1004       AC_CHECK_LIB(mad, mad_bit_init, [
1005         BUILTINS="${BUILTINS} codec/mad/mad"
1006         mad_LDFLAGS="${mad_LDFLAGS} -lmad"
1007         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1008       ],[])
1009       LDFLAGS="${save_LDFLAGS}"
1010     else
1011       AC_MSG_RESULT(no)
1012       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1013     fi
1014   else
1015     CFLAGS="${save_CFLAGS} ${mad_CFLAGS}"
1016     LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
1017     AC_CHECK_HEADERS(mad.h, ,
1018       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1019     AC_CHECK_LIB(mad, mad_bit_init, [
1020       PLUGINS="${PLUGINS} codec/mad/mad"
1021       mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
1022       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1023     CFLAGS="${save_CFLAGS}"
1024     LDFLAGS="${save_LDFLAGS}"
1025   fi
1026 fi
1027
1028 dnl
1029 dnl   libid3tag support
1030 dnl
1031 AC_CHECK_HEADERS(id3tag.h, [
1032   id3tag_LDFLAGS="${id3tag_LDFLAGS} -lz -lid3tag"
1033   PLUGINS="${PLUGINS} demux/util/id3tag"])
1034    
1035 dnl
1036 dnl  ffmpeg decoder plugin
1037 dnl
1038 AC_ARG_ENABLE(ffmpeg,
1039 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1040 if test "x${enable_ffmpeg}" = "xyes"
1041 then
1042   AC_ARG_WITH(ffmpeg,
1043     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1044   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1045   then
1046     ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${with_ffmpeg}/include/libffmpeg"
1047     ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L${with_ffmpeg}/lib"
1048   fi
1049
1050   dnl Add postprocessing modules
1051   PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_c"
1052   if test "x${ac_cv_mmx_inline}" != "xno"; then
1053     PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmx"
1054   fi
1055
1056   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1057     PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmxext"
1058   fi
1059
1060
1061   AC_ARG_WITH(ffmpeg-tree, 
1062   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1063   if test "x${with_ffmpeg_tree}" != "x"
1064   then
1065     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1066     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1067     if test "x${real_ffmpeg_tree}" = x
1068     then
1069       dnl  The given directory can't be found
1070       AC_MSG_RESULT(no)
1071       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1072     fi
1073     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1074     then
1075       dnl  Use a custom libffmpeg
1076       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1077       BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1078       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1079       ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${real_ffmpeg_tree}/libavcodec"
1080     else
1081       dnl  The given libavcodec wasn't built
1082       AC_MSG_RESULT(no)
1083       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1084     fi
1085   else
1086     CFLAGS="${save_CFLAGS} ${ffmpeg_CFLAGS}"
1087     LDFLAGS="${save_LDFLAGS} ${ffmpeg_LDFLAGS}"
1088     AC_CHECK_LIB(avcodec, avcodec_init, [
1089       BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1090       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec" ],
1091       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1092     LDFLAGS="${save_LDFLAGS}"
1093     CFLAGS="${save_CFLAGS}"
1094   fi
1095 fi
1096
1097 dnl
1098 dnl  faad decoder plugin
1099 dnl
1100 AC_ARG_ENABLE(faad,
1101 [  --enable-faad           faad codec (default disabled)])
1102 if test "x${enable_faad}" = "xyes"
1103 then
1104   AC_ARG_WITH(faad,
1105     [    --with-faad=PATH      path to faad installation],[],[])
1106   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1107   then
1108     faad_CFLAGS="${faad_CFLAGS} -I${with_faad}/include"
1109     faad_LDFLAGS="${faad_LDFLAGS} -L${with_faad}/lib"
1110   fi
1111   faad_LDFLAGS="${faad_LDFLAGS}"
1112
1113   AC_ARG_WITH(faad-tree, 
1114   [    --with-faad-tree=PATH faad tree for static linking])
1115   if test "x${with_faad_tree}" != "x"
1116   then
1117     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1118     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1119     if test "x${real_faad_tree}" = x
1120     then
1121       dnl  The given directory can't be found
1122       AC_MSG_RESULT(no)
1123       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1124     fi
1125     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1126     then
1127       dnl  Use a custom faad
1128       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1129       BUILTINS="${BUILTINS} codec/faad/faad"
1130       faad_LDFLAGS="${faad_LDFLAGS} ${real_faad_tree}/libfaad/.libs/libfaad.a"
1131       faad_CFLAGS="${faad_CFLAGS} -I${real_faad_tree}/include"
1132     else
1133       dnl  The given libfaad wasn't built
1134       AC_MSG_RESULT(no)
1135       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1136     fi
1137   else
1138     CFLAGS="${save_CFLAGS} ${faad_CFLAGS}"
1139     LDFLAGS="${save_LDFLAGS} ${faad_LDFLAGS}"
1140     AC_CHECK_HEADERS(faad.h, ,
1141       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1142     AC_CHECK_LIB(faad, faacDecOpen, [
1143       PLUGINS="${PLUGINS} codec/faad/faad"
1144       faad_LDFLAGS="${faad_LDFLAGS} -lfaad" ],
1145       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1146     LDFLAGS="${save_LDFLAGS}"
1147     CFLAGS="${save_CFLAGS}"
1148   fi
1149 fi
1150
1151
1152
1153 dnl 
1154 dnl MP4 module 
1155 dnl 
1156 AC_ARG_ENABLE(mp4,
1157   [  --enable-mp4            MP4 demux module (default enabled)])
1158 if test "x${enable_mp4}" != "xno"
1159 then
1160
1161     PLUGINS="${PLUGINS} demux/mp4/mp4"
1162     AC_CHECK_HEADERS(zlib.h,
1163               [ mp4_LDFLAGS="${mp4_LDFLAGS} -lz" ] )
1164 fi
1165
1166 dnl
1167 dnl  a52 AC3 decoder plugin
1168 dnl
1169 AC_ARG_ENABLE(a52,
1170   [  --enable-a52            A/52 support with liba52 (default enabled)])
1171 if test "x${enable_a52}" != "xno"
1172 then
1173   AC_ARG_WITH(a52, 
1174     [    --with-a52=PATH       a52 headers and libraries])
1175   AC_ARG_WITH(a52-tree,
1176     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1177   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1178   then
1179     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1180     if test "x${real_a52_tree}" = "x"
1181     then
1182       dnl  The given directory can't be found
1183       AC_MSG_RESULT(no)
1184       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1185     fi
1186     dnl  Use a custom a52dec
1187     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1188     if test -f ${real_a52_tree}/include/a52.h
1189     then
1190       AC_MSG_RESULT(yes)
1191       a52_CFLAGS="${a52_CFLAGS} -I${real_a52_tree}"
1192       a52_LDFLAGS="${a52_LDFLAGS} -L${real_a52_tree}/liba52/.libs"
1193       LDFLAGS="${save_LDFLAGS} ${a52_LDFLAGS}"
1194       AC_CHECK_LIB(a52, a52_free, [
1195         BUILTINS="${BUILTINS} codec/a52"
1196         a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
1197         a52_CFLAGS="${a52_CFLAGS} -DUSE_A52DEC_TREE"
1198         ],[
1199         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1200         then
1201           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1202         else
1203           AC_MSG_ERROR([the specified tree hasn't been compiled])
1204         fi
1205       ],[-lm])
1206       LDFLAGS="${save_LDFLAGS}"
1207     else
1208       AC_MSG_RESULT(no)
1209       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1210     fi
1211   else
1212     if test "x${with_a52}" = "x"
1213     then
1214       test_LDFLAGS=""
1215       test_CFLAGS=""
1216     else
1217       test_LDFLAGS="-L${with_a52}/lib"
1218       test_CFLAGS="-I${with_a52}/include"
1219     fi
1220     save_CPPFLAGS="${CPPFLAGS}"
1221     save_LDFLAGS="${LDFLAGS}"
1222     CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
1223     LDFLAGS="${save_LDFLAGS} ${test_LDFLAGS}"
1224     AC_CHECK_HEADERS(a52dec/a52.h, [
1225       AC_CHECK_LIB(a52, a52_free, [
1226         BUILTINS="${BUILTINS} codec/a52"
1227         a52_LDFLAGS="${a52_LDFLAGS} ${test_LDFLAGS} -la52 -lm"
1228         a52_CFLAGS="${a52_CFLAGS} ${test_CFLAGS}"
1229       ],[
1230         if test "x${enable_dvbpsi}" != "x"
1231         then
1232           AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net])
1233         fi
1234       ],[-lm])
1235     ])
1236     CPPFLAGS="${save_CPPFLAGS}"
1237     LDFLAGS="${save_LDFLAGS}"
1238   fi
1239 fi
1240
1241 dnl
1242 dnl  cinepak plugin
1243 dnl
1244 AC_ARG_ENABLE(cinepak,
1245   [  --enable-cinepak        Cinepak decoder (default enabled)])
1246 if test "x${enable_cinepak}" != "xno"
1247 then
1248   PLUGINS="${PLUGINS} codec/cinepak/cinepak"
1249 fi
1250
1251 dnl
1252 dnl  ogg vorbis plugin
1253 dnl
1254 AC_ARG_ENABLE(vorbis,
1255   [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
1256 if test "x${enable_vorbis}" != "xno"
1257 then
1258   AC_CHECK_HEADERS(ogg/ogg.h, [
1259     dnl disabled for the moment
1260     #PLUGINS="${PLUGINS} demux/ogg/ogg codec/vorbis/vorbis"
1261     vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
1262    ],[])
1263 fi
1264
1265 dnl
1266 dnl  DV plugin
1267 dnl 
1268 AC_ARG_ENABLE(dv,
1269   [  --enable-dv             DV decoder support (default disabled)])
1270 if test "x${enable_dv}" = "xyes"
1271 then
1272   AC_CHECK_HEADERS(libdv/dv.h, [
1273     BUILTINS="${BUILTINS} codec/dv/dv"
1274     dv_LDFLAGS="${dv_LDFLAGS} -ldv"
1275    ],[])
1276 fi  
1277
1278 dnl
1279 dnl  Video plugins
1280 dnl
1281
1282 AC_ARG_WITH(,[Video plugins:])
1283
1284 dnl
1285 dnl  X11 module
1286 dnl  (enabled by default except on win32)
1287 dnl
1288 AC_ARG_ENABLE(x11,
1289   [  --enable-x11            X11 support (default enabled)])
1290 if test "x${enable_x11}" != "xno" &&
1291   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1292   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1293   AC_CHECK_HEADERS(X11/Xlib.h, [
1294     PLUGINS="${PLUGINS} video_output/x11/x11"
1295     x11_LDFLAGS="${x11_LDFLAGS} -L${x_libraries} -lX11 -lXext"
1296     x11_CFLAGS="${x11_CFLAGS} -I${x_includes}"
1297   ])
1298   CPPFLAGS="${save_CPPFLAGS}"
1299 fi
1300
1301 dnl
1302 dnl  XVideo module
1303 dnl  (enabled by default except on win32)
1304 dnl
1305 AC_ARG_ENABLE(xvideo,
1306   [  --enable-xvideo         XVideo support (default enabled)])
1307 if test "x${enable_xvideo}" != "xno" &&
1308   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1309   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1310   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1311     CFLAGS="${save_CFLAGS} -L${x_libraries} -lX11 -lXext"
1312     AC_CHECK_LIB(Xv_pic,XvPutImage,
1313       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1314       PLUGINS="${PLUGINS} video_output/x11/xvideo"
1315       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv_pic"
1316       xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1317       AC_CHECK_LIB(Xv,XvPutImage,
1318         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1319         PLUGINS="${PLUGINS} video_output/x11/xvideo"
1320         xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv"
1321         xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1322         # Otherwise... well, do nothing.
1323         :
1324       )
1325     )
1326     CFLAGS="${save_CFLAGS}"
1327   ]
1328   CPPFLAGS="${save_CPPFLAGS}")
1329 fi
1330
1331 dnl
1332 dnl  SDL module
1333 dnl
1334 AC_ARG_ENABLE(sdl,
1335   [  --enable-sdl            SDL support (default enabled)])
1336 if test "x${enable_sdl}" != "xno"
1337 then
1338   SDL_PATH="${PATH}"
1339   AC_ARG_WITH(sdl-config-path,
1340     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1341     [ if test "x${with_sdl_config_path}" != "xno"
1342       then
1343         SDL_PATH="${with_sdl_config_path}:${PATH}"
1344       fi ])
1345   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1346   SDL_CONFIG="${SDL12_CONFIG}"
1347   SDL_HEADER="SDL12/SDL.h"
1348   if test "x${SDL_CONFIG}" = "xno"
1349   then
1350     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1351     SDL_CONFIG=${SDL11_CONFIG}
1352     SDL_HEADER="SDL11/SDL.h"
1353   fi
1354   if test "x${SDL_CONFIG}" = "xno"
1355   then
1356     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1357     SDL_HEADER="SDL/SDL.h"
1358   fi
1359   if test "x${SDL_CONFIG}" != "xno"
1360   then
1361     PLUGINS="${PLUGINS} video_output/sdl audio_output/sdl"
1362     sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
1363     sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
1364     CPPFLAGS="${save_CPPFLAGS} ${sdl_CFLAGS}"
1365     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1366       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1367       [ AC_MSG_ERROR([The development package for SDL is not installed. 
1368 Please install it and try again. Alternatively you can also configure with 
1369 --disable-sdl.])
1370       ])
1371     CPPFLAGS="${save_CPPFLAGS}"
1372     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1373     then
1374       AC_MSG_ERROR([The development package for SDL is not installed.
1375 Please install it and try again. Alternatively you can also configure with
1376 --disable-sdl.])
1377     fi
1378   elif test "x${enable_sdl}" =  "xyes"
1379   then
1380     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1381 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1382     ])
1383   fi
1384 fi
1385
1386 dnl
1387 dnl  Windows DirectX module
1388 dnl
1389 AC_ARG_ENABLE(directx,
1390   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1391 if test "x${enable_directx}" != "xno"
1392 then
1393   if test "x${SYS}" = "xmingw32"
1394   then
1395     AC_ARG_WITH(directx, 
1396     [    --with-directx=PATH   Win32 DirectX headers])
1397     if test "x${with_directx}" = "x"
1398     then
1399       AC_CHECK_HEADERS(ddraw.h,
1400       [ PLUGINS="${PLUGINS} video_output/directx/directx"
1401         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32" ])
1402     else
1403       AC_MSG_CHECKING(for directX headers in ${with_directx})
1404       if test -f ${with_directx}/ddraw.h
1405       then
1406         PLUGINS="${PLUGINS} video_output/directx/directx"
1407         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32"
1408         directx_CFLAGS="${directx_CFLAGS} -I${with_directx}"
1409         AC_MSG_RESULT(yes)
1410       else
1411         AC_MSG_RESULT(no)
1412         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1413       fi
1414     fi
1415   fi
1416 fi
1417
1418 dnl
1419 dnl  Linux framebuffer module
1420 dnl
1421 AC_ARG_ENABLE(fb,
1422   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
1423     if test "x${enable_fb}" != "xno"
1424     then
1425       AC_CHECK_HEADERS(linux/fb.h, [
1426         PLUGINS="${PLUGINS} video_output/fb"
1427       ])
1428     fi
1429
1430 dnl
1431 dnl  Linux MGA module
1432 dnl
1433 AC_ARG_ENABLE(mga,
1434   [  --enable-mga            Linux kernel Matrox support (default disabled)],
1435   [ if test "x${enable_mga}" = "xyes"
1436     then
1437       PLUGINS="${PLUGINS} video_output/mga/mga video_output/mga/xmga"
1438     fi ])
1439
1440 dnl
1441 dnl  SVGAlib module
1442 dnl
1443 AC_ARG_ENABLE(svgalib,
1444   [  --enable-svgalib        SVGAlib support (default disabled)])
1445 if test "x${enable_svgalib}" = "xyes"
1446 then
1447   PLUGINS="${PLUGINS} video_output/svgalib"
1448   svgalib_LDFLAGS="${svgalib_LDFLAGS} -lvgagl -lvga"
1449 fi
1450
1451 dnl
1452 dnl  GGI module
1453 dnl
1454 AC_ARG_ENABLE(ggi,
1455   [  --enable-ggi            GGI support (default disabled)])
1456 if test "x${enable_ggi}" = "xyes"
1457 then
1458   PLUGINS="${PLUGINS} video_output/ggi"
1459   ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
1460   AC_ARG_WITH(ggi,
1461     [    --with-ggi=PATH       path to libggi],
1462     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
1463       then
1464         CFLAGS_GGI="${CFLAGS_GGI} -I${with_ggi}/include"
1465         ggi_LDFLAGS="${ggi_LDFLAGS} -L${with_ggi}/lib"
1466       fi ])
1467 fi
1468
1469 dnl
1470 dnl  Glide module
1471 dnl
1472 AC_ARG_ENABLE(glide,
1473   [  --enable-glide          Glide (3dfx) support (default disabled)])
1474 if test "x${enable_glide}" = "xyes"
1475 then
1476   PLUGINS="${PLUGINS} video_output/glide"
1477   glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
1478   glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
1479   AC_ARG_WITH(glide,
1480     [    --with-glide=PATH     path to libglide],
1481     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
1482       then
1483         glide_CFLAGS="${glide_CFLAGS} -I${with_glide}/include"
1484         glide_LDFLAGS="${glide_LDFLAGS} -L${with_glide}/lib"
1485       fi ])
1486 fi
1487
1488 dnl
1489 dnl  AA plugin
1490 dnl
1491 AC_ARG_ENABLE(aa,
1492   [  --enable-aa             aalib output (default disabled)])
1493 if test "x${enable_aa}" = "xyes"
1494 then
1495   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
1496   if test "x${have_aa}" = "xtrue"
1497   then
1498     PLUGINS="${PLUGINS} video_output/aa"
1499     aa_LDFLAGS="${aa_LDFLAGS} -laa"
1500   fi
1501 fi
1502
1503 dnl
1504 dnl  Audio plugins
1505 dnl
1506
1507 AC_ARG_WITH(,[Audio plugins:])
1508
1509 dnl
1510 dnl  OSS /dev/dsp module (enabled by default except on win32)
1511 dnl
1512 AC_ARG_ENABLE(oss,
1513   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
1514
1515 if test "x${enable_oss}" != "xno" &&
1516   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
1517 then
1518   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1519     PLUGINS="${PLUGINS} audio_output/oss"
1520     AC_CHECK_LIB(ossaudio,main,oss_LDFLAGS="${oss_LDFLAGS} -lossaudio")
1521   ])
1522 fi
1523
1524 dnl
1525 dnl  Esound module
1526 dnl
1527 AC_ARG_ENABLE(esd,
1528   [  --enable-esd            Esound library support (default disabled)],
1529   [if test "x${enable_esd}" = "xyes"
1530    then
1531      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1532      if test "x${ESD_CONFIG}" != "xno"
1533      then
1534        PLUGINS="${PLUGINS} audio_output/esd"
1535        esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
1536        esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
1537      fi
1538    fi])
1539
1540 dnl
1541 dnl  aRts module
1542 dnl
1543 AC_ARG_ENABLE(arts,
1544   [  --enable-arts           aRts sound server (default disabled)],
1545   [if test "x${enable_arts}" = "xyes"
1546    then
1547      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1548      if test "x${ARTS_CONFIG}" != "xno"
1549      then
1550        PLUGINS="${PLUGINS} audio_output/arts"
1551        arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
1552        arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
1553      fi
1554    fi])
1555
1556 dnl
1557 dnl  ALSA module
1558 dnl
1559 AC_ARG_ENABLE(alsa,
1560   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1561   [if test "x${enable_alsa}" = "xyes"
1562    then
1563      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1564      if test "x${have_alsa}" = "xtrue"
1565      then
1566        PLUGINS="${PLUGINS} audio_output/alsa"
1567        alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
1568      fi
1569    fi])
1570
1571 dnl
1572 dnl  win32 waveOut plugin
1573 dnl
1574 AC_ARG_ENABLE(waveout,
1575   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1576 if test "x${enable_waveout}" != "xno" -a "x${SYS}" = "xmingw32"
1577   then
1578     PLUGINS="${PLUGINS} audio_output/waveout"
1579     waveout_LDFLAGS="-lwinmm"
1580 fi
1581
1582 dnl
1583 dnl  Interface plugins
1584 dnl
1585
1586 AC_ARG_WITH(,[Interface plugins:])
1587
1588 dnl special case for BeOS
1589 if test "x${SYS}" = "xbeos"
1590 then
1591     PLUGINS="${PLUGINS} gui/beos/beos"
1592 fi
1593
1594 dnl
1595 dnl  Gtk+ module
1596 dnl
1597 AC_ARG_ENABLE(gtk,
1598   [  --enable-gtk            Gtk+ support (default enabled)])
1599 if test "x${enable_gtk}" != "xno"
1600 then
1601   GTK_PATH="${PATH}"
1602   AC_ARG_WITH(gtk-config-path,
1603     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1604     [ if test "x${with_gtk_config_path}" != "xno"
1605       then
1606         GTK_PATH="${with_gtk_config_path}:${PATH}"
1607       fi ])
1608   # look for gtk-config
1609   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1610   GTK_CONFIG=${GTK12_CONFIG}
1611   if test "x${GTK_CONFIG}" = "xno"
1612   then
1613     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1614   fi
1615   if test "x${GTK_CONFIG}" != "xno"
1616   then
1617     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1618     then
1619       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.])
1620     fi
1621     gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
1622     gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1623     # now look for the gtk.h header
1624     CPPFLAGS="${save_CPPFLAGS} ${gtk_CFLAGS}"
1625     ac_cv_gtk_headers=yes
1626     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1627       ac_cv_gtk_headers=no
1628       echo "Cannot find gtk development headers."
1629     ])
1630     if test "x${ac_cv_gtk_headers}" = "xyes"
1631     then
1632       PLUGINS="${PLUGINS} gui/gtk/gtk"
1633       NEED_GTK_MAIN=yes
1634       ALIASES="${ALIASES} gvlc"
1635     fi
1636     CPPFLAGS="${save_CPPFLAGS}"
1637   fi
1638 fi
1639
1640 dnl
1641 dnl  Familiar module uses Gtk+ library
1642 dnl
1643 AC_ARG_ENABLE(familiar,
1644   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
1645 if test "x${enable_familiar}" = "xyes"
1646 then
1647   GTK_PATH="${PATH}"
1648   AC_ARG_WITH(gtk-config-path,
1649     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1650     [ if test "x${with_gtk_config_path}" != "xno"
1651       then
1652         GTK_PATH="${with_gtk_config_path}:${PATH}"
1653       fi ])
1654   # look for gtk-config
1655   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1656   GTK_CONFIG=${GTK12_CONFIG}
1657   if test "x${GTK_CONFIG}" = "xno"
1658   then
1659     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1660   fi
1661   if test "x${GTK_CONFIG}" != "xno"
1662   then
1663     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1664     then
1665       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.])
1666     fi
1667     familiar_CFLAGS="${familiar_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
1668     familiar_LDFLAGS="${familiar_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1669     # now look for the gtk.h header
1670     CPPFLAGS="${save_CPPFLAGS} ${familiar_CFLAGS}"
1671     ac_cv_gtk_headers=yes
1672     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1673       ac_cv_gtk_headers=no
1674       echo "Cannot find gtk development headers."
1675     ])
1676     if test "x${ac_cv_gtk_headers}" = "xyes"
1677     then
1678       PLUGINS="${PLUGINS} gui/familiar/familiar"
1679       NEED_GTK_MAIN=yes
1680     fi
1681     CPPFLAGS="${save_CPPFLAGS}"
1682   fi
1683 fi
1684
1685 dnl
1686 dnl  Gnome module
1687 dnl
1688 AC_ARG_ENABLE(gnome,
1689   [  --enable-gnome          Gnome interface support (default disabled)],
1690   [if test "x${enable_gnome}" = "xyes"; then
1691     # look for gnome-config
1692     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1693     if test -x ${GNOME_CONFIG}
1694     then
1695        gnome_CFLAGS="${gnome_CFLAGS} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1696        gnome_LDFLAGS="${gnome_LDFLAGS} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1697     fi
1698     # now look for the gnome.h header
1699     CPPFLAGS="${save_CPPFLAGS} ${gnome_CFLAGS}"
1700     AC_CHECK_HEADERS(gnome.h, [
1701       PLUGINS="${PLUGINS} gui/gtk/gnome"
1702       NEED_GTK_MAIN=yes
1703       ALIASES="${ALIASES} gnome-vlc"
1704      ],[
1705       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1706 developement tools or remove the --enable-gnome option])
1707      ])
1708     CPPFLAGS="${save_CPPFLAGS}"
1709   fi])
1710
1711 dnl
1712 dnl  Qt module
1713 dnl
1714 AC_ARG_ENABLE(qt,
1715   [  --enable-qt             Qt interface support (default disabled)],
1716   [if test "x${enable_qt}" = "xyes"; then
1717      PLUGINS="${PLUGINS} gui/qt/qt"
1718      ALIASES="${ALIASES} qvlc"
1719      qt_LDFLAGS="${qt_LDFLAGS} -lqt -L${QTDIR}/lib"
1720      qt_CFLAGS="${qt_CFLAGS} -I/usr/include/qt -I${QTDIR}/include"
1721      if test -x ${QTDIR}/bin/moc
1722      then
1723        MOC=${QTDIR}/bin/moc
1724      else
1725        MOC=moc
1726      fi
1727    fi])
1728
1729 dnl 
1730 dnl  KDE module
1731 dnl
1732 AC_ARG_ENABLE(kde,
1733   [  --enable-kde            KDE interface support (default disabled)],
1734   [if test "x${enable_kde}" = "xyes"; then
1735      PLUGINS="${PLUGINS} gui/kde/kde"
1736      ALIASES="${ALIASES} kvlc"
1737      kde_LDFLAGS="${kde_LDFLAGS} -L${KDEDIR}/lib -lkfile"
1738      kde_CFLAGS="${kde_CFLAGS} -I/usr/include/kde -I/usr/include/qt"
1739      kde_CFLAGS="${kde_CFLAGS} -I${KDEDIR}/include -I${QTDIR}/include"
1740      if test -x ${QTDIR}/bin/moc
1741      then
1742        MOC=${QTDIR}/bin/moc
1743      else
1744        MOC=moc
1745      fi
1746    fi])
1747
1748 dnl
1749 dnl  Qt embedded module
1750 dnl
1751 AC_ARG_ENABLE(qte,
1752   [  --enable-qte            Qt embedded interface support (default disabled)],
1753   [if test "x${enable_qte}" = "xyes"; then
1754      PLUGINS="${PLUGINS} gui/qte/qte"
1755      qte_LDFLAGS="${qte_LDFLAGS} -lqte -L${QTEDIR}/lib"
1756      qte_CFLAGS="${qte_CFLAGS} -I/usr/include/qte -I${QTEDIR}/include"
1757      if test -x ${QTEDIR}/bin/moc
1758      then
1759        MOC=${QTEDIR}/bin/moc
1760      else
1761        MOC=moc
1762      fi
1763    fi])
1764
1765
1766 dnl
1767 dnl  MacOS X module
1768 dnl
1769 AC_ARG_ENABLE(macosx,
1770   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1771   [if test "x${enable_macosx}" = "xyes"
1772    then
1773      BUILTINS="${BUILTINS} gui/macosx/macosx"
1774      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1775    fi],
1776   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1777      BUILTINS="${BUILTINS} gui/macosx/macosx"
1778      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1779    )])
1780
1781 dnl
1782 dnl  QNX RTOS module
1783 dnl
1784 AC_ARG_ENABLE(qnx,
1785   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1786     if test "x${enable_qnx}" != "xno"
1787     then
1788       AC_CHECK_HEADERS(Ph.h, [
1789         PLUGINS="${PLUGINS} gui/qnx/qnx"
1790         qnx_LDFLAGS="${qnx_LDFLAGS} -lasound -lph"
1791       ])
1792     fi
1793
1794 dnl
1795 dnl  Windows native interface module, built with Borland C++ Builder
1796 dnl
1797 AC_ARG_ENABLE(intfwin,
1798 [  --enable-intfwin        Win32 interface support (default disabled)],
1799 [ if test "x${enable_intfwin}" != "xno"
1800   then
1801     AC_ARG_WITH(bcbuilder, 
1802     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1803     if test "x${with_bcbuilder}" != "x"
1804     then
1805       BCBUILDER="${with_bcbuilder}"
1806     fi
1807     PLUGINS="${PLUGINS} gui/win32/win32"
1808   fi ])
1809
1810 dnl
1811 dnl  ncurses module
1812 dnl
1813 AC_ARG_ENABLE(ncurses,
1814   [  --enable-ncurses        ncurses interface support (default disabled)],
1815   [if test "x${enable_ncurses}" = "xyes"; then
1816      PLUGINS="${PLUGINS} gui/ncurses/ncurses"
1817      ncurses_LDFLAGS="${ncurses_LDFLAGS} -lncurses"
1818    fi])
1819
1820 dnl
1821 dnl  XOSD plugin
1822 dnl
1823 AC_ARG_ENABLE(xosd,
1824   [  --enable-xosd           xosd interface support (default disabled)])
1825 if test "x${enable_xosd}" = "xyes"
1826 then
1827   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
1828   AC_TRY_COMPILE([#include <xosd.h>],
1829      [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
1830       AC_DEFINE(HAVE_OLD_XOSD_H, 1, Define if <xosd.h> is pre-1.0.0))
1831   if test "x${have_xosd}" = "xtrue"
1832   then
1833     PLUGINS="${PLUGINS} visualization/xosd/xosd"
1834     xosd_LDFLAGS="${xosd_LDFLAGS} -lxosd"
1835   fi
1836 fi
1837
1838 dnl
1839 dnl  Lirc plugin
1840 dnl
1841 AC_ARG_ENABLE(lirc,
1842   [  --enable-lirc           lirc support (default disabled)])
1843 if test "x${enable_lirc}" = "xyes"
1844 then
1845   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
1846   if test "x${have_lirc}" = "xtrue"
1847   then
1848     PLUGINS="${PLUGINS} control/lirc/lirc"
1849     lirc_LDFLAGS="${lirc_LDFLAGS} -llirc_client"
1850   fi
1851 fi
1852
1853 AC_ARG_WITH(,[Misc options:])
1854
1855 dnl
1856 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
1857 dnl
1858 dnl  We give the user the opportunity to specify
1859 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
1860 dnl
1861 AC_ARG_WITH(words,
1862   [  --with-words=endianness set endianness (big or little)])
1863   case "x${with_words}" in
1864     xbig)
1865       ac_cv_c_bigendian=yes
1866       ;;
1867     xlittle)
1868       ac_cv_c_bigendian=no
1869       ;;
1870     *)
1871       dnl  Try to guess endianness by matching patterns on a compiled
1872       dnl  binary, by looking for an ASCII or EBCDIC string
1873       AC_CACHE_CHECK([whether the byte order is big-endian],
1874         [ac_cv_c_bigendian],
1875         [ac_cv_c_bigendian="unknown"
1876         [cat >conftest.c <<EOF
1877         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
1878         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
1879         void _a(void) { char*s = (char*)am; s = (char *)ai; }
1880         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
1881         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
1882         void _e(void) { char*s = (char*)em; s = (char*)ei; }
1883         int main(void) { _a(); _e(); return 0; }
1884 EOF
1885         ]
1886         if test -f conftest.c
1887         then 
1888           if ${CC-cc} -c conftest.c -o conftest.o >config.log 2>&1 \
1889               && test -f conftest.o
1890           then
1891             if test "`strings conftest.o | grep BIGenDianSyS`"
1892             then
1893               ac_cv_c_bigendian="yes"
1894             fi
1895             if test "`strings conftest.o | grep LiTTleEnDian`"
1896             then
1897               ac_cv_c_bigendian="no"
1898             fi
1899           fi
1900         fi
1901       ])
1902       if test "x${ac_cv_c_bigendian}" = "xunknown"
1903       then
1904         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
1905       fi
1906       ;;
1907   esac
1908 dnl  Now we know what to use for endianness, just put it in the header
1909 if test "${ac_cv_c_bigendian}" = "yes"
1910 then
1911   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
1912 fi
1913
1914 dnl
1915 dnl  Profiling
1916 dnl
1917 PROFILING=0
1918
1919 GPROF=0
1920 AC_ARG_ENABLE(gprof,
1921 [  --enable-gprof          gprof profiling (default disabled)],
1922 [ if test "x${enable_gprof}" = "xyes"
1923   then
1924     GPROF=1
1925     PROFILING="gprof"
1926   fi
1927 ])
1928
1929 CPROF=0
1930 AC_ARG_ENABLE(cprof,
1931 [  --enable-cprof          cprof profiling (default disabled)],
1932 [ if test "x${enable_cprof}" = "xyes"
1933   then
1934     save_LDFLAGS="${save_LDFLAGS} -lcprof"; LDFLAGS="${save_LDFLAGS}"
1935     CPROF=1
1936     PROFILING="cprof"
1937   fi
1938 ])
1939
1940 dnl
1941 dnl  GNU portable threads
1942 dnl
1943 AC_ARG_ENABLE(pth,
1944   [  --enable-pth            GNU Pth support (default disabled)],
1945   [ if test "x${enable_pth}" = "xyes"; then
1946     AC_CHECK_LIB(pth,pth_init)
1947     AC_EGREP_HEADER(pth_init,pth.h,[
1948       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
1949                 Define if <pth.h> defines pth_init)
1950     THREAD_LIB="-lpth"
1951     fi])
1952 ])
1953
1954 dnl
1955 dnl  State Threads
1956 dnl
1957 AC_ARG_ENABLE(st,
1958   [  --enable-st             State Threads (default disabled)],
1959   [ if test "x${enable_st}" = "xyes"; then
1960     AC_CHECK_LIB(st,st_init)
1961     AC_EGREP_HEADER(st_init,st.h,[
1962       AC_DEFINE(ST_INIT_IN_ST_H, 1,
1963                 Define if <st.h> defines st_init)
1964     THREAD_LIB="-lst"
1965     fi])
1966 ])
1967
1968 vlc_LDFLAGS="${vlc_LDFLAGS} ${THREAD_LIB}"
1969 plugins_LDFLAGS="${plugins_LDFLAGS} ${THREAD_LIB}"
1970
1971 dnl
1972 dnl  Mozilla plugin
1973 dnl
1974 MOZILLA=0
1975 AC_ARG_ENABLE(mozilla,
1976   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
1977 if test "x${enable_mozilla}" = "xyes"
1978 then
1979   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
1980   if test "x${MOZILLA_CONFIG}" != "xno"
1981   then
1982     if test "x${SYS}" != "xmingw32"; then
1983       LDFLAGS="${save_LDFLAGS} -L${x_libraries}"
1984       AC_CHECK_LIB(Xt,XtStrings,[
1985         mozilla_LDFLAGS="${mozilla_LDFLAGS} -L${x_libraries} -lXt"
1986       ])
1987       LDFLAGS="${save_LDFLAGS}"
1988     fi
1989     MOZILLA=1
1990     mozilla_CFLAGS="${mozilla_CFLAGS} `${MOZILLA_CONFIG} --cflags plugin java --defines | xargs`"
1991     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
1992     mozilla_LDFLAGS="${mozilla_LDFLAGS} `${MOZILLA_CONFIG} --libs | sed 's#-I\(.*\)/mozilla/\([^ ]*\)#-I\1/\2 -I\1/mozilla/\2#g'`"
1993   fi
1994 fi
1995
1996 dnl
1997 dnl  gtk_main plugin
1998 dnl
1999 if test "x${NEED_GTK_MAIN}" != "xno"
2000 then
2001     PLUGINS="${PLUGINS} misc/gtk_main"
2002     gtk_main_CFLAGS="${gtk_main_CFLAGS} ${gtk_CFLAGS} ${familiar_CFLAGS} ${gnome_CFLAGS}"
2003     gtk_main_LDFLAGS="${gtk_main_LDFLAGS} ${gtk_LDFLAGS} ${familiar_LDFLAGS} ${gnome_LDFLAGS}"
2004 fi
2005
2006 dnl
2007 dnl  Plug-ins - this must be AT THE END
2008 dnl
2009 AC_ARG_ENABLE(plugins,
2010   [  --disable-plugins       make all plug-ins built-in (default plug-ins enabled)],
2011   [if test "x${enable_plugins}" = "xno"
2012    then
2013      BUILTINS="${BUILTINS} ${PLUGINS}"
2014      PLUGINS=
2015    fi])
2016
2017 dnl Automagically disable plug-ins if there is no system support for .so files
2018 dnl don't forget vlc-win32 still can load .so as plugins
2019 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2020 then
2021   echo "*** Your system doesn't have plug-in support. All plug-ins will be compiled"
2022   echo "as built-in"
2023   BUILTINS="${BUILTINS} ${PLUGINS}"
2024   PLUGINS=
2025 fi
2026
2027 dnl
2028 dnl  Stuff used by the program
2029 dnl
2030 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc ${VERSION} ${CODENAME} Copyright 1996-2002 VideoLAN", [Simple version string])
2031 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string])
2032 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2033
2034 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
2035 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2036 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2037
2038 DATA_PATH="${ac_tool_prefix}/share/videolan"
2039 AC_SUBST(DATA_PATH)
2040 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
2041 AC_SUBST(PLUGIN_PATH)
2042
2043 dnl
2044 dnl  Restore *FLAGS
2045 dnl
2046 CPPFLAGS="${save_CPPFLAGS}"
2047 CFLAGS="${save_CFLAGS}"
2048 LDFLAGS="${save_LDFLAGS}"
2049
2050 dnl
2051 dnl  Create the vlc-config script
2052 dnl
2053 libvlc_LDFLAGS="${vlc_LDFLAGS} ${builtins_LDFLAGS}"
2054 for i in `echo ${BUILTINS} | sed -e 's#[^ ]*/##g'` ; do libvlc_LDFLAGS="${libvlc_LDFLAGS} ${libdir}/vlc/${i}.a `eval echo '$'{${i}_LDFLAGS}`" ; done
2055 AC_SUBST(libvlc_LDFLAGS)
2056
2057 dnl 
2058 dnl  Configuration is finished
2059 dnl
2060 AC_SUBST(SYS)
2061 AC_SUBST(ARCH)
2062 AC_SUBST(PLUGINS)
2063 AC_SUBST(BUILTINS)
2064 AC_SUBST(ALIASES)
2065 AC_SUBST(DEBUG)
2066 AC_SUBST(ASM)
2067 AC_SUBST(CPROF)
2068 AC_SUBST(GPROF)
2069 AC_SUBST(OPTIMS)
2070 AC_SUBST(TUNING)
2071 AC_SUBST(RELEASE)
2072 AC_SUBST(MOC)
2073 AC_SUBST(WINDRES)
2074 AC_SUBST(BCBUILDER)
2075 AC_SUBST(PACKAGE)
2076 AC_SUBST(VERSION)
2077 AC_SUBST(NEED_GETOPT)
2078 AC_SUBST(MOZILLA)
2079
2080 AC_SUBST(CFLAGS_OPTIM)
2081 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2082 AC_SUBST(LDFLAGS)
2083
2084 AC_SUBST(vlc_CFLAGS)
2085 AC_SUBST(plugins_CFLAGS)
2086 AC_SUBST(builtins_CFLAGS)
2087 AC_SUBST(mozilla_CFLAGS)
2088
2089 AC_SUBST(a52_CFLAGS)
2090 AC_SUBST(arts_CFLAGS)
2091 AC_SUBST(i420_yuy2_mmx_CFLAGS)
2092 AC_SUBST(dvd_CFLAGS)
2093 AC_SUBST(dvdread_CFLAGS)
2094 AC_SUBST(dvdplay_CFLAGS)
2095 AC_SUBST(ts_dvbpsi_CFLAGS)
2096 AC_SUBST(directx_CFLAGS)
2097 AC_SUBST(esd_CFLAGS)
2098 AC_SUBST(familiar_CFLAGS)
2099 AC_SUBST(faad_CFLAGS)
2100 AC_SUBST(ffmpeg_CFLAGS)
2101 AC_SUBST(glide_CFLAGS)
2102 AC_SUBST(gnome_CFLAGS)
2103 AC_SUBST(gtk_CFLAGS)
2104 AC_SUBST(gtk_main_CFLAGS)
2105 AC_SUBST(kde_CFLAGS)
2106 AC_SUBST(idctaltivec_CFLAGS)
2107 AC_SUBST(macosx_CFLAGS)
2108 AC_SUBST(mad_CFLAGS)
2109 AC_SUBST(memcpyaltivec_CFLAGS)
2110 AC_SUBST(motionaltivec_CFLAGS)
2111 AC_SUBST(qt_CFLAGS)
2112 AC_SUBST(qte_CFLAGS)
2113 AC_SUBST(sdl_CFLAGS)
2114 AC_SUBST(svgalib_CFLAGS)
2115 AC_SUBST(x11_CFLAGS)
2116 AC_SUBST(xvideo_CFLAGS)
2117
2118 AC_SUBST(vlc_LDFLAGS)
2119 AC_SUBST(plugins_LDFLAGS)
2120 AC_SUBST(builtins_LDFLAGS)
2121 AC_SUBST(mozilla_LDFLAGS)
2122
2123 AC_SUBST(a52_LDFLAGS)
2124 AC_SUBST(aa_LDFLAGS)
2125 AC_SUBST(alsa_LDFLAGS)
2126 AC_SUBST(arts_LDFLAGS)
2127 AC_SUBST(beos_LDFLAGS)
2128 AC_SUBST(i420_rgb_LDFLAGS)
2129 AC_SUBST(directx_LDFLAGS)
2130 AC_SUBST(dv_LDFLAGS)
2131 AC_SUBST(dvd_LDFLAGS)
2132 AC_SUBST(dvdread_LDFLAGS)
2133 AC_SUBST(dvdplay_LDFLAGS)
2134 AC_SUBST(ts_dvbpsi_LDFLAGS)
2135 AC_SUBST(audio_LDFLAGS)
2136 AC_SUBST(esd_LDFLAGS)
2137 AC_SUBST(familiar_LDFLAGS)
2138 AC_SUBST(distort_LDFLAGS)
2139 AC_SUBST(faad_LDFLAGS)
2140 AC_SUBST(ffmpeg_LDFLAGS)
2141 AC_SUBST(mp4_LDFLAGS)
2142 AC_SUBST(ggi_LDFLAGS)
2143 AC_SUBST(glide_LDFLAGS)
2144 AC_SUBST(gnome_LDFLAGS)
2145 AC_SUBST(gtk_LDFLAGS)
2146 AC_SUBST(gtk_main_LDFLAGS)
2147 AC_SUBST(http_LDFLAGS)
2148 AC_SUBST(idctaltivec_LDFLAGS)
2149 AC_SUBST(imdct_LDFLAGS)
2150 AC_SUBST(imdct3dn_LDFLAGS)
2151 AC_SUBST(imdctsse_LDFLAGS)
2152 AC_SUBST(ipv4_LDFLAGS)
2153 AC_SUBST(ipv6_LDFLAGS)
2154 AC_SUBST(kde_LDFLAGS)
2155 AC_SUBST(lirc_LDFLAGS)
2156 AC_SUBST(macosx_LDFLAGS)
2157 AC_SUBST(mad_LDFLAGS)
2158 AC_SUBST(memcpyaltivec_LDFLAGS)
2159 AC_SUBST(motionaltivec_LDFLAGS)
2160 AC_SUBST(ncurses_LDFLAGS)
2161 AC_SUBST(oss_LDFLAGS)
2162 AC_SUBST(qnx_LDFLAGS)
2163 AC_SUBST(qt_LDFLAGS)
2164 AC_SUBST(qte_LDFLAGS)
2165 AC_SUBST(rc_LDFLAGS)
2166 AC_SUBST(sdl_LDFLAGS)
2167 AC_SUBST(svgalib_LDFLAGS)
2168 AC_SUBST(vcd_LDFLAGS)
2169 AC_SUBST(vorbis_LDFLAGS)
2170 AC_SUBST(waveout_LDFLAGS)
2171 AC_SUBST(x11_LDFLAGS)
2172 AC_SUBST(xvideo_LDFLAGS)
2173 AC_SUBST(xosd_LDFLAGS)
2174 AC_SUBST(id3tag_LDFLAGS)
2175         
2176 AC_OUTPUT([
2177   Makefile
2178   Makefile.config
2179   Makefile.opts
2180   m4/Makefile
2181   intl/Makefile
2182   po/Makefile.in
2183   vlc-config
2184 ],[
2185   chmod a+x vlc-config
2186 ])
2187
2188 echo "
2189 vlc configuration
2190 --------------------
2191 vlc version           : ${VERSION}
2192 system                : ${SYS}
2193 architecture          : ${ARCH}
2194 optimizations         : ${OPTIMS}
2195 tuning                : ${TUNING}
2196 debug mode            : ${DEBUG}
2197 release               : ${RELEASE}
2198 profiling             : ${PROFILING}
2199 need builtin getopt   : ${NEED_GETOPT}
2200 modules               : (see Makefile.config)
2201 mozilla plugin        : ${MOZILLA}
2202 vlc aliases           :${ALIASES}
2203
2204 You may now tune Makefile.config and Makefile.opts at your convenience, for
2205 instance to choose which modules get compiled as plugins, or tune CFLAGS.
2206
2207 To build vlc and its plugins, type \`${VLC_MAKE}'.
2208 "
2209