configure.ac: fix compilation of v4l2src with "-Wall -Werror" fixes #142664
[platform/upstream/gstreamer.git] / configure.ac
1 dnl autoconf configuration file for gst-plugins 
2 AC_INIT
3 AC_CANONICAL_TARGET([])
4
5 dnl We disable static building for development, for time savings
6 dnl this goes before AS_LIBTOOL to appease autoconf
7 dnl *NOTE*: dnl this line before release, so release does static too
8 AM_DISABLE_STATIC
9
10 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
11 AM_MAINTAINER_MODE
12
13 dnl when going to/from release please set the nano (fourth number) right !
14 dnl releases only do Wall, cvs and prerelease does Werror too
15 AS_VERSION(gst-plugins, GST_PLUGINS_VERSION, 0, 8, 1, 1, GST_CVS="no", GST_CVS="yes")
16
17 AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
18
19 dnl our libraries and install dirs use major.minor as a version
20 GST_MAJORMINOR=$GST_PLUGINS_VERSION_MAJOR.$GST_PLUGINS_VERSION_MINOR
21 dnl we override it here if we need to for the release candidate
22 #GST_MAJORMINOR=0.8
23 AC_SUBST(GST_MAJORMINOR)
24
25 dnl CURRENT, REVISION, AGE
26 dnl - library source changed -> increment REVISION
27 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
28 dnl - interfaces added -> increment AGE
29 dnl - interfaces removed -> AGE = 0
30 AS_LIBTOOL(GST_PLUGINS, 1, 0, 1)
31 AM_PROG_LIBTOOL
32
33 dnl FIXME take something else ?
34 AC_CONFIG_SRCDIR([gst/law/alaw.c])
35 AM_CONFIG_HEADER(config.h)
36
37 dnl Add parameters for aclocal
38 dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
39 ACLOCAL_FLAGS="-I m4 -I common/m4"
40 AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)
41
42 AC_PROG_CC
43 AM_PROG_CC_STDC
44 AM_PROG_AS
45 AS="${CC}"
46
47 dnl the gettext stuff needed
48 AM_GNU_GETTEXT_VERSION(0.11.5)
49 AM_GNU_GETTEXT([external])
50                                                                                 
51 GETTEXT_PACKAGE=gst-plugins-$GST_MAJORMINOR
52 AC_SUBST(GETTEXT_PACKAGE)
53 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE",
54                    [gettext package name])
55                                                                                 
56 dnl define LOCALEDIR in config.h
57 AS_AC_EXPAND(LOCALEDIR, $datadir/locale)
58 AC_DEFINE_UNQUOTED([LOCALEDIR], "$LOCALEDIR",
59                    [gettext locale dir])
60
61 dnl decide on error flags
62 AS_COMPILER_FLAG(-Wall, GST_WALL="yes", GST_WALL="no")
63
64 if test "x$GST_WALL" = "xyes"; then
65    GST_ERROR="$GST_ERROR -Wall -Wno-sign-compare"
66
67    if test "x$GST_CVS" = "xyes"; then
68      AS_COMPILER_FLAG(-Werror,GST_ERROR="$GST_ERROR -Werror",GST_ERROR="$GST_ERROR")
69      GST_ERROR="$GST_ERROR -DG_DISABLE_DEPRECATED"
70    fi
71 fi
72
73 dnl determine c++ compiler
74 AC_PROG_CXX
75 dnl determine if c++ is available on this system
76 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
77 dnl determine c++ preprocessor
78 AC_PROG_CXXCPP
79 AC_ISC_POSIX
80
81 AC_HEADER_STDC([])
82 AC_C_INLINE
83 AX_CREATE_STDINT_H
84
85 dnl Check for malloc.h
86 AC_CHECK_HEADER(malloc.h,[
87   AC_DEFINE(HAVE_MALLOC_H, 1, [whether malloc.h available])
88 ])
89
90 dnl Check for a way to display the function name in debug output
91 GST_CHECK_FUNCTION()
92
93 dnl define correct errorlevel for debugging messages. We want to have GST_ERROR
94 dnl messages printed when running cvs builds
95 if test "x$GST_CVS" = "xyes"; then
96   AC_DEFINE(GST_LEVEL_DEFAULT, GST_LEVEL_ERROR, [Default errorlevel to use])
97 fi
98
99 dnl ############################################
100 dnl # Super Duper options for plug-in building #
101 dnl ############################################
102
103 dnl ext plug-ins; plug-ins that have external dependencies
104 GST_CHECK_FEATURE(EXTERNAL, [enable building of plug-ins with external deps],,
105 [HAVE_EXTERNAL=yes],enabled,
106 [
107   AC_MSG_WARN(building external plug-ins)
108   BUILD_EXTERNAL="yes"
109 ],[
110   AC_MSG_WARN(all plug-ins with external dependencies will not be built)
111   BUILD_EXTERNAL="no"
112 ])
113 # make BUILD_EXTERNAL available to Makefile.am
114 AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes")
115
116 dnl experimental plug-ins; stuff that hasn't had the dust settle yet
117 dnl read 'builds, but might not work'UTO
118 GST_CHECK_FEATURE(EXPERIMENTAL, [enable building of experimental plug-ins],,
119 [HAVE_EXPERIMENTAL=yes],disabled,
120 [
121   AC_MSG_WARN(building experimental plug-ins)
122   USE_TARKIN="yes"
123 ],[
124   AC_MSG_NOTICE(not building experimental plug-ins)
125   USE_TARKIN="no"
126 ])
127
128 dnl broken plug-ins; stuff that doesn't seem to build at the moment
129 GST_CHECK_FEATURE(BROKEN, [enable building of broken plug-ins],,
130 HAVE_BROKEN=yes,disabled,
131 [  
132   AC_MSG_WARN([building broken plug-ins -- no bug reports on these, only patches :)])
133 ],[
134   AC_MSG_NOTICE([not building broken plug-ins])
135 ])
136
137 dnl ##############################
138 dnl # Do automated configuration #
139 dnl ##############################
140
141 dnl Check for tools:
142 dnl ================
143
144 dnl allow for different autotools
145 AS_AUTOTOOLS_ALTERNATE()
146
147 dnl modify pkg-config path
148 AC_ARG_WITH(pkg-config-path, 
149    AC_HELP_STRING([--with-pkg-config-path],[colon-separated list of pkg-config(1) dirs]),
150    [export PKG_CONFIG_PATH=${withval}])
151
152 dnl check architecture
153 GST_ARCH()
154
155 dnl Check for nasm
156 AC_PATH_PROG(NASM_PATH, nasm, no)
157 AC_SUBST(NASM_PATH)
158 if test x$NASM_PATH = xno; then
159   AC_MSG_WARN(Couldn't find nasm)
160   HAVE_NASM="no"
161 else
162   AC_DEFINE(HAVE_NASM, 1, [Define if NASM, the netwide assembler, is available])
163   HAVE_NASM="yes"
164 fi
165
166 dnl check for gconftool-2
167 translit(dnm, m, l) AM_CONDITIONAL(USE_GCONFTOOL, true)
168 GST_CHECK_FEATURE(GCONFTOOL, [GConf schemas], , [
169   AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
170   if test x$GCONFTOOL = xno; then
171     AC_MSG_WARN(Not installing GConf schemas)
172     HAVE_GCONFTOOL="no"
173   else
174     AM_GCONF_SOURCE_2
175     HAVE_GCONFTOOL="yes"
176   fi
177   AC_SUBST(HAVE_GCONFTOOL)
178 ])
179
180 dnl check for GConf libraries
181 translit(dnm, m, l) AM_CONDITIONAL(USE_GCONF, true)
182 GST_CHECK_FEATURE(GCONF, [GConf libraries], , [
183   PKG_CHECK_MODULES(GCONF, gconf-2.0, HAVE_GCONF="yes", HAVE_GCONF="no")
184   AC_SUBST(GCONF_CFLAGS)
185   AC_SUBST(GCONF_LIBS)
186 ])
187
188 dnl check for gstreamer; uninstalled is selected preferentially -- see pkg-config(1)
189 GST_REQ=0.8.1.1
190 PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ,
191   HAVE_GST="yes", HAVE_GST="no")
192
193 if test "x$HAVE_GST" = "xno"; then
194   AC_MSG_ERROR(no GStreamer found)
195 fi
196
197 GST_TOOLS_DIR=`pkg-config --variable=toolsdir gstreamer-$GST_MAJORMINOR`
198 if test -z $GST_TOOLS_DIR; then
199   AC_MSG_ERROR([no tools dir defined in GStreamer pkg-config file; core upgrade needed.])
200 fi
201 AC_SUBST(GST_TOOLS_DIR)
202
203 dnl check for gstreamer-control; uninstalled is selected preferentially
204 PKG_CHECK_MODULES(GST_CONTROL, gstreamer-control-$GST_MAJORMINOR >= $GST_REQ,
205   HAVE_GST_CONTROL="yes", HAVE_GST_CONTROL="no")
206
207 if test "x$HAVE_GST_CONTROL" = "xno"; then
208   AC_MSG_ERROR(no GStreamer Control Libs found)
209 fi
210
211 AC_SUBST(GST_CONTROL_LIBS)
212
213 dnl Determine endianness
214 AC_C_BIGENDIAN
215
216 dnl Check for fast float to int casting as defined in C99
217 AC_C99_FUNC_LRINT()
218 AC_C99_FUNC_LRINTF()
219
220 dnl Check for essential libraries first:
221 dnl ====================================
222
223 GST_GLIB2_CHECK()
224
225 dnl Check for additional libraries that we might use:
226 dnl =================================================
227 dnl GTK
228 HAVE_GTK=NO
229 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0, HAVE_GTK_22=yes, HAVE_GTK_22=no)
230 if test "x$HAVE_GTK_22" = "xyes"; then
231   HAVE_GTK=yes
232   GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
233   AC_SUBST(GTK_VERSION)
234   GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
235   GDK_PIXBUF_LIBDIR=`$PKG_CONFIG --variable=libdir gdk-pixbuf-2.0`
236   GDK_PIXBUF_PREFIXDIR=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
237   AC_SUBST(GTK_BASE_DIR)
238 else
239   PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK_20=yes, HAVE_GTK_20=no)
240 fi
241 if test "x$HAVE_GTK_20" = "xyes"; then
242   HAVE_GTK=yes
243 fi
244 GTK_CFLAGS=$GTK2_CFLAGS
245 GTK_LIBS=$GTK2_LIBS
246 AC_SUBST(GTK_LIBS)
247 AC_SUBST(GTK_CFLAGS)
248 AC_SUBST(HAVE_GTK)
249
250 # gdk_pixbuf gstreamer loader is considered experimental, so disable
251 # by default
252 if test "x$HAVE_GTK_22" = "xyes"; then
253   HAVE_GDK_LOADERS=yes
254 else
255   HAVE_GDK_LOADERS=no
256 fi
257
258 # we set the defaults always to make sure we have non-empty variables
259 # for the Makefile
260
261 # by default, stick to prefix
262 GDK_PIXBUF_LOADER_DIR=${libdir}/gtk-2.0/\${GTK_VERSION}/loaders
263 GDK_PIXBUF_CONF_DIR=${sysconfdir}/gtk-2.0
264
265
266 AC_ARG_ENABLE(gdk-pixbuf-loader,
267   AC_HELP_STRING([--enable-gdk-pixbuf-loader],
268               [whether to enable building of gdk_pixbuf loader]),
269               :, HAVE_GDK_LOADERS="no")
270
271 if test "x$HAVE_GDK_LOADERS" = "xyes"; then
272   AC_PATH_PROG(QUERYLOADERS, gdk-pixbuf-query-loaders, no)
273   # allow customization of pixbuf loader install location
274   # when nothing specified, adhere to prefix settings
275   # when called without any option with this argument, autodetect
276   # when called with a path, set to the given path
277
278   AC_ARG_WITH(gdk-pixbuf-loader-dir, 
279      AC_HELP_STRING([--with-gdk-pixbuf-loader-dir],
280         [directory to install the gdk_pixbuf loader (none for pkg-config default)]),
281      [
282       if test "x${withval}" != xyes ; then
283         GDK_PIXBUF_LOADER_DIR="${withval}"
284       else
285         GDK_PIXBUF_LOADER_DIR="$GDK_PIXBUF_LIBDIR/gtk-2.0/\$GTK_VERSION/loaders"
286       fi
287      ]
288   )
289   AS_AC_EXPAND(GDK_PIXBUF_LOADER_DIR, $GDK_PIXBUF_LOADER_DIR)
290   AC_SUBST(GDK_PIXBUF_LOADER_DIR)
291   AC_MSG_NOTICE([Putting GTK+-2 pixbuf loaders in $GDK_PIXBUF_LOADER_DIR])
292   
293   # allow customization of pixbuf loader configuration file
294   # when nothing specified, adhere to prefix settings
295   # when called without any option with this argument, autodetect
296   # when called with a path, set to the given path
297
298   AC_ARG_WITH(gdk-pixbuf-conf-dir, 
299      AC_HELP_STRING([--with-gdk-pixbuf-conf-dir],
300         [directory to install the gdk_pixbuf config (none for pkg-config default)]),
301      [
302       if test "x${withval}" != xyes ; then
303         GDK_PIXBUF_CONF_DIR="${withval}"
304       else
305         GDK_PIXBUF_CONF_DIR="$GDK_PIXBUF_PREFIXDIR/etc/gtk-2.0/"
306       fi
307      ]
308   )
309   AS_AC_EXPAND(GDK_PIXBUF_CONF_DIR, $GDK_PIXBUF_CONF_DIR)
310   AC_SUBST(GDK_PIXBUF_CONF_DIR)
311   AC_MSG_NOTICE([Putting GTK+-2 pixbuf loader config in $GDK_PIXBUF_CONF_DIR])
312 fi
313 AM_CONDITIONAL(HAVE_GDK_LOADERS, test "x$HAVE_GDK_LOADERS" = "xyes")
314
315 PKG_CHECK_MODULES(LIBOIL, liboil-0.1, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
316 AC_SUBST(LIBOIL_CFLAGS)
317 AC_SUBST(LIBOIL_LIBS)
318 if test "x${HAVE_LIBOIL}" = xyes ; then
319   #AC_DEFINE_UNQUOTED(HAVE_LIBOIL, 1, [Define if liboil is being used])
320   true
321 fi
322
323 dnl ===========================================================================
324 dnl ============================= gst plug-ins ================================
325 dnl ===========================================================================
326
327 plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
328 AC_SUBST(plugindir)
329
330 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '[_]*(gst_|Gst|GST_).*' $GST_LIBS"
331 AC_SUBST(GST_PLUGIN_LDFLAGS)
332
333 dnl these are all the gst plug-ins, compilable without additional libs
334 GST_PLUGINS_ALL="\
335         ac3parse \
336         adder \
337         asfdemux \
338         audioconvert \
339         audioscale \
340         auparse \
341         avi \
342         cdxaparse \
343         chart \
344         colorspace \
345         cutter \
346         debug \
347         deinterlace \
348         effectv \
349         festival \
350         ffmpegcolorspace \
351         filter \
352         flx \
353         goom \
354         interleave \
355         law \
356         level \
357         matroska \
358         median \
359         mixmatrix \
360         mpeg1sys \
361         mpeg1videoparse \
362         mpeg2sub \
363         mpegaudio \
364         mpegaudioparse \
365         mpegstream \
366         monoscope \
367         overlay \
368         passthrough \
369         playondemand \
370         qtdemux \
371         realmedia \
372         rtjpeg \
373         rtp \
374         silence \
375         sine \
376         smooth \
377         smpte \
378         spectrum \
379         speed \
380         stereo \
381         switch \
382         synaesthesia \
383         tags \
384         tcp \
385         typefind \
386         udp \
387         vbidec \
388         videocrop \
389         videodrop \
390         videoflip \
391         videofilter \
392         videoscale \
393         videotestsrc \
394         volenv \
395         volume \
396         wavenc \
397         wavparse \
398         y4m"
399
400 dnl see if we can build C++ plug-ins
401 if test "x$HAVE_CXX" = "xyes"; then
402   GST_PLUGINS_ALL="$GST_PLUGINS_ALL \
403                   modplug"
404 else
405   AC_MSG_WARN([Not compiling plug-ins requiring C++ compiler])
406 fi
407
408 AC_SUBST(GST_PLUGINS_ALL)
409
410 GST_PLUGINS_SELECTED=""
411
412 AC_ARG_WITH(plugins,
413     AC_HELP_STRING([--with-plugins],[comma-separated list of plug-ins to compile]),
414     [for i in `echo $withval | tr , ' '`; do
415         if echo $GST_PLUGINS_ALL | grep $i > /dev/null
416         then
417             GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED $i"
418         else
419             echo "plug-in $i not recognized, ignoring..."
420         fi
421     done],
422     [GST_PLUGINS_SELECTED=$GST_PLUGINS_ALL])
423
424 AC_SUBST(GST_PLUGINS_SELECTED)
425
426 dnl ==========================================================================
427 dnl ============================= sys plug-ins ================================
428 dnl ==========================================================================
429
430 dnl *** DXR3 card ***
431 translit(dnm, m, l) AM_CONDITIONAL(USE_DXR3, true)
432 GST_CHECK_FEATURE(DXR3, [DXR3 hardware MPEG DVD decoder],
433   dxr3videosink dxr3audiosink dxr3spusink, [
434   HAVE_DXR3=yes
435   AC_CHECK_HEADER(linux/em8300.h, ,
436                   [ AC_MSG_WARN([DXR3/em8300 header file not found]) &&
437                     HAVE_DXR3=no ] )
438   AC_CHECK_HEADER(linux/soundcard.h, ,
439                   [ AC_MSG_WARN([Generic sound header file not found]) &&
440                     HAVE_DXR3=no ] )
441 ])
442
443 dnl *** OSS audio ***
444 translit(dnm, m, l) AM_CONDITIONAL(USE_OSS, true)
445 GST_CHECK_FEATURE(OSS, [OSS audio], osssrc osssink, [
446   AC_CHECK_HEADER(sys/soundcard.h, HAVE_OSS="yes", HAVE_OSS="no")
447 ])
448
449 dnl *** QuickCam ***
450 translit(dnm, m, l) AM_CONDITIONAL(USE_QCAM, true)
451 GST_CHECK_FEATURE(QCAM, [QuickCam], qcamsrc, [
452   if test "x$HAVE_CPU_I386" != "xyes";
453   then
454     HAVE_QCAM="no"
455   else
456     AC_CHECK_HEADER(sys/io.h, HAVE_QCAM="yes", HAVE_QCAM="no")
457   fi
458   if test "x$HAVE_QCAM" != "xyes";
459   then
460     AC_MSG_WARN([QuickCam only works on i386-linux])
461   fi
462 ])
463
464 dnl *** Video CD ***
465 translit(dnm, m, l) AM_CONDITIONAL(USE_VCD, true)
466 GST_CHECK_FEATURE(VCD, [Video CD], vcdsrc, [
467   AC_CHECK_HEADER(linux/cdrom.h, HAVE_VCD="yes", HAVE_VCD="no")
468 ])
469
470 dnl *** CDROM Audio ***
471 translit(dnm, m, l) AM_CONDITIONAL(USE_CDROM, true)
472 GST_CHECK_FEATURE(CDROM, [CDROM Audio], cdrom, [
473   AC_CHECK_HEADERS(linux/cdrom.h) dnl linux
474   AC_CHECK_HEADERS(sys/cdio.h) dnl almost everything else
475 dnl  AC_CHECK_HEADERS(dmedia/cdaudio.h) dnl irix
476
477   if test "${ac_cv_header_linux_cdrom_h}" = "yes" || test "${ac_cv_header_sys_cdio_h}" = "yes" || test "${ac_cv_header_dmedia_cdaudio_h}" = "yes"; then
478         case "$host" in 
479                 *-sun-* | *-*-linux*)
480                         AC_DEFINE(HAVE_CDROM_SOLARIS,, [Define if cdrom access is in Solaris style])
481                 ;;
482                 *-*-freebsd*)
483                         AC_DEFINE(HAVE_CDROM_BSD,, [Define if cdrom access is in BSD style])
484                 ;;
485                 *-*-netbsd* | *-*-openbsd*)
486                         AC_DEFINE(HAVE_CDROM_BSD,, [Define if cdrom access is in BSD style])
487                         AC_DEFINE(HAVE_CDROM_BSD_NETBSD,, [Define if cdrom access uses NetBSD variant])
488                 ;;
489                 *-*darwin*)
490                         AC_DEFINE(HAVE_CDROM_BSD,, [Define if cdrom access is in BSD style])
491                         AC_DEFINE(HAVE_CDROM_BSD_DARWIN,, [Define if cdrom access uses Darwin variant])
492                 ;;
493 dnl             *-irix-*)
494 dnl                     AC_DEFINE(HAVE_CDROM_IRIX,, [Define if cdrom access is in Irix DMedia style])
495 dnl             ;;
496     esac
497
498         HAVE_CDROM="yes"
499   else
500         HAVE_CDROM="no"
501   fi
502 ])
503
504 dnl Check for X11
505 translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
506 GST_CHECK_FEATURE(X, [X libraries and plugins],
507                   [ximagesink], [
508   AC_PATH_XTRA
509   dnl now try to find the HEADER
510   AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
511
512   if test "x$HAVE_X" = "xno"
513   then
514     AC_MSG_NOTICE([cannot find X11 development files])
515   else
516     dnl this is much more than we want
517     X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
518     dnl AC_PATH_XTRA only defines the path needed to find the X libs,
519     dnl it does not add the libs; therefore we add them here
520     X_LIBS="$X_LIBS -lX11"
521     AC_SUBST(X_CFLAGS)
522     AC_SUBST(X_LIBS)
523   fi
524   AC_SUBST(HAVE_X)
525 ])
526   
527 dnl *** XVideo ***
528 dnl Look for the PIC library first, Debian requires it.
529 dnl Check debian-devel archives for gory details.
530 dnl 20020110:
531 dnl At the moment XFree86 doesn't distribute shared libXv due
532 dnl to unstable API.  On many platforms you CAN NOT link a shared
533 dnl lib to a static non-PIC lib.  This is what the xvideo GStreamer
534 dnl plug-in wants to do.  So Debian distributes a PIC compiled
535 dnl version of the static lib for plug-ins to link to when it is
536 dnl inappropriate to link the main application to libXv directly.
537 dnl FIXME: add check if this platform can support linking to a
538 dnl        non-PIC libXv, if not then don not use Xv.
539 dnl FIXME: perhaps warn user if they have a shared libXv since
540 dnl        this is an error until XFree86 starts shipping one
541    
542 dnl Check for Xv extension
543 translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
544 GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
545                   [xvimagesink], [
546   if test x$HAVE_X = xyes; then
547     AC_CHECK_LIB(Xv_pic, XvQueryExtension,
548                  HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
549                  $X_LIBS -lXext)
550
551     if test x$HAVE_XVIDEO = xyes; then
552       XVIDEO_LIBS="-lXv_pic -lXext"
553       AC_SUBST(XVIDEO_LIBS)
554     else
555       dnl try again using something else if we didn't find it first
556       if test x$HAVE_XVIDEO = xno; then
557         AC_CHECK_LIB(Xv, XvQueryExtension,
558                    HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
559                    $X_LIBS -lXext)
560
561         if test x$HAVE_XVIDEO = xyes; then
562           XVIDEO_LIBS="-lXv -lXext"
563           AC_SUBST(XVIDEO_LIBS)
564         fi
565       fi
566     fi
567   fi
568 ])
569
570 dnl check for X Shm
571 translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
572 GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], xshm, [
573   if test x$HAVE_X = xyes; then
574     AC_CHECK_LIB(Xext, XShmAttach, 
575                  HAVE_XSHM="yes", HAVE_XSHM="no",
576                  $X_LIBS) 
577     if test "x$HAVE_XSHM" = "xyes"; then
578       XSHM_LIBS="-lXext"
579     else
580       dnl On AIX, it is in XextSam instead, but we still need -lXext
581       AC_CHECK_LIB(XextSam, XShmAttach, 
582                    HAVE_XSHM="yes", HAVE_XSHM="no",
583                    $X_LIBS) 
584       if test "x$HAVE_XSHM" = "xyes"; then
585         XSHM_LIBS="-lXext -lXextSam"
586       fi
587     fi
588   fi
589 ], , [ 
590   AC_SUBST(HAVE_XSHM) 
591   AC_SUBST(XSHM_LIBS) 
592 ] )
593
594 dnl v4l/v4l2 checks have been moved down because they require X
595
596 dnl *** Video 4 Linux ***
597 dnl for information about the header/define, see sys/v4l/gstv4lelement.h
598 translit(dnm, m, l) AM_CONDITIONAL(USE_V4L, true)
599 GST_CHECK_FEATURE(V4L, [Video 4 Linux], v4lsrc v4lmjpegsrc v4lmjpegsink, [
600   # first check X
601   HAVE_V4L="no"
602   if test "$HAVE_X" = "yes"
603   then
604     AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_V4L="yes", HAVE_V4L="no", [
605 #include <sys/types.h>
606 #define _LINUX_TIME_H
607 #include <linux/videodev.h>
608     ])
609   fi
610 ])
611
612 dnl *** Video 4 Linux 2 ***
613 dnl for information about the header/define, see sys/v4l2/gstv4l2element.h
614 translit(dnm, m, l) AM_CONDITIONAL(USE_V4L2, true)
615 GST_CHECK_FEATURE(V4L2, [Video 4 Linux 2], v4l2src, [
616   HAVE_V4L2="no"
617   if test "$HAVE_X" = "yes"
618   then
619     AC_MSG_CHECKING([Checking for uptodate v4l2 installation])
620     AC_TRY_COMPILE([
621 #include <sys/types.h>
622 #include <linux/types.h>
623 #define _LINUX_TIME_H
624 #include <linux/videodev2.h>
625 #if defined(V4L2_MAJOR_VERSION) || defined(V4L2_MINOR_VERSION)
626 #error too early v4l2 version or no v4l2 at all
627 #endif
628     ], [
629 return 0;
630     ], [ HAVE_V4L2="yes" && AC_MSG_RESULT(yes)],
631        [ HAVE_V4L2="no"  && AC_MSG_RESULT(no) &&
632          AC_CHECK_HEADER(linux/videodev2.h,
633                          [ AC_MSG_WARN([video4linux2 headers were found, but they're old. Please update v4l2 to compile the v4l2 plugins])],
634                          [ AC_MSG_WARN([video4linux2 was not found])])
635        ])
636   fi
637   dnl check for missing v4l2_buffer declaration (see #135919)
638   if [ test x$HAVE_V4L2 = xyes ]; then
639     MISSING_DECL=0
640     AC_MSG_CHECKING(struct v4l2_buffer declaration)
641     AC_TRY_COMPILE([
642 #include <sys/types.h>
643 #include <linux/types.h>
644 #define _LINUX_TIME_H
645 #include <linux/videodev2.h>
646     ],[
647 struct v4l2_buffer buf;
648 buf.index = 0;
649 return 0;
650     ], [ AC_MSG_RESULT(yes) ], [ MISSING_DECL=1 && AC_MSG_RESULT(no) ])
651     if [ test x$MISSING_DECL = x1 ]; then
652       AC_DEFINE(GST_V4L2_MISSING_BUFDECL, 1, [struct v4l2_buffer missing])
653     fi
654   fi
655 ])
656
657 dnl Next, check for the optional libraries:
658 dnl These are all libraries used in building plug-ins
659 dnl ================================================
660 dnl let's try and sort them alphabetically, shall we ?
661
662 if test "x$BUILD_EXTERNAL" = "xyes"; then
663
664 AC_MSG_NOTICE(Checking for plug-in dependency libraries)
665
666 dnl *** a52dec ***
667 translit(dnm, m, l) AM_CONDITIONAL(USE_A52DEC, true)
668 GST_CHECK_FEATURE(A52DEC, [a52dec], a52dec, [
669   AC_CHECK_A52DEC(HAVE_A52DEC=yes, HAVE_A52DEC=no)
670 ])
671
672 dnl *** aalib ***
673 translit(dnm, m, l) AM_CONDITIONAL(USE_AALIB, true)
674 GST_CHECK_FEATURE(AALIB, [aasink plug-in], aasink, [
675   AM_PATH_AALIB(, HAVE_AALIB=yes, HAVE_AALIB=no)
676   AS_SCRUB_INCLUDE(AALIB_CFLAGS)
677 ])
678
679 dnl *** alsa ***
680 translit(dnm, m, l) AM_CONDITIONAL(USE_ALSA, true)
681 GST_CHECK_FEATURE(ALSA, [alsa plug-ins], gstalsa, [
682   PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, [
683     HAVE_ALSA="yes"
684     AC_SUBST(ALSA_CFLAGS)
685     AC_SUBST(ALSA_LIBS)
686   ], [
687     AM_PATH_ALSA(0.9.1, HAVE_ALSA="yes", HAVE_ALSA="no")
688   ])
689 ])
690
691 dnl *** arts ***
692 dnl if mcopidl can't be found there's no use in compiling it
693 AC_CHECK_PROG(MCOPIDL, mcopidl, yes, no)
694 if test "x$HAVE_MCOPIDL" = "xno";
695 then
696   USE_ARTS=no
697 fi
698
699 translit(dnm, m, l) AM_CONDITIONAL(USE_ARTS, true)
700 GST_CHECK_FEATURE(ARTS, [arts plug-ins], arts, [
701   AM_PATH_ARTS(, HAVE_ARTS=yes, HAVE_ARTS=no)
702 ])
703
704 dnl *** artsc ***
705 translit(dnm, m, l) AM_CONDITIONAL(USE_ARTSC, true)
706 GST_CHECK_FEATURE(ARTSC, [artsd plug-ins], artsdsink, [
707   GST_CHECK_ARTSC()
708 ])
709
710 dnl *** audiofile ***
711 dnl this check uses the GST_CHECK_CONFIGPROG macro
712 translit(dnm, m, l) AM_CONDITIONAL(USE_AUDIOFILE, true)
713 GST_CHECK_FEATURE(AUDIOFILE, [audiofile], afsink afsrc, [
714   translit(dnm, m, l) AC_SUBST(AUDIOFILE_LIBS)
715   translit(dnm, m, l) AC_SUBST(AUDIOFILE_CFLAGS)
716   dnl check with pkg-config first
717   PKG_CHECK_MODULES(AUDIOFILE, audiofile, HAVE_AUDIOFILE="yes", HAVE_AUDIOFILE="no")
718   if test "x$HAVE_AUDIOFILE" = "xno"; then
719     GST_CHECK_CONFIGPROG(AUDIOFILE, audiofile-config)
720     dnl we need this function
721     AC_CHECK_LIB(audiofile, afOpenVirtualFile, , HAVE_AUDIOFILE="no")
722   fi])
723
724 dnl *** CDParanoia ***
725 translit(dnm, m, l) AM_CONDITIONAL(USE_CDPARANOIA, true)
726 GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
727   GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface, 
728                       cdda_open, -lm, 
729                       cdda_interface.h, 
730                       CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
731                       HEADER_DIR="no"
732                       FOUND_CDPARANOIA="yes")
733   if test "x$FOUND_CDPARANOIA" != "xyes";
734   then
735     GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface, 
736                         cdda_open, -lm, 
737                         cdda/cdda_interface.h, 
738                         CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
739                         HEADER_DIR="yes"
740                         FOUND_CDPARANOIA="yes")
741   fi
742   if test "x$HEADER_DIR" = "xyes";
743   then
744     AC_DEFINE_UNQUOTED(CDPARANOIA_HEADERS_IN_DIR, ,
745                        defined if cdda headers are in a cdda/ directory)
746   fi
747   AC_SUBST(CDPARANOIA_LIBS)
748 ])
749 dnl FIXME : add second check somehow if that is necessary
750 dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
751 dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no)
752
753 dnl *** dirac ***
754 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRAC, true)
755 GST_CHECK_FEATURE(DIRAC, [dirac plug-ins], dirac, [
756   PKG_CHECK_MODULES(DIRAC, dirac, HAVE_DIRAC="yes", HAVE_DIRAC="no")
757   AC_SUBST(DIRAC_CFLAGS)
758   AC_SUBST(DIRAC_LIBS)
759 ])
760
761 dnl *** DIVX ***
762 translit(dnm, m, l) AM_CONDITIONAL(USE_DIVX, true)
763 GST_CHECK_FEATURE(DIVX, [divx plugins], divx, [
764   HAVE_DIVX=yes
765   AC_CHECK_HEADER(encore2.h, ,
766                   [ AC_MSG_WARN([Divx4linux encore headers not found]) &&
767                     HAVE_DIVX=no ] )
768   if [ test x$HAVE_DIVX = xyes ]; then
769     AC_MSG_CHECKING([Checking for valid divx4linux encore version])
770     AC_TRY_COMPILE([
771 #include <encore2.h>
772 #if ENCORE_VERSION != 20021024
773 #error Wrong version of divx encore libraries
774 #endif
775     ], [
776 return 0;
777     ], [ HAVE_DIVX=yes && AC_MSG_RESULT(yes)],
778        [ HAVE_DIVX=no  && AC_MSG_RESULT(no) &&
779          AC_MSG_WARN([Wrong version of divx4linux installed]) ])
780   fi
781   if [ test x$HAVE_DIVX = xyes ]; then
782     AC_CHECK_HEADER(decore.h, ,
783                     [ AC_MSG_WARN([Divx4linux decoder headers not found]) &&
784                       HAVE_DIVX=no ] )
785   fi
786   if [ test x$HAVE_DIVX = xyes ]; then
787     AC_MSG_CHECKING([Checking for valid divx4linux decore version])
788     AC_TRY_COMPILE([
789 #include <decore.h>
790 #if DECORE_VERSION != 20021112
791 #error Wrong version of divx decore libraries
792 #endif
793     ], [
794 return 0;
795     ], [ HAVE_DIVX=yes && AC_MSG_RESULT(yes)],
796        [ HAVE_DIVX=no  && AC_MSG_RESULT(no) &&
797          AC_MSG_WARN([Wrong version of divx4linux installed]) ])
798   fi
799   LIBS="-lm"
800   if test x$HAVE_DIVX = xyes; then
801     AC_CHECK_LIB(divxencore, encore, ,
802                  [ AC_MSG_WARN([Divx4linux encore libs not found]) &&
803                    HAVE_DIVX=no ] )
804   fi
805   if test x$HAVE_DIVX = xyes; then
806     AC_CHECK_LIB(divxdecore, decore, ,
807                  [ AC_MSG_WARN([Divx4linux decore libs not found]) &&
808                    HAVE_DIVX=no ] )
809   fi
810   if test x$HAVE_DIVX = xyes; then
811     DIVXENC_LIBS="-ldivxencore -lm"
812     DIVXDEC_LIBS="-ldivxdecore -lm"
813     AC_SUBST(DIVXENC_LIBS)
814     AC_SUBST(DIVXDEC_LIBS)
815   fi
816 ])
817
818 dnl *** DTS ***
819 translit(dnm, m, l) AM_CONDITIONAL(USE_DTS, true)
820 GST_CHECK_FEATURE(DTS, [dts library], dtsdec, [
821   GST_CHECK_LIBHEADER(DTS, dts_pic, dts_init, -lm, dts.h, DTS_LIBS="-ldts_pic -lm")
822   AC_SUBST(DTS_LIBS)
823 ])
824
825 dnl *** dvdread ***
826 translit(dnm, m, l) AM_CONDITIONAL(USE_DVDREAD, true)
827 GST_CHECK_FEATURE(DVDREAD, [dvdread library], dvdreadsrc, [
828   GST_CHECK_LIBHEADER(DVDREAD, dvdread, DVDOpen, , dvdread/dvd_reader.h, DVDREAD_LIBS="-ldvdread")
829   AC_SUBST(DVDREAD_LIBS)
830 ])
831
832 dnl *** dvdnav ***
833 translit(dnm, m, l) AM_CONDITIONAL(USE_DVDNAV, true)
834 GST_CHECK_FEATURE(DVDNAV, [dvdnav library], dvdnavsrc, [
835   translit(dnm, m, l) AC_SUBST(DVDNAV_LIBS)
836   translit(dnm, m, l) AC_SUBST(DVDNAV_CFLAGS)
837   GST_CHECK_CONFIGPROG(DVDNAV, dvdnav-config)
838   if test x"$HAVE_DVDNAV" = x"yes"; then
839     dnl check version
840     DVDNAV_VERSION=`dvdnav-config --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
841     DVDNAV_MAJOR=`echo $DVDNAV_VERSION | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
842     DVDNAV_MINOR=`echo $DVDNAV_VERSION | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
843     DVDNAV_MICRO=`echo $DVDNAV_VERSION | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
844     if [[ "$DVDNAV_MAJOR" -eq "0" ]] && \
845        [[ "$DVDNAV_MINOR" -lt "1" ]]; then
846       AC_MSG_WARN([libdvdnav >= 0.1.7 is required, you have $DVDNAV_VERSION])
847       HAVE_DVDNAV="no"
848     elif [[ "$DVDNAV_MAJOR" -eq "0" ]] && \
849          [[ "$DVDNAV_MINOR" -eq "1" ]] && \
850          [[ "$DVDNAV_MICRO" -lt "7" ]]; then
851       AC_MSG_WARN([libdvdnav >= 0.1.7 is required, you have $DVDNAV_VERSION])
852       HAVE_DVDNAV="no"
853       fi
854     fi
855   AS_SCRUB_INCLUDE(DVDNAV_CFLAGS)
856 ])
857
858 dnl **** ESound ****
859 translit(dnm, m, l) AM_CONDITIONAL(USE_ESD, true)
860 GST_CHECK_FEATURE(ESD, [esound plug-ins], esdsink esdmon, [
861   PKG_CHECK_MODULES(ESD, esound >= 0.2.12, [
862     HAVE_ESD="yes"
863     AC_SUBST(ESD_CFLAGS)
864     AC_SUBST(ESD_LIBS)
865   ], [
866     AM_PATH_ESD(0.2.12, HAVE_ESD="yes", HAVE_ESD="no")
867     AS_SCRUB_INCLUDE(ESD_CFLAGS)
868   ])
869 ])
870
871 dnl **** Free AAC Encoder (FAAC) ****
872 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAC, true)
873 GST_CHECK_FEATURE(FAAC, [AAC encoder plug-in], faac, [
874   GST_CHECK_LIBHEADER(FAAC, faac, faacEncOpen, -lm, faac.h, FAAC_LIBS="-lfaac -lm")
875   AS_SCRUB_INCLUDE(FAAC_CFLAGS)
876   AC_SUBST(FAAC_LIBS)
877 ])
878
879 dnl **** Free AAC Decoder (FAAD) ****
880 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAD, true)
881 GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
882   HAVE_FAAD="yes"
883   GST_CHECK_LIBHEADER(FAAD, faad, faacDecOpen, -lm, faad.h, FAAD_LIBS="-lfaad -lm", HAVE_FAAD="no")
884   if test $HAVE_FAAD = "yes"; then
885     AC_MSG_CHECKING([Checking for FAAD >= 2])
886     AC_TRY_COMPILE([
887 #include <faad.h>
888 #if !defined(FAAD2_VERSION) || !defined(FAAD_FMT_DOUBLE)
889 #error Not faad2
890 #endif
891     ], [ return 0; ],
892        [ HAVE_FAAD="yes" && AC_MSG_RESULT(yes)],
893        [ HAVE_FAAD="no"  && AC_MSG_RESULT(no)])
894   fi;
895   AS_SCRUB_INCLUDE(FAAD_CFLAGS)
896   AC_SUBST(FAAD_LIBS)
897 ])
898
899 dnl **** festival ****
900 dnl translit(dnm, m, l) AM_CONDITIONAL(USE_FESTIVAL, true)
901 dnl GST_CHECK_FEATURE(FESTIVAL, [festival plug-ins], festivalsrc, [
902   dnl NOTE: just using local net connection now, add this lib check
903   dnl       in the future if needed
904   dnl AC_LANG_PUSH(C++)
905   dnl dnl FIXME: took out func to check for
906   dnl dnl This check puts festival_tidy_up in extern "C".
907   dnl dnl But, at least on Debian as of 20020110, it is compiled with name
908   dnl dnl mangling C++ nonsense and symbols can't resolve
909   dnl dnl GST_CHECK_LIBHEADER(FESTIVAL, Festival, festival_tidy_up, , festival/festival.h, FESTIVAL_LIBS="-lFestival")
910   dnl GST_CHECK_LIBHEADER(FESTIVAL, Festival, , , festival/festival.h, FESTIVAL_LIBS="-lFestival")
911   dnl AC_LANG_POP(C++)
912   dnl AC_SUBST(FESTIVAL_LIBS)
913 dnl  HAVE_FESTIVAL=yes
914 dnl])
915
916 dnl *** FLAC ***
917 translit(dnm, m, l) AM_CONDITIONAL(USE_FLAC, true)
918 GST_CHECK_FEATURE(FLAC, [FLAC lossless audio], flacenc flacdec, [
919   GST_CHECK_LIBHEADER(FLAC, FLAC, FLAC__seekable_stream_encoder_new, -lm, FLAC/all.h, FLAC_LIBS="-lFLAC")
920   AC_SUBST(FLAC_LIBS)
921 ])
922
923 dnl *** GDK pixbuf ***
924 translit(dnm, m, l) AM_CONDITIONAL(USE_GDK_PIXBUF, true)
925 GST_CHECK_FEATURE(GDK_PIXBUF, [GDK pixbuf], gdkpixbufsrc, [
926   if test $HAVE_GTK_22 = "yes"; then HAVE_GDK_PIXBUF=yes; fi;
927 ])
928
929 dnl *** Gnome VFS ***
930 translit(dnm, m, l) AM_CONDITIONAL(USE_GNOME_VFS, true)
931 GST_CHECK_FEATURE(GNOME_VFS, [Gnome VFS], gnomevfssrc, [
932   PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0, HAVE_GNOME_VFS="yes", HAVE_GNOME_VFS="no")
933   AC_SUBST(GNOME_VFS_CFLAGS)
934   AC_SUBST(GNOME_VFS_LIBS)
935 ])
936
937 dnl *** gsm ***
938 translit(dnm, m, l) AM_CONDITIONAL(USE_GSM, true)
939 GST_CHECK_FEATURE(GSM, [GSM library], gsmenc gsmdec, [
940   GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm.h, GSM_LIBS="-lgsm")
941   if test $HAVE_GSM != "yes"; then
942     GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm/gsm.h, GSM_LIBS="-lgsm")
943     if test $HAVE_GSM = "yes"; then 
944       AC_DEFINE(GSM_HEADER_IN_SUBDIR, 1, [Define if GSM header in gsm/ subdir])
945     fi
946   fi
947   AC_SUBST(GSM_LIBS)
948 ])
949
950 dnl *** Hermes ***
951 translit(dnm, m, l) AM_CONDITIONAL(USE_HERMES, true)
952 GST_CHECK_FEATURE(HERMES, [Hermes library], hermescolorspace, [
953   GST_CHECK_LIBHEADER(HERMES, Hermes, Hermes_ConverterInstance, , Hermes/Hermes.h, HERMES_LIBS="-lHermes")
954 ], AC_SUBST(HERMES_LIBS))
955
956 dnl *** http ***
957 dnl translit(dnm, m, l) AM_CONDITIONAL(USE_HTTP, true)
958 dnl GST_CHECK_FEATURE(HTTP, [http plug-ins], gsthttpsrc, [
959 dnl  dnl FIXME: need to check for header
960 dnl  GHTTP_LIBS=
961 dnl  GST_HTTPSRC_GET_TYPE=
962 dnl  if test x$USE_GLIB2 = xyes; then
963 dnl    AC_MSG_WARN(ghttp disabled for glib2.0)
964 dnl  else
965 dnl    AC_CHECK_LIB(ghttp, ghttp_request_new,
966 dnl      [HTTP_LIBS="-lghttp"
967 dnl       GST_HTTPSRC_GET_TYPE="gst_httpsrc_get_type"
968 dnl       HAVE_HTTP=yes
969 dnl      ], :, $LIBS)
970 dnl  fi
971 dnl  AC_SUBST(HTTP_LIBS)
972 dnl  AC_SUBST(GST_HTTPSRC_GET_TYPE)
973 dnl ])
974
975 dnl *** ivorbis ***
976 dnl AM_PATH_IVORBIS only takes two options
977 translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
978 GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
979   IVORBIS_LIBS=
980   IVORBIS_CFLAGS=
981   AC_CHECK_LIB(vorbisidec, vorbis_block_init,
982     [IVORBIS_LIBS=-lvorbisidec
983      HAVE_IVORBIS=yes],
984     HAVE_IVORBIS=no)
985   AC_SUBST(IVORBIS_LIBS)
986   AC_SUBST(IVORBIS_CFLAGS)
987 ])
988
989 dnl *** Jack ***
990 translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
991 GST_CHECK_FEATURE(JACK, Jack, jack, [
992   PKG_CHECK_MODULES(JACK, jack >= 0.29.0, HAVE_JACK="yes", HAVE_JACK="no")
993   AC_SUBST(JACK_CFLAGS)
994   AC_SUBST(JACK_LIBS)
995 ])
996
997 dnl *** jpeg ***
998 dnl FIXME: we could use header checks here as well IMO
999 translit(dnm, m, l) AM_CONDITIONAL(USE_JPEG, true)
1000 GST_CHECK_FEATURE(JPEG, [jpeg], jpegenc jpegdec, [
1001   AC_ARG_WITH(jpeg-mmx,
1002     [  --with-jpeg-mmx, path to MMX'ified JPEG library])
1003   OLD_LIBS="$LIBS"
1004   if test x$with_jpeg_mmx != x; then
1005     LIBS="$LIBS -L$with_jpeg_mmx"
1006   fi
1007   AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
1008   JPEG_LIBS="$LIBS -ljpeg-mmx"
1009   LIBS="$OLD_LIBS"
1010   if test x$HAVE_JPEG != xyes; then
1011     AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
1012     JPEG_LIBS="-ljpeg"
1013   fi
1014   AC_SUBST(JPEG_LIBS)
1015 ])
1016
1017 dnl *** KDE / Qt ***
1018
1019 dnl * Qt *
1020
1021 qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3 /usr/local/qt"
1022
1023 dnl Build include path search path from the list of Qt dirs
1024
1025 qt_include_dirs=""
1026 for dir in $qt_dirs; do
1027   qt_include_dirs="$qt_include_dirs $dir/include $dir"
1028 done
1029
1030 qt_include_dirs="$qt_include_dirs /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/include/qt3"
1031
1032 for dir in $qt_include_dirs; do
1033   if test -r "$dir/qglobal.h"; then
1034     qt_include_dir=$dir
1035     break
1036   fi
1037 done
1038
1039 for dir in $qt_dirs; do
1040   qt_lib_dirs="$qt_lib_dirs $dir/lib $dir"
1041 done
1042
1043 qt_lib_dirs="$qt_lib_dirs /usr/X11R6/lib /usr/lib"
1044
1045 for dir in $qt_lib_dirs; do
1046   try="ls -1 $dir/libqt-mt.*"
1047   if test -n "`$try 2> /dev/null`"; then
1048     qt_lib_dir=$dir
1049     break
1050   fi
1051 done
1052
1053 dnl * KDE *
1054
1055 translit(dnm, m, l) AM_CONDITIONAL(USE_KIO, true)
1056 GST_CHECK_FEATURE(KIO, [kio], kio, [
1057   AC_PATH_PROG(KDE_CONFIG, kde-config, no)
1058
1059   if test x$KDE_CONFIG != xno; then
1060     KDE_PREFIX=`$KDE_CONFIG --prefix`
1061   fi
1062
1063   kde_include_dirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include"
1064   kde_lib_dirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib"
1065
1066   if test -n "$KDE_PREFIX"; then
1067     kde_include_dirs="$KDE_PREFIX/include $KDE_PREFIX/include/kde $KDE_PREFIX $kde_include_dirs"
1068     kde_lib_dirs="$KDE_PREFIX/lib $KDE_PREFIX $kde_lib_dirs"
1069   fi
1070   if test -n "$KDEDIR"; then
1071     kde_include_dirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_include_dirs"
1072     kde_lib_dirs="$KDEDIR/lib $KDEDIR $kde_lib_dirs"
1073   fi
1074
1075   for dir in $kde_include_dirs; do
1076     if test -r "$dir/kglobal.h" && test -r "$dir/kdemacros.h"; then
1077       kde_include_dir=$dir
1078       break
1079     fi
1080   done
1081
1082   for dir in $kde_lib_dirs; do
1083     try="ls -1 $dir/libkio.*"
1084     if test -n "`$try 2> /dev/null`"; then
1085       kde_lib_dir=$dir
1086       break
1087     fi
1088   done
1089
1090   if test -n $kde_include_dir && test -n $kde_lib_dir; then
1091     KIO_CFLAGS="-I$kde_include_dir -I$qt_include_dir"
1092     KIO_LIBS="-L$KDE_PREFIX/lib -L$qt_lib_dir -lkio -lqt-mt"
1093     AC_LANG_PUSH(C++)
1094     save_LIBS="$LIBS"
1095     save_CPPFLAGS="$CPPFLAGS"
1096     LIBS="$LIBS $KIO_LIBS"
1097     CPPFLAGS="$CPPFLAGS $KIO_CFLAGS"
1098     AC_TRY_LINK([
1099 #include <kio/job.h>
1100                  ], [
1101 KIO::get ("bla")
1102                  ], HAVE_KIO="yes", HAVE_KIO="no")
1103     LIBS="$save_LIBS"
1104     CPPFLAGS="$save_CPPFLAGS"
1105     AC_LANG_POP(C++)
1106     AC_SUBST(KIO_CFLAGS)
1107     AC_SUBST(KIO_LIBS)
1108   else
1109     HAVE_KIO="false"
1110   fi
1111 ])
1112
1113 dnl *** ladspa ***
1114 translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true)
1115 GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [
1116   AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA="yes", HAVE_LADSPA="no")
1117 ])
1118
1119 dnl *** lame ***
1120 translit(dnm, m, l) AM_CONDITIONAL(USE_LAME, true)
1121 GST_CHECK_FEATURE(LAME, [lame mp3 encoder library], lame, [
1122   GST_CHECK_LIBHEADER(LAME, mp3lame, lame_init, -lm, lame/lame.h, HAVE_LAME="yes" LAME_LIBS="-lmp3lame")
1123 ])
1124 AC_SUBST(LAME_LIBS)
1125
1126 dnl *** libcolorspace ***
1127 translit(dnm, m, l) AM_CONDITIONAL(USE_LCS, true)
1128 GST_CHECK_FEATURE(LCS, Lcs, lcs, [
1129   PKG_CHECK_MODULES(LCS, lcs, HAVE_LCS="yes", HAVE_LCS="no")
1130   AC_SUBST(LCS_CFLAGS)
1131   AC_SUBST(LCS_LIBS)
1132 ])
1133
1134 dnl *** libdv ***
1135 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBDV, true)
1136 GST_CHECK_FEATURE(LIBDV, [libdv DV/video decoder], dvdec, [
1137   PKG_CHECK_MODULES(LIBDV, libdv >= 0.98, HAVE_LIBDV="yes", HAVE_LIBDV="no")
1138   AC_SUBST(LIBDV_CFLAGS)
1139   AC_SUBST(LIBDV_LIBS)
1140 ])
1141
1142 dnl *** libcaca ***
1143 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBCACA, true)
1144 GST_CHECK_FEATURE(LIBCACA, [libcaca], libcaca, [
1145   GST_CHECK_CONFIGPROG(LIBCACA, caca-config)
1146   AC_SUBST(LIBCACA_CFLAGS)
1147   AC_SUBST(LIBCACA_LIBS)
1148 ])
1149
1150 dnl *** libfame ***
1151 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBFAME, true)
1152 GST_CHECK_FEATURE(LIBFAME, [libfame MPEG1/4 encoder], libfame, [
1153   AM_PATH_LIBFAME(0.9.0, HAVE_LIBFAME="yes", HAVE_LIBFAME="no")
1154   AC_SUBST(LIBFAME_CFLAGS)
1155   AC_SUBST(LIBFAME_LIBS)
1156 ])
1157
1158 dnl *** libpng ***
1159 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBPNG, true)
1160 GST_CHECK_FEATURE(LIBPNG, [libpng PNG encoder], pngenc, [
1161   PKG_CHECK_MODULES(LIBPNG, libpng12, HAVE_LIBPNG="yes", HAVE_LIBPNG="no")
1162   AC_SUBST(LIBPNG_CFLAGS)
1163   AC_SUBST(LIBPNG_LIBS)
1164 ])
1165
1166 dnl *** librfb ***
1167 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBRFB, true)
1168 GST_CHECK_FEATURE(LIBRFB, [librfb Remote Framebuffer], rfbsrc, [
1169   PKG_CHECK_MODULES(LIBRFB, librfb-0.1, HAVE_LIBRFB="yes", HAVE_LIBRFB="no")
1170   AC_SUBST(LIBRFB_CFLAGS)
1171   AC_SUBST(LIBRFB_LIBS)
1172 ])
1173
1174 dnl *** libvisual ***
1175 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
1176 GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [
1177   PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.1.1, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no")
1178   AC_SUBST(LIBVISUAL_CFLAGS)
1179   AC_SUBST(LIBVISUAL_LIBS)
1180 ])
1181
1182 dnl *** mad ***
1183 dnl FIXME: we could use header checks here as well IMO
1184 translit(dnm, m, l) AM_CONDITIONAL(USE_MAD, true)
1185 GST_CHECK_FEATURE(MAD, [mad mp3 decoder], mad, [
1186   dnl check with pkg-config first
1187   PKG_CHECK_MODULES(MAD, mad >= 0.15 id3tag >= 0.15, HAVE_MAD="yes", HAVE_MAD="no")
1188   if test "x$HAVE_MAD" = "xno"; then
1189     dnl fall back to oldskool detection
1190     AC_CHECK_LIB(mad, mad_decoder_finish, HAVE_MAD="yes" MAD_LIBS="-lmad")
1191     if test "x$HAVE_MAD" = "xyes"; then
1192       HAVE_MAD="no"
1193       save_LIBS=$LIBS
1194       LIBS="-lz"
1195       AC_CHECK_LIB(id3tag, id3_tag_options, HAVE_MAD="yes" MAD_LIBS="-lmad -lid3tag -lz")
1196       LIBS=$save_LIBS
1197     fi
1198   fi    
1199 ])
1200 AC_SUBST(MAD_LIBS)
1201
1202 dnl *** mikmod ***
1203 translit(dnm, m, l) AM_CONDITIONAL(USE_MIKMOD, true)
1204 GST_CHECK_FEATURE(MIKMOD, [mikmod plug-in], mikmod, [
1205   AM_PATH_LIBMIKMOD(, HAVE_MIKMOD=yes, HAVE_MIKMOD=no)
1206   AC_SUBST(MIKMOD_LIBS, "$LIBMIKMOD_LIBS")
1207   AC_SUBST(MIKMOD_CFLAGS, "$LIBMIKMODCFLAGS")
1208 ])
1209
1210 dnl *** mpeg2dec ***
1211 translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2DEC, true)
1212 GST_CHECK_FEATURE(MPEG2DEC, [mpeg2dec], mpeg2dec, [
1213   PKG_CHECK_MODULES(MPEG2DEC, libmpeg2 >= 0.4.0,
1214       HAVE_MPEG2DEC="yes", HAVE_MPEG2DEC="no")
1215   AC_SUBST(MPEG2DEC_CFLAGS)
1216   AC_SUBST(MPEG2DEC_LIBS)
1217 ])
1218
1219 dnl *** mpeg2enc ***
1220 translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2ENC, true)
1221 GST_CHECK_FEATURE(MPEG2ENC, [mpeg2enc], mpeg2enc, [
1222   HAVE_MPEG2ENC="no"
1223   dnl we require a c++ compiler for this one
1224   if [ test x$HAVE_CXX = xyes ]; then
1225     dnl libmpeg2enc was first included in mjpegtools-1.6.2-rc3 (1.6.1.92)
1226     dnl since many distros include mjpegtools specifically without mplex
1227     dnl and mpeg2enc, we check for mpeg2enc on its own, too.
1228     PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.93, [
1229       dnl switch over to c++ to test things
1230       AC_LANG_CPLUSPLUS
1231       OLD_CPPFLAGS="$CPPFLAGS"
1232       CPPFLAGS="$CPPFLAGS $MPEG2ENC_CFLAGS"
1233       AC_CHECK_HEADER(mpeg2encoder.hh, [
1234         MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp -lm -lpthread"
1235         OLD_LIBS="$LIBS"
1236         LIBS="$LIBS $MPEG2ENC_LIBS"
1237         AC_MSG_CHECKING([for valid mpeg2enc objects])
1238         AC_TRY_RUN([
1239 #include <mpeg2encoder.hh>
1240 #include <mpeg2encoptions.hh>
1241
1242 int
1243 main (int   argc,
1244       char *argv[])
1245 {
1246   MPEG2EncOptions *options = new MPEG2EncOptions ();
1247   MPEG2Encoder encoder (*options);
1248   return 0;
1249 }
1250         ],[
1251           HAVE_MPEG2ENC="yes"
1252           AC_SUBST(MPEG2ENC_CFLAGS)
1253           AC_SUBST(MPEG2ENC_LIBS)
1254           AC_MSG_RESULT(yes)
1255         ], AC_MSG_RESULT(no))
1256         LIBS="$OLD_LIBS"
1257       ])
1258       CPPFLAGS="$OLD_CPPFLAGS"
1259       AC_LANG_C
1260     ],
1261     HAVE_MPEG2ENC="no")
1262   fi
1263 ])
1264
1265 dnl *** mplex ***
1266 translit(dnm, m, l) AM_CONDITIONAL(USE_MPLEX, true)
1267 GST_CHECK_FEATURE(MPLEX, [mplex], mplex, [
1268   HAVE_MPLEX="no"
1269   dnl we require a c++ compiler for this one
1270   if [ test x$HAVE_CXX = xyes ]; then
1271     dnl libmplex was first included in mjpegtools-1.6.2-rc4 (1.6.1.93)
1272     dnl since many distros include mjpegtools specifically without mplex
1273     dnl and mpeg2enc, we check for mplex on its own, too.
1274     PKG_CHECK_MODULES(MPLEX, mjpegtools >= 1.6.1.93, [
1275       dnl switch over to c++ to test things
1276       AC_LANG_CPLUSPLUS
1277       OLD_CPPFLAGS="$CPPFLAGS"
1278       CPPFLAGS="$CPPFLAGS $MPLEX_CFLAGS"
1279       AC_CHECK_HEADER(interact.hpp, [
1280         MPLEX_LIBS="$MPLEX_LIBS -lmplex2 -lm"
1281         OLD_LIBS="$LIBS"
1282         LIBS="$LIBS $MPLEX_LIBS"
1283         AC_MSG_CHECKING([for valid mplex objects])
1284         AC_TRY_RUN([
1285 #include <interact.hpp>
1286 #include <outputstrm.hpp>
1287 #include <multiplexor.hpp>
1288
1289 int
1290 main (int   argc,
1291       char *argv[])
1292 {
1293   class TestOutputStream : public OutputStream {
1294   public:
1295     TestOutputStream () : OutputStream () { }
1296     void Write (uint8_t *a, unsigned int b) { }
1297     void NextSegment () { }
1298     off_t SegmentSize () { }
1299     void Close () { }
1300     int Open () { }
1301   };
1302   MultiplexJob *job = new MultiplexJob ();
1303   vector<IBitStream *> inputs;
1304   job->SetupInputStreams (inputs);
1305   TestOutputStream *out = new TestOutputStream ();
1306   Multiplexor mux (*job, *out);
1307   return 0;
1308 }
1309         ],[
1310           HAVE_MPLEX="yes"
1311           AC_SUBST(MPLEX_CFLAGS)
1312           AC_SUBST(MPLEX_LIBS)
1313           AC_MSG_RESULT(yes)
1314         ], AC_MSG_RESULT(no))
1315         LIBS="$OLD_LIBS"
1316       ])
1317       CPPFLAGS="$OLD_CPPFLAGS"
1318       AC_LANG_C
1319     ], HAVE_MPLEX="no")
1320   fi
1321 ])
1322
1323 dnl *** musicbrainz ***
1324 dnl libmusicbrainz <= 2.0.2 has symbol clashes with ffmpeg
1325 translit(dnm, m, l) AM_CONDITIONAL(USE_MUSICBRAINZ, true)
1326 GST_CHECK_FEATURE(MUSICBRAINZ, [musicbrainz], musicbrainz, [
1327   PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz > 2.0.2,
1328       HAVE_MUSICBRAINZ="yes", HAVE_MUSICBRAINZ="no")
1329   AC_SUBST(MUSICBRAINZ_CFLAGS)
1330   AC_SUBST(MUSICBRAINZ_LIBS)
1331 ])
1332
1333 dnl *** nas ***
1334 translit(dnm, m, l) AM_CONDITIONAL(USE_NAS, true)
1335 GST_CHECK_FEATURE(NAS, [nas plug-in], nassink, [
1336   HAVE_NAS="no"
1337   if test "x$HAVE_X" = "xyes"; then
1338     save_cppflags=$CFLAGS
1339     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1340     GST_CHECK_LIBHEADER(NAS, audio, AuOpenServer, $X_LIBS, audio/audiolib.h,
1341       NAS_LIBS="$X_LIBS -laudio" NAS_CFLAGS="$X_CFLAGS")
1342     CPPFLAGS="$save_cppflags"
1343   fi
1344   AC_SUBST(NAS_CFLAGS)
1345   AC_SUBST(NAS_LIBS)
1346 ])
1347
1348 dnl *** pango ***
1349 translit(dnm, m, l) AM_CONDITIONAL(USE_PANGO, true)
1350 GST_CHECK_FEATURE(PANGO, [pango], pango, [
1351   PKG_CHECK_MODULES(PANGO, pango pangoft2,
1352       HAVE_PANGO="yes", HAVE_PANGO="no")
1353   AC_SUBST(PANGO_CFLAGS)
1354   AC_SUBST(PANGO_LIBS)
1355 ])
1356
1357 dnl *** raw1394 ***
1358 translit(dnm, m, l) AM_CONDITIONAL(USE_RAW1394, true)
1359 GST_CHECK_FEATURE(RAW1394, [raw1394 library], dv1394src, [
1360   GST_CHECK_LIBHEADER(RAW1394, raw1394, raw1394_new_handle,, libraw1394/raw1394.h, RAW1394_LIBS="-lraw1394")
1361   AC_SUBST(RAW1394_LIBS)
1362 ])
1363
1364 dnl *** SDL ***
1365 translit(dnm, m, l) AM_CONDITIONAL(USE_SDL, true)
1366 GST_CHECK_FEATURE(SDL, [SDL plug-in], sdlvideosink, [
1367   dnl sdlvideosink depends on the xoverlay interface, which depends on X
1368   if test x$HAVE_X = xyes; then
1369     AM_PATH_SDL(, HAVE_SDL=yes, HAVE_SDL=no)
1370   fi
1371 ])
1372
1373 dnl *** shout ***
1374 translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT, true)
1375 GST_CHECK_FEATURE(SHOUT, [shout plug-in], icecastsend, [
1376   GST_CHECK_LIBHEADER(SHOUT, shout, shout_init_connection,, shout/shout.h, SHOUT_LIBS="-lshout")
1377   AC_SUBST(SHOUT_LIBS)
1378 ])
1379
1380 dnl *** shout2 *** 
1381 translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT2, true)
1382 GST_CHECK_FEATURE(SHOUT2, [shout2 plug-in], shout2send, [
1383   PKG_CHECK_MODULES(SHOUT2, shout >= 2.0, [
1384     HAVE_SHOUT2="yes"
1385     AC_SUBST(SHOUT2_CFLAGS)
1386     AC_SUBST(SHOUT2_LIBS)
1387   ], [
1388     AM_PATH_SHOUT2(HAVE_SHOUT2="yes", HAVE_SHOUT2="no")
1389     AC_SUBST(SHOUT2_CFLAGS)
1390     AC_SUBST(SHOUT2_LIBS)
1391   ])
1392 ])
1393
1394 dnl *** sidplay ***
1395 translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true)
1396 GST_CHECK_FEATURE(SIDPLAY, [sidplay plug-in], sidplay, [
1397   GST_PATH_SIDPLAY()
1398 ])
1399
1400 dnl *** smoothwave ***
1401 translit(dnm, m, l) AM_CONDITIONAL(USE_SMOOTHWAVE, true)
1402 GST_CHECK_FEATURE(SMOOTHWAVE, [smoothwave plug-in], smoothwave, [
1403   if test $HAVE_GTK = "yes"; then HAVE_SMOOTHWAVE=yes; fi;
1404 ])
1405
1406
1407 dnl *** snapshot ***
1408 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBPNG, true)
1409 GST_CHECK_FEATURE(LIBPNG, [snapshot plug-in], snapshot, [
1410   GST_CHECK_LIBHEADER(LIBPNG, png, png_read_info, -lz -lm, png.h, LIBPNG_LIBS="-lpng -lz -lm")
1411   AC_SUBST(LIBPNG_LIBS)
1412 ])
1413
1414 dnl *** speex 1.0 only, not 1.1 ***
1415 dnl speex_jitter.h is 1.1 only
1416 translit(dnm, m, l) AM_CONDITIONAL(USE_SPEEX, true)
1417 GST_CHECK_FEATURE(SPEEX, [speex plug-in], speex, [
1418   GST_CHECK_LIBHEADER(SPEEX, speex, speex_bits_init, , speex.h, [
1419     AC_CHECK_HEADER(speex_jitter.h, HAVE_SPEEX="no", [
1420       HAVE_SPEEX="yes"
1421       SPEEX_LIBS="-lspeex"
1422       AC_SUBST(SPEEX_CFLAGS)
1423       AC_SUBST(SPEEX_LIBS)
1424     ])
1425   ])
1426 ])
1427
1428 dnl *** sndfile ***
1429 translit(dnm, m, l) AM_CONDITIONAL(USE_SNDFILE, true)
1430 GST_CHECK_FEATURE(SNDFILE, [sndfile plug-in], sfsrc sfsink, [
1431   PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.0, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
1432   AC_SUBST(SNDFILE_CFLAGS)
1433   AC_SUBST(SNDFILE_LIBS)
1434 ])
1435
1436 dnl *** swfdec ***
1437 translit(dnm, m, l) AM_CONDITIONAL(USE_SWFDEC, true)
1438 GST_CHECK_FEATURE(SWFDEC, [swfdec plug-in], swfdec, [
1439   PKG_CHECK_MODULES(SWFDEC, swfdec >= 0.1.3.1, HAVE_SWFDEC=yes, HAVE_SWFDEC=no)
1440   AC_SUBST(SWFDEC_CFLAGS)
1441   AC_SUBST(SWFDEC_LIBS)
1442 ])
1443
1444 dnl *** tarkin ***
1445 dnl for now the sources are included in the plug-in
1446 dnl and should be moved to ext-libs/ perhaps
1447 translit(dnm, m, l) AM_CONDITIONAL(USE_TARKIN, true)
1448 GST_CHECK_FEATURE(TARKIN, [tarkinenc tarkindec], tarkin, [
1449   HAVE_TARKIN="yes"
1450 ])
1451
1452 dnl *** ogg ***
1453 translit(dnm, m, l) AM_CONDITIONAL(USE_OGG, true)
1454 GST_CHECK_FEATURE(OGG, [ogg de/encoder], oggdemux oggmux, [
1455   PKG_CHECK_MODULES(OGG, ogg >= 1.0, [
1456     HAVE_OGG="yes"
1457     AC_SUBST(OGG_CFLAGS)
1458     AC_SUBST(OGG_LIBS)
1459   ], [
1460     XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
1461     AS_SCRUB_INCLUDE(OGG_CFLAGS)
1462   ])
1463 ])
1464
1465 dnl *** theora ***
1466 dnl FIXME: theora doesn't have proper pc/m4 files yet, change this when this happens
1467 translit(dnm, m, l) AM_CONDITIONAL(USE_THEORA, true)
1468 GST_CHECK_FEATURE(THEORA, [ogg theora codec], theoradec, [
1469   GST_CHECK_LIBHEADER(THEORA, theora, theora_version_string, , theora/theora.h, THEORA_LIBS="-ltheora")
1470   AC_SUBST(THEORA_LIBS)
1471 ])
1472
1473 dnl *** vorbis ***
1474 dnl AM_PATH_VORBIS only takes two options
1475 translit(dnm, m, l) AM_CONDITIONAL(USE_VORBIS, true)
1476 GST_CHECK_FEATURE(VORBIS, [vorbis plug-in], vorbisenc vorbisdec, [
1477   PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0 vorbisenc >= 1.0, [
1478     HAVE_VORBIS="yes"
1479   ], [
1480     XIPH_PATH_VORBIS(HAVE_VORBIS="yes", HAVE_VORBIS="no")
1481     AS_SCRUB_INCLUDE(VORBIS_CFLAGS)
1482   ])
1483 ])
1484 if test "x$HAVE_VORBIS" = "xyes"; then
1485   ac_cflags_save="$CFLAGS"
1486   dnl FIXME: does this work on non-gcc? -- Company
1487   CFLAGS="-Wall -Werror"
1488   AC_COMPILE_IFELSE(
1489     AC_LANG_PROGRAM([
1490 #include <vorbis/codec.h>
1491                      ],[
1492 vorbis_dsp_state *v;
1493
1494 vorbis_synthesis_restart (v);
1495                      ]), HAVE_VSR=yes, HAVE_VSR=no)
1496   if test "x$HAVE_VSR" = "xyes"; then
1497     AC_DEFINE_UNQUOTED(HAVE_VORBIS_SYNTHESIS_RESTART, 1,
1498                        [defined if vorbis_synthesis_restart is present])
1499   fi
1500   CFLAGS="$ac_cflags_save"
1501 fi
1502
1503 dnl *** xine ***
1504 translit(dnm, m, l) AM_CONDITIONAL(USE_XINE, true)
1505 GST_CHECK_FEATURE(XINE, [xine wrapper], xine, [
1506   PKG_CHECK_MODULES(XINE, libxine >= 1.0.0, HAVE_XINE=yes, HAVE_XINE=no)
1507   AC_SUBST(XINE_CFLAGS)
1508   AC_SUBST(XINE_LIBS)
1509 ],disabled)
1510
1511 dnl *** XVID ***
1512 translit(dnm, m, l) AM_CONDITIONAL(USE_XVID, true)
1513 GST_CHECK_FEATURE(XVID, [xvid plugins], xvid, [
1514   HAVE_XVID=no
1515   AC_CHECK_HEADER(xvid.h, [
1516     OLD_LIBS="$LIBS"
1517     LIBS="-lm"
1518     AC_CHECK_LIB(xvidcore, xvid_encore, [
1519       AC_CHECK_LIB(xvidcore, xvid_decore, [
1520         AC_CHECK_LIB(xvidcore, xvid_global, [
1521           AC_MSG_CHECKING([for uptodate XviD API version])
1522           AC_TRY_RUN([
1523 #include <xvid.h>
1524 #if XVID_API != XVID_MAKE_API(4,0)
1525 #error "Incompatible XviD API version"
1526 #endif
1527 int main () { return 0; }
1528           ],[ AC_MSG_RESULT(yes)
1529             XVID_LIBS="-lxvidcore -lm"
1530             AC_SUBST(XVID_LIBS)
1531             HAVE_XVID=yes
1532           ], AC_MSG_RESULT(no) )
1533         ], )
1534       ], )
1535     ], )
1536     LIBS="$OLD_LIBS"
1537   ], )
1538 ])
1539
1540
1541 fi dnl of EXT plugins
1542
1543 dnl Check for atomic.h
1544 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
1545 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
1546 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
1547 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
1548 if test x$HAVE_ATOMIC_H = xyes; then
1549   AC_TRY_RUN([
1550 #include "asm/atomic.h"
1551 main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
1552   ],, [
1553     # Not successful
1554     if test x$HAVE_ATOMIC_H = xyes; then
1555       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
1556     fi
1557     HAVE_ATOMIC_H=no
1558   ], [
1559     # Cross compiling
1560     AC_MSG_RESULT(yes)
1561     AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
1562   ])
1563 fi
1564
1565
1566 dnl ######################################################################
1567 dnl # Check command line parameters, and set shell variables accordingly #
1568 dnl ######################################################################
1569
1570 AC_ARG_ENABLE(libmmx,
1571   AC_HELP_STRING([--enable-libmmx],[use libmmx, if available]),
1572 [case "${enableval}" in
1573   yes) USE_LIBMMX=$HAVE_LIBMMX ;;
1574   no)  USE_LIBMMX=no ;;
1575   *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmmx) ;;
1576 esac], 
1577 [USE_LIBMMX=$HAVE_LIBMMX]) dnl Default value
1578
1579 AC_ARG_ENABLE(atomic,
1580   AC_HELP_STRING([--enable-atomic],[use atomic reference counting header]),
1581 [case "${enableval}" in
1582   yes) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
1583   noset) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
1584   no)  USE_ATOMIC_H=no;;
1585   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
1586 esac], 
1587 [USE_ATOMIC_H=$HAVE_ATOMIC_H]) dnl Default value
1588
1589 AC_ARG_ENABLE(profiling,
1590   AC_HELP_STRING([--enable-profiling],
1591                  [-pg to compiler commandline, for profiling]),
1592 [case "${enableval}" in
1593   yes) USE_PROFILING=yes ;;
1594   no)  UES_PROFILING=no ;;
1595   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
1596 esac], 
1597 [USE_PROFILING=no]) dnl Default value
1598
1599 AC_ARG_ENABLE(tests,
1600   AC_HELP_STRING([--disable-tests],[disable building test apps]),
1601 [case "${enableval}" in
1602   yes) BUILD_TESTS=yes ;;
1603   no)  BUILD_TESTS=no ;;
1604   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
1605 esac], 
1606 [BUILD_TESTS=yes]) dnl Default value
1607
1608 AC_ARG_ENABLE(examples,
1609   AC_HELP_STRING([--disable-examples],[disable building examples]),
1610 [case "${enableval}" in
1611   yes) BUILD_EXAMPLES=yes ;;
1612   no)  BUILD_EXAMPLES=no ;;
1613   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
1614 esac], 
1615 [BUILD_EXAMPLES=yes]) dnl Default value
1616
1617 dnl seeking needs freetype, so check for it here
1618 PKG_CHECK_MODULES(FT2, freetype2 >= 2.0.9, HAVE_FT2="yes", [
1619   AC_CHECK_FT2(2.0.9, HAVE_FT2="yes", HAVE_FT2="no")
1620 ])
1621 dnl make the HAVE_FT2 variable available to automake and Makefile.am
1622 AM_CONDITIONAL(HAVE_FT2, test "x$HAVE_FT2" = "xyes")
1623 AC_SUBST(FT2_CFLAGS)
1624 AC_SUBST(FT2_LIBS)
1625
1626 dnl ################################################
1627 dnl # Set defines according to variables set above #
1628 dnl ################################################
1629
1630
1631 if test "x$USE_LIBMMX" = xyes; then
1632   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
1633 fi
1634
1635 if test "x$USE_ATOMIC_H" = xyes; then
1636   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
1637 fi
1638
1639 # do not use deprecated stuff
1640 GST_CFLAGS="$GST_CFLAGS -DGST_DISABLE_DEPRECATED"
1641
1642 if test "x$USE_DEBUG" = xyes; then
1643   GST_CFLAGS="$GST_CFLAGS -g"
1644 fi
1645
1646 dnl #############################
1647 dnl # Set automake conditionals #
1648 dnl #############################
1649
1650 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
1651 dnl HAVE_ and it is likely to be easier to stick with the old name
1652 AM_CONDITIONAL(HAVE_LIBMMX,         test "x$USE_LIBMMX" = "xyes")
1653
1654 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
1655
1656 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
1657 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
1658
1659 AM_CONDITIONAL(HAVE_NASM,           test "x$HAVE_NASM" = "xyes")
1660 AM_CONDITIONAL(HAVE_GTK,            test "x$HAVE_GTK" = "xyes")
1661 AM_CONDITIONAL(HAVE_GTK_DOC,        $HAVE_GTK_DOC)
1662 AM_CONDITIONAL(BUILD_DOCS,          test "x$BUILD_DOCS" = "xyes")
1663 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
1664 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
1665 AM_CONDITIONAL(BUILD_PLUGIN_DOCS,   test "x$BUILD_PLUGIN_DOCS" = "xyes")
1666 AM_CONDITIONAL(HAVE_FIG2DEV_PNG,    $HAVE_FIG2DEV_PNG)
1667 AM_CONDITIONAL(HAVE_FIG2DEV_PDF,    $HAVE_FIG2DEV_PDF)
1668 AM_CONDITIONAL(HAVE_RAW1394,        test "x$HAVE_RAW1394" = "xyes")
1669
1670 dnl prefer internal headers to already installed ones
1671 GST_CFLAGS="-I\$(top_srcdir)/gst-libs $GST_CFLAGS $GST_ERROR"
1672
1673 AC_SUBST(GST_LIBS)
1674 AC_SUBST(GST_CFLAGS)
1675
1676 dnl ###########################
1677 dnl # Configure external libs #
1678 dnl ###########################
1679
1680 dnl ############################
1681 dnl # Set up some more defines #
1682 dnl ############################
1683
1684 dnl set license and copyright notice
1685 AC_DEFINE(GST_LICENSE, "LGPL", [GStreamer license])
1686 dnl package name in plugins
1687 AC_ARG_WITH(package-name,
1688 AC_HELP_STRING([--with-package-name],[specify package name to use in plugins]),
1689 [case "${withval}" in
1690   yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
1691   no) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
1692   *) GST_PACKAGE="${withval}" ;;
1693 esac], 
1694 [GST_PACKAGE="GStreamer Plugins"]) dnl Default value
1695 AC_MSG_NOTICE(Using $GST_PACKAGE as package name)
1696 AC_DEFINE_UNQUOTED(GST_PACKAGE, "$GST_PACKAGE", [package name in plugins])
1697 dnl package origin URL
1698 AC_ARG_WITH(package-origin,
1699 AC_HELP_STRING([--with-package-origin],[specify package origin URL to use in plugins]),
1700 [case "${withval}" in
1701   yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
1702   no) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
1703   *) GST_ORIGIN="${withval}" ;;
1704 esac], 
1705 [GST_ORIGIN="http://gstreamer.net/"]) dnl Default value
1706 AC_MSG_NOTICE(Using $GST_ORIGIN as package origin)
1707 AC_DEFINE_UNQUOTED(GST_ORIGIN, "$GST_ORIGIN", [package origin])
1708
1709 dnl #########################
1710 dnl # Make the output files #
1711 dnl #########################
1712
1713 AC_CONFIG_FILES(
1714 Makefile
1715 gst-plugins.spec
1716 gst/Makefile
1717 gst/ac3parse/Makefile
1718 gst/adder/Makefile
1719 gst/audioconvert/Makefile
1720 gst/audioscale/Makefile
1721 gst/auparse/Makefile
1722 gst/avi/Makefile
1723 gst/asfdemux/Makefile
1724 gst/cdxaparse/Makefile
1725 gst/chart/Makefile
1726 gst/colorspace/Makefile
1727 gst/cutter/Makefile
1728 gst/debug/Makefile
1729 gst/deinterlace/Makefile
1730 gst/effectv/Makefile
1731 gst/festival/Makefile
1732 gst/ffmpegcolorspace/Makefile
1733 gst/filter/Makefile
1734 gst/flx/Makefile
1735 gst/goom/Makefile
1736 gst/interleave/Makefile
1737 gst/law/Makefile
1738 gst/level/Makefile
1739 gst/matroska/Makefile
1740 gst/median/Makefile
1741 gst/mixmatrix/Makefile
1742 gst/mpeg1sys/Makefile
1743 gst/mpeg1videoparse/Makefile
1744 gst/mpeg2sub/Makefile
1745 gst/mpegaudio/Makefile
1746 gst/mpegaudioparse/Makefile
1747 gst/mpegstream/Makefile
1748 gst/modplug/Makefile
1749 gst/modplug/libmodplug/Makefile
1750 gst/monoscope/Makefile
1751 gst/overlay/Makefile
1752 gst/passthrough/Makefile
1753 gst/playondemand/Makefile
1754 gst/qtdemux/Makefile
1755 gst/realmedia/Makefile
1756 gst/rtjpeg/Makefile
1757 gst/rtp/Makefile
1758 gst/silence/Makefile
1759 gst/sine/Makefile
1760 gst/smooth/Makefile
1761 gst/smpte/Makefile
1762 gst/spectrum/Makefile
1763 gst/speed/Makefile
1764 gst/stereo/Makefile
1765 gst/switch/Makefile
1766 gst/synaesthesia/Makefile
1767 gst/tags/Makefile
1768 gst/tcp/Makefile
1769 gst/typefind/Makefile
1770 gst/udp/Makefile
1771 gst/vbidec/Makefile
1772 gst/videocrop/Makefile
1773 gst/videodrop/Makefile
1774 gst/videofilter/Makefile
1775 gst/videoflip/Makefile
1776 gst/videoscale/Makefile
1777 gst/videotestsrc/Makefile
1778 gst/volenv/Makefile
1779 gst/volume/Makefile
1780 gst/wavenc/Makefile
1781 gst/wavparse/Makefile
1782 gst/y4m/Makefile
1783 sys/Makefile
1784 sys/cdrom/Makefile
1785 sys/dxr3/Makefile
1786 sys/glsink/Makefile
1787 sys/oss/Makefile
1788 sys/qcam/Makefile
1789 sys/v4l/Makefile
1790 sys/v4l2/Makefile
1791 sys/vcd/Makefile
1792 sys/ximage/Makefile
1793 sys/xvimage/Makefile
1794 ext/Makefile
1795 ext/a52dec/Makefile
1796 ext/aalib/Makefile
1797 ext/alsa/Makefile
1798 ext/arts/Makefile
1799 ext/artsd/Makefile
1800 ext/audiofile/Makefile
1801 ext/cdparanoia/Makefile
1802 ext/dirac/Makefile
1803 ext/divx/Makefile
1804 ext/dts/Makefile
1805 ext/dv/Makefile
1806 ext/dvdread/Makefile
1807 ext/dvdnav/Makefile
1808 ext/esd/Makefile
1809 ext/faac/Makefile
1810 ext/faad/Makefile
1811 ext/flac/Makefile
1812 ext/gdk_pixbuf/Makefile
1813 ext/gnomevfs/Makefile
1814 ext/gsm/Makefile
1815 ext/hermes/Makefile
1816 dnl ext/http/Makefile
1817 ext/jack/Makefile
1818 ext/jpeg/Makefile
1819 ext/kio/Makefile
1820 ext/ladspa/Makefile
1821 ext/lame/Makefile
1822 ext/ivorbis/Makefile
1823 ext/lcs/Makefile
1824 ext/libcaca/Makefile
1825 ext/libfame/Makefile
1826 ext/libpng/Makefile
1827 ext/librfb/Makefile
1828 ext/libvisual/Makefile
1829 ext/mad/Makefile
1830 ext/mikmod/Makefile
1831 ext/mpeg2dec/Makefile
1832 ext/mpeg2enc/Makefile
1833 ext/mplex/Makefile
1834 ext/musicbrainz/Makefile
1835 ext/nas/Makefile
1836 ext/ogg/Makefile
1837 ext/pango/Makefile
1838 ext/raw1394/Makefile
1839 ext/sdl/Makefile
1840 ext/shout/Makefile
1841 ext/shout2/Makefile
1842 ext/sidplay/Makefile
1843 ext/smoothwave/Makefile
1844 ext/snapshot/Makefile
1845 ext/speex/Makefile
1846 ext/sndfile/Makefile
1847 ext/swfdec/Makefile
1848 ext/tarkin/Makefile
1849 ext/theora/Makefile
1850 ext/vorbis/Makefile
1851 ext/xine/Makefile
1852 ext/xvid/Makefile
1853 gst-libs/Makefile
1854 gst-libs/gst/Makefile
1855 gst-libs/gst/audio/Makefile
1856 gst-libs/gst/colorbalance/Makefile
1857 gst-libs/gst/floatcast/Makefile
1858 gst-libs/gst/gconf/Makefile
1859 gst-libs/gst/idct/Makefile
1860 gst-libs/gst/media-info/Makefile
1861 gst-libs/gst/mixer/Makefile
1862 gst-libs/gst/navigation/Makefile
1863 gst-libs/gst/play/Makefile
1864 gst-libs/gst/propertyprobe/Makefile
1865 gst-libs/gst/resample/Makefile
1866 gst-libs/gst/riff/Makefile
1867 gst-libs/gst/tag/Makefile
1868 gst-libs/gst/tuner/Makefile
1869 gst-libs/gst/video/Makefile
1870 gst-libs/gst/xoverlay/Makefile
1871 gst-libs/gst/xwindowlistener/Makefile
1872 gst-libs/ext/Makefile
1873 examples/dynparams/Makefile
1874 examples/capsfilter/Makefile
1875 examples/seeking/Makefile
1876 examples/indexing/Makefile
1877 examples/gstplay/Makefile
1878 examples/switch/Makefile
1879 examples/Makefile
1880 testsuite/spider/Makefile
1881 testsuite/alsa/Makefile
1882 testsuite/Makefile
1883 tools/Makefile
1884 gconf/Makefile
1885 gconf/gstreamer.schemas
1886 pkgconfig/Makefile
1887 pkgconfig/gstreamer-gconf.pc
1888 pkgconfig/gstreamer-gconf-uninstalled.pc
1889 pkgconfig/gstreamer-interfaces.pc
1890 pkgconfig/gstreamer-interfaces-uninstalled.pc
1891 pkgconfig/gstreamer-libs.pc
1892 pkgconfig/gstreamer-libs-uninstalled.pc
1893 pkgconfig/gstreamer-media-info.pc
1894 pkgconfig/gstreamer-media-info-uninstalled.pc
1895 pkgconfig/gstreamer-play.pc
1896 pkgconfig/gstreamer-play-uninstalled.pc
1897 pkgconfig/gstreamer-plugins.pc
1898 pkgconfig/gstreamer-plugins-uninstalled.pc
1899 po/Makefile.in
1900 common/Makefile
1901 common/m4/Makefile
1902 m4/Makefile
1903 )
1904 AC_OUTPUT
1905
1906 echo -n "configure: *** Plug-ins that will be built :"
1907 echo -e "$GST_PLUGINS_YES" | sort
1908 echo
1909 echo -n "configure: *** Plug-ins that will not be built :"
1910 echo -e "$GST_PLUGINS_NO" | sort
1911 echo
1912 if test "x$BUILD_EXTERNAL" = "xno"; then
1913   echo "configure: *** No external plug-ins will be built"
1914 fi