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