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