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