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