]> git.sesse.net Git - vlc/blob - configure.in
141d6afb49f66b9c55126c92edcd2ded3d1a1b40
[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 '[a-z].' '[A-Z]_'`"
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"
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   case "x$with_dvdread" in
649   x)
650     AC_CHECK_HEADERS(dvdread/dvd_reader.h,
651       [ PLUGINS="${PLUGINS} dvdread"
652         dvdread_LDFLAGS="${dvdread_LDFLAGS} -ldvdread" ])
653   ;;
654   *)
655     AC_MSG_CHECKING(for dvdread headers in ${withval})
656     if test -f ${withval}/include/dvdread/dvd_reader.h
657     then
658       AC_MSG_RESULT(yes)
659       PLUGINS="${PLUGINS} dvdread"
660       dvdread_LDFLAGS="${dvdread_LDFLAGS} -L${withval}/lib -ldvdread"
661       dvdread_CFLAGS="${dvdread_CFLAGS} -I${withval}/include"
662     else
663       AC_MSG_RESULT(no)
664       AC_MSG_ERROR([Cannot find ${withval}/dvdread/dvd_reader.h])
665     fi
666   ;;
667   esac
668 fi
669
670 dnl
671 dnl  VCD module
672 dnl
673 AC_ARG_ENABLE(vcd,
674   [  --enable-vcd            VCD support for Linux and MacOS X (default enabled)])
675
676 if test x$enable_vcd != xno
677 then
678   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
679     PLUGINS="${PLUGINS} vcd"
680   ])
681
682   if test "x${SYS}" = "xbsdi"
683   then
684     PLUGINS="${PLUGINS} vcd"
685   fi
686
687   if test "x${SYS}" = "xdarwin"
688   then
689     PLUGINS="${PLUGINS} vcd"
690     vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
691   fi
692 fi
693
694 dnl
695 dnl  Satellite input module
696 dnl
697 AC_ARG_ENABLE(satellite,
698   [  --enable-satellite      satellite card support (default disabled)],
699   [ if test x$enable_satellite = xyes
700     then
701       BUILTINS="${BUILTINS} satellite"
702       AC_DEFINE(HAVE_SATELLITE, 1, define if compiling with satellite card support)
703     fi])
704
705 dnl
706 dnl  ipv6 plugin
707 dnl
708 AC_CHECK_FUNC(inet_pton,[PLUGINS="${PLUGINS} ipv6"])
709
710 dnl
711 dnl  Codec plugins
712 dnl
713
714 AC_ARG_WITH(,[Codec plugins:])
715
716 dnl
717 dnl  mad plugin
718 dnl
719 AC_ARG_ENABLE(mad,
720   [  --enable-mad            libmad module (default disabled)])
721 if test x$enable_mad = xyes
722 then
723   PLUGINS="${PLUGINS} mad"
724   mad_LDFLAGS="${mad_LDFLAGS} -lmad"
725   AC_ARG_WITH(mad,
726     [    --with-mad=PATH       path to libmad],
727     [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
728       then
729         mad_CFLAGS="${mad_CFLAGS} -I$with_val/include"
730         mad_LDFLAGS="${mad_LDFLAGS} -L$with_val/lib"
731       fi ])
732   save_CFLAGS=$CFLAGS
733   save_LDFLAGS=$LDFLAGS
734   CFLAGS="$CFLAGS $mad_CFLAGS"
735   LDFLAGS="$LDFLAGS $mad_LDFLAGS"
736   AC_CHECK_HEADERS(mad.h, ,
737   [ echo "Cannot find development headers for libmad..."
738     exit 1
739   ])
740   AC_CHECK_LIB(mad, mad_bit_init, ,
741   [ echo "Cannot find libmad library..."
742     exit 1
743   ])
744   CFLAGS=$save_CFLAGS
745   LDFLAGS=$save_LDFLAGS
746 fi
747
748 dnl special case for BeOS
749 if test x$SYS = xbeos
750 then
751     PLUGINS="${PLUGINS} beos"
752 fi
753
754 dnl
755 dnl  a52 AC3 decoder plugin
756 dnl
757 AC_ARG_ENABLE(a52,
758   [  --enable-a52            AC3 support with liba52 (default enabled)])
759 if test "x$enableval" != "xno" -a x$SYS != xmingw32
760   then
761     AC_CHECK_HEADERS(a52dec/a52.h, [
762       BUILTINS="${BUILTINS} a52"
763       a52_LDFLAGS="${a52_LDFLAGS} -la52 -lm"
764      ],[])
765 fi
766
767 dnl
768 dnl  ogg vorbis plugin
769 dnl
770 AC_ARG_ENABLE(vorbis,
771   [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
772 if test "x$enableval" != "xno"
773 then
774   AC_CHECK_HEADERS(ogg/ogg.h, [
775     PLUGINS="${PLUGINS} vorbis"
776     vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
777    ],[])
778 fi
779
780 dnl
781 dnl  Video plugins
782 dnl
783
784 AC_ARG_WITH(,[Video plugins:])
785
786 dnl
787 dnl  X11 module
788 dnl  (enabled by default except on win32)
789 dnl
790 AC_ARG_ENABLE(x11,
791   [  --enable-x11            X11 support (default enabled)])
792 if test x$enable_x11 != xno &&
793   (test x$SYS != xmingw32 || test x$enable_x11 = xyes); then
794   if test x$x_includes = xNONE; then
795     x_includes=/usr/X11R6/include
796   fi
797   if test x$x_libraries = xNONE; then
798     x_libraries=/usr/X11R6/lib
799   fi
800   CPPFLAGS="$save_CPPFLAGS -I$x_includes"
801   AC_CHECK_HEADERS(X11/Xlib.h, [
802     PLUGINS="${PLUGINS} x11"
803     x11_LDFLAGS="${x11_LDFLAGS} -L$x_libraries -lX11 -lXext"
804     x11_CFLAGS="${x11_CFLAGS} -I$x_includes"
805   ])
806   CPPFLAGS="$save_CPPFLAGS"
807 fi
808
809 dnl
810 dnl  XVideo module
811 dnl  (enabled by default except on win32)
812 dnl
813 AC_ARG_ENABLE(xvideo,
814   [  --enable-xvideo         XVideo support (default enabled)])
815 if test x$enable_xvideo != xno &&
816   (test x$SYS != xmingw32 || test x$enable_xvideo = xyes); then
817   if test x$x_includes = xNONE; then
818     x_includes=/usr/X11R6/include
819   fi
820   if test x$x_libraries = xNONE; then
821     x_libraries=/usr/X11R6/lib
822   fi
823   save_CPPFLAGS=$CPPFLAGS
824   CPPFLAGS="$save_CPPFLAGS -I$x_includes"
825   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
826     save_CFLAGS=$CFLAGS
827     CFLAGS="$CFLAGS -L$x_libraries -lX11 -lXext"
828     AC_CHECK_LIB(Xv_pic,XvSetPortAttribute,
829       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
830       PLUGINS="${PLUGINS} xvideo"
831       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L$x_libraries -lX11 -lXext -lXv_pic"
832       xvideo_CFLAGS="${xvideo_CFLAGS} -I$x_includes",
833       # We don't have Xv_pic, let's make xvideo.a as builtin
834       BUILTINS="${BUILTINS} xvideo"
835       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L$x_libraries -lX11 -lXext -lXv"
836       xvideo_CFLAGS="${xvideo_CFLAGS} -I$x_includes")
837     CFLAGS="$save_CFLAGS"
838   ]
839   CPPFLAGS="$save_CPPFLAGS")
840 fi
841
842 dnl
843 dnl  SDL module
844 dnl
845 AC_ARG_ENABLE(sdl,
846   [  --enable-sdl            SDL support (default enabled)])
847 if test "x$enable_sdl" != "xno"
848 then
849   SDL_PATH=$PATH
850   AC_ARG_WITH(sdl-config-path,
851     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
852     [ if test "x$withval" != "xno"
853       then
854         SDL_PATH=$withval:$PATH
855       fi ])
856   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, $SDL_PATH)
857   SDL_CONFIG=${SDL12_CONFIG}
858   SDL_HEADER="SDL12/SDL.h"
859   if test x${SDL_CONFIG} = xno
860   then
861     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, $SDL_PATH)
862     SDL_CONFIG=${SDL11_CONFIG}
863     SDL_HEADER="SDL11/SDL.h"
864   fi
865   if test x${SDL_CONFIG} = xno
866   then
867     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $SDL_PATH)
868     SDL_HEADER="SDL/SDL.h"
869   fi
870   if test x${SDL_CONFIG} != xno
871   then
872     PLUGINS="${PLUGINS} sdl"
873     sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
874     sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
875     CPPFLAGS="$save_CPPFLAGS $sdl_CFLAGS"
876     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
877       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
878       [ AC_MSG_ERROR([The development package for SDL is not installed. 
879 Please install it and try again. Alternatively you can also configure with 
880 --disable-sdl.])
881       ])
882     CPPFLAGS="$save_CPPFLAGS"
883     if expr 1.1.5 \> `$SDL_CONFIG --version` >/dev/null
884     then
885       AC_MSG_ERROR([The development package for SDL is not installed.
886 Please install it and try again. Alternatively you can also configure with
887 --disable-sdl.])
888     fi
889   elif test "x$enable_sdl" =  "xyes"
890   then
891     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
892 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
893     ])
894   fi
895 fi
896
897 dnl
898 dnl  Windows DirectX module
899 dnl
900 AC_ARG_ENABLE(directx,
901   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
902 if test "x$enableval" != "xno"
903 then
904   if test x$SYS = xmingw32
905   then
906     AC_ARG_WITH(directx, 
907     [    --with-directx=PATH   Win32 DirectX headers and libraries])
908     if test "x$with_directx" = "x"
909     then
910       AC_CHECK_HEADERS(ddraw.h,
911       [ PLUGINS="${PLUGINS} directx"
912         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32" ])
913     else
914       AC_MSG_CHECKING(for directX headers in ${withval})
915       if test -f ${withval}/ddraw.h
916       then
917         PLUGINS="${PLUGINS} directx"
918         directx_LDFLAGS="${directx_LDFLAGS} -L${withval}/lib -lgdi32"
919         directx_CFLAGS="${directx_CFLAGS} -I${withval}"
920         AC_MSG_RESULT(yes)
921       else
922         AC_MSG_RESULT(no)
923         AC_MSG_ERROR([Cannot find ${withval}/ddraw.h!])
924       fi
925     fi
926   fi
927 fi
928
929 dnl
930 dnl  Linux framebuffer module
931 dnl
932 AC_ARG_ENABLE(fb,
933   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
934     if test x$enable_fb != xno
935     then
936       AC_CHECK_HEADERS(linux/fb.h, [
937         PLUGINS="${PLUGINS} fb"
938       ])
939     fi
940
941 dnl
942 dnl  Linux MGA module
943 dnl
944 AC_ARG_ENABLE(mga,
945   [  --enable-mga            Linux kernel Matrox support (default disabled)],
946   [ if test x$enable_mga = xyes
947     then
948       PLUGINS="${PLUGINS} mga xmga"
949     fi ])
950
951 dnl
952 dnl  GGI module
953 dnl
954 AC_ARG_ENABLE(ggi,
955   [  --enable-ggi            GGI support (default disabled)])
956 if test x$enable_ggi = xyes
957 then
958   PLUGINS="${PLUGINS} ggi"
959   ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
960   AC_ARG_WITH(ggi,
961     [    --with-ggi=PATH       path to libggi],
962     [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
963       then
964         CFLAGS_GGI="${CFLAGS_GGI} -I$with_val/include"
965         ggi_LDFLAGS="${ggi_LDFLAGS} -L$with_val/lib"
966       fi ])
967 fi
968
969 dnl
970 dnl  Glide module
971 dnl
972 AC_ARG_ENABLE(glide,
973   [  --enable-glide          Glide (3dfx) support (default disabled)])
974 if test x$enable_glide = xyes
975 then
976   PLUGINS="${PLUGINS} glide"
977   glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
978   glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
979   AC_ARG_WITH(glide,
980     [    --with-glide=PATH     path to libglide],
981     [ if test "x$with_val" != "xno" -a "x$with_val" != "x"
982       then
983         glide_CFLAGS="${glide_CFLAGS} -I$with_val/include"
984         glide_LDFLAGS="${glide_LDFLAGS} -L$with_val/lib"
985       fi ])
986 fi
987
988 dnl
989 dnl  AA plugin
990 dnl
991 AC_ARG_ENABLE(aa,
992   [  --enable-aa             aalib output (default disabled)])
993 if test x$enable_aa = xyes
994 then
995   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
996   if test x$have_aa = xtrue
997   then
998     PLUGINS="${PLUGINS} aa"
999     aa_LDFLAGS="${aa_LDFLAGS} -laa"
1000   fi
1001 fi
1002
1003 dnl
1004 dnl  Audio plugins
1005 dnl
1006
1007 AC_ARG_WITH(,[Audio plugins:])
1008
1009 dnl
1010 dnl  OSS /dev/dsp module (enabled by default except on win32)
1011 dnl
1012 AC_ARG_ENABLE(dsp,
1013   [  --enable-dsp            Linux /dev/dsp support (enabled on Linux)])
1014
1015 if test x$enable_dsp != xno &&
1016   (test x$SYS != xmingw32 || test x$enable_dsp = xyes)
1017 then
1018   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1019     PLUGINS="${PLUGINS} dsp"
1020     AC_CHECK_LIB(ossaudio,main,dsp_LDFLAGS="${dsp_LDFLAGS} -lossaudio")
1021   ])
1022 fi
1023
1024 dnl
1025 dnl  Esound module
1026 dnl
1027 AC_ARG_ENABLE(esd,
1028   [  --enable-esd            Esound library support (default disabled)],
1029   [if test x$enable_esd = xyes
1030    then
1031      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1032      if test x${ESD_CONFIG} != xno
1033      then
1034        PLUGINS="${PLUGINS} esd"
1035        esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
1036        esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
1037      fi
1038    fi])
1039
1040 dnl
1041 dnl  aRts module
1042 dnl
1043 AC_ARG_ENABLE(arts,
1044   [  --enable-arts           aRts sound server (default disabled)],
1045   [if test x$enable_arts = xyes
1046    then
1047      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1048      if test x${ARTS_CONFIG} != xno
1049      then
1050        PLUGINS="${PLUGINS} arts"
1051        arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
1052        arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
1053      fi
1054    fi])
1055
1056 dnl
1057 dnl  ALSA module
1058 dnl
1059 AC_ARG_ENABLE(alsa,
1060   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1061   [if test x$enable_alsa = xyes
1062    then
1063      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1064      if test x$have_alsa = xtrue
1065      then
1066        PLUGINS="${PLUGINS} alsa"
1067        alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
1068      fi
1069    fi])
1070
1071 dnl
1072 dnl  win32 waveOut plugin
1073 dnl
1074 AC_ARG_ENABLE(waveout,
1075   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1076 if test "x$enableval" != "xno" -a x$SYS = xmingw32
1077   then
1078     PLUGINS="${PLUGINS} waveout"
1079     waveout_LDFLAGS="-lwinmm"
1080 fi
1081
1082 dnl
1083 dnl  Interface plugins
1084 dnl
1085
1086 AC_ARG_WITH(,[Interface plugins:])
1087
1088 dnl
1089 dnl  Gtk+ module
1090 dnl
1091 AC_ARG_ENABLE(gtk,
1092   [  --enable-gtk            Gtk+ support (default enabled)])
1093 if test x$enable_gtk != xno
1094 then
1095   GTK_PATH=$PATH
1096   AC_ARG_WITH(gtk-config-path,
1097     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1098     [ if test "x$withval" != "xno"
1099       then
1100         GTK_PATH=$withval:$PATH
1101       fi ])
1102   # look for gtk-config
1103   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, $GTK_PATH)
1104   GTK_CONFIG=${GTK12_CONFIG}
1105   if test x${GTK_CONFIG} = xno
1106   then
1107     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, $GTK_PATH)
1108   fi
1109   if test x${GTK_CONFIG} != xno
1110   then
1111     if expr 1.2.0 \> `$GTK_CONFIG --version` >/dev/null
1112     then
1113       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.])
1114     fi
1115     gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk`"
1116     gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
1117     # now look for the gtk.h header
1118     CPPFLAGS="$save_CPPFLAGS $gtk_CFLAGS"
1119     ac_cv_gtk_headers=yes
1120     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1121       ac_cv_gtk_headers=no
1122       echo "Cannot find gtk development headers."
1123     ])
1124     if test "x$ac_cv_gtk_headers" = xyes
1125     then
1126       PLUGINS="${PLUGINS} gtk"
1127       ALIASES="${ALIASES} gvlc"
1128     fi
1129     CPPFLAGS="$save_CPPFLAGS"
1130   fi
1131 fi
1132
1133 dnl
1134 dnl  Gnome module
1135 dnl
1136 AC_ARG_ENABLE(gnome,
1137   [  --enable-gnome          Gnome interface support (default disabled)],
1138   [if test x$enable_gnome = xyes; then
1139     # look for gnome-config
1140     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1141     if test -x ${GNOME_CONFIG}
1142     then
1143        gnome_CFLAGS="${gnome_CFLAGS} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1144        gnome_LDFLAGS="${gnome_LDFLAGS} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1145     fi
1146     # now look for the gnome.h header
1147     CPPFLAGS="$save_CPPFLAGS $gnome_CFLAGS"
1148     AC_CHECK_HEADERS(gnome.h, [
1149       PLUGINS="${PLUGINS} gnome"
1150       ALIASES="${ALIASES} gnome-vlc"
1151      ],[
1152       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1153 developement tools or remove the --enable-gnome option])
1154      ])
1155     CPPFLAGS="$save_CPPFLAGS"
1156   fi])
1157
1158 dnl
1159 dnl  Qt module
1160 dnl
1161 AC_ARG_ENABLE(qt,
1162   [  --enable-qt             Qt interface support (default disabled)],
1163   [if test x$enable_qt = xyes; then
1164      PLUGINS="${PLUGINS} qt"
1165      ALIASES="${ALIASES} qvlc"
1166      qt_LDFLAGS="${qt_LDFLAGS} -lqt -L${QTDIR}/lib"
1167      qt_CFLAGS="${qt_CFLAGS} -I/usr/include/qt -I${QTDIR}/include"
1168      if test -x ${QTDIR}/bin/moc
1169      then
1170        MOC=${QTDIR}/bin/moc
1171      else
1172        MOC=moc
1173      fi
1174    fi])
1175
1176 dnl 
1177 dnl  KDE module
1178 dnl
1179 AC_ARG_ENABLE(kde,
1180   [  --enable-kde            KDE interface support (default disabled)],
1181   [if test x$enable_kde = xyes; then
1182      PLUGINS="${PLUGINS} kde"
1183      ALIASES="${ALIASES} kvlc"
1184      kde_LDFLAGS="${kde_LDFLAGS} -L${KDEDIR}/lib -lkfile"
1185      kde_CFLAGS="${kde_CFLAGS} -I/usr/include/kde -I/usr/include/qt"
1186      kde_CFLAGS="${kde_CFLAGS} -I${KDEDIR}/include -I${QTDIR}/include"
1187      if test -x ${QTDIR}/bin/moc
1188      then
1189        MOC=${QTDIR}/bin/moc
1190      else
1191        MOC=moc
1192      fi
1193    fi])
1194
1195 dnl
1196 dnl  MacOS X module
1197 dnl
1198 AC_ARG_ENABLE(macosx,
1199   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1200   [if test x$enable_macosx = xyes
1201    then
1202      BUILTINS="${BUILTINS} macosx"
1203      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
1204      macosx_CFLAGS="${macosx_CFLAGS} -ObjC"
1205      LDFLAGS="${LDFLAGS} -ObjC"
1206    fi],
1207   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1208      BUILTINS="${BUILTINS} macosx"
1209      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework Cocoa -framework AGL -framework QuickTime -lobjc"
1210      macosx_CFLAGS="${macosx_CFLAGS} -ObjC"
1211      LDFLAGS="${LDFLAGS} -ObjC"
1212    )])
1213
1214 dnl
1215 dnl  QNX RTOS module
1216 dnl
1217 AC_ARG_ENABLE(qnx,
1218   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1219     if test x$enable_qnx != xno
1220     then
1221       AC_CHECK_HEADERS(Ph.h, [
1222         PLUGINS="${PLUGINS} qnx"
1223         qnx_LDFLAGS="${qnx_LDFLAGS} -lasound -lph"
1224       ])
1225     fi
1226
1227 dnl
1228 dnl  Windows native interface module, built with Borland C++ Builder
1229 dnl
1230 AC_ARG_ENABLE(intfwin,
1231 [  --enable-intfwin        Win32 interface support (default disabled)],
1232 [ if test "x$enableval" != "xno"
1233   then
1234     AC_ARG_WITH(bcbuilder, 
1235     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1236     if test "x$with_bcbuilder" != "x"
1237     then
1238       BCBUILDER="$with_bcbuilder"
1239     fi
1240     PLUGINS="${PLUGINS} intfwin"
1241   fi ])
1242
1243 dnl
1244 dnl  ncurses module
1245 dnl
1246 AC_ARG_ENABLE(ncurses,
1247   [  --enable-ncurses        ncurses interface support (default disabled)],
1248   [if test x$enable_ncurses = xyes; then
1249      PLUGINS="${PLUGINS} ncurses"
1250      ncurses_LDFLAGS="${ncurses_LDFLAGS} -lncurses"
1251    fi])
1252
1253 dnl
1254 dnl  Lirc plugin
1255 dnl
1256 AC_ARG_ENABLE(lirc,
1257   [  --enable-lirc           lirc support (default disabled)])
1258 if test x$enable_lirc = xyes
1259 then
1260   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
1261   if test x$have_lirc = xtrue
1262   then
1263     PLUGINS="${PLUGINS} lirc"
1264     lirc_LDFLAGS="${lirc_LDFLAGS} -llirc_client"
1265   fi
1266 fi
1267
1268 AC_ARG_WITH(,[Misc options:])
1269
1270 dnl
1271 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
1272 dnl
1273 dnl  We give the user the opportunity to specify
1274 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
1275 dnl
1276 AC_ARG_WITH(words,
1277   [  --with-words=endianness set endianness (big or little)])
1278   case "x$withval" in
1279     xbig)
1280       ac_cv_c_bigendian=yes
1281       ;;
1282     xlittle)
1283       ac_cv_c_bigendian=no
1284       ;;
1285     *)
1286       dnl  Try to guess endianness by matching patterns on a compiled
1287       dnl  binary, by looking for an ASCII or EBCDIC string
1288       AC_CACHE_CHECK([whether the byte order is big-endian],
1289         [ac_cv_c_bigendian],
1290         [ac_cv_c_bigendian=unknown
1291         [cat >conftest.c <<EOF
1292         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
1293         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
1294         void _a(void) { char*s = (char*)am; s = (char *)ai; }
1295         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
1296         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
1297         void _e(void) { char*s = (char*)em; s = (char*)ei; }
1298         int main(void) { _a(); _e(); return 0; }
1299 EOF
1300         ]
1301         if test -f conftest.c
1302         then 
1303           if ${CC-cc} conftest.c -o conftest.o >config.log 2>&1 \
1304               && test -f conftest.o
1305           then
1306             if test "`strings conftest.o | grep BIGenDianSyS`"
1307             then
1308               ac_cv_c_bigendian=yes
1309             fi
1310             if test "`strings conftest.o | grep LiTTleEnDian`"
1311             then
1312               ac_cv_c_bigendian=no
1313             fi
1314           fi
1315         fi
1316       ])
1317       if test x$ac_cv_c_bigendian = xunknown
1318       then
1319         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
1320       fi
1321       ;;
1322   esac
1323 dnl  Now we know what to use for endianness, just put it in the header
1324 if test $ac_cv_c_bigendian = yes
1325 then
1326   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
1327 fi
1328
1329 dnl
1330 dnl  Profiling
1331 dnl
1332 GPROF=0
1333 AC_ARG_ENABLE(gprof,
1334 [  --enable-gprof          gprof profiling (default disabled)],
1335 [ if test x$enableval = xyes; then GPROF=1; fi ])
1336
1337 CPROF=0
1338 AC_ARG_ENABLE(cprof,
1339 [  --enable-cprof          cprof profiling (default disabled)],
1340 [ if test x$enableval = xyes;
1341   then
1342     LDFLAGS="${LDFLAGS} -lcprof"
1343     CPROF=1
1344   fi
1345 ])
1346
1347 dnl
1348 dnl  GNU portable threads
1349 dnl
1350 AC_ARG_ENABLE(pth,
1351   [  --enable-pth            GNU Pth support (default disabled)],
1352   [ if test x$enableval = xyes; then
1353     AC_CHECK_LIB(pth,pth_init)
1354     AC_EGREP_HEADER(pth_init,pth.h,[
1355       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
1356                 Define if <pth.h> defines pth_init)
1357     THREAD_LIB="-lpth"
1358     fi])
1359 ])
1360
1361 dnl
1362 dnl  State Threads
1363 dnl
1364 AC_ARG_ENABLE(st,
1365   [  --enable-st             State Threads (default disabled)],
1366   [ if test x$enableval = xyes; then
1367     AC_CHECK_LIB(st,st_init)
1368     AC_EGREP_HEADER(st_init,st.h,[
1369       AC_DEFINE(ST_INIT_IN_ST_H, 1,
1370                 Define if <st.h> defines st_init)
1371     THREAD_LIB="-lst"
1372     fi])
1373 ])
1374
1375 LDFLAGS="${LDFLAGS} ${THREAD_LIB}"
1376
1377 dnl
1378 dnl  Plug-ins - this must be AT THE END
1379 dnl
1380 AC_ARG_ENABLE(plugins,
1381   [  --disable-plugins       make all plug-ins built-in (default plug-ins enabled)],
1382   [if test x$enable_plugins = xno
1383    then
1384      BUILTINS="${BUILTINS} ${PLUGINS}"
1385      PLUGINS=
1386    fi])
1387
1388 dnl Automagically disable plug-ins if there is no system support for .so files
1389 dnl don't forget vlc-win32 still can load .so as plugins
1390 if test x$ac_cv_header_dlfcn_h = xno -a x$ac_cv_header_image_h = xno -a x$SYS != xmingw32
1391 then
1392   echo "*** Your system doesn't have plug-in support. All plug-ins will be compiled"
1393   echo "as built-in"
1394   BUILTINS="${BUILTINS} ${PLUGINS}"
1395   PLUGINS=
1396 fi
1397
1398 dnl
1399 dnl  Stuff used by the program
1400 dnl
1401 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc $VERSION $CODENAME Copyright 1996-2002 VideoLAN\n", [Simple version string])
1402 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version $VERSION $CODENAME - (c) 1996-2002 VideoLAN", [Copyright string])
1403
1404 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
1405 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__MODULE_$VLC_SYMBOL", [String suffix for module functions])
1406 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, $VLC_SYMBOL, [Symbol suffix for module functions])
1407
1408 DATA_PATH="${ac_tool_prefix}/share/videolan"
1409 AC_SUBST(DATA_PATH)
1410 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
1411 AC_SUBST(PLUGIN_PATH)
1412
1413 dnl 
1414 dnl  Configuration is finished
1415 dnl
1416 AC_SUBST(SYS)
1417 AC_SUBST(ARCH)
1418 AC_SUBST(PLUGINS)
1419 AC_SUBST(BUILTINS)
1420 AC_SUBST(ALIASES)
1421 AC_SUBST(DEBUG)
1422 AC_SUBST(ASM)
1423 AC_SUBST(CPROF)
1424 AC_SUBST(GPROF)
1425 AC_SUBST(OPTIMS)
1426 AC_SUBST(TUNING)
1427 AC_SUBST(RELEASE)
1428 AC_SUBST(MOC)
1429 AC_SUBST(WINDRES)
1430 AC_SUBST(BCBUILDER)
1431 AC_SUBST(VLC_PACKAGE)
1432 AC_SUBST(VLC_VERSION)
1433 AC_SUBST(NEED_GETOPT)
1434
1435 AC_SUBST(CFLAGS_OPTIM)
1436 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
1437 AC_SUBST(LDFLAGS)
1438
1439 AC_SUBST(vlc_CFLAGS)
1440 AC_SUBST(plugins_CFLAGS)
1441 AC_SUBST(builtins_CFLAGS)
1442
1443 AC_SUBST(arts_CFLAGS)
1444 AC_SUBST(dvd_CFLAGS)
1445 AC_SUBST(dvdread_CFLAGS)
1446 AC_SUBST(directx_CFLAGS)
1447 AC_SUBST(esd_CFLAGS)
1448 AC_SUBST(glide_CFLAGS)
1449 AC_SUBST(gnome_CFLAGS)
1450 AC_SUBST(gtk_CFLAGS)
1451 AC_SUBST(kde_CFLAGS)
1452 AC_SUBST(idctaltivec_CFLAGS)
1453 AC_SUBST(macosx_CFLAGS)
1454 AC_SUBST(mad_CFLAGS)
1455 AC_SUBST(memcpyaltivec_CFLAGS)
1456 AC_SUBST(motionaltivec_CFLAGS)
1457 AC_SUBST(qt_CFLAGS)
1458 AC_SUBST(sdl_CFLAGS)
1459 AC_SUBST(x11_CFLAGS)
1460 AC_SUBST(xvideo_CFLAGS)
1461
1462 AC_SUBST(vlc_LDFLAGS)
1463 AC_SUBST(plugins_LDFLAGS)
1464 AC_SUBST(builtins_LDFLAGS)
1465
1466 AC_SUBST(a52_LDFLAGS)
1467 AC_SUBST(aa_LDFLAGS)
1468 AC_SUBST(alsa_LDFLAGS)
1469 AC_SUBST(arts_LDFLAGS)
1470 AC_SUBST(beos_LDFLAGS)
1471 AC_SUBST(chroma_i420_rgb_LDFLAGS)
1472 AC_SUBST(directx_LDFLAGS)
1473 AC_SUBST(dsp_LDFLAGS)
1474 AC_SUBST(dvd_LDFLAGS)
1475 AC_SUBST(dvdread_LDFLAGS)
1476 AC_SUBST(esd_LDFLAGS)
1477 AC_SUBST(filter_distort_LDFLAGS)
1478 AC_SUBST(ggi_LDFLAGS)
1479 AC_SUBST(glide_LDFLAGS)
1480 AC_SUBST(gnome_LDFLAGS)
1481 AC_SUBST(gtk_LDFLAGS)
1482 AC_SUBST(idctaltivec_LDFLAGS)
1483 AC_SUBST(imdct_LDFLAGS)
1484 AC_SUBST(imdct3dn_LDFLAGS)
1485 AC_SUBST(imdctsse_LDFLAGS)
1486 AC_SUBST(ipv4_LDFLAGS)
1487 AC_SUBST(kde_LDFLAGS)
1488 AC_SUBST(lirc_LDFLAGS)
1489 AC_SUBST(macosx_LDFLAGS)
1490 AC_SUBST(mad_LDFLAGS)
1491 AC_SUBST(memcpyaltivec_LDFLAGS)
1492 AC_SUBST(motionaltivec_LDFLAGS)
1493 AC_SUBST(ncurses_LDFLAGS)
1494 AC_SUBST(qnx_LDFLAGS)
1495 AC_SUBST(qt_LDFLAGS)
1496 AC_SUBST(rc_LDFLAGS)
1497 AC_SUBST(sdl_LDFLAGS)
1498 AC_SUBST(vcd_LDFLAGS)
1499 AC_SUBST(vorbis_LDFLAGS)
1500 AC_SUBST(waveout_LDFLAGS)
1501 AC_SUBST(x11_LDFLAGS)
1502 AC_SUBST(xvideo_LDFLAGS)
1503
1504 AC_OUTPUT([Makefile.opts po/Makefile.in])
1505
1506 echo "
1507 vlc configuration
1508 --------------------
1509 vlc version           : ${VERSION}
1510 system                : ${SYS}
1511 architecture          : ${ARCH}
1512 optimizations         : ${OPTIMS}
1513 tuning                : ${TUNING}
1514 debug mode            : ${DEBUG}
1515 release               : ${RELEASE}
1516 cprof/gprof support   : ${CPROF}/${GPROF}
1517 need builtin getopt   : ${NEED_GETOPT}
1518 built-in modules      :${BUILTINS}
1519 plug-in modules       :${PLUGINS}
1520 vlc aliases           :${ALIASES}
1521
1522 You may now tune Makefile.opts at your convenience, for instance to choose
1523 which modules get compiled as plugins.
1524
1525 To build vlc and its plugins, type \`$VLC_MAKE'.
1526 "
1527