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