]> git.sesse.net Git - vlc/blob - configure.in
* ./configure.in: fixed inet_pton detection.
[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     AC_CHECK_LIB(resolv,inet_pton,
824       [PLUGINS="${PLUGINS} ipv6"
825        ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
826   ])
827 fi
828 if test "x$SYS" = "xmingw32"
829 then
830   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
831   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
832     PLUGINS="${PLUGINS} ipv6"],[AC_MSG_RESULT(no)])
833 fi
834
835 dnl
836 dnl  AVI demux plugin
837 dnl
838 AC_ARG_ENABLE(avi,
839   [  --enable-avi            AVI demux module (default enabled)])
840 if test x$enable_avi != xno
841 then
842   PLUGINS="${PLUGINS} avi"
843 fi
844
845 dnl
846 dnl  Codec plugins
847 dnl
848
849 AC_ARG_WITH(,[Codec plugins:])
850
851 dnl
852 dnl  mad plugin
853 dnl
854 AC_ARG_ENABLE(mad,
855   [  --enable-mad            libmad module (default disabled)])
856 if test x$enable_mad = xyes
857 then
858   AC_ARG_WITH(mad,
859     [    --with-mad=PATH       path to libmad],[],[])
860   if test "x$with_mad" != "xno" -a "x$with_mad" != "x"
861   then
862     mad_CFLAGS="${mad_CFLAGS} -I$with_mad/include"
863     mad_LDFLAGS="${mad_LDFLAGS} -L$with_mad/lib"
864   fi
865
866   AC_ARG_WITH(mad-tree,
867     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
868   if test "x$with_mad_tree" != "xno" -a "x$with_mad_tree" != "x"
869   then
870     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
871     if test "x$real_mad_tree" = x
872     then
873       dnl  The given directory can't be found
874       AC_MSG_RESULT(no)
875       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
876     fi
877     dnl  Use a custom libmad
878     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
879     if test -f ${real_mad_tree}/libmad/mad.h
880     then
881       AC_MSG_RESULT(yes)
882       mad_CFLAGS="${mad_CFLAGS} -I${real_mad_tree}/libmad"
883       mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs"
884       save_LDFLAGS=$LDFLAGS
885       LDFLAGS=$mad_LDFLAGS
886       AC_CHECK_LIB(mad, mad_bit_init, [
887         BUILTINS="${BUILTINS} mad"
888         mad_LDFLAGS="${mad_LDFLAGS} -lmad"
889         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
890       ],[])
891       LDFLAGS=$save_LDFLAGS
892     else
893       AC_MSG_RESULT(no)
894       AC_MSG_ERROR([the specified tree doesn't have mad.h])
895     fi
896   else
897     CFLAGS="$vlc_CFLAGS $mad_CFLAGS"
898     LDFLAGS="$vlc_LDFLAGS $mad_LDFLAGS"
899     AC_CHECK_HEADERS(mad.h, ,
900       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
901     AC_CHECK_LIB(mad, mad_bit_init, [
902       PLUGINS="${PLUGINS} mad"
903       mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
904       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
905   fi
906 fi
907
908 dnl
909 dnl  ffmpeg decoder plugin
910 dnl
911 AC_ARG_ENABLE(ffmpeg,
912 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
913 if test "x$enable_ffmpeg" = "xyes"
914 then
915   AC_ARG_WITH(ffmpeg,
916     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
917   if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"
918   then
919     ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I$with_ffmpeg/include/libffmpeg"
920     ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L$with_ffmpeg/lib"
921   fi
922
923   AC_ARG_WITH(ffmpeg-tree, 
924   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
925   if test "x$with_ffmpeg_tree" != "x"
926   then
927     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
928     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
929     if test "x$real_ffmpeg_tree" = x
930     then
931       dnl  The given directory can't be found
932       AC_MSG_RESULT(no)
933       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
934     fi
935     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
936     then
937       dnl  Use a custom libffmpeg
938       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
939       BUILTINS="${BUILTINS} ffmpeg"
940       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a -lm"
941       ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${real_ffmpeg_tree}/libavcodec"
942     else
943       dnl  The given libavcodec wasn't built
944       AC_MSG_RESULT(no)
945       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
946     fi
947   else
948     save_CFLAGS=$CFLAGS
949     save_LDFLAGS=$LDFLAGS
950     CFLAGS="$CFLAGS $ffmpeg_CFLAGS"
951     LDFLAGS="$LDFLAGS $ffmpeg_LDFLAGS -lm"
952     AC_CHECK_LIB(avcodec, avcodec_init, [
953       BUILTINS="${BUILTINS} ffmpeg"
954       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec -lm" ],
955       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
956     CFLAGS=$save_CFLAGS
957     LDFLAGS=$save_LDFLAGS
958   fi
959 fi
960
961
962 dnl special case for BeOS
963 if test x$SYS = xbeos
964 then
965     PLUGINS="${PLUGINS} beos"
966 fi
967
968 dnl
969 dnl  a52 AC3 decoder plugin
970 dnl
971 AC_ARG_ENABLE(a52,
972   [  --enable-a52            AC3 support with liba52 (default enabled)])
973 if test "x$enable_a52" != "xno"
974 then
975   AC_ARG_WITH(a52-tree,
976     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
977   if test "x$with_a52_tree" != "xno" -a "x$with_a52_tree" != "x"
978   then
979     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
980     if test "x$real_a52_tree" = x
981     then
982       dnl  The given directory can't be found
983       AC_MSG_RESULT(no)
984       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
985     fi
986     dnl  Use a custom a52dec
987     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
988     if test -f ${real_a52_tree}/include/a52.h
989     then
990       AC_MSG_RESULT(yes)
991       a52_CFLAGS="${a52_CFLAGS} -I${real_a52_tree}"
992       a52_LDFLAGS="${a52_LDFLAGS} -L${real_a52_tree}/liba52/.libs"
993       save_LDFLAGS=$LDFLAGS
994       LDFLAGS="$a52_LDFLAGS $LDFLAGS"
995       AC_CHECK_LIB(a52, a52_free, [
996         BUILTINS="${BUILTINS} a52"
997         a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
998         a52_CFLAGS="${a52_CFLAGS} -DUSE_A52DEC_TREE"
999         ],[
1000         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1001         then
1002           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1003         else
1004           AC_MSG_ERROR([the specified tree hasn't been compiled])
1005         fi
1006       ],[-lm])
1007       LDFLAGS=$save_LDFLAGS
1008     else
1009       AC_MSG_RESULT(no)
1010       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1011     fi
1012   else dnl  no with args
1013     AC_CHECK_HEADERS(a52dec/a52.h, [
1014       AC_CHECK_LIB(a52, a52_free, [
1015         BUILTINS="${BUILTINS} a52"
1016         a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
1017         a52_CFLAGS="${a52_CFLAGS}"
1018       ],[],[-lm])
1019     ])
1020   fi
1021 fi
1022
1023 dnl
1024 dnl  ogg vorbis plugin
1025 dnl
1026 AC_ARG_ENABLE(vorbis,
1027   [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
1028 if test "x$enable_vorbis" != "xno"
1029 then
1030   AC_CHECK_HEADERS(ogg/ogg.h, [
1031     dnl disabled for the moment
1032     #PLUGINS="${PLUGINS} vorbis"
1033     vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
1034    ],[])
1035 fi
1036
1037 dnl
1038 dnl  Video plugins
1039 dnl
1040
1041 AC_ARG_WITH(,[Video plugins:])
1042
1043 dnl
1044 dnl  X11 module
1045 dnl  (enabled by default except on win32)
1046 dnl
1047 AC_ARG_ENABLE(x11,
1048   [  --enable-x11            X11 support (default enabled)])
1049 if test x$enable_x11 != xno &&
1050   (test x$SYS != xmingw32 || test x$enable_x11 = xyes); then
1051   if test x$x_includes = xNONE; then
1052     x_includes=/usr/X11R6/include
1053   fi
1054   if test x$x_libraries = xNONE; then
1055     x_libraries=/usr/X11R6/lib
1056   fi
1057   CPPFLAGS="$save_CPPFLAGS -I$x_includes"
1058   AC_CHECK_HEADERS(X11/Xlib.h, [
1059     PLUGINS="${PLUGINS} x11"
1060     x11_LDFLAGS="${x11_LDFLAGS} -L$x_libraries -lX11 -lXext"
1061     x11_CFLAGS="${x11_CFLAGS} -I$x_includes"
1062   ])
1063   CPPFLAGS="$save_CPPFLAGS"
1064 fi
1065
1066 dnl
1067 dnl  XVideo module
1068 dnl  (enabled by default except on win32)
1069 dnl
1070 AC_ARG_ENABLE(xvideo,
1071   [  --enable-xvideo         XVideo support (default enabled)])
1072 if test x$enable_xvideo != xno &&
1073   (test x$SYS != xmingw32 || test x$enable_xvideo = xyes); then
1074   if test x$x_includes = xNONE; then
1075     x_includes=/usr/X11R6/include
1076   fi
1077   if test x$x_libraries = xNONE; then
1078     x_libraries=/usr/X11R6/lib
1079   fi
1080   CPPFLAGS="$save_CPPFLAGS -I$x_includes"
1081   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1082     CFLAGS="$save_CFLAGS -L$x_libraries -lX11 -lXext"
1083     AC_CHECK_LIB(Xv_pic,XvSetPortAttribute,
1084       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1085       PLUGINS="${PLUGINS} xvideo"
1086       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L$x_libraries -lX11 -lXext -lXv_pic"
1087       xvideo_CFLAGS="${xvideo_CFLAGS} -I$x_includes",
1088       # We don't have Xv_pic, let's make xvideo.a as builtin
1089       BUILTINS="${BUILTINS} xvideo"
1090       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L$x_libraries -lX11 -lXext -lXv"
1091       xvideo_CFLAGS="${xvideo_CFLAGS} -I$x_includes")
1092   ]
1093   CPPFLAGS="$save_CPPFLAGS")
1094 fi
1095
1096 dnl
1097 dnl  SDL module
1098 dnl
1099 AC_ARG_ENABLE(sdl,
1100   [  --enable-sdl            SDL support (default enabled)])
1101 if test "x$enable_sdl" != "xno"
1102 then
1103   SDL_PATH=$PATH
1104   AC_ARG_WITH(sdl-config-path,
1105     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1106     [ if test "x$with_sdl_config_path" != "xno"
1107       then
1108         SDL_PATH="$with_sdl_config_path:$PATH"
1109       fi ])
1110   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, $SDL_PATH)
1111   SDL_CONFIG=${SDL12_CONFIG}
1112   SDL_HEADER="SDL12/SDL.h"
1113   if test x${SDL_CONFIG} = xno
1114   then
1115     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
1116     SDL_CONFIG=${SDL11_CONFIG}
1117     SDL_HEADER="SDL11/SDL.h"
1118   fi
1119   if test x${SDL_CONFIG} = xno
1120   then
1121     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
1122     SDL_HEADER="SDL/SDL.h"
1123   fi
1124   if test x${SDL_CONFIG} != xno
1125   then
1126     PLUGINS="${PLUGINS} sdl"
1127     sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
1128     sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
1129     CPPFLAGS="$save_CPPFLAGS $sdl_CFLAGS"
1130     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1131       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1132       [ AC_MSG_ERROR([The development package for SDL is not installed. 
1133 Please install it and try again. Alternatively you can also configure with 
1134 --disable-sdl.])
1135       ])
1136     CPPFLAGS="$save_CPPFLAGS"
1137     if expr 1.1.5 \> `$SDL_CONFIG --version` >/dev/null
1138     then
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     fi
1143   elif test "x$enable_sdl" =  "xyes"
1144   then
1145     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1146 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1147     ])
1148   fi
1149 fi
1150
1151 dnl
1152 dnl  Windows DirectX module
1153 dnl
1154 AC_ARG_ENABLE(directx,
1155   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1156 if test "x$enable_directx" != "xno"
1157 then
1158   if test x$SYS = xmingw32
1159   then
1160     AC_ARG_WITH(directx, 
1161     [    --with-directx=PATH   Win32 DirectX headers and libraries])
1162     if test "x$with_directx" = "x"
1163     then
1164       AC_CHECK_HEADERS(ddraw.h,
1165       [ PLUGINS="${PLUGINS} directx"
1166         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32" ])
1167     else
1168       AC_MSG_CHECKING(for directX headers in ${with_directx})
1169       if test -f ${with_directx}/ddraw.h
1170       then
1171         PLUGINS="${PLUGINS} directx"
1172         directx_LDFLAGS="${directx_LDFLAGS} -L${with_directx}/lib -lgdi32"
1173         directx_CFLAGS="${directx_CFLAGS} -I${with_directx}"
1174         AC_MSG_RESULT(yes)
1175       else
1176         AC_MSG_RESULT(no)
1177         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1178       fi
1179     fi
1180   fi
1181 fi
1182
1183 dnl
1184 dnl  Linux framebuffer module
1185 dnl
1186 AC_ARG_ENABLE(fb,
1187   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
1188     if test x$enable_fb != xno
1189     then
1190       AC_CHECK_HEADERS(linux/fb.h, [
1191         PLUGINS="${PLUGINS} fb"
1192       ])
1193     fi
1194
1195 dnl
1196 dnl  Linux MGA module
1197 dnl
1198 AC_ARG_ENABLE(mga,
1199   [  --enable-mga            Linux kernel Matrox support (default disabled)],
1200   [ if test x$enable_mga = xyes
1201     then
1202       PLUGINS="${PLUGINS} mga xmga"
1203     fi ])
1204
1205 dnl
1206 dnl  GGI module
1207 dnl
1208 AC_ARG_ENABLE(ggi,
1209   [  --enable-ggi            GGI support (default disabled)])
1210 if test x$enable_ggi = xyes
1211 then
1212   PLUGINS="${PLUGINS} ggi"
1213   ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
1214   AC_ARG_WITH(ggi,
1215     [    --with-ggi=PATH       path to libggi],
1216     [ if test "x$with_ggi" != "xno" -a "x$with_ggi" != "x"
1217       then
1218         CFLAGS_GGI="${CFLAGS_GGI} -I$with_ggi/include"
1219         ggi_LDFLAGS="${ggi_LDFLAGS} -L$with_ggi/lib"
1220       fi ])
1221 fi
1222
1223 dnl
1224 dnl  Glide module
1225 dnl
1226 AC_ARG_ENABLE(glide,
1227   [  --enable-glide          Glide (3dfx) support (default disabled)])
1228 if test x$enable_glide = xyes
1229 then
1230   PLUGINS="${PLUGINS} glide"
1231   glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
1232   glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
1233   AC_ARG_WITH(glide,
1234     [    --with-glide=PATH     path to libglide],
1235     [ if test "x$with_glide" != "xno" -a "x$with_glide" != "x"
1236       then
1237         glide_CFLAGS="${glide_CFLAGS} -I$with_glide/include"
1238         glide_LDFLAGS="${glide_LDFLAGS} -L$with_glide/lib"
1239       fi ])
1240 fi
1241
1242 dnl
1243 dnl  AA plugin
1244 dnl
1245 AC_ARG_ENABLE(aa,
1246   [  --enable-aa             aalib output (default disabled)])
1247 if test x$enable_aa = xyes
1248 then
1249   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
1250   if test x$have_aa = xtrue
1251   then
1252     PLUGINS="${PLUGINS} aa"
1253     aa_LDFLAGS="${aa_LDFLAGS} -laa"
1254   fi
1255 fi
1256
1257 dnl
1258 dnl  Audio plugins
1259 dnl
1260
1261 AC_ARG_WITH(,[Audio plugins:])
1262
1263 dnl
1264 dnl  OSS /dev/dsp module (enabled by default except on win32)
1265 dnl
1266 AC_ARG_ENABLE(dsp,
1267   [  --enable-dsp            Linux /dev/dsp support (enabled on Linux)])
1268
1269 if test x$enable_dsp != xno &&
1270   (test x$SYS != xmingw32 || test x$enable_dsp = xyes)
1271 then
1272   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1273     PLUGINS="${PLUGINS} dsp"
1274     AC_CHECK_LIB(ossaudio,main,dsp_LDFLAGS="${dsp_LDFLAGS} -lossaudio")
1275   ])
1276 fi
1277
1278 dnl
1279 dnl  Esound module
1280 dnl
1281 AC_ARG_ENABLE(esd,
1282   [  --enable-esd            Esound library support (default disabled)],
1283   [if test x$enable_esd = xyes
1284    then
1285      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1286      if test x${ESD_CONFIG} != xno
1287      then
1288        PLUGINS="${PLUGINS} esd"
1289        esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
1290        esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
1291      fi
1292    fi])
1293
1294 dnl
1295 dnl  aRts module
1296 dnl
1297 AC_ARG_ENABLE(arts,
1298   [  --enable-arts           aRts sound server (default disabled)],
1299   [if test x$enable_arts = xyes
1300    then
1301      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1302      if test x${ARTS_CONFIG} != xno
1303      then
1304        PLUGINS="${PLUGINS} arts"
1305        arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
1306        arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
1307      fi
1308    fi])
1309
1310 dnl
1311 dnl  ALSA module
1312 dnl
1313 AC_ARG_ENABLE(alsa,
1314   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1315   [if test x$enable_alsa = xyes
1316    then
1317      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1318      if test x$have_alsa = xtrue
1319      then
1320        PLUGINS="${PLUGINS} alsa"
1321        alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
1322      fi
1323    fi])
1324
1325 dnl
1326 dnl  win32 waveOut plugin
1327 dnl
1328 AC_ARG_ENABLE(waveout,
1329   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1330 if test "x$enable_waveout" != "xno" -a x$SYS = xmingw32
1331   then
1332     PLUGINS="${PLUGINS} waveout"
1333     waveout_LDFLAGS="-lwinmm"
1334 fi
1335
1336 dnl
1337 dnl  Interface plugins
1338 dnl
1339
1340 AC_ARG_WITH(,[Interface plugins:])
1341
1342 dnl
1343 dnl  Gtk+ module
1344 dnl
1345 AC_ARG_ENABLE(gtk,
1346   [  --enable-gtk            Gtk+ support (default enabled)])
1347 if test x$enable_gtk != xno
1348 then
1349   GTK_PATH=$PATH
1350   AC_ARG_WITH(gtk-config-path,
1351     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1352     [ if test "x$with_gtk_config_path" != "xno"
1353       then
1354         GTK_PATH="$with_gtk_config_path:$PATH"
1355       fi ])
1356   # look for gtk-config
1357   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, $GTK_PATH)
1358   GTK_CONFIG=${GTK12_CONFIG}
1359   if test x${GTK_CONFIG} = xno
1360   then
1361     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, $GTK_PATH)
1362   fi
1363   if test x${GTK_CONFIG} != xno
1364   then
1365     if expr 1.2.0 \> `$GTK_CONFIG --version` >/dev/null
1366     then
1367       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.])
1368     fi
1369     gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk`"
1370     gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
1371     # now look for the gtk.h header
1372     CPPFLAGS="$save_CPPFLAGS $gtk_CFLAGS"
1373     ac_cv_gtk_headers=yes
1374     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1375       ac_cv_gtk_headers=no
1376       echo "Cannot find gtk development headers."
1377     ])
1378     if test "x$ac_cv_gtk_headers" = xyes
1379     then
1380       PLUGINS="${PLUGINS} gtk"
1381       ALIASES="${ALIASES} gvlc"
1382     fi
1383     CPPFLAGS="$save_CPPFLAGS"
1384   fi
1385 fi
1386
1387 dnl
1388 dnl  Gnome module
1389 dnl
1390 AC_ARG_ENABLE(gnome,
1391   [  --enable-gnome          Gnome interface support (default disabled)],
1392   [if test x$enable_gnome = xyes; then
1393     # look for gnome-config
1394     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1395     if test -x ${GNOME_CONFIG}
1396     then
1397        gnome_CFLAGS="${gnome_CFLAGS} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1398        gnome_LDFLAGS="${gnome_LDFLAGS} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1399     fi
1400     # now look for the gnome.h header
1401     CPPFLAGS="$save_CPPFLAGS $gnome_CFLAGS"
1402     AC_CHECK_HEADERS(gnome.h, [
1403       PLUGINS="${PLUGINS} gnome"
1404       ALIASES="${ALIASES} gnome-vlc"
1405      ],[
1406       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1407 developement tools or remove the --enable-gnome option])
1408      ])
1409     CPPFLAGS="$save_CPPFLAGS"
1410   fi])
1411
1412 dnl
1413 dnl  Qt module
1414 dnl
1415 AC_ARG_ENABLE(qt,
1416   [  --enable-qt             Qt interface support (default disabled)],
1417   [if test x$enable_qt = xyes; then
1418      PLUGINS="${PLUGINS} qt"
1419      ALIASES="${ALIASES} qvlc"
1420      qt_LDFLAGS="${qt_LDFLAGS} -lqt -L${QTDIR}/lib"
1421      qt_CFLAGS="${qt_CFLAGS} -I/usr/include/qt -I${QTDIR}/include"
1422      if test -x ${QTDIR}/bin/moc
1423      then
1424        MOC=${QTDIR}/bin/moc
1425      else
1426        MOC=moc
1427      fi
1428    fi])
1429
1430 dnl 
1431 dnl  KDE module
1432 dnl
1433 AC_ARG_ENABLE(kde,
1434   [  --enable-kde            KDE interface support (default disabled)],
1435   [if test x$enable_kde = xyes; then
1436      PLUGINS="${PLUGINS} kde"
1437      ALIASES="${ALIASES} kvlc"
1438      kde_LDFLAGS="${kde_LDFLAGS} -L${KDEDIR}/lib -lkfile"
1439      kde_CFLAGS="${kde_CFLAGS} -I/usr/include/kde -I/usr/include/qt"
1440      kde_CFLAGS="${kde_CFLAGS} -I${KDEDIR}/include -I${QTDIR}/include"
1441      if test -x ${QTDIR}/bin/moc
1442      then
1443        MOC=${QTDIR}/bin/moc
1444      else
1445        MOC=moc
1446      fi
1447    fi])
1448
1449 dnl
1450 dnl  MacOS X module
1451 dnl
1452 AC_ARG_ENABLE(macosx,
1453   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1454   [if test x$enable_macosx = xyes
1455    then
1456      BUILTINS="${BUILTINS} macosx"
1457      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework AGL -framework QuickTime -lobjc -ObjC"
1458    fi],
1459   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1460      BUILTINS="${BUILTINS} macosx"
1461      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework AGL -framework QuickTime -lobjc -ObjC"
1462    )])
1463
1464 dnl
1465 dnl  QNX RTOS module
1466 dnl
1467 AC_ARG_ENABLE(qnx,
1468   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1469     if test x$enable_qnx != xno
1470     then
1471       AC_CHECK_HEADERS(Ph.h, [
1472         PLUGINS="${PLUGINS} qnx"
1473         qnx_LDFLAGS="${qnx_LDFLAGS} -lasound -lph"
1474       ])
1475     fi
1476
1477 dnl
1478 dnl  Windows native interface module, built with Borland C++ Builder
1479 dnl
1480 AC_ARG_ENABLE(intfwin,
1481 [  --enable-intfwin        Win32 interface support (default disabled)],
1482 [ if test "x$enable_intfwin" != "xno"
1483   then
1484     AC_ARG_WITH(bcbuilder, 
1485     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1486     if test "x$with_bcbuilder" != "x"
1487     then
1488       BCBUILDER="$with_bcbuilder"
1489     fi
1490     PLUGINS="${PLUGINS} intfwin"
1491   fi ])
1492
1493 dnl
1494 dnl  ncurses module
1495 dnl
1496 AC_ARG_ENABLE(ncurses,
1497   [  --enable-ncurses        ncurses interface support (default disabled)],
1498   [if test x$enable_ncurses = xyes; then
1499      PLUGINS="${PLUGINS} ncurses"
1500      ncurses_LDFLAGS="${ncurses_LDFLAGS} -lncurses"
1501    fi])
1502
1503 dnl
1504 dnl  XOSD plugin
1505 dnl
1506 AC_ARG_ENABLE(xosd,
1507   [  --enable-xosd           xosd interface support (default disabled)])
1508 if test x$enable_xosd = xyes
1509 then
1510   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
1511   if test x$have_xosd = xtrue
1512   then
1513     PLUGINS="${PLUGINS} xosd"
1514     xosd_LDFLAGS="${xosd_LDFLAGS} -lxosd"
1515   fi
1516 fi
1517
1518 dnl
1519 dnl  Lirc plugin
1520 dnl
1521 AC_ARG_ENABLE(lirc,
1522   [  --enable-lirc           lirc support (default disabled)])
1523 if test x$enable_lirc = xyes
1524 then
1525   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
1526   if test x$have_lirc = xtrue
1527   then
1528     PLUGINS="${PLUGINS} lirc"
1529     lirc_LDFLAGS="${lirc_LDFLAGS} -llirc_client"
1530   fi
1531 fi
1532
1533 AC_ARG_WITH(,[Misc options:])
1534
1535 dnl
1536 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
1537 dnl
1538 dnl  We give the user the opportunity to specify
1539 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
1540 dnl
1541 AC_ARG_WITH(words,
1542   [  --with-words=endianness set endianness (big or little)])
1543   case "x$with_words" in
1544     xbig)
1545       ac_cv_c_bigendian=yes
1546       ;;
1547     xlittle)
1548       ac_cv_c_bigendian=no
1549       ;;
1550     *)
1551       dnl  Try to guess endianness by matching patterns on a compiled
1552       dnl  binary, by looking for an ASCII or EBCDIC string
1553       AC_CACHE_CHECK([whether the byte order is big-endian],
1554         [ac_cv_c_bigendian],
1555         [ac_cv_c_bigendian=unknown
1556         [cat >conftest.c <<EOF
1557         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
1558         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
1559         void _a(void) { char*s = (char*)am; s = (char *)ai; }
1560         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
1561         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
1562         void _e(void) { char*s = (char*)em; s = (char*)ei; }
1563         int main(void) { _a(); _e(); return 0; }
1564 EOF
1565         ]
1566         if test -f conftest.c
1567         then 
1568           if ${CC-cc} -c conftest.c -o conftest.o >config.log 2>&1 \
1569               && test -f conftest.o
1570           then
1571             if test "`strings conftest.o | grep BIGenDianSyS`"
1572             then
1573               ac_cv_c_bigendian=yes
1574             fi
1575             if test "`strings conftest.o | grep LiTTleEnDian`"
1576             then
1577               ac_cv_c_bigendian=no
1578             fi
1579           fi
1580         fi
1581       ])
1582       if test x$ac_cv_c_bigendian = xunknown
1583       then
1584         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
1585       fi
1586       ;;
1587   esac
1588 dnl  Now we know what to use for endianness, just put it in the header
1589 if test $ac_cv_c_bigendian = yes
1590 then
1591   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
1592 fi
1593
1594 dnl
1595 dnl  Profiling
1596 dnl
1597 PROFILING=0
1598
1599 GPROF=0
1600 AC_ARG_ENABLE(gprof,
1601 [  --enable-gprof          gprof profiling (default disabled)],
1602 [ if test "x$enable_gprof" = "xyes"
1603   then
1604     GPROF=1
1605     PROFILING="gprof"
1606   fi
1607 ])
1608
1609 CPROF=0
1610 AC_ARG_ENABLE(cprof,
1611 [  --enable-cprof          cprof profiling (default disabled)],
1612 [ if test "x$enable_cprof" = "xyes"
1613   then
1614     LDFLAGS="${LDFLAGS} -lcprof"
1615     CPROF=1
1616     PROFILING="cprof"
1617   fi
1618 ])
1619
1620 dnl
1621 dnl  GNU portable threads
1622 dnl
1623 AC_ARG_ENABLE(pth,
1624   [  --enable-pth            GNU Pth support (default disabled)],
1625   [ if test "x$enable_pth" = "xyes"; then
1626     AC_CHECK_LIB(pth,pth_init)
1627     AC_EGREP_HEADER(pth_init,pth.h,[
1628       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
1629                 Define if <pth.h> defines pth_init)
1630     THREAD_LIB="-lpth"
1631     fi])
1632 ])
1633
1634 dnl
1635 dnl  State Threads
1636 dnl
1637 AC_ARG_ENABLE(st,
1638   [  --enable-st             State Threads (default disabled)],
1639   [ if test "x$enable_st" = "xyes"; then
1640     AC_CHECK_LIB(st,st_init)
1641     AC_EGREP_HEADER(st_init,st.h,[
1642       AC_DEFINE(ST_INIT_IN_ST_H, 1,
1643                 Define if <st.h> defines st_init)
1644     THREAD_LIB="-lst"
1645     fi])
1646 ])
1647
1648 vlc_LDFLAGS="${vlc_LDFLAGS} ${THREAD_LIB}"
1649 plugins_LDFLAGS="${plugins_LDFLAGS} ${THREAD_LIB}"
1650
1651 dnl
1652 dnl  Plug-ins - this must be AT THE END
1653 dnl
1654 AC_ARG_ENABLE(plugins,
1655   [  --disable-plugins       make all plug-ins built-in (default plug-ins enabled)],
1656   [if test x$enable_plugins = xno
1657    then
1658      BUILTINS="${BUILTINS} ${PLUGINS}"
1659      PLUGINS=
1660    fi])
1661
1662 dnl Automagically disable plug-ins if there is no system support for .so files
1663 dnl don't forget vlc-win32 still can load .so as plugins
1664 if test x$ac_cv_header_dlfcn_h = xno -a x$ac_cv_header_image_h = xno -a x$SYS != xmingw32
1665 then
1666   echo "*** Your system doesn't have plug-in support. All plug-ins will be compiled"
1667   echo "as built-in"
1668   BUILTINS="${BUILTINS} ${PLUGINS}"
1669   PLUGINS=
1670 fi
1671
1672 dnl
1673 dnl  Stuff used by the program
1674 dnl
1675 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc $VERSION $CODENAME Copyright 1996-2002 VideoLAN", [Simple version string])
1676 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version $VERSION $CODENAME - (c) 1996-2002 VideoLAN", [Copyright string])
1677 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "$CONFIGURE_LINE", [The ./configure command line])
1678
1679 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
1680 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__MODULE_$VLC_SYMBOL", [String suffix for module functions])
1681 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, $VLC_SYMBOL, [Symbol suffix for module functions])
1682
1683 DATA_PATH="${ac_tool_prefix}/share/videolan"
1684 AC_SUBST(DATA_PATH)
1685 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
1686 AC_SUBST(PLUGIN_PATH)
1687
1688 dnl
1689 dnl  Restore *FLAGS
1690 dnl
1691 CPPFLAGS="${save_CPPFLAGS}"
1692 CFLAGS="${save_CFLAGS}"
1693 LDFLAGS="${save_LDFLAGS}"
1694
1695 dnl 
1696 dnl  Configuration is finished
1697 dnl
1698 AC_SUBST(SYS)
1699 AC_SUBST(ARCH)
1700 AC_SUBST(PLUGINS)
1701 AC_SUBST(BUILTINS)
1702 AC_SUBST(ALIASES)
1703 AC_SUBST(DEBUG)
1704 AC_SUBST(ASM)
1705 AC_SUBST(CPROF)
1706 AC_SUBST(GPROF)
1707 AC_SUBST(OPTIMS)
1708 AC_SUBST(TUNING)
1709 AC_SUBST(RELEASE)
1710 AC_SUBST(MOC)
1711 AC_SUBST(WINDRES)
1712 AC_SUBST(BCBUILDER)
1713 AC_SUBST(PACKAGE)
1714 AC_SUBST(VERSION)
1715 AC_SUBST(NEED_GETOPT)
1716
1717 AC_SUBST(CFLAGS_OPTIM)
1718 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
1719 AC_SUBST(LDFLAGS)
1720
1721 AC_SUBST(vlc_CFLAGS)
1722 AC_SUBST(plugins_CFLAGS)
1723 AC_SUBST(builtins_CFLAGS)
1724
1725 AC_SUBST(a52_CFLAGS)
1726 AC_SUBST(arts_CFLAGS)
1727 AC_SUBST(chroma_i420_yuy2_mmx_CFLAGS)
1728 AC_SUBST(dvd_CFLAGS)
1729 AC_SUBST(dvdread_CFLAGS)
1730 AC_SUBST(mpeg_ts_dvbpsi_CFLAGS)
1731 AC_SUBST(directx_CFLAGS)
1732 AC_SUBST(esd_CFLAGS)
1733 AC_SUBST(ffmpeg_CFLAGS)
1734 AC_SUBST(glide_CFLAGS)
1735 AC_SUBST(gnome_CFLAGS)
1736 AC_SUBST(gtk_CFLAGS)
1737 AC_SUBST(kde_CFLAGS)
1738 AC_SUBST(idctaltivec_CFLAGS)
1739 AC_SUBST(macosx_CFLAGS)
1740 AC_SUBST(mad_CFLAGS)
1741 AC_SUBST(memcpyaltivec_CFLAGS)
1742 AC_SUBST(motionaltivec_CFLAGS)
1743 AC_SUBST(qt_CFLAGS)
1744 AC_SUBST(sdl_CFLAGS)
1745 AC_SUBST(x11_CFLAGS)
1746 AC_SUBST(xvideo_CFLAGS)
1747
1748 AC_SUBST(vlc_LDFLAGS)
1749 AC_SUBST(plugins_LDFLAGS)
1750 AC_SUBST(builtins_LDFLAGS)
1751
1752 AC_SUBST(a52_LDFLAGS)
1753 AC_SUBST(aa_LDFLAGS)
1754 AC_SUBST(alsa_LDFLAGS)
1755 AC_SUBST(arts_LDFLAGS)
1756 AC_SUBST(beos_LDFLAGS)
1757 AC_SUBST(chroma_i420_rgb_LDFLAGS)
1758 AC_SUBST(directx_LDFLAGS)
1759 AC_SUBST(dsp_LDFLAGS)
1760 AC_SUBST(dvd_LDFLAGS)
1761 AC_SUBST(dvdread_LDFLAGS)
1762 AC_SUBST(mpeg_ts_dvbpsi_LDFLAGS)
1763 AC_SUBST(esd_LDFLAGS)
1764 AC_SUBST(filter_distort_LDFLAGS)
1765 AC_SUBST(ffmpeg_LDFLAGS)
1766 AC_SUBST(ggi_LDFLAGS)
1767 AC_SUBST(glide_LDFLAGS)
1768 AC_SUBST(gnome_LDFLAGS)
1769 AC_SUBST(gtk_LDFLAGS)
1770 AC_SUBST(http_LDFLAGS)
1771 AC_SUBST(idctaltivec_LDFLAGS)
1772 AC_SUBST(imdct_LDFLAGS)
1773 AC_SUBST(imdct3dn_LDFLAGS)
1774 AC_SUBST(imdctsse_LDFLAGS)
1775 AC_SUBST(ipv4_LDFLAGS)
1776 AC_SUBST(ipv6_LDFLAGS)
1777 AC_SUBST(kde_LDFLAGS)
1778 AC_SUBST(lirc_LDFLAGS)
1779 AC_SUBST(macosx_LDFLAGS)
1780 AC_SUBST(mad_LDFLAGS)
1781 AC_SUBST(memcpyaltivec_LDFLAGS)
1782 AC_SUBST(motionaltivec_LDFLAGS)
1783 AC_SUBST(ncurses_LDFLAGS)
1784 AC_SUBST(qnx_LDFLAGS)
1785 AC_SUBST(qt_LDFLAGS)
1786 AC_SUBST(rc_LDFLAGS)
1787 AC_SUBST(sdl_LDFLAGS)
1788 AC_SUBST(vcd_LDFLAGS)
1789 AC_SUBST(vorbis_LDFLAGS)
1790 AC_SUBST(waveout_LDFLAGS)
1791 AC_SUBST(x11_LDFLAGS)
1792 AC_SUBST(xvideo_LDFLAGS)
1793 AC_SUBST(xosd_LDFLAGS)
1794
1795 AC_OUTPUT([Makefile.config Makefile.opts po/Makefile.in])
1796
1797 echo "
1798 vlc configuration
1799 --------------------
1800 vlc version           : ${VERSION}
1801 system                : ${SYS}
1802 architecture          : ${ARCH}
1803 optimizations         : ${OPTIMS}
1804 tuning                : ${TUNING}
1805 debug mode            : ${DEBUG}
1806 release               : ${RELEASE}
1807 profiling             : ${PROFILING}
1808 need builtin getopt   : ${NEED_GETOPT}
1809 built-in modules      :${BUILTINS}
1810 plug-in modules       :${PLUGINS}
1811 vlc aliases           :${ALIASES}
1812
1813 You may now tune Makefile.opts at your convenience, for instance to choose
1814 which modules get compiled as plugins.
1815
1816 To build vlc and its plugins, type \`$VLC_MAKE'.
1817 "
1818