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