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