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