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