* configure.in: Fixed detection of Qt-embedded.
[vlc.git] / 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"
451 #PLUGINS="${PLUGINS} codec/lpcm/lpcm"
452 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"
453 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"
454 PLUGINS="${PLUGINS} audio_filter/resampler/trivial audio_filter/resampler/ugly"
455 PLUGINS="${PLUGINS} audio_filter/channel_mixer/trivial"
456 PLUGINS="${PLUGINS} audio_mixer/float32 audio_mixer/trivial audio_mixer/spdif"
457 PLUGINS="${PLUGINS} audio_output/file"
458 #PLUGINS="${PLUGINS} visualization/scope/scope"
459 PLUGINS="${PLUGINS} video_chroma/i420_rgb video_chroma/i420_yuy2 video_chroma/i422_yuy2 video_chroma/i420_ymga"
460 PLUGINS="${PLUGINS} demux/util/id3"
461 dnl
462 dnl  Network modules
463 dnl
464 NETWORK_MODULES="access/udp access/http access/rtp misc/network/ipv4"
465
466 dnl
467 dnl  Accelerated modules
468 dnl
469 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"
470 MMXEXT_MODULES="misc/memcpy/memcpymmxext codec/mpeg_video/idct/idctmmxext codec/mpeg_video/motion/motionmmxext"
471 THREEDNOW_MODULES="misc/memcpy/memcpy3dn codec/a52old/imdct/imdct3dn codec/a52old/downmix/downmix3dn"
472 SSE_MODULES="codec/a52old/imdct/imdctsse codec/a52old/downmix/downmixsse"
473 ALTIVEC_MODULES="codec/mpeg_video/idct/idctaltivec codec/mpeg_video/motion/motionaltivec misc/memcpy/memcpyaltivec"
474
475 if test x$SYS != xbeos
476 then
477   PLUGINS="${PLUGINS} ${NETWORK_MODULES}"
478 fi
479
480 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
481     [ac_cv_mmx_inline],
482     [CFLAGS="${save_CFLAGS}"
483      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
484                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
485 if test "x${ac_cv_mmx_inline}" != "xno"; then
486   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
487 fi
488
489 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
490     [ac_cv_mmxext_inline],
491     [CFLAGS="${save_CFLAGS}"
492      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
493                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
494 if test "x${ac_cv_mmxext_inline}" != "xno"; then
495   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
496 fi
497
498 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
499     [ac_cv_3dnow_inline],
500     [CFLAGS="${save_CFLAGS}"
501      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
502                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
503 if test "x${ac_cv_3dnow_inline}" != "xno"; then
504   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
505   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
506 fi
507
508 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
509     [ac_cv_sse_inline],
510     [CFLAGS="${save_CFLAGS}"
511      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
512                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
513 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
514   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
515   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
516 fi
517
518 # don't try to grok AltiVec with native mingw32 it doesn't work right now
519 # we should be able to remove this test with future versions of mingw32
520 if test "x${SYS}" != "xmingw32"; then
521 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
522     [ac_cv_altivec_inline],
523     [CFLAGS="${save_CFLAGS}"
524      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
525          ac_cv_altivec_inline=yes,
526          [CFLAGS="${save_CFLAGS} -Wa,-m7400"
527           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
528             [ac_cv_altivec_inline="-Wa,-m7400"],
529             ac_cv_altivec_inline=no)
530          ])])
531 if test "x${ac_cv_altivec_inline}" != "xno"; then
532   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
533   if test "x${ac_cv_altivec_inline}" != "xyes"; then
534     idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_altivec_inline}"
535     motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_altivec_inline}"
536     memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_altivec_inline}"
537     vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_altivec_inline}"
538   fi
539   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
540 fi
541
542 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
543     [ac_cv_c_altivec],
544     [CFLAGS="${save_CFLAGS} -faltivec"
545      # Darwin test
546      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
547         ac_cv_c_altivec=-faltivec, [
548         # Linux/PPC test
549         CFLAGS="${save_CFLAGS} ${idctaltivec_CFLAGS} -fvec"
550         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
551             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
552         ])
553      CFLAGS="${save_CFLAGS}"])
554 if test "x${ac_cv_c_altivec}" != "xno"; then
555   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
556   idctaltivec_CFLAGS="${idctaltivec_CFLAGS} ${ac_cv_c_altivec}"
557   motionaltivec_CFLAGS="${motionaltivec_CFLAGS} ${ac_cv_c_altivec}"
558   memcpyaltivec_CFLAGS="${memcpyaltivec_CFLAGS} ${ac_cv_c_altivec}"
559   vlc_CFLAGS="${vlc_CFLAGS} ${ac_cv_c_altivec}"
560   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
561 fi
562
563 AC_CACHE_CHECK([if linker needs -framework vecLib],
564     [ac_cv_ld_altivec],
565     [LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
566      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
567      LDFLAGS="${save_LDFLAGS}"
568     ])
569 if test "x${ac_cv_ld_altivec}" != "xno"; then
570   idctaltivec_LDFLAGS="${idctaltivec_LDFLAGS} -framework vecLib"
571   motionaltivec_LDFLAGS="${motionaltivec_LDFLAGS} -framework vecLib"
572   memcpyaltivec_LDFLAGS="${memcpyaltivec_LDFLAGS} -framework vecLib"
573   vlc_LDFLAGS="${vlc_LDFLAGS} -framework vecLib"
574 fi
575 fi # end if mingw32
576
577
578 AC_ARG_WITH(,[])
579 AC_ARG_WITH(,[Optimization options:])
580
581 dnl
582 dnl  Special arch tuning
583 dnl
584 AC_ARG_WITH(tuning,
585 [  --with-tuning=ARCH      enable special tuning for an architecture
586                           (default i686 on IA-32 and 750 on PPC)])
587 if test "x${with_tuning}" != "x"; then
588     TUNING="${with_tuning}"
589 else
590     if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xi486" -o "x${target_cpu}" = "xi386"; then TUNING="pentiumpro"
591     else
592         if test "x${target_cpu}" = "xpowerpc"; then TUNING="750"; fi
593     fi
594 fi
595
596 dnl
597 dnl  x86 accelerations
598 dnl
599 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
600 then
601     ARCH="${ARCH} mmx"
602     PLUGINS="${PLUGINS} ${ACCEL_MODULES}"
603 fi
604
605 dnl
606 dnl  Enable/disable optimizations
607 dnl
608 AC_ARG_ENABLE(optimizations,
609 [  --disable-optimizations disable compiler optimizations (default enabled)],
610 [ if test "x${enable_optimizations}" = "xno"; then OPTIMS=0; fi ],
611 [ OPTIMS=1 ])
612
613 dnl
614 dnl  AltiVec acceleration
615 dnl
616 AC_ARG_ENABLE(altivec,
617 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
618 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
619     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
620 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
621     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
622
623 dnl
624 dnl  Debugging mode
625 dnl
626 DEBUG=0
627 AC_ARG_ENABLE(debug,
628 [  --enable-debug          debug mode (default disabled)],
629 [ if test "x${enable_debug}" = "xyes"; then DEBUG=1; fi ])
630
631 dnl
632 dnl  Enable release-specific flags
633 dnl
634 RELEASE=0
635 AC_ARG_ENABLE(release,
636 [  --enable-release        activate extra optimizations (default disabled)],
637 [ if test "x${enable_release}" = "xyes"; then RELEASE=1; fi ],
638 [ VERSION="${VERSION}_`date +%Y-%m-%d`" ])
639
640 dnl
641 dnl  Input plugins
642 dnl
643
644 AC_ARG_WITH(,[Input plugins:])
645
646 dnl
647 dnl  DVD module: optionally check for installed libdvdcss
648 dnl
649 AC_ARG_ENABLE(dvd,
650 [  --enable-dvd            DVD input module (default enabled)])
651 if test "x${enable_dvd}" != "xno"
652 then
653   AC_ARG_WITH(dvdcss, 
654   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
655   AC_ARG_WITH(dvdcss-tree, 
656   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
657   case "x${with_dvdcss}" in
658   x|xyes)
659     if test "x${with_dvdcss_tree}" = x
660     then
661       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
662         [ PLUGINS="${PLUGINS} access/dvd/dvd"
663           dvd_LDFLAGS="${dvd_LDFLAGS} -ldvdcss" ],
664         [ 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.])
665           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
666     else
667       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
668       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
669       if test "x${real_dvdcss_tree}" = "x"
670       then
671         dnl  The given directory can't be found
672         AC_MSG_RESULT(no)
673         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
674       fi
675       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
676       then
677         dnl  Use a custom libdvdcss
678         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
679         BUILTINS="${BUILTINS} access/dvd/dvd"
680         dvd_LDFLAGS="${dvd_LDFLAGS} ${real_dvdcss_tree}/src/.libs/libdvdcss.a"
681         dvd_CFLAGS="${dvd_CFLAGS} -I${real_dvdcss_tree}/src"
682       else
683         dnl  The given libdvdcss wasn't built
684         AC_MSG_RESULT(no)
685         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
686       fi
687     fi
688   ;;
689   xno)
690     dnl  Compile without dvdcss (dlopen version, works only under Linux)
691     PLUGINS="${PLUGINS} access/dvd/dvd"
692     dvd_CFLAGS="${dvd_CFLAGS} -DGOD_DAMN_DMCA"
693     dvd_LDFLAGS="${dvd_LDFLAGS} -ldl"
694   ;;
695   *)
696     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
697     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
698     then
699       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
700       AC_MSG_RESULT(yes)
701       PLUGINS="${PLUGINS} access/dvd/dvd"
702       dvd_LDFLAGS="${dvd_LDFLAGS} -L${with_dvdcss}/lib -ldvdcss"
703       dvd_CFLAGS="${dvd_CFLAGS} -I${with_dvdcss}/include"
704     else
705       dnl  No libdvdcss could be found, sorry
706       AC_MSG_RESULT(no)
707       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
708     fi
709   ;;
710   esac
711 fi
712
713 dnl
714 dnl dvdread module: check for libdvdread plugin
715 dnl
716 AC_ARG_ENABLE(dvdread,
717 [  --enable-dvdread        dvdread input module (default disabled)])
718 if test "x${enable_dvdread}" != "xno"
719 then
720   AC_ARG_WITH(dvdread, 
721   [    --with-dvdread=PATH   libdvdread headers and libraries])
722   if test "x${with_dvdread}" = "x"
723   then
724     test_LDFLAGS=""
725     test_CFLAGS=""
726   else
727     test_LDFLAGS="-L${with_dvdread}/lib"
728     test_CFLAGS="-I${with_dvdread}/include"
729   fi
730   CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
731   AC_CHECK_HEADERS(dvdread/dvd_reader.h, [
732      AC_TRY_COMPILE([#include <dvdread/dvd_reader.h>],
733         [int foo() { return DVD_VIDEO_LB_LEN; }],[
734           PLUGINS="${PLUGINS} access/dvdread/dvdread"
735           dvdread_LDFLAGS="${dvdread_LDFLAGS} ${test_LDFLAGS} -ldvdread"
736           dvdread_CFLAGS="${dvdread_CFLAGS} ${test_CFLAGS}"
737         ],[
738           if test "x${enable_dvdread}" != "x"
739           then
740             AC_MSG_ERROR([Cannot find DVD_VIDEO_LB_LEN in dvdread/dvd_reader.h, please install libdvdread version 0.9.2 or later])
741           fi
742         ])
743   ],[
744     if test "x${enable_dvdread}" != "x"
745     then
746       if test "x${with_dvdread}" != "x"
747       then
748         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h in ${with_dvdread}/include])
749       else
750         AC_MSG_ERROR([Cannot find dvdread/dvd_reader.h])
751       fi
752     fi
753   ])
754   CPPFLAGS="$save_CPPFLAGS"
755 fi
756
757 dnl
758 dnl dvdplay module: check for libdvdplay
759 dnl
760 AC_ARG_ENABLE(dvdplay,
761 [  --enable-dvdplay        dvdplay input module (default disabled)])
762 if test "x$enable_dvdplay" != "xno"
763 then
764   AC_ARG_WITH(dvdplay, 
765   [    --with-dvdplay=PATH   libdvdplay headers and libraries])
766   if test "x$with_dvdplay" = x
767   then
768     test_LDFLAGS=""
769     test_CFLAGS=""
770   else
771     test_LDFLAGS="-L${with_dvdplay}/lib"
772     test_CFLAGS="-I${with_dvdplay}/include"
773   fi
774   CPPFLAGS="$save_CPPFLAGS $test_CFLAGS"
775   AC_CHECK_HEADERS(dvdplay/dvdplay.h, [
776       PLUGINS="${PLUGINS} access/dvdplay/dvdplay"
777       dvdplay_LDFLAGS="${dvdplay_LDFLAGS} ${test_LDFLAGS} -ldvdplay -ldvdread"
778       dvdplay_CFLAGS="${dvdplay_CFLAGS} ${test_CFLAGS}"
779     ],[
780     if test "x$enable_dvdplay" != x
781     then
782       if test "x$with_dvdplay" != x
783       then
784         AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h in ${with_dvdplay}/include])
785       else
786         AC_MSG_ERROR([Cannot find dvdplay/dvdplay.h])
787       fi
788     fi
789   ])
790   CPPFLAGS="${save_CPPFLAGS}"
791 fi
792
793
794 dnl
795 dnl  libdvbpsi ts demux
796 dnl
797 AC_ARG_ENABLE(dvbpsi,
798 [  --enable-dvbpsi        dvbpsi ts demux module (default disabled)])
799 if test "x${enable_dvbpsi}" != "xno"
800 then
801   AC_ARG_WITH(dvbpsi, 
802   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
803   AC_ARG_WITH(dvbpsi,
804   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
805   case "x${with_dvbpsi}" in
806   x|xyes)
807     if test "x${with_dvbpsi_tree}" = "x"
808     then
809       AC_CHECK_HEADERS(dvbpsi/dr.h,
810         [ PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
811           ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} -ldvbpsi" ], [],
812         [  AC_MSG_ERROR([cannot find libdvbpsi headers]) ])
813     else
814       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
815       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
816       if test "x${real_dvbpsi_tree}" = "x"
817       then
818         dnl  The given directory can't be found
819         AC_MSG_RESULT(no)
820         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
821       fi
822       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
823       then
824         dnl  Use a custom libdvbpsi
825         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
826         BUILTINS="${BUILTINS} demux/mpeg/ts_dvbpsi"
827         ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
828         ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} -I${real_dvbpsi_tree}/src"
829       else
830         dnl  The given libdvbpsi wasn't built
831         AC_MSG_RESULT(no)
832         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
833       fi
834     fi
835   ;;
836   xno)
837     dnl  Compile without dvbpsi
838   ;;
839   *)
840     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
841     if test "x${with_dvbpsi}" = "x"
842     then
843       test_LDFLAGS=""
844       test_CFLAGS=""
845     else
846       test_LDFLAGS="-L${with_dvbpsi}/lib"
847       test_CFLAGS="-I${with_dvbpsi}/include"
848     fi
849     CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
850     AC_CHECK_HEADER([dvbpsi/dr.h],[
851       PLUGINS="${PLUGINS} demux/mpeg/ts_dvbpsi"
852       ts_dvbpsi_LDFLAGS="${ts_dvbpsi_LDFLAGS} ${test_LDFLAGS} -ldvbpsi"
853       ts_dvbpsi_CFLAGS="${ts_dvbpsi_CFLAGS} ${test_CFLAGS}"
854       ],[
855       if test "x${enable_dvbpsi}" != "x"
856       then
857         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])
858       fi
859     ])
860     CPPFLAGS="${save_CPPFLAGS}"
861   ;;
862   esac
863 fi
864
865 dnl
866 dnl  Video4Linux plugin
867 dnl
868 AC_ARG_ENABLE(v4l,
869   [  --enable-v4l            Video4Linux input support (default disabled)])
870 if test "x${enable_v4l}" = "xyes"
871 then
872   AC_CHECK_HEADERS(libv4l/v4l.h, [
873     PLUGINS="${PLUGINS} access/v4l/v4l"
874    ],[])
875 fi
876
877 dnl
878 dnl  VCD module
879 dnl
880 AC_ARG_ENABLE(vcd,
881   [  --enable-vcd            VCD support for Linux, FreeBSD and MacOS X (default enabled)])
882
883 if test "x${enable_vcd}" != "xno"
884 then
885   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
886     PLUGINS="${PLUGINS} access/vcd/vcd"
887   ])
888   
889   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
890     PLUGINS="${PLUGINS} access/vcd/vcd"
891     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
892   ])
893   
894   if test "x${SYS}" = "xbsdi"
895   then
896     PLUGINS="${PLUGINS} access/vcd/vcd"
897   fi
898
899   if test "x${SYS}" = "xdarwin"
900   then
901     # No need to add vcd to PLUGINS, Darwin is already based on FreeBSD
902     vcd_LDFLAGS="${vcd_LDFLAGS} -framework IOKit -framework CoreFoundation" 
903   fi
904 fi
905
906 dnl
907 dnl  Satellite input module
908 dnl
909 AC_ARG_ENABLE(satellite,
910   [  --enable-satellite      satellite card support (default disabled)],
911   [ if test "x${enable_satellite}" = "xyes"
912     then
913       PLUGINS="${PLUGINS} access/satellite/satellite"
914     fi])
915
916 dnl
917 dnl  ipv6 plugin - not for QNX yet
918 dnl
919 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
920 then
921   have_ipv6=0
922   AC_CHECK_FUNC(inet_pton,[have_ipv6=1],[
923     AC_CHECK_LIB(resolv,inet_pton,
924       [have_ipv6=1
925        ipv6_LDFLAGS="${ipv6_LDFLAGS} -lresolv"])
926   ])
927   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
928   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
929     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=0])
930   if test x$have_ipv6 = x1; then
931     PLUGINS="${PLUGINS} misc/network/ipv6"
932   fi
933 fi
934 if test "x${SYS}" = "xmingw32"
935 then
936   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
937   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
938     PLUGINS="${PLUGINS} misc/network/ipv6"],[AC_MSG_RESULT(no)])
939 fi
940
941 dnl
942 dnl  AVI demux plugin
943 dnl
944 AC_ARG_ENABLE(avi,
945   [  --enable-avi            AVI demux module (default enabled)])
946 if test "x${enable_avi}" != "xno"
947 then
948   PLUGINS="${PLUGINS} demux/avi/avi"
949 fi
950
951 dnl
952 dnl  AAC demux plugin
953 dnl
954 AC_ARG_ENABLE(aac,
955   [  --enable-aac            AAC demux module (default enabled)])
956 if test "x${enable_aac}" != "xno"
957 then
958   PLUGINS="${PLUGINS} demux/aac/aac"
959 fi
960
961 dnl
962 dnl  Codec plugins
963 dnl
964
965 AC_ARG_WITH(,[Codec plugins:])
966
967 dnl
968 dnl  mad plugin
969 dnl
970 AC_ARG_ENABLE(mad,
971   [  --enable-mad            libmad module (default disabled)])
972 if test "x${enable_mad}" = "xyes"
973 then
974   AC_ARG_WITH(mad,
975     [    --with-mad=PATH       path to libmad],[],[])
976   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
977   then
978     mad_CFLAGS="${mad_CFLAGS} -I${with_mad}/include"
979     mad_LDFLAGS="${mad_LDFLAGS} -L${with_mad}/lib"
980   fi
981
982   AC_ARG_WITH(mad-tree,
983     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
984   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
985   then
986     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
987     if test "x${real_mad_tree}" = "x"
988     then
989       dnl  The given directory can't be found
990       AC_MSG_RESULT(no)
991       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
992     fi
993     dnl  Use a custom libmad
994     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
995     if test -f ${real_mad_tree}/libmad/mad.h
996     then
997       AC_MSG_RESULT(yes)
998       mad_CFLAGS="${mad_CFLAGS} -I${real_mad_tree}/libmad"
999       mad_LDFLAGS="${mad_LDFLAGS} -L${real_mad_tree}/libmad/.libs"
1000       LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
1001       AC_CHECK_LIB(mad, mad_bit_init, [
1002         BUILTINS="${BUILTINS} codec/mad/mad"
1003         mad_LDFLAGS="${mad_LDFLAGS} -lmad"
1004         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1005       ],[])
1006       LDFLAGS="${save_LDFLAGS}"
1007     else
1008       AC_MSG_RESULT(no)
1009       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1010     fi
1011   else
1012     CFLAGS="${save_CFLAGS} ${mad_CFLAGS}"
1013     LDFLAGS="${save_LDFLAGS} ${mad_LDFLAGS}"
1014     AC_CHECK_HEADERS(mad.h, ,
1015       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1016     AC_CHECK_LIB(mad, mad_bit_init, [
1017       PLUGINS="${PLUGINS} codec/mad/mad"
1018       mad_LDFLAGS="${mad_LDFLAGS} -lmad" ],
1019       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1020     CFLAGS="${save_CFLAGS}"
1021     LDFLAGS="${save_LDFLAGS}"
1022   fi
1023 fi
1024
1025 dnl
1026 dnl   libid3tag support
1027 dnl
1028 AC_CHECK_HEADERS(id3tag.h, [
1029   id3tag_LDFLAGS="${id3tag_LDFLAGS} -lz -lid3tag"
1030   PLUGINS="${PLUGINS} demux/util/id3tag"])
1031    
1032 dnl
1033 dnl  ffmpeg decoder plugin
1034 dnl
1035 AC_ARG_ENABLE(ffmpeg,
1036 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1037 if test "x${enable_ffmpeg}" = "xyes"
1038 then
1039   AC_ARG_WITH(ffmpeg,
1040     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1041   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1042   then
1043     ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${with_ffmpeg}/include/libffmpeg"
1044     ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -L${with_ffmpeg}/lib"
1045   fi
1046
1047   dnl Add postprocessing modules
1048   PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_c"
1049   if test "x${ac_cv_mmx_inline}" != "xno"; then
1050     PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmx"
1051   fi
1052
1053   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1054     PLUGINS="${PLUGINS} codec/ffmpeg/postprocessing/postprocessing_mmxext"
1055   fi
1056
1057
1058   AC_ARG_WITH(ffmpeg-tree, 
1059   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1060   if test "x${with_ffmpeg_tree}" != "x"
1061   then
1062     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1063     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1064     if test "x${real_ffmpeg_tree}" = x
1065     then
1066       dnl  The given directory can't be found
1067       AC_MSG_RESULT(no)
1068       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1069     fi
1070     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1071     then
1072       dnl  Use a custom libffmpeg
1073       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1074       BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1075       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} ${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1076       ffmpeg_CFLAGS="${ffmpeg_CFLAGS} -I${real_ffmpeg_tree}/libavcodec"
1077     else
1078       dnl  The given libavcodec wasn't built
1079       AC_MSG_RESULT(no)
1080       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1081     fi
1082   else
1083     CFLAGS="${save_CFLAGS} ${ffmpeg_CFLAGS}"
1084     LDFLAGS="${save_LDFLAGS} ${ffmpeg_LDFLAGS}"
1085     AC_CHECK_LIB(avcodec, avcodec_init, [
1086       BUILTINS="${BUILTINS} codec/ffmpeg/ffmpeg"
1087       ffmpeg_LDFLAGS="${ffmpeg_LDFLAGS} -lavcodec" ],
1088       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1089     LDFLAGS="${save_LDFLAGS}"
1090     CFLAGS="${save_CFLAGS}"
1091   fi
1092 fi
1093
1094 dnl
1095 dnl  faad decoder plugin
1096 dnl
1097 AC_ARG_ENABLE(faad,
1098 [  --enable-faad           faad codec (default disabled)])
1099 if test "x${enable_faad}" = "xyes"
1100 then
1101   AC_ARG_WITH(faad,
1102     [    --with-faad=PATH      path to faad installation],[],[])
1103   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1104   then
1105     faad_CFLAGS="${faad_CFLAGS} -I${with_faad}/include"
1106     faad_LDFLAGS="${faad_LDFLAGS} -L${with_faad}/lib"
1107   fi
1108   faad_LDFLAGS="${faad_LDFLAGS}"
1109
1110   AC_ARG_WITH(faad-tree, 
1111   [    --with-faad-tree=PATH faad tree for static linking])
1112   if test "x${with_faad_tree}" != "x"
1113   then
1114     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1115     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1116     if test "x${real_faad_tree}" = x
1117     then
1118       dnl  The given directory can't be found
1119       AC_MSG_RESULT(no)
1120       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1121     fi
1122     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1123     then
1124       dnl  Use a custom faad
1125       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1126       BUILTINS="${BUILTINS} codec/faad/faad"
1127       faad_LDFLAGS="${faad_LDFLAGS} ${real_faad_tree}/libfaad/.libs/libfaad.a"
1128       faad_CFLAGS="${faad_CFLAGS} -I${real_faad_tree}/include"
1129     else
1130       dnl  The given libfaad wasn't built
1131       AC_MSG_RESULT(no)
1132       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1133     fi
1134   else
1135     CFLAGS="${save_CFLAGS} ${faad_CFLAGS}"
1136     LDFLAGS="${save_LDFLAGS} ${faad_LDFLAGS}"
1137     AC_CHECK_HEADERS(faad.h, ,
1138       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1139     AC_CHECK_LIB(faad, faacDecOpen, [
1140       PLUGINS="${PLUGINS} codec/faad/faad"
1141       faad_LDFLAGS="${faad_LDFLAGS} -lfaad" ],
1142       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1143     LDFLAGS="${save_LDFLAGS}"
1144     CFLAGS="${save_CFLAGS}"
1145   fi
1146 fi
1147
1148
1149
1150 dnl 
1151 dnl MP4 module 
1152 dnl 
1153 AC_ARG_ENABLE(mp4,
1154   [  --enable-mp4            MP4 demux module (default enabled)])
1155 if test "x${enable_mp4}" != "xno"
1156 then
1157
1158     PLUGINS="${PLUGINS} demux/mp4/mp4"
1159     AC_CHECK_HEADERS(zlib.h,
1160               [ mp4_LDFLAGS="${mp4_LDFLAGS} -lz" ] )
1161 fi
1162
1163 dnl
1164 dnl  a52 AC3 decoder plugin
1165 dnl
1166 AC_ARG_ENABLE(a52,
1167   [  --enable-a52            A/52 support with liba52 (default enabled)])
1168 if test "x${enable_a52}" != "xno"
1169 then
1170   AC_ARG_WITH(a52, 
1171     [    --with-a52=PATH       a52 headers and libraries])
1172   AC_ARG_WITH(a52-tree,
1173     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1174   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1175   then
1176     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1177     if test "x${real_a52_tree}" = "x"
1178     then
1179       dnl  The given directory can't be found
1180       AC_MSG_RESULT(no)
1181       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1182     fi
1183     dnl  Use a custom a52dec
1184     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1185     if test -f ${real_a52_tree}/include/a52.h
1186     then
1187       AC_MSG_RESULT(yes)
1188       a52tofloat32_CFLAGS="${a52tofloat32_CFLAGS} -I${real_a52_tree}"
1189       a52tofloat32_LDFLAGS="${a52tofloat32_LDFLAGS} -L${real_a52_tree}/liba52/.libs"
1190       LDFLAGS="${save_LDFLAGS} ${a52tofloat32_LDFLAGS}"
1191       AC_CHECK_LIB(a52, a52_free, [
1192         BUILTINS="${BUILTINS} audio_filter/converter/a52tofloat32"
1193         a52tofloat32_LDFLAGS="${a52tofloat32_LDFLAGS} -la52 -lm"
1194         a52tofloat32_CFLAGS="${a52tofloat32_CFLAGS} -DUSE_A52DEC_TREE"
1195         ],[
1196         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1197         then
1198           AC_MSG_ERROR([make sure you have at least a52dec-0.7.4])
1199         else
1200           AC_MSG_ERROR([the specified tree hasn't been compiled])
1201         fi
1202       ],[-lm])
1203       LDFLAGS="${save_LDFLAGS}"
1204     else
1205       AC_MSG_RESULT(no)
1206       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1207     fi
1208   else
1209     if test "x${with_a52}" = "x"
1210     then
1211       test_LDFLAGS=""
1212       test_CFLAGS=""
1213     else
1214       test_LDFLAGS="-L${with_a52}/lib"
1215       test_CFLAGS="-I${with_a52}/include"
1216     fi
1217     save_CPPFLAGS="${CPPFLAGS}"
1218     save_LDFLAGS="${LDFLAGS}"
1219     CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
1220     LDFLAGS="${save_LDFLAGS} ${test_LDFLAGS}"
1221     AC_CHECK_HEADERS(a52dec/a52.h, [
1222       AC_CHECK_LIB(a52, a52_free, [
1223         BUILTINS="${BUILTINS} audio_filter/converter/a52tofloat32"
1224         a52tofloat32_LDFLAGS="${a52tofloat32_LDFLAGS} ${test_LDFLAGS} -la52 -lm"
1225         a52tofloat32_CFLAGS="${a52tofloat32_CFLAGS} ${test_CFLAGS}"
1226       ],[
1227         if test "x${enable_dvbpsi}" != "x"
1228         then
1229           AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net])
1230         fi
1231       ],[-lm])
1232     ])
1233     CPPFLAGS="${save_CPPFLAGS}"
1234     LDFLAGS="${save_LDFLAGS}"
1235   fi
1236 fi
1237
1238 dnl
1239 dnl  cinepak plugin
1240 dnl
1241 AC_ARG_ENABLE(cinepak,
1242   [  --enable-cinepak        Cinepak decoder (default enabled)])
1243 if test "x${enable_cinepak}" != "xno"
1244 then
1245   PLUGINS="${PLUGINS} codec/cinepak/cinepak"
1246 fi
1247
1248 dnl
1249 dnl  ogg vorbis plugin
1250 dnl
1251 AC_ARG_ENABLE(vorbis,
1252   [  --enable-vorbis         Ogg/Vorbis decoder support (default enabled)])
1253 if test "x${enable_vorbis}" != "xno"
1254 then
1255   AC_CHECK_HEADERS(ogg/ogg.h, [
1256     dnl disabled for the moment
1257     #PLUGINS="${PLUGINS} demux/ogg/ogg codec/vorbis/vorbis"
1258     vorbis_LDFLAGS="${vorbis_LDFLAGS} -lvorbis"
1259    ],[])
1260 fi
1261
1262 dnl
1263 dnl  DV plugin
1264 dnl 
1265 AC_ARG_ENABLE(dv,
1266   [  --enable-dv             DV decoder support (default disabled)])
1267 if test "x${enable_dv}" = "xyes"
1268 then
1269   AC_CHECK_HEADERS(libdv/dv.h, [
1270     PLUGINS="${PLUGINS} codec/dv/dv"
1271     dv_LDFLAGS="${dv_LDFLAGS} -ldv"
1272    ],[])
1273 fi  
1274
1275 dnl
1276 dnl  Video plugins
1277 dnl
1278
1279 AC_ARG_WITH(,[Video plugins:])
1280
1281 dnl
1282 dnl  X11 module
1283 dnl  (enabled by default except on win32)
1284 dnl
1285 AC_ARG_ENABLE(x11,
1286   [  --enable-x11            X11 support (default enabled)])
1287 if test "x${enable_x11}" != "xno" &&
1288   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1289   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1290   AC_CHECK_HEADERS(X11/Xlib.h, [
1291     PLUGINS="${PLUGINS} video_output/x11/x11"
1292     x11_LDFLAGS="${x11_LDFLAGS} -L${x_libraries} -lX11 -lXext"
1293     x11_CFLAGS="${x11_CFLAGS} -I${x_includes}"
1294   ])
1295   CPPFLAGS="${save_CPPFLAGS}"
1296 fi
1297
1298 dnl
1299 dnl  XVideo module
1300 dnl  (enabled by default except on win32)
1301 dnl
1302 AC_ARG_ENABLE(xvideo,
1303   [  --enable-xvideo         XVideo support (default enabled)])
1304 if test "x${enable_xvideo}" != "xno" &&
1305   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1306   CPPFLAGS="${save_CPPFLAGS} -I${x_includes}"
1307   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1308     CFLAGS="${save_CFLAGS} -L${x_libraries} -lX11 -lXext"
1309     AC_CHECK_LIB(Xv_pic,XvPutImage,
1310       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1311       PLUGINS="${PLUGINS} video_output/x11/xvideo"
1312       xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv_pic"
1313       xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1314       AC_CHECK_LIB(Xv,XvPutImage,
1315         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1316         PLUGINS="${PLUGINS} video_output/x11/xvideo"
1317         xvideo_LDFLAGS="${xvideo_LDFLAGS} -L${x_libraries} -lX11 -lXext -lXv"
1318         xvideo_CFLAGS="${xvideo_CFLAGS} -I${x_includes}",
1319         # Otherwise... well, do nothing.
1320         :
1321       )
1322     )
1323     CFLAGS="${save_CFLAGS}"
1324   ]
1325   CPPFLAGS="${save_CPPFLAGS}")
1326 fi
1327
1328 dnl
1329 dnl  SDL module
1330 dnl
1331 AC_ARG_ENABLE(sdl,
1332   [  --enable-sdl            SDL support (default enabled)])
1333 if test "x${enable_sdl}" != "xno"
1334 then
1335   SDL_PATH="${PATH}"
1336   AC_ARG_WITH(sdl-config-path,
1337     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1338     [ if test "x${with_sdl_config_path}" != "xno"
1339       then
1340         SDL_PATH="${with_sdl_config_path}:${PATH}"
1341       fi ])
1342   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1343   SDL_CONFIG="${SDL12_CONFIG}"
1344   SDL_HEADER="SDL12/SDL.h"
1345   if test "x${SDL_CONFIG}" = "xno"
1346   then
1347     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1348     SDL_CONFIG=${SDL11_CONFIG}
1349     SDL_HEADER="SDL11/SDL.h"
1350   fi
1351   if test "x${SDL_CONFIG}" = "xno"
1352   then
1353     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1354     SDL_HEADER="SDL/SDL.h"
1355   fi
1356   if test "x${SDL_CONFIG}" != "xno"
1357   then
1358     PLUGINS="${PLUGINS} video_output/sdl audio_output/sdl"
1359     sdl_CFLAGS="${sdl_CFLAGS} `${SDL_CONFIG} --cflags`"
1360     sdl_LDFLAGS="${sdl_LDFLAGS} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
1361     CPPFLAGS="${save_CPPFLAGS} ${sdl_CFLAGS}"
1362     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1363       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1364       [ AC_MSG_ERROR([The development package for SDL is not installed. 
1365 Please install it and try again. Alternatively you can also configure with 
1366 --disable-sdl.])
1367       ])
1368     CPPFLAGS="${save_CPPFLAGS}"
1369     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1370     then
1371       AC_MSG_ERROR([The development package for SDL is not installed.
1372 Please install it and try again. Alternatively you can also configure with
1373 --disable-sdl.])
1374     fi
1375   elif test "x${enable_sdl}" =  "xyes"
1376   then
1377     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1378 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1379     ])
1380   fi
1381 fi
1382
1383 dnl
1384 dnl  Qt Embedded module
1385 dnl  (disabled by default)
1386 dnl
1387 AC_ARG_ENABLE(qte,
1388   [  --enable-qte            QT Embedded support (default disabled)])
1389 if test "x${enable_qte}" != "xno"
1390 then
1391   AC_ARG_WITH(qte,
1392   [    --with-qte=PATH    Qt Embedded headers and libraries])
1393   if test "x${with_qte}" = "x"
1394   then
1395     test_LDFLAGS="-L${QTDIR}/lib"
1396     test_CFLAGS="-I$(QTDIR)/include"
1397   else
1398     test_LDFLAGS="-L${with_qte}/lib"
1399     test_CFLAGS="-I${with_qte}/include"
1400   fi
1401
1402   CPPFLAGS="${save_CPPFLAGS} ${test_CFLAGS}"
1403   AC_CHECK_HEADERS(qt.h, [
1404     qte_CFLAGS="${qte_CFLAGS} ${test_CFLAGS} -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
1405     qte_LDFLAGS="${qte_LDFLAGS} ${test_LDFLAGS} -lqpe -lqte"
1406     if test "x${with_qte}" = "x"
1407     then
1408       PLUGINS="${PLUGINS} video_output/qte/qte"
1409     else
1410       BUILTINS="${BUILTINS} video_output/qte/qte"
1411     fi
1412   ])
1413   CPPFLAGS="${save_CPPFLAGS}"
1414 fi
1415
1416 dnl
1417 dnl  Windows DirectX module
1418 dnl
1419 AC_ARG_ENABLE(directx,
1420   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1421 if test "x${enable_directx}" != "xno"
1422 then
1423   if test "x${SYS}" = "xmingw32"
1424   then
1425     AC_ARG_WITH(directx, 
1426     [    --with-directx=PATH   Win32 DirectX headers])
1427     if test "x${with_directx}" = "x"
1428     then
1429       AC_CHECK_HEADERS(ddraw.h,
1430       [ PLUGINS="${PLUGINS} video_output/directx/directx"
1431         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32" ])
1432     else
1433       AC_MSG_CHECKING(for directX headers in ${with_directx})
1434       if test -f ${with_directx}/ddraw.h
1435       then
1436         PLUGINS="${PLUGINS} video_output/directx/directx"
1437         directx_LDFLAGS="${directx_LDFLAGS} -lgdi32"
1438         directx_CFLAGS="${directx_CFLAGS} -I${with_directx}"
1439         AC_MSG_RESULT(yes)
1440       else
1441         AC_MSG_RESULT(no)
1442         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1443       fi
1444     fi
1445   fi
1446 fi
1447
1448 dnl
1449 dnl  Linux framebuffer module
1450 dnl
1451 AC_ARG_ENABLE(fb,
1452   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
1453     if test "x${enable_fb}" != "xno"
1454     then
1455       AC_CHECK_HEADERS(linux/fb.h, [
1456         PLUGINS="${PLUGINS} video_output/fb"
1457       ])
1458     fi
1459
1460 dnl
1461 dnl  Linux MGA module
1462 dnl
1463 AC_ARG_ENABLE(mga,
1464   [  --enable-mga            Linux kernel Matrox support (default disabled)],
1465   [ if test "x${enable_mga}" = "xyes"
1466     then
1467       PLUGINS="${PLUGINS} video_output/mga/mga video_output/mga/xmga"
1468     fi ])
1469
1470 dnl
1471 dnl  SVGAlib module
1472 dnl
1473 AC_ARG_ENABLE(svgalib,
1474   [  --enable-svgalib        SVGAlib support (default disabled)])
1475 if test "x${enable_svgalib}" = "xyes"
1476 then
1477   PLUGINS="${PLUGINS} video_output/svgalib"
1478   svgalib_LDFLAGS="${svgalib_LDFLAGS} -lvgagl -lvga"
1479 fi
1480
1481 dnl
1482 dnl  GGI module
1483 dnl
1484 AC_ARG_ENABLE(ggi,
1485   [  --enable-ggi            GGI support (default disabled)])
1486 if test "x${enable_ggi}" = "xyes"
1487 then
1488   PLUGINS="${PLUGINS} video_output/ggi"
1489   ggi_LDFLAGS="${ggi_LDFLAGS} -lggi"
1490   AC_ARG_WITH(ggi,
1491     [    --with-ggi=PATH       path to libggi],
1492     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
1493       then
1494         CFLAGS_GGI="${CFLAGS_GGI} -I${with_ggi}/include"
1495         ggi_LDFLAGS="${ggi_LDFLAGS} -L${with_ggi}/lib"
1496       fi ])
1497 fi
1498
1499 dnl
1500 dnl  Glide module
1501 dnl
1502 AC_ARG_ENABLE(glide,
1503   [  --enable-glide          Glide (3dfx) support (default disabled)])
1504 if test "x${enable_glide}" = "xyes"
1505 then
1506   PLUGINS="${PLUGINS} video_output/glide"
1507   glide_LDFLAGS="${glide_LDFLAGS} -lglide2x -lm"
1508   glide_CFLAGS="${glide_CFLAGS} -I/usr/include/glide"
1509   AC_ARG_WITH(glide,
1510     [    --with-glide=PATH     path to libglide],
1511     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
1512       then
1513         glide_CFLAGS="${glide_CFLAGS} -I${with_glide}/include"
1514         glide_LDFLAGS="${glide_LDFLAGS} -L${with_glide}/lib"
1515       fi ])
1516 fi
1517
1518 dnl
1519 dnl  AA plugin
1520 dnl
1521 AC_ARG_ENABLE(aa,
1522   [  --enable-aa             aalib output (default disabled)])
1523 if test "x${enable_aa}" = "xyes"
1524 then
1525   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
1526   if test "x${have_aa}" = "xtrue"
1527   then
1528     PLUGINS="${PLUGINS} video_output/aa"
1529     aa_LDFLAGS="${aa_LDFLAGS} -laa"
1530   fi
1531 fi
1532
1533 dnl
1534 dnl  Audio plugins
1535 dnl
1536
1537 AC_ARG_WITH(,[Audio plugins:])
1538
1539 dnl
1540 dnl  OSS /dev/dsp module (enabled by default except on win32)
1541 dnl
1542 AC_ARG_ENABLE(oss,
1543   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
1544
1545 if test "x${enable_oss}" != "xno" &&
1546   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
1547 then
1548   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1549     PLUGINS="${PLUGINS} audio_output/oss"
1550     AC_CHECK_LIB(ossaudio,main,oss_LDFLAGS="${oss_LDFLAGS} -lossaudio")
1551   ])
1552 fi
1553
1554 dnl
1555 dnl  Esound module
1556 dnl
1557 AC_ARG_ENABLE(esd,
1558   [  --enable-esd            Esound library support (default disabled)],
1559   [if test "x${enable_esd}" = "xyes"
1560    then
1561      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1562      if test "x${ESD_CONFIG}" != "xno"
1563      then
1564        PLUGINS="${PLUGINS} audio_output/esd"
1565        esd_CFLAGS="${esd_CFLAGS} `${ESD_CONFIG} --cflags`"
1566        esd_LDFLAGS="${esd_LDFLAGS} `${ESD_CONFIG} --libs`"
1567      fi
1568    fi])
1569
1570 dnl
1571 dnl  aRts module
1572 dnl
1573 AC_ARG_ENABLE(arts,
1574   [  --enable-arts           aRts sound server (default disabled)],
1575   [if test "x${enable_arts}" = "xyes"
1576    then
1577      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1578      if test "x${ARTS_CONFIG}" != "xno"
1579      then
1580        PLUGINS="${PLUGINS} audio_output/arts"
1581        arts_CFLAGS="${arts_CFLAGS} `${ARTS_CONFIG} --cflags`"
1582        arts_LDFLAGS="${arts_LDFLAGS} `${ARTS_CONFIG} --libs `"
1583      fi
1584    fi])
1585
1586 dnl
1587 dnl  ALSA module
1588 dnl
1589 AC_ARG_ENABLE(alsa,
1590   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1591   [if test "x${enable_alsa}" = "xyes"
1592    then
1593      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1594      if test "x${have_alsa}" = "xtrue"
1595      then
1596        PLUGINS="${PLUGINS} audio_output/alsa"
1597        alsa_LDFLAGS="${alsa_LDFLAGS} -lasound -lm -ldl"
1598      fi
1599    fi])
1600
1601 dnl
1602 dnl  win32 waveOut plugin
1603 dnl
1604 AC_ARG_ENABLE(waveout,
1605   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1606 if test "x${enable_waveout}" != "xno" -a "x${SYS}" = "xmingw32"
1607   then
1608     PLUGINS="${PLUGINS} audio_output/waveout"
1609     waveout_LDFLAGS="-lwinmm"
1610 fi
1611
1612 dnl
1613 dnl  Interface plugins
1614 dnl
1615
1616 AC_ARG_WITH(,[Interface plugins:])
1617
1618 dnl special case for BeOS
1619 if test "x${SYS}" = "xbeos"
1620 then
1621     PLUGINS="${PLUGINS} gui/beos/beos"
1622 fi
1623
1624 dnl
1625 dnl  Gtk+ module
1626 dnl
1627 AC_ARG_ENABLE(gtk,
1628   [  --enable-gtk            Gtk+ support (default enabled)])
1629 if test "x${enable_gtk}" != "xno"
1630 then
1631   GTK_PATH="${PATH}"
1632   AC_ARG_WITH(gtk-config-path,
1633     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1634     [ if test "x${with_gtk_config_path}" != "xno"
1635       then
1636         GTK_PATH="${with_gtk_config_path}:${PATH}"
1637       fi ])
1638   # look for gtk-config
1639   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1640   GTK_CONFIG=${GTK12_CONFIG}
1641   if test "x${GTK_CONFIG}" = "xno"
1642   then
1643     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1644   fi
1645   if test "x${GTK_CONFIG}" != "xno"
1646   then
1647     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1648     then
1649       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.])
1650     fi
1651     gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
1652     gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1653     # now look for the gtk.h header
1654     CPPFLAGS="${save_CPPFLAGS} ${gtk_CFLAGS}"
1655     ac_cv_gtk_headers=yes
1656     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1657       ac_cv_gtk_headers=no
1658       echo "Cannot find gtk development headers."
1659     ])
1660     if test "x${ac_cv_gtk_headers}" = "xyes"
1661     then
1662       PLUGINS="${PLUGINS} gui/gtk/gtk"
1663       NEED_GTK_MAIN=yes
1664       ALIASES="${ALIASES} gvlc"
1665     fi
1666     CPPFLAGS="${save_CPPFLAGS}"
1667   fi
1668 fi
1669
1670 dnl
1671 dnl  Familiar module uses Gtk+ library
1672 dnl
1673 AC_ARG_ENABLE(familiar,
1674   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
1675 if test "x${enable_familiar}" = "xyes"
1676 then
1677   GTK_PATH="${PATH}"
1678   AC_ARG_WITH(gtk-config-path,
1679     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1680     [ if test "x${with_gtk_config_path}" != "xno"
1681       then
1682         GTK_PATH="${with_gtk_config_path}:${PATH}"
1683       fi ])
1684   # look for gtk-config
1685   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1686   GTK_CONFIG=${GTK12_CONFIG}
1687   if test "x${GTK_CONFIG}" = "xno"
1688   then
1689     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1690   fi
1691   if test "x${GTK_CONFIG}" != "xno"
1692   then
1693     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1694     then
1695       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.])
1696     fi
1697     familiar_CFLAGS="${familiar_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
1698     familiar_LDFLAGS="${familiar_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1699     # now look for the gtk.h header
1700     CPPFLAGS="${save_CPPFLAGS} ${familiar_CFLAGS}"
1701     ac_cv_gtk_headers=yes
1702     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1703       ac_cv_gtk_headers=no
1704       echo "Cannot find gtk development headers."
1705     ])
1706     if test "x${ac_cv_gtk_headers}" = "xyes"
1707     then
1708       PLUGINS="${PLUGINS} gui/familiar/familiar"
1709       NEED_GTK_MAIN=yes
1710     fi
1711     CPPFLAGS="${save_CPPFLAGS}"
1712   fi
1713 fi
1714
1715 dnl
1716 dnl  Gnome module
1717 dnl
1718 AC_ARG_ENABLE(gnome,
1719   [  --enable-gnome          Gnome interface support (default disabled)],
1720   [if test "x${enable_gnome}" = "xyes"; then
1721     # look for gnome-config
1722     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1723     if test -x ${GNOME_CONFIG}
1724     then
1725        gnome_CFLAGS="${gnome_CFLAGS} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1726        gnome_LDFLAGS="${gnome_LDFLAGS} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1727     fi
1728     # now look for the gnome.h header
1729     CPPFLAGS="${save_CPPFLAGS} ${gnome_CFLAGS}"
1730     AC_CHECK_HEADERS(gnome.h, [
1731       PLUGINS="${PLUGINS} gui/gtk/gnome"
1732       NEED_GTK_MAIN=yes
1733       ALIASES="${ALIASES} gnome-vlc"
1734      ],[
1735       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1736 developement tools or remove the --enable-gnome option])
1737      ])
1738     CPPFLAGS="${save_CPPFLAGS}"
1739   fi])
1740
1741 dnl
1742 dnl  Qt module
1743 dnl
1744 AC_ARG_ENABLE(qt,
1745   [  --enable-qt             Qt interface support (default disabled)],
1746   [if test "x${enable_qt}" = "xyes"; then
1747      PLUGINS="${PLUGINS} gui/qt/qt"
1748      ALIASES="${ALIASES} qvlc"
1749      qt_LDFLAGS="${qt_LDFLAGS} -lqt -L${QTDIR}/lib"
1750      qt_CFLAGS="${qt_CFLAGS} -I/usr/include/qt -I${QTDIR}/include"
1751      if test -x ${QTDIR}/bin/moc
1752      then
1753        MOC=${QTDIR}/bin/moc
1754      else
1755        MOC=moc
1756      fi
1757    fi])
1758
1759 dnl 
1760 dnl  KDE module
1761 dnl
1762 AC_ARG_ENABLE(kde,
1763   [  --enable-kde            KDE interface support (default disabled)],
1764   [if test "x${enable_kde}" = "xyes"; then
1765      PLUGINS="${PLUGINS} gui/kde/kde"
1766      ALIASES="${ALIASES} kvlc"
1767      kde_LDFLAGS="${kde_LDFLAGS} -L${KDEDIR}/lib -lkfile"
1768      kde_CFLAGS="${kde_CFLAGS} -I/usr/include/kde -I/usr/include/qt"
1769      kde_CFLAGS="${kde_CFLAGS} -I${KDEDIR}/include -I${QTDIR}/include"
1770      if test -x ${QTDIR}/bin/moc
1771      then
1772        MOC=${QTDIR}/bin/moc
1773      else
1774        MOC=moc
1775      fi
1776    fi])
1777
1778 dnl
1779 dnl  Opie QT embedded module
1780 dnl
1781 AC_ARG_ENABLE(opie,
1782   [  --enable-opie           Qt embedded interface support (default disabled)],
1783   [if test "x${enable_opie}" = "xyes"; then
1784      AC_ARG_WITH(qte,
1785      [    --with-qte=PATH    Qt Embedded headers and libraries])
1786      if test "x${with_qte}" = "x"
1787      then
1788        test_LDFLAGS="-L$(QTDIR)/lib"
1789        test_CFLAGS="-I${QTDIR}/include"
1790      else
1791        test_LDFLAGS="-L${with_qte}/lib"
1792        test_CFLAGS="-I${with_qte}/include"
1793      fi
1794
1795      PLUGINS="${PLUGINS} gui/opie/opie"
1796      opie_LDFLAGS="${opie_LDFLAGS} ${test_LDFLAGS} -lqte"
1797      opie_CFLAGS="${opie_CFLAGS} ${test_CFLAGS}"
1798      if test -x ${QTEDIR}/bin/moc
1799      then
1800        MOC=${QTEDIR}/bin/moc
1801      else
1802        MOC=moc
1803      fi
1804    fi])
1805
1806
1807 dnl
1808 dnl  MacOS X module
1809 dnl
1810 AC_ARG_ENABLE(macosx,
1811   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1812   [if test "x${enable_macosx}" = "xyes"
1813    then
1814      BUILTINS="${BUILTINS} gui/macosx/macosx"
1815      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1816    fi],
1817   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1818      BUILTINS="${BUILTINS} gui/macosx/macosx"
1819      macosx_LDFLAGS="${macosx_LDFLAGS} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1820    )])
1821
1822 dnl
1823 dnl  QNX RTOS module
1824 dnl
1825 AC_ARG_ENABLE(qnx,
1826   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1827     if test "x${enable_qnx}" != "xno"
1828     then
1829       AC_CHECK_HEADERS(Ph.h, [
1830         PLUGINS="${PLUGINS} gui/qnx/qnx"
1831         qnx_LDFLAGS="${qnx_LDFLAGS} -lasound -lph"
1832       ])
1833     fi
1834
1835 dnl
1836 dnl  Windows native interface module, built with Borland C++ Builder
1837 dnl
1838 AC_ARG_ENABLE(intfwin,
1839 [  --enable-intfwin        Win32 interface support (default disabled)],
1840 [ if test "x${enable_intfwin}" != "xno"
1841   then
1842     AC_ARG_WITH(bcbuilder, 
1843     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1844     if test "x${with_bcbuilder}" != "x"
1845     then
1846       BCBUILDER="${with_bcbuilder}"
1847     fi
1848     PLUGINS="${PLUGINS} gui/win32/win32"
1849   fi ])
1850
1851 dnl
1852 dnl  ncurses module
1853 dnl
1854 AC_ARG_ENABLE(ncurses,
1855   [  --enable-ncurses        ncurses interface support (default disabled)],
1856   [if test "x${enable_ncurses}" = "xyes"; then
1857      PLUGINS="${PLUGINS} gui/ncurses/ncurses"
1858      ncurses_LDFLAGS="${ncurses_LDFLAGS} -lncurses"
1859    fi])
1860
1861 dnl
1862 dnl  XOSD plugin
1863 dnl
1864 AC_ARG_ENABLE(xosd,
1865   [  --enable-xosd           xosd interface support (default disabled)])
1866 if test "x${enable_xosd}" = "xyes"
1867 then
1868   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
1869   AC_TRY_COMPILE([#include <xosd.h>],
1870      [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
1871       AC_DEFINE(HAVE_OLD_XOSD_H, 1, Define if <xosd.h> is pre-1.0.0))
1872   if test "x${have_xosd}" = "xtrue"
1873   then
1874     PLUGINS="${PLUGINS} visualization/xosd/xosd"
1875     xosd_LDFLAGS="${xosd_LDFLAGS} -lxosd"
1876   fi
1877 fi
1878
1879 dnl
1880 dnl  Lirc plugin
1881 dnl
1882 AC_ARG_ENABLE(lirc,
1883   [  --enable-lirc           lirc support (default disabled)])
1884 if test "x${enable_lirc}" = "xyes"
1885 then
1886   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
1887   if test "x${have_lirc}" = "xtrue"
1888   then
1889     PLUGINS="${PLUGINS} control/lirc/lirc"
1890     lirc_LDFLAGS="${lirc_LDFLAGS} -llirc_client"
1891   fi
1892 fi
1893
1894 AC_ARG_WITH(,[Misc options:])
1895
1896 dnl
1897 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
1898 dnl
1899 dnl  We give the user the opportunity to specify
1900 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
1901 dnl
1902 AC_ARG_WITH(words,
1903   [  --with-words=endianness set endianness (big or little)])
1904   case "x${with_words}" in
1905     xbig)
1906       ac_cv_c_bigendian=yes
1907       ;;
1908     xlittle)
1909       ac_cv_c_bigendian=no
1910       ;;
1911     *)
1912       dnl  Try to guess endianness by matching patterns on a compiled
1913       dnl  binary, by looking for an ASCII or EBCDIC string
1914       AC_CACHE_CHECK([whether the byte order is big-endian],
1915         [ac_cv_c_bigendian],
1916         [ac_cv_c_bigendian="unknown"
1917         [cat >conftest.c <<EOF
1918         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
1919         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
1920         void _a(void) { char*s = (char*)am; s = (char *)ai; }
1921         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
1922         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
1923         void _e(void) { char*s = (char*)em; s = (char*)ei; }
1924         int main(void) { _a(); _e(); return 0; }
1925 EOF
1926         ]
1927         if test -f conftest.c
1928         then 
1929           if ${CC-cc} -c conftest.c -o conftest.o >config.log 2>&1 \
1930               && test -f conftest.o
1931           then
1932             if test "`strings conftest.o | grep BIGenDianSyS`"
1933             then
1934               ac_cv_c_bigendian="yes"
1935             fi
1936             if test "`strings conftest.o | grep LiTTleEnDian`"
1937             then
1938               ac_cv_c_bigendian="no"
1939             fi
1940           fi
1941         fi
1942       ])
1943       if test "x${ac_cv_c_bigendian}" = "xunknown"
1944       then
1945         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
1946       fi
1947       ;;
1948   esac
1949 dnl  Now we know what to use for endianness, just put it in the header
1950 if test "${ac_cv_c_bigendian}" = "yes"
1951 then
1952   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
1953 fi
1954
1955 dnl
1956 dnl  Profiling
1957 dnl
1958 PROFILING=0
1959
1960 GPROF=0
1961 AC_ARG_ENABLE(gprof,
1962 [  --enable-gprof          gprof profiling (default disabled)],
1963 [ if test "x${enable_gprof}" = "xyes"
1964   then
1965     GPROF=1
1966     PROFILING="gprof"
1967   fi
1968 ])
1969
1970 CPROF=0
1971 AC_ARG_ENABLE(cprof,
1972 [  --enable-cprof          cprof profiling (default disabled)],
1973 [ if test "x${enable_cprof}" = "xyes"
1974   then
1975     save_LDFLAGS="${save_LDFLAGS} -lcprof"; LDFLAGS="${save_LDFLAGS}"
1976     CPROF=1
1977     PROFILING="cprof"
1978   fi
1979 ])
1980
1981 dnl
1982 dnl  GNU portable threads
1983 dnl
1984 AC_ARG_ENABLE(pth,
1985   [  --enable-pth            GNU Pth support (default disabled)],
1986   [ if test "x${enable_pth}" = "xyes"; then
1987     AC_CHECK_LIB(pth,pth_init)
1988     AC_EGREP_HEADER(pth_init,pth.h,[
1989       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
1990                 Define if <pth.h> defines pth_init)
1991     THREAD_LIB="-lpth"
1992     fi])
1993 ])
1994
1995 dnl
1996 dnl  State Threads
1997 dnl
1998 AC_ARG_ENABLE(st,
1999   [  --enable-st             State Threads (default disabled)],
2000   [ if test "x${enable_st}" = "xyes"; then
2001     AC_CHECK_LIB(st,st_init)
2002     AC_EGREP_HEADER(st_init,st.h,[
2003       AC_DEFINE(ST_INIT_IN_ST_H, 1,
2004                 Define if <st.h> defines st_init)
2005     THREAD_LIB="-lst"
2006     fi])
2007 ])
2008
2009 vlc_LDFLAGS="${vlc_LDFLAGS} ${THREAD_LIB}"
2010 plugins_LDFLAGS="${plugins_LDFLAGS} ${THREAD_LIB}"
2011
2012 dnl
2013 dnl  Mozilla plugin
2014 dnl
2015 MOZILLA=0
2016 AC_ARG_ENABLE(mozilla,
2017   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2018 if test "x${enable_mozilla}" = "xyes"
2019 then
2020   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2021   if test "x${MOZILLA_CONFIG}" != "xno"
2022   then
2023     if test "x${SYS}" != "xmingw32"; then
2024       LDFLAGS="${save_LDFLAGS} -L${x_libraries}"
2025       AC_CHECK_LIB(Xt,XtStrings,[
2026         mozilla_LDFLAGS="${mozilla_LDFLAGS} -L${x_libraries} -lXt"
2027       ])
2028       LDFLAGS="${save_LDFLAGS}"
2029     fi
2030     MOZILLA=1
2031     mozilla_CFLAGS="${mozilla_CFLAGS} `${MOZILLA_CONFIG} --cflags plugin java --defines | xargs`"
2032     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2033     mozilla_LDFLAGS="${mozilla_LDFLAGS} `${MOZILLA_CONFIG} --libs | sed 's#-I\(.*\)/mozilla/\([^ ]*\)#-I\1/\2 -I\1/mozilla/\2#g'`"
2034   fi
2035 fi
2036
2037 dnl
2038 dnl  gtk_main plugin
2039 dnl
2040 if test "x${NEED_GTK_MAIN}" != "xno"
2041 then
2042     PLUGINS="${PLUGINS} misc/gtk_main"
2043     gtk_main_CFLAGS="${gtk_main_CFLAGS} ${gtk_CFLAGS} ${familiar_CFLAGS} ${gnome_CFLAGS}"
2044     gtk_main_LDFLAGS="${gtk_main_LDFLAGS} ${gtk_LDFLAGS} ${familiar_LDFLAGS} ${gnome_LDFLAGS}"
2045 fi
2046
2047 dnl
2048 dnl  Plug-ins - this must be AT THE END
2049 dnl
2050 AC_ARG_ENABLE(plugins,
2051   [  --disable-plugins       make all plug-ins built-in (default plug-ins enabled)],
2052   [if test "x${enable_plugins}" = "xno"
2053    then
2054      BUILTINS="${BUILTINS} ${PLUGINS}"
2055      PLUGINS=
2056    fi])
2057
2058 dnl Automagically disable plug-ins if there is no system support for .so files
2059 dnl don't forget vlc-win32 still can load .so as plugins
2060 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2061 then
2062   echo "*** Your system doesn't have plug-in support. All plug-ins will be compiled"
2063   echo "as built-in"
2064   BUILTINS="${BUILTINS} ${PLUGINS}"
2065   PLUGINS=
2066 fi
2067
2068 dnl
2069 dnl  Stuff used by the program
2070 dnl
2071 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "vlc ${VERSION} ${CODENAME} Copyright 1996-2002 VideoLAN", [Simple version string])
2072 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string])
2073 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2074
2075 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
2076 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2077 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2078
2079 DATA_PATH="${ac_tool_prefix}/share/videolan"
2080 AC_SUBST(DATA_PATH)
2081 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
2082 AC_SUBST(PLUGIN_PATH)
2083
2084 dnl
2085 dnl  Restore *FLAGS
2086 dnl
2087 CPPFLAGS="${save_CPPFLAGS}"
2088 CFLAGS="${save_CFLAGS}"
2089 LDFLAGS="${save_LDFLAGS}"
2090
2091 dnl
2092 dnl  Create the vlc-config script
2093 dnl
2094 libvlc_LDFLAGS="${vlc_LDFLAGS} ${builtins_LDFLAGS}"
2095 for i in `echo ${BUILTINS} | sed -e 's#[^ ]*/##g'` ; do libvlc_LDFLAGS="${libvlc_LDFLAGS} ${libdir}/vlc/${i}.a `eval echo '$'{${i}_LDFLAGS}`" ; done
2096 AC_SUBST(libvlc_LDFLAGS)
2097
2098 dnl 
2099 dnl  Configuration is finished
2100 dnl
2101 AC_SUBST(SYS)
2102 AC_SUBST(ARCH)
2103 AC_SUBST(PLUGINS)
2104 AC_SUBST(BUILTINS)
2105 AC_SUBST(ALIASES)
2106 AC_SUBST(DEBUG)
2107 AC_SUBST(ASM)
2108 AC_SUBST(CPROF)
2109 AC_SUBST(GPROF)
2110 AC_SUBST(OPTIMS)
2111 AC_SUBST(TUNING)
2112 AC_SUBST(RELEASE)
2113 AC_SUBST(MOC)
2114 AC_SUBST(WINDRES)
2115 AC_SUBST(BCBUILDER)
2116 AC_SUBST(NEED_GETOPT)
2117 AC_SUBST(MOZILLA)
2118
2119 AC_SUBST(CFLAGS_OPTIM)
2120 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2121 AC_SUBST(LDFLAGS)
2122
2123 AC_SUBST(vlc_CFLAGS)
2124 AC_SUBST(plugins_CFLAGS)
2125 AC_SUBST(builtins_CFLAGS)
2126 AC_SUBST(mozilla_CFLAGS)
2127
2128 AC_SUBST(a52tofloat32_CFLAGS)
2129 AC_SUBST(arts_CFLAGS)
2130 AC_SUBST(i420_yuy2_mmx_CFLAGS)
2131 AC_SUBST(dvd_CFLAGS)
2132 AC_SUBST(dvdread_CFLAGS)
2133 AC_SUBST(dvdplay_CFLAGS)
2134 AC_SUBST(ts_dvbpsi_CFLAGS)
2135 AC_SUBST(directx_CFLAGS)
2136 AC_SUBST(esd_CFLAGS)
2137 AC_SUBST(familiar_CFLAGS)
2138 AC_SUBST(faad_CFLAGS)
2139 AC_SUBST(ffmpeg_CFLAGS)
2140 AC_SUBST(glide_CFLAGS)
2141 AC_SUBST(gnome_CFLAGS)
2142 AC_SUBST(gtk_CFLAGS)
2143 AC_SUBST(gtk_main_CFLAGS)
2144 AC_SUBST(kde_CFLAGS)
2145 AC_SUBST(opie_CFLAGS)
2146 AC_SUBST(idctaltivec_CFLAGS)
2147 AC_SUBST(macosx_CFLAGS)
2148 AC_SUBST(mad_CFLAGS)
2149 AC_SUBST(memcpyaltivec_CFLAGS)
2150 AC_SUBST(motionaltivec_CFLAGS)
2151 AC_SUBST(qt_CFLAGS)
2152 AC_SUBST(qte_CFLAGS)
2153 AC_SUBST(sdl_CFLAGS)
2154 AC_SUBST(svgalib_CFLAGS)
2155 AC_SUBST(x11_CFLAGS)
2156 AC_SUBST(xvideo_CFLAGS)
2157
2158 AC_SUBST(vlc_LDFLAGS)
2159 AC_SUBST(plugins_LDFLAGS)
2160 AC_SUBST(builtins_LDFLAGS)
2161 AC_SUBST(mozilla_LDFLAGS)
2162
2163 AC_SUBST(a52tofloat32_LDFLAGS)
2164 AC_SUBST(aa_LDFLAGS)
2165 AC_SUBST(alsa_LDFLAGS)
2166 AC_SUBST(arts_LDFLAGS)
2167 AC_SUBST(beos_LDFLAGS)
2168 AC_SUBST(i420_rgb_LDFLAGS)
2169 AC_SUBST(directx_LDFLAGS)
2170 AC_SUBST(dv_LDFLAGS)
2171 AC_SUBST(dvd_LDFLAGS)
2172 AC_SUBST(dvdread_LDFLAGS)
2173 AC_SUBST(dvdplay_LDFLAGS)
2174 AC_SUBST(ts_dvbpsi_LDFLAGS)
2175 AC_SUBST(audio_LDFLAGS)
2176 AC_SUBST(esd_LDFLAGS)
2177 AC_SUBST(familiar_LDFLAGS)
2178 AC_SUBST(distort_LDFLAGS)
2179 AC_SUBST(faad_LDFLAGS)
2180 AC_SUBST(ffmpeg_LDFLAGS)
2181 AC_SUBST(mp4_LDFLAGS)
2182 AC_SUBST(ggi_LDFLAGS)
2183 AC_SUBST(glide_LDFLAGS)
2184 AC_SUBST(gnome_LDFLAGS)
2185 AC_SUBST(gtk_LDFLAGS)
2186 AC_SUBST(gtk_main_LDFLAGS)
2187 AC_SUBST(http_LDFLAGS)
2188 AC_SUBST(idctaltivec_LDFLAGS)
2189 AC_SUBST(imdct_LDFLAGS)
2190 AC_SUBST(imdct3dn_LDFLAGS)
2191 AC_SUBST(imdctsse_LDFLAGS)
2192 AC_SUBST(ipv4_LDFLAGS)
2193 AC_SUBST(ipv6_LDFLAGS)
2194 AC_SUBST(kde_LDFLAGS)
2195 AC_SUBST(lirc_LDFLAGS)
2196 AC_SUBST(macosx_LDFLAGS)
2197 AC_SUBST(mad_LDFLAGS)
2198 AC_SUBST(memcpyaltivec_LDFLAGS)
2199 AC_SUBST(motionaltivec_LDFLAGS)
2200 AC_SUBST(ncurses_LDFLAGS)
2201 AC_SUBST(opie_LDFLAGS)
2202 AC_SUBST(oss_LDFLAGS)
2203 AC_SUBST(qnx_LDFLAGS)
2204 AC_SUBST(qt_LDFLAGS)
2205 AC_SUBST(qte_LDFLAGS)
2206 AC_SUBST(rc_LDFLAGS)
2207 AC_SUBST(sdl_LDFLAGS)
2208 AC_SUBST(svgalib_LDFLAGS)
2209 AC_SUBST(vcd_LDFLAGS)
2210 AC_SUBST(vorbis_LDFLAGS)
2211 AC_SUBST(waveout_LDFLAGS)
2212 AC_SUBST(x11_LDFLAGS)
2213 AC_SUBST(xvideo_LDFLAGS)
2214 AC_SUBST(xosd_LDFLAGS)
2215 AC_SUBST(id3tag_LDFLAGS)
2216         
2217 AC_OUTPUT([
2218   Makefile
2219   Makefile.config
2220   Makefile.opts
2221   m4/Makefile
2222   intl/Makefile
2223   po/Makefile.in
2224   vlc-config
2225 ],[
2226   chmod a+x vlc-config
2227 ])
2228
2229 echo "
2230 vlc configuration
2231 --------------------
2232 vlc version           : ${VERSION}
2233 system                : ${SYS}
2234 architecture          : ${ARCH}
2235 optimizations         : ${OPTIMS}
2236 tuning                : ${TUNING}
2237 debug mode            : ${DEBUG}
2238 release               : ${RELEASE}
2239 profiling             : ${PROFILING}
2240 need builtin getopt   : ${NEED_GETOPT}
2241 modules               : (see Makefile.config)
2242 mozilla plugin        : ${MOZILLA}
2243 vlc aliases           :${ALIASES}
2244
2245 You may now tune Makefile.config and Makefile.opts at your convenience, for
2246 instance to choose which modules get compiled as plugins, or tune CFLAGS.
2247
2248 To build vlc and its plugins, type \`${VLC_MAKE}'.
2249 "
2250