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