]> git.sesse.net Git - vlc/blob - configure.in
* ALL: added *.am files here and there for future automake support.
[vlc] / configure.in
1 dnl Autoconf settings for vlc
2 AC_INIT(configure.in)
3
4 AC_PREREQ(2.50)
5 AC_CANONICAL_SYSTEM
6
7 CONFIGURE_LINE="$0 $*"
8
9 PACKAGE="vlc"
10 VERSION="0.5.0-cvs"
11 CODENAME="Natalya"
12
13 AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})
14 AM_CONFIG_HEADER(config.h)
15
16 dnl
17 dnl  Save *FLAGS
18 dnl
19 save_CPPFLAGS="${CPPFLAGS}"
20 save_CFLAGS="${CFLAGS}"
21 save_LDFLAGS="${LDFLAGS}"
22
23 dnl
24 dnl Check for tools
25 dnl
26 AC_PROG_CC
27 AC_PROG_CPP
28 AC_PROG_MAKE_SET
29 AC_PROG_INSTALL
30
31 dnl Find the right ranlib, even when cross-compiling
32 AC_CHECK_TOOL(RANLIB, ranlib, :)
33 AC_CHECK_TOOL(STRIP, strip, :)
34
35 dnl
36 dnl Check for GNU make
37 dnl
38 AC_PATH_PROG(GMAKE, gmake, no)
39 if test "x${GMAKE}" = "xno"; then
40 AC_CACHE_CHECK([whether GNU make is installed],
41   [ac_cv_gmake],
42   [if make --version | grep -q -i gnu; then
43      ac_cv_gmake="yes"
44    else
45      echo "This software needs you to install GNU make to compile properly."
46      echo "You can get it from http://www.gnu.org/."
47      exit
48    fi])
49 VLC_MAKE="make"
50 else
51 VLC_MAKE="gmake"
52 fi
53
54 dnl Gettext stuff
55 ALL_LINGUAS="de en_GB fr ja no ru nl pl se"
56 AM_GNU_GETTEXT_VERSION(0.10.40)
57 AM_GNU_GETTEXT
58
59 dnl AM_PROG_LIBTOOL
60 AC_PROG_INSTALL
61
62 dnl Check for compiler properties
63 AC_C_CONST
64 AC_C_INLINE
65
66 dnl
67 dnl  Set default LDFLAGS
68 dnl
69 vlc_LDFLAGS="${LDFLAGS}"
70
71 dnl
72 dnl  Check the operating system
73 dnl
74 case "x${target_os}" in
75 x)
76 SYS=unknown
77 ;;
78 xlinux*)
79 SYS=linux
80 ;;
81 xbsdi*)
82 SYS=bsdi
83 save_CFLAGS="${save_CFLAGS} -pthread"; CFLAGS="${save_CFLAGS}"
84 dvd_LDFLAGS="${dvd_LDFLAGS} -ldvd"
85 vcd_LDFLAGS="${vcd_LDFLAGS} -ldvd"
86 ;;
87 x*bsd*)
88 SYS="${target_os}"
89 save_CFLAGS="${save_CFLAGS} -pthread"; CFLAGS="${save_CFLAGS}"
90 ;;
91 xdarwin*)
92 SYS=darwin
93 save_CFLAGS="${save_CFLAGS} -no-cpp-precomp"; CFLAGS="${save_CFLAGS}"
94 vlc_LDFLAGS="${vlc_LDFLAGS} -all_load"
95 ;;
96 x*mingw32*)
97 SYS=mingw32
98 AC_CHECK_TOOL(WINDRES, windres, :)
99 save_CFLAGS="${save_CFLAGS} -fnative-struct -D_OFF_T_ -D_off_t=long"; CFLAGS="${save_CFLAGS}"
100 vlc_LDFLAGS="${vlc_LDFLAGS} -mwindows -Xlinker --force-exe-suffix"
101 vlc_LDFLAGS="${vlc_LDFLAGS} -lws2_32 -lnetapi32"
102 ipv4_LDFLAGS="${ipv4_LDFLAGS} -lws2_32"
103 ipv6_LDFLAGS="${ipv6_LDFLAGS} -lws2_32"
104 http_LDFLAGS="${http_LDFLAGS} -lws2_32"
105 rc_LDFLAGS="${rc_LDFLAGS} -lws2_32"
106 ;;
107 x*nto*)
108 SYS=nto
109 x11_LDFLAGS="${x11_LDFLAGS} -lsocket"
110 xvideo_LDFLAGS="${xvideo_LDFLAGS} -lsocket"
111 ;;
112 xsolaris*)
113 SYS=solaris
114 ;;
115 xbeos)
116 SYS=beos
117 save_CFLAGS="${save_CFLAGS} -Wno-multichar -Wno-ctor-dtor-privacy -Woverloaded-virtual"; CFLAGS="${save_CFLAGS}"
118 vlc_LDFLAGS="${vlc_LDFLAGS} -lbe"
119 plugins_LDFLAGS="${plugins_LDFLAGS} -nostart"
120 beos_LDFLAGS="${beos_LDFLAGS} -lbe -lgame -lroot -ltracker -lstdc++.r4"
121 ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind"
122 ;;
123 x*)
124 SYS="${target_os}"
125 ;;
126 esac
127
128 dnl Flags for plugin compilation
129 if test "x${SYS}" = "xmingw32"
130 then
131 plugins_CFLAGS="${plugins_CFLAGS} -fnative-struct"
132 else
133 plugins_CFLAGS="${plugins_CFLAGS} -fPIC"
134 plugins_LDFLAGS="${plugins_LDFLAGS} -fPIC"
135 fi
136
137 dnl The -DSYS_FOO flag
138 save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CFLAGS="${save_CFLAGS}"
139
140 dnl Check for system libs needed
141 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll strndup)
142
143 AC_CHECK_FUNC(connect,,[
144 AC_CHECK_LIB(socket,connect,
145 ipv4_LDFLAGS="${ipv4_LDFLAGS} -lsocket"
146 vlc_LDFLAGS="${vlc_LDFLAGS} -lsocket"
147 )])
148 AC_CHECK_FUNC(send,,[
149 AC_CHECK_LIB(socket,send,
150 http_LDFLAGS="${http_LDFLAGS} -lsocket"
151 )])
152 AC_CHECK_FUNC(gethostbyname,,[
153 AC_CHECK_LIB(nsl,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lnsl",[
154 AC_CHECK_LIB(bind,gethostbyname,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lbind")])
155 ])
156 have_nanosleep=0
157 AC_CHECK_FUNC(nanosleep,have_nanosleep=1,[
158   AC_CHECK_LIB(rt,nanosleep,
159     [pthread_LDFLAGS="${pthread_LDFLAGS} -lrt"; have_nanosleep=1],
160     [AC_CHECK_LIB(posix4,nanosleep,
161         [pthread_LDFLAGS="${pthread_LDFLAGS} -lposix4"; have_nanosleep=1])]
162   )
163 ])
164 if test x$have_nanosleep = x1; then
165 AC_DEFINE(HAVE_NANOSLEEP, 1,
166         Define if nanosleep is available.)
167 fi
168 # HP/UX port
169 AC_CHECK_LIB(rt,sem_init, [pthread_LDFLAGS="${pthread_LDFLAGS} -lrt"])
170
171 AC_CHECK_FUNC(inet_aton,,[
172 AC_CHECK_LIB(resolv,inet_aton,ipv4_LDFLAGS="${ipv4_LDFLAGS} -lresolv")
173 ])
174 AC_CHECK_FUNC(textdomain,,[
175 AC_CHECK_LIB(intl,textdomain,
176 vlc_LDFLAGS="${vlc_LDFLAGS} -lintl"
177 plugins_LDFLAGS="${plugins_LDFLAGS} -lintl"
178 )
179 ])
180
181 dnl Check for getopt
182 NEED_GETOPT=0
183 AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
184 [ # FreeBSD has a gnugetopt library for this:
185 AC_CHECK_LIB([gnugetopt],[getopt_long],
186 [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) vlc_LDFLAGS="${vlc_LDFLAGS} -lgnugetopt"],
187 [NEED_GETOPT=1])])
188
189 AC_TYPE_SIGNAL
190 AC_CHECK_LIB(dl,dlopen,vlc_LDFLAGS="${vlc_LDFLAGS} -ldl")
191 AC_CHECK_LIB(m,cos,
192 imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
193 filter_distort_LDFLAGS="${filter_distort_LDFLAGS} -lm")
194 AC_CHECK_LIB(m,pow,
195 ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lm"
196 imdct_LDFLAGS="${imdct_LDFLAGS} -lm"
197 imdct3dn_LDFLAGS="${imdct3dn_LDFLAGS} -lm"
198 imdctsse_LDFLAGS="${imdctsse_LDFLAGS} -lm"
199 i420_rgb_LDFLAGS="${i420_rgb_LDFLAGS} -lm"
200 faad_LDFLAGS="${faad_LDFLAGS} -lm"
201 )
202
203 dnl Check for pthreads - borrowed from XMMS
204 THREAD_LIB=error
205 if test "x${THREAD_LIB}" = "xerror"; then
206   AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread ${pthread_LDFLAGS}")
207 fi
208 if test "x${THREAD_LIB}" = "xerror"; then
209   AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads ${pthread_LDFLAGS}")
210 fi
211 if test "x${THREAD_LIB}" = "xerror"; then
212 AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
213 fi
214 if test "x${THREAD_LIB}" = "xerror"; then
215 AC_CHECK_FUNC(pthread_mutex_lock)
216 THREAD_LIB=""
217 fi
218
219 dnl Check for cthreads under GNU/Hurd for instance
220 AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
221
222 dnl Check for misc headers
223 AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
224 AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
225         Define if <pthread.h> defines pthread_cond_t.)])
226 AC_EGREP_HEADER(pthread_once,pthread.h,[
227 AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
228         Define if <pthread.h> defines pthread_once.)])
229 AC_EGREP_HEADER(strncasecmp,strings.h,[
230 AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
231         Define if <strings.h> defines strncasecmp.)])
232
233 dnl Check for headers
234 AC_CHECK_HEADERS(stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
235 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h)
236 AC_CHECK_HEADERS(dlfcn.h image.h)
237 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
238 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
239 AC_CHECK_HEADERS(linux/version.h)
240
241 AC_HEADER_TIME
242
243 dnl Mac OS X and other OSes don't have declaration for nanosleep
244 AC_EGREP_HEADER(nanosleep,time.h,[
245 AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
246         Define if <time.h> defines nanosleep.)
247 ])
248
249 dnl Make sure we have timespecs
250 AC_EGREP_HEADER(timespec,sys/time.h,[
251 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
252         Define if <sys/time.h> defines struct timespec.)
253 ])
254
255 dnl Check for threads library
256 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
257
258 dnl Default X headers and libraries
259 if test "x${x_includes}" = "xNONE"; then
260 x_includes="/usr/X11R6/include"
261 fi
262 if test "x${x_libraries}" = "xNONE"; then
263 x_libraries="/usr/X11R6/lib"
264 fi
265
266 dnl Build the gtk_main plugin?
267 NEED_GTK_MAIN=no
268
269 dnl Check for DPMS
270 if test "x${SYS}" != "xmingw32"
271 then
272 CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
273 AC_CHECK_HEADERS(X11/extensions/dpms.h, [
274 AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
275   AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
276             Define if <X11/extensions/dpms.h> defines DPMSInfo.)
277 ])
278 ])
279 CPPFLAGS="${save_CPPFLAGS}"
280 fi
281
282 dnl Check for ntohl, etc.
283 AC_CACHE_CHECK([for ntohl in sys/param.h],
284 [ac_cv_c_ntohl_sys_param_h],
285 [CFLAGS="${save_CFLAGS} -Wall -Werror"
286  AC_TRY_COMPILE([#include <sys/param.h>],
287     [void foo() { int meuh; ntohl(meuh); }],
288     ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
289 if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
290 AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
291 fi
292
293 dnl Check for inline function size limit
294 AC_CACHE_CHECK([if \$CC accepts -finline-limit],
295 [ac_cv_c_inline_limit],
296 [CFLAGS="${save_CFLAGS} -finline-limit-30000"
297  AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
298 if test "x${ac_cv_c_inline_limit}" != "xno"; then
299 save_CFLAGS="${save_CFLAGS} -finline-limit-30000"; CFLAGS="${save_CFLAGS}"
300 fi
301
302 dnl Check for -W or -w flags
303 AC_CACHE_CHECK([if \$CC accepts -Wall -Winline],
304 [ac_cv_c_Wall_Winline],
305 [CFLAGS="-Wall -Winline ${save_CFLAGS}"
306  AC_TRY_COMPILE([],,ac_cv_c_Wall_Winline=yes, ac_cv_c_Wall_Winline=no)])
307 if test "x${ac_cv_c_Wall_Winline}" != "xno"; then
308 save_CFLAGS="-Wall -Winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
309 else
310 AC_CACHE_CHECK([if \$CC accepts -wall -winline],
311     [ac_cv_c_wall_winline],
312     [CFLAGS="-wall -winline ${save_CFLAGS}"
313      AC_TRY_COMPILE([],,ac_cv_c_wall_winline=yes, ac_cv_c_wall_winline=no)])
314 if test "x${ac_cv_c_wall_winline}" != "xno"; then
315     save_CFLAGS="-wall -winline ${save_CFLAGS}"; CFLAGS="${save_CFLAGS}"
316 fi
317 fi
318
319 dnl Check for -pipe
320 AC_CACHE_CHECK([if \$CC accepts -pipe],
321 [ac_cv_c_pipe],
322 [CFLAGS="${save_CFLAGS} -pipe"
323  AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
324 if test "x${ac_cv_c_pipe}" != "xno"; then
325 save_CFLAGS="${save_CFLAGS} -pipe"; CFLAGS="${save_CFLAGS}"
326 fi
327
328 dnl Check for various optimization flags
329 AC_CACHE_CHECK([if \$CC accepts -O3],
330 [ac_cv_c_o3],
331 [CFLAGS="${save_CFLAGS} -O3"
332  AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
333 if test "x${ac_cv_c_o3}" != "xno"; then
334 CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
335 else
336 AC_CACHE_CHECK([if \$CC accepts -O2],
337     [ac_cv_c_o2],
338     [CFLAGS="${save_CFLAGS} -O2"
339      AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
340 if test "x${ac_cv_c_o2}" != "xno"; then
341     CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
342 else
343     AC_CACHE_CHECK([if \$CC accepts -O],
344         [ac_cv_c_o],
345         [CFLAGS="${save_CFLAGS} -O"
346          AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
347     if test "x${ac_cv_c_o}" != "xno"; then
348         CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
349     fi
350 fi
351 fi
352
353 dnl Check for -ffast-math
354 AC_CACHE_CHECK([if \$CC accepts -ffast-math],
355 [ac_cv_c_fast_math],
356 [CFLAGS="${save_CFLAGS} -ffast-math"
357  AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
358 if test "x${ac_cv_c_fast_math}" != "xno"; then
359 CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
360 fi
361
362 dnl Check for -funroll-loops
363 AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
364 [ac_cv_c_unroll_loops],
365 [CFLAGS="${save_CFLAGS} -funroll-loops"
366  AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
367 if test "x${ac_cv_c_unroll_loops}" != "xno"; then
368 CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
369 fi
370
371 dnl Check for -fomit-frame-pointer
372 AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
373 [ac_cv_c_omit_frame_pointer],
374 [CFLAGS="${save_CFLAGS} -fomit-frame-pointer"
375  AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
376 if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
377 CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
378 # this plugin does not compile without -fomit-frame-pointer, damn gcc!
379 i420_yuy2_mmx_CFLAGS="${i420_yuy2_mmx_CFLAGS} -fomit-frame-pointer"
380 fi
381
382 dnl Check for Darwin plugin linking flags
383 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
384 [ac_cv_ld_darwin],
385 [CFLAGS="${save_CFLAGS} -bundle -undefined error -lcc_dynamic"
386  AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
387 if test "x${ac_cv_ld_darwin}" != "xno"; then
388 plugins_LDFLAGS="${plugins_LDFLAGS} -bundle -undefined error -lcc_dynamic"
389 fi
390
391 dnl Check for standard plugin linking flags
392 AC_CACHE_CHECK([if \$CC accepts -shared],
393 [ac_cv_ld_plugins],
394 [CFLAGS="${save_CFLAGS} -shared"
395  AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
396 if test "x${ac_cv_ld_plugins}" != "xno"; then
397 plugins_LDFLAGS="${plugins_LDFLAGS} -shared"
398 fi
399     
400 dnl Check for variadic macros
401 AC_CACHE_CHECK([for variadic cpp macros],
402 [ac_cv_cpp_variadic_macros],
403 [CFLAGS="${save_CFLAGS}"
404  AC_TRY_COMPILE(
405      [#include <stdio.h>
406       #define a(b,c...) printf(b,##c)],
407      [a("foo");a("%s","bar");a("%s%s","baz","quux");],
408      ac_cv_cpp_variadic_macros=yes,
409      ac_cv_cpp_variadic_macros=no)])
410 if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
411 AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
412 fi
413
414 dnl Checks for __attribute__(aligned()) directive
415 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
416 [ac_cv_c_attribute_aligned],
417 [ac_cv_c_attribute_aligned=0
418     CFLAGS="${save_CFLAGS} -Werror"
419 for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
420     AC_TRY_COMPILE([],
421     [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
422     [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
423 done
424     CFLAGS="${save_CFLAGS}"])
425 if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
426 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
427     [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
428 fi
429
430 dnl
431 dnl  Check the CPU
432 dnl
433 case "x${target_cpu}" in
434 x)
435 ARCH=unknown
436 ;;
437 *)
438 ARCH="${target_cpu}"
439 ;;
440 esac
441
442 dnl
443 dnl  default modules
444 dnl
445 BUILTINS="${BUILTINS}"
446 PLUGINS="${PLUGINS} misc/dummy/dummy misc/null"
447 PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file misc/memcpy/memcpy"
448 PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts demux/a52sys"
449 PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/mpeg_audio/mpeg_audio"
450 PLUGINS="${PLUGINS} codec/a52old/imdct/imdct codec/a52old/downmix/downmix codec/a52old/a52old codec/a52 codec/lpcm"
451 PLUGINS="${PLUGINS} video_filter/deinterlace/deinterlace video_filter/invert video_filter/wall video_filter/transform video_filter/distort video_filter/clone video_filter/crop video_filter/motionblur"
452 PLUGINS="${PLUGINS} audio_filter/converter/float32tos16 audio_filter/converter/float32tos8 audio_filter/converter/float32tou16 audio_filter/converter/float32tou8 audio_filter/converter/a52tospdif audio_filter/converter/fixed32tofloat32 audio_filter/converter/fixed32tos16 audio_filter/converter/s16tofloat32 audio_filter/converter/s16tofloat32swab"
453 PLUGINS="${PLUGINS} audio_filter/resampler/trivial audio_filter/resampler/ugly"
454 PLUGINS="${PLUGINS} audio_filter/channel_mixer/trivial"
455 PLUGINS="${PLUGINS} audio_mixer/float32 audio_mixer/trivial audio_mixer/spdif"
456 PLUGINS="${PLUGINS} audio_output/file"
457 #PLUGINS="${PLUGINS} visualization/scope/scope"
458 PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga"
459 PLUGINS="${PLUGINS} demux/util/id3"
460 dnl
461 dnl  Network modules
462 dnl
463 NETWORK_MODULES="access/udp access/http access/rtp misc/network/ipv4"
464
465 dnl
466 dnl  Accelerated modules
467 dnl
468 MMX_MODULES="misc/memcpy/memcpymmx codec/mpeg_video/idct/idctmmx codec/mpeg_video/motion/motionmmx video_chroma/i420_rgb_mmx video_chroma/i420_yuy2_mmx video_chroma/i422_yuy2_mmx video_chroma/i420_ymga_mmx"
469 MMXEXT_MODULES="misc/memcpy/memcpymmxext codec/mpeg_video/idct/idctmmxext codec/mpeg_video/motion/motionmmxext"
470 THREEDNOW_MODULES="misc/memcpy/memcpy3dn codec/a52old/imdct/imdct3dn codec/a52old/downmix/downmix3dn"
471 SSE_MODULES="codec/a52old/imdct/imdctsse codec/a52old/downmix/downmixsse"
472 ALTIVEC_MODULES="codec/mpeg_video/idct/idctaltivec codec/mpeg_video/motion/motionaltivec misc/memcpy/memcpyaltivec"
473
474 if test x$SYS != xbeos
475 then
476   PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
477 fi
478
479 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
480     [ac_cv_mmx_inline],
481     [CFLAGS="${save_CFLAGS}"
482      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
483                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
484 if test "x${ac_cv_mmx_inline}" != "xno"; then
485   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
486 fi
487
488 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
489     [ac_cv_mmxext_inline],
490     [CFLAGS="${save_CFLAGS}"
491      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
492                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
493 if test "x${ac_cv_mmxext_inline}" != "xno"; then
494   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
495 fi
496
497 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
498     [ac_cv_3dnow_inline],
499     [CFLAGS="${save_CFLAGS}"
500      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
501                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
502 if test "x${ac_cv_3dnow_inline}" != "xno"; then
503   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
504   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
505 fi
506
507 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
508     [ac_cv_sse_inline],
509     [CFLAGS="${save_CFLAGS}"
510      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
511                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
512 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
513   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
514   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
515 fi
516
517 # don't try to grok AltiVec with native mingw32 it doesn't work right now
518 # we should be able to remove this test with future versions of mingw32
519 if test "x${SYS}" != "xmingw32"; then
520 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
521     [ac_cv_altivec_inline],
522     [CFLAGS="${save_CFLAGS}"
523      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
524          ac_cv_altivec_inline=yes,
525          [CFLAGS="${save_CFLAGS} -Wa,-m7400"
526           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
527             [ac_cv_altivec_inline="-Wa,-m7400"],
528             ac_cv_altivec_inline=no)
529          ])])
530 if test "x${ac_cv_altivec_inline}" != "xno"; then
531   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
532   if test "x${ac_cv_altivec_inline}" != "xyes"; then
533     idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_altivec_inline}"
534     motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_altivec_inline}"
535     memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_altivec_inline}"
536     vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_altivec_inline}"
537   fi
538   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
539 fi
540
541 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
542     [ac_cv_c_altivec],
543     [CFLAGS="${save_CFLAGS} -faltivec"
544      # Darwin test
545      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
546         ac_cv_c_altivec=-faltivec, [
547         # Linux/PPC test
548         CFLAGS="${save_CFLAGS} ${idctaltivec_CFLAGS} -fvec"
549         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
550             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
551         ])
552      CFLAGS="${save_CFLAGS}"])
553 if test "x${ac_cv_c_altivec}" != "xno"; then
554   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
555   idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_c_altivec}"
556   motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_c_altivec}"
557   memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_c_altivec}"
558   vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_c_altivec}"
559   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
560 fi
561
562 AC_CACHE_CHECK([if linker needs -framework vecLib],
563     [ac_cv_ld_altivec],
564     [LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
565      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
566      LDFLAGS="${save_LDFLAGS}"
567     ])
568 if test "x${ac_cv_ld_altivec}" != "xno"; then
569   idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
570   motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
571   memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
572   vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
573 fi
574 fi # end if mingw32
575
576
577 AC_ARG_WITH(,[])
578 AC_ARG_WITH(,[Optimization options:])
579
580 dnl
581 dnl  Special arch tuning
582 dnl
583 AC_ARG_WITH(tuning,
584 [  --with-tuning=ARCH      enable special tuning for an architecture
585                           (default i686 on IA-32 and 750 on PPC)])
586 if test "x${with_tuning}" != "x"; then
587     TUNING="${with_tuning}"
588 else
589     if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then TUNING="pentiumpro"
590     else
591         if test "x${target_cpu}" = "xpowerpc"; then TUNING="750"; fi
592     fi
593 fi
594
595 dnl
596 dnl  x86 accelerations
597 dnl
598 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
599 then
600     ARCH="${ARCH} mmx"
601     PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
602 fi
603
604 dnl
605 dnl  Enable/disable optimizations
606 dnl
607 AC_ARG_ENABLE(optimizations,
608 [  --disable-optimizations disable compiler optimizations (default enabled)],
609 [ if test "x${enable_optimizations}" = "xno"; then OPTIMS=0; fi ],
610 [ OPTIMS=1 ])
611
612 dnl
613 dnl  AltiVec acceleration
614 dnl
615 AC_ARG_ENABLE(altivec,
616 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
617 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
618     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
619 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
620     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
621
622 dnl
623 dnl  Debugging mode
624 dnl
625 DEBUG=0
626 AC_ARG_ENABLE(debug,
627 [  --enable-debug          debug mode (default disabled)],
628 [ if test "x${enable_debug}" = "xyes"; then DEBUG=1; fi ])
629
630 dnl
631 dnl  Enable release-specific flags
632 dnl
633 RELEASE=0
634 AC_ARG_ENABLE(release,
635 [  --enable-release        activate extra optimizations (default disabled)],
636 [ if test "x${enable_release}" = "xyes"; then RELEASE=1; fi ],
637 [ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
638
639 dnl
640 dnl  Input plugins
641 dnl
642
643 AC_ARG_WITH(,[Input plugins:])
644
645 dnl
646 dnl  DVD module: optionally check for installed libdvdcss
647 dnl
648 AC_ARG_ENABLE(dvd,
649 [  --enable-dvd            DVD input module (default enabled)])
650 if test "x${enable_dvd}" != "xno"
651 then
652   AC_ARG_WITH(dvdcss, 
653   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
654   AC_ARG_WITH(dvdcss-tree, 
655   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
656   case "x${with_dvdcss}" in
657   x|xyes)
658     if test "x${with_dvdcss_tree}" = x
659     then
660       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
661         [ PLUGINS="${PLUGINS} access/dvd/dvd"
662           dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
663         [ 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.])
664           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
665     else
666       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
667       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
668       if test "x${real_dvdcss_tree}" = "x"
669       then
670         dnl  The given directory can't be found
671         AC_MSG_RESULT(no)
672         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
673       fi
674       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
675       then
676         dnl  Use a custom libdvdcss
677         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
678         BUILTINS="${BUILTINS} access/dvd/dvd"
679         dvd_LDFLAGS="${dvd_LDFLAGS} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
680         dvd_CFLAGS="${dvd_CFLAGS} -I${real_dvdcss_tree}/src"
681       else
682         dnl  The given libdvdcss wasn't built
683         AC_MSG_RESULT(no)
684         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
685       fi
686     fi
687   ;;
688   xno)
689     dnl  Compile without dvdcss (dlopen version, works only under Linux)
690     PLUGINS="${PLUGINS} access/dvd/dvd"
691     dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
692     dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
693   ;;
694   *)
695     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
696     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
697     then
698       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
699       AC_MSG_RESULT(yes)
700       PLUGINS="${PLUGINS} access/dvd/dvd"
701       dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
702       dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
703     else
704       dnl  No libdvdcss could be found, sorry
705       AC_MSG_RESULT(no)
706       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
707     fi
708   ;;
709   esac
710 fi
711
712 dnl
713 dnl dvdread module: check for libdvdread plugin
714 dnl
715 AC_ARG_ENABLE(dvdread,
716 [  --enable-dvdread        dvdread input module (default disabled)])
717 if test "x${enable_dvdread}" != "xno"
718 then
719   AC_ARG_WITH(dvdread, 
720   [    --with-dvdread=PATH   libdvdread headers and libraries])
721   if test "x${with_dvdread}" = "x"
722   then
723     test_LDFLAGS=""
724     test_CFLAGS=""
725   else
726     test_LDFLAGS="-L${with_dvdread}/lib"
727     test_CFLAGS="-I${with_dvdread}/include"
728   fi
729   CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
730   AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
731      AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
732         [int foo() { return DVD_VIDEO_LB_LEN; }],[
733           PLUGINS="${PLUGINS} access/dvdread/dvdread"
734           dvdread_LDFLAGS="${dvdread_LDFLAGS} ${test_LDFLAGS} -ldvdread"
735           dvdread_CFLAGS="${dvdread_CFLAGS} ${test_CFLAGS}"
736         ],[
737           if test "x${enable_dvdread}" != "x"
738           then
739             AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
740           fi
741         ])
742   ],[
743     if test "x${enable_dvdread}" != "x"
744     then
745       if test "x${with_dvdread}" != "x"
746       then
747         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
748       else
749         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
750       fi
751     fi
752   ])
753   CPPFLAGS="$save_CPPFLAGS"
754 fi
755
756 dnl
757 dnl dvdplay module: check for libdvdplay
758 dnl
759 AC_ARG_ENABLE(dvdplay,
760 [  --enable-dvdplay        dvdplay input module (default disabled)])
761 if test "x$enable_dvdplay" != "xno"
762 then
763   AC_ARG_WITH(dvdplay, 
764   [    --with-dvdplay=PATH   libdvdplay headers and libraries])
765   if test "x$with_dvdplay" = x
766   then
767     test_LDFLAGS=""
768     test_CFLAGS=""
769   else
770     test_LDFLAGS="-L${with_dvdplay}/lib"
771     test_CFLAGS="-I${with_dvdplay}/include"
772   fi
773   CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
774   AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
775       PLUGINS="${PLUGINS} access/dvdplay/dvdplay"
776       dvdplay_LDFLAGS="${dvdplay_LDFLAGS} ${test_LDFLAGS} -ldvdplay -ldvdread"
777       dvdplay_CFLAGS="${dvdplay_CFLAGS} ${test_CFLAGS}"
778     ],[
779     if test "x$enable_dvdplay" != x
780     then
781       if test "x$with_dvdplay" != x
782       then
783         AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
784       else
785         AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
786       fi
787     fi
788   ])
789   CPPFLAGS="${save_CPPFLAGS}"
790 fi
791
792
793 dnl
794 dnl  libdvbpsi ts demux
795 dnl
796 AC_ARG_ENABLE(dvbpsi,
797 [  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
798 if test "x${enable_dvbpsi}" != "xno"
799 then
800   AC_ARG_WITH(dvbpsi, 
801   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
802   AC_ARG_WITH(dvbpsi,
803   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
804   case "x${with_dvbpsi}" in
805   x|xyes)
806     if test "x${with_dvbpsi_tree}" = "x"
807     then
808       AC_CHECK_HEADERS(dvbpsi/dr.h,
809         [ PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
810           ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} -ldvbpsi" ], [],
811         [  AC_MSG_ERROR([cannot find libdvbpsi headers]) ])
812     else
813       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
814       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
815       if test "x${real_dvbpsi_tree}" = "x"
816       then
817         dnl  The given directory can't be found
818         AC_MSG_RESULT(no)
819         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
820       fi
821       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
822       then
823         dnl  Use a custom libdvbpsi
824         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
825         BUILTINS="${BUILTINS} demux/mpeg/ts_dvbpsi"
826         ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
827         ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} -I${real_dvbpsi_tree}/src"
828       else
829         dnl  The given libdvbpsi wasn't built
830         AC_MSG_RESULT(no)
831         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
832       fi
833     fi
834   ;;
835   xno)
836     dnl  Compile without dvbpsi
837   ;;
838   *)
839     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
840     if test "x${with_dvbpsi}" = "x"
841     then
842       test_LDFLAGS=""
843       test_CFLAGS=""
844     else
845       test_LDFLAGS="-L${with_dvbpsi}/lib"
846       test_CFLAGS="-I${with_dvbpsi}/include"
847     fi
848     CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
849     AC_CHECK_HEADER([dvbpsi/dr.h],[
850       PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
851       ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${test_LDFLAGS} -ldvbpsi"
852       ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} ${test_CFLAGS}"
853       ],[
854       if test "x${enable_dvbpsi}" != "x"
855       then
856         AC_MSG_ERROR([Could not find libdvbpsi on your system: you may get it from www.videolan.org, you'll need at least version 0.1.1])
857       fi
858     ])
859     CPPFLAGS="${save_CPPFLAGS}"
860   ;;
861   esac
862 fi
863
864 dnl
865 dnl  Video4Linux plugin
866 dnl
867 AC_ARG_ENABLE(v4l,
868   [  --enable-v4l            Video4Linux input support (default disabled)])
869 if test "x${enable_v4l}" = "xyes"
870 then
871   AC_CHECK_HEADERS(libv4l/v4l.h, [
872     PLUGINS="${PLUGINS} access/v4l/v4l"
873    ],[])
874 fi
875
876 dnl
877 dnl  VCD module
878 dnl
879 AC_ARG_ENABLE(vcd,
880   [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
881
882 if test "x${enable_vcd}" != "xno"
883 then
884   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
885     PLUGINS="${PLUGINS} access/vcd/vcd"
886   ])
887   
888   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
889     PLUGINS="${PLUGINS} access/vcd/vcd"
890     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
891   ])
892   
893   if test "x${SYS}" = "xbsdi"
894   then
895     PLUGINS="${PLUGINS} access/vcd/vcd"
896   fi
897
898   if test "x${SYS}" = "xdarwin"
899   then
900     # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
901     vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
902   fi
903 fi
904
905 dnl
906 dnl  Satellite input module
907 dnl
908 AC_ARG_ENABLE(satellite,
909   [  --enable-satellite      satellite card support (default disabled)],
910   [ if test "x${enable_satellite}" = "xyes"
911     then
912       PLUGINS="${PLUGINS} access/satellite/satellite"
913     fi])
914
915 dnl
916 dnl  ipv6 plugin - not for QNX yet
917 dnl
918 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
919 then
920   have_ipv6=0
921   AC_CHECK_FUNC(inet_pton,[have_ipv6=1],[
922     AC_CHECK_LIB(resolv,inet_pton,
923       [have_ipv6=1
924        ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
925   ])
926   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
927   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
928     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=0])
929   if test x$have_ipv6 = x1; then
930     PLUGINS="${PLUGINS} misc/network/ipv6"
931   fi
932 fi
933 if test "x${SYS}" = "xmingw32"
934 then
935   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
936   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
937     PLUGINS="${PLUGINS} misc/network/ipv6"],[AC_MSG_RESULT(no)])
938 fi
939
940 dnl
941 dnl  AVI demux plugin
942 dnl
943 AC_ARG_ENABLE(avi,
944   [  --enable-avi            AVI demux module (default enabled)])
945 if test "x${enable_avi}" != "xno"
946 then
947   PLUGINS="${PLUGINS} demux/avi/avi"
948 fi
949
950 dnl
951 dnl  AAC demux plugin
952 dnl
953 AC_ARG_ENABLE(aac,
954   [  --enable-aac            AAC demux module (default enabled)])
955 if test "x${enable_aac}" != "xno"
956 then
957   PLUGINS="${PLUGINS} demux/aac/aac"
958 fi
959
960 dnl
961 dnl  Codec plugins
962 dnl
963
964 AC_ARG_WITH(,[Codec plugins:])
965
966 dnl
967 dnl  mad plugin
968 dnl
969 AC_ARG_ENABLE(mad,
970   [  --enable-mad            libmad module (default disabled)])
971 if test "x${enable_mad}" = "xyes"
972 then
973   AC_ARG_WITH(mad,
974     [    --with-mad=PATH       path to libmad],[],[])
975   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
976   then
977     mad_CFLAGS="${mad_CFLAGS} -I${with_mad}/include"
978     mad_LDFLAGS="${mad_LDFLAGS} -L${with_mad}/lib"
979   fi
980
981   AC_ARG_WITH(mad-tree,
982     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
983   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
984   then
985     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
986     if test "x${real_mad_tree}" = "x"
987     then
988       dnl  The given directory can't be found
989       AC_MSG_RESULT(no)
990       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
991     fi
992     dnl  Use a custom libmad
993     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
994     if test -f ${real_mad_tree}/libmad/mad.h
995     then
996       AC_MSG_RESULT(yes)
997       mad_CFLAGS="${mad_CFLAGS} -I${real_mad_tree}/libmad"
998       mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs"
999       LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
1000       AC_CHECK_LIB(mad, mad_bit_init, [
1001         BUILTINS="${BUILTINS} codec/mad/mad"
1002         mad_LDFLAGS="${mad_LDFLAGS} -lmad"
1003         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1004       ],[])
1005       LDFLAGS="${save_LDFLAGS}"
1006     else
1007       AC_MSG_RESULT(no)
1008       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1009     fi
1010   else
1011     CFLAGS="${save_CFLAGS} ${mad_CFLAGS}"
1012     LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
1013     AC_CHECK_HEADERS(mad.h, ,
1014       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1015     AC_CHECK_LIB(mad, mad_bit_init, [
1016       PLUGINS="${PLUGINS} codec/mad/mad"
1017       mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
1018       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1019     CFLAGS="${save_CFLAGS}"
1020     LDFLAGS="${save_LDFLAGS}"
1021   fi
1022 fi
1023
1024 dnl
1025 dnl   libid3tag support
1026 dnl
1027 AC_CHECK_HEADERS(id3tag.h, [
1028   id3tag_LDFLAGS="${id3tag_LDFLAGS} -lz -lid3tag"
1029   PLUGINS="${PLUGINS} demux/util/id3tag"])
1030    
1031 dnl
1032 dnl  ffmpeg decoder plugin
1033 dnl
1034 AC_ARG_ENABLE(ffmpeg,
1035 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1036 if test "x${enable_ffmpeg}" = "xyes"
1037 then
1038   AC_ARG_WITH(ffmpeg,
1039     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1040   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1041   then
1042     ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${with_ffmpeg}/include/libffmpeg"
1043     ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L${with_ffmpeg}/lib"
1044   fi
1045
1046   dnl Add postprocessing modules
1047   PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_c"
1048   if test "x${ac_cv_mmx_inline}" != "xno"; then
1049     PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmx"
1050   fi
1051
1052   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1053     PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmxext"
1054   fi
1055
1056
1057   AC_ARG_WITH(ffmpeg-tree, 
1058   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1059   if test "x${with_ffmpeg_tree}" != "x"
1060   then
1061     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1062     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1063     if test "x${real_ffmpeg_tree}" = x
1064     then
1065       dnl  The given directory can't be found
1066       AC_MSG_RESULT(no)
1067       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1068     fi
1069     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1070     then
1071       dnl  Use a custom libffmpeg
1072       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1073       BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1074       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1075       ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${real_ffmpeg_tree}/libavcodec"
1076     else
1077       dnl  The given libavcodec wasn't built
1078       AC_MSG_RESULT(no)
1079       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1080     fi
1081   else
1082     CFLAGS="${save_CFLAGS} ${ffmpeg_CFLAGS}"
1083     LDFLAGS="${save_LDFLAGS} ${ffmpeg_LDFLAGS}"
1084     AC_CHECK_LIB(avcodec, avcodec_init, [
1085       BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1086       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec" ],
1087       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1088     LDFLAGS="${save_LDFLAGS}"
1089     CFLAGS="${save_CFLAGS}"
1090   fi
1091 fi
1092
1093 dnl
1094 dnl  faad decoder plugin
1095 dnl
1096 AC_ARG_ENABLE(faad,
1097 [  --enable-faad           faad codec (default disabled)])
1098 if test "x${enable_faad}" = "xyes"
1099 then
1100   AC_ARG_WITH(faad,
1101     [    --with-faad=PATH      path to faad installation],[],[])
1102   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1103   then
1104     faad_CFLAGS="${faad_CFLAGS} -I${with_faad}/include"
1105     faad_LDFLAGS="${faad_LDFLAGS} -L${with_faad}/lib"
1106   fi
1107   faad_LDFLAGS="${faad_LDFLAGS}"
1108
1109   AC_ARG_WITH(faad-tree, 
1110   [    --with-faad-tree=PATH faad tree for static linking])
1111   if test "x${with_faad_tree}" != "x"
1112   then
1113     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1114     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1115     if test "x${real_faad_tree}" = x
1116     then
1117       dnl  The given directory can't be found
1118       AC_MSG_RESULT(no)
1119       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1120     fi
1121     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1122     then
1123       dnl  Use a custom faad
1124       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1125       BUILTINS="${BUILTINS} codec/faad/faad"
1126       faad_LDFLAGS="${faad_LDFLAGS} ${real_faad_tree}/libfaad/.libs/libfaad.a"
1127       faad_CFLAGS="${faad_CFLAGS} -I${real_faad_tree}/include"
1128     else
1129       dnl  The given libfaad wasn't built
1130       AC_MSG_RESULT(no)
1131       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1132     fi
1133   else
1134     CFLAGS="${save_CFLAGS} ${faad_CFLAGS}"
1135     LDFLAGS="${save_LDFLAGS} ${faad_LDFLAGS}"
1136     AC_CHECK_HEADERS(faad.h, ,
1137       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1138     AC_CHECK_LIB(faad, faacDecOpen, [
1139       PLUGINS="${PLUGINS} codec/faad/faad"
1140       faad_LDFLAGS="${faad_LDFLAGS} -lfaad" ],
1141       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1142     LDFLAGS="${save_LDFLAGS}"
1143     CFLAGS="${save_CFLAGS}"
1144   fi
1145 fi
1146
1147
1148
1149 dnl 
1150 dnl MP4 module 
1151 dnl 
1152 AC_ARG_ENABLE(mp4,
1153   [  --enable-mp4            MP4 demux module (default enabled)])
1154 if test "x${enable_mp4}" != "xno"
1155 then
1156
1157     PLUGINS="${PLUGINS} demux/mp4/mp4"
1158     AC_CHECK_HEADERS(zlib.h,
1159               [ mp4_LDFLAGS="${mp4_LDFLAGS} -lz" ] )
1160 fi
1161
1162 dnl
1163 dnl  a52 AC3 decoder plugin
1164 dnl
1165 AC_ARG_ENABLE(a52,
1166   [  --enable-a52            A/52 support with liba52 (default enabled)])
1167 if test "x${enable_a52}" != "xno"
1168 then
1169   AC_ARG_WITH(a52, 
1170     [    --with-a52=PATH       a52 headers and libraries])
1171   AC_ARG_WITH(a52-tree,
1172     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1173   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1174   then
1175     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1176     if test "x${real_a52_tree}" = "x"
1177     then
1178       dnl  The given directory can't be found
1179       AC_MSG_RESULT(no)
1180       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1181     fi
1182     dnl  Use a custom a52dec
1183     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1184     if test -f ${real_a52_tree}/include/a52.h
1185     then
1186       AC_MSG_RESULT(yes)
1187       a52tofloat32_CFLAGS="${a52tofloat32_CFLAGS} -I${real_a52_tree}"
1188       a52tofloat32_LDFLAGS="${a52tofloat32_LDFLAGS} -L${real_a52_tree}/liba52/.libs"
1189       LDFLAGS="${save_LDFLAGS} ${a52tofloat32_LDFLAGS}"
1190       AC_CHECK_LIB(a52, a52_free, [
1191         BUILTINS="${BUILTINS} audio_filter/converter/a52tofloat32"
1192         a52tofloat32_LDFLAGS="${a52tofloat32_LDFLAGS} -la52 -lm"
1193         a52tofloat32_CFLAGS="${a52tofloat32_CFLAGS} -DUSE_A52DEC_TREE"
1194         ],[
1195         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1196         then
1197           AC_MSG_ERROR([make sure you have at least a52dec-0.7.4])
1198         else
1199           AC_MSG_ERROR([the specified tree hasn't been compiled])
1200         fi
1201       ],[-lm])
1202       LDFLAGS="${save_LDFLAGS}"
1203     else
1204       AC_MSG_RESULT(no)
1205       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1206     fi
1207   else
1208     if test "x${with_a52}" = "x"
1209     then
1210       test_LDFLAGS=""
1211       test_CFLAGS=""
1212     else
1213       test_LDFLAGS="-L${with_a52}/lib"
1214       test_CFLAGS="-I${with_a52}/include"
1215     fi
1216     save_CPPFLAGS="${CPPFLAGS}"
1217     save_LDFLAGS="${LDFLAGS}"
1218     CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
1219     LDFLAGS="${save_LDFLAGS} ${test_LDFLAGS}"
1220     AC_CHECK_HEADERS(a52dec/a52.h, [
1221       AC_CHECK_LIB(a52, a52_free, [
1222         BUILTINS="${BUILTINS} audio_filter/converter/a52tofloat32"
1223         a52tofloat32_LDFLAGS="${a52tofloat32_LDFLAGS} ${test_LDFLAGS} -la52 -lm"
1224         a52tofloat32_CFLAGS="${a52tofloat32_CFLAGS} ${test_CFLAGS}"
1225       ],[
1226         if test "x${enable_dvbpsi}" != "x"
1227         then
1228           AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net])
1229         fi
1230       ],[-lm])
1231     ])
1232     CPPFLAGS="${save_CPPFLAGS}"
1233     LDFLAGS="${save_LDFLAGS}"
1234   fi
1235 fi
1236
1237 dnl
1238 dnl  cinepak plugin
1239 dnl
1240 AC_ARG_ENABLE(cinepak,
1241   [  --enable-cinepak        Cinepak decoder (default enabled)])
1242 if test "x${enable_cinepak}" != "xno"
1243 then
1244   PLUGINS="${PLUGINS} codec/cinepak/cinepak"
1245 fi
1246
1247 dnl
1248 dnl  ogg vorbis plugin
1249 dnl
1250 AC_ARG_ENABLE(vorbis,
1251   [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
1252 if test "x${enable_vorbis}" != "xno"
1253 then
1254   AC_CHECK_HEADERS(ogg/ogg.h, [
1255     dnl disabled for the moment
1256     #PLUGINS="${PLUGINS} demux/ogg/ogg codec/vorbis/vorbis"
1257     vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
1258    ],[])
1259 fi
1260
1261 dnl
1262 dnl  DV plugin
1263 dnl 
1264 AC_ARG_ENABLE(dv,
1265   [  --enable-dv             DV decoder support (default disabled)])
1266 if test "x${enable_dv}" = "xyes"
1267 then
1268   AC_CHECK_HEADERS(libdv/dv.h, [
1269     PLUGINS="${PLUGINS} codec/dv/dv"
1270     dv_LDFLAGS="${dv_LDFLAGS} -ldv"
1271    ],[])
1272 fi  
1273
1274 dnl
1275 dnl  Video plugins
1276 dnl
1277
1278 AC_ARG_WITH(,[Video plugins:])
1279
1280 dnl
1281 dnl  X11 module
1282 dnl  (enabled by default except on win32)
1283 dnl
1284 AC_ARG_ENABLE(x11,
1285   [  --enable-x11            X11 support (default enabled)])
1286 if test "x${enable_x11}" != "xno" &&
1287   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1288   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1289   AC_CHECK_HEADERS(X11/Xlib.h, [
1290     PLUGINS="${PLUGINS} video_output/x11/x11"
1291     x11_LDFLAGS="${x11_LDFLAGS} -L${x_libraries} -lX11 -lXext"
1292     x11_CFLAGS="${x11_CFLAGS} -I${x_includes}"
1293   ])
1294   CPPFLAGS="${save_CPPFLAGS}"
1295 fi
1296
1297 dnl
1298 dnl  XVideo module
1299 dnl  (enabled by default except on win32)
1300 dnl
1301 AC_ARG_ENABLE(xvideo,
1302   [  --enable-xvideo         XVideo support (default enabled)])
1303 if test "x${enable_xvideo}" != "xno" &&
1304   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1305   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1306   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1307     CFLAGS="${save_CFLAGS} -L${x_libraries} -lX11 -lXext"
1308     AC_CHECK_LIB(Xv_pic,XvPutImage,
1309       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1310       PLUGINS="${PLUGINS} video_output/x11/xvideo"
1311       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv_pic"
1312       xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1313       AC_CHECK_LIB(Xv,XvPutImage,
1314         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1315         PLUGINS="${PLUGINS} video_output/x11/xvideo"
1316         xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv"
1317         xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1318         # Otherwise... well, do nothing.
1319         :
1320       )
1321     )
1322     CFLAGS="${save_CFLAGS}"
1323   ]
1324   CPPFLAGS="${save_CPPFLAGS}")
1325 fi
1326
1327 dnl
1328 dnl  SDL module
1329 dnl
1330 AC_ARG_ENABLE(sdl,
1331   [  --enable-sdl            SDL support (default enabled)])
1332 if test "x${enable_sdl}" != "xno"
1333 then
1334   SDL_PATH="${PATH}"
1335   AC_ARG_WITH(sdl-config-path,
1336     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1337     [ if test "x${with_sdl_config_path}" != "xno"
1338       then
1339         SDL_PATH="${with_sdl_config_path}:${PATH}"
1340       fi ])
1341   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1342   SDL_CONFIG="${SDL12_CONFIG}"
1343   SDL_HEADER="SDL12/SDL.h"
1344   if test "x${SDL_CONFIG}" = "xno"
1345   then
1346     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1347     SDL_CONFIG=${SDL11_CONFIG}
1348     SDL_HEADER="SDL11/SDL.h"
1349   fi
1350   if test "x${SDL_CONFIG}" = "xno"
1351   then
1352     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1353     SDL_HEADER="SDL/SDL.h"
1354   fi
1355   if test "x${SDL_CONFIG}" != "xno"
1356   then
1357     PLUGINS="${PLUGINS} video_output/sdl audio_output/sdl"
1358     sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
1359     sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
1360     CPPFLAGS="${save_CPPFLAGS} ${sdl_CFLAGS}"
1361     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1362       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1363       [ AC_MSG_ERROR([The development package for SDL is not installed. 
1364 Please install it and try again. Alternatively you can also configure with 
1365 --disable-sdl.])
1366       ])
1367     CPPFLAGS="${save_CPPFLAGS}"
1368     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1369     then
1370       AC_MSG_ERROR([The development package for SDL is not installed.
1371 Please install it and try again. Alternatively you can also configure with
1372 --disable-sdl.])
1373     fi
1374   elif test "x${enable_sdl}" =  "xyes"
1375   then
1376     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1377 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1378     ])
1379   fi
1380 fi
1381
1382 dnl
1383 dnl  Qt Embedded module
1384 dnl  (disabled by default)
1385 dnl
1386 AC_ARG_ENABLE(qte,
1387   [  --enable-qte            QT Embedded support (default disabled)])
1388 if test "x${enable_qte}" != "xno"
1389 then
1390   AC_ARG_WITH(qte,
1391   [    --with-qte=PATH    Qt Embedded headers and libraries])
1392   if test "x${with_qte}" = "x"
1393   then
1394     test_LDFLAGS="-L${QTDIR}/lib"
1395     test_CFLAGS="-I${QTDIR}/include"
1396   else
1397     test_LDFLAGS="-L${with_qte}/lib"
1398     test_CFLAGS="-I${with_qte}/include"
1399   fi
1400
1401   CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
1402   AC_CHECK_HEADERS(qt.h, [
1403     qte_CFLAGS="${qte_CFLAGS} ${test_CFLAGS} -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1404     qte_LDFLAGS="${qte_LDFLAGS} ${test_LDFLAGS} -lqte"
1405     if test "x${with_qte}" = "x"
1406     then
1407       PLUGINS="${PLUGINS} video_output/qte/qte"
1408     else
1409       BUILTINS="${BUILTINS} video_output/qte/qte"
1410     fi
1411   ])
1412   CPPFLAGS="${save_CPPFLAGS}"
1413 fi
1414
1415 dnl
1416 dnl  Windows DirectX module
1417 dnl
1418 AC_ARG_ENABLE(directx,
1419   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1420 if test "x${enable_directx}" != "xno"
1421 then
1422   if test "x${SYS}" = "xmingw32"
1423   then
1424     AC_ARG_WITH(directx, 
1425     [    --with-directx=PATH   Win32 DirectX headers])
1426     if test "x${with_directx}" = "x"
1427     then
1428       AC_CHECK_HEADERS(ddraw.h,
1429       [ PLUGINS="${PLUGINS} video_output/directx/directx"
1430         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32" ])
1431     else
1432       AC_MSG_CHECKING(for directX headers in ${with_directx})
1433       if test -f ${with_directx}/ddraw.h
1434       then
1435         PLUGINS="${PLUGINS} video_output/directx/directx"
1436         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32"
1437         directx_CFLAGS="${directx_CFLAGS} -I${with_directx}"
1438         AC_MSG_RESULT(yes)
1439       else
1440         AC_MSG_RESULT(no)
1441         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1442       fi
1443     fi
1444   fi
1445 fi
1446
1447 dnl
1448 dnl  Linux framebuffer module
1449 dnl
1450 AC_ARG_ENABLE(fb,
1451   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
1452     if test "x${enable_fb}" != "xno"
1453     then
1454       AC_CHECK_HEADERS(linux/fb.h, [
1455         PLUGINS="${PLUGINS} video_output/fb"
1456       ])
1457     fi
1458
1459 dnl
1460 dnl  Linux MGA module
1461 dnl
1462 AC_ARG_ENABLE(mga,
1463   [  --enable-mga            Linux kernel Matrox support (default disabled)],
1464   [ if test "x${enable_mga}" = "xyes"
1465     then
1466       PLUGINS="${PLUGINS} video_output/mga/mga video_output/mga/xmga"
1467     fi ])
1468
1469 dnl
1470 dnl  SVGAlib module
1471 dnl
1472 AC_ARG_ENABLE(svgalib,
1473   [  --enable-svgalib        SVGAlib support (default disabled)])
1474 if test "x${enable_svgalib}" = "xyes"
1475 then
1476   PLUGINS="${PLUGINS} video_output/svgalib"
1477   svgalib_LDFLAGS="${svgalib_LDFLAGS} -lvgagl -lvga"
1478 fi
1479
1480 dnl
1481 dnl  GGI module
1482 dnl
1483 AC_ARG_ENABLE(ggi,
1484   [  --enable-ggi            GGI support (default disabled)])
1485 if test "x${enable_ggi}" = "xyes"
1486 then
1487   PLUGINS="${PLUGINS} video_output/ggi"
1488   ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
1489   AC_ARG_WITH(ggi,
1490     [    --with-ggi=PATH       path to libggi],
1491     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
1492       then
1493         CFLAGS_GGI="${CFLAGS_GGI} -I${with_ggi}/include"
1494         ggi_LDFLAGS="${ggi_LDFLAGS} -L${with_ggi}/lib"
1495       fi ])
1496 fi
1497
1498 dnl
1499 dnl  Glide module
1500 dnl
1501 AC_ARG_ENABLE(glide,
1502   [  --enable-glide          Glide (3dfx) support (default disabled)])
1503 if test "x${enable_glide}" = "xyes"
1504 then
1505   PLUGINS="${PLUGINS} video_output/glide"
1506   glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
1507   glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
1508   AC_ARG_WITH(glide,
1509     [    --with-glide=PATH     path to libglide],
1510     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
1511       then
1512         glide_CFLAGS="${glide_CFLAGS} -I${with_glide}/include"
1513         glide_LDFLAGS="${glide_LDFLAGS} -L${with_glide}/lib"
1514       fi ])
1515 fi
1516
1517 dnl
1518 dnl  AA plugin
1519 dnl
1520 AC_ARG_ENABLE(aa,
1521   [  --enable-aa             aalib output (default disabled)])
1522 if test "x${enable_aa}" = "xyes"
1523 then
1524   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
1525   if test "x${have_aa}" = "xtrue"
1526   then
1527     PLUGINS="${PLUGINS} video_output/aa"
1528     aa_LDFLAGS="${aa_LDFLAGS} -laa"
1529   fi
1530 fi
1531
1532 dnl
1533 dnl  Audio plugins
1534 dnl
1535
1536 AC_ARG_WITH(,[Audio plugins:])
1537
1538 dnl
1539 dnl  OSS /dev/dsp module (enabled by default except on win32)
1540 dnl
1541 AC_ARG_ENABLE(oss,
1542   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
1543
1544 if test "x${enable_oss}" != "xno" &&
1545   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
1546 then
1547   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1548     PLUGINS="${PLUGINS} audio_output/oss"
1549     AC_CHECK_LIB(ossaudio,main,oss_LDFLAGS="${oss_LDFLAGS} -lossaudio")
1550   ])
1551 fi
1552
1553 dnl
1554 dnl  Esound module
1555 dnl
1556 AC_ARG_ENABLE(esd,
1557   [  --enable-esd            Esound library support (default disabled)],
1558   [if test "x${enable_esd}" = "xyes"
1559    then
1560      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1561      if test "x${ESD_CONFIG}" != "xno"
1562      then
1563        PLUGINS="${PLUGINS} audio_output/esd"
1564        esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
1565        esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
1566      fi
1567    fi])
1568
1569 dnl
1570 dnl  aRts module
1571 dnl
1572 AC_ARG_ENABLE(arts,
1573   [  --enable-arts           aRts sound server (default disabled)],
1574   [if test "x${enable_arts}" = "xyes"
1575    then
1576      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1577      if test "x${ARTS_CONFIG}" != "xno"
1578      then
1579        PLUGINS="${PLUGINS} audio_output/arts"
1580        arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
1581        arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
1582      fi
1583    fi])
1584
1585 dnl
1586 dnl  ALSA module
1587 dnl
1588 AC_ARG_ENABLE(alsa,
1589   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1590   [if test "x${enable_alsa}" = "xyes"
1591    then
1592      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1593      if test "x${have_alsa}" = "xtrue"
1594      then
1595        PLUGINS="${PLUGINS} audio_output/alsa"
1596        alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
1597      fi
1598    fi])
1599
1600 dnl
1601 dnl  win32 waveOut plugin
1602 dnl
1603 AC_ARG_ENABLE(waveout,
1604   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1605 if test "x${enable_waveout}" != "xno" -a "x${SYS}" = "xmingw32"
1606   then
1607     PLUGINS="${PLUGINS} audio_output/waveout"
1608     waveout_LDFLAGS="-lwinmm"
1609 fi
1610
1611 dnl
1612 dnl  Interface plugins
1613 dnl
1614
1615 AC_ARG_WITH(,[Interface plugins:])
1616
1617 dnl special case for BeOS
1618 if test "x${SYS}" = "xbeos"
1619 then
1620     PLUGINS="${PLUGINS} gui/beos/beos"
1621 fi
1622
1623 dnl
1624 dnl  Gtk+ module
1625 dnl
1626 AC_ARG_ENABLE(gtk,
1627   [  --enable-gtk            Gtk+ support (default enabled)])
1628 if test "x${enable_gtk}" != "xno"
1629 then
1630   GTK_PATH="${PATH}"
1631   AC_ARG_WITH(gtk-config-path,
1632     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1633     [ if test "x${with_gtk_config_path}" != "xno"
1634       then
1635         GTK_PATH="${with_gtk_config_path}:${PATH}"
1636       fi ])
1637   # look for gtk-config
1638   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1639   GTK_CONFIG=${GTK12_CONFIG}
1640   if test "x${GTK_CONFIG}" = "xno"
1641   then
1642     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1643   fi
1644   if test "x${GTK_CONFIG}" != "xno"
1645   then
1646     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1647     then
1648       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.])
1649     fi
1650     gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
1651     gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1652     # now look for the gtk.h header
1653     CPPFLAGS="${save_CPPFLAGS} ${gtk_CFLAGS}"
1654     ac_cv_gtk_headers=yes
1655     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1656       ac_cv_gtk_headers=no
1657       echo "Cannot find gtk development headers."
1658     ])
1659     if test "x${ac_cv_gtk_headers}" = "xyes"
1660     then
1661       PLUGINS="${PLUGINS} gui/gtk/gtk"
1662       NEED_GTK_MAIN=yes
1663       ALIASES="${ALIASES} gvlc"
1664     fi
1665     CPPFLAGS="${save_CPPFLAGS}"
1666   fi
1667 fi
1668
1669 dnl
1670 dnl  Familiar module uses Gtk+ library
1671 dnl
1672 AC_ARG_ENABLE(familiar,
1673   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
1674 if test "x${enable_familiar}" = "xyes"
1675 then
1676   GTK_PATH="${PATH}"
1677   AC_ARG_WITH(gtk-config-path,
1678     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1679     [ if test "x${with_gtk_config_path}" != "xno"
1680       then
1681         GTK_PATH="${with_gtk_config_path}:${PATH}"
1682       fi ])
1683   # look for gtk-config
1684   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1685   GTK_CONFIG=${GTK12_CONFIG}
1686   if test "x${GTK_CONFIG}" = "xno"
1687   then
1688     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1689   fi
1690   if test "x${GTK_CONFIG}" != "xno"
1691   then
1692     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1693     then
1694       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-familiar.])
1695     fi
1696     familiar_CFLAGS="${familiar_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
1697     familiar_LDFLAGS="${familiar_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1698     # now look for the gtk.h header
1699     CPPFLAGS="${save_CPPFLAGS} ${familiar_CFLAGS}"
1700     ac_cv_gtk_headers=yes
1701     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1702       ac_cv_gtk_headers=no
1703       echo "Cannot find gtk development headers."
1704     ])
1705     if test "x${ac_cv_gtk_headers}" = "xyes"
1706     then
1707       PLUGINS="${PLUGINS} gui/familiar/familiar"
1708       NEED_GTK_MAIN=yes
1709     fi
1710     CPPFLAGS="${save_CPPFLAGS}"
1711   fi
1712 fi
1713
1714 dnl
1715 dnl  Gnome module
1716 dnl
1717 AC_ARG_ENABLE(gnome,
1718   [  --enable-gnome          Gnome interface support (default disabled)],
1719   [if test "x${enable_gnome}" = "xyes"; then
1720     # look for gnome-config
1721     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1722     if test -x ${GNOME_CONFIG}
1723     then
1724        gnome_CFLAGS="${gnome_CFLAGS} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1725        gnome_LDFLAGS="${gnome_LDFLAGS} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1726     fi
1727     # now look for the gnome.h header
1728     CPPFLAGS="${save_CPPFLAGS} ${gnome_CFLAGS}"
1729     AC_CHECK_HEADERS(gnome.h, [
1730       PLUGINS="${PLUGINS} gui/gtk/gnome"
1731       NEED_GTK_MAIN=yes
1732       ALIASES="${ALIASES} gnome-vlc"
1733      ],[
1734       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1735 developement tools or remove the --enable-gnome option])
1736      ])
1737     CPPFLAGS="${save_CPPFLAGS}"
1738   fi])
1739
1740 dnl
1741 dnl  Qt module
1742 dnl
1743 AC_ARG_ENABLE(qt,
1744   [  --enable-qt             Qt interface support (default disabled)],
1745   [if test "x${enable_qt}" = "xyes"; then
1746      PLUGINS="${PLUGINS} gui/qt/qt"
1747      ALIASES="${ALIASES} qvlc"
1748      qt_LDFLAGS="${qt_LDFLAGS} -lqt -L${QTDIR}/lib"
1749      qt_CFLAGS="${qt_CFLAGS} -I/usr/include/qt -I${QTDIR}/include"
1750      if test -x ${QTDIR}/bin/moc
1751      then
1752        MOC=${QTDIR}/bin/moc
1753      else
1754        MOC=moc
1755      fi
1756    fi])
1757
1758 dnl 
1759 dnl  KDE module
1760 dnl
1761 AC_ARG_ENABLE(kde,
1762   [  --enable-kde            KDE interface support (default disabled)],
1763   [if test "x${enable_kde}" = "xyes"; then
1764      PLUGINS="${PLUGINS} gui/kde/kde"
1765      ALIASES="${ALIASES} kvlc"
1766      kde_LDFLAGS="${kde_LDFLAGS} -L${KDEDIR}/lib -lkfile"
1767      kde_CFLAGS="${kde_CFLAGS} -I/usr/include/kde -I/usr/include/qt"
1768      kde_CFLAGS="${kde_CFLAGS} -I${KDEDIR}/include -I${QTDIR}/include"
1769      if test -x ${QTDIR}/bin/moc
1770      then
1771        MOC=${QTDIR}/bin/moc
1772      else
1773        MOC=moc
1774      fi
1775    fi])
1776
1777 dnl
1778 dnl  Opie QT embedded module
1779 dnl
1780 AC_ARG_ENABLE(opie,
1781   [  --enable-opie           Qt embedded interface support (default disabled)],
1782   [if test "x${enable_opie}" = "xyes"; then
1783      AC_ARG_WITH(qte,
1784      [    --with-qte=PATH    Qt Embedded headers and libraries])
1785      if test "x${with_qte}" = "x"
1786      then
1787        test_LDFLAGS="-L$(QTDIR)/lib -lqte"
1788        test_CFLAGS="-I${QTDIR}/include -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1789      else
1790        test_LDFLAGS="-L${with_qte}/lib"
1791        test_CFLAGS="-I${with_qte}/include"
1792      fi
1793
1794      CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
1795      AC_CHECK_HEADERS(qt.h, [
1796        opie_CFLAGS="${opie_CFLAGS} ${test_CFLAGS}"
1797        opie_LDFLAGS="${opie_LDFLAGS} -lqpe ${test_LDFLAGS}"
1798        if test "x${with_qte}" = "x"
1799        then
1800          PLUGINS="${PLUGINS} gui/opie/opie"
1801        else
1802          BUILTINS="${BUILTINS} gui/opie/opie"
1803        fi
1804      ])
1805      CPPFLAGS="${save_CPPFLAGS}"
1806
1807      if test -x ${QTDIR}/bin/moc
1808      then
1809        MOC=${QTDIR}/bin/moc
1810      else
1811        MOC=moc
1812      fi
1813    fi])
1814
1815
1816 dnl
1817 dnl  MacOS X module
1818 dnl
1819 AC_ARG_ENABLE(macosx,
1820   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1821   [if test "x${enable_macosx}" = "xyes"
1822    then
1823      BUILTINS="${BUILTINS} gui/macosx/macosx"
1824      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1825    fi],
1826   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1827      BUILTINS="${BUILTINS} gui/macosx/macosx"
1828      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1829    )])
1830
1831 dnl
1832 dnl  QNX RTOS module
1833 dnl
1834 AC_ARG_ENABLE(qnx,
1835   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1836     if test "x${enable_qnx}" != "xno"
1837     then
1838       AC_CHECK_HEADERS(Ph.h, [
1839         PLUGINS="${PLUGINS} gui/qnx/qnx"
1840         qnx_LDFLAGS="${qnx_LDFLAGS} -lasound -lph"
1841       ])
1842     fi
1843
1844 dnl
1845 dnl  Windows native interface module, built with Borland C++ Builder
1846 dnl
1847 AC_ARG_ENABLE(intfwin,
1848 [  --enable-intfwin        Win32 interface support (default disabled)],
1849 [ if test "x${enable_intfwin}" != "xno"
1850   then
1851     AC_ARG_WITH(bcbuilder, 
1852     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1853     if test "x${with_bcbuilder}" != "x"
1854     then
1855       BCBUILDER="${with_bcbuilder}"
1856     fi
1857     PLUGINS="${PLUGINS} gui/win32/win32"
1858   fi ])
1859
1860 dnl
1861 dnl  ncurses module
1862 dnl
1863 AC_ARG_ENABLE(ncurses,
1864   [  --enable-ncurses        ncurses interface support (default disabled)],
1865   [if test "x${enable_ncurses}" = "xyes"; then
1866      PLUGINS="${PLUGINS} gui/ncurses/ncurses"
1867      ncurses_LDFLAGS="${ncurses_LDFLAGS} -lncurses"
1868    fi])
1869
1870 dnl
1871 dnl  XOSD plugin
1872 dnl
1873 AC_ARG_ENABLE(xosd,
1874   [  --enable-xosd           xosd interface support (default disabled)])
1875 if test "x${enable_xosd}" = "xyes"
1876 then
1877   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
1878   AC_TRY_COMPILE([#include <xosd.h>],
1879      [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
1880       AC_DEFINE(HAVE_OLD_XOSD_H, 1, Define if <xosd.h> is pre-1.0.0))
1881   if test "x${have_xosd}" = "xtrue"
1882   then
1883     PLUGINS="${PLUGINS} visualization/xosd/xosd"
1884     xosd_LDFLAGS="${xosd_LDFLAGS} -lxosd"
1885   fi
1886 fi
1887
1888 dnl
1889 dnl  Lirc plugin
1890 dnl
1891 AC_ARG_ENABLE(lirc,
1892   [  --enable-lirc           lirc support (default disabled)])
1893 if test "x${enable_lirc}" = "xyes"
1894 then
1895   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
1896   if test "x${have_lirc}" = "xtrue"
1897   then
1898     PLUGINS="${PLUGINS} control/lirc/lirc"
1899     lirc_LDFLAGS="${lirc_LDFLAGS} -llirc_client"
1900   fi
1901 fi
1902
1903 AC_ARG_WITH(,[Misc options:])
1904
1905 dnl
1906 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
1907 dnl
1908 dnl  We give the user the opportunity to specify
1909 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
1910 dnl
1911 AC_ARG_WITH(words,
1912   [  --with-words=endianness set endianness (big or little)])
1913   case "x${with_words}" in
1914     xbig)
1915       ac_cv_c_bigendian=yes
1916       ;;
1917     xlittle)
1918       ac_cv_c_bigendian=no
1919       ;;
1920     *)
1921       dnl  Try to guess endianness by matching patterns on a compiled
1922       dnl  binary, by looking for an ASCII or EBCDIC string
1923       AC_CACHE_CHECK([whether the byte order is big-endian],
1924         [ac_cv_c_bigendian],
1925         [ac_cv_c_bigendian="unknown"
1926         [cat >conftest.c <<EOF
1927         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
1928         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
1929         void _a(void) { char*s = (char*)am; s = (char *)ai; }
1930         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
1931         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
1932         void _e(void) { char*s = (char*)em; s = (char*)ei; }
1933         int main(void) { _a(); _e(); return 0; }
1934 EOF
1935         ]
1936         if test -f conftest.c
1937         then 
1938           if ${CC-cc} -c conftest.c -o conftest.o >config.log 2>&1 \
1939               && test -f conftest.o
1940           then
1941             if test "`strings conftest.o | grep BIGenDianSyS`"
1942             then
1943               ac_cv_c_bigendian="yes"
1944             fi
1945             if test "`strings conftest.o | grep LiTTleEnDian`"
1946             then
1947               ac_cv_c_bigendian="no"
1948             fi
1949           fi
1950         fi
1951       ])
1952       if test "x${ac_cv_c_bigendian}" = "xunknown"
1953       then
1954         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
1955       fi
1956       ;;
1957   esac
1958 dnl  Now we know what to use for endianness, just put it in the header
1959 if test "${ac_cv_c_bigendian}" = "yes"
1960 then
1961   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
1962 fi
1963
1964 dnl
1965 dnl  Profiling
1966 dnl
1967 PROFILING=0
1968
1969 GPROF=0
1970 AC_ARG_ENABLE(gprof,
1971 [  --enable-gprof          gprof profiling (default disabled)],
1972 [ if test "x${enable_gprof}" = "xyes"
1973   then
1974     GPROF=1
1975     PROFILING="gprof"
1976   fi
1977 ])
1978
1979 CPROF=0
1980 AC_ARG_ENABLE(cprof,
1981 [  --enable-cprof          cprof profiling (default disabled)],
1982 [ if test "x${enable_cprof}" = "xyes"
1983   then
1984     save_LDFLAGS="${save_LDFLAGS} -lcprof"; LDFLAGS="${save_LDFLAGS}"
1985     CPROF=1
1986     PROFILING="cprof"
1987   fi
1988 ])
1989
1990 dnl
1991 dnl  GNU portable threads
1992 dnl
1993 AC_ARG_ENABLE(pth,
1994   [  --enable-pth            GNU Pth support (default disabled)],
1995   [ if test "x${enable_pth}" = "xyes"; then
1996     AC_CHECK_LIB(pth,pth_init)
1997     AC_EGREP_HEADER(pth_init,pth.h,[
1998       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
1999                 Define if <pth.h> defines pth_init)
2000     THREAD_LIB="-lpth"
2001     fi])
2002 ])
2003
2004 dnl
2005 dnl  State Threads
2006 dnl
2007 AC_ARG_ENABLE(st,
2008   [  --enable-st             State Threads (default disabled)],
2009   [ if test "x${enable_st}" = "xyes"; then
2010     AC_CHECK_LIB(st,st_init)
2011     AC_EGREP_HEADER(st_init,st.h,[
2012       AC_DEFINE(ST_INIT_IN_ST_H, 1,
2013                 Define if <st.h> defines st_init)
2014     THREAD_LIB="-lst"
2015     fi])
2016 ])
2017
2018 vlc_LDFLAGS="${vlc_LDFLAGS} ${THREAD_LIB}"
2019 plugins_LDFLAGS="${plugins_LDFLAGS} ${THREAD_LIB}"
2020
2021 dnl
2022 dnl  Mozilla plugin
2023 dnl
2024 MOZILLA=0
2025 AC_ARG_ENABLE(mozilla,
2026   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2027 if test "x${enable_mozilla}" = "xyes"
2028 then
2029   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2030   if test "x${MOZILLA_CONFIG}" != "xno"
2031   then
2032     if test "x${SYS}" != "xmingw32"; then
2033       LDFLAGS="${save_LDFLAGS} -L${x_libraries}"
2034       AC_CHECK_LIB(Xt,XtStrings,[
2035         mozilla_LDFLAGS="${mozilla_LDFLAGS} -L${x_libraries} -lXt"
2036       ])
2037       LDFLAGS="${save_LDFLAGS}"
2038     fi
2039     MOZILLA=1
2040     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2041     [mozilla_CFLAGS="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2042     mozilla_LDFLAGS="${mozilla_LDFLAGS} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2043   fi
2044 fi
2045
2046 dnl
2047 dnl  gtk_main plugin
2048 dnl
2049 if test "x${NEED_GTK_MAIN}" != "xno"
2050 then
2051     PLUGINS="${PLUGINS} misc/gtk_main"
2052     gtk_main_CFLAGS="${gtk_main_CFLAGS} ${gtk_CFLAGS} ${familiar_CFLAGS} ${gnome_CFLAGS}"
2053     gtk_main_LDFLAGS="${gtk_main_LDFLAGS} ${gtk_LDFLAGS} ${familiar_LDFLAGS} ${gnome_LDFLAGS}"
2054 fi
2055
2056 dnl
2057 dnl  Plug-ins - this must be AT THE END
2058 dnl
2059 AC_ARG_ENABLE(plugins,
2060   [  --disable-plugins       make all plug-ins built-in (default plug-ins enabled)],
2061   [if test "x${enable_plugins}" = "xno"
2062    then
2063      BUILTINS="${BUILTINS} ${PLUGINS}"
2064      PLUGINS=
2065    fi])
2066
2067 dnl Automagically disable plug-ins if there is no system support for .so files
2068 dnl don't forget vlc-win32 still can load .so as plugins
2069 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2070 then
2071   echo "*** Your system doesn't have plug-in support. All plug-ins will be compiled"
2072   echo "as built-in"
2073   BUILTINS="${BUILTINS} ${PLUGINS}"
2074   PLUGINS=
2075 fi
2076
2077 dnl
2078 dnl  Stuff used by the program
2079 dnl
2080 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc ${VERSION} ${CODENAME} Copyright 1996-2002 VideoLAN", [Simple version string])
2081 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string])
2082 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2083
2084 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
2085 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2086 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2087
2088 DATA_PATH="${ac_tool_prefix}/share/videolan"
2089 AC_SUBST(DATA_PATH)
2090 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
2091 AC_SUBST(PLUGIN_PATH)
2092
2093 dnl
2094 dnl  Restore *FLAGS
2095 dnl
2096 CPPFLAGS="${save_CPPFLAGS}"
2097 CFLAGS="${save_CFLAGS}"
2098 LDFLAGS="${save_LDFLAGS}"
2099
2100 dnl
2101 dnl  Create the vlc-config script
2102 dnl
2103 libvlc_LDFLAGS="${vlc_LDFLAGS} ${builtins_LDFLAGS}"
2104 for i in `echo ${BUILTINS} | sed -e 's#[^ ]*/##g'` ; do libvlc_LDFLAGS="${libvlc_LDFLAGS} ${libdir}/vlc/${i}.a `eval echo '$'{${i}_LDFLAGS}`" ; done
2105 AC_SUBST(libvlc_LDFLAGS)
2106
2107 dnl 
2108 dnl  Configuration is finished
2109 dnl
2110 AC_SUBST(SYS)
2111 AC_SUBST(ARCH)
2112 AC_SUBST(PLUGINS)
2113 AC_SUBST(BUILTINS)
2114 AC_SUBST(ALIASES)
2115 AC_SUBST(DEBUG)
2116 AC_SUBST(ASM)
2117 AC_SUBST(CPROF)
2118 AC_SUBST(GPROF)
2119 AC_SUBST(OPTIMS)
2120 AC_SUBST(TUNING)
2121 AC_SUBST(RELEASE)
2122 AC_SUBST(MOC)
2123 AC_SUBST(WINDRES)
2124 AC_SUBST(BCBUILDER)
2125 AC_SUBST(NEED_GETOPT)
2126 AC_SUBST(MOZILLA)
2127
2128 AC_SUBST(CFLAGS_OPTIM)
2129 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2130 AC_SUBST(LDFLAGS)
2131
2132 AC_SUBST(vlc_CFLAGS)
2133 AC_SUBST(plugins_CFLAGS)
2134 AC_SUBST(builtins_CFLAGS)
2135 AC_SUBST(mozilla_CFLAGS)
2136
2137 AC_SUBST(a52tofloat32_CFLAGS)
2138 AC_SUBST(arts_CFLAGS)
2139 AC_SUBST(i420_yuy2_mmx_CFLAGS)
2140 AC_SUBST(dvd_CFLAGS)
2141 AC_SUBST(dvdread_CFLAGS)
2142 AC_SUBST(dvdplay_CFLAGS)
2143 AC_SUBST(ts_dvbpsi_CFLAGS)
2144 AC_SUBST(directx_CFLAGS)
2145 AC_SUBST(esd_CFLAGS)
2146 AC_SUBST(familiar_CFLAGS)
2147 AC_SUBST(faad_CFLAGS)
2148 AC_SUBST(ffmpeg_CFLAGS)
2149 AC_SUBST(glide_CFLAGS)
2150 AC_SUBST(gnome_CFLAGS)
2151 AC_SUBST(gtk_CFLAGS)
2152 AC_SUBST(gtk_main_CFLAGS)
2153 AC_SUBST(kde_CFLAGS)
2154 AC_SUBST(opie_CFLAGS)
2155 AC_SUBST(idctaltivec_CFLAGS)
2156 AC_SUBST(macosx_CFLAGS)
2157 AC_SUBST(mad_CFLAGS)
2158 AC_SUBST(memcpyaltivec_CFLAGS)
2159 AC_SUBST(motionaltivec_CFLAGS)
2160 AC_SUBST(qt_CFLAGS)
2161 AC_SUBST(qte_CFLAGS)
2162 AC_SUBST(sdl_CFLAGS)
2163 AC_SUBST(svgalib_CFLAGS)
2164 AC_SUBST(x11_CFLAGS)
2165 AC_SUBST(xvideo_CFLAGS)
2166
2167 AC_SUBST(vlc_LDFLAGS)
2168 AC_SUBST(plugins_LDFLAGS)
2169 AC_SUBST(builtins_LDFLAGS)
2170 AC_SUBST(mozilla_LDFLAGS)
2171
2172 AC_SUBST(a52tofloat32_LDFLAGS)
2173 AC_SUBST(aa_LDFLAGS)
2174 AC_SUBST(alsa_LDFLAGS)
2175 AC_SUBST(arts_LDFLAGS)
2176 AC_SUBST(beos_LDFLAGS)
2177 AC_SUBST(i420_rgb_LDFLAGS)
2178 AC_SUBST(directx_LDFLAGS)
2179 AC_SUBST(dv_LDFLAGS)
2180 AC_SUBST(dvd_LDFLAGS)
2181 AC_SUBST(dvdread_LDFLAGS)
2182 AC_SUBST(dvdplay_LDFLAGS)
2183 AC_SUBST(ts_dvbpsi_LDFLAGS)
2184 AC_SUBST(audio_LDFLAGS)
2185 AC_SUBST(esd_LDFLAGS)
2186 AC_SUBST(familiar_LDFLAGS)
2187 AC_SUBST(distort_LDFLAGS)
2188 AC_SUBST(faad_LDFLAGS)
2189 AC_SUBST(ffmpeg_LDFLAGS)
2190 AC_SUBST(mp4_LDFLAGS)
2191 AC_SUBST(ggi_LDFLAGS)
2192 AC_SUBST(glide_LDFLAGS)
2193 AC_SUBST(gnome_LDFLAGS)
2194 AC_SUBST(gtk_LDFLAGS)
2195 AC_SUBST(gtk_main_LDFLAGS)
2196 AC_SUBST(http_LDFLAGS)
2197 AC_SUBST(idctaltivec_LDFLAGS)
2198 AC_SUBST(imdct_LDFLAGS)
2199 AC_SUBST(imdct3dn_LDFLAGS)
2200 AC_SUBST(imdctsse_LDFLAGS)
2201 AC_SUBST(ipv4_LDFLAGS)
2202 AC_SUBST(ipv6_LDFLAGS)
2203 AC_SUBST(kde_LDFLAGS)
2204 AC_SUBST(lirc_LDFLAGS)
2205 AC_SUBST(macosx_LDFLAGS)
2206 AC_SUBST(mad_LDFLAGS)
2207 AC_SUBST(memcpyaltivec_LDFLAGS)
2208 AC_SUBST(motionaltivec_LDFLAGS)
2209 AC_SUBST(ncurses_LDFLAGS)
2210 AC_SUBST(opie_LDFLAGS)
2211 AC_SUBST(oss_LDFLAGS)
2212 AC_SUBST(qnx_LDFLAGS)
2213 AC_SUBST(qt_LDFLAGS)
2214 AC_SUBST(qte_LDFLAGS)
2215 AC_SUBST(rc_LDFLAGS)
2216 AC_SUBST(sdl_LDFLAGS)
2217 AC_SUBST(svgalib_LDFLAGS)
2218 AC_SUBST(vcd_LDFLAGS)
2219 AC_SUBST(vorbis_LDFLAGS)
2220 AC_SUBST(waveout_LDFLAGS)
2221 AC_SUBST(x11_LDFLAGS)
2222 AC_SUBST(xvideo_LDFLAGS)
2223 AC_SUBST(xosd_LDFLAGS)
2224 AC_SUBST(id3tag_LDFLAGS)
2225         
2226 AC_OUTPUT([
2227   Makefile
2228   Makefile.config
2229   Makefile.opts
2230   m4/Makefile
2231   intl/Makefile
2232   po/Makefile.in
2233   vlc-config
2234 ],[
2235   chmod a+x vlc-config
2236 ])
2237
2238 echo "
2239 vlc configuration
2240 --------------------
2241 vlc version           : ${VERSION}
2242 system                : ${SYS}
2243 architecture          : ${ARCH}
2244 optimizations         : ${OPTIMS}
2245 tuning                : ${TUNING}
2246 debug mode            : ${DEBUG}
2247 release               : ${RELEASE}
2248 profiling             : ${PROFILING}
2249 need builtin getopt   : ${NEED_GETOPT}
2250 modules               : (see Makefile.config)
2251 mozilla plugin        : ${MOZILLA}
2252 vlc aliases           :${ALIASES}
2253
2254 You may now tune Makefile.config and Makefile.opts at your convenience, for
2255 instance to choose which modules get compiled as plugins, or tune CFLAGS.
2256
2257 To build vlc and its plugins, type \`${VLC_MAKE}'.
2258 "
2259