* ALL: New ogg demux and vorbis codec modules for preliminary support of
[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  ogg plugin
1076 dnl
1077 AC_ARG_ENABLE(ogg,
1078   [  --enable-ogg            Ogg demux support (default enabled)])
1079 if test "x${enable_ogg}" != "xno"
1080 then
1081   AC_CHECK_HEADERS(ogg/ogg.h, [
1082     PLUGINS="${PLUGINS} ogg"
1083     LDFLAGS_ogg="${LDFLAGS_ogg} -logg"
1084    ],[])
1085 fi
1086
1087 dnl
1088 dnl  Codec plugins
1089 dnl
1090
1091 AC_ARG_WITH(,[Codec plugins:])
1092
1093 dnl
1094 dnl  mad plugin
1095 dnl
1096 AC_ARG_ENABLE(mad,
1097   [  --enable-mad            libmad module (default disabled)])
1098 if test "x${enable_mad}" = "xyes"
1099 then
1100   AC_ARG_WITH(mad,
1101     [    --with-mad=PATH       path to libmad],[],[])
1102   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
1103   then
1104     CPPFLAGS_mad="${CPPFLAGS_mad} -I${with_mad}/include"
1105     LDFLAGS_mad="${LDFLAGS_mad} -L${with_mad}/lib"
1106   fi
1107
1108   AC_ARG_WITH(mad-tree,
1109     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
1110   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
1111   then
1112     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
1113     if test "x${real_mad_tree}" = "x"
1114     then
1115       dnl  The given directory can't be found
1116       AC_MSG_RESULT(no)
1117       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
1118     fi
1119     dnl  Use a custom libmad
1120     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
1121     if test -f ${real_mad_tree}/libmad/mad.h
1122     then
1123       AC_MSG_RESULT(yes)
1124       CPPFLAGS_mad="${CPPFLAGS_mad} -I${real_mad_tree}/libmad"
1125       LDFLAGS_mad="${LDFLAGS_mad} -L${real_mad_tree}/libmad/.libs"
1126       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mad}"
1127       AC_CHECK_LIB(mad, mad_bit_init, [
1128         BUILTINS="${BUILTINS} mad"
1129         LDFLAGS_mad="${LDFLAGS_mad} -lmad"
1130         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1131       ],[])
1132       LDFLAGS="${LDFLAGS_save}"
1133     else
1134       AC_MSG_RESULT(no)
1135       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1136     fi
1137   else
1138     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mad}"
1139     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mad}"
1140     AC_CHECK_HEADERS(mad.h, ,
1141       [ AC_MSG_ERROR([Cannot find development headers for libmad...]) ])
1142     AC_CHECK_LIB(mad, mad_bit_init, [
1143       PLUGINS="${PLUGINS} mad"
1144       LDFLAGS_mad="${LDFLAGS_mad} -lmad" ],
1145       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1146     CPPFLAGS="${CPPFLAGS_save}"
1147     LDFLAGS="${LDFLAGS_save}"
1148   fi
1149 fi
1150
1151 dnl
1152 dnl   libid3tag support
1153 dnl
1154 AC_CHECK_HEADERS(id3tag.h, [
1155   LDFLAGS_id3tag="${LDFLAGS_id3tag} -lz -lid3tag"
1156   PLUGINS="${PLUGINS} id3tag"])
1157
1158 dnl
1159 dnl  ffmpeg decoder plugin
1160 dnl
1161 AC_ARG_ENABLE(ffmpeg,
1162 [  --enable-ffmpeg         ffmpeg codec (default disabled)])
1163 if test "x${enable_ffmpeg}" = "xyes"
1164 then
1165   AC_ARG_WITH(ffmpeg,
1166     [    --with-ffmpeg=PATH    path to ffmpeg installation],[],[])
1167   if test "x${with_ffmpeg}" != "xno" -a "x${with_ffmpeg}" != "x"
1168   then
1169     CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${with_ffmpeg}/include/libffmpeg"
1170     LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${with_ffmpeg}/lib"
1171   fi
1172
1173   dnl Add postprocessing modules
1174   PLUGINS="${PLUGINS} postprocessing_c"
1175   if test "x${ac_cv_mmx_inline}" != "xno"; then
1176     PLUGINS="${PLUGINS} postprocessing_mmx"
1177   fi
1178
1179   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1180     PLUGINS="${PLUGINS} postprocessing_mmxext"
1181   fi
1182
1183   AC_ARG_WITH(ffmpeg-tree,
1184   [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1185   if test "x${with_ffmpeg_tree}" != "x"
1186   then
1187     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1188     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1189     if test "x${real_ffmpeg_tree}" = x
1190     then
1191       dnl  The given directory can't be found
1192       AC_MSG_RESULT(no)
1193       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1194     fi
1195     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1196     then
1197       dnl  Use a custom libffmpeg
1198       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1199       BUILTINS="${BUILTINS} ffmpeg"
1200       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} ${real_ffmpeg_tree}/libavcodec/libavcodec.a"
1201       CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
1202     else
1203       dnl  The given libavcodec wasn't built
1204       AC_MSG_RESULT(no)
1205       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1206     fi
1207   else
1208     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
1209     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
1210     AC_CHECK_LIB(avcodec, avcodec_init, [
1211       BUILTINS="${BUILTINS} ffmpeg"
1212       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec" ],
1213       [ AC_MSG_ERROR([Cannot find libavcodec library...]) ])
1214     LDFLAGS="${LDFLAGS_save}"
1215     CPPFLAGS="${CPPFLAGS_save}"
1216   fi
1217 fi
1218
1219 dnl
1220 dnl  faad decoder plugin
1221 dnl
1222 AC_ARG_ENABLE(faad,
1223 [  --enable-faad           faad codec (default disabled)])
1224 if test "x${enable_faad}" = "xyes"
1225 then
1226   AC_ARG_WITH(faad,
1227     [    --with-faad=PATH      path to faad installation],[],[])
1228   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1229   then
1230     CPPFLAGS_faad="${CPPFLAGS_faad} -I${with_faad}/include"
1231     LDFLAGS_faad="${LDFLAGS_faad} -L${with_faad}/lib"
1232   fi
1233   LDFLAGS_faad="${LDFLAGS_faad}"
1234
1235   AC_ARG_WITH(faad-tree,
1236   [    --with-faad-tree=PATH faad tree for static linking])
1237   if test "x${with_faad_tree}" != "x"
1238   then
1239     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1240     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1241     if test "x${real_faad_tree}" = x
1242     then
1243       dnl  The given directory can't be found
1244       AC_MSG_RESULT(no)
1245       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1246     fi
1247     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1248     then
1249       dnl  Use a custom faad
1250       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1251       BUILTINS="${BUILTINS} faad"
1252       LDFLAGS_faad="${LDFLAGS_faad} ${real_faad_tree}/libfaad/.libs/libfaad.a"
1253       CPPFLAGS_faad="${CPPFLAGS_faad} -I${real_faad_tree}/include"
1254     else
1255       dnl  The given libfaad wasn't built
1256       AC_MSG_RESULT(no)
1257       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1258     fi
1259   else
1260     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
1261     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_faad}"
1262     AC_CHECK_HEADERS(faad.h, ,
1263       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1264     AC_CHECK_LIB(faad, faacDecOpen, [
1265       PLUGINS="${PLUGINS} faad"
1266       LDFLAGS_faad="${LDFLAGS_faad} -lfaad" ],
1267       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1268     LDFLAGS="${LDFLAGS_save}"
1269     CPPFLAGS="${CPPFLAGS_save}"
1270   fi
1271 fi
1272
1273
1274
1275 dnl
1276 dnl MP4 module
1277 dnl
1278 AC_ARG_ENABLE(mp4,
1279   [  --enable-mp4            MP4 demux module (default enabled)])
1280 if test "x${enable_mp4}" != "xno"
1281 then
1282
1283     PLUGINS="${PLUGINS} mp4"
1284     AC_CHECK_HEADERS(zlib.h,
1285               [ LDFLAGS_mp4="${LDFLAGS_mp4} -lz" ] )
1286 fi
1287
1288 dnl
1289 dnl  a52 AC3 decoder plugin
1290 dnl
1291 AC_ARG_ENABLE(a52,
1292   [  --enable-a52            A/52 support with liba52 (default enabled)])
1293 if test "x${enable_a52}" != "xno"
1294 then
1295   AC_ARG_WITH(a52,
1296     [    --with-a52=PATH       a52 headers and libraries])
1297   AC_ARG_WITH(a52-tree,
1298     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1299   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1300   then
1301     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1302     if test "x${real_a52_tree}" = "x"
1303     then
1304       dnl  The given directory can't be found
1305       AC_MSG_RESULT(no)
1306       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1307     fi
1308     dnl  Use a custom a52dec
1309     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1310     if test -f ${real_a52_tree}/include/a52.h
1311     then
1312       AC_MSG_RESULT(yes)
1313       CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -I${real_a52_tree}"
1314       LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -L${real_a52_tree}/liba52/.libs"
1315       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
1316       AC_CHECK_LIB(a52, a52_free, [
1317         BUILTINS="${BUILTINS} a52tofloat32"
1318         LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -la52 -lm"
1319         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -DUSE_A52DEC_TREE"
1320         ],[
1321         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1322         then
1323           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1324         else
1325           AC_MSG_ERROR([the specified tree hasn't been compiled])
1326         fi
1327       ],[-lm])
1328       LDFLAGS="${LDFLAGS_save}"
1329     else
1330       AC_MSG_RESULT(no)
1331       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1332     fi
1333   else
1334     if test "x${with_a52}" = "x"
1335     then
1336       LDFLAGS_test=""
1337       CPPFLAGS_test=""
1338     else
1339       LDFLAGS_test="-L${with_a52}/lib"
1340       CPPFLAGS_test="-I${with_a52}/include"
1341     fi
1342     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1343     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test}"
1344     AC_CHECK_HEADERS(a52dec/a52.h, [
1345       AC_CHECK_LIB(a52, a52_free, [
1346         PLUGINS="${PLUGINS} a52tofloat32"
1347         LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} ${LDFLAGS_test} -la52 -lm"
1348         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} ${CPPFLAGS_test}"
1349       ],[
1350         if test "x${enable_dvbpsi}" != "x"
1351         then
1352           AC_MSG_ERROR([Could not find a52 on your system: you may get it from http://liba52.sf.net])
1353         fi
1354       ],[-lm])
1355     ])
1356     CPPFLAGS="${CPPFLAGS_save}"
1357     LDFLAGS="${LDFLAGS_save}"
1358   fi
1359 fi
1360
1361 dnl
1362 dnl  cinepak plugin
1363 dnl
1364 AC_ARG_ENABLE(cinepak,
1365   [  --enable-cinepak        Cinepak decoder (default enabled)])
1366 if test "x${enable_cinepak}" != "xno"
1367 then
1368   PLUGINS="${PLUGINS} cinepak"
1369 fi
1370
1371 dnl
1372 dnl  DV plugin
1373 dnl
1374 AC_ARG_ENABLE(dv,
1375   [  --enable-dv             DV decoder support (default disabled)])
1376 if test "x${enable_dv}" = "xyes"
1377 then
1378   AC_CHECK_HEADERS(libdv/dv.h, [
1379     PLUGINS="${PLUGINS} dv"
1380     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1381    ],[])
1382 fi
1383
1384 dnl
1385 dnl  Vorbis plugin
1386 dnl
1387 AC_ARG_ENABLE(vorbis,
1388   [  --enable-vorbis            Vorbis decoder support (default enabled)])
1389 if test "x${enable_vorbis}" != "xno"
1390 then
1391   AC_CHECK_HEADERS(vorbis/codec.h, [
1392     PLUGINS="${PLUGINS} vorbis"
1393     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis"
1394    ],[])
1395 fi
1396
1397 dnl
1398 dnl  Video plugins
1399 dnl
1400
1401 AC_ARG_WITH(,[Video plugins:])
1402
1403 dnl
1404 dnl  X11 module
1405 dnl  (enabled by default except on win32)
1406 dnl
1407 AC_ARG_ENABLE(x11,
1408   [  --enable-x11            X11 support (default enabled)])
1409 if test "x${enable_x11}" != "xno" &&
1410   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
1411   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1412   AC_CHECK_HEADERS(X11/Xlib.h, [
1413     PLUGINS="${PLUGINS} x11"
1414     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
1415     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
1416   ])
1417   CPPFLAGS="${CPPFLAGS_save}"
1418 fi
1419
1420 dnl
1421 dnl  XVideo module
1422 dnl  (enabled by default except on win32)
1423 dnl
1424 AC_ARG_ENABLE(xvideo,
1425   [  --enable-xvideo         XVideo support (default enabled)])
1426 if test "x${enable_xvideo}" != "xno" &&
1427   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
1428   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1429   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
1430     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
1431     AC_CHECK_LIB(Xv_pic,XvPutImage,
1432       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
1433       PLUGINS="${PLUGINS} xvideo"
1434       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
1435       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1436       AC_CHECK_LIB(Xv,XvPutImage,
1437         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
1438         PLUGINS="${PLUGINS} xvideo"
1439         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
1440         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
1441         # Otherwise... well, do nothing.
1442         :
1443       )
1444     )
1445     CFLAGS="${CFLAGS_save}"
1446   ]
1447   CPPFLAGS="${CPPFLAGS_save}")
1448 fi
1449
1450 dnl
1451 dnl  SDL module
1452 dnl
1453 AC_ARG_ENABLE(sdl,
1454   [  --enable-sdl            SDL support (default enabled)])
1455 if test "x${enable_sdl}" != "xno"
1456 then
1457   SDL_PATH="${PATH}"
1458   AC_ARG_WITH(sdl-config-path,
1459     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
1460     [ if test "x${with_sdl_config_path}" != "xno"
1461       then
1462         SDL_PATH="${with_sdl_config_path}:${PATH}"
1463       fi ])
1464   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
1465   SDL_CONFIG="${SDL12_CONFIG}"
1466   SDL_HEADER="SDL12/SDL.h"
1467   if test "x${SDL_CONFIG}" = "xno"
1468   then
1469     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
1470     SDL_CONFIG=${SDL11_CONFIG}
1471     SDL_HEADER="SDL11/SDL.h"
1472   fi
1473   if test "x${SDL_CONFIG}" = "xno"
1474   then
1475     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
1476     SDL_HEADER="SDL/SDL.h"
1477   fi
1478   if test "x${SDL_CONFIG}" != "xno"
1479   then
1480     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
1481     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} --cflags`"
1482     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
1483     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} --cflags`"
1484     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} --libs | sed 's,-rdynamic,,'`"
1485     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
1486     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
1487       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
1488       [ AC_MSG_ERROR([The development package for SDL is not installed.
1489 Please install it and try again. Alternatively you can also configure with
1490 --disable-sdl.])
1491       ])
1492     CPPFLAGS="${CPPFLAGS_save}"
1493     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
1494     then
1495       AC_MSG_ERROR([The development package for SDL is not installed.
1496 Please install it and try again. Alternatively you can also configure with
1497 --disable-sdl.])
1498     fi
1499   elif test "x${enable_sdl}" =  "xyes"
1500   then
1501     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
1502 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
1503     ])
1504   fi
1505 fi
1506
1507 dnl
1508 dnl  Qt Embedded module
1509 dnl  (disabled by default)
1510 dnl
1511 AC_ARG_ENABLE(qte,
1512   [  --enable-qte            QT Embedded support (default disabled)])
1513 if test "x${enable_qte}" != "xno"
1514 then
1515   AC_ARG_WITH(qte,
1516   [    --with-qte=PATH    Qt Embedded headers and libraries])
1517   if test "x${with_qte}" = "x"
1518   then
1519     LDFLAGS_test="-L${QTDIR}/lib"
1520     CPPFLAGS_test="-I${QTDIR}/include"
1521   else
1522     LDFLAGS_test="-L${with_qte}/lib"
1523     CPPFLAGS_test="-I${with_qte}/include"
1524   fi
1525
1526   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1527   AC_CHECK_HEADERS(qt.h, [
1528     CPPFLAGS_qte="${CPPFLAGS_qte} ${CPPFLAGS_test} -DQT_QWS_IPAQ -DQWS"
1529     CXXFLAGS_qte="${CXXFLAGS_qte} -fno-exceptions -fno-rtti"
1530     LDFLAGS_qte="${LDFLAGS_qte} ${LDFLAGS_test} -lqte"
1531     if test "x${with_qte}" = "x"
1532     then
1533       PLUGINS="${PLUGINS} qte"
1534     else
1535       BUILTINS="${BUILTINS} qte"
1536     fi
1537   ])
1538   CPPFLAGS="${CPPFLAGS_save}"
1539 fi
1540
1541 dnl
1542 dnl  Windows DirectX module
1543 dnl
1544 AC_ARG_ENABLE(directx,
1545   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
1546 if test "x${enable_directx}" != "xno"
1547 then
1548   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
1549   then
1550     AC_ARG_WITH(directx,
1551     [    --with-directx=PATH   Win32 DirectX headers])
1552     if test "x${with_directx}" = "x"
1553     then
1554       AC_CHECK_HEADERS(ddraw.h,
1555       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
1556         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
1557     else
1558       AC_MSG_CHECKING(for directX headers in ${with_directx})
1559       if test -f ${with_directx}/ddraw.h
1560       then
1561         PLUGINS="${PLUGINS} vout_directx aout_directx"
1562         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
1563         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
1564         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
1565         AC_MSG_RESULT(yes)
1566       else
1567         AC_MSG_RESULT(no)
1568         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
1569       fi
1570     fi
1571   fi
1572 fi
1573
1574 dnl
1575 dnl  Linux framebuffer module
1576 dnl
1577 AC_ARG_ENABLE(fb,
1578   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
1579     if test "x${enable_fb}" != "xno"
1580     then
1581       AC_CHECK_HEADERS(linux/fb.h, [
1582         PLUGINS="${PLUGINS} fb"
1583       ])
1584     fi
1585
1586 dnl
1587 dnl  Linux MGA module
1588 dnl
1589 AC_ARG_ENABLE(mga,
1590   [  --enable-mga            Linux kernel Matrox support (default disabled)],
1591   [ if test "x${enable_mga}" = "xyes"
1592     then
1593       PLUGINS="${PLUGINS} mga xmga"
1594     fi ])
1595
1596 dnl
1597 dnl  SVGAlib module
1598 dnl
1599 AC_ARG_ENABLE(svgalib,
1600   [  --enable-svgalib        SVGAlib support (default disabled)])
1601 if test "x${enable_svgalib}" = "xyes"
1602 then
1603   PLUGINS="${PLUGINS} svgalib"
1604   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
1605 fi
1606
1607 dnl
1608 dnl  GGI module
1609 dnl
1610 AC_ARG_ENABLE(ggi,
1611   [  --enable-ggi            GGI support (default disabled)])
1612 if test "x${enable_ggi}" = "xyes"
1613 then
1614   PLUGINS="${PLUGINS} ggi"
1615   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
1616   AC_ARG_WITH(ggi,
1617     [    --with-ggi=PATH       path to libggi],
1618     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
1619       then
1620         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
1621         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
1622       fi ])
1623 fi
1624
1625 dnl
1626 dnl  Glide module
1627 dnl
1628 AC_ARG_ENABLE(glide,
1629   [  --enable-glide          Glide (3dfx) support (default disabled)])
1630 if test "x${enable_glide}" = "xyes"
1631 then
1632   PLUGINS="${PLUGINS} glide"
1633   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
1634   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
1635   AC_ARG_WITH(glide,
1636     [    --with-glide=PATH     path to libglide],
1637     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
1638       then
1639         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
1640         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
1641       fi ])
1642 fi
1643
1644 dnl
1645 dnl  AA plugin
1646 dnl
1647 AC_ARG_ENABLE(aa,
1648   [  --enable-aa             aalib output (default disabled)])
1649 if test "x${enable_aa}" = "xyes"
1650 then
1651   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
1652   if test "x${have_aa}" = "xtrue"
1653   then
1654     PLUGINS="${PLUGINS} aa"
1655     LDFLAGS_aa="${LDFLAGS_aa} -laa"
1656   fi
1657 fi
1658
1659 dnl
1660 dnl  Audio plugins
1661 dnl
1662
1663 AC_ARG_WITH(,[Audio plugins:])
1664
1665 dnl
1666 dnl  OSS /dev/dsp module (enabled by default except on win32)
1667 dnl
1668 AC_ARG_ENABLE(oss,
1669   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
1670
1671 if test "x${enable_oss}" != "xno" &&
1672   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
1673 then
1674   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
1675     PLUGINS="${PLUGINS} oss"
1676     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
1677   ])
1678 fi
1679
1680 dnl
1681 dnl  Esound module
1682 dnl
1683 AC_ARG_ENABLE(esd,
1684   [  --enable-esd            Esound library support (default disabled)],
1685   [if test "x${enable_esd}" = "xyes"
1686    then
1687      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
1688      if test "x${ESD_CONFIG}" != "xno"
1689      then
1690        PLUGINS="${PLUGINS} esd"
1691        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
1692        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
1693      fi
1694    fi])
1695
1696 dnl
1697 dnl  aRts module
1698 dnl
1699 AC_ARG_ENABLE(arts,
1700   [  --enable-arts           aRts sound server (default disabled)],
1701   [if test "x${enable_arts}" = "xyes"
1702    then
1703      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
1704      if test "x${ARTS_CONFIG}" != "xno"
1705      then
1706        PLUGINS="${PLUGINS} arts"
1707        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
1708        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
1709      fi
1710    fi])
1711
1712 dnl
1713 dnl  ALSA module
1714 dnl
1715 AC_ARG_ENABLE(alsa,
1716   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
1717   [if test "x${enable_alsa}" = "xyes"
1718    then
1719      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
1720      if test "x${have_alsa}" = "xtrue"
1721      then
1722        PLUGINS="${PLUGINS} alsa"
1723        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
1724      fi
1725    fi])
1726
1727 dnl
1728 dnl  win32 waveOut plugin
1729 dnl
1730 AC_ARG_ENABLE(waveout,
1731   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
1732 if test "x${enable_waveout}" != "xno"; then
1733   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
1734     PLUGINS="${PLUGINS} waveout"
1735     LDFLAGS_waveout="-lwinmm"
1736   fi
1737 fi
1738
1739 dnl
1740 dnl  Interface plugins
1741 dnl
1742
1743 AC_ARG_WITH(,[Interface plugins:])
1744
1745 dnl special case for BeOS
1746 if test "x${SYS}" = "xbeos"
1747 then
1748     PLUGINS="${PLUGINS} beos"
1749 fi
1750
1751 dnl
1752 dnl  Gtk+ module
1753 dnl
1754 AC_ARG_ENABLE(gtk,
1755   [  --enable-gtk            Gtk+ support (default enabled)])
1756 if test "x${enable_gtk}" != "xno"
1757 then
1758   GTK_PATH="${PATH}"
1759   AC_ARG_WITH(gtk-config-path,
1760     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1761     [ if test "x${with_gtk_config_path}" != "xno"
1762       then
1763         GTK_PATH="${with_gtk_config_path}:${PATH}"
1764       fi ])
1765   # look for gtk-config
1766   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1767   GTK_CONFIG=${GTK12_CONFIG}
1768   if test "x${GTK_CONFIG}" = "xno"
1769   then
1770     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1771   fi
1772   if test "x${GTK_CONFIG}" != "xno"
1773   then
1774     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1775     then
1776       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.])
1777     fi
1778     if test "x${SYS}" != "xmingw32"; then
1779       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
1780       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1781     else
1782       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
1783       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
1784     fi
1785     # now look for the gtk.h header
1786     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
1787     ac_cv_gtk_headers=yes
1788     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1789       ac_cv_gtk_headers=no
1790       echo "Cannot find gtk development headers."
1791     ])
1792     if test "x${ac_cv_gtk_headers}" = "xyes"
1793     then
1794       PLUGINS="${PLUGINS} gtk"
1795       if test "x${SYS}" != "xmingw32"; then
1796         NEED_GTK_MAIN=yes
1797       fi
1798       ALIASES="${ALIASES} gvlc"
1799     fi
1800     CPPFLAGS="${CPPFLAGS_save}"
1801   fi
1802 fi
1803
1804 dnl
1805 dnl  Familiar module uses Gtk+ library
1806 dnl
1807 AC_ARG_ENABLE(familiar,
1808   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
1809 if test "x${enable_familiar}" = "xyes"
1810 then
1811   GTK_PATH="${PATH}"
1812   AC_ARG_WITH(gtk-config-path,
1813     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
1814     [ if test "x${with_gtk_config_path}" != "xno"
1815       then
1816         GTK_PATH="${with_gtk_config_path}:${PATH}"
1817       fi ])
1818   # look for gtk-config
1819   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
1820   GTK_CONFIG=${GTK12_CONFIG}
1821   if test "x${GTK_CONFIG}" = "xno"
1822   then
1823     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
1824   fi
1825   if test "x${GTK_CONFIG}" != "xno"
1826   then
1827     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
1828     then
1829       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.])
1830     fi
1831     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} --cflags gtk gthread`"
1832     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
1833     # now look for the gtk.h header
1834     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
1835     ac_cv_gtk_headers=yes
1836     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
1837       ac_cv_gtk_headers=no
1838       echo "Cannot find gtk development headers."
1839     ])
1840     if test "x${ac_cv_gtk_headers}" = "xyes"
1841     then
1842       PLUGINS="${PLUGINS} familiar"
1843       NEED_GTK_MAIN=yes
1844     fi
1845     CPPFLAGS="${CPPFLAGS_save}"
1846   fi
1847 fi
1848
1849 dnl
1850 dnl  Gnome module
1851 dnl
1852 AC_ARG_ENABLE(gnome,
1853   [  --enable-gnome          Gnome interface support (default disabled)],
1854   [if test "x${enable_gnome}" = "xyes"; then
1855     # look for gnome-config
1856     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
1857     if test -x ${GNOME_CONFIG}
1858     then
1859        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
1860        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
1861     fi
1862     # now look for the gnome.h header
1863     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
1864     AC_CHECK_HEADERS(gnome.h, [
1865       PLUGINS="${PLUGINS} gnome"
1866       NEED_GTK_MAIN=yes
1867       NEED_GNOME_MAIN=yes
1868       ALIASES="${ALIASES} gnome-vlc"
1869      ],[
1870       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
1871 developement tools or remove the --enable-gnome option])
1872      ])
1873     CPPFLAGS="${CPPFLAGS_save}"
1874   fi])
1875
1876 dnl
1877 dnl  Qt module
1878 dnl
1879 AC_ARG_ENABLE(qt,
1880   [  --enable-qt             Qt interface support (default disabled)],
1881   [if test "x${enable_qt}" = "xyes"; then
1882      PLUGINS="${PLUGINS} qt"
1883      ALIASES="${ALIASES} qvlc"
1884      LDFLAGS_qt="${LDFLAGS_qt} -lqt -L${QTDIR}/lib"
1885      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt -I${QTDIR}/include"
1886      if test -x ${QTDIR}/bin/moc
1887      then
1888        MOC=${QTDIR}/bin/moc
1889      else
1890        MOC=moc
1891      fi
1892    fi])
1893
1894 dnl
1895 dnl  KDE module
1896 dnl
1897 AC_ARG_ENABLE(kde,
1898   [  --enable-kde            KDE interface support (default disabled)],
1899   [if test "x${enable_kde}" = "xyes"; then
1900      PLUGINS="${PLUGINS} kde"
1901      ALIASES="${ALIASES} kvlc"
1902      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib -lkfile"
1903      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt"
1904      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
1905      if test -x ${QTDIR}/bin/moc
1906      then
1907        MOC=${QTDIR}/bin/moc
1908      else
1909        MOC=moc
1910      fi
1911    fi])
1912
1913 dnl
1914 dnl  Opie QT embedded module
1915 dnl
1916 AC_ARG_ENABLE(opie,
1917   [  --enable-opie           Qt embedded interface support (default disabled)],
1918   [if test "x${enable_opie}" = "xyes"; then
1919      AC_ARG_WITH(qte,
1920      [    --with-qte=PATH    Qt Embedded headers and libraries])
1921      if test "x${with_qte}" = "x"
1922      then
1923        LDFLAGS_test="-L${QTDIR}/lib"
1924        CPPFLAGS_test="-I${QTDIR}/include"
1925      else
1926        LDFLAGS_test="-L${with_qte}/lib"
1927        CPPFLAGS_test="-I${with_qte}/include"
1928      fi
1929
1930      PLUGINS="${PLUGINS} opie"
1931      LDFLAGS_opie="${LDFLAGS_opie} ${LDFLAGS_test} -lqte"
1932      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_test}"
1933      if test -x ${QTEDIR}/bin/moc
1934      then
1935        MOC=${QTEDIR}/bin/moc
1936      else
1937        MOC=moc
1938      fi
1939    fi])
1940
1941 dnl
1942 dnl  MacOS X module
1943 dnl
1944 AC_ARG_ENABLE(macosx,
1945   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
1946   [if test "x${enable_macosx}" = "xyes"
1947    then
1948      BUILTINS="${BUILTINS} macosx"
1949      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1950    fi],
1951   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
1952      BUILTINS="${BUILTINS} macosx"
1953      LDFLAGS_macosx="${LDFLAGS_macosx} -framework CoreAudio -framework AudioToolbox -framework IOKit -framework Cocoa -framework Carbon -framework AGL -framework QuickTime -lobjc -ObjC"
1954    )])
1955
1956 dnl
1957 dnl  QNX RTOS module
1958 dnl
1959 AC_ARG_ENABLE(qnx,
1960   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
1961     if test "x${enable_qnx}" != "xno"
1962     then
1963       AC_CHECK_HEADERS(Ph.h, [
1964         PLUGINS="${PLUGINS} qnx"
1965         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
1966       ])
1967     fi
1968
1969 dnl
1970 dnl  Windows native interface module, built with Borland C++ Builder
1971 dnl
1972 AC_ARG_ENABLE(intfwin,
1973 [  --enable-intfwin        Win32 interface support (default disabled)],
1974 [ if test "x${enable_intfwin}" != "xno"
1975   then
1976     AC_ARG_WITH(bcbuilder,
1977     [    --with-bcbuilder=PATH Borland C++ Builder installation path])
1978     if test "x${with_bcbuilder}" != "x"
1979     then
1980       BCBUILDER="${with_bcbuilder}"
1981     fi
1982     PLUGINS="${PLUGINS} win32"
1983   fi ])
1984
1985 dnl
1986 dnl  ncurses module
1987 dnl
1988 AC_ARG_ENABLE(ncurses,
1989   [  --enable-ncurses        ncurses interface support (default disabled)],
1990   [if test "x${enable_ncurses}" = "xyes"; then
1991      PLUGINS="${PLUGINS} ncurses"
1992      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
1993    fi])
1994
1995 dnl
1996 dnl  XOSD plugin
1997 dnl
1998 AC_ARG_ENABLE(xosd,
1999   [  --enable-xosd           xosd interface support (default disabled)])
2000 if test "x${enable_xosd}" = "xyes"
2001 then
2002   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2003   AC_TRY_COMPILE([#include <xosd.h>],
2004      [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2005       AC_DEFINE(HAVE_OLD_XOSD_H, 1, Define if <xosd.h> is pre-1.0.0))
2006   if test "x${have_xosd}" = "xtrue"
2007   then
2008     PLUGINS="${PLUGINS} xosd"
2009     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2010   fi
2011 fi
2012
2013 dnl
2014 dnl  Lirc plugin
2015 dnl
2016 AC_ARG_ENABLE(lirc,
2017   [  --enable-lirc           lirc support (default disabled)])
2018 if test "x${enable_lirc}" = "xyes"
2019 then
2020   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2021   if test "x${have_lirc}" = "xtrue"
2022   then
2023     PLUGINS="${PLUGINS} lirc"
2024     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2025   fi
2026 fi
2027
2028 AC_ARG_WITH(,[Misc options:])
2029
2030 dnl
2031 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2032 dnl
2033 dnl  We give the user the opportunity to specify
2034 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2035 dnl
2036 AC_ARG_WITH(words,
2037   [  --with-words=endianness set endianness (big or little)])
2038   case "x${with_words}" in
2039     xbig)
2040       ac_cv_c_bigendian=yes
2041       ;;
2042     xlittle)
2043       ac_cv_c_bigendian=no
2044       ;;
2045     *)
2046       dnl  Try to guess endianness by matching patterns on a compiled
2047       dnl  binary, by looking for an ASCII or EBCDIC string
2048       AC_CACHE_CHECK([whether the byte order is big-endian],
2049         [ac_cv_c_bigendian],
2050         [ac_cv_c_bigendian="unknown"
2051         [cat >conftest.c <<EOF
2052         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2053         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2054         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2055         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2056         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2057         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2058         int main(void) { _a(); _e(); return 0; }
2059 EOF
2060         ]
2061         if test -f conftest.c
2062         then
2063           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2064               && test -f conftest.o
2065           then
2066             if test "`strings conftest.o | grep BIGenDianSyS`"
2067             then
2068               ac_cv_c_bigendian="yes"
2069             fi
2070             if test "`strings conftest.o | grep LiTTleEnDian`"
2071             then
2072               ac_cv_c_bigendian="no"
2073             fi
2074           fi
2075         fi
2076       ])
2077       if test "x${ac_cv_c_bigendian}" = "xunknown"
2078       then
2079         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
2080       fi
2081       ;;
2082   esac
2083 dnl  Now we know what to use for endianness, just put it in the header
2084 if test "${ac_cv_c_bigendian}" = "yes"
2085 then
2086   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
2087 fi
2088
2089 dnl
2090 dnl  Profiling
2091 dnl
2092 AC_ARG_ENABLE(gprof,
2093 [  --enable-gprof          gprof profiling (default disabled)])
2094 AC_ARG_ENABLE(cprof,
2095 [  --enable-cprof          cprof profiling (default disabled)])
2096 AM_CONDITIONAL(GPROF, test "x${enable_gprof}" = "xyes")
2097 AM_CONDITIONAL(CPROF, test "x${enable_gprof}" = "xyes")
2098
2099 dnl
2100 dnl  GNU portable threads
2101 dnl
2102 AC_ARG_ENABLE(pth,
2103   [  --enable-pth            GNU Pth support (default disabled)],
2104   [ if test "x${enable_pth}" = "xyes"; then
2105     AC_CHECK_LIB(pth,pth_init)
2106     AC_EGREP_HEADER(pth_init,pth.h,[
2107       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
2108                 Define if <pth.h> defines pth_init)
2109     THREAD_LIB="-lpth"
2110     fi])
2111 ])
2112
2113 dnl
2114 dnl  State Threads
2115 dnl
2116 AC_ARG_ENABLE(st,
2117   [  --enable-st             State Threads (default disabled)],
2118   [ if test "x${enable_st}" = "xyes"; then
2119     AC_CHECK_LIB(st,st_init)
2120     AC_EGREP_HEADER(st_init,st.h,[
2121       AC_DEFINE(ST_INIT_IN_ST_H, 1,
2122                 Define if <st.h> defines st_init)
2123     THREAD_LIB="-lst"
2124     fi])
2125 ])
2126
2127 if test "x${SYS}" != "xmingw32"; then
2128   LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
2129   LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
2130 fi
2131
2132 dnl
2133 dnl  Mozilla plugin
2134 dnl
2135 mozilla=false
2136 AC_ARG_ENABLE(mozilla,
2137   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
2138 if test "x${enable_mozilla}" = "xyes"
2139 then
2140   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
2141   if test "x${MOZILLA_CONFIG}" != "xno"
2142   then
2143     if test "x${SYS}" != "xmingw32"; then
2144       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
2145       AC_CHECK_LIB(Xt,XtStrings,[
2146         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
2147       ])
2148       LDFLAGS="${LDFLAGS_save}"
2149     fi
2150     mozilla=:
2151     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
2152     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2153     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
2154     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
2155     dnl Not necessarily in ${PATH}
2156     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
2157     then
2158       XPIDL="/usr/lib/mozilla/xpidl"
2159     fi
2160   fi
2161 fi
2162 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
2163
2164 dnl
2165 dnl  test plugins
2166 dnl
2167 AC_ARG_ENABLE(testsuite,
2168   [  --enable-testsuite      build test modules (default disabled)])
2169 if test "x${enable_testsuite}" = "xyes"
2170 then
2171   TESTS="test1 test2 test3 test4"
2172
2173   dnl  we define those so that bootstrap sets the right linker
2174   CXXFLAGS_test2="${CXXFLAGS_test2}"
2175   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
2176   dnl  this one is needed until automake knows what to do
2177   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
2178
2179   PLUGINS="${PLUGINS} ${TESTS}"
2180   #BUILTINS="${BUILTINS} ${TESTS}"
2181 fi
2182
2183 dnl
2184 dnl  gtk_main plugin
2185 dnl
2186 if test "x${NEED_GTK_MAIN}" != "xno"
2187 then
2188     PLUGINS="${PLUGINS} gtk_main"
2189     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
2190     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
2191     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
2192 fi
2193
2194 if test "x${NEED_GNOME_MAIN}" != "xno"
2195 then
2196     PLUGINS="${PLUGINS} gnome_main"
2197     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
2198     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
2199 fi
2200
2201 dnl
2202 dnl  Plugin and builtin checks
2203 dnl
2204 builtin_support=false
2205 plugin_support=:
2206
2207 dnl Support for plugins - this must be AT THE END
2208 AC_ARG_ENABLE(plugins,
2209   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
2210   [if test "x${enable_plugins}" = "xno"
2211    then
2212      plugin_support=false
2213    fi])
2214
2215 dnl Automagically disable plugins if there is no system support for
2216 dnl dynamically loadable files (.so, .dll, .dylib).
2217 dnl don't forget vlc-win32 still can load .dll as plugins
2218 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
2219 then
2220   echo "*** Your system doesn't have plugin support. All plugins will be built"
2221   echo "statically."
2222   plugin_support=false
2223 fi
2224
2225 dnl Export automake variables
2226 if ${plugin_support}
2227 then
2228   for plugin in `echo ${PLUGINS}`
2229   do
2230     eval "${plugin}_plugin=yes"
2231   done
2232 else
2233   BUILTINS="${BUILTINS} ${PLUGINS}"
2234   PLUGINS=
2235 fi
2236 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
2237
2238 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
2239 then
2240   builtin_support=:
2241   for builtin in `echo ${BUILTINS}`
2242   do
2243     eval "${builtin}_builtin=yes"
2244   done
2245 fi]
2246 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
2247
2248 dnl do not touch this line (bootstrap needs it)
2249
2250
2251 dnl
2252 dnl  Stuff used by the program
2253 dnl
2254 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
2255 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VideoLAN Client - version ${VERSION} ${CODENAME} - (c) 1996-2002 VideoLAN", [Copyright string])
2256 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
2257
2258 VLC_SYMBOL="`echo ${VERSION} | tr .- __`"
2259 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
2260 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
2261 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
2262
2263 DATA_PATH="${ac_tool_prefix}/share/videolan"
2264 AC_SUBST(DATA_PATH)
2265 PLUGIN_PATH="${ac_tool_prefix}/share/videolan"
2266 AC_SUBST(PLUGIN_PATH)
2267
2268 dnl
2269 dnl  Restore *FLAGS
2270 dnl
2271 CPPFLAGS="${CPPFLAGS_save}"
2272 CFLAGS="${CFLAGS_save}"
2273 CXXFLAGS="${CXXFLAGS_save}"
2274 OBJCFLAGS="${OBJCFLAGS_save}"
2275 LDFLAGS="${LDFLAGS_save}"
2276
2277 dnl
2278 dnl  Fool automake (see Makefile.am)
2279 dnl
2280 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
2281 AC_SUBST(AUTOMAKE_SUCKS)
2282
2283 dnl
2284 dnl  Create the vlc-config script
2285 dnl
2286 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
2287 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
2288
2289 dnl
2290 dnl  Configuration is finished
2291 dnl
2292 AC_SUBST(SYS)
2293 AC_SUBST(ARCH)
2294 AC_SUBST(PLUGINS)
2295 AC_SUBST(BUILTINS)
2296 AC_SUBST(ALIASES)
2297 AC_SUBST(ASM)
2298 AC_SUBST(MOC)
2299 AC_SUBST(WINDRES)
2300 AC_SUBST(BCBUILDER)
2301 AC_SUBST(XPIDL)
2302 AC_SUBST(LIBEXT)
2303 AC_SUBST(INCLUDES)
2304
2305 AC_SUBST(CFLAGS_TUNING)
2306 AC_SUBST(CFLAGS_OPTIM)
2307 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
2308 AC_SUBST(LDFLAGS)
2309
2310 AC_SUBST(CFLAGS_vlc)
2311 AC_SUBST(CFLAGS_pics)
2312 AC_SUBST(CFLAGS_plugins)
2313 AC_SUBST(CFLAGS_builtins)
2314 AC_SUBST(CPPFLAGS_mozilla)
2315
2316 AC_SUBST(LDFLAGS_vlc)
2317 AC_SUBST(LDFLAGS_libvlc)
2318 AC_SUBST(LDFLAGS_plugins)
2319 AC_SUBST(LDFLAGS_builtins)
2320 AC_SUBST(LDFLAGS_mozilla)
2321
2322 AC_OUTPUT([
2323   Makefile
2324   debian/Makefile
2325   doc/Makefile
2326   intl/Makefile
2327   ipkg/Makefile
2328   lib/Makefile
2329   m4/Makefile
2330   modules/Makefile
2331   po/Makefile.in
2332   share/Makefile
2333   src/Makefile
2334   vlc-config
2335 ],[
2336   chmod a+x vlc-config
2337 ])
2338
2339 printf "
2340 vlc configuration
2341 --------------------
2342 vlc version           : ${VERSION}
2343 system                : ${SYS}
2344 architecture          : ${ARCH}
2345 build flavour         : "
2346 test "x${DEBUG_TRUE}" = "x" && printf "debug "
2347 test "x${CPROF_TRUE}" = "x" && printf "cprof "
2348 test "x${GPROF_TRUE}" = "x" && printf "gprof "
2349 test "x${OPTIM_TRUE}" = "x" && printf "optim "
2350 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
2351 echo "
2352 vlc aliases           :${ALIASES}
2353
2354 To build vlc and its plugins, type \`make'.
2355 "
2356