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