* ./src/misc/messages.c: ouch. when the message queue was full, we were
[vlc.git] / configure.ac.in
1 dnl Autoconf settings for vlc
2
3 AC_INIT(vlc,0.6.0-test3)
4
5 CONFIGURE_LINE="$0 $*"
6 CODENAME="Trevelyan"
7
8 AC_PREREQ(2.50)
9 AC_CONFIG_SRCDIR(src/libvlc.c)
10 AC_CONFIG_AUX_DIR(autotools)
11 AC_CANONICAL_SYSTEM
12
13 dnl XXX: we don't put any flags here, because automake 1.5 doesn't support
14 dnl them. And we need the comma otherwize automake will choke on it.
15 AM_INIT_AUTOMAKE(vlc,0.6.0-test3)
16 AM_CONFIG_HEADER(config.h)
17
18 dnl
19 dnl  Save *FLAGS
20 dnl
21 CPPFLAGS_save="${CPPFLAGS}"
22 CFLAGS_save="${CFLAGS}"
23 CXXFLAGS_save="${CXXFLAGS}"
24 OBJCFLAGS_save="${OBJCFLAGS}"
25 LDFLAGS_save="${LDFLAGS}"
26
27 dnl
28 dnl Check for tools
29 dnl
30 AC_PROG_CC
31 AM_PROG_CC_C_O
32 AC_PROG_CPP
33 AC_PROG_CXX
34 AC_PROG_MAKE_SET
35 AC_PROG_INSTALL
36
37 dnl AC_PROG_EGREP only exists in autoconf 2.54+, so we use AC_EGREP_CPP right
38 dnl now otherwise it might be set in an obscure if statement.
39 AC_EGREP_CPP(foo,foo)
40
41 dnl AC_PROG_OBJC doesn't seem to exist, this is the KDE workaround
42 AC_MSG_CHECKING(for an Objective-C compiler)
43 OBJC="${CXX}"
44 AC_SUBST(OBJC)
45 OBJCFLAGS="${CXXFLAGS} -fgnu-runtime -fconstant-string-class=NSConstantString"
46 AC_SUBST(OBJCFLAGS)
47 dnl _AM_DEPENDENCIES(OBJC) doesn't work, so hard code OBJCDEPMODE here
48 #OBJCDEPMODE="depmode=gcc3"
49 #AC_SUBST(OBJCDEPMODE)
50 _AM_DEPENDENCIES(OBJC)
51 AC_MSG_RESULT(not implemented yet)
52
53 dnl Find the right ranlib, even when cross-compiling
54 AC_CHECK_TOOL(RANLIB, ranlib, :)
55 AC_CHECK_TOOL(STRIP, strip, :)
56 AC_CHECK_TOOL(AR, ar, :)
57 AC_CHECK_TOOL(LD, ld, :)
58
59 dnl AM_PROG_LIBTOOL
60 AC_PROG_INSTALL
61
62 dnl Check for compiler properties
63 AC_C_CONST
64 AC_C_INLINE
65
66 dnl
67 dnl  Set default values
68 dnl
69 LDFLAGS_vlc="${LDFLAGS}"
70 LIBEXT=".so"
71
72 dnl
73 dnl  Check the operating system
74 dnl
75 case "x${target_os}" in
76   x)
77     SYS=unknown
78     ;;
79   xlinux*)
80     SYS=linux
81     ;;
82   xbsdi*)
83     SYS=bsdi
84     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
85     LDFLAGS_dvd="${LDFLAGS_dvd} -ldvd"
86     LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvd"
87     LDFLAGS_vcd="${LDFLAGS_vcd} -ldvd"
88     LDFLAGS_cdda="${LDFLAGS_cdda} -ldvd"
89     ;;
90   x*bsd*)
91     SYS="${target_os}"
92     CFLAGS_save="${CFLAGS_save} -pthread"; CFLAGS="${CFLAGS_save}"
93     ;;
94   xdarwin*)
95     SYS=darwin
96     CFLAGS_save="${CFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CFLAGS="${CFLAGS_save}"
97     CXXFLAGS_save="${CXXFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; CXXFLAGS="${CXXFLAGS_save}"
98     OBJCFLAGS_save="${OBJCFLAGS_save} -no-cpp-precomp -D_INTL_REDIRECT_MACROS"; OBJCFLAGS="${OBJCFLAGS_save}"
99     LDFLAGS_vlc="${LDFLAGS_vlc} -all_load"
100     LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -all_load"
101     LIBEXT=".dylib"
102     ;;
103   x*mingw32* | x*cygwin*)
104     AC_CHECK_TOOL(WINDRES, windres, :)
105     LIBEXT=".dll"
106
107     case "x${target_os}" in
108       x*mingw32*)
109         SYS=mingw32
110         ;;
111       x*cygwin*)
112         dnl Check if we are using the mno-cygwin mode in which case we are
113         dnl actually dealing with a mingw32 compiler.
114         AC_EGREP_CPP(yes,
115             [#ifdef WIN32
116              yes
117              #endif],
118             SYS=mingw32, SYS=cygwin)
119         ;;
120     esac
121
122     if test "x$SYS" = "xmingw32"; then
123         # add ws2_32 for closesocket, select, recv
124         CPPFLAGS_save="${CPPFLAGS_save} -D_OFF_T_ -D_off_t=long"
125         CPPFLAGS="${CPPFLAGS_save}"
126         LDFLAGS_vlc="${LDFLAGS_vlc} -lws2_32 -lnetapi32 -lwinmm -mwindows"
127         LDFLAGS_ipv4="${LDFLAGS_ipv4} -lws2_32"
128         LDFLAGS_ipv6="${LDFLAGS_ipv6} -lws2_32"
129         LDFLAGS_access_http="${LDFLAGS_access_http} -lws2_32"
130         LDFLAGS_access_mms="${LDFLAGS_access_mms} -lws2_32"
131         LDFLAGS_access_udp="${LDFLAGS_access_udp} -lws2_32"
132         LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lws2_32"
133         LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lws2_32"
134         LDFLAGS_sap="${LDFLAGS_sap} -lws2_32"
135         LDFLAGS_slp="${LDFLAGS_slp} -lws2_32"
136         LDFLAGS_http="${LDFLAGS_http} -lws2_32"
137         LDFLAGS_httpd="${LDFLAGS_httpd} -lws2_32"
138     fi
139     ;;
140   x*nto*)
141     SYS=nto
142     LDFLAGS_x11="${LDFLAGS_x11} -lsocket"
143     LDFLAGS_xvideo="${LDFLAGS_xvideo} -lsocket"
144     ;;
145   xsolaris*)
146     SYS=solaris
147     ;;
148   xhpux*)
149     SYS=hpux
150     LIBEXT=".sl"
151     ;;
152   xbeos)
153     SYS=beos
154     CFLAGS_save="${CFLAGS_save} -Wno-multichar"; CFLAGS="${CFLAGS_save}"
155     CXXFLAGS_save="${CXXFLAGS_save} -Wno-multichar"; CXXFLAGS="${CXXFLAGS_save}"
156     LDFLAGS_vlc="${LDFLAGS_vlc} -lbe"
157     LDFLAGS_beos="${LDFLAGS_beos} -lbe -lmedia -ltranslation -ltracker -lgame -lstdc++.r4"
158     dnl Check if we have BONE (old net_server doesn't have libsocket.so)
159     AC_CHECK_LIB( socket, connect,
160         LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket -lbind" 
161         LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket -lbind"
162         LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket -lbind"
163         LDFLAGS_httpd="${LDFLAGS_httpd} -lsocket -lbind" )
164     ;;
165   x*)
166     SYS="${target_os}"
167     ;;
168 esac
169 AM_CONDITIONAL(HAVE_BEOS, test "x${SYS}" = "xbeos")
170 AM_CONDITIONAL(HAVE_DARWIN, test "x${SYS}" = "xdarwin")
171 AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")
172
173 dnl
174 dnl Gettext stuff
175 dnl
176 ALL_LINGUAS="de en_GB fr it ja no ru nl pl sv"
177 AM_GNU_GETTEXT_VERSION(0.11.5)
178 AM_GNU_GETTEXT
179 if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
180   AC_DEFINE(HAVE_INCLUDED_GETTEXT, 1, Define if we use the local libintl)
181   INCLUDES="${INCLUDES} -I\\\$(top_srcdir)/intl"
182 else
183   AC_CHECK_FUNCS(textdomain,,[
184     AC_CHECK_LIB(intl,textdomain,
185       LDFLAGS_vlc="${LDFLAGS_vlc} ${LIBINTL}",,
186       ${LIBINTL}
187     )
188   ])
189 fi
190 AM_CONDITIONAL(BUILD_INTL, test "${nls_cv_force_use_gnu_gettext}" = "yes")
191 XGETTEXT="${XGETTEXT} --keyword=_NS --keyword=_ANS"
192
193 AC_MSG_CHECKING(for suffix of libraries)
194 AC_MSG_RESULT(${LIBEXT})
195
196 dnl Check for the need to include the mingwex lib for mingw32
197 if test x$SYS = xmingw32
198 then
199     AC_CHECK_LIB(mingwex,opendir,
200         AC_CHECK_LIB(mingw32,opendir,LDFLAGS_vlc="${LDFLAGS_vlc}",
201             [LDFLAGS_vlc="${LDFLAGS_vlc} -lmingwex"
202              LDFLAGS_gtk="${LDFLAGS_gtk} -lmingwex"])
203     )
204 fi
205
206 dnl Check for fnative-struct or mms-bitfields support for mingw32
207 if test x$SYS = xmingw32
208 then
209     AC_CACHE_CHECK([if \$CC accepts -mms-bitfields],
210         [ac_cv_c_mms_bitfields],
211         [CFLAGS="${CFLAGS_save} -mms-bitfields"
212          AC_TRY_COMPILE([],,ac_cv_c_mms_bitfields=yes, ac_cv_c_mms_bitfields=no)])
213     if test x"$ac_cv_c_mms_bitfields" != x"no"; then
214         CFLAGS_save="${CFLAGS_save} -mms-bitfields";
215         CXXFLAGS_save="${CXXFLAGS_save} -mms-bitfields";
216     else
217         AC_CACHE_CHECK([if \$CC accepts -fnative-struct],
218             [ac_cv_c_fnative_struct],
219             [CFLAGS="${CFLAGS_save} -fnative-struct"
220              AC_TRY_COMPILE([],,ac_cv_c_fnative_struct=yes, ac_cv_c_fnative_struct=no)])
221         if test x"$ac_cv_c_fnative_struct" != x"no"; then
222             CFLAGS_save="${CFLAGS_save} -fnative-struct";
223             CXXFLAGS_save="${CXXFLAGS_save} -fnative-struct";
224         fi
225     fi
226
227     CFLAGS="${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
228 fi
229
230 dnl Check for fvtable-thunks support for mingw32
231 if test x$SYS = xmingw32
232 then
233 AC_LANG_PUSH(C++)
234     AC_CACHE_CHECK([if \$CXX accepts -fvtable-thunks],
235         [ac_cv_cxx_fvtable_thunks],
236         [CXXFLAGS="${CXXFLAGS_save} -Wall -Werror -fvtable-thunks"
237          AC_TRY_COMPILE([],,ac_cv_cxx_fvtable_thunks=yes,
238                         ac_cv_cxx_fvtable_thunks=no)])
239     if test x"$ac_cv_cxx_fvtable_thunks" = x"yes"; then
240         CXXFLAGS_mingw32_special="-fvtable-thunks"
241     fi
242
243     CXXFLAGS_save="${CXXFLAGS_save} ${CXXFLAGS_mingw32_special}"
244     CXXFLAGS="${CXXFLAGS_save}"
245 AC_LANG_POP(C++)
246 fi
247
248 dnl Flags for plugin compilation
249 case "x${SYS}" in
250   xmingw32|xcygwin)
251     CFLAGS_pics="${CFLAGS_pics} ${CFLAGS_mingw32_special}"
252     CXXFLAGS_pics="${CXXFLAGS_pics} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
253     OBJCFLAGS_pics="${OBJCFLAGS_pics} ${CFLAGS_mingw32_special}"
254     CFLAGS_plugins="${CFLAGS_plugins} ${CFLAGS_mingw32_special}"
255     CXXFLAGS_plugins="${CXXFLAGS_plugins} ${CFLAGS_mingw32_special} ${CXXFLAGS_mingw32_special}"
256     OBJCFLAGS_plugins="${OBJCFLAGS_plugins} ${CFLAGS_mingw32_special}"
257     ;;
258   x*)
259     CFLAGS_pics="${CFLAGS_pics} -fPIC"
260     CXXFLAGS_pics="${CXXFLAGS_pics} -fPIC"
261     OBJCFLAGS_pics="${OBJCFLAGS_pics} -fPIC"
262     CFLAGS_plugins="${CFLAGS_plugins} -fPIC"
263     CXXFLAGS_plugins="${CXXFLAGS_plugins} -fPIC"
264     OBJCFLAGS_plugins="${OBJCFLAGS_plugins} -fPIC"
265     LDFLAGS_plugins="${LDFLAGS_plugins} -fPIC"
266     ;;
267 esac
268
269 dnl The -DSYS_FOO flag
270 CPPFLAGS_save="${CPPFLAGS_save} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"; CPPFLAGS="${CPPFLAGS_save}"
271
272 dnl Check for system libs needed
273 need_libc=false
274
275 AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2 atoll getenv putenv setenv)
276
277 dnl Check for usual libc functions
278 AC_CHECK_FUNCS(strdup strndup atof lseek)
279 AC_CHECK_FUNCS(strcasecmp,,[AC_CHECK_FUNCS(stricmp)])
280 AC_CHECK_FUNCS(strncasecmp,,[AC_CHECK_FUNCS(strnicmp)])
281
282 AC_CHECK_FUNCS(connect,,[
283   AC_CHECK_LIB(socket,connect,
284     LDFLAGS_ipv4="${LDFLAGS_ipv4} -lsocket"
285     LDFLAGS_vlc="${LDFLAGS_vlc} -lsocket"
286 )])
287
288 AC_CHECK_FUNCS(send,,[
289   AC_CHECK_LIB(socket,send,
290     LDFLAGS_access_http="${LDFLAGS_access_http} -lsocket"
291     LDFLAGS_access_mms="${LDFLAGS_access_mms} -lsocket"
292     LDFLAGS_access_udp="${LDFLAGS_access_udp} -lsocket"
293     LDFLAGS_access_ftp="${LDFLAGS_access_ftp} -lsocket"
294     LDFLAGS_sap="${LDFLAGS_sap} -lsocket"
295     LDFLAGS_http="${LDFLAGS_http} -lsocket"
296     LDFLAGS_access_output_udp="${LDFLAGS_access_output_udp} -lsocket"
297 )])
298
299 AC_CHECK_FUNCS(gethostbyname,,[
300   AC_CHECK_LIB(nsl,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lnsl" LDFLAGS_httpd="${LDFLAGS_httpd} -lnsl",[
301     AC_CHECK_LIB(bind,gethostbyname,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lbind" LDFLAGS_httpd="${LDFLAGS_httpd} -lbind")])
302 ])
303
304 dnl Check for socklen_t
305 AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
306   [AC_TRY_COMPILE(
307      [#include <sys/types.h>
308       #include <sys/socket.h>],
309      [socklen_t len = 42; return len;],
310      ac_cv_type_socklen_t=yes,
311      ac_cv_type_socklen_t=no)])
312 if test x$ac_cv_type_socklen_t != xno; then
313   AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if <sys/socket.h> defines socklen_t.])
314 fi
315
316 dnl Check for va_copy
317 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy,
318   AC_TRY_LINK(
319     [#include <stdarg.h>],
320     [va_list ap1, ap2; va_copy(ap1,ap2);],
321     [ac_cv_c_va_copy="yes"],
322     [ac_cv_c_va_copy="no"]))
323 if test "$ac_cv_c_va_copy" = "yes"; then
324   AC_DEFINE(HAVE_VA_COPY, 1, [Define if <stdarg.h> defines va_copy.])
325 fi
326 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy,
327   AC_TRY_LINK(
328     [#include <stdarg.h>],
329     [va_list ap1, ap2; __va_copy(ap1,ap2);],
330     [ac_cv_c___va_copy="yes"],
331     [ac_cv_c___va_copy="no"]))
332 if test "$ac_cv_c___va_copy" = "yes"; then
333   AC_DEFINE(HAVE___VA_COPY, 1, [Define if <stdarg.h> defines __va_copy.])
334 fi
335
336 AC_CHECK_FUNCS(inet_aton,,[
337   AC_CHECK_LIB(resolv,inet_aton,LDFLAGS_ipv4="${LDFLAGS_ipv4} -lresolv" LDFLAGS_httpd="${LDFLAGS_httpd} -lresolv")
338 ])
339
340 dnl Check for getopt
341 need_getopt=false
342 AC_CHECK_FUNCS(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
343 [ # FreeBSD has a gnugetopt library for this:
344   AC_CHECK_LIB([gnugetopt],[getopt_long],
345     [AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LDFLAGS_vlc="${LDFLAGS_vlc} -lgnugetopt"],
346     [need_getopt=:])])
347 AM_CONDITIONAL(BUILD_GETOPT, ${need_getopt})
348
349 if test "x$SYS" != "xmingw32"; then
350 AC_TYPE_SIGNAL
351 AC_CHECK_LIB(dl,dlopen,LDFLAGS_vlc="${LDFLAGS_vlc} -ldl")
352 AC_CHECK_LIB(m,cos,
353   LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
354   LDFLAGS_adjust="${LDFLAGS_adjust} -lm"
355   LDFLAGS_distort="${LDFLAGS_distort} -lm"
356   LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -lm")
357 AC_CHECK_LIB(m,pow,
358   LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lm"
359   LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -lm"
360   LDFLAGS_imdct="${LDFLAGS_imdct} -lm"
361   LDFLAGS_imdct3dn="${LDFLAGS_imdct3dn} -lm"
362   LDFLAGS_imdctsse="${LDFLAGS_imdctsse} -lm"
363   LDFLAGS_i420_rgb="${LDFLAGS_i420_rgb} -lm"
364   LDFLAGS_faad="${LDFLAGS_faad} -lm"
365 )
366 AC_CHECK_LIB(m,sqrt,
367   LDFLAGS_headphone_channel_mixer="${LDFLAGS_headphone_channel_mixer} -lm"
368 )
369 fi # end "x$SYS" != "xmingw32"
370
371 if test "x$SYS" != "xmingw32"; then
372 dnl Check for pthreads - borrowed from XMMS
373 THREAD_LIB=error
374 if test "x${THREAD_LIB}" = "xerror"; then
375   AC_CHECK_LIB(pthread,main,THREAD_LIB="-lpthread")
376 fi
377 if test "x${THREAD_LIB}" = "xerror"; then
378   AC_CHECK_LIB(pthreads,main,THREAD_LIB="-lpthreads")
379 fi
380 if test "x${THREAD_LIB}" = "xerror"; then
381   AC_CHECK_LIB(c_r,main,THREAD_LIB="-lc_r")
382 fi
383 if test "x${THREAD_LIB}" = "xerror"; then
384   AC_CHECK_FUNCS(pthread_mutex_lock)
385   THREAD_LIB=""
386 fi
387
388 dnl Check for cthreads under GNU/Hurd for instance
389 AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
390
391 dnl
392 dnl  GNU portable threads
393 dnl
394 AC_ARG_ENABLE(pth,
395   [  --enable-pth            GNU Pth support (default disabled)],
396   [ if test "x${enable_pth}" = "xyes"; then
397     AC_CHECK_LIB(pth,pth_init)
398     AC_MSG_CHECKING(for pth_init in pth.h)
399     AC_EGREP_HEADER(pth_init,pth.h,[
400       AC_MSG_RESULT(yes)
401       AC_DEFINE(PTH_INIT_IN_PTH_H, 1,
402                 Define if <pth.h> defines pth_init)
403       THREAD_LIB="-lpth"
404     ],[
405       AC_MSG_RESULT(no)
406     ])
407     fi
408 ])
409
410 dnl
411 dnl  State Threads
412 dnl
413 AC_ARG_ENABLE(st,
414   [  --enable-st             State Threads (default disabled)],
415   [ if test "x${enable_st}" = "xyes"; then
416     AC_CHECK_LIB(st,st_init)
417     AC_MSG_CHECKING(for st_init in st.h)
418     AC_EGREP_HEADER(st_init,st.h,[
419       AC_MSG_RESULT(yes)
420       AC_DEFINE(ST_INIT_IN_ST_H, 1,
421                 Define if <st.h> defines st_init)
422       THREAD_LIB="-lst"
423     ],[
424       AC_MSG_RESULT(yes)
425     ])
426     fi
427 ])
428
429 LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
430 LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
431
432 dnl Don't link with rt when using GNU-pth
433 if test "x${THREAD_LIB}" != "x-lpth" && test "x${THREAD_LIB}" != "x-lst"; then
434   dnl HP/UX port
435   AC_CHECK_LIB(rt,sem_init, [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"])
436
437   have_nanosleep=false
438   AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
439     AC_CHECK_LIB(rt,nanosleep,
440       [LDFLAGS_vlc="${LDFLAGS_vlc} -lrt"; have_nanosleep=:],
441       [AC_CHECK_LIB(posix4,nanosleep,
442           [LDFLAGS_vlc="${LDFLAGS_vlc} -lposix4"; have_nanosleep=:])]
443     )
444   ])
445   if ${have_nanosleep}; then
446     AC_DEFINE(HAVE_NANOSLEEP, 1,
447               Define if nanosleep is available.)
448   fi
449 fi
450
451 dnl Check for misc headers
452 AC_MSG_CHECKING(for pthread_cond_t in pthread.h)
453 AC_EGREP_HEADER(pthread_cond_t,pthread.h,[
454   AC_MSG_RESULT(yes)
455   AC_DEFINE(PTHREAD_COND_T_IN_PTHREAD_H, 1,
456             Define if <pthread.h> defines pthread_cond_t.)],[
457   AC_MSG_RESULT(no)])
458
459 AC_MSG_CHECKING(for pthread_once in pthread.h)
460 AC_EGREP_HEADER(pthread_once,pthread.h,[
461   AC_MSG_RESULT(yes)
462   AC_DEFINE(PTHREAD_ONCE_IN_PTHREAD_H, 1,
463             Define if <pthread.h> defines pthread_once.)],[
464   AC_MSG_RESULT(no)])
465 fi # end "x$SYS" != "xmingw32"
466
467 AC_MSG_CHECKING(for strncasecmp in strings.h)
468 AC_EGREP_HEADER(strncasecmp,strings.h,[
469   AC_MSG_RESULT(yes)
470   AC_DEFINE(STRNCASECMP_IN_STRINGS_H, 1,
471             Define if <strings.h> defines strncasecmp.)],[
472   AC_MSG_RESULT(no)])
473
474 dnl Check for headers
475 AC_CHECK_HEADERS(signal.h time.h errno.h stdint.h getopt.h strings.h inttypes.h sys/int_types.h)
476 AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h)
477 AC_CHECK_HEADERS(dlfcn.h image.h)
478 AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
479 if test "x$SYS" != "xmingw32"; then
480 AC_CHECK_HEADERS(machine/param.h sys/shm.h)
481 AC_CHECK_HEADERS(linux/version.h)
482 fi # end "x$SYS" != "xmingw32"
483
484 AC_HEADER_TIME
485
486 dnl Check for dirent
487 need_dirent=false
488 AC_CHECK_HEADERS(dirent.h,,[need_dirent=:])
489 AM_CONDITIONAL(BUILD_DIRENT, ${need_dirent})
490
491 dnl Mac OS X and other OSes don't have declaration for nanosleep
492 if test "x$SYS" != "xmingw32"; then
493 AC_MSG_CHECKING(for nanosleep in time.h)
494 AC_EGREP_HEADER(nanosleep,time.h,[
495   AC_MSG_RESULT(yes)
496   AC_DEFINE(HAVE_DECL_NANOSLEEP, 1,
497             Define if <time.h> defines nanosleep.)
498 ],[
499   AC_MSG_RESULT(no)
500 ])
501 fi # end "x$SYS" != "xmingw32"
502
503 dnl Make sure we have timespecs
504 AC_MSG_CHECKING(for timespec in sys/time.h)
505 AC_EGREP_HEADER(timespec,sys/time.h,[
506   AC_MSG_RESULT(yes)
507   AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
508             Define if <sys/time.h> defines struct timespec.)
509 ],[
510   AC_MSG_RESULT(no)
511 ])
512
513 dnl Check for threads library
514 if test "x$SYS" != "xmingw32"; then
515 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/scheduler.h kernel/OS.h)
516 fi # end "x$SYS" != "xmingw32"
517
518 dnl Default X headers and libraries
519 if test "x${x_includes}" = "xNONE"; then
520   x_includes="/usr/X11R6/include"
521 fi
522 if test "x${x_libraries}" = "xNONE"; then
523   x_libraries="/usr/X11R6/lib"
524 fi
525
526 dnl Build the gtk_main plugins?
527 NEED_GTK_MAIN=no
528 NEED_GNOME_MAIN=no
529 NEED_GTK2_MAIN=no
530 NEED_GNOME2_MAIN=no
531
532 dnl build the qte plugin ?
533 NEED_QTE_MAIN=no
534
535 dnl Check for ntohl, etc.
536 AC_CACHE_CHECK([for ntohl in sys/param.h],
537     [ac_cv_c_ntohl_sys_param_h],
538     [CFLAGS="${CFLAGS_save} -Wall -Werror"
539      AC_TRY_COMPILE([#include <sys/param.h>],
540         [void foo() { int meuh; ntohl(meuh); }],
541         ac_cv_c_ntohl_sys_param_h=yes, ac_cv_c_ntohl_sys_param_h=no)])
542 if test "x${ac_cv_c_ntohl_sys_param_h}" != "xno"; then
543     AC_DEFINE(NTOHL_IN_SYS_PARAM_H, 1, Define if <sys/param.h> defines ntohl.)
544 fi
545
546 dnl Check for inline function size limit
547 AC_CACHE_CHECK([if \$CC accepts -finline-limit],
548     [ac_cv_c_inline_limit],
549     [CFLAGS="${CFLAGS_save} -finline-limit-30000"
550      AC_TRY_COMPILE([],,ac_cv_c_inline_limit=yes, ac_cv_c_inline_limit=no)])
551 if test "x${ac_cv_c_inline_limit}" != "xno"; then
552     CFLAGS_save="${CFLAGS_save} -finline-limit-30000"; CFLAGS="${CFLAGS_save}"
553     CXXFLAGS_save="${CXXFLAGS_save} -finline-limit-30000"; CXXFLAGS="${CXXFLAGS_save}"
554     OBJCFLAGS_save="${OBJCFLAGS_save} -finline-limit-30000"; OBJCFLAGS="${OBJCFLAGS_save}"
555 fi
556
557 # XXX: do this with an M4 macro?
558 #dnl Check for various -W flags
559 #for flag in "" all unreachable-code conversion sign-compare disabled-optimization
560 #do
561 #    AC_CACHE_CHECK([if \$CC accepts -W${flag}],
562 #        [ac_cv_c_W${flag}],
563 #        [CFLAGS="-W${flag} ${CFLAGS_save}"
564 #         AC_TRY_COMPILE([],,ac_cv_c_W${flag}=yes, ac_cv_c_W${flag}=no)])
565 #    if test "x${ac_cv_c_W${flag}}" != "xno"; then
566 #        CFLAGS_save="-W${flag} ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
567 #        CXXFLAGS_save="-W${flag} ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
568 #        OBJCFLAGS_save="-W${flag} ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
569 #    fi
570 #done
571
572 AC_CACHE_CHECK([if \$CC accepts -Wall],
573     [ac_cv_c_Wall],
574     [CFLAGS="-Wall ${CFLAGS_save}"
575      AC_TRY_COMPILE([],,ac_cv_c_Wall=yes, ac_cv_c_Wall=no)])
576
577 AC_CACHE_CHECK([if \$CC accepts -Wconversion],
578     [ac_cv_c_Wconversion],
579     [CFLAGS="-Wconversion ${CFLAGS_save}"
580      AC_TRY_COMPILE([],,ac_cv_c_Wconversion=yes, ac_cv_c_Wconversion=no)])
581
582 AC_CACHE_CHECK([if \$CC accepts -Wunreachable-code],
583     [ac_cv_c_Wunreachable_code],
584     [CFLAGS="-Wunreachable-code ${CFLAGS_save}"
585      AC_TRY_COMPILE([],,ac_cv_c_Wunreachable_code=yes, ac_cv_c_Wunreachable_code=no)])
586
587 AC_CACHE_CHECK([if \$CC accepts -Wsign-compare],
588     [ac_cv_c_Wsign_compare],
589     [CFLAGS="-Wsign-compare ${CFLAGS_save}"
590      AC_TRY_COMPILE([],,ac_cv_c_Wsign_compare=yes, ac_cv_c_Wsign_compare=no)])
591
592 AC_CACHE_CHECK([if \$CC accepts -Wdisabled-optimization],
593     [ac_cv_c_Wdisabled_optimization],
594     [CFLAGS="-Wdisabled-optimization ${CFLAGS_save}"
595      AC_TRY_COMPILE([],,ac_cv_c_Wdisabled_optimization=yes, ac_cv_c_Wdisabled_optimization=no)])
596
597 AC_CACHE_CHECK([if \$CC accepts -Winline],
598     [ac_cv_c_Winline],
599     [CFLAGS="-Winline ${CFLAGS_save}"
600      AC_TRY_COMPILE([],,ac_cv_c_Winline=yes, ac_cv_c_Winline=no)])
601
602 if test "x${ac_cv_c_Wall}" != "xno"; then
603     CFLAGS_save="-Wall ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
604     CXXFLAGS_save="-Wall ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
605     OBJCFLAGS_save="-Wall ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
606 fi
607
608 if test "x${ac_cv_c_Wunreachable_code}" != "xno"; then
609 #    CFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
610 #    CXXFLAGS_save="-Wunreachable-code ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
611 #    OBJCFLAGS_save="-Wunreachable-code ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
612
613     dnl -Wunreachable-code means gcc-3.x, we can use -Wconversion and we can
614     dnl activate -Winline for C++, it won't choke on system headers.
615 #    if test "x${ac_cv_c_Wconversion}" != "xno"; then
616 #        CFLAGS_save="-Wconversion ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
617 #        CXXFLAGS_save="-Wconversion ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
618 #        OBJCFLAGS_save="-Wconversion ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
619 #    fi
620     if test "x${ac_cv_c_Winline}" != "xno"; then
621         CXXFLAGS_save="-Winline ${CXXFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
622     fi
623
624 fi
625
626 if test "x${ac_cv_c_Wsign_compare}" != "xno"; then
627     CFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
628     CXXFLAGS_save="-Wsign-compare ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
629     OBJCFLAGS_save="-Wsign-compare ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
630 fi
631
632 if test "x${ac_cv_c_Wdisabled_optimization}" != "xno"; then
633     CFLAGS_save="-Wdisabled-optimization ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
634     CXXFLAGS_save="-Wdisabled-optimization ${CFLAGS_save}"; CXXFLAGS="${CXXFLAGS_save}"
635     OBJCFLAGS_save="-Wdisabled-optimization ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
636 fi
637
638 if test "x${ac_cv_c_Winline}" != "xno"; then
639     CFLAGS_save="-Winline ${CFLAGS_save}"; CFLAGS="${CFLAGS_save}"
640     OBJCFLAGS_save="-Winline ${OBJCFLAGS_save}"; OBJCFLAGS="${OBJCFLAGS_save}"
641 fi
642
643 dnl Check for -pipe
644 AC_CACHE_CHECK([if \$CC accepts -pipe],
645     [ac_cv_c_pipe],
646     [CFLAGS="${CFLAGS_save} -pipe"
647      AC_TRY_COMPILE([],,ac_cv_c_pipe=yes, ac_cv_c_pipe=no)])
648 if test "x${ac_cv_c_pipe}" != "xno"; then
649     CFLAGS_save="${CFLAGS_save} -pipe"; CFLAGS="${CFLAGS_save}"
650     CXXFLAGS_save="${CXXFLAGS_save} -pipe"; CXXFLAGS="${CXXFLAGS_save}"
651     OBJCFLAGS_save="${OBJCFLAGS_save} -pipe"; OBJCFLAGS="${OBJCFLAGS_save}"
652 fi
653
654 dnl Check for various optimization flags
655 AC_CACHE_CHECK([if \$CC accepts -O3],
656     [ac_cv_c_o3],
657     [CFLAGS="${CFLAGS_save} -O3"
658      AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
659 if test "x${ac_cv_c_o3}" != "xno"; then
660     CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
661 fi
662
663 AC_CACHE_CHECK([if \$CC accepts -O2],
664     [ac_cv_c_o2],
665     [CFLAGS="${CFLAGS_save} -O2"
666      AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
667 if test "x${ac_cv_c_o2}" != "xno"; then
668     if test "x${ac_cv_c_o3}" = "xno"; then
669         CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
670     fi
671     CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O2"
672 else
673     AC_CACHE_CHECK([if \$CC accepts -O],
674         [ac_cv_c_o],
675         [CFLAGS="${CFLAGS_save} -O"
676          AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
677     if test "x${ac_cv_c_o}" != "xno"; then
678         if test "x${ac_cv_c_o3}" = "xno"; then
679             CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
680         fi
681         CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
682     fi
683 fi
684
685 dnl Check for -ffast-math
686 AC_CACHE_CHECK([if \$CC accepts -ffast-math],
687     [ac_cv_c_fast_math],
688     [CFLAGS="${CFLAGS_save} -ffast-math"
689      AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
690 if test "x${ac_cv_c_fast_math}" != "xno"; then
691     CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
692 fi
693
694 dnl Check for -funroll-loops
695 dnl Disabled on BeOS because BeOS' gcc is buggy and may crash with it
696 if test "x${SYS}" != "xbeos"
697 then
698   AC_CACHE_CHECK([if \$CC accepts -funroll-loops],
699       [ac_cv_c_unroll_loops],
700       [CFLAGS="${CFLAGS_save} -funroll-loops"
701        AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
702   if test "x${ac_cv_c_unroll_loops}" != "xno"; then
703       CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops"
704   fi
705 fi
706
707 dnl Check for -fomit-frame-pointer
708 AC_CACHE_CHECK([if \$CC accepts -fomit-frame-pointer],
709     [ac_cv_c_omit_frame_pointer],
710     [CFLAGS="${CFLAGS_save} -fomit-frame-pointer"
711      AC_TRY_COMPILE([],,ac_cv_c_omit_frame_pointer=yes, ac_cv_c_omit_frame_pointer=no)])
712 if test "x${ac_cv_c_omit_frame_pointer}" != "xno"; then
713     CFLAGS_OPTIM_NODEBUG="${CFLAGS_OPTIM_NODEBUG} -fomit-frame-pointer"
714     # this plugin does not compile without -fomit-frame-pointer, damn gcc!
715     CFLAGS_i420_yuy2_mmx="${CFLAGS_i420_yuy2_mmx} -fomit-frame-pointer"
716 fi
717
718 dnl Check for -mdynamic-no-pic
719 AC_CACHE_CHECK([if \$CC accepts -mdynamic-no-pic],
720     [ac_cv_c_dynamic_no_pic],
721     [CFLAGS="${CFLAGS_save} -mdynamic-no-pic"
722      AC_TRY_COMPILE([],,ac_cv_c_dynamic_no_pic=yes, ac_cv_c_dynamic_no_pic=no)])
723 if test "x${ac_cv_c_dynamic_no_pic}" != "xno"; then
724     CFLAGS_builtins="${CFLAGS_builtins} -mdynamic-no-pic"
725     CFLAGS_libvlc="${CFLAGS_libvlc} -mdynamic-no-pic"
726 fi
727
728 dnl Check for Darwin plugin linking flags
729 AC_CACHE_CHECK([if \$CC accepts -bundle -undefined error -lcc_dynamic],
730     [ac_cv_ld_darwin],
731     [CFLAGS="${CFLAGS_save} -bundle -undefined error -lcc_dynamic"
732      AC_TRY_COMPILE([],,ac_cv_ld_darwin=yes, ac_cv_ld_darwin=no)])
733 if test "x${ac_cv_ld_darwin}" != "xno"; then
734     LDFLAGS_plugins="${LDFLAGS_plugins} -bundle -undefined error -lcc_dynamic"
735 fi
736
737 dnl Check for standard plugin linking flags
738 dnl BeOS' gcc needs -nostart instead of -shared, even if -shared isn't harmful (just a warning)
739 if test "x${SYS}" = "xbeos"; then
740     LDFLAGS_plugins="${LDFLAGS_plugins} -nostart"
741 else
742     AC_CACHE_CHECK([if \$CC accepts -shared],
743         [ac_cv_ld_plugins],
744         [CFLAGS="${CFLAGS_save} -shared"
745          AC_TRY_COMPILE([],, ac_cv_ld_plugins=yes, ac_cv_ld_plugins=no)])
746     if test "x${ac_cv_ld_plugins}" != "xno"; then
747         LDFLAGS_plugins="${LDFLAGS_plugins} -shared"
748     fi
749 fi
750
751 dnl Check for variadic macros
752 AC_CACHE_CHECK([for variadic cpp macros],
753     [ac_cv_cpp_variadic_macros],
754     [CFLAGS="${CFLAGS_save}"
755      AC_TRY_COMPILE(
756          [#include <stdio.h>
757           #define a(b,c...) printf(b,##c)],
758          [a("foo");a("%s","bar");a("%s%s","baz","quux");],
759          ac_cv_cpp_variadic_macros=yes,
760          ac_cv_cpp_variadic_macros=no)])
761 if test "x${ac_cv_cpp_variadic_macros}" != "xno"; then
762     AC_DEFINE(HAVE_VARIADIC_MACROS, 1, Support for variadic macros)
763 fi
764
765 dnl Checks for __attribute__(aligned()) directive
766 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
767     [ac_cv_c_attribute_aligned],
768     [ac_cv_c_attribute_aligned=0
769         CFLAGS="${CFLAGS_save} -Werror"
770     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
771         AC_TRY_COMPILE([],
772         [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
773         [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
774     done
775         CFLAGS="${CFLAGS_save}"])
776 if test "x${ac_cv_c_attribute_aligned}" != "x0"; then
777     AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
778         [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
779 fi
780
781 dnl Checks for __attribute__(format()) directive
782 AC_CACHE_CHECK([__attribute__ ((format ())) support with function pointers],
783     [ac_cv_c_attribute_format],
784     [ac_cv_c_attribute_format=no
785         CFLAGS="${CFLAGS_save} -Werror"
786         AC_TRY_COMPILE([],
787         [static void (*pf_printf)(const char *, ...) __attribute__ ((format(printf,1,2)));(void)pf_printf;],
788         [ac_cv_c_attribute_format=yes])
789         CFLAGS="${CFLAGS_save}"])
790 if test "x${ac_cv_c_attribute_format}" != "xno"; then
791     AC_DEFINE(HAVE_ATTRIBUTE_FORMAT, 1, Support for __attribute__((format())) with function pointers)
792 fi
793
794 dnl
795 dnl  Check the CPU
796 dnl
797 case "x${target_cpu}" in
798   x)
799     ARCH=unknown
800     ;;
801   *)
802     ARCH="${target_cpu}"
803     ;;
804 esac
805
806 case "${ARCH}" in
807   hppa64)
808     CFLAGS_mpeg_video_old="${CFLAGS_mpeg_video_old} -ffunction-sections"
809     ;;
810 esac
811
812 dnl
813 dnl  Enable profiling
814 dnl
815 AC_ARG_ENABLE(gprof,
816 [  --enable-gprof          gprof profiling (default disabled)])
817 AC_ARG_ENABLE(cprof,
818 [  --enable-cprof          cprof profiling (default disabled)])
819 AM_CONDITIONAL(GPROF, test "${enable_gprof}" = "yes")
820 AM_CONDITIONAL(CPROF, test "${enable_gprof}" = "yes")
821
822 dnl
823 dnl  default modules
824 dnl
825 #BUILTINS="${BUILTINS} mpeg_video_old idct idctclassic motion"
826 PLUGINS="${PLUGINS} dummy rc logger gestures memcpy"
827 PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts avi asf aac mp4 rawdv"
828 PLUGINS="${PLUGINS} spudec mpeg_audio lpcm a52 dts cinepak"
829 PLUGINS="${PLUGINS} deinterlace invert adjust wall transform distort clone crop motionblur"
830 PLUGINS="${PLUGINS} float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif fixed32tofloat32 fixed32tos16 s16tofixed32 s16tofloat32 s16tofloat32swab s8tofloat32 u8tofixed32 u8tofloat32"
831 PLUGINS="${PLUGINS} trivial_resampler ugly_resampler linear_resampler bandlimited_resampler"
832 PLUGINS="${PLUGINS} trivial_channel_mixer headphone_channel_mixer"
833 PLUGINS="${PLUGINS} trivial_mixer spdif_mixer float32_mixer"
834 PLUGINS="${PLUGINS} aout_file"
835 #PLUGINS="${PLUGINS} scope"
836 PLUGINS="${PLUGINS} i420_rgb i420_yuy2 i422_yuy2 i420_ymga"
837 PLUGINS="${PLUGINS} id3 m3u"
838 PLUGINS="${PLUGINS} rawvideo"
839 PLUGINS="${PLUGINS} wav araw demuxdump demuxsub adpcm a52sys au"
840 PLUGINS="${PLUGINS} access_file access_udp access_http ipv4 access_mms"
841 PLUGINS="${PLUGINS} access_ftp access_directory sap httpd http"
842
843 dnl
844 dnl  Switch to enable a version of VLC where most modules will be builtin
845 dnl
846 AC_ARG_ENABLE(mostly-builtin,
847 [  --enable-mostly-builtin most modules will be built-in (default disabled)])
848 if test "x${enable_mostly_builtin}" = "xyes"; then
849   BUILTINS="${BUILTINS} ${PLUGINS}"
850   PLUGINS=""
851 fi
852
853 dnl
854 dnl Some plugins aren't useful on some platforms
855 dnl
856 if test "x${SYS}" != "xmingw32"; then
857     PLUGINS="${PLUGINS} screensaver"
858 fi
859
860 dnl
861 dnl  Accelerated modules
862 dnl
863 MMX_MODULES="memcpymmx i420_rgb_mmx i422_yuy2_mmx i420_ymga_mmx"
864 #MMX_MODULES="${MMX_MODULES} idctmmx motionmmx"
865 MMXEXT_MODULES="memcpymmxext"
866 #MMXEXT_MODULES="${MMXEXT_MODULES} idctmmxext motionmmxext"
867 THREEDNOW_MODULES="memcpy3dn"
868 SSE_MODULES=""
869 ALTIVEC_MODULES="memcpyaltivec"
870 #ALTIVEC_MODULES="${ALTIVEC_MODULES} idctaltivec motionaltivec"
871
872 if test "${enable_gprof}" != "yes"
873 then
874   MMX_MODULES="${MMX_MODULES} i420_yuy2_mmx"
875 fi
876
877 AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
878     [ac_cv_mmx_inline],
879     [CFLAGS="${CFLAGS_save}"
880      AC_TRY_COMPILE(,[void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));],
881                     ac_cv_mmx_inline=yes, ac_cv_mmx_inline=no)])
882 if test "x${ac_cv_mmx_inline}" != "xno"; then
883   ACCEL_MODULES="${ACCEL_MODULES} ${MMX_MODULES}"
884 fi
885
886 AC_CACHE_CHECK([if \$CC groks MMX EXT inline assembly],
887     [ac_cv_mmxext_inline],
888     [CFLAGS="${CFLAGS_save}"
889      AC_TRY_COMPILE(,[void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));],
890                     ac_cv_mmxext_inline=yes, ac_cv_mmxext_inline=no)])
891 if test "x${ac_cv_mmxext_inline}" != "xno"; then
892   ACCEL_MODULES="${ACCEL_MODULES} ${MMXEXT_MODULES}"
893 fi
894
895 AC_CACHE_CHECK([if \$CC groks 3D Now! inline assembly],
896     [ac_cv_3dnow_inline],
897     [CFLAGS="${CFLAGS_save}"
898      AC_TRY_COMPILE(,[void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));],
899                     ac_cv_3dnow_inline=yes, ac_cv_3dnow_inline=no)])
900 if test "x${ac_cv_3dnow_inline}" != "xno"; then
901   AC_DEFINE(CAN_COMPILE_3DNOW, 1, Define if \$CC groks 3D Now! inline assembly.)
902   ACCEL_MODULES="${ACCEL_MODULES} ${THREEDNOW_MODULES}"
903 fi
904
905 AC_CACHE_CHECK([if \$CC groks SSE inline assembly],
906     [ac_cv_sse_inline],
907     [CFLAGS="${CFLAGS_save}"
908      AC_TRY_COMPILE(,[void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));],
909                     ac_cv_sse_inline=yes, ac_cv_sse_inline=no)])
910 if test "x${ac_cv_sse_inline}" != "xno" -a "x${SYS}" != "xmingw32"; then
911   AC_DEFINE(CAN_COMPILE_SSE, 1, Define if \$CC groks SSE inline assembly.)
912   ACCEL_MODULES="${ACCEL_MODULES} ${SSE_MODULES}"
913 fi
914
915 if test "x${SYS}" != "xmingw32"; then
916 AC_CACHE_CHECK([if \$CC groks AltiVec inline assembly],
917     [ac_cv_altivec_inline],
918     [CFLAGS="${CFLAGS_save}"
919      AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
920          ac_cv_altivec_inline=yes,
921          [CFLAGS="${CFLAGS_save} -Wa,-m7400"
922           AC_TRY_COMPILE(,[asm volatile("vperm 0,1,2,3");],
923             [ac_cv_altivec_inline="-Wa,-m7400"],
924             ac_cv_altivec_inline=no)
925          ])])
926 if test "x${ac_cv_altivec_inline}" != "xno"; then
927   AC_DEFINE(CAN_COMPILE_ALTIVEC, 1, Define if \$CC groks AltiVec inline assembly.)
928   if test "x${ac_cv_altivec_inline}" != "xyes"; then
929     CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_altivec_inline}"
930     CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_altivec_inline}"
931     CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_altivec_inline}"
932     CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_altivec_inline}"
933   fi
934   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
935 fi
936
937 AC_CACHE_CHECK([if \$CC groks AltiVec C extensions],
938     [ac_cv_c_altivec],
939     [CFLAGS="${CFLAGS_save} -faltivec"
940      # Darwin test
941      AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
942         ac_cv_c_altivec=-faltivec, [
943         # Linux/PPC test
944         CFLAGS="${CFLAGS_save} ${CFLAGS_idctaltivec} -fvec"
945         AC_TRY_COMPILE(,[vec_mtvscr((vector unsigned int)(0));],
946             [ac_cv_c_altivec="-fvec"], ac_cv_c_altivec=no)
947         ])
948      CFLAGS="${CFLAGS_save}"])
949 if test "x${ac_cv_c_altivec}" != "xno"; then
950   AC_DEFINE(CAN_COMPILE_C_ALTIVEC, 1, Define if your compiler groks C AltiVec extensions.)
951   CFLAGS_idctaltivec="${CFLAGS_idctaltivec} ${ac_cv_c_altivec}"
952   CFLAGS_motionaltivec="${CFLAGS_motionaltivec} ${ac_cv_c_altivec}"
953   CFLAGS_memcpyaltivec="${CFLAGS_memcpyaltivec} ${ac_cv_c_altivec}"
954   CFLAGS_vlc="${CFLAGS_vlc} ${ac_cv_c_altivec}"
955   ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
956 fi
957
958 AC_CACHE_CHECK([if linker needs -framework vecLib],
959     [ac_cv_ld_altivec],
960     [LDFLAGS="${LDFLAGS_vlc} -framework vecLib"
961      AC_TRY_LINK([],,ac_cv_ld_altivec=yes,ac_cv_ld_altivec=no)
962      LDFLAGS="${LDFLAGS_save}"
963     ])
964 if test "x${ac_cv_ld_altivec}" != "xno"; then
965   LDFLAGS_idctaltivec="${LDFLAGS_idctaltivec} -framework vecLib"
966   LDFLAGS_motionaltivec="${LDFLAGS_motionaltivec} -framework vecLib"
967   LDFLAGS_memcpyaltivec="${LDFLAGS_memcpyaltivec} -framework vecLib"
968   LDFLAGS_vlc="${LDFLAGS_vlc} -framework vecLib"
969 fi
970 fi # end "x$SYS" != "xmingw32"
971
972 AC_ARG_WITH(,[])
973 AC_ARG_WITH(,[Optimization options:])
974
975 dnl
976 dnl  Special arch tuning
977 dnl
978 AC_ARG_WITH(tuning,
979 [  --with-tuning=ARCH      enable special tuning for an architecture
980                           (default i686 on IA-32 and 750 on PPC)])
981 if test "x${with_tuning}" != "x"; then
982     if test "x${target_cpu}" = "xpowerpc"; then
983         CFLAGS_TUNING="-mtune=${with_tuning}"
984     else
985         CFLAGS_TUNING="-mcpu=${with_tuning}"
986     fi
987 else
988     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"
989     else
990         if test "x${target_cpu}" = "xpowerpc"; then CFLAGS_TUNING="-mtune=750"; fi
991     fi
992 fi
993
994 dnl
995 dnl  x86 accelerations
996 dnl
997 if test "x${target_cpu}" = "xi686" -o "x${target_cpu}" = "xi586" -o "x${target_cpu}" = "xx86" -o "x${target_cpu}" = "xi386"
998 then
999     ARCH="${ARCH} mmx"
1000     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"
1001 fi
1002
1003 dnl
1004 dnl  Enable/disable optimizations
1005 dnl
1006 AC_ARG_ENABLE(optimizations,
1007 [  --disable-optimizations disable compiler optimizations (default enabled)])
1008 AM_CONDITIONAL(OPTIM, test "x${enable_optimizations}" != "xno")
1009
1010 dnl
1011 dnl  AltiVec acceleration
1012 dnl
1013 AC_ARG_ENABLE(altivec,
1014 [  --disable-altivec       disable AltiVec optimizations (default enabled on PPC)],
1015 [ if test "x${enable_altivec}" = "xyes"; then ARCH="${ARCH} altivec";
1016     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ],
1017 [ if test "x${target_cpu}" = "xpowerpc"; then ARCH="${ARCH} altivec";
1018     BUILTINS="${BUILTINS} ${ACCEL_MODULES}"; fi ])
1019
1020 dnl
1021 dnl  Debugging mode
1022 dnl
1023 AC_ARG_ENABLE(debug,
1024 [  --enable-debug          debug mode (default disabled)])
1025 AM_CONDITIONAL(DEBUG, test "x${enable_debug}" = "xyes")
1026
1027 dnl
1028 dnl  Enable release-specific flags
1029 dnl
1030 AC_ARG_ENABLE(release,
1031 [  --enable-release        activate extra optimizations (default disabled)])
1032 AM_CONDITIONAL(RELEASE, test "x${enable_release}" = "xyes")
1033
1034 dnl
1035 dnl Stream output
1036 dnl
1037 AC_ARG_ENABLE(sout,
1038   [  --enable-sout           Stream output modules (default enabled)])
1039 if test "x${enable_sout}" != "xno"
1040 then
1041   PLUGINS="${PLUGINS} access_output_dummy access_output_udp access_output_file access_output_http"
1042   PLUGINS="${PLUGINS} mux_ts mux_ps mux_avi mux_dummy"
1043   PLUGINS="${PLUGINS} packetizer_mpegaudio packetizer_mpegvideo packetizer_a52"
1044   PLUGINS="${PLUGINS} packetizer_mpeg4video packetizer_mpeg4audio"
1045   PLUGINS="${PLUGINS} packetizer_copy"
1046
1047   PLUGINS="${PLUGINS} stream_out_dummy stream_out_standard stream_out_es"
1048   PLUGINS="${PLUGINS} stream_out_duplicate stream_out_display"
1049
1050     dnl Ogg/ogm
1051     AC_CHECK_HEADERS(ogg/ogg.h, [
1052       AC_CHECK_LIB( ogg, ogg_stream_packetin, [
1053         PLUGINS="${PLUGINS} mux_ogg"
1054         LDFLAGS_mux_ogg="${LDFLAGS_mux_ogg} -logg" ])
1055     ],[])
1056 fi
1057
1058
1059 dnl
1060 dnl  Input plugins
1061 dnl
1062
1063 AC_ARG_WITH(,[Input plugins:])
1064
1065 dnl
1066 dnl  DVD module: optionally check for installed libdvdcss
1067 dnl
1068 AC_ARG_ENABLE(dvd,
1069 [  --enable-dvd            DVD input module (default enabled)])
1070 if test "x${enable_dvd}" != "xno"
1071 then
1072   AC_ARG_WITH(dvdcss,
1073   [    --with-dvdcss=PATH    libdvdcss headers and libraries])
1074   AC_ARG_WITH(dvdcss-tree,
1075   [    --with-dvdcss-tree=PATH libdvdcss tree for static linking])
1076   case "x${with_dvdcss}" in
1077   x|xyes)
1078     if test "x${with_dvdcss_tree}" = x
1079     then
1080       AC_CHECK_HEADERS(dvdcss/dvdcss.h,
1081         [ PLUGINS="${PLUGINS} dvd"
1082           LDFLAGS_dvd="${LDFLAGS_dvd} -ldvdcss"
1083           LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -ldvdcss" ],
1084         [ 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.])
1085           AC_MSG_ERROR([cannot find libdvdcss headers]) ])
1086     else
1087       AC_MSG_CHECKING(for libdvdcss.a in ${with_dvdcss_tree})
1088       real_dvdcss_tree="`cd ${with_dvdcss_tree} 2>/dev/null && pwd`"
1089       if test "x${real_dvdcss_tree}" = "x"
1090       then
1091         dnl  The given directory can't be found
1092         AC_MSG_RESULT(no)
1093         AC_MSG_ERROR([cannot cd to ${with_dvdcss_tree}])
1094       fi
1095       if test -f "${real_dvdcss_tree}/src/.libs/libdvdcss.a"
1096       then
1097         dnl  Use a custom libdvdcss
1098         AC_MSG_RESULT(${real_dvdcss_tree}/src/.libs/libdvdcss.a)
1099         BUILTINS="${BUILTINS} dvd"
1100         LDFLAGS_dvd="${LDFLAGS_dvd} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
1101         LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${real_dvdcss_tree}/src/.libs -ldvdcss"
1102         CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${real_dvdcss_tree}/src"
1103       else
1104         dnl  The given libdvdcss wasn't built
1105         AC_MSG_RESULT(no)
1106         AC_MSG_ERROR([cannot find ${real_dvdcss_tree}/src/.libs/libdvdcss.a, make sure you compiled libdvdcss in ${with_dvdcss_tree}])
1107       fi
1108     fi
1109   ;;
1110   xno)
1111     dnl  Compile without dvdcss (dlopen version, works only under Linux)
1112     PLUGINS="${PLUGINS} dvd"
1113     CPPFLAGS_dvd="${CPPFLAGS_dvd} -DGOD_DAMN_DMCA"
1114     LDFLAGS_dvd="${LDFLAGS_dvd} -ldl"
1115   ;;
1116   *)
1117     AC_MSG_CHECKING(for dvdcss headers in ${with_dvdcss})
1118     if test -f ${with_dvdcss}/include/dvdcss/dvdcss.h
1119     then
1120       dnl  Use ${with_dvdcss}/include/dvdcss/dvdcss.h
1121       AC_MSG_RESULT(yes)
1122       PLUGINS="${PLUGINS} dvd"
1123       LDFLAGS_dvd="${LDFLAGS_dvd} -L${with_dvdcss}/lib -ldvdcss"
1124       LDFLAGS_dvdcss="${LDFLAGS_dvdcss} -L${with_dvdcss}/lib -ldvdcss"
1125       CPPFLAGS_dvd="${CPPFLAGS_dvd} -I${with_dvdcss}/include"
1126     else
1127       dnl  No libdvdcss could be found, sorry
1128       AC_MSG_RESULT(no)
1129       AC_MSG_ERROR([cannot find ${with_dvdcss}/include/dvdcss/dvdcss.h])
1130     fi
1131   ;;
1132   esac
1133 fi
1134
1135 dnl
1136 dnl dvdread module: check for libdvdread
1137 dnl
1138 AC_ARG_ENABLE(dvdread,
1139 [  --enable-dvdread        dvdread input module (default disabled)])
1140 if test "x${enable_dvdread}" != "xno"
1141 then
1142   AC_ARG_WITH(dvdread,
1143   [    --with-dvdread=PATH    libdvdread headers and libraries])
1144   AC_ARG_WITH(dvdread-tree,
1145   [    --with-dvdread-tree=PATH libdvdread tree for static linking])
1146   if test "x${with_dvdread}" = x
1147   then
1148     if test "x${with_dvdread_tree}" = x
1149     then
1150       AC_CHECK_HEADERS(dvdread/dvd_reader.h,
1151         [ PLUGINS="${PLUGINS} dvdread"
1152           LDFLAGS_dvdread="${LDFLAGS_dvdread} -ldvdread ${LDFLAGS_dvdcss}" ],
1153         [ if test "x${enable_dvdread}" != "x"
1154           then
1155             AC_MSG_WARN([Please get libdvdread from http://www.dtek.chalmers.se/groups/dvd/downloads.shtml])
1156             AC_MSG_ERROR([cannot find libdvdread headers])
1157           fi ])
1158     else
1159       AC_MSG_CHECKING(for libdvdread.a in ${with_dvdread_tree})
1160       real_dvdread_tree="`cd ${with_dvdread_tree} 2>/dev/null && pwd`"
1161       if test "x${real_dvdread_tree}" = "x"
1162       then
1163         dnl  The given directory can't be found
1164         AC_MSG_RESULT(no)
1165         AC_MSG_ERROR([cannot cd to ${with_dvdread_tree}])
1166       fi
1167       if test -f "${real_dvdread_tree}/dvdread/.libs/libdvdread.a"
1168       then
1169         dnl  Use a custom libdvdread
1170         AC_MSG_RESULT(${real_dvdread_tree}/dvdread/.libs/libdvdread.a)
1171         BUILTINS="${BUILTINS} dvdread"
1172         LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${real_dvdread_tree}/dvdread/.libs -ldvdread ${LDFLAGS_dvdcss}"
1173         CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${real_dvdread_tree}"
1174       else
1175         dnl  The given libdvdread wasn't built
1176         AC_MSG_RESULT(no)
1177         AC_MSG_ERROR([cannot find ${real_dvdread_tree}/dvdread/.libs/libdvdread.a, make sure you compiled libdvdread in ${with_dvdread_tree}])
1178       fi
1179     fi
1180   else
1181     AC_MSG_CHECKING(for dvdread headers in ${with_dvdread})
1182     if test -f ${with_dvdread}/include/dvdread/dvd_reader.h
1183     then
1184       dnl  Use ${with_dvdread}/include/dvdread/dvd_reader.h
1185       AC_MSG_RESULT(yes)
1186       PLUGINS="${PLUGINS} dvdread"
1187       LDFLAGS_dvdread="${LDFLAGS_dvdread} -L${with_dvdread}/lib -ldvdread ${LDFLAGS_dvdcss}"
1188       CPPFLAGS_dvdread="${CPPFLAGS_dvdread} -I${with_dvdread}/include"
1189     else
1190       dnl  No libdvdread could be found, sorry
1191       AC_MSG_RESULT(no)
1192       AC_MSG_ERROR([cannot find ${with_dvdread}/include/dvdread/dvd_reader.h])
1193     fi
1194   fi
1195 fi
1196
1197 dnl
1198 dnl dvdplay module: check for libdvdplay
1199 dnl
1200 AC_ARG_ENABLE(dvdplay,
1201 [  --enable-dvdplay        dvdplay input module (default enabled)])
1202 if test "x${enable_dvdplay}" != "xno"
1203 then
1204   AC_ARG_WITH(dvdplay,
1205   [    --with-dvdplay=PATH    libdvdplay headers and libraries])
1206   AC_ARG_WITH(dvdplay-tree,
1207   [    --with-dvdplay-tree=PATH libdvdplay tree for static linking])
1208   if test "x${with_dvdplay}" = x
1209   then
1210     if test "x${with_dvdplay_tree}" = x
1211     then
1212       AC_CHECK_HEADERS(dvdplay/dvdplay.h,
1213         [ PLUGINS="${PLUGINS} dvdplay"
1214           LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1215           CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread}" ],
1216         [ if test "x${enable_dvdplay}" != "x"
1217           then
1218             AC_MSG_WARN([Please get libdvdplay from http://www.videolan.org/.])
1219             AC_MSG_ERROR([cannot find libdvdplay headers])
1220           fi ])
1221     else
1222       AC_MSG_CHECKING(for libdvdplay.a in ${with_dvdplay_tree})
1223       real_dvdplay_tree="`cd ${with_dvdplay_tree} 2>/dev/null && pwd`"
1224       if test "x${real_dvdplay_tree}" = "x"
1225       then
1226         dnl  The given directory can't be found
1227         AC_MSG_RESULT(no)
1228         AC_MSG_ERROR([cannot cd to ${with_dvdplay_tree}])
1229       fi
1230       if test -f "${real_dvdplay_tree}/src/.libs/libdvdplay.a"
1231       then
1232         dnl  Use a custom libdvdplay
1233         AC_MSG_RESULT(${real_dvdplay_tree}/src/.libs/libdvdplay.a)
1234         BUILTINS="${BUILTINS} dvdplay"
1235         LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${real_dvdplay_tree}/src/.libs -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1236         CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${real_dvdplay_tree}/src"
1237       else
1238         dnl  The given libdvdplay wasn't built
1239         AC_MSG_RESULT(no)
1240         AC_MSG_ERROR([cannot find ${real_dvdplay_tree}/src/.libs/libdvdplay.a, make sure you compiled libdvdplay in ${with_dvdplay_tree}])
1241       fi
1242     fi
1243   else
1244     AC_MSG_CHECKING(for dvdplay headers in ${with_dvdplay})
1245     if test -f ${with_dvdplay}/include/dvdplay/dvdplay.h
1246     then
1247       dnl  Use ${with_dvdplay}/include/dvdplay/dvdplay.h
1248       AC_MSG_RESULT(yes)
1249       PLUGINS="${PLUGINS} dvdplay"
1250       LDFLAGS_dvdplay="${LDFLAGS_dvdplay} -L${with_dvdplay}/lib -ldvdplay ${LDFLAGS_dvdread} ${LDFLAGS_dvdcss}"
1251       CPPFLAGS_dvdplay="${CPPFLAGS_dvdplay} ${CPPFLAGS_dvdread} -I${with_dvdplay}/include"
1252     else
1253       dnl  No libdvdplay could be found, sorry
1254       AC_MSG_RESULT(no)
1255       AC_MSG_ERROR([cannot find ${with_dvdplay}/include/dvdplay/dvdplay.h])
1256     fi
1257   fi
1258 fi
1259
1260 dnl
1261 dnl  libdvbpsi ts demux/mux
1262 dnl
1263 AC_ARG_ENABLE(dvbpsi,
1264 [  --enable-dvbpsi         dvbpsi ts mux and demux module (default enabled)])
1265 if test "x${enable_dvbpsi}" != "xno"
1266 then
1267   AC_ARG_WITH(dvbpsi,
1268   [    --with-dvbpsi=PATH    libdvbpsi headers and libraries])
1269   AC_ARG_WITH(dvbpsi,
1270   [    --with-dvbpsi-tree=PATH libdvbpsi tree for static linking])
1271   case "x${with_dvbpsi}" in
1272   x|xyes)
1273     if test "x${with_dvbpsi_tree}" = "x"
1274     then
1275       AC_CHECK_HEADERS(dvbpsi/dr.h,
1276         [ PLUGINS="${PLUGINS} ts_dvbpsi"
1277           LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -ldvbpsi" 
1278           PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1279           LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -ldvbpsi" ],
1280         [  AC_MSG_WARN([cannot find libdvbpsi headers]) ],
1281         [#if defined( HAVE_STDINT_H )
1282 #   include <stdint.h>
1283 #elif defined( HAVE_INTTYPES_H )
1284 #   include <inttypes.h>
1285 #endif
1286 #include <dvbpsi/dvbpsi.h>
1287 #include <dvbpsi/descriptor.h>
1288 #include <dvbpsi/pat.h>
1289 #include <dvbpsi/pmt.h>])
1290     else
1291       AC_MSG_CHECKING(for libdvbpsi.a in ${with_dvbpsi_tree})
1292       real_dvbpsi_tree="`cd ${with_dvbpsi_tree} 2>/dev/null && pwd`"
1293       if test "x${real_dvbpsi_tree}" = "x"
1294       then
1295         dnl  The given directory can't be found
1296         AC_MSG_RESULT(no)
1297         AC_MSG_ERROR([cannot cd to ${with_dvbpsi_tree}])
1298       fi
1299       if test -f "${real_dvbpsi_tree}/src/.libs/libdvbpsi.a"
1300       then
1301         dnl  Use a custom libdvbpsi
1302         AC_MSG_RESULT(${real_dvbpsi_tree}/src/.libs/libdvbpsi.a)
1303         BUILTINS="${BUILTINS} ts_dvbpsi"
1304         LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1305         CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1306
1307         BUILTINS="${BUILTINS} mux_ts_dvbpsi"
1308         LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} -L${real_dvbpsi_tree}/src/.libs -ldvbpsi"
1309         CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} -I${real_dvbpsi_tree}/src"
1310
1311       else
1312         dnl  The given libdvbpsi wasn't built
1313         AC_MSG_RESULT(no)
1314         AC_MSG_ERROR([cannot find ${real_dvbpsi_tree}/src/.libs/libdvbpsi.a, make sure you compiled libdvbpsi in ${with_dvbpsi_tree}])
1315       fi
1316     fi
1317   ;;
1318   xno)
1319     dnl  Compile without dvbpsi
1320   ;;
1321   *)
1322     AC_MSG_CHECKING(for dvbpsi headers in ${with_dvbpsi})
1323     if test "x${with_dvbpsi}" = "x"
1324     then
1325       LDFLAGS_test=""
1326       CPPFLAGS_test=""
1327     else
1328       LDFLAGS_test="-L${with_dvbpsi}/lib"
1329       CPPFLAGS_test="-I${with_dvbpsi}/include"
1330     fi
1331     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test}"
1332     AC_CHECK_HEADER([dvbpsi/dr.h],[
1333       PLUGINS="${PLUGINS} ts_dvbpsi"
1334       LDFLAGS_ts_dvbpsi="${LDFLAGS_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1335       CPPFLAGS_ts_dvbpsi="${CPPFLAGS_ts_dvbpsi} ${CPPFLAGS_test}"
1336       PLUGINS="${PLUGINS} mux_ts_dvbpsi"
1337       LDFLAGS_mux_ts_dvbpsi="${LDFLAGS_mux_ts_dvbpsi} ${LDFLAGS_test} -ldvbpsi"
1338       CPPFLAGS_mux_ts_dvbpsi="${CPPFLAGS_mux_ts_dvbpsi} ${CPPFLAGS_test}"
1339
1340       ],[
1341       if test "x${enable_dvbpsi}" != "x"
1342       then
1343         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])
1344       fi
1345     ])
1346     CPPFLAGS="${CPPFLAGS_save}"
1347   ;;
1348   esac
1349 fi
1350
1351 dnl
1352 dnl  Video4Linux plugin
1353 dnl
1354 AC_ARG_ENABLE(v4l,
1355   [  --enable-v4l            Video4Linux input support (default disabled)])
1356 if test "x${enable_v4l}" = "xyes"
1357 then
1358   AC_CHECK_HEADERS(linux/videodev.h, [
1359     PLUGINS="${PLUGINS} v4l"
1360    ],[])
1361 fi
1362
1363 dnl
1364 dnl  special access module for Hauppauge PVR cards
1365 dnl
1366 AC_ARG_ENABLE(pvr,
1367   [  --enable-pvr            PVR cards access module (default disabled)])
1368 if test "x${enable_pvr}" = "xyes"
1369 then
1370   PLUGINS="${PLUGINS} pvr"
1371 fi
1372
1373 dnl
1374 dnl  VCD module
1375 dnl
1376 AC_ARG_ENABLE(vcd,
1377   [  --enable-vcd            VCD support for Linux, FreeBSD, MacOS X and Win32 (default enabled)])
1378
1379 if test "x${enable_vcd}" != "xno"
1380 then
1381   AC_MSG_CHECKING(for cdrom_msf0 in linux/cdrom.h)
1382   AC_EGREP_HEADER(cdrom_msf0,linux/cdrom.h,[
1383     AC_MSG_RESULT(yes)
1384     PLUGINS="${PLUGINS} vcd cdda"
1385   ],[
1386     AC_MSG_RESULT(no)
1387   ])
1388
1389   AC_MSG_CHECKING(for scsireq in sys/scsiio.h)
1390   AC_EGREP_HEADER(scsireq,sys/scsiio.h,[
1391     AC_MSG_RESULT(yes)
1392     PLUGINS="${PLUGINS} vcd cdda"
1393     AC_DEFINE(HAVE_SCSIREQ_IN_SYS_SCSIIO_H, 1, For NetBSD VCD support)
1394   ],[
1395     AC_MSG_RESULT(no)
1396   ])
1397
1398   AC_MSG_CHECKING(for ioc_toc_header in sys/cdio.h)
1399   AC_EGREP_HEADER(ioc_toc_header ,sys/cdio.h,[
1400     AC_MSG_RESULT(yes)
1401     PLUGINS="${PLUGINS} vcd cdda"
1402     AC_DEFINE(HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H, 1, For FreeBSD VCD support)
1403   ],[
1404     AC_MSG_RESULT(no)
1405   ])
1406
1407   if test "x${SYS}" = "xbsdi" -o "x${SYS}" = "xmingw32"
1408   then
1409     PLUGINS="${PLUGINS} vcd cdda"
1410   fi
1411
1412   if test "x${SYS}" = "xdarwin"
1413   then
1414     PLUGINS="${PLUGINS} vcd cdda"
1415     LDFLAGS_vcd="${LDFLAGS_vcd} -framework IOKit -framework CoreFoundation"
1416     LDFLAGS_cdda="${LDFLAGS_cdda} -framework IOKit -framework CoreFoundation"
1417   fi
1418 fi
1419
1420 dnl
1421 dnl  Satellite input module
1422 dnl
1423 AC_ARG_ENABLE(satellite,
1424   [  --enable-satellite      satellite card support (default disabled)],
1425   [ if test "x${enable_satellite}" = "xyes"
1426     then
1427       PLUGINS="${PLUGINS} satellite"
1428     fi])
1429
1430 dnl
1431 dnl  ipv6 plugin - not for QNX yet
1432 dnl
1433 if test "x${SYS}" != "xnto" && test "x${SYS}" != "xmingw32"
1434 then
1435   have_ipv6=false
1436   AC_CHECK_FUNCS(inet_pton,[have_ipv6=:],[
1437     AC_CHECK_LIB(resolv,inet_pton,
1438       [have_ipv6=:
1439        LDFLAGS_ipv6="${LDFLAGS_ipv6} -lresolv"])
1440   ])
1441   AC_MSG_CHECKING(for sockaddr_in6 in netinet/in.h)
1442   AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,
1443     [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); have_ipv6=false])
1444   if ${have_ipv6}; then
1445     PLUGINS="${PLUGINS} ipv6"
1446   fi
1447 fi
1448 if test "x${SYS}" = "xmingw32"
1449 then
1450   AC_MSG_CHECKING(for getaddrinfo in ws2tcpip.h)
1451   AC_EGREP_HEADER(addrinfo,ws2tcpip.h,[AC_MSG_RESULT(yes)
1452     PLUGINS="${PLUGINS} ipv6"],[AC_MSG_RESULT(no)])
1453 fi
1454
1455 dnl
1456 dnl  ogg plugin
1457 dnl
1458 AC_ARG_ENABLE(ogg,
1459   [  --enable-ogg            Ogg demux support (default enabled)])
1460 if test "x${enable_ogg}" != "xno"
1461 then
1462   AC_CHECK_HEADERS(ogg/ogg.h, [
1463     AC_CHECK_LIB( ogg, oggpack_read, [
1464       PLUGINS="${PLUGINS} ogg"
1465       LDFLAGS_ogg="${LDFLAGS_ogg} -logg"
1466       AC_CHECK_LIB( ogg, oggpackB_read, [
1467         CPPFLAGS_ogg="${CPPFLAGS_ogg} -DHAVE_OGGPACKB"])])
1468    ],[])
1469 fi
1470
1471 dnl
1472 dnl  Codec plugins
1473 dnl
1474
1475 AC_ARG_WITH(,[Codec plugins:])
1476
1477 dnl
1478 dnl  mad plugin
1479 dnl
1480 AC_ARG_ENABLE(mad,
1481   [  --enable-mad            libmad module (default enabled)])
1482 if test "x${enable_mad}" != "xno"
1483 then
1484   AC_ARG_WITH(mad,
1485     [    --with-mad=PATH       path to libmad],[],[])
1486   if test "x${with_mad}" != "xno" -a "x${with_mad}" != "x"
1487   then
1488     CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${with_mad}/include"
1489     LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${with_mad}/lib"
1490   fi
1491
1492   AC_ARG_WITH(mad-tree,
1493     [    --with-mad-tree=PATH  mad tree for static linking],[],[])
1494   if test "x${with_mad_tree}" != "xno" -a "x${with_mad_tree}" != "x"
1495   then
1496     real_mad_tree="`cd ${with_mad_tree} 2>/dev/null && pwd`"
1497     if test "x${real_mad_tree}" = "x"
1498     then
1499       dnl  The given directory can't be found
1500       AC_MSG_RESULT(no)
1501       AC_MSG_ERROR([${with_mad_tree} directory doesn't exist])
1502     fi
1503     dnl  Use a custom libmad
1504     AC_MSG_CHECKING(for mad.h in ${real_mad_tree}/libmad)
1505     if test -f ${real_mad_tree}/libmad/mad.h
1506     then
1507       AC_MSG_RESULT(yes)
1508       CPPFLAGS_mpgatofixed32="${CPPFLAGS_mpgatofixed32} -I${real_mad_tree}/libmad"
1509       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -L${real_mad_tree}/libmad/.libs"
1510       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1511       AC_CHECK_LIB(mad, mad_bit_init, [
1512         BUILTINS="${BUILTINS} mpgatofixed32"
1513         LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad"
1514         ],[ AC_MSG_ERROR([the specified tree hasn't been compiled ])
1515       ],[])
1516       LDFLAGS="${LDFLAGS_save}"
1517     else
1518       AC_MSG_RESULT(no)
1519       AC_MSG_ERROR([the specified tree doesn't have mad.h])
1520     fi
1521   else
1522     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_mpgatofixed32}"
1523     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_mpgatofixed32}"
1524     AC_CHECK_HEADERS(mad.h, ,
1525       [ AC_MSG_ERROR([Could not find libmad on your system: you may get it from http://www.underbit.com/products/mad/. Alternatively you can use --disable-mad to disable the mad plugin.]) ])
1526     AC_CHECK_LIB(mad, mad_bit_init, [
1527       PLUGINS="${PLUGINS} mpgatofixed32"
1528       LDFLAGS_mpgatofixed32="${LDFLAGS_mpgatofixed32} -lmad" ],
1529       [ AC_MSG_ERROR([Cannot find libmad library...]) ])
1530     CPPFLAGS="${CPPFLAGS_save}"
1531     LDFLAGS="${LDFLAGS_save}"
1532   fi
1533 fi
1534
1535 dnl
1536 dnl   libid3tag support
1537 dnl
1538 AC_CHECK_HEADERS(id3tag.h, [
1539   AC_CHECK_HEADERS(zlib.h, [
1540     LDFLAGS_id3tag="${LDFLAGS_id3tag} -lid3tag -lz"
1541     PLUGINS="${PLUGINS} id3tag"]) ])
1542
1543 dnl
1544 dnl  ffmpeg decoder plugin
1545 dnl
1546 AC_ARG_ENABLE(ffmpeg,
1547 [  --enable-ffmpeg         ffmpeg codec (default enabled)])
1548 if test "x${enable_ffmpeg}" != "xno"
1549 then
1550   AC_ARG_WITH(ffmpeg-tree,
1551     [    --with-ffmpeg-tree=PATH ffmpeg tree for static linking])
1552
1553   dnl
1554   dnl test for !(--with-ffmpeg-tree)
1555   dnl
1556   if test "x${with_ffmpeg_tree}" == "xno" -o "x${with_ffmpeg_tree}" == "x";then
1557     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_ffmpeg}"
1558     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_ffmpeg}"
1559     AC_CHECK_HEADERS(ffmpeg/avcodec.h postproc/postprocess.h)
1560     AC_CHECK_LIB(avcodec, avcodec_init, [
1561       BUILTINS="${BUILTINS} ffmpeg stream_out_transcode"
1562       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -lavcodec"
1563       dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
1564       dnl       linker would miserably barf on multiple definitions.
1565       LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode}" ],
1566        [ AC_MSG_ERROR([Could not find ffmpeg on your system: you may get it from http://ffmpeg.sf.net/ (cvs version is recommended). Alternatively you can use --disable-ffmpeg to disable the ffmpeg plugins.]) ])
1567     LDFLAGS="${LDFLAGS_save}"
1568     CPPFLAGS="${CPPFLAGS_save}"
1569   fi
1570
1571   dnl
1572   dnl test for --with-ffmpeg-tree
1573   dnl
1574   if test "x${with_ffmpeg_tree}" != "xno" -a "x${with_ffmpeg_tree}" != "x";then
1575     AC_MSG_CHECKING(for libavcodec.a in ${with_ffmpeg_tree})
1576     real_ffmpeg_tree="`cd ${with_ffmpeg_tree} 2>/dev/null && pwd`"
1577     if test "x${real_ffmpeg_tree}" = x; then
1578       dnl  The given directory can't be found
1579       AC_MSG_RESULT(no)
1580       AC_MSG_ERROR([cannot cd to ${with_ffmpeg_tree}])
1581     fi
1582     if test -f "${real_ffmpeg_tree}/libavcodec/libavcodec.a"; then
1583       dnl  Use a custom libffmpeg
1584       AC_MSG_RESULT(${real_ffmpeg_tree}/libavcodec/libavcodec.a)
1585       BUILTINS="${BUILTINS} ffmpeg stream_out_transcode"
1586       LDFLAGS_ffmpeg="${LDFLAGS_ffmpeg} -L${real_ffmpeg_tree}/libavcodec -lavcodec"
1587       CPPFLAGS_ffmpeg="${CPPFLAGS_ffmpeg} -I${real_ffmpeg_tree}/libavcodec"
1588
1589       dnl  XXX: we don't link with -lavcodec a 2nd time because the OS X
1590       dnl       linker would miserably barf on multiple definitions.
1591       LDFLAGS_stream_out_transcode="${LDFLAGS_stream_out_transcode} -L${real_ffmpeg_tree}/libavcodec"
1592       CPPFLAGS_stream_out_transcode="${CPPFLAGS_stream_out_transcode} -I${real_ffmpeg_tree}/libavcodec"
1593     else
1594       dnl  The given libavcodec wasn't built
1595       AC_MSG_RESULT(no)
1596       AC_MSG_ERROR([cannot find ${real_ffmpeg_tree}/libavcodec/libavcodec.a, make sure you compiled libavcodec in ${with_ffmpeg_tree}])
1597     fi
1598   fi
1599
1600   dnl Duplicate the ffmpeg CPPFLAGS and LDFLAGS for the encoder
1601   CPPFLAGS_encoder_ffmpeg="${CPPFLAGS_ffmpeg}"
1602   dnl XXX: we don't link with -lavcodec blah blah blah
1603   #LDFLAGS_encoder_ffmpeg="${LDFLAGS_ffmpeg}"
1604
1605   dnl Add postprocessing modules
1606   PLUGINS="${PLUGINS} postprocessing_c"
1607   if test "x${ac_cv_mmx_inline}" != "xno"; then
1608     PLUGINS="${PLUGINS} postprocessing_mmx"
1609   fi
1610
1611   if test "x${ac_cv_mmxext_inline}" != "xno"; then
1612     PLUGINS="${PLUGINS} postprocessing_mmxext"
1613   fi
1614 fi
1615
1616 dnl
1617 dnl  faad decoder plugin
1618 dnl
1619 AC_ARG_ENABLE(faad,
1620 [  --enable-faad           faad codec (default disabled)])
1621 if test "x${enable_faad}" = "xyes"
1622 then
1623   AC_ARG_WITH(faad,
1624     [    --with-faad=PATH      path to faad installation],[],[])
1625   if test "x${with_faad}" != "xno" -a "x${with_faad}" != "x"
1626   then
1627     CPPFLAGS_faad="${CPPFLAGS_faad} -I${with_faad}/include"
1628     LDFLAGS_faad="${LDFLAGS_faad} -L${with_faad}/lib"
1629   fi
1630   LDFLAGS_faad="${LDFLAGS_faad}"
1631
1632   AC_ARG_WITH(faad-tree,
1633   [    --with-faad-tree=PATH faad tree for static linking])
1634   if test "x${with_faad_tree}" != "x"
1635   then
1636     AC_MSG_CHECKING(for libfaad.a in ${with_faad_tree})
1637     real_faad_tree="`cd ${with_faad_tree} 2>/dev/null && pwd`"
1638     if test "x${real_faad_tree}" = x
1639     then
1640       dnl  The given directory can't be found
1641       AC_MSG_RESULT(no)
1642       AC_MSG_ERROR([cannot cd to ${with_faad_tree}])
1643     fi
1644     if test -f "${real_faad_tree}/libfaad/.libs/libfaad.a"
1645     then
1646       dnl  Use a custom faad
1647       AC_MSG_RESULT(${real_faad_tree}/libfaad/.libs/libfaad.a)
1648       BUILTINS="${BUILTINS} faad"
1649       LDFLAGS_faad="${LDFLAGS_faad} -L${real_faad_tree}/libfaad/.libs -lfaad"
1650       CPPFLAGS_faad="${CPPFLAGS_faad} -I${real_faad_tree}/include"
1651     else
1652       dnl  The given libfaad wasn't built
1653       AC_MSG_RESULT(no)
1654       AC_MSG_ERROR([cannot find ${real_faad_tree}/libfaad/.libs/libfaad.a, make sure you compiled libfaad in ${with_faad_tree}])
1655     fi
1656   else
1657     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_faad}"
1658     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_faad}"
1659     AC_CHECK_HEADERS(faad.h, ,
1660       [ AC_MSG_ERROR([Cannot find development headers for libfaad...]) ])
1661     AC_CHECK_LIB(faad, faacDecOpen, [
1662       PLUGINS="${PLUGINS} faad"
1663       LDFLAGS_faad="${LDFLAGS_faad} -lfaad" ],
1664       [ AC_MSG_ERROR([Cannot find libfaad library...]) ])
1665     LDFLAGS="${LDFLAGS_save}"
1666     CPPFLAGS="${CPPFLAGS_save}"
1667   fi
1668 fi
1669
1670
1671 dnl
1672 dnl  xvid decoder plugin
1673 dnl
1674 AC_ARG_ENABLE(xvid,
1675 [  --enable-xvid           xvid codec (default disabled)])
1676 if test "x${enable_xvid}" = "xyes"
1677 then
1678   AC_ARG_WITH(xvid,
1679     [    --with-xvid=PATH      path to xvid installation],[],[])
1680   if test "x${with_xvid}" != "xno" -a "x${with_xvid}" != "x"
1681   then
1682     CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${with_xvid}/include"
1683     LDFLAGS_xvid="${LDFLAGS_xvid} -L${with_xvid}/lib"
1684   fi
1685   LDFLAGS_xvid="${LDFLAGS_xvid}"
1686
1687   AC_ARG_WITH(xvid-tree,
1688   [    --with-xvid-tree=PATH xvid tree for static linking])
1689   if test "x${with_xvid_tree}" != "x"
1690   then
1691     AC_MSG_CHECKING(for libxvidcore.a in ${with_xvid_tree})
1692     real_xvid_tree="`cd ${with_xvid_tree} 2>/dev/null && pwd`"
1693     if test "x${real_xvid_tree}" = x
1694     then
1695       dnl  The given directory can't be found
1696       AC_MSG_RESULT(no)
1697       AC_MSG_ERROR([cannot cd to ${with_xvid_tree}])
1698     fi
1699     if test -f "${real_xvid_tree}/build/generic/libxvidcore.a"
1700     then
1701       dnl  Use a custom xvid
1702       AC_MSG_RESULT(${real_xvid_tree}/build/generic/libxvidcore.a)
1703       BUILTINS="${BUILTINS} xvid"
1704       LDFLAGS_xvid="${LDFLAGS_xvid} -L${real_xvid_tree}/build/generic -lxvidcore"
1705       CPPFLAGS_xvid="${CPPFLAGS_xvid} -I${real_xvid_tree}/src"
1706     else
1707       dnl  The given libxvidcore wasn't built
1708       AC_MSG_RESULT(no)
1709       AC_MSG_ERROR([cannot find ${real_xvid_tree}/build/generic/libxvidcore.a, make sure you compiled libxvidcore in ${with_xvid_tree}])
1710     fi
1711   else
1712     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_xvid}"
1713     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_xvid}"
1714     AC_CHECK_HEADERS(xvid.h, ,
1715       [ AC_MSG_ERROR([Cannot find development headers for libxvidcore...]) ])
1716     AC_CHECK_LIB(xvidcore, xvid_init, [
1717       PLUGINS="${PLUGINS} xvid"
1718       LDFLAGS_xvid="${LDFLAGS_xvid} -lxvidcore" ],
1719       [ AC_MSG_ERROR([Cannot find libxvidcore library...]) ])
1720     LDFLAGS="${LDFLAGS_save}"
1721     CPPFLAGS="${CPPFLAGS_save}"
1722   fi
1723
1724   dnl Duplicate the xvid CPPFLAGS and LDFLAGS for the encoder
1725   LDFLAGS_encoder_xvid=${LDFLAGS_xvid}
1726   CPPFLAGS_encoder_xvid=${CPPFLAGS_xvid}
1727 fi
1728
1729 dnl
1730 dnl  QuickTime plugin
1731 dnl
1732 AC_ARG_ENABLE(quicktime,
1733   [  --enable-quicktime      QuickTime module (default enabled on MacOS X)])
1734 if test "x${enable_quicktime}" != "xno" &&
1735   (test "x${SYS}" = "xdarwin" || test "x${enable_quicktime}" = "xyes")
1736 then
1737   AC_CHECK_HEADERS(QuickTime/QuickTime.h,
1738     [ BUILTINS="${BUILTINS} quicktime"
1739       LDFLAGS_quicktime="${LDFLAGS_quicktime} -framework QuickTime -framework Carbon"
1740     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
1741 fi
1742
1743 dnl
1744 dnl MP4 module
1745 dnl
1746 AC_CHECK_HEADERS(zlib.h, [
1747   LDFLAGS_mp4="${LDFLAGS_mp4} -lz"
1748   LDFLAGS_skins="${LDFLAGS_skins} -lz"
1749   LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lz"
1750 ] )
1751
1752
1753 dnl
1754 dnl skins module
1755 dnl
1756 AC_CHECK_HEADERS(libtar.h, [
1757   LDFLAGS_skins="${LDFLAGS_skins} -ltar"
1758   LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -ltar"
1759 ] )
1760
1761
1762
1763 dnl
1764 dnl  a52 AC3 decoder plugin
1765 dnl
1766 AC_ARG_ENABLE(a52,
1767   [  --enable-a52            A/52 support with liba52 (default enabled)])
1768 if test "x${enable_a52}" != "xno"
1769 then
1770   AC_ARG_WITH(a52,
1771     [    --with-a52=PATH       a52 headers and libraries])
1772   AC_ARG_WITH(a52-tree,
1773     [    --with-a52-tree=PATH  a52dec tree for static linking ],[],[])
1774   if test "x${with_a52_tree}" != "xno" -a "x${with_a52_tree}" != "x"
1775   then
1776     real_a52_tree="`cd ${with_a52_tree} 2>/dev/null && pwd`"
1777     if test "x${real_a52_tree}" = "x"
1778     then
1779       dnl  The given directory can't be found
1780       AC_MSG_RESULT(no)
1781       AC_MSG_ERROR([${with_a52_tree} directory doesn't exist])
1782     fi
1783     dnl  Use a custom a52dec
1784     AC_MSG_CHECKING(for a52.h in ${real_a52_tree}/include)
1785     if test -f ${real_a52_tree}/include/a52.h
1786     then
1787       AC_MSG_RESULT(yes)
1788       CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -I${real_a52_tree}"
1789       LDFLAGS_a52tofloat32="${LDFLAGS_a52tofloat32} -L${real_a52_tree}/liba52/.libs"
1790       LDFLAGS="${LDFLAGS_save} ${LDFLAGS_a52tofloat32}"
1791       AC_CHECK_LIB(a52, a52_free, [
1792         BUILTINS="${BUILTINS} a52tofloat32"
1793         LDFLAGS_a52tofloat32="-la52 ${LDFLAGS_a52tofloat32}"
1794         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} -DUSE_A52DEC_TREE"
1795         ],[
1796         if test -f ${real_a52_tree}/liba52/.libs/liba52.a
1797         then
1798           AC_MSG_ERROR([make sure you have at least a52dec-0.7.3])
1799         else
1800           AC_MSG_ERROR([the specified tree hasn't been compiled])
1801         fi
1802       ])
1803       LDFLAGS="${LDFLAGS_save}"
1804     else
1805       AC_MSG_RESULT(no)
1806       AC_MSG_ERROR([the specified tree doesn't have a52.h])
1807     fi
1808   else
1809     if test "x${with_a52}" = "x"
1810     then
1811       LDFLAGS_test=""
1812       CPPFLAGS_test=""
1813     else
1814       LDFLAGS_test="-L${with_a52}/lib"
1815       CPPFLAGS_test="-I${with_a52}/include"
1816     fi
1817     CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_test} ${CPPFLAGS_a52tofloat32}"
1818     LDFLAGS="${LDFLAGS_save} ${LDFLAGS_test} ${LDFLAGS_a52tofloat32}"
1819     AC_CHECK_HEADERS(a52dec/a52.h, [
1820       AC_CHECK_LIB(a52, a52_free, [
1821         PLUGINS="${PLUGINS} a52tofloat32"
1822         LDFLAGS_a52tofloat32="${LDFLAGS_test} -la52 ${LDFLAGS_a52tofloat32}"
1823         CPPFLAGS_a52tofloat32="${CPPFLAGS_a52tofloat32} ${CPPFLAGS_test}"
1824       ],[
1825         AC_MSG_ERROR([Could not find liba52 on your system: you may get it from http://liba52.sf.net/. Alternatively you can use --disable-a52 to disable the a52 plugin.])
1826       ])
1827     ])
1828     CPPFLAGS="${CPPFLAGS_save}"
1829     LDFLAGS="${LDFLAGS_save}"
1830   fi
1831 fi
1832
1833 dnl
1834 dnl  DV plugin
1835 dnl
1836 AC_ARG_ENABLE(dv,
1837   [  --enable-dv             DV decoder support (deprecated in favor of ffmpeg) (default disabled)])
1838 if test "x${enable_dv}" = "xyes"
1839 then
1840   AC_CHECK_HEADERS(libdv/dv.h, [
1841     PLUGINS="${PLUGINS} dv"
1842     LDFLAGS_dv="${LDFLAGS_dv} -ldv"
1843    ],[])
1844 fi
1845
1846 dnl
1847 dnl  Flac plugin
1848 dnl
1849 AC_ARG_ENABLE(flac,
1850   [  --enable-flac           flac decoder support (default disabled)])
1851 if test "x${enable_flac}" = "xyes"
1852 then
1853   AC_CHECK_HEADERS(FLAC/stream_decoder.h, [
1854     PLUGINS="${PLUGINS} flac flacdec"
1855     LDFLAGS_flacdec="${LDFLAGS_flacdec} -lFLAC"
1856    ],[])
1857 fi
1858
1859 dnl
1860 dnl  Libmpeg2 plugin
1861 dnl
1862 AC_ARG_ENABLE(libmpeg2,
1863   [  --enable-libmpeg2       libmpeg2 decoder support (default enabled)])
1864 if test "x${enable_libmpeg2}" != "xno"
1865 then
1866   AC_ARG_WITH(libmpeg2-tree,
1867   [    --with-libmpeg2-tree=PATH libmpeg2 tree for static linking])
1868   if test "x${with_libmpeg2_tree}" != "x"
1869   then
1870     AC_MSG_CHECKING(for libmpeg2.a in ${with_libmpeg2_tree})
1871     real_libmpeg2_tree="`cd ${with_libmpeg2_tree} 2>/dev/null && pwd`"
1872     if test "x${real_libmpeg2_tree}" = x
1873     then
1874       dnl  The given directory can't be found
1875       AC_MSG_RESULT(no)
1876       AC_MSG_ERROR([cannot cd to ${with_libmpeg2_tree}])
1877     fi
1878     if test -f "${real_libmpeg2_tree}/libmpeg2/.libs/libmpeg2.a"
1879     then
1880       dnl  Use a custom libmpeg2
1881       AC_MSG_RESULT(${real_libmpeg2_tree}/libmpeg2/.libs/libmpeg2.a)
1882       PLUGINS="${PLUGINS} libmpeg2"
1883       LDFLAGS_libmpeg2="${LDFLAGS_libmpeg2} -L${real_libmpeg2_tree}/libmpeg2/.libs -lmpeg2"
1884       CFLAGS_libmpeg2="${CFLAGS_libmpeg2} -I${real_libmpeg2_tree}/include"
1885       eval "`cd ${real_libmpeg2_tree}/include && ln -sf . mpeg2dec 2>/dev/null`"
1886     else
1887       dnl  The given libmpeg2 wasn't built
1888       AC_MSG_RESULT(no)
1889       AC_MSG_ERROR([cannot find ${real_libmpeg2_tree}/libmpeg2/.libs/libmpeg2.a, make sure you compiled libmpeg2 in ${with_libmpeg2_tree}])
1890     fi
1891   else
1892     AC_CHECK_HEADERS(mpeg2dec/mpeg2.h, [
1893       AC_MSG_CHECKING(for libmpeg2 version >= 0.3.2)
1894       AC_EGREP_CPP(yes,
1895         [#include <mpeg2dec/mpeg2.h>
1896          #ifdef MPEG2_RELEASE
1897          #if MPEG2_RELEASE >= MPEG2_VERSION(0,3,2)
1898          yes
1899          #endif
1900          #endif],
1901         [AC_MSG_RESULT([yes])
1902           PLUGINS="${PLUGINS} libmpeg2"
1903           LDFLAGS_libmpeg2="${LDFLAGS_libmpeg2} -lmpeg2"],
1904         [AC_MSG_RESULT([no])
1905           AC_MSG_ERROR([Your libmpeg2 is too old (you need the cvs version): you may get a more recent one from http://libmpeg2.sf.net/. Alternatively you can use --disable-libmpeg2 to disable the libmpeg2 plugin.])])],
1906
1907       [AC_MSG_ERROR([Could not find libmpeg2 on your system: you may get it from http://libmpeg2.sf.net/ (you need the cvs version). Alternatively you can use --disable-libmpeg2 to disable the libmpeg2 plugin.])]
1908     )
1909   fi
1910 fi
1911
1912 dnl
1913 dnl  Vorbis plugin
1914 dnl
1915 AC_ARG_ENABLE(vorbis,
1916   [  --enable-vorbis         Vorbis decoder support (default enabled)])
1917 if test "x${enable_vorbis}" != "xno"
1918 then
1919   AC_CHECK_HEADERS(vorbis/codec.h, [
1920     PLUGINS="${PLUGINS} vorbis"
1921     LDFLAGS_vorbis="${LDFLAGS_vorbis} -lvorbis -logg"
1922    ],[])
1923 fi
1924
1925 dnl
1926 dnl  Tremor plugin
1927 dnl
1928 AC_ARG_ENABLE(tremor,
1929   [  --enable-tremor         Tremor decoder support (default disabled)])
1930 if test "x${enable_tremor}" = "xyes"
1931 then
1932   AC_CHECK_HEADERS(tremor/ivorbiscodec.h, [
1933     PLUGINS="${PLUGINS} tremor"
1934     LDFLAGS_tremor="${LDFLAGS_tremor} -lvorbisidec -logg"
1935    ],[])
1936 fi
1937
1938 dnl
1939 dnl  tarkin decoder plugin
1940 dnl
1941 AC_ARG_ENABLE(tarkin,
1942 [  --enable-tarkin         experimental tarkin codec (default disabled)])
1943 if test "x${enable_tarkin}" = "xyes"
1944 then
1945   AC_ARG_WITH(tarkin-tree,
1946   [    --with-tarkin-tree=PATH tarkin tree for static linking])
1947   if test "x${with_tarkin_tree}" != "x"
1948   then
1949     AC_MSG_CHECKING(for tarkin.o in ${with_tarkin_tree})
1950     real_tarkin_tree="`cd ${with_tarkin_tree} 2>/dev/null && pwd`"
1951     if test -f "${real_tarkin_tree}/tarkin.o"
1952     then
1953       BUILTINS="${BUILTINS} tarkin"
1954       CPPFLAGS_tarkin="${CPPFLAGS_tarkin} -I${real_tarkin_tree}"
1955       LDFLAGS_tarkin="${LDFLAGS_tarkin} ${real_tarkin_tree}/mem.o ${real_tarkin_tree}/pnm.o ${real_tarkin_tree}/wavelet.o ${real_tarkin_tree}/wavelet_xform.o ${real_tarkin_tree}/wavelet_coeff.o ${real_tarkin_tree}/yuv.o ${real_tarkin_tree}/tarkin.o ${real_tarkin_tree}/info.o -logg"
1956       AC_MSG_RESULT(yes)
1957     else
1958       dnl  The given tarkin tree wasn't built
1959       AC_MSG_RESULT(no)
1960       AC_MSG_ERROR([cannot find ${real_tarkin_tree}/tarkin.o,
1961                     make sure you compiled tarkin in ${with_tarkin_tree}])
1962     fi
1963   fi
1964 fi
1965
1966 dnl
1967 dnl  theora decoder plugin
1968 dnl
1969 AC_ARG_ENABLE(theora,
1970 [  --enable-theora         experimental theora codec (default disabled)])
1971 if test "x${enable_theora}" = "xyes"
1972 then
1973   AC_CHECK_HEADERS(theora/theora.h, [
1974     AC_CHECK_LIB(theora, theora_granule_time, [
1975       BUILTINS="${BUILTINS} theora"
1976       LDFLAGS_theora="${LDFLAGS_theora} -ltheora -logg" ],[
1977       AC_MSG_ERROR([libtheora doesn't appear to be installed on you system.
1978 You also need to check that you have a libogg posterior to the 1.0 release.])],
1979       [-logg])
1980   ])
1981 fi
1982
1983 dnl
1984 dnl  Video plugins
1985 dnl
1986
1987 AC_ARG_WITH(,[Video plugins:])
1988
1989 dnl Check for DPMS
1990 if test "x${SYS}" != "xmingw32"
1991 then
1992   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
1993   AC_CHECK_HEADERS(X11/extensions/dpms.h, [
1994     AC_MSG_CHECKING(for DPMSInfo in X11/extensions/dpms.h)
1995     AC_EGREP_HEADER(DPMSInfo,X11/extensions/dpms.h,[
1996       AC_MSG_RESULT(yes)
1997       AC_DEFINE(DPMSINFO_IN_DPMS_H, 1,
1998                 Define if <X11/extensions/dpms.h> defines DPMSInfo.)
1999     ],[
2000       AC_MSG_RESULT(no)
2001     ])
2002   ],,[
2003     #include <X11/Xlib.h>
2004   ])
2005   CPPFLAGS="${CPPFLAGS_save}"
2006 fi
2007
2008 dnl
2009 dnl  X11 module
2010 dnl  (enabled by default except on win32)
2011 dnl
2012 AC_ARG_ENABLE(x11,
2013   [  --enable-x11            X11 support (default enabled)])
2014 if test "x${enable_x11}" != "xno" &&
2015   (test "x${SYS}" != "xmingw32" || test "x${enable_x11}" = "xyes"); then
2016   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
2017   AC_CHECK_HEADERS(X11/Xlib.h, [
2018     PLUGINS="${PLUGINS} x11"
2019     LDFLAGS_x11="${LDFLAGS_x11} -L${x_libraries} -lX11 -lXext"
2020     CPPFLAGS_x11="${CPPFLAGS_x11} -I${x_includes}"
2021     AC_CHECK_HEADERS(X11/extensions/Xinerama.h, [
2022       CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
2023       AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
2024         AC_DEFINE(HAVE_XINERAMA,1,[Define this if you have libXinerama installed])
2025         LDFLAGS_x11="${LDFLAGS_x11} -lXinerama")
2026       CFLAGS="${CFLAGS_save}"
2027     ])
2028   ])
2029   CPPFLAGS="${CPPFLAGS_save}"
2030 fi
2031
2032 dnl
2033 dnl  XVideo module
2034 dnl  (enabled by default except on win32)
2035 dnl
2036 AC_ARG_ENABLE(xvideo,
2037   [  --enable-xvideo         XVideo support (default enabled)])
2038 if test "x${enable_xvideo}" != "xno" &&
2039   (test "x${SYS}" != "xmingw32" || test "x${enable_xvideo}" = "xyes"); then
2040   CPPFLAGS="${CPPFLAGS_save} -I${x_includes}"
2041   AC_CHECK_HEADERS(X11/extensions/Xv.h, [
2042     CFLAGS="${CFLAGS_save} -L${x_libraries} -lX11 -lXext"
2043     AC_CHECK_LIB(Xv_pic,XvPutImage,
2044       # We have Xv_pic, that's good, we can build an xvideo.so plugin !
2045       PLUGINS="${PLUGINS} xvideo"
2046       LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv_pic"
2047       CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
2048       AC_CHECK_LIB(Xv,XvPutImage,
2049         # We don't have Xv_pic, but we have Xv, let's make xvideo.a as builtin
2050         PLUGINS="${PLUGINS} xvideo"
2051         LDFLAGS_xvideo="${LDFLAGS_xvideo} -L${x_libraries} -lX11 -lXext -lXv"
2052         CPPFLAGS_xvideo="${CPPFLAGS_xvideo} -I${x_includes}",
2053         # Otherwise... well, do nothing.
2054         :
2055       )
2056     )
2057     AC_CHECK_HEADERS(X11/extensions/Xinerama.h, [
2058       AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
2059         AC_DEFINE(HAVE_XINERAMA,1,[Define this if you have libXinerama installed])
2060         LDFLAGS_xvideo="${LDFLAGS_xvideo} -lXinerama")
2061     ])
2062     CFLAGS="${CFLAGS_save}"
2063   ]
2064   CPPFLAGS="${CPPFLAGS_save}")
2065 fi
2066
2067 dnl
2068 dnl  SDL module
2069 dnl
2070 AC_ARG_ENABLE(sdl,
2071   [  --enable-sdl            SDL support (default enabled)])
2072 if test "x${enable_sdl}" != "xno"
2073 then
2074   SDL_PATH="${PATH}"
2075   AC_ARG_WITH(sdl-config-path,
2076     [    --with-sdl-config-path=PATH sdl-config path (default search in \$PATH)],
2077     [ if test "x${with_sdl_config_path}" != "xno"
2078       then
2079         SDL_PATH="${with_sdl_config_path}:${PATH}"
2080       fi ])
2081   AC_PATH_PROG(SDL12_CONFIG, sdl12-config, no, ${SDL_PATH})
2082   SDL_CONFIG="${SDL12_CONFIG}"
2083   SDL_HEADER="SDL12/SDL.h"
2084   if test "x${SDL_CONFIG}" = "xno"
2085   then
2086     AC_PATH_PROG(SDL11_CONFIG, sdl11-config, no, ${SDL_PATH})
2087     SDL_CONFIG=${SDL11_CONFIG}
2088     SDL_HEADER="SDL11/SDL.h"
2089   fi
2090   if test "x${SDL_CONFIG}" = "xno"
2091   then
2092     AC_PATH_PROG(SDL_CONFIG, sdl-config, no, ${SDL_PATH})
2093     SDL_HEADER="SDL/SDL.h"
2094   fi
2095   # check for cross-compiling
2096   SDL_PREFIX=
2097   AC_ARG_WITH(sdl-prefix,
2098     [    --with-sdl-prefix=PATH path to libsdl (needed for cross-compiling),
2099                                e.g use as:
2100                                --with-sdl-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2101   if test "x${with_sdl_prefix}" != "xno" -a "x${with_sdl_prefix}" != "x"
2102   then
2103     SDL_PREFIX="--prefix=${with_sdl_prefix}"
2104   fi
2105   if test "x${SDL_CONFIG}" != "xno"
2106   then
2107     PLUGINS="${PLUGINS} vout_sdl aout_sdl"
2108     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
2109     LDFLAGS_vout_sdl="${LDFLAGS_vout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
2110     CFLAGS_aout_sdl="${CFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --cflags | sed 's,SDL,,'`"
2111     LDFLAGS_aout_sdl="${LDFLAGS_aout_sdl} `${SDL_CONFIG} ${SDL_PREFIX} --libs | sed 's,-rdynamic,,'`"
2112     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_vout_sdl}"
2113     AC_CHECK_HEADERS(${SDL_HEADER}, AC_DEFINE_UNQUOTED(SDL_INCLUDE_FILE,
2114       <${SDL_HEADER}>, Indicate whether we should use SDL/SDL.h or SDL11/SDL.h),
2115       [ AC_CHECK_HEADERS(SDL.h, AC_DEFINE(SDL_INCLUDE_FILE, <SDL.h>,
2116           As a last resort we also test for SDL.h presence),
2117       [ AC_MSG_ERROR([The development package for SDL is not installed.
2118 Please install it and try again. Alternatively you can also configure with
2119 --disable-sdl.])
2120       ])])
2121     CPPFLAGS="${CPPFLAGS_save}"
2122     if expr 1.1.5 \> `${SDL_CONFIG} --version` >/dev/null
2123     then
2124       AC_MSG_ERROR([The development package for SDL is not installed.
2125 Please install it and try again. Alternatively you can also configure with
2126 --disable-sdl.])
2127     fi
2128   elif test "x${enable_sdl}" =  "xyes"
2129   then
2130     AC_MSG_ERROR([I couldn't find the SDL package. You can download libSDL
2131 from http://www.libsdl.org/, or configure with --disable-sdl. Have a nice day.
2132     ])
2133   fi
2134 fi
2135
2136 dnl
2137 dnl  freetype module
2138 dnl
2139 AC_ARG_ENABLE(freetype,
2140   [  --enable-freetype       freetype support (default enabled)])
2141 if test "x${enable_freetype}" != "xno"
2142 then
2143   FREETYPE_PATH="${PATH}"
2144   AC_ARG_WITH(freetype-config-path,
2145     [    --with-freetype-config-path=PATH freetype-config path (default search in \$PATH)],
2146     [ if test "x${with_freetype_config_path}" != "xno"
2147       then
2148         FREETYPE_PATH="${with_freetype_config_path}:${PATH}"
2149       fi ])
2150   AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no, ${FREETYPE_PATH})
2151
2152   if test "x${FREETYPE_CONFIG}" != "xno"
2153   then
2154     PLUGINS="${PLUGINS} osdtext"
2155     CFLAGS_osdtext="${CFLAGS_osdtext} `${FREETYPE_CONFIG} --cflags`"
2156     LDFLAGS_osdtext="${LDFLAGS_osdtext} `${FREETYPE_CONFIG} --libs`"
2157     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_freetype}"
2158   elif test "x${enable_freetype}" =  "xyes"
2159   then
2160     AC_MSG_ERROR([I couldn't find the freetype package. You can download libfreetype2
2161 from http://www.freetype.org/, or configure with --disable-freetype. Have a nice day.
2162     ])
2163   fi
2164 fi
2165
2166 dnl
2167 dnl  Qt Embedded module
2168 dnl  (disabled by default)
2169 dnl
2170 AC_ARG_ENABLE(qte,
2171   [  --enable-qte            QT Embedded support (default disabled)])
2172 if test "x${enable_qte}" = "xyes"
2173 then
2174   AC_ARG_WITH(qte,
2175   [    --with-qte=PATH       Qt Embedded headers and libraries])
2176   if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2177   then
2178     LDFLAGS_qte="${LDFLAGS_qte} -L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2179     CPPFLAGS_qte="${CPPFLAGS_qte} -I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2180   else
2181     LDFLAGS_qte="${LDFLAGS_qte} -L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2182     CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2183   fi
2184   PLUGINS="${PLUGINS} qte"
2185   NEED_QTE_MAIN=yes
2186   CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2187   AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2188     AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2189   ] )
2190   CPPFLAGS="${CPPFLAGS_save}"
2191 fi
2192
2193 dnl
2194 dnl  Windows DirectX module
2195 dnl
2196 AC_ARG_ENABLE(directx,
2197   [  --enable-directx        Win32 DirectX support (default enabled on Win32)])
2198 if test "x${enable_directx}" != "xno"
2199 then
2200   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"
2201   then
2202     AC_ARG_WITH(directx,
2203     [    --with-directx=PATH   Win32 DirectX headers])
2204     if test "x${with_directx}" = "x"
2205     then
2206       AC_CHECK_HEADERS(ddraw.h,
2207       [ PLUGINS="${PLUGINS} vout_directx aout_directx"
2208         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32" ])
2209     else
2210       AC_MSG_CHECKING(for directX headers in ${with_directx})
2211       if test -f ${with_directx}/ddraw.h
2212       then
2213         PLUGINS="${PLUGINS} vout_directx aout_directx"
2214         LDFLAGS_vout_directx="${LDFLAGS_directx} -lgdi32"
2215         CPPFLAGS_vout_directx="${CPPFLAGS_vout_directx} -I${with_directx}"
2216         CPPFLAGS_aout_directx="${CPPFLAGS_aout_directx} -I${with_directx}"
2217         AC_MSG_RESULT(yes)
2218       else
2219         AC_MSG_RESULT(no)
2220         AC_MSG_ERROR([Cannot find ${with_directx}/ddraw.h!])
2221       fi
2222     fi
2223   fi
2224 fi
2225
2226 dnl
2227 dnl  Linux framebuffer module
2228 dnl
2229 AC_ARG_ENABLE(fb,
2230   [  --enable-fb             Linux framebuffer support (default enabled on Linux)])
2231     if test "x${enable_fb}" != "xno"
2232     then
2233       AC_CHECK_HEADERS(linux/fb.h, [
2234         PLUGINS="${PLUGINS} fb"
2235       ])
2236     fi
2237
2238 dnl
2239 dnl  Linux MGA module
2240 dnl
2241 AC_ARG_ENABLE(mga,
2242   [  --enable-mga            Linux kernel Matrox support (default disabled)],
2243   [ if test "x${enable_mga}" = "xyes"
2244     then
2245       PLUGINS="${PLUGINS} mga xmga"
2246     fi ])
2247
2248 dnl
2249 dnl  SVGAlib module
2250 dnl
2251 AC_ARG_ENABLE(svgalib,
2252   [  --enable-svgalib        SVGAlib support (default disabled)])
2253 if test "x${enable_svgalib}" = "xyes"
2254 then
2255   PLUGINS="${PLUGINS} svgalib"
2256   LDFLAGS_svgalib="${LDFLAGS_svgalib} -lvgagl -lvga"
2257 fi
2258
2259 dnl
2260 dnl  GGI module
2261 dnl
2262 AC_ARG_ENABLE(ggi,
2263   [  --enable-ggi            GGI support (default disabled)])
2264 if test "x${enable_ggi}" = "xyes"
2265 then
2266   PLUGINS="${PLUGINS} ggi"
2267   LDFLAGS_ggi="${LDFLAGS_ggi} -lggi"
2268   AC_ARG_WITH(ggi,
2269     [    --with-ggi=PATH       path to libggi],
2270     [ if test "x${with_ggi}" != "xno" -a "x${with_ggi}" != "x"
2271       then
2272         CPPFLAGS_ggi="${CPPFLAGS_ggi} -I${with_ggi}/include"
2273         LDFLAGS_ggi="${LDFLAGS_ggi} -L${with_ggi}/lib"
2274       fi ])
2275 fi
2276
2277 dnl
2278 dnl  Glide module
2279 dnl
2280 AC_ARG_ENABLE(glide,
2281   [  --enable-glide          Glide (3dfx) support (default disabled)])
2282 if test "x${enable_glide}" = "xyes"
2283 then
2284   PLUGINS="${PLUGINS} glide"
2285   LDFLAGS_glide="${LDFLAGS_glide} -lglide2x -lm"
2286   CPPFLAGS_glide="${CPPFLAGS_glide} -I/usr/include/glide"
2287   AC_ARG_WITH(glide,
2288     [    --with-glide=PATH     path to libglide],
2289     [ if test "x${with_glide}" != "xno" -a "x${with_glide}" != "x"
2290       then
2291         CPPFLAGS_glide="${CPPFLAGS_glide} -I${with_glide}/include"
2292         LDFLAGS_glide="${LDFLAGS_glide} -L${with_glide}/lib"
2293       fi ])
2294 fi
2295
2296 dnl
2297 dnl  AA plugin
2298 dnl
2299 AC_ARG_ENABLE(aa,
2300   [  --enable-aa             aalib output (default disabled)])
2301 if test "x${enable_aa}" = "xyes"
2302 then
2303   AC_CHECK_HEADER(aalib.h,have_aa="true",have_aa="false")
2304   if test "x${have_aa}" = "xtrue"
2305   then
2306     PLUGINS="${PLUGINS} aa"
2307     LDFLAGS_aa="${LDFLAGS_aa} -laa"
2308   fi
2309 fi
2310
2311 dnl
2312 dnl  win32 GDI plugin
2313 dnl
2314 AC_ARG_ENABLE(wingdi,
2315   [  --enable-wingdi         Win32 GDI module (default enabled on Win32)])
2316 if test "x${enable_wingdi}" != "xno"; then
2317   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2318     PLUGINS="${PLUGINS} wingdi"
2319     LDFLAGS_wingdi="${LDFLAGS_wingdi} -lgdi32"
2320   fi
2321 fi
2322
2323 dnl
2324 dnl  Audio plugins
2325 dnl
2326
2327 AC_ARG_WITH(,[Audio plugins:])
2328
2329 dnl
2330 dnl  OSS /dev/dsp module (enabled by default except on win32)
2331 dnl
2332 AC_ARG_ENABLE(oss,
2333   [  --enable-oss            Linux OSS /dev/dsp support (enabled on Linux)])
2334
2335 if test "x${enable_oss}" != "xno" &&
2336   (test "x${SYS}" != "xmingw32" || test "x${enable_oss}" = "xyes")
2337 then
2338   AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h, [
2339     PLUGINS="${PLUGINS} oss"
2340     AC_CHECK_LIB(ossaudio,main,LDFLAGS_oss="${LDFLAGS_oss} -lossaudio")
2341   ])
2342 fi
2343
2344 dnl
2345 dnl  Esound module
2346 dnl
2347 AC_ARG_ENABLE(esd,
2348   [  --enable-esd            Esound library support (default disabled)],
2349   [if test "x${enable_esd}" = "xyes"
2350    then
2351      AC_PATH_PROG(ESD_CONFIG, esd-config, no)
2352      if test "x${ESD_CONFIG}" != "xno"
2353      then
2354        PLUGINS="${PLUGINS} esd"
2355        CFLAGS_esd="${CFLAGS_esd} `${ESD_CONFIG} --cflags`"
2356        LDFLAGS_esd="${LDFLAGS_esd} `${ESD_CONFIG} --libs`"
2357      fi
2358    fi])
2359
2360 dnl
2361 dnl  aRts module
2362 dnl
2363 AC_ARG_ENABLE(arts,
2364   [  --enable-arts           aRts sound server (default disabled)],
2365   [if test "x${enable_arts}" = "xyes"
2366    then
2367      AC_PATH_PROG(ARTS_CONFIG, artsc-config, no)
2368      if test "x${ARTS_CONFIG}" != "xno"
2369      then
2370        PLUGINS="${PLUGINS} arts"
2371        CFLAGS_arts="${CFLAGS_arts} `${ARTS_CONFIG} --cflags`"
2372        LDFLAGS_arts="${LDFLAGS_arts} `${ARTS_CONFIG} --libs `"
2373      fi
2374    fi])
2375
2376 dnl
2377 dnl  ALSA module
2378 dnl
2379 AC_ARG_ENABLE(alsa,
2380   [  --enable-alsa           ALSA sound support for Linux (default disabled)],
2381   [if test "x${enable_alsa}" = "xyes"
2382    then
2383      AC_CHECK_HEADER(alsa/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false")
2384      if test "x${have_alsa}" = "xtrue"
2385      then
2386        AC_TRY_COMPILE([#define ALSA_PCM_NEW_HW_PARAMS_API
2387                        #define ALSA_PCM_NEW_SW_PARAMS_API
2388                        #include <alsa/asoundlib.h>],
2389           [void foo() { snd_pcm_hw_params_get_period_time(0,0,0); }],
2390            AC_DEFINE(HAVE_ALSA_NEW_API, 1, Define if ALSA is at least rc4))
2391        PLUGINS="${PLUGINS} alsa"
2392        LDFLAGS_alsa="${LDFLAGS_alsa} -lasound -lm -ldl"
2393      else
2394        AC_MSG_ERROR([Could not find ALSA development headers])
2395      fi
2396    fi])
2397
2398 dnl
2399 dnl  win32 waveOut plugin
2400 dnl
2401 AC_ARG_ENABLE(waveout,
2402   [  --enable-waveout        Win32 waveOut module (default enabled on Win32)])
2403 if test "x${enable_waveout}" != "xno"; then
2404   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2405     PLUGINS="${PLUGINS} waveout"
2406     LDFLAGS_waveout="-lwinmm"
2407   fi
2408 fi
2409
2410 dnl
2411 dnl  CoreAudio plugin
2412 dnl
2413 AC_ARG_ENABLE(coreaudio,
2414   [  --enable-coreaudio      CoreAudio module (default enabled on MacOS X)])
2415 if test "x${enable_coreaudio}" != "xno" &&
2416   (test "x${SYS}" = "xdarwin" || test "x${enable_coreaudio}" = "xyes")
2417 then
2418   AC_CHECK_HEADERS(CoreAudio/CoreAudio.h, 
2419     [ BUILTINS="${BUILTINS} coreaudio"
2420       LDFLAGS_coreaudio="${LDFLAGS_coreaudio} -framework CoreAudio"
2421       AC_MSG_CHECKING(for kAudioConverterPrimeMethod in AudioToolbox/AudioConverter.h)
2422       AC_EGREP_HEADER(kAudioConverterPrimeMethod,AudioToolbox/AudioConverter.h,[
2423         AC_MSG_RESULT(yes)
2424         PLUGINS="${PLUGINS} coreaudio_resampler"
2425         LDFLAGS_coreaudio_resampler="${LDFLAGS_coreaudio_resampler} -framework AudioToolbox"
2426       ],[ AC_MSG_RESULT(no) ])
2427     ], [ AC_MSG_ERROR([cannot find CoreAudio headers]) ])
2428 fi
2429
2430 dnl
2431 dnl  Interface plugins
2432 dnl
2433
2434 AC_ARG_WITH(,[Interface plugins:])
2435
2436 dnl special case for BeOS
2437 if test "x${SYS}" = "xbeos"
2438 then
2439     PLUGINS="${PLUGINS} beos"
2440 fi
2441
2442 dnl
2443 dnl Skins module
2444 dnl
2445 AC_ARG_ENABLE(skins,
2446   [  --enable-skins          Skins interface module (default enabled on Win32)])
2447 if test "x${enable_skins}" != "xno"; then
2448   WXWINDOWS_PATH="${PATH}"
2449   AC_ARG_WITH(skins-wx-config-path,
2450     [    --with-skins-wx-config-path=PATH wx-config path for the skins plugin (default search in \$PATH)],
2451     [ if test "x${with_skins_wx_config_path}" != "xno"
2452       then
2453         WXWINDOWS_PATH="${with_skins_wx_config_path}:${PATH}"
2454       fi ])
2455   # look for wx-config
2456   AC_PATH_PROG(WX_CONFIG_SKINS, wx-config, no, ${WXWINDOWS_PATH})
2457   if test "x${WX_CONFIG_SKINS}" != "xno"
2458   then
2459     if expr 2.3.0 \> `${WX_CONFIG_SKINS} --version` >/dev/null
2460     then
2461       AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-skins.])
2462     fi
2463     CPPFLAGS_skins="${CPPFLAGS_skins} `${WX_CONFIG_SKINS} --cxxflags` -DWX_SKINS"
2464     LDFLAGS_skins="${LDFLAGS_skins} `${WX_CONFIG_SKINS} --libs`"
2465   fi
2466
2467   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2468     PLUGINS="${PLUGINS} skins"
2469     CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -U_OFF_T_ -U_off_t -fno-rtti -Imodules/gui/skins"
2470     LDFLAGS_skins="${LDFLAGS_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
2471   else
2472     if test "x${enable_skins}" = "xyes"; then
2473       IMLIB2_PATH="${PATH}"
2474       AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
2475       if test "x${IMLIB2_CONFIG_SKINS}" = "xno"; then
2476         AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-skins.])
2477       fi
2478
2479       PLUGINS="${PLUGINS} skins"
2480       CPPFLAGS_skins="${CPPFLAGS_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS"
2481       LDFLAGS_skins="${LDFLAGS_skins} -lstdc++ -L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`"
2482       PLUGINS="${PLUGINS} skins"
2483     fi
2484   fi
2485 fi
2486
2487 dnl
2488 dnl Basic skins module (i.e. without wxWindows dialogs)
2489 dnl
2490 AC_ARG_ENABLE(basic-skins,
2491   [  --enable-basic-skins    Skins interface module without wxWindows dialogs (default disabled)])
2492 if test "x${enable_basic_skins}" = "xyes"; then
2493   if test "x${SYS}" = "xmingw32" -o "x${SYS}" = "xcygwin"; then
2494
2495     CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -U_OFF_T_ -U_off_t -fno-rtti -Imodules/gui/skins"
2496     LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lstdc++ -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32"
2497
2498   else
2499     IMLIB2_PATH="${PATH}"
2500     AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
2501     if test "x${IMLIB2_CONFIG_SKINS}" = "xno"; then
2502     AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-basic-skins.])
2503     fi
2504
2505     CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -O2 -fno-rtti -Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS"
2506     LDFLAGS_basic_skins="${LDFLAGS_basic_skins} -lstdc++ -L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`"
2507   fi
2508
2509   PLUGINS="${PLUGINS} basic_skins"
2510   CPPFLAGS_basic_skins="${CPPFLAGS_basic_skins} -DBASIC_SKINS"
2511 fi
2512
2513 dnl
2514 dnl  Gtk+ module
2515 dnl
2516 AC_ARG_ENABLE(gtk,
2517   [  --enable-gtk            Gtk+ support (default enabled)])
2518 if test "x${enable_gtk}" != "xno"
2519 then
2520   GTK_PATH="${PATH}"
2521   AC_ARG_WITH(gtk-config-path,
2522     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2523     [ if test "x${with_gtk_config_path}" != "xno"
2524       then
2525         GTK_PATH="${with_gtk_config_path}:${PATH}"
2526       fi ])
2527   # look for gtk-config
2528   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2529   GTK_CONFIG=${GTK12_CONFIG}
2530   if test "x${GTK_CONFIG}" = "xno"
2531   then
2532     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2533   fi
2534   if test "x${GTK_CONFIG}" != "xno"
2535   then
2536     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2537     then
2538       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.])
2539     fi
2540     if test "x${SYS}" != "xmingw32"; then
2541       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
2542       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
2543     else
2544       CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
2545       LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
2546     fi
2547     # now look for the gtk.h header
2548     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
2549     ac_cv_gtk_headers=yes
2550     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2551       ac_cv_gtk_headers=no
2552       echo "Cannot find gtk development headers."
2553     ])
2554     if test "x${ac_cv_gtk_headers}" = "xyes"
2555     then
2556       PLUGINS="${PLUGINS} gtk"
2557       if test "x${SYS}" != "xmingw32"; then
2558         NEED_GTK_MAIN=yes
2559       fi
2560       ALIASES="${ALIASES} gvlc"
2561     fi
2562     CPPFLAGS="${CPPFLAGS_save}"
2563   fi
2564 fi
2565
2566 dnl
2567 dnl  Gtk+2 module
2568 dnl
2569 AC_ARG_ENABLE(gtk2,
2570   [  --enable-gtk2           Gtk2 support (default disabled)])
2571 if test "x${enable_gtk2}" = "xyes"
2572 then
2573   PKG_CHECK_MODULES(GTK2, [gtk+-2.0 >= 2.0.0, gthread-2.0])
2574   CFLAGS_gtk2="${CFLAGS_gtk2} ${GTK2_CFLAGS}"
2575   LDFLAGS_gtk2="${LDFLAGS_gtk2} ${GTK2_LIBS}"
2576   PLUGINS="${PLUGINS} gtk2"
2577   if test "x${SYS}" != "xmingw32"; then
2578     NEED_GTK2_MAIN=yes
2579   fi
2580 fi
2581
2582 dnl
2583 dnl  Familiar module uses Gtk+ library
2584 dnl
2585 AC_ARG_ENABLE(familiar,
2586   [  --enable-familiar       Familiar Gtk+ support (default disabled)])
2587 if test "x${enable_familiar}" = "xyes"
2588 then
2589   GTK_PATH="${PATH}"
2590   AC_ARG_WITH(gtk-config-path,
2591     [    --with-gtk-config-path=PATH gtk-config path (default search in \$PATH)],
2592     [ if test "x${with_gtk_config_path}" != "xno"
2593       then
2594         GTK_PATH="${with_gtk_config_path}:${PATH}"
2595       fi ])
2596   # look for gtk-config
2597   AC_PATH_PROG(GTK12_CONFIG, gtk12-config, no, ${GTK_PATH})
2598   GTK_CONFIG=${GTK12_CONFIG}
2599   if test "x${GTK_CONFIG}" = "xno"
2600   then
2601     AC_PATH_PROG(GTK_CONFIG, gtk-config, no, ${GTK_PATH})
2602   fi
2603   # check for cross-compiling
2604   GTK_PREFIX=
2605   AC_ARG_WITH(gtk-prefix,
2606     [    --with-gtk-prefix=PATH path to libgtk (needed for cross-compiling),
2607                           e.g use as:
2608                           --with-gtk-prefix=/usr/local/arm/2.95.3/arm-linux/usr)],[],[])
2609   if test "x${with_gtk_prefix}" != "xno" -a "x${with_gtk_prefix}" != "x"
2610   then
2611     GTK_PREFIX="--prefix=$with_gtk_prefix"
2612   fi
2613   if test "x${GTK_CONFIG}" != "xno"
2614   then
2615     if expr 1.2.0 \> `${GTK_CONFIG} --version` >/dev/null
2616     then
2617       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.])
2618     fi
2619     CFLAGS_familiar="${CFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --cflags gtk gthread`"
2620     LDFLAGS_familiar="${LDFLAGS_familiar} `${GTK_CONFIG} ${GTK_PREFIX} --libs gtk gthread | sed 's,-rdynamic,,'`"
2621     # now look for the gtk.h header
2622     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar}"
2623     ac_cv_gtk_headers=yes
2624     AC_CHECK_HEADERS(gtk/gtk.h glib.h gdk/gdk.h, , [
2625       ac_cv_gtk_headers=no
2626       echo "Cannot find gtk development headers."
2627     ])
2628     if test "x${ac_cv_gtk_headers}" = "xyes"
2629     then
2630       PLUGINS="${PLUGINS} familiar"
2631     fi
2632     CPPFLAGS="${CPPFLAGS_save}"
2633
2634     # now look for gpe support
2635     AC_ARG_WITH(gpe-prefix,
2636     [    --with-gpe-prefix=PATH gpe installation path prefix (default search in \$PATH)],[],[])
2637     if test "x$with_gpe_prefix" != "xno"  -a "x$with_gpe_prefix" != "x"
2638     then
2639       CFLAGS_gpe="-I$with_gpe_prefix/include"
2640       LDFLAGS_gpe="-lXi -lgdk_pixbuf -L$with_gpe_prefix/lib -lgpewidget"
2641       # now look for gpe/init.h header file
2642       CFLAGS_save=$CFLAGS
2643       LDFLAGS_save=$LDFLAGS
2644       CFLAGS="${CFLAGS_familiar} ${CFLAGS_gpe}"
2645       LDFLAGS="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2646       CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_familiar} ${CFLAGS_gpe}"
2647       ac_cv_gpe_headers=yes
2648       AC_CHECK_HEADERS(gpe/init.h, ,
2649         [ ac_cv_gpe_headers=no
2650           AC_MSG_ERROR([Cannot find development headers for libgpewidget...]) ])
2651       CFLAGS=$CFLAGS_save
2652       LDFLAGS=$LDFLAG_save
2653       if test "x${ac_cv_gpe_headers}" = "xyes"
2654       then
2655         CFLAGS_familiar="${CFLAGS_familiar} ${CFLAGS_gpe}"
2656         LDFLAGS_familiar="${LDFLAGS_familiar} ${LDFLAGS_gpe}"
2657       fi
2658     else
2659           NEED_GTK_MAIN=yes
2660     fi # end gpe support
2661   fi # end gtk+ support
2662 fi
2663
2664 dnl
2665 dnl  Gnome module
2666 dnl
2667 AC_ARG_ENABLE(gnome,
2668   [  --enable-gnome          Gnome interface support (default disabled)],
2669   [if test "x${enable_gnome}" = "xyes"; then
2670     # look for gnome-config
2671     AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
2672     if test -x ${GNOME_CONFIG}
2673     then
2674        CFLAGS_gnome="${CFLAGS_gnome} `${GNOME_CONFIG} --cflags gtk gnomeui`"
2675        LDFLAGS_gnome="${LDFLAGS_gnome} `${GNOME_CONFIG} --libs gnomeui | sed 's,-rdynamic,,'`"
2676     fi
2677     # now look for the gnome.h header
2678     CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gnome}"
2679     AC_CHECK_HEADERS(gnome.h, [
2680       PLUGINS="${PLUGINS} gnome"
2681       NEED_GTK_MAIN=yes
2682       NEED_GNOME_MAIN=yes
2683       ALIASES="${ALIASES} gnome-vlc"
2684       dnl We need this because of some moronic gnomesupport.h flavours
2685       AC_MSG_CHECKING(for strndup in gnome.h)
2686       AC_EGREP_HEADER(strndup,gnome.h,[
2687         AC_MSG_RESULT(yes)
2688         AC_DEFINE(STRNDUP_IN_GNOME_H, 1,
2689                   Define if <gnome.h> defines strndup.)],[
2690         AC_MSG_RESULT(no)])
2691      ],[
2692       AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
2693 developement tools or remove the --enable-gnome option])
2694      ])
2695     CPPFLAGS="${CPPFLAGS_save}"
2696   fi])
2697
2698 dnl
2699 dnl  Gnome2 module
2700 dnl
2701 AC_ARG_ENABLE(gnome2,
2702   [  --enable-gnome2         Gnome2 support (default disabled)])
2703 if test "x${enable_gnome2}" = "xyes"
2704 then
2705   PKG_CHECK_MODULES(GNOME2, [libgnomeui-2.0])
2706   CFLAGS_gnome2="${CFLAGS_gnome2} ${GNOME2_CFLAGS}"
2707   LDFLAGS_gnome2="${LDFLAGS_gnome2} ${GNOME2_LIBS}"
2708   PLUGINS="${PLUGINS} gnome2"
2709   if test "x${SYS}" != "xmingw32"; then
2710     NEED_GNOME2_MAIN=yes
2711   fi
2712 fi
2713
2714 dnl
2715 dnl  wxWindows module
2716 dnl
2717 AC_ARG_ENABLE(wxwindows,
2718   [  --enable-wxwindows      wxWindows support (default enabled)])
2719 if test "x${enable_wxwindows}" != "xno"
2720 then
2721   WXWINDOWS_PATH="${PATH}"
2722   AC_ARG_WITH(wx-config-path,
2723     [    --with-wx-config-path=PATH wx-config path (default search in \$PATH)],
2724     [ if test "x${with_wx_config_path}" != "xno"
2725       then
2726         WXWINDOWS_PATH="${with_wx_config_path}:${PATH}"
2727       fi ])
2728   # look for wx-config
2729   AC_PATH_PROG(WX_CONFIG, wx-config, no, ${WXWINDOWS_PATH})
2730   if test "x${WX_CONFIG}" != "xno"
2731   then
2732     if expr 2.3.0 \> `${WX_CONFIG} --version` >/dev/null
2733     then
2734       AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-wxwindows.])
2735     fi
2736     CXXFLAGS_wxwindows="${CXXFLAGS_wxwindows} `${WX_CONFIG} --cxxflags`"
2737     LDFLAGS_wxwindows="${LDFLAGS_wxwindows} `${WX_CONFIG} --libs`"
2738     # now look for the wxprec.h header
2739     CPPFLAGS="${CPPFLAGS_save} ${CXXFLAGS_wxwindows}"
2740     ac_cv_wx_headers=yes
2741     AC_CHECK_HEADERS(wx/wxprec.h, , [
2742       ac_cv_wx_headers=no
2743       echo "Cannot find wxWindows development headers."
2744     ])
2745     if test "x${ac_cv_wx_headers}" = "xyes"
2746     then
2747       PLUGINS="${PLUGINS} wxwindows"
2748       ALIASES="${ALIASES} wxvlc"
2749     fi
2750     CPPFLAGS="${CPPFLAGS_save}"
2751   fi
2752 fi
2753
2754 dnl
2755 dnl  Qt module
2756 dnl
2757 AC_ARG_ENABLE(qt,
2758   [  --enable-qt             Qt interface support (default disabled)],
2759   [if test "x${enable_qt}" = "xyes"; then
2760      PLUGINS="${PLUGINS} qt"
2761      ALIASES="${ALIASES} qvlc"
2762      LDFLAGS_qt="${LDFLAGS_qt} -L${QTDIR}/lib"
2763      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_qt}"
2764      AC_CHECK_LIB(qt-mt,main,[
2765        LDFLAGS_qt="${LDFLAGS_qt} -lqt-mt"
2766      ],[
2767        AC_CHECK_LIB(qt,main,[
2768          LDFLAGS_qt="${LDFLAGS_qt} -lqt"
2769        ])
2770      ])
2771      LDFLAGS="${LDFLAGS_save}"
2772      CPPFLAGS_qt="${CPPFLAGS_qt} -I/usr/include/qt3 -I/usr/include/qt -I${QTDIR}/include"
2773      if test -x ${QTDIR}/bin/moc
2774      then
2775        MOC=${QTDIR}/bin/moc
2776      else
2777        MOC=moc
2778      fi
2779    fi])
2780
2781 dnl
2782 dnl  KDE module
2783 dnl
2784 AC_ARG_ENABLE(kde,
2785   [  --enable-kde            KDE interface support (default disabled)],
2786   [if test "x${enable_kde}" = "xyes"; then
2787      PLUGINS="${PLUGINS} kde"
2788      ALIASES="${ALIASES} kvlc"
2789      LDFLAGS_kde="${LDFLAGS_kde} -L${KDEDIR}/lib"
2790      dnl Check for -lkfile (only in KDE 2) or -lkdeui -lkio (KDE 3)
2791      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2792      AC_CHECK_LIB(kfile,main,[
2793        LDFLAGS_kde="${LDFLAGS_kde} -lkfile"
2794      ])
2795      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2796      AC_CHECK_LIB(kdeui,main,[
2797        LDFLAGS_kde="${LDFLAGS_kde} -lkdeui"
2798      ])
2799      LDFLAGS="${LDFLAGS_save} ${LDFLAGS_kde}"
2800      AC_CHECK_LIB(kio,main,[
2801        LDFLAGS_kde="${LDFLAGS_kde} -lkio"
2802      ])
2803      LDFLAGS="${LDFLAGS_save}"
2804      CPPFLAGS_kde="${CPPFLAGS_kde} -I/usr/include/kde -I/usr/include/qt3 -I/usr/include/qt"
2805      CPPFLAGS_kde="${CPPFLAGS_kde} -I${KDEDIR}/include -I${QTDIR}/include"
2806      if test -x ${QTDIR}/bin/moc
2807      then
2808        MOC=${QTDIR}/bin/moc
2809      else
2810        MOC=moc
2811      fi
2812    fi])
2813
2814 dnl
2815 dnl  Opie QT embedded module
2816 dnl
2817 AC_ARG_ENABLE(opie,
2818   [  --enable-opie           Qt embedded interface support (default disabled)],
2819   [if test "x${enable_opie}" = "xyes"; then
2820      AC_ARG_WITH(qte,
2821      [    --with-qte=PATH       Qt Embedded headers and libraries])
2822      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2823      then
2824        LDFLAGS_qte="-L${with_qte}/lib `echo -L${with_qte}/lib | sed 's,opt/QtPalmtop,usr,'` -ljpeg -lqte"
2825        CPPFLAGS_qte="-I${with_qte}/include `echo -I${with_qte}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
2826      else
2827        LDFLAGS_qte="-L${QTDIR}/lib `echo -L${QTDIR}/lib | sed 's,opt/QtPalmtop,usr,'`"
2828        CPPFLAGS_qte="-I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'`"
2829      fi
2830      CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
2831      AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
2832        AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
2833      ] )
2834      CPPFLAGS="${CPPFLAGS_save}"
2835
2836      PLUGINS="${PLUGINS} opie"
2837      NEED_QTE_MAIN=yes
2838      LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
2839      CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
2840      if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
2841      then
2842        MOC=${with_qte}/bin/moc
2843      else
2844        MOC=${QTDIR}/bin/moc
2845      fi
2846    fi])
2847
2848 dnl
2849 dnl  MacOS X module
2850 dnl
2851 AC_ARG_ENABLE(macosx,
2852   [  --enable-macosx         MacOS X support (default enabled on MacOS X)],
2853   [if test "x${enable_macosx}" = "xyes"
2854    then
2855      BUILTINS="${BUILTINS} macosx"
2856      LDFLAGS_macosx="${LDFLAGS_macosx} -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2857    fi],
2858   [AC_CHECK_HEADERS(Cocoa/Cocoa.h,
2859      BUILTINS="${BUILTINS} macosx"
2860      LDFLAGS_macosx="${LDFLAGS_macosx} -framework IOKit -framework Cocoa -framework Carbon -framework QuickTime -lobjc -ObjC"
2861    )])
2862
2863 dnl
2864 dnl  QNX RTOS module
2865 dnl
2866 AC_ARG_ENABLE(qnx,
2867   [  --enable-qnx            QNX RTOS support (default enabled on QNX RTOS)])
2868     if test "x${enable_qnx}" != "xno"
2869     then
2870       AC_CHECK_HEADERS(Ph.h, [
2871         PLUGINS="${PLUGINS} qnx"
2872         LDFLAGS_qnx="${LDFLAGS_qnx} -lasound -lph"
2873       ])
2874     fi
2875
2876 dnl
2877 dnl  ncurses module
2878 dnl
2879 AC_ARG_ENABLE(ncurses,
2880   [  --enable-ncurses        ncurses interface support (default disabled)],
2881   [if test "x${enable_ncurses}" = "xyes"; then
2882      PLUGINS="${PLUGINS} ncurses"
2883      LDFLAGS_ncurses="${LDFLAGS_ncurses} -lncurses"
2884    fi])
2885
2886 dnl
2887 dnl  XOSD plugin
2888 dnl
2889 AC_ARG_ENABLE(xosd,
2890   [  --enable-xosd           xosd interface support (default disabled)])
2891 if test "x${enable_xosd}" = "xyes"
2892 then
2893   AC_CHECK_HEADER(xosd.h, have_xosd="true", have_xosd="false")
2894   AC_CHECK_LIB(xosd,xosd_set_offset,
2895       AC_DEFINE(HAVE_XOSD_VERSION_1, 1, Define if <xosd.h> is 1.0.x),
2896     AC_CHECK_LIB(xosd,xosd_set_horizontal_offset,
2897         AC_DEFINE(HAVE_XOSD_VERSION_2, 1, Define if <xosd.h> is 2.0.x),
2898       AC_TRY_COMPILE([#include <xosd.h>],
2899          [void foo() { xosd_init("foo","bar",12,XOSD_top,2,12,42); }],,
2900           AC_DEFINE(HAVE_XOSD_VERSION_0, 1, Define if <xosd.h> is pre-1.0.0))))
2901   if test "x${have_xosd}" = "xtrue"
2902   then
2903     PLUGINS="${PLUGINS} xosd"
2904     LDFLAGS_xosd="${LDFLAGS_xosd} -lxosd"
2905   fi
2906 fi
2907
2908 dnl
2909 dnl  SLP access plugin
2910 dnl
2911 AC_ARG_ENABLE(slp,
2912   [  --enable-slp            SLP service discovery support (default enabled)])
2913 if test "x${enable_slp}" != "xno"
2914 then
2915   AC_ARG_WITH(slp,
2916   [    --with-slp=PATH       libslp headers and libraries])
2917   if test "x${with_slp}" = x
2918   then
2919     AC_CHECK_HEADER(slp.h, have_slp="true", have_slp="false")
2920     if test "x${have_slp}" = "xtrue"
2921     then
2922       PLUGINS="${PLUGINS} slp"
2923       LDFLAGS_slp="-lslp ${LDFLAGS_slp}"
2924     fi
2925   else
2926     AC_MSG_CHECKING(for slp headers in ${with_slp})
2927     if test -f ${with_slp}/slp.h
2928     then
2929       dnl  Use ${with_slp}/libslp/slp.h
2930       AC_MSG_RESULT(yes)
2931       PLUGINS="${PLUGINS} slp"
2932       LDFLAGS_slp="-L${with_slp} -lslp ${LDFLAGS_slp}"
2933       CPPFLAGS_slp="${CPPFLAGS_slp} -I${with_slp}"
2934     else
2935       dnl  No libslp could be found, sorry
2936       AC_MSG_RESULT(no)
2937       AC_MSG_ERROR([cannot find ${with_slp}/slp.h])
2938     fi
2939   fi
2940 fi
2941
2942 dnl
2943 dnl  Lirc plugin
2944 dnl
2945 AC_ARG_ENABLE(lirc,
2946   [  --enable-lirc           lirc support (default disabled)])
2947 if test "x${enable_lirc}" = "xyes"
2948 then
2949   AC_CHECK_HEADER(lirc/lirc_client.h, AC_CHECK_LIB(lirc_client, lirc_init, have_lirc="true", have_lirc="false"),have_lirc="false")
2950   if test "x${have_lirc}" = "xtrue"
2951   then
2952     PLUGINS="${PLUGINS} lirc"
2953     LDFLAGS_lirc="${LDFLAGS_lirc} -llirc_client"
2954   fi
2955 fi
2956
2957 AC_ARG_WITH(,[Misc options:])
2958
2959 dnl
2960 dnl  Endianness check, AC_C_BIGENDIAN doesn't work if we are cross-compiling
2961 dnl
2962 dnl  We give the user the opportunity to specify
2963 dnl  --with-words=big or --with-words=little ; otherwise, try to guess
2964 dnl
2965 AC_ARG_WITH(words,
2966   [  --with-words=endianness set endianness (big or little)])
2967   case "x${with_words}" in
2968     xbig)
2969       ac_cv_c_bigendian=yes
2970       ;;
2971     xlittle)
2972       ac_cv_c_bigendian=no
2973       ;;
2974     *)
2975       dnl  Try to guess endianness by matching patterns on a compiled
2976       dnl  binary, by looking for an ASCII or EBCDIC string
2977       AC_CACHE_CHECK([whether the byte order is big-endian],
2978         [ac_cv_c_bigendian],
2979         [ac_cv_c_bigendian="unknown"
2980         [cat >conftest.c <<EOF
2981         short am[] = { 0x4249, 0x4765, 0x6e44, 0x6961, 0x6e53, 0x7953, 0 };
2982         short ai[] = { 0x694c, 0x5454, 0x656c, 0x6e45, 0x6944, 0x6e61, 0 };
2983         void _a(void) { char*s = (char*)am; s = (char *)ai; }
2984         short ei[] = { 0x89D3, 0xe3e3, 0x8593, 0x95c5, 0x89c4, 0x9581, 0 };
2985         short em[] = { 0xc2c9, 0xc785, 0x95c4, 0x8981, 0x95e2, 0xa8e2, 0 };
2986         void _e(void) { char*s = (char*)em; s = (char*)ei; }
2987         int main(void) { _a(); _e(); return 0; }
2988 EOF
2989         ]
2990         if test -f conftest.c
2991         then
2992           if ${CC-cc} -c conftest.c -o conftest.o >>config.log 2>&1 \
2993               && test -f conftest.o
2994           then
2995             if test "`strings conftest.o | grep BIGenDianSyS`"
2996             then
2997               ac_cv_c_bigendian="yes"
2998             fi
2999             if test "`strings conftest.o | grep LiTTleEnDian`"
3000             then
3001               ac_cv_c_bigendian="no"
3002             fi
3003           fi
3004         fi
3005       ])
3006       if test "x${ac_cv_c_bigendian}" = "xunknown"
3007       then
3008         AC_MSG_ERROR([Could not guess endianness, please use --with-words])
3009       fi
3010       ;;
3011   esac
3012 dnl  Now we know what to use for endianness, just put it in the header
3013 if test "${ac_cv_c_bigendian}" = "yes"
3014 then
3015   AC_DEFINE(WORDS_BIGENDIAN, 1, big endian system)
3016 fi
3017
3018 dnl
3019 dnl  Mozilla plugin
3020 dnl
3021 mozilla=false
3022 AC_ARG_ENABLE(mozilla,
3023   [  --enable-mozilla        build a vlc-based Mozilla plugin (default disabled)])
3024 if test "x${enable_mozilla}" = "xyes"
3025 then
3026   AC_PATH_PROG(MOZILLA_CONFIG, mozilla-config, no)
3027   if test "x${MOZILLA_CONFIG}" != "xno"
3028   then
3029     if test "x${SYS}" != "xmingw32"; then
3030       LDFLAGS="${LDFLAGS_save} -L${x_libraries}"
3031       AC_CHECK_LIB(Xt,XtStrings,[
3032         LDFLAGS_mozilla="${LDFLAGS_mozilla} -L${x_libraries} -lXt"
3033       ])
3034       LDFLAGS="${LDFLAGS_save}"
3035     fi
3036     mozilla=:
3037     dnl Workaround for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=150490
3038     [CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
3039     #[CPPFLAGS_mozilla="${CPPFLAGS_mozilla} `${MOZILLA_CONFIG} --cflags plugin xpcom java --defines | sed 's,-I\([^ ]*\)/mozilla/\([^ ]*\),-I\1/\2 -I\1/mozilla/\2,g' | xargs`"]
3040     LDFLAGS_mozilla="${LDFLAGS_mozilla} `${MOZILLA_CONFIG} --libs plugin xpcom`"
3041     dnl Not necessarily in ${PATH}
3042     if test "x${XPIDL}" = "x" -o ! -x "${XPIDL}"
3043     then
3044       XPIDL="/usr/lib/mozilla/xpidl"
3045     fi
3046   fi
3047 fi
3048 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
3049
3050 dnl
3051 dnl  test plugins
3052 dnl
3053 AC_ARG_ENABLE(testsuite,
3054   [  --enable-testsuite      build test modules (default disabled)])
3055 if test "x${enable_testsuite}" = "xyes"
3056 then
3057   TESTS="test1 test2 test3 test4"
3058
3059   dnl  we define those so that bootstrap sets the right linker
3060   CXXFLAGS_test2="${CXXFLAGS_test2}"
3061   OBJCFLAGS_test3="${OBJCFLAGS_test3}"
3062   dnl  this one is needed until automake knows what to do
3063   LDFLAGS_test3="${LDFLAGS_test3} -lobjc"
3064
3065   PLUGINS="${PLUGINS} ${TESTS}"
3066   #BUILTINS="${BUILTINS} ${TESTS}"
3067 fi
3068
3069 dnl
3070 dnl  gtk_main plugin
3071 dnl
3072 if test "x${NEED_GTK_MAIN}" != "xno"
3073 then
3074     PLUGINS="${PLUGINS} gtk_main"
3075     CFLAGS_gtk="${CFLAGS_gtk} -DNEED_GTK_MAIN"
3076     CFLAGS_familiar="${CFLAGS_familiar} -DNEED_GTK_MAIN"
3077     CFLAGS_gtk_main="${CFLAGS_gtk_main} ${CFLAGS_gtk} ${CFLAGS_familiar}"
3078     LDFLAGS_gtk_main="${LDFLAGS_gtk_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar}"
3079 fi
3080
3081 if test "x${NEED_GNOME_MAIN}" != "xno"
3082 then
3083     PLUGINS="${PLUGINS} gnome_main"
3084     CFLAGS_gnome_main="${CFLAGS_gnome_main} ${CFLAGS_gtk} ${CFLAGS_familiar} ${CFLAGS_gnome}"
3085     LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
3086 fi
3087
3088 if test "x${NEED_GTK2_MAIN}" != "xno"
3089 then
3090     PLUGINS="${PLUGINS} gtk2_main"
3091     CFLAGS_gtk2="${CFLAGS_gtk2} -DNEED_GTK2_MAIN"
3092     CFLAGS_gtk2_main="${CFLAGS_gtk2_main} ${CFLAGS_gtk2}"
3093     LDFLAGS_gtk2_main="${LDFLAGS_gtk2_main} ${LDFLAGS_gtk2}"
3094 fi
3095
3096 if test "x${NEED_GNOME2_MAIN}" != "xno"
3097 then
3098     PLUGINS="${PLUGINS} gnome2_main"
3099     CFLAGS_gnome2_main="${CFLAGS_gnome2_main} ${CFLAGS_gtk2} ${CFLAGS_gnome2}"
3100     LDFLAGS_gnome2_main="${LDFLAGS_gnome2_main} ${LDFLAGS_gtk2} ${LDFLAGS_gnome2}"
3101 fi
3102
3103 dnl
3104 dnl  qte_main plugin
3105 dnl
3106 if test "x${NEED_QTE_MAIN}" != "xno"
3107 then
3108     PLUGINS="${PLUGINS} qte_main"
3109     CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
3110     CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
3111     CFLAGS_vout_sdl="${CFLAGS_vout_sdl} -DNEED_QTE_MAIN"
3112     CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
3113     LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
3114 fi
3115
3116
3117 dnl
3118 dnl  Plugin and builtin checks
3119 dnl
3120 builtin_support=false
3121 plugin_support=:
3122
3123 dnl Support for plugins - this must be AT THE END
3124 AC_ARG_ENABLE(plugins,
3125   [  --disable-plugins       make all plugins built-in (default plugins enabled)],
3126   [if test "x${enable_plugins}" = "xno"
3127    then
3128      plugin_support=false
3129    fi])
3130
3131 dnl Automagically disable plugins if there is no system support for
3132 dnl dynamically loadable files (.so, .dll, .dylib).
3133 dnl don't forget vlc-win32 still can load .dll as plugins
3134 if test "x${ac_cv_header_dlfcn_h}" = "xno" -a "x${ac_cv_header_image_h}" = "xno" -a "x${SYS}" != "xmingw32"
3135 then
3136   echo "*** Your system doesn't have plugin support. All plugins will be built"
3137   echo "statically."
3138   plugin_support=false
3139 fi
3140
3141 dnl Export automake variables
3142 if ${plugin_support}
3143 then
3144   for plugin in `echo ${PLUGINS}`
3145   do
3146     eval "${plugin}_plugin=yes"
3147   done
3148 else
3149   BUILTINS="${BUILTINS} ${PLUGINS}"
3150   PLUGINS=
3151 fi
3152 AM_CONDITIONAL(HAVE_PLUGINS, ${plugin_support})
3153
3154 [if echo "${BUILTINS}" | grep '[^ ]' >/dev/null 2>&1
3155 then
3156   builtin_support=:
3157   for builtin in `echo ${BUILTINS}`
3158   do
3159     eval "${builtin}_builtin=yes"
3160   done
3161 fi]
3162 AM_CONDITIONAL(HAVE_BUILTINS, ${builtin_support})
3163
3164 dnl do not touch this line (bootstrap needs it)
3165
3166
3167 dnl
3168 dnl  Stuff used by the program
3169 dnl
3170 AC_DEFINE_UNQUOTED(VERSION_MESSAGE, "${VERSION} ${CODENAME}", [Simple version string])
3171 AC_DEFINE_UNQUOTED(COPYRIGHT_MESSAGE, "VLC media player - version ${VERSION} ${CODENAME} - (c) 1996-2003 VideoLAN", [Copyright string])
3172 AC_DEFINE_UNQUOTED(CONFIGURE_LINE, "${CONFIGURE_LINE}", [The ./configure command line])
3173
3174 VLC_SYMBOL="`echo ${VERSION} | sed -e 'y/.-/__/'`"
3175 AC_DEFINE_UNQUOTED(MODULE_SUFFIX, "__${VLC_SYMBOL}", [String suffix for module functions])
3176 AC_DEFINE_UNQUOTED(MODULE_SYMBOL, ${VLC_SYMBOL}, [Symbol suffix for module functions])
3177 AC_DEFINE_UNQUOTED(LIBEXT, "${LIBEXT}", [Dynamic object extension])
3178
3179 DATA_PATH="${ac_tool_prefix}/share/vlc"
3180 AC_SUBST(DATA_PATH)
3181 PLUGIN_PATH="${ac_tool_prefix}/lib/vlc"
3182 AC_SUBST(PLUGIN_PATH)
3183
3184 dnl
3185 dnl  Restore *FLAGS
3186 dnl
3187 CPPFLAGS="${CPPFLAGS_save}"
3188 CFLAGS="${CFLAGS_save}"
3189 CXXFLAGS="${CXXFLAGS_save}"
3190 OBJCFLAGS="${OBJCFLAGS_save}"
3191 LDFLAGS="${LDFLAGS_save}"
3192
3193 dnl
3194 dnl  Fool automake (see Makefile.am)
3195 dnl
3196 AUTOMAKE_SUCKS="\$(L_builtin) \$(LDFLAGS_builtin)"
3197 AC_SUBST(AUTOMAKE_SUCKS)
3198
3199 dnl
3200 dnl  Create the vlc-config script
3201 dnl
3202 LDFLAGS_libvlc="${LDFLAGS_vlc} ${LDFLAGS_builtins}"
3203 for i in `echo "${BUILTINS}" | sed -e 's@[^ ]*/@@g'` ; do LDFLAGS_libvlc="${LDFLAGS_libvlc} ${libdir}/vlc/${i}.a `eval echo '$'{LDFLAGS_${i}}`" ; done
3204
3205 dnl
3206 dnl  Configuration is finished
3207 dnl
3208 AC_SUBST(SYS)
3209 AC_SUBST(ARCH)
3210 AC_SUBST(PLUGINS)
3211 AC_SUBST(BUILTINS)
3212 AC_SUBST(ALIASES)
3213 AC_SUBST(ASM)
3214 AC_SUBST(MOC)
3215 AC_SUBST(WINDRES)
3216 AC_SUBST(XPIDL)
3217 AC_SUBST(LIBEXT)
3218 AC_SUBST(INCLUDES)
3219 AC_SUBST(ALL_LINGUAS)
3220
3221 AC_SUBST(CFLAGS_TUNING)
3222 AC_SUBST(CFLAGS_OPTIM)
3223 AC_SUBST(CFLAGS_OPTIM_NODEBUG)
3224 AC_SUBST(CFLAGS_NOOPTIM)
3225 AC_SUBST(LDFLAGS)
3226
3227 AC_SUBST(CFLAGS_vlc)
3228 AC_SUBST(CFLAGS_pics)
3229 AC_SUBST(CXXFLAGS_pics)
3230 AC_SUBST(CFLAGS_plugins)
3231 AC_SUBST(CXXFLAGS_plugins)
3232 AC_SUBST(CFLAGS_builtins)
3233 AC_SUBST(CPPFLAGS_mozilla)
3234
3235 AC_SUBST(LDFLAGS_vlc)
3236 AC_SUBST(LDFLAGS_libvlc)
3237 AC_SUBST(LDFLAGS_plugins)
3238 AC_SUBST(LDFLAGS_builtins)
3239 AC_SUBST(LDFLAGS_mozilla)
3240
3241 AC_OUTPUT([
3242   Makefile
3243   autotools/Makefile
3244   debian/Makefile
3245   doc/Makefile
3246   intl/Makefile
3247   ipkg/Makefile
3248   lib/Makefile
3249   m4/Makefile
3250   modules/Makefile
3251   po/Makefile.in
3252   share/Makefile
3253   src/Makefile
3254   vlc-config
3255 ],[
3256   chmod a+x vlc-config
3257 ])
3258
3259 printf "
3260 vlc configuration
3261 --------------------
3262 vlc version           : ${VERSION}
3263 system                : ${SYS}
3264 architecture          : ${ARCH}
3265 build flavour         : "
3266 test "x${DEBUG_TRUE}" = "x" && printf "debug "
3267 test "x${CPROF_TRUE}" = "x" && printf "cprof "
3268 test "x${GPROF_TRUE}" = "x" && printf "gprof "
3269 test "x${OPTIM_TRUE}" = "x" && printf "optim "
3270 test "x${RELEASE_TRUE}" = "x" && printf "release " || printf "devel "
3271 echo "
3272 vlc aliases           :${ALIASES}
3273
3274 To build vlc and its plugins, type \`make'.
3275 "
3276