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