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