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