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