]> git.sesse.net Git - vlc/blob - configure.in
* ./doc/developer/decoders.xml: fixed a typo preventing compilation.
[vlc] / configure.in
1 dnl Autoconf settings for vlc
2 AC_INIT(include/main.h)
3 AC_CONFIG_HEADER(include/defs.h)
4
5 AC_CANONICAL_SYSTEM
6
7 VERSION="0.3.0"
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 fr ja no ru nl"
43
44 AC_DEFINE_UNQUOTED(VLC_PACKAGE, "vlc", [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     save_LDFLAGS="${save_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)
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,vlc_LDFLAGS="${vlc_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/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 Checks for __attribute__(aligned()) directive
335 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
336     [ac_cv_c_attribute_aligned],
337     [ac_cv_c_attribute_aligned=0
338         CFLAGS="${save_CFLAGS} -Werror"
339     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
340         AC_TRY_COMPILE([],
341         [static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0; return c;],
342         [ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try])
343     done])
344 if test x"$ac_cv_c_attribute_aligned" != x"0"; then
345     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
346         [$ac_cv_c_attribute_aligned],[Maximum supported data alignment])
347 fi
348
349 dnl End of the bizarre compilation tests
350 CFLAGS="${save_CFLAGS}"
351 CPPFLAGS="${save_CPPFLAGS}"
352 LDFLAGS="${save_LDFLAGS}"
353
354 dnl Check for boolean_t
355 AC_CACHE_CHECK([for boolean_t in sys/types.h],
356     [ac_cv_c_boolean_t_sys_types_h],
357     [AC_TRY_COMPILE([#include <sys/types.h>], [boolean_t foo;],
358      ac_cv_c_boolean_t_sys_types_h=yes, ac_cv_c_boolean_t_sys_types_h=no)])
359 if test x"$ac_cv_c_boolean_t_sys_types_h" != x"no"; then
360     AC_DEFINE(BOOLEAN_T_IN_SYS_TYPES_H, 1, Define if <sys/types.h> defines boolean_t.)
361 fi
362
363 AC_CACHE_CHECK([for boolean_t in pthread.h],
364     [ac_cv_c_boolean_t_pthread_h],
365     [AC_TRY_COMPILE([#include <pthread.h>], [boolean_t foo;],
366      ac_cv_c_boolean_t_pthread_h=yes, ac_cv_c_boolean_t_pthread_h=no)])
367 if test x"$ac_cv_c_boolean_t_pthread_h" != x"no"; then
368     AC_DEFINE(BOOLEAN_T_IN_PTHREAD_H, 1, Define if <pthread.h> defines boolean_t.)
369 fi
370
371 AC_CACHE_CHECK([for boolean_t in cthreads.h],
372     [ac_cv_c_boolean_t_cthreads_h],
373     [AC_TRY_COMPILE([#include <cthreads.h>], [boolean_t foo;],
374      ac_cv_c_boolean_t_cthreads_h=yes, ac_cv_c_boolean_t_cthreads_h=no)])
375 if test x"$ac_cv_c_boolean_t_cthreads_h" != x"no"; then
376     AC_DEFINE(BOOLEAN_T_IN_CTHREADS_H, 1, Define if <cthreads.h> defines boolean_t.)
377 fi
378
379 dnl
380 dnl  Check the CPU
381 dnl
382 case x"${target_cpu}" in
383   x)
384     ARCH=unknown
385     ;;
386   *)
387     ARCH="${target_cpu}"
388     ;;
389 esac
390
391 dnl
392 dnl  default modules
393 dnl
394 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"
395 PLUGINS="${PLUGINS} dummy null rc logger mpeg_es mpeg_ps mpeg_ts file udp http ipv4 memcpy lpcm_adec ac3_spdif spudec filter_deinterlace filter_invert filter_wall filter_transform filter_distort fx_scope"
396
397 dnl
398 dnl  Accelerated modules
399 dnl
400 MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mmx chroma_i422_yuy2_mmx chroma_i420_ymga_mmx"
401 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
402 THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
403 SSE_MODULES="imdctsse downmixsse"
404 ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
405
406 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
407     [ac_cv_mmx_inline],
408     [AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
409                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
410 if test x"$ac_cv_mmx_inline" != x"no"; then
411   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
412 fi
413
414 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
415     [ac_cv_mmxext_inline],
416     [AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
417                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
418 if test x"$ac_cv_mmxext_inline" != x"no"; then
419   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
420 fi
421
422 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
423     [ac_cv_3dnow_inline],
424     [AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
425                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
426 if test x"$ac_cv_3dnow_inline" != x"no"; then
427   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
428   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
429 fi
430
431 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
432     [ac_cv_sse_inline],
433     [AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
434                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
435 if test x"$ac_cv_sse_inline" != x"no"; then
436   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
437   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
438 fi
439
440 # don't try to grok altivec with native mingw32 it doesn't work right now
441 # we should be able to remove this test with future versions of mingw32
442 if test x$SYS != xmingw32; then
443 AC_CACHE_CHECK([if \$CC groks Altivec inline assembly],
444     [ac_cv_altivec_inline],
445     [AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
446          ac_cv_altivec_inline=yes,
447          [save_CFLAGS=$CFLAGS
448           CFLAGS="$CFLAGS -Wa,-m7400"
449           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
450             [ac_cv_altivec_inline="-Wa,-m7400"],
451             ac_cv_altivec_inline=no)
452           CFLAGS=$save_CFLAGS
453          ])])
454 if test x"$ac_cv_altivec_inline" != x"no"; then
455   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks ALTIVEC inline assembly.)
456   if test x"$ac_cv_altivec_inline" != x"yes"; then
457     idctaltivec_CFLAGS="$idctaltivec_CFLAGS $ac_cv_altivec_inline"
458     motionaltivec_CFLAGS="$motionaltivec_CFLAGS $ac_cv_altivec_inline"
459     memcpyaltivec_CFLAGS="$memcpyaltivec_CFLAGS $ac_cv_altivec_inline"
460     vlc_CFLAGS="$vlc_CFLAGS $ac_cv_altivec_inline"
461   fi
462   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
463 fi
464
465 AC_CACHE_CHECK([if \$CC groks Altivec C extensions],
466     [ac_cv_c_altivec],
467     [save_CFLAGS=$CFLAGS
468      CFLAGS="$CFLAGS -faltivec"
469      # Darwin test
470      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
471         ac_cv_c_altivec=-faltivec, [
472         # Linux/PPC test
473         CFLAGS="$save_CFLAGS $idctaltivec_CFLAGS -fvec"
474         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
475             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
476         ])
477      CFLAGS=$save_CFLAGS
478     ])
479 if test x"$ac_cv_c_altivec" != x"no"; then
480   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C altivec extensions.)
481   idctaltivec_CFLAGS="$idctaltivec_CFLAGS $ac_cv_c_altivec"
482   motionaltivec_CFLAGS="$motionaltivec_CFLAGS $ac_cv_c_altivec"
483   memcpyaltivec_CFLAGS="$memcpyaltivec_CFLAGS $ac_cv_c_altivec"
484   vlc_CFLAGS="$vlc_CFLAGS $ac_cv_c_altivec"
485   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
486 fi
487
488 AC_CACHE_CHECK([if linker needs -framework vecLib],
489     [ac_cv_ld_altivec],
490     [save_LDFLAGS=$LDFLAGS
491      LDFLAGS="$LDFLAGS -framework vecLib"
492      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
493      LDFLAGS=$save_LDFLAGS
494     ])
495 if test x"$ac_cv_ld_altivec" != x"no"; then
496   idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
497   motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
498   memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
499   vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
500 fi
501 fi # end if mingw32
502
503
504 AC_ARG_WITH(,[])
505 AC_ARG_WITH(,[Optimization options:])
506
507 dnl
508 dnl  Special arch tuning
509 dnl
510 AC_ARG_WITH(tuning,
511 [  --with-tuning=ARCH      enable special tuning for an architecture
512                           (default i686 on IA-32 and 750 on PPC)])
513 if test "x$withval" != "x"; then
514     TUNING=$withval
515 else
516     if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xi486 -o x${target_cpu} = xi386; then TUNING="pentiumpro"
517     else
518         if test x${target_cpu} = xpowerpc; then TUNING="750"; fi
519     fi
520 fi
521
522 dnl
523 dnl  x86 accelerations
524 dnl
525 if test x${target_cpu} = xi686 -o x${target_cpu} = xi586 -o x${target_cpu} = xx86 -o x${target_cpu} = xi386
526 then
527     ARCH="${ARCH} mmx"
528     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"
529 fi
530
531 dnl
532 dnl  Enable/disable optimizations
533 dnl
534 AC_ARG_ENABLE(optimizations,
535 [  --disable-optimizations disable compiler optimizations (default enabled)],
536 [ if test x$enableval = xno; then OPTIMS=0; fi ],
537 [ OPTIMS=1 ])
538
539 dnl
540 dnl  AltiVec acceleration
541 dnl
542 AC_ARG_ENABLE(altivec,
543 [  --disable-altivec       disable altivec optimizations (default enabled on PPC)],
544 [ if test x$enableval = xyes; then ARCH="${ARCH} altivec";
545     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
546 [ if test x${target_cpu} = xpowerpc; then ARCH="${ARCH} altivec";
547     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
548
549 dnl
550 dnl  Debugging mode
551 dnl
552 DEBUG=0
553 AC_ARG_ENABLE(debug,
554 [  --enable-debug          debug mode (default disabled)],
555 [ if test x$enableval = xyes; then DEBUG=1; fi ])
556
557 dnl
558 dnl  Enable release-specific flags
559 dnl
560 RELEASE=0
561 AC_ARG_ENABLE(release,
562 [  --enable-release        activate extra optimizations (default disabled)],
563 [ if test x$enableval = xyes; then RELEASE=1; fi ],
564 [ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
565
566 dnl
567 dnl  Input plugins
568 dnl
569
570 AC_ARG_WITH(,[Input plugins:])
571
572 dnl
573 dnl  DVD module: optionally check for installed libdvdcss
574 dnl
575 AC_ARG_ENABLE(dvd,
576 [  --enable-dvd            DVD input module (default enabled)])
577 if test "x$enableval" != "xno"
578 then
579   AC_ARG_WITH(dvdcss, 
580   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
581   AC_ARG_WITH(dvdcss-tree, 
582   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
583   case "x$with_dvdcss" in
584   x|xyes)
585     if test "x$with_dvdcss_tree" = x
586     then
587       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
588         [ PLUGINS="${PLUGINS} dvd"
589           dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
590         [ 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.])
591           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
592     else
593       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
594       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
595       if test "x$real_dvdcss_tree" = x
596       then
597         dnl  The given directory can't be found
598         AC_MSG_RESULT(no)
599         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
600       fi
601       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
602       then
603         dnl  Use a custom libdvdcss
604         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
605         BUILTINS="${BUILTINS} dvd"
606         dvd_LDFLAGS="${dvd_LDFLAGS} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
607         dvd_CFLAGS="${dvd_CFLAGS} -I${real_dvdcss_tree}/src"
608       else
609         dnl  The given libdvdcss wasn't built
610         AC_MSG_RESULT(no)
611         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
612       fi
613     fi
614   ;;
615   xno)
616     dnl  Compile without dvdcss (dlopen version, works only under Linux)
617     PLUGINS="${PLUGINS} dvd"
618     dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
619     dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
620   ;;
621   *)
622     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
623     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
624     then
625       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
626       AC_MSG_RESULT(yes)
627       PLUGINS="${PLUGINS} dvd"
628       dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
629       dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
630     else
631       dnl  No libdvdcss could be found, sorry
632       AC_MSG_RESULT(no)
633       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
634     fi
635   ;;
636   esac
637 fi
638
639 dnl
640 dnl dvdread module: check for libdvdread plugin
641 dnl
642 AC_ARG_ENABLE(dvdread,
643 [  --enable-dvdread        dvdread input module (default disabled)])
644 if test "x$enableval" != "xno"
645 then
646   AC_ARG_WITH(dvdread, 
647   [    --with-dvdread=PATH   libdvdread headers and libraries])
648   if test "x$withval" = x
649   then
650     test_LDFLAGS=""
651     test_CFLAGS=""
652   else
653     test_LDFLAGS="-L${withval}/lib"
654     test_CFLAGS="-I${withval}/include"
655   fi
656   CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
657   AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
658      AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
659         [void foo() { int i=DVD_VIDEO_LB_LEN; }],[
660           PLUGINS="${PLUGINS} dvdread"
661           dvdread_LDFLAGS="${dvdread_LDFLAGS} ${test_LDFLAGS} -ldvdread"
662           dvdread_CFLAGS="${dvdread_CFLAGS} ${test_CFLAGS}"
663         ],[
664           if test "x$enableval" != x
665           then
666             AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
667           fi
668         ])
669   ],[
670     if test "x$enableval" != x
671     then
672       if test "x$withval" != x
673       then
674         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${withval}/include])
675       else
676         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
677       fi
678     fi
679   ])
680   CPPFLAGS="$save_CPPFLAGS"
681 fi
682
683 dnl
684 dnl  VCD module
685 dnl
686 AC_ARG_ENABLE(vcd,
687   [  --enable-vcd            VCD support for Linux and MacOS X (default enabled)])
688
689 if test x$enable_vcd != xno
690 then
691   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
692     PLUGINS="${PLUGINS} vcd"
693   ])
694
695   if test "x${SYS}" = "xbsdi"
696   then
697     PLUGINS="${PLUGINS} vcd"
698   fi
699
700   if test "x${SYS}" = "xdarwin"
701   then
702     PLUGINS="${PLUGINS} vcd"
703     vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
704   fi
705 fi
706
707 dnl
708 dnl  Satellite input module
709 dnl
710 AC_ARG_ENABLE(satellite,
711   [  --enable-satellite      satellite card support (default disabled)],
712   [ if test x$enable_satellite = xyes
713     then
714       BUILTINS="${BUILTINS} satellite"
715       AC_DEFINE(HAVE_SATELLITE, 1, define if compiling with satellite card support)
716     fi])
717
718 dnl
719 dnl  ipv6 plugin
720 dnl
721 AC_CHECK_FUNC(inet_pton,[PLUGINS="${PLUGINS} ipv6"])
722
723 dnl
724 dnl  Codec plugins
725 dnl
726
727 AC_ARG_WITH(,[Codec plugins:])
728
729 dnl
730 dnl  mad plugin
731 dnl
732 AC_ARG_ENABLE(mad,
733   [  --enable-mad            libmad module (default disabled)])
734 if test x$enable_mad = xyes
735 then
736   PLUGINS="${PLUGINS} mad"
737   mad_LDFLAGS="${mad_LDFLAGS} -lmad"
738   AC_ARG_WITH(mad,
739     [    --with-mad=PATH       path to libmad],
740     [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
741       then
742         mad_CFLAGS="${mad_CFLAGS} -I$with_val/include"
743         mad_LDFLAGS="${mad_LDFLAGS} -L$with_val/lib"
744       fi ])
745   save_CFLAGS=$CFLAGS
746   save_LDFLAGS=$LDFLAGS
747   CFLAGS="$CFLAGS $mad_CFLAGS"
748   LDFLAGS="$LDFLAGS $mad_LDFLAGS"
749   AC_CHECK_HEADERS(mad.h, ,
750   [ echo "Cannot find development headers for libmad..."
751     exit 1
752   ])
753   AC_CHECK_LIB(mad, mad_bit_init, ,
754   [ echo "Cannot find libmad library..."
755     exit 1
756   ])
757   CFLAGS=$save_CFLAGS
758   LDFLAGS=$save_LDFLAGS
759 fi
760
761 dnl special case for BeOS
762 if test x$SYS = xbeos
763 then
764     PLUGINS="${PLUGINS} beos"
765 fi
766
767 dnl
768 dnl  a52 AC3 decoder plugin
769 dnl
770 AC_ARG_ENABLE(a52,
771   [  --enable-a52            AC3 support with liba52 (default enabled)])
772 if test "x$enableval" != "xno" -a x$SYS != xmingw32
773   then
774     AC_CHECK_HEADERS(a52dec/a52.h, [
775       BUILTINS="${BUILTINS} a52"
776       a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
777      ],[])
778 fi
779
780 dnl
781 dnl  ogg vorbis plugin
782 dnl
783 AC_ARG_ENABLE(vorbis,
784   [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
785 if test "x$enableval" != "xno"
786 then
787   AC_CHECK_HEADERS(ogg/ogg.h, [
788     PLUGINS="${PLUGINS} vorbis"
789     vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
790    ],[])
791 fi
792
793 dnl
794 dnl  Video plugins
795 dnl
796
797 AC_ARG_WITH(,[Video plugins:])
798
799 dnl
800 dnl  X11 module
801 dnl  (enabled by default except on win32)
802 dnl
803 AC_ARG_ENABLE(x11,
804   [  --enable-x11            X11 support (default enabled)])
805 if test x$enable_x11 != xno &&
806   (test x$SYS != xmingw32 || test x$enable_x11 = xyes); then
807   if test x$x_includes = xNONE; then
808     x_includes=/usr/X11R6/include
809   fi
810   if test x$x_libraries = xNONE; then
811     x_libraries=/usr/X11R6/lib
812   fi
813   CPPFLAGS="$save_CPPFLAGS -I$x_includes"
814   AC_CHECK_HEADERS(X11/Xlib.h, [
815     PLUGINS="${PLUGINS} x11"
816     x11_LDFLAGS="${x11_LDFLAGS} -L$x_libraries -lX11 -lXext"
817     x11_CFLAGS="${x11_CFLAGS} -I$x_includes"
818   ])
819   CPPFLAGS="$save_CPPFLAGS"
820 fi
821
822 dnl
823 dnl  XVideo module
824 dnl  (enabled by default except on win32)
825 dnl
826 AC_ARG_ENABLE(xvideo,
827   [  --enable-xvideo         XVideo support (default enabled)])
828 if test x$enable_xvideo != xno &&
829   (test x$SYS != xmingw32 || test x$enable_xvideo = xyes); then
830   if test x$x_includes = xNONE; then
831     x_includes=/usr/X11R6/include
832   fi
833   if test x$x_libraries = xNONE; then
834     x_libraries=/usr/X11R6/lib
835   fi
836   save_CPPFLAGS=$CPPFLAGS
837   CPPFLAGS="$save_CPPFLAGS -I$x_includes"
838   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
839     save_CFLAGS=$CFLAGS
840     CFLAGS="$CFLAGS -L$x_libraries -lX11 -lXext"
841     AC_CHECK_LIB(Xv_pic,XvSetPortAttribute,
842       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
843       PLUGINS="${PLUGINS} xvideo"
844       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L$x_libraries -lX11 -lXext -lXv_pic"
845       xvideo_CFLAGS="${xvideo_CFLAGS} -I$x_includes",
846       # We don't have Xv_pic, let's make xvideo.a as builtin
847       BUILTINS="${BUILTINS} xvideo"
848       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L$x_libraries -lX11 -lXext -lXv"
849       xvideo_CFLAGS="${xvideo_CFLAGS} -I$x_includes")
850     CFLAGS="$save_CFLAGS"
851   ]
852   CPPFLAGS="$save_CPPFLAGS")
853 fi
854
855 dnl
856 dnl  SDL module
857 dnl
858 AC_ARG_ENABLE(sdl,
859   [  --enable-sdl            SDL support (default enabled)])
860 if test "x$enable_sdl" != "xno"
861 then
862   SDL_PATH=$PATH
863   AC_ARG_WITH(sdl-config-path,
864     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
865     [ if test "x$withval" != "xno"
866       then
867         SDL_PATH=$withval:$PATH
868       fi ])
869   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, $SDL_PATH)
870   SDL_CONFIG=${SDL12_CONFIG}
871   SDL_HEADER="SDL12/SDL.h"
872   if test x${SDL_CONFIG} = xno
873   then
874     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
875     SDL_CONFIG=${SDL11_CONFIG}
876     SDL_HEADER="SDL11/SDL.h"
877   fi
878   if test x${SDL_CONFIG} = xno
879   then
880     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
881     SDL_HEADER="SDL/SDL.h"
882   fi
883   if test x${SDL_CONFIG} != xno
884   then
885     PLUGINS="${PLUGINS} sdl"
886     sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
887     sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
888     CPPFLAGS="$save_CPPFLAGS $sdl_CFLAGS"
889     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
890       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
891       [ AC_MSG_ERROR([The development package for SDL is not installed. 
892 Please install it and try again. Alternatively you can also configure with 
893 --disable-sdl.])
894       ])
895     CPPFLAGS="$save_CPPFLAGS"
896     if expr 1.1.5 \> `$SDL_CONFIG --version` >/dev/null
897     then
898       AC_MSG_ERROR([The development package for SDL is not installed.
899 Please install it and try again. Alternatively you can also configure with
900 --disable-sdl.])
901     fi
902   elif test "x$enable_sdl" =  "xyes"
903   then
904     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
905 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
906     ])
907   fi
908 fi
909
910 dnl
911 dnl  Windows DirectX module
912 dnl
913 AC_ARG_ENABLE(directx,
914   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
915 if test "x$enableval" != "xno"
916 then
917   if test x$SYS = xmingw32
918   then
919     AC_ARG_WITH(directx, 
920     [    --with-directx=PATH   Win32 DirectX headers and libraries])
921     if test "x$with_directx" = "x"
922     then
923       AC_CHECK_HEADERS(ddraw.h,
924       [ PLUGINS="${PLUGINS} directx"
925         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32" ])
926     else
927       AC_MSG_CHECKING(for directX headers in ${withval})
928       if test -f ${withval}/ddraw.h
929       then
930         PLUGINS="${PLUGINS} directx"
931         directx_LDFLAGS="${directx_LDFLAGS} -L${withval}/lib -lgdi32"
932         directx_CFLAGS="${directx_CFLAGS} -I${withval}"
933         AC_MSG_RESULT(yes)
934       else
935         AC_MSG_RESULT(no)
936         AC_MSG_ERROR([Cannot find ${withval}/ddraw.h!])
937       fi
938     fi
939   fi
940 fi
941
942 dnl
943 dnl  Linux framebuffer module
944 dnl
945 AC_ARG_ENABLE(fb,
946   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
947     if test x$enable_fb != xno
948     then
949       AC_CHECK_HEADERS(linux/fb.h, [
950         PLUGINS="${PLUGINS} fb"
951       ])
952     fi
953
954 dnl
955 dnl  Linux MGA module
956 dnl
957 AC_ARG_ENABLE(mga,
958   [  --enable-mga            Linux kernel Matrox support (default disabled)],
959   [ if test x$enable_mga = xyes
960     then
961       PLUGINS="${PLUGINS} mga xmga"
962     fi ])
963
964 dnl
965 dnl  GGI module
966 dnl
967 AC_ARG_ENABLE(ggi,
968   [  --enable-ggi            GGI support (default disabled)])
969 if test x$enable_ggi = xyes
970 then
971   PLUGINS="${PLUGINS} ggi"
972   ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
973   AC_ARG_WITH(ggi,
974     [    --with-ggi=PATH       path to libggi],
975     [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
976       then
977         CFLAGS_GGI="${CFLAGS_GGI} -I$with_val/include"
978         ggi_LDFLAGS="${ggi_LDFLAGS} -L$with_val/lib"
979       fi ])
980 fi
981
982 dnl
983 dnl  Glide module
984 dnl
985 AC_ARG_ENABLE(glide,
986   [  --enable-glide          Glide (3dfx) support (default disabled)])
987 if test x$enable_glide = xyes
988 then
989   PLUGINS="${PLUGINS} glide"
990   glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
991   glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
992   AC_ARG_WITH(glide,
993     [    --with-glide=PATH     path to libglide],
994     [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
995       then
996         glide_CFLAGS="${glide_CFLAGS} -I$with_val/include"
997         glide_LDFLAGS="${glide_LDFLAGS} -L$with_val/lib"
998       fi ])
999 fi
1000
1001 dnl
1002 dnl  AA plugin
1003 dnl
1004 AC_ARG_ENABLE(aa,
1005   [  --enable-aa             aalib output (default disabled)])
1006 if test x$enable_aa = xyes
1007 then
1008   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
1009   if test x$have_aa = xtrue
1010   then
1011     PLUGINS="${PLUGINS} aa"
1012     aa_LDFLAGS="${aa_LDFLAGS} -laa"
1013   fi
1014 fi
1015
1016 dnl
1017 dnl  Audio plugins
1018 dnl
1019
1020 AC_ARG_WITH(,[Audio plugins:])
1021
1022 dnl
1023 dnl  OSS /dev/dsp module (enabled by default except on win32)
1024 dnl
1025 AC_ARG_ENABLE(dsp,
1026   [  --enable-dsp            Linux /dev/dsp support (enabled on Linux)])
1027
1028 if test x$enable_dsp != xno &&
1029   (test x$SYS != xmingw32 || test x$enable_dsp = xyes)
1030 then
1031   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1032     PLUGINS="${PLUGINS} dsp"
1033     AC_CHECK_LIB(ossaudio,main,dsp_LDFLAGS="${dsp_LDFLAGS} -lossaudio")
1034   ])
1035 fi
1036
1037 dnl
1038 dnl  Esound module
1039 dnl
1040 AC_ARG_ENABLE(esd,
1041   [  --enable-esd            Esound library support (default disabled)],
1042   [if test x$enable_esd = xyes
1043    then
1044      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1045      if test x${ESD_CONFIG} != xno
1046      then
1047        PLUGINS="${PLUGINS} esd"
1048        esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
1049        esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
1050      fi
1051    fi])
1052
1053 dnl
1054 dnl  aRts module
1055 dnl
1056 AC_ARG_ENABLE(arts,
1057   [  --enable-arts           aRts sound server (default disabled)],
1058   [if test x$enable_arts = xyes
1059    then
1060      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1061      if test x${ARTS_CONFIG} != xno
1062      then
1063        PLUGINS="${PLUGINS} arts"
1064        arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
1065        arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
1066      fi
1067    fi])
1068
1069 dnl
1070 dnl  ALSA module
1071 dnl
1072 AC_ARG_ENABLE(alsa,
1073   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1074   [if test x$enable_alsa = xyes
1075    then
1076      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1077      if test x$have_alsa = xtrue
1078      then
1079        PLUGINS="${PLUGINS} alsa"
1080        alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
1081      fi
1082    fi])
1083
1084 dnl
1085 dnl  win32 waveOut plugin
1086 dnl
1087 AC_ARG_ENABLE(waveout,
1088   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1089 if test "x$enableval" != "xno" -a x$SYS = xmingw32
1090   then
1091     PLUGINS="${PLUGINS} waveout"
1092     waveout_LDFLAGS="-lwinmm"
1093 fi
1094
1095 dnl
1096 dnl  Interface plugins
1097 dnl
1098
1099 AC_ARG_WITH(,[Interface plugins:])
1100
1101 dnl
1102 dnl  Gtk+ module
1103 dnl
1104 AC_ARG_ENABLE(gtk,
1105   [  --enable-gtk            Gtk+ support (default enabled)])
1106 if test x$enable_gtk != xno
1107 then
1108   GTK_PATH=$PATH
1109   AC_ARG_WITH(gtk-config-path,
1110     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1111     [ if test "x$withval" != "xno"
1112       then
1113         GTK_PATH=$withval:$PATH
1114       fi ])
1115   # look for gtk-config
1116   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, $GTK_PATH)
1117   GTK_CONFIG=${GTK12_CONFIG}
1118   if test x${GTK_CONFIG} = xno
1119   then
1120     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, $GTK_PATH)
1121   fi
1122   if test x${GTK_CONFIG} != xno
1123   then
1124     if expr 1.2.0 \> `$GTK_CONFIG --version` >/dev/null
1125     then
1126       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.])
1127     fi
1128     gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk`"
1129     gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
1130     # now look for the gtk.h header
1131     CPPFLAGS="$save_CPPFLAGS $gtk_CFLAGS"
1132     ac_cv_gtk_headers=yes
1133     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1134       ac_cv_gtk_headers=no
1135       echo "Cannot find gtk development headers."
1136     ])
1137     if test "x$ac_cv_gtk_headers" = xyes
1138     then
1139       PLUGINS="${PLUGINS} gtk"
1140       ALIASES="${ALIASES} gvlc"
1141     fi
1142     CPPFLAGS="$save_CPPFLAGS"
1143   fi
1144 fi
1145
1146 dnl
1147 dnl  Gnome module
1148 dnl
1149 AC_ARG_ENABLE(gnome,
1150   [  --enable-gnome          Gnome interface support (default disabled)],
1151   [if test x$enable_gnome = xyes; then
1152     # look for gnome-config
1153     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1154     if test -x ${GNOME_CONFIG}
1155     then
1156        gnome_CFLAGS="${gnome_CFLAGS} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1157        gnome_LDFLAGS="${gnome_LDFLAGS} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1158     fi
1159     # now look for the gnome.h header
1160     CPPFLAGS="$save_CPPFLAGS $gnome_CFLAGS"
1161     AC_CHECK_HEADERS(gnome.h, [
1162       PLUGINS="${PLUGINS} gnome"
1163       ALIASES="${ALIASES} gnome-vlc"
1164      ],[
1165       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1166 developement tools or remove the --enable-gnome option])
1167      ])
1168     CPPFLAGS="$save_CPPFLAGS"
1169   fi])
1170
1171 dnl
1172 dnl  Qt module
1173 dnl
1174 AC_ARG_ENABLE(qt,
1175   [  --enable-qt             Qt interface support (default disabled)],
1176   [if test x$enable_qt = xyes; then
1177      PLUGINS="${PLUGINS} qt"
1178      ALIASES="${ALIASES} qvlc"
1179      qt_LDFLAGS="${qt_LDFLAGS} -lqt -L${QTDIR}/lib"
1180      qt_CFLAGS="${qt_CFLAGS} -I/usr/include/qt -I${QTDIR}/include"
1181      if test -x ${QTDIR}/bin/moc
1182      then
1183        MOC=${QTDIR}/bin/moc
1184      else
1185        MOC=moc
1186      fi
1187    fi])
1188
1189 dnl 
1190 dnl  KDE module
1191 dnl
1192 AC_ARG_ENABLE(kde,
1193   [  --enable-kde            KDE interface support (default disabled)],
1194   [if test x$enable_kde = xyes; then
1195      PLUGINS="${PLUGINS} kde"
1196      ALIASES="${ALIASES} kvlc"
1197      kde_LDFLAGS="${kde_LDFLAGS} -L${KDEDIR}/lib -lkfile"
1198      kde_CFLAGS="${kde_CFLAGS} -I/usr/include/kde -I/usr/include/qt"
1199      kde_CFLAGS="${kde_CFLAGS} -I${KDEDIR}/include -I${QTDIR}/include"
1200      if test -x ${QTDIR}/bin/moc
1201      then
1202        MOC=${QTDIR}/bin/moc
1203      else
1204        MOC=moc
1205      fi
1206    fi])
1207
1208 dnl
1209 dnl  MacOS X module
1210 dnl
1211 AC_ARG_ENABLE(macosx,
1212   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1213   [if test x$enable_macosx = xyes
1214    then
1215      BUILTINS="${BUILTINS} macosx"
1216      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
1217      macosx_CFLAGS="${macosx_CFLAGS} -ObjC"
1218      LDFLAGS="${LDFLAGS} -ObjC"
1219    fi],
1220   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1221      BUILTINS="${BUILTINS} macosx"
1222      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
1223      macosx_CFLAGS="${macosx_CFLAGS} -ObjC"
1224      LDFLAGS="${LDFLAGS} -ObjC"
1225    )])
1226
1227 dnl
1228 dnl  QNX RTOS module
1229 dnl
1230 AC_ARG_ENABLE(qnx,
1231   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1232     if test x$enable_qnx != xno
1233     then
1234       AC_CHECK_HEADERS(Ph.h, [
1235         PLUGINS="${PLUGINS} qnx"
1236         qnx_LDFLAGS="${qnx_LDFLAGS} -lasound -lph"
1237       ])
1238     fi
1239
1240 dnl
1241 dnl  Windows native interface module, built with Borland C++ Builder
1242 dnl
1243 AC_ARG_ENABLE(intfwin,
1244 [  --enable-intfwin        Win32 interface support (default disabled)],
1245 [ if test "x$enableval" != "xno"
1246   then
1247     AC_ARG_WITH(bcbuilder, 
1248     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1249     if test "x$with_bcbuilder" != "x"
1250     then
1251       BCBUILDER="$with_bcbuilder"
1252     fi
1253     PLUGINS="${PLUGINS} intfwin"
1254   fi ])
1255
1256 dnl
1257 dnl  ncurses module
1258 dnl
1259 AC_ARG_ENABLE(ncurses,
1260   [  --enable-ncurses        ncurses interface support (default disabled)],
1261   [if test x$enable_ncurses = xyes; then
1262      PLUGINS="${PLUGINS} ncurses"
1263      ncurses_LDFLAGS="${ncurses_LDFLAGS} -lncurses"
1264    fi])
1265
1266 dnl
1267 dnl  Lirc plugin
1268 dnl
1269 AC_ARG_ENABLE(lirc,
1270   [  --enable-lirc           lirc support (default disabled)])
1271 if test x$enable_lirc = xyes
1272 then
1273   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
1274   if test x$have_lirc = xtrue
1275   then
1276     PLUGINS="${PLUGINS} lirc"
1277     lirc_LDFLAGS="${lirc_LDFLAGS} -llirc_client"
1278   fi
1279 fi
1280
1281 AC_ARG_WITH(,[Misc options:])
1282
1283 dnl
1284 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
1285 dnl
1286 dnl  We give the user the opportunity to specify
1287 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
1288 dnl
1289 AC_ARG_WITH(words,
1290   [  --with-words=endianness set endianness (big or little)])
1291   case "x$withval" in
1292     xbig)
1293       ac_cv_c_bigendian=yes
1294       ;;
1295     xlittle)
1296       ac_cv_c_bigendian=no
1297       ;;
1298     *)
1299       dnl  Try to guess endianness by matching patterns on a compiled
1300       dnl  binary, by looking for an ASCII or EBCDIC string
1301       AC_CACHE_CHECK([whether the byte order is big-endian],
1302         [ac_cv_c_bigendian],
1303         [ac_cv_c_bigendian=unknown
1304         [cat >conftest.c <<EOF
1305         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
1306         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
1307         void _a(void) { char*s = (char*)am; s = (char *)ai; }
1308         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
1309         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
1310         void _e(void) { char*s = (char*)em; s = (char*)ei; }
1311         int main(void) { _a(); _e(); return 0; }
1312 EOF
1313         ]
1314         if test -f conftest.c
1315         then 
1316           if ${CC-cc} conftest.c -o conftest.o >config.log 2>&1 \
1317               && test -f conftest.o
1318           then
1319             if test "`strings conftest.o | grep BIGenDianSyS`"
1320             then
1321               ac_cv_c_bigendian=yes
1322             fi
1323             if test "`strings conftest.o | grep LiTTleEnDian`"
1324             then
1325               ac_cv_c_bigendian=no
1326             fi
1327           fi
1328         fi
1329       ])
1330       if test x$ac_cv_c_bigendian = xunknown
1331       then
1332         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
1333       fi
1334       ;;
1335   esac
1336 dnl  Now we know what to use for endianness, just put it in the header
1337 if test $ac_cv_c_bigendian = yes
1338 then
1339   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
1340 fi
1341
1342 dnl
1343 dnl  Profiling
1344 dnl
1345 GPROF=0
1346 AC_ARG_ENABLE(gprof,
1347 [  --enable-gprof          gprof profiling (default disabled)],
1348 [ if test x$enableval = xyes; then GPROF=1; fi ])
1349
1350 CPROF=0
1351 AC_ARG_ENABLE(cprof,
1352 [  --enable-cprof          cprof profiling (default disabled)],
1353 [ if test x$enableval = xyes;
1354   then
1355     LDFLAGS="${LDFLAGS} -lcprof"
1356     CPROF=1
1357   fi
1358 ])
1359
1360 dnl
1361 dnl  GNU portable threads
1362 dnl
1363 AC_ARG_ENABLE(pth,
1364   [  --enable-pth            GNU Pth support (default disabled)],
1365   [ if test x$enableval = xyes; then
1366     AC_CHECK_LIB(pth,pth_init)
1367     AC_EGREP_HEADER(pth_init,pth.h,[
1368       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
1369                 Define if <pth.h> defines pth_init)
1370     THREAD_LIB="-lpth"
1371     fi])
1372 ])
1373
1374 dnl
1375 dnl  State Threads
1376 dnl
1377 AC_ARG_ENABLE(st,
1378   [  --enable-st             State Threads (default disabled)],
1379   [ if test x$enableval = xyes; then
1380     AC_CHECK_LIB(st,st_init)
1381     AC_EGREP_HEADER(st_init,st.h,[
1382       AC_DEFINE(ST_INIT_IN_ST_H, 1,
1383                 Define if <st.h> defines st_init)
1384     THREAD_LIB="-lst"
1385     fi])
1386 ])
1387
1388 LDFLAGS="${LDFLAGS} ${THREAD_LIB}"
1389
1390 dnl
1391 dnl  Plug-ins - this must be AT THE END
1392 dnl
1393 AC_ARG_ENABLE(plugins,
1394   [  --disable-plugins       make all plug-ins built-in (default plug-ins enabled)],
1395   [if test x$enable_plugins = xno
1396    then
1397      BUILTINS="${BUILTINS} ${PLUGINS}"
1398      PLUGINS=
1399    fi])
1400
1401 dnl Automagically disable plug-ins if there is no system support for .so files
1402 dnl don't forget vlc-win32 still can load .so as plugins
1403 if test x$ac_cv_header_dlfcn_h = xno -a x$ac_cv_header_image_h = xno -a x$SYS != xmingw32
1404 then
1405   echo "*** Your system doesn't have plug-in support. All plug-ins will be compiled"
1406   echo "as built-in"
1407   BUILTINS="${BUILTINS} ${PLUGINS}"
1408   PLUGINS=
1409 fi
1410
1411 dnl
1412 dnl  Stuff used by the program
1413 dnl
1414 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc $VERSION $CODENAME Copyright 1996-2002 VideoLAN\n", [Simple version string])
1415 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version $VERSION $CODENAME - (c) 1996-2002 VideoLAN", [Copyright string])
1416
1417 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
1418 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__MODULE_$VLC_SYMBOL", [String suffix for module functions])
1419 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, $VLC_SYMBOL, [Symbol suffix for module functions])
1420
1421 DATA_PATH="${ac_tool_prefix}/share/videolan"
1422 AC_SUBST(DATA_PATH)
1423 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
1424 AC_SUBST(PLUGIN_PATH)
1425
1426 dnl 
1427 dnl  Configuration is finished
1428 dnl
1429 AC_SUBST(SYS)
1430 AC_SUBST(ARCH)
1431 AC_SUBST(PLUGINS)
1432 AC_SUBST(BUILTINS)
1433 AC_SUBST(ALIASES)
1434 AC_SUBST(DEBUG)
1435 AC_SUBST(ASM)
1436 AC_SUBST(CPROF)
1437 AC_SUBST(GPROF)
1438 AC_SUBST(OPTIMS)
1439 AC_SUBST(TUNING)
1440 AC_SUBST(RELEASE)
1441 AC_SUBST(MOC)
1442 AC_SUBST(WINDRES)
1443 AC_SUBST(BCBUILDER)
1444 AC_SUBST(VLC_PACKAGE)
1445 AC_SUBST(VLC_VERSION)
1446 AC_SUBST(NEED_GETOPT)
1447
1448 AC_SUBST(CFLAGS_OPTIM)
1449 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
1450 AC_SUBST(LDFLAGS)
1451
1452 AC_SUBST(vlc_CFLAGS)
1453 AC_SUBST(plugins_CFLAGS)
1454 AC_SUBST(builtins_CFLAGS)
1455
1456 AC_SUBST(arts_CFLAGS)
1457 AC_SUBST(dvd_CFLAGS)
1458 AC_SUBST(dvdread_CFLAGS)
1459 AC_SUBST(directx_CFLAGS)
1460 AC_SUBST(esd_CFLAGS)
1461 AC_SUBST(glide_CFLAGS)
1462 AC_SUBST(gnome_CFLAGS)
1463 AC_SUBST(gtk_CFLAGS)
1464 AC_SUBST(kde_CFLAGS)
1465 AC_SUBST(idctaltivec_CFLAGS)
1466 AC_SUBST(macosx_CFLAGS)
1467 AC_SUBST(mad_CFLAGS)
1468 AC_SUBST(memcpyaltivec_CFLAGS)
1469 AC_SUBST(motionaltivec_CFLAGS)
1470 AC_SUBST(qt_CFLAGS)
1471 AC_SUBST(sdl_CFLAGS)
1472 AC_SUBST(x11_CFLAGS)
1473 AC_SUBST(xvideo_CFLAGS)
1474
1475 AC_SUBST(vlc_LDFLAGS)
1476 AC_SUBST(plugins_LDFLAGS)
1477 AC_SUBST(builtins_LDFLAGS)
1478
1479 AC_SUBST(a52_LDFLAGS)
1480 AC_SUBST(aa_LDFLAGS)
1481 AC_SUBST(alsa_LDFLAGS)
1482 AC_SUBST(arts_LDFLAGS)
1483 AC_SUBST(beos_LDFLAGS)
1484 AC_SUBST(chroma_i420_rgb_LDFLAGS)
1485 AC_SUBST(directx_LDFLAGS)
1486 AC_SUBST(dsp_LDFLAGS)
1487 AC_SUBST(dvd_LDFLAGS)
1488 AC_SUBST(dvdread_LDFLAGS)
1489 AC_SUBST(esd_LDFLAGS)
1490 AC_SUBST(filter_distort_LDFLAGS)
1491 AC_SUBST(ggi_LDFLAGS)
1492 AC_SUBST(glide_LDFLAGS)
1493 AC_SUBST(gnome_LDFLAGS)
1494 AC_SUBST(gtk_LDFLAGS)
1495 AC_SUBST(idctaltivec_LDFLAGS)
1496 AC_SUBST(imdct_LDFLAGS)
1497 AC_SUBST(imdct3dn_LDFLAGS)
1498 AC_SUBST(imdctsse_LDFLAGS)
1499 AC_SUBST(ipv4_LDFLAGS)
1500 AC_SUBST(kde_LDFLAGS)
1501 AC_SUBST(lirc_LDFLAGS)
1502 AC_SUBST(macosx_LDFLAGS)
1503 AC_SUBST(mad_LDFLAGS)
1504 AC_SUBST(memcpyaltivec_LDFLAGS)
1505 AC_SUBST(motionaltivec_LDFLAGS)
1506 AC_SUBST(ncurses_LDFLAGS)
1507 AC_SUBST(qnx_LDFLAGS)
1508 AC_SUBST(qt_LDFLAGS)
1509 AC_SUBST(rc_LDFLAGS)
1510 AC_SUBST(sdl_LDFLAGS)
1511 AC_SUBST(vcd_LDFLAGS)
1512 AC_SUBST(vorbis_LDFLAGS)
1513 AC_SUBST(waveout_LDFLAGS)
1514 AC_SUBST(x11_LDFLAGS)
1515 AC_SUBST(xvideo_LDFLAGS)
1516
1517 AC_OUTPUT([Makefile.opts po/Makefile.in])
1518
1519 echo "
1520 vlc configuration
1521 --------------------
1522 vlc version           : ${VERSION}
1523 system                : ${SYS}
1524 architecture          : ${ARCH}
1525 optimizations         : ${OPTIMS}
1526 tuning                : ${TUNING}
1527 debug mode            : ${DEBUG}
1528 release               : ${RELEASE}
1529 cprof/gprof support   : ${CPROF}/${GPROF}
1530 need builtin getopt   : ${NEED_GETOPT}
1531 built-in modules      :${BUILTINS}
1532 plug-in modules       :${PLUGINS}
1533 vlc aliases           :${ALIASES}
1534
1535 You may now tune Makefile.opts at your convenience, for instance to choose
1536 which modules get compiled as plugins.
1537
1538 To build vlc and its plugins, type \`$VLC_MAKE'.
1539 "
1540