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