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