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