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