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