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