Add CELT encoder and decoder elements based on the Speex elements.
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ(2.52)
2
3 dnl initialize autoconf
4 dnl when going to/from release please set the nano (fourth number) right !
5 dnl releases only do Wall, cvs and prerelease does Werror too
6 AC_INIT(GStreamer Bad Plug-ins, 0.10.8.1,
7     http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
8     gst-plugins-bad)
9
10 AG_GST_INIT
11
12 dnl initialize automake
13 AM_INIT_AUTOMAKE
14
15 dnl define PACKAGE_VERSION_* variables
16 AS_VERSION
17
18 dnl check if this is a release version
19 AS_NANO(GST_CVS="no", GST_CVS="yes")
20
21 dnl can autoconf find the source ?
22 AC_CONFIG_SRCDIR([docs/plugins/gst-plugins-bad-plugins-docs.sgml])
23
24 dnl define the output header for config
25 AM_CONFIG_HEADER([config.h])
26
27 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
28 AM_MAINTAINER_MODE
29
30 dnl sets host_* variables
31 AC_CANONICAL_HOST
32
33 dnl our libraries and install dirs use major.minor as a version
34 GST_MAJORMINOR=$GST_PLUGINS_BAD_VERSION_MAJOR.$GST_PLUGINS_BAD_VERSION_MINOR
35 dnl we override it here if we need to for the release candidate of new series
36 GST_MAJORMINOR=0.10
37 AC_SUBST(GST_MAJORMINOR)
38
39 dnl FIXME: this macro doesn't actually work;
40 dnl the generated libtool script has no support for the listed tags.
41 dnl So this needs to be fixed first if we want to use this
42 dnl AS_LIBTOOL_TAGS([CXX])
43
44 AC_LIBTOOL_WIN32_DLL
45 AM_PROG_LIBTOOL
46
47 dnl *** required versions of GStreamer stuff ***
48 GST_REQ=0.10.20
49 GSTPB_REQ=0.10.20
50
51 dnl *** autotools stuff ****
52
53 dnl allow for different autotools
54 AS_AUTOTOOLS_ALTERNATE
55
56 dnl Add parameters for aclocal
57 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
58
59 dnl set up gettext
60 dnl the version check needs to stay here because autopoint greps for it
61 AM_GNU_GETTEXT_VERSION([0.11.5])
62 AM_GNU_GETTEXT([external])
63 AG_GST_GETTEXT([gst-plugins-bad-$GST_MAJORMINOR])
64
65 dnl *** check for arguments to configure ***
66
67 AG_GST_ARG_DEBUG
68 AG_GST_ARG_PROFILING
69 AG_GST_ARG_VALGRIND
70 AG_GST_ARG_GCOV
71
72 AG_GST_ARG_EXAMPLES
73
74 AG_GST_ARG_WITH_PKG_CONFIG_PATH
75 AG_GST_ARG_WITH_PACKAGE_NAME
76 AG_GST_ARG_WITH_PACKAGE_ORIGIN
77
78 AG_GST_ARG_WITH_PLUGINS
79
80 AG_GST_ARG_ENABLE_EXTERNAL
81
82 AG_GST_ARG_ENABLE_EXPERIMENTAL
83
84 dnl *** checks for platform ***
85
86 dnl * hardware/architecture *
87
88 dnl common/m4/gst-arch.m4
89 dnl check CPU type
90 AG_GST_ARCH
91
92 dnl Determine endianness
93 AC_C_BIGENDIAN
94
95 dnl *** checks for programs ***
96
97 dnl find a compiler
98 AC_PROG_CC
99
100 dnl determine c++ compiler
101 AC_PROG_CXX
102 dnl determine if c++ is available on this system
103 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
104
105 AS_PROG_OBJC
106
107 dnl check if the compiler supports '-c' and '-o' options
108 AM_PROG_CC_C_O
109
110 dnl check if the compiler supports do while(0) macros
111 AG_GST_CHECK_DOWHILE_MACROS
112
113 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
114 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
115
116 dnl check for documentation tools
117 GTK_DOC_CHECK([1.3])
118 AS_PATH_PYTHON([2.1])
119 AG_GST_PLUGIN_DOCS([1.3],[2.1])
120
121 dnl *** checks for libraries ***
122
123 dnl check for libm, for sin() etc.
124 AC_CHECK_LIBM
125 AC_SUBST(LIBM)
126
127 dnl *** checks for header files ***
128
129 AC_CHECK_HEADERS([unistd.h], HAVE_UNISTD_H=yes)
130 AM_CONDITIONAL(HAVE_UNISTD_H, test "x$HAVE_UNISTD_H" = "xyes")
131
132 if test "x$HAVE_UNISTD_H" != "xyes"; then
133   GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/festival//`
134 fi
135
136 dnl used by ext/dts
137 AX_CREATE_STDINT_H
138
139 dnl *** checks for types/defines ***
140
141 dnl *** checks for structures ***
142
143 dnl *** checks for compiler characteristics ***
144 dnl check if we have GCC inline-asm
145 AS_GCC_INLINE_ASSEMBLY([HAVE_GCC_ASM=yes], [HAVE_GCC_ASM=no])
146 if test x$HAVE_GCC_ASM = xyes ; then
147   AC_DEFINE(HAVE_GCC_ASM, 1,
148     [Define if compiler supports gcc inline assembly])
149 fi
150 AM_CONDITIONAL(HAVE_GCC_ASM, test "x$HAVE_GCC_ASM" = "xyes")
151
152 dnl *** checks for library functions ***
153
154 dnl *** checks for dependency libraries ***
155
156 dnl GLib is required
157 AG_GST_GLIB_CHECK([2.6])
158
159 dnl liboil is required
160 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= 0.3.8, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
161 if test "x$HAVE_LIBOIL" != "xyes"; then
162   AC_ERROR([liboil-0.3.8 or later is required])
163 fi
164
165 dnl checks for gstreamer
166 dnl uninstalled is selected preferentially -- see pkg-config(1)
167 AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ], yes)
168 AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQ], yes)
169 AG_GST_CHECK_GST_GDP($GST_MAJORMINOR, [$GST_REQ], yes)
170 AG_GST_CHECK_GST_CHECK($GST_MAJORMINOR, [$GST_REQ], no)
171 AG_GST_CHECK_GST_CONTROLLER($GST_MAJORMINOR, [$GST_REQ], yes)
172 AG_GST_CHECK_GST_PLUGINS_BASE($GST_MAJORMINOR, [$GSTPB_REQ], yes)
173 AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
174
175 GSTPB_PLUGINS_DIR=`$PKG_CONFIG gstreamer-plugins-base-$GST_MAJORMINOR --variable pluginsdir`
176 AC_SUBST(GSTPB_PLUGINS_DIR)
177 AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
178
179 dnl Check for documentation xrefs
180 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
181 GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-$GST_MAJORMINOR`"
182 GSTPB_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-plugins-base-$GST_MAJORMINOR`"
183 AC_SUBST(GLIB_PREFIX)
184 AC_SUBST(GST_PREFIX)
185 AC_SUBST(GSTPB_PREFIX)
186
187 dnl GTK is optional and used in examples
188 HAVE_GTK=NO
189 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0, HAVE_GTK_22=yes, HAVE_GTK_22=no)
190 if test "x$HAVE_GTK_22" = "xyes"; then
191   HAVE_GTK=yes
192   GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
193   AC_SUBST(GTK_VERSION)
194   GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
195   AC_SUBST(GTK_BASE_DIR)
196   GDK_PIXBUF_LIBDIR=`$PKG_CONFIG --variable=libdir gdk-pixbuf-2.0`
197   GDK_PIXBUF_PREFIXDIR=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
198   AC_SUBST(GTK_BASE_DIR)
199 else
200   PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK_20=yes, HAVE_GTK_20=no)
201 fi
202 if test "x$HAVE_GTK_20" = "xyes"; then
203   HAVE_GTK=yes
204 fi
205 GTK_CFLAGS=$GTK2_CFLAGS
206 GTK_LIBS=$GTK2_LIBS
207 AC_SUBST(GTK_LIBS)
208 AC_SUBST(GTK_CFLAGS)
209 AC_SUBST(HAVE_GTK)
210 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
211
212 dnl libglade is optional and only used in examples
213 HAVE_GLADE=NO
214 PKG_CHECK_MODULES(GLADE, libglade-2.0 >= 2.6.0, HAVE_GLADE=yes, HAVE_GLADE=no)
215 AC_SUBST(GLADE_LIBS)
216 AC_SUBST(GLADE_CFLAGS)
217 AC_SUBST(HAVE_GLADE)
218 AM_CONDITIONAL(HAVE_GLADE, test "x$HAVE_GLADE" = "xyes")
219
220 dnl set license and copyright notice
221 GST_LICENSE="LGPL"
222 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
223 AC_SUBST(GST_LICENSE)
224
225 dnl set location of plugin directory
226 AG_GST_SET_PLUGINDIR
227
228 dnl define an ERROR_CFLAGS Makefile variable
229 AG_GST_SET_ERROR_CFLAGS($GST_CVS)
230
231 dnl define an ERROR_CXXFLAGS Makefile variable
232 AG_GST_SET_ERROR_CXXFLAGS($GST_CVS)
233
234 dnl define correct level for debugging messages
235 AG_GST_SET_LEVEL_DEFAULT($GST_CVS)
236
237 dnl *** plug-ins to include ***
238
239 dnl these are all the gst plug-ins, compilable without additional libs
240 AG_GST_CHECK_PLUGIN(app)
241 AG_GST_CHECK_PLUGIN(bayer)
242 AG_GST_CHECK_PLUGIN(cdxaparse)
243 AG_GST_CHECK_PLUGIN(deinterlace)
244 AG_GST_CHECK_PLUGIN(deinterlace2)
245 AG_GST_CHECK_PLUGIN(dvdspu)
246 AG_GST_CHECK_PLUGIN(festival)
247 AG_GST_CHECK_PLUGIN(filter)
248 AG_GST_CHECK_PLUGIN(flv)
249 AG_GST_CHECK_PLUGIN(freeze)
250 AG_GST_CHECK_PLUGIN(h264parse)
251 AG_GST_CHECK_PLUGIN(librfb)
252 AG_GST_CHECK_PLUGIN(modplug)
253 AG_GST_CHECK_PLUGIN(mpegtsparse)
254 AG_GST_CHECK_PLUGIN(mpeg4videoparse)
255 AG_GST_CHECK_PLUGIN(mpegvideoparse)
256 AG_GST_CHECK_PLUGIN(mve)
257 AG_GST_CHECK_PLUGIN(nsf)
258 AG_GST_CHECK_PLUGIN(nuvdemux)
259 AG_GST_CHECK_PLUGIN(rawparse)
260 AG_GST_CHECK_PLUGIN(real)
261 AG_GST_CHECK_PLUGIN(rtpmanager)
262 AG_GST_CHECK_PLUGIN(sdp)
263 AG_GST_CHECK_PLUGIN(selector)
264 AG_GST_CHECK_PLUGIN(speed)
265 AG_GST_CHECK_PLUGIN(speexresample)
266 AG_GST_CHECK_PLUGIN(subenc)
267 AG_GST_CHECK_PLUGIN(stereo)
268 AG_GST_CHECK_PLUGIN(tta)
269 AG_GST_CHECK_PLUGIN(videosignal)
270 AG_GST_CHECK_PLUGIN(vmnc)
271 AG_GST_CHECK_PLUGIN(y4m)
272
273 dnl *** plug-ins to exclude ***
274
275 dnl see if we can build C++ plug-ins
276 if test "x$HAVE_CXX" != "xyes"; then
277   AC_MSG_WARN([Not compiling plug-ins requiring C++ compiler])
278   AG_GST_DISABLE_PLUGIN(modplug)
279 fi
280
281 dnl real plugin only works on i386 and x86_64 for the time being.
282 if test "x$HAVE_CPU_I386" != "xyes" && test "x$HAVE_CPU_X86_64" != "xyes"; then
283   AC_MSG_WARN([Not building real plugin, only works on 32bit and 64bit x86 platforms])
284   AG_GST_DISABLE_PLUGIN(real)
285 fi
286
287 dnl disable experimental plug-ins
288 if test "x$BUILD_EXPERIMENTAL" != "xyes"; then
289   AG_GST_DISABLE_PLUGIN(deinterlace2)
290 fi
291
292 dnl disable gst plugins we might not be able to build on this
293 dnl platform: librfb (ugly but minimally invasive)
294 dnl FIXME: maybe move to sys, or make work with winsock2
295 AC_CHECK_HEADERS([sys/socket.h], HAVE_SYS_SOCKET_H=yes)
296 AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes)
297
298 dnl needed for festival
299 AM_CONDITIONAL(HAVE_WINSOCK2_H, test "x$HAVE_WINSOCK2_H" = "xyes")
300
301 if test "x$HAVE_SYS_SOCKET_H" != "xyes"; then
302   AG_GST_DISABLE_PLUGIN(librfb)
303 fi
304
305 dnl *** sys plug-ins ***
306
307 dnl check for QuickTime
308 translit(dnm, m, l) AM_CONDITIONAL(USE_QUICKTIME, true)
309 AG_GST_CHECK_FEATURE(QUICKTIME, [QuickTime wrapper], qtwrapper, [
310   AC_CHECK_HEADER(QuickTime/Movies.h, HAVE_QUICKTIME="yes", HAVE_QUICKTIME="no")
311 ])
312
313 dnl check for Video CD
314 translit(dnm, m, l) AM_CONDITIONAL(USE_VCD, true)
315 AG_GST_CHECK_FEATURE(VCD, [Video CD], vcdsrc, [
316   AC_CHECK_HEADER(linux/cdrom.h, HAVE_VCD="yes", HAVE_VCD="no")
317 ])
318
319 dnl *** ext plug-ins ***
320 dnl keep this list sorted alphabetically !
321
322 if test "x$BUILD_EXTERNAL" = "xyes"; then
323
324 dnl *** alsa ***
325 translit(dnm, m, l) AM_CONDITIONAL(USE_ALSA, true)
326 AG_GST_CHECK_FEATURE(ALSA, [alsa plug-ins], gstalsa, [
327   PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, [
328     HAVE_ALSA="yes"
329     AC_SUBST(ALSA_CFLAGS)
330     AC_SUBST(ALSA_LIBS)
331   ], [
332     AM_PATH_ALSA(0.9.1, HAVE_ALSA="yes", HAVE_ALSA="no")
333   ])
334 ])
335
336 dnl *** amrwb ***
337 translit(dnm, m, l) AM_CONDITIONAL(USE_AMRWB, true)
338 AG_GST_CHECK_FEATURE(AMRWB, [amrwb library], amrwb, [
339   AG_GST_CHECK_LIBHEADER(AMRWB, amrwb,
340                         GP3D_IF_decode, ,
341                         amrwb/dec.h,
342                         AMRWB_LIBS="-lamrwb"
343                         AC_SUBST(AMRWB_LIBS))
344 ])
345
346 dnl *** BZ2 ***
347 translit(dnm, m, l) AM_CONDITIONAL(USE_BZ2, true)
348 AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [
349   AG_GST_CHECK_LIBHEADER(BZ2, bz2, BZ2_bzCompress, ,bzlib.h, BZ2_LIBS="-lbz2")
350   AC_SUBST(BZ2_LIBS)
351 ])
352
353 #dnl *** cairo ***
354 #translit(dnm, m, l) AM_CONDITIONAL(USE_CAIRO, true)
355 #AG_GST_CHECK_FEATURE(CAIRO, [cairo plug-in], cairo, [
356 #  PKG_CHECK_MODULES(CAIRO, cairo >= 1.0 glitz-glx, HAVE_CAIRO=yes, [
357 #    HAVE_CAIRO=no
358 #    AC_MSG_RESULT(no)
359 #  ])
360 #  AC_SUBST(CAIRO_CFLAGS)
361 #  AC_SUBST(CAIRO_LIBS)
362 #])
363
364 dnl *** cdaudio ***
365 translit(dnm, m, l) AM_CONDITIONAL(USE_CDAUDIO, true)
366 AG_GST_CHECK_FEATURE(CDAUDIO, [cdaudio], cdaudio, [
367   AG_GST_CHECK_CONFIGPROG(CDAUDIO, libcdaudio-config)
368   AC_SUBST(CDAUDIO_CFLAGS)
369   AC_SUBST(CDAUDIO_LIBS)
370 ])
371
372 dnl *** celt ***
373 translit(dnm, m, l) AM_CONDITIONAL(USE_CELT, true)
374 AG_GST_CHECK_FEATURE(CELT, [celt], celt, [
375   PKG_CHECK_MODULES(CELT, celt >= 0.4.0, [
376       HAVE_CELT="yes"], [
377       HAVE_CELT="no"
378       AC_MSG_RESULT(no)
379   ])
380   AC_SUBST(CELT_CFLAGS)
381   AC_SUBST(CELT_LIBS)
382 ])
383
384 dnl *** dc1394  ***
385 translit(dnm, m, l) AM_CONDITIONAL(USE_DC1394, true)
386 AG_GST_CHECK_FEATURE(DC1394, [libdc1394], dc1394, [
387    PKG_CHECK_MODULES(LIBDC1394, libdc1394-2 >= 2.0.0, [
388         if test -z "`pkg-config --modversion libdc1394-2 | grep 2.0.0-rc`"; then
389                 HAVE_DC1394="yes"
390         else
391                 HAVE_DC1394="no"
392                 AC_MSG_RESULT(no)
393         fi
394    ], [
395         HAVE_DC1394="no"
396         AC_MSG_RESULT(no)
397    ])
398    AC_SUBST(LIBDC1394_CFLAGS)
399    AC_SUBST(LIBDC1394_LIBS)
400 ])
401
402
403 dnl **** DirectFB ****
404 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTFB, true)
405 AG_GST_CHECK_FEATURE(DIRECTFB, [directfb], dfbvideosink , [
406   PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.24, HAVE_DIRECTFB="yes", [
407     HAVE_DIRECTFB="no"
408     AC_MSG_RESULT(no)
409   ])
410 ])
411
412 dnl **** Dirac ****
413 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRAC, true)
414 AG_GST_CHECK_FEATURE(DIRAC, [dirac], dirac, [
415   PKG_CHECK_MODULES(DIRAC, dirac >= 0.10, HAVE_DIRAC="yes", [
416     HAVE_DIRAC="no"
417     AC_MSG_RESULT(no)
418   ])
419 ])
420
421 dnl *** DTS ***
422 translit(dnm, m, l) AM_CONDITIONAL(USE_DTS, true)
423 AG_GST_CHECK_FEATURE(DTS, [dts library], dtsdec, [
424   HAVE_DTS="yes"
425   AG_GST_CHECK_LIBHEADER(DTS, dts_pic, dts_init, -lm, dts.h,
426     DTS_LIBS="-ldts_pic -lm", HAVE_DTS="no")
427   if test $HAVE_DTS = "no"; then
428     AG_GST_CHECK_LIBHEADER(DTS, dca, dca_init, -lm, dts.h,
429       DTS_LIBS="-ldca -lm")
430   fi
431   AC_SUBST(DTS_LIBS)
432 ])
433
434 dnl *** DIVX ***
435 translit(dnm, m, l) AM_CONDITIONAL(USE_DIVX, true)
436 AG_GST_CHECK_FEATURE(DIVX, [divx plugins], divx, [
437   HAVE_DIVX=yes
438   AC_CHECK_HEADER(encore2.h, , [
439     AC_MSG_WARN([Divx4linux encore headers not found])
440     HAVE_DIVX=no
441   ])
442   if [ test x$HAVE_DIVX = xyes ]; then
443     AC_MSG_CHECKING([Checking for valid divx4linux encore version])
444     AC_TRY_COMPILE([
445 #include <encore2.h>
446 #if ENCORE_VERSION != 20021024
447 #error Wrong version of divx encore libraries
448 #endif
449     ], [
450 return 0;
451     ], [
452       HAVE_DIVX=yes
453       AC_MSG_RESULT(yes)
454     ], [
455       HAVE_DIVX=no
456       AC_MSG_RESULT(no)
457       AC_MSG_WARN([Wrong version of divx4linux installed])
458     ])
459   fi
460   if [ test x$HAVE_DIVX = xyes ]; then
461     AC_CHECK_HEADER(decore.h, , [
462       AC_MSG_WARN([Divx4linux decoder headers not found])
463       HAVE_DIVX=no
464     ])
465   fi
466   if [ test x$HAVE_DIVX = xyes ]; then
467     AC_MSG_CHECKING([Checking for valid divx4linux decore version])
468     AC_TRY_COMPILE([
469 #include <decore.h>
470 #if DECORE_VERSION != 20021112
471 #error Wrong version of divx decore libraries
472 #endif
473     ], [
474 return 0;
475     ], [
476       HAVE_DIVX=yes
477       AC_MSG_RESULT(yes)
478     ], [
479       HAVE_DIVX=no
480       AC_MSG_RESULT(no)
481       AC_MSG_WARN([Wrong version of divx4linux installed])
482     ])
483   fi
484   LIBS="-lm"
485   if test x$HAVE_DIVX = xyes; then
486     AC_CHECK_LIB(divxencore, encore, , [
487       AC_MSG_WARN([Divx4linux encore libs not found])
488       HAVE_DIVX=no
489     ])
490   fi
491   if test x$HAVE_DIVX = xyes; then
492     AC_CHECK_LIB(divxdecore, decore, , [
493       AC_MSG_WARN([Divx4linux decore libs not found])
494       HAVE_DIVX=no
495   ])
496   fi
497   if test x$HAVE_DIVX = xyes; then
498     DIVXENC_LIBS="-ldivxencore -lm"
499     DIVXDEC_LIBS="-ldivxdecore -lm"
500     AC_SUBST(DIVXENC_LIBS)
501     AC_SUBST(DIVXDEC_LIBS)
502   fi
503 ])
504
505 dnl *** dvdnav for resindvd ***
506 USE_DVDNAV=$BUILD_EXPERIMENTAL
507 translit(dnm, m, l) AM_CONDITIONAL(USE_DVDNAV, true)
508 AG_GST_CHECK_FEATURE(DVDNAV, [dvdnav library], resindvd, [
509   translit(dnm, m, l) AC_SUBST(DVDNAV_LIBS)
510   translit(dnm, m, l) AC_SUBST(DVDNAV_CFLAGS)
511   AG_GST_CHECK_CONFIGPROG(DVDNAV, dvdnav-config)
512   if test x"$HAVE_DVDNAV" = x"yes"; then
513     dnl check version
514     DVDNAV_VERSION=`dvdnav-config --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
515     DVDNAV_MAJOR=`echo $DVDNAV_VERSION | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
516     DVDNAV_MINOR=`echo $DVDNAV_VERSION | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
517     DVDNAV_MICRO=`echo $DVDNAV_VERSION | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
518     if [[ "$DVDNAV_MAJOR" -eq "0" ]] && \
519        [[ "$DVDNAV_MINOR" -lt "1" ]]; then
520       AC_MSG_WARN([libdvdnav >= 0.1.7 is required, you have $DVDNAV_VERSION])
521       HAVE_DVDNAV="no"
522     elif [[ "$DVDNAV_MAJOR" -eq "0" ]] && \
523          [[ "$DVDNAV_MINOR" -eq "1" ]] && \
524          [[ "$DVDNAV_MICRO" -lt "7" ]]; then
525       AC_MSG_WARN([libdvdnav >= 0.1.7 is required, you have $DVDNAV_VERSION])
526       HAVE_DVDNAV="no"
527     elif [[ "$DVDNAV_MAJOR" -eq "0" ]]; then
528       AC_DEFINE(DVDNAV_OLD, 1, [Define if an old libdvdnav is used])      
529     fi
530   fi
531   AS_SCRUB_INCLUDE(DVDNAV_CFLAGS)
532 ])
533
534 dnl *** METADATA ***
535 translit(dnm, m, l) AM_CONDITIONAL(USE_METADATA, true)
536 AG_GST_CHECK_FEATURE(METADATA, [METADATA muxer and demuxer], metadata, [
537   HAVE_METADATA="no"
538   PKG_CHECK_MODULES(EXIF, libexif >= 0.6.16, HAVE_EXIF="yes", [
539     HAVE_EXIF="no"
540   ])
541   PKG_CHECK_MODULES(IPTC, libiptcdata >= 1.0.2, HAVE_IPTC="yes", [
542     HAVE_IPTC="no"
543   ])
544   PKG_CHECK_MODULES(XMP, exempi-2.0, HAVE_XMP="yes", [
545     HAVE_XMP="no"
546   ])
547   PKG_CHECK_MODULES(XMP_1_99_5, exempi-2.0 >= 1.99.5, XMP_CFLAGS="-DXMP_1_99_5 $XMP_CFLAGS", AC_MSG_RESULT(no))
548   if test x$HAVE_EXIF = xyes; then
549     METADATA_CFLAGS="-DHAVE_EXIF $EXIF_CFLAGS $METADATA_CFLAGS"
550     METADATA_LIBS="$EXIF_LIBS $METADATA_LIBS -lm"
551     HAVE_METADATA="yes"
552   fi
553   if test x$HAVE_IPTC = xyes; then
554     METADATA_CFLAGS="-DHAVE_IPTC $IPTC_CFLAGS $METADATA_CFLAGS"
555     METADATA_LIBS="$IPTC_LIBS $METADATA_LIBS"
556     HAVE_METADATA="yes"
557   fi
558   if test x$HAVE_XMP = xyes; then
559     METADATA_CFLAGS="-DHAVE_XMP $XMP_CFLAGS $METADATA_CFLAGS"
560     METADATA_LIBS="$XMP_LIBS $METADATA_LIBS"
561     HAVE_METADATA="yes"
562   fi
563   if test x$HAVE_METADATA = xno; then
564     AC_MSG_WARN(no of metadata libraries (exif, iptc or xmp) found)
565   fi
566   dnl metadata plugin will parse whole chunks anyway
567   HAVE_METADATA="yes"
568   AC_SUBST(METADATA_CFLAGS)
569   AC_SUBST(METADATA_LIBS)
570 ])
571
572 dnl **** Free AAC Encoder (FAAC) ****
573 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAC, true)
574 AG_GST_CHECK_FEATURE(FAAC, [AAC encoder plug-in], faac, [
575   AG_GST_CHECK_LIBHEADER(FAAC, faac, faacEncOpen, -lm, faac.h,
576     FAAC_LIBS="-lfaac -lm")
577   AS_SCRUB_INCLUDE(FAAC_CFLAGS)
578   AC_SUBST(FAAC_LIBS)
579 ])
580
581 dnl **** Free AAC Decoder (FAAD) ****
582 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAD, true)
583 AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
584   HAVE_FAAD="yes"
585   AG_GST_CHECK_LIBHEADER(FAAD, faad, faacDecOpen, -lm, faad.h,
586     FAAD_LIBS="-lfaad -lm", HAVE_FAAD="no")
587   if test $HAVE_FAAD = "no"; then
588     AG_GST_CHECK_LIBHEADER(FAAD, faad, NeAACDecOpen, -lm, neaacdec.h,
589       [ FAAD_LIBS="-lfaad -lm"
590                 AC_DEFINE(FAAD_IS_NEAAC, 1, [Define if AAC is using new api prefix])
591           ],
592           HAVE_FAAD="no",)
593   fi
594   if test $HAVE_FAAD = "yes"; then
595     AC_MSG_CHECKING([Checking for FAAD >= 2.0])
596     AC_TRY_COMPILE([#include <faad.h>], [
597         #if !defined(FAAD2_VERSION) || !defined(FAAD_FMT_DOUBLE)
598         #error Not faad2
599         #else
600         /* Release candidate of 2.0 is not good enough for us. This field
601          * was added only in 2.0 final and does not exist in 2.0-RC3 */
602         faacDecConfiguration conf; conf.dontUpSampleImplicitSBR = 1;
603         #endif
604     ], [
605       HAVE_FAAD="yes"
606       AC_MSG_RESULT(yes)
607     ], [
608       HAVE_FAAD="no"
609       AC_MSG_RESULT(no)
610     ])
611   fi
612   AS_SCRUB_INCLUDE(FAAD_CFLAGS)
613   AC_SUBST(FAAD_LIBS)
614   AC_SUBST(FAAD_IS_NEAAC)
615 ])
616
617 dnl *** fbdev ***
618 translit(dnm, m, l) AM_CONDITIONAL(USE_FBDEV, true)
619 AG_GST_CHECK_FEATURE(FBDEV, [linux framebuffer], fbdevsink, [
620   if test "x$HAVE_FBDEV" != "xyes"; then
621     AC_CHECK_HEADER([linux/fb.h], HAVE_FBDEV=yes, HAVE_FBDEV=no)
622   fi
623 ])
624
625 dnl *** gsm ***
626 translit(dnm, m, l) AM_CONDITIONAL(USE_GSM, true)
627 AG_GST_CHECK_FEATURE(GSM, [GSM library], gsmenc gsmdec, [
628   AG_GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm.h, GSM_LIBS="-lgsm")
629   if test $HAVE_GSM != "yes"; then
630     AG_GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm/gsm.h, GSM_LIBS="-lgsm")
631     if test $HAVE_GSM = "yes"; then
632       AC_DEFINE(GSM_HEADER_IN_SUBDIR, 1, [Define if GSM header in gsm/ subdir])
633     fi
634   fi
635   AC_SUBST(GSM_LIBS)
636 ])
637
638 dnl *** ivorbis ***
639 dnl AM_PATH_IVORBIS only takes two options
640 translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
641 AG_GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
642   IVORBIS_LIBS=
643   IVORBIS_CFLAGS=
644   AC_CHECK_LIB(vorbisidec, vorbis_block_init,
645     [IVORBIS_LIBS=-lvorbisidec
646      HAVE_IVORBIS=yes
647      case $host in
648      arm-*-*)
649        IVORBIS_CFLAGS="-D_ARM_ASSEM_ $IVORBIS_CFLAGS"
650      esac
651     ],
652     HAVE_IVORBIS=no)
653   AC_SUBST(IVORBIS_LIBS)
654   AC_SUBST(IVORBIS_CFLAGS)
655 ])
656
657 dnl *** Jack ***
658 translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
659 AG_GST_CHECK_FEATURE(JACK, Jack, jack, [
660   PKG_CHECK_MODULES(JACK, jack >= 0.99.10, HAVE_JACK="yes", HAVE_JACK="no")
661   AC_SUBST(JACK_CFLAGS)
662   AC_SUBST(JACK_LIBS)
663 ])
664
665 dnl *** ladspa ***
666 translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true)
667 AG_GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [
668   AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA="yes", HAVE_LADSPA="no")
669   save_cflags="$CFLAGS"
670   CFLAGS="$CFLAGS -D_GNU_SOURCE"
671   
672   AC_CHECK_LIB(dl, dlopen,
673     LADSPA_LIBS="-ldl",
674     HAVE_LADSPA="no")
675   CFLAGS="$save_cflags"
676 ])
677 AC_SUBST(LADSPA_LIBS)
678
679 dnl *** libmms ***
680 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBMMS, true)
681 AG_GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
682   dnl check with pkg-config first
683   PKG_CHECK_MODULES(LIBMMS, libmms >= 0.2, HAVE_LIBMMS="yes", [
684     HAVE_LIBMMS="no"
685     AC_MSG_RESULT(no)
686   ])
687 ])
688 AC_SUBST(LIBMMS_LIBS)
689
690 dnl *** mjpegtools version info ***
691 dnl some may prefer older version (given quirks above)
692 dnl hm, no version info seems available within mjpegtools headers
693 dnl and API really moves along
694 echo
695 PKG_CHECK_EXISTS(mjpegtools >= 1.6.1.93 mjpegtools < 1.8.0, [
696   mjpegtools_api=10601
697 ], [
698   PKG_CHECK_EXISTS(mjpegtools >= 1.8.0 mjpegtools < 1.9.0, [
699     mjpegtools_api=10800
700   ], [
701     PKG_CHECK_MODULES(MJPEG, mjpegtools >= 1.9.0, [
702       dnl logging API changed in release candidates
703       OLD_CFLAGS="$CFLAGS"
704       OLD_LIBS="$LIBS"
705       CFLAGS="$MJPEG_CFLAGS"
706       LIBS="$LIBS $MJPEG_LIBS -lmjpegutils -lm -lpthread"
707       AC_CHECK_FUNC(mjpeg_loglev_t, [
708         mjpegtools_api=10903
709         ], [
710         mjpegtools_api=10900
711         ])
712       CFLAGS="$OLD_CFLAGS"
713       LIBS="$OLD_LIBS"
714     ], [
715       mjpegtools_api=0
716     ])
717   ])
718 ])
719 AC_DEFINE_UNQUOTED(GST_MJPEGTOOLS_API, $mjpegtools_api,
720   [mjpegtools API evolution])
721
722 dnl *** mpeg2enc ***
723 translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2ENC, true)
724 AG_GST_CHECK_FEATURE(MPEG2ENC, [mpeg2enc], mpeg2enc, [
725   HAVE_MPEG2ENC="no"
726   dnl we require a c++ compiler for this one
727   if [ test x$HAVE_CXX = xyes ]; then
728     dnl libmpeg2enc was first included in mjpegtools-1.6.2-rc3 (1.6.1.92)
729     dnl since many distros include mjpegtools specifically without mplex
730     dnl and mpeg2enc, we check for mpeg2enc on its own, too.
731     PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.93, [
732       dnl HACK because mpeg2enc 1.8.0 header files have a spurious 'include config.h'
733       touch config.h
734       dnl switch over to c++ to test things
735       AC_LANG_CPLUSPLUS
736       OLD_CPPFLAGS="$CPPFLAGS"
737       dnl HACK as above
738       CPPFLAGS_GOOD="$CPPFLAGS $MPEG2ENC_CFLAGS"
739       CPPFLAGS="$CPPFLAGS_GOOD -I."
740       dnl check headers
741       mpeg2enc_headers_ok=no
742       AC_CHECK_HEADER([mpeg2encoder.hh], [
743         MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp -lm -lpthread"
744         OLD_LIBS="$LIBS"
745         LIBS="$LIBS $MPEG2ENC_LIBS"
746         AC_MSG_CHECKING([for valid mpeg2enc objects])
747         AC_TRY_RUN([
748           #include <mpeg2encoder.hh>
749           #include <mpeg2encoptions.hh>
750
751           int
752           main (int   argc,
753                 char *argv[])
754           {
755             MPEG2EncOptions *options = new MPEG2EncOptions ();
756             MPEG2Encoder *encoder = new MPEG2Encoder (*options);
757             return 0;
758           }
759         ],[
760           AC_MSG_RESULT(yes)
761           dnl so far so good, let's check more things:
762           dnl mjpegtools-1.8.0 does not install the required
763           dnl mpeg2syntaxcodes.h header by default, and a new release
764           dnl is not in sight, so check for this oversight in case
765           dnl distros or folks have fixed this themselves
766           if test "$mjpegtools_api" -ge "10800"; then
767             AC_CHECK_HEADER([mpeg2syntaxcodes.h], [
768                 mpeg2enc_headers_ok=yes
769               ], [
770                 mpeg2enc_headers_ok=no
771               ])
772           else
773             mpeg2enc_headers_ok=yes
774           fi
775           if test "x$mpeg2enc_headers_ok" = "xyes"; then
776             HAVE_MPEG2ENC="yes"
777           fi
778           CPP_FLAGS="$CPPFLAGS_GOOD"
779           AC_SUBST(MPEG2ENC_CFLAGS)
780           AC_SUBST(MPEG2ENC_LIBS)
781         ], [
782           AC_MSG_RESULT(no)
783         ])
784         LIBS="$OLD_LIBS"
785       ])
786
787       CPPFLAGS="$OLD_CPPFLAGS"
788       AC_LANG_C
789     ], [
790       HAVE_MPEG2ENC="no"
791     ])
792   fi
793 ])
794
795 dnl *** mplex ***
796 translit(dnm, m, l) AM_CONDITIONAL(USE_MPLEX, true)
797 AG_GST_CHECK_FEATURE(MPLEX, [mplex], mplex, [
798   HAVE_MPLEX="no"
799   dnl we require a c++ compiler for this one
800   if [ test x$HAVE_CXX = xyes ]; then
801     dnl libmplex was first included in mjpegtools-1.6.2-rc4 (1.6.1.93)
802     dnl since many distros include mjpegtools specifically without mplex
803     dnl and mpeg2enc, we check for mplex on its own, too.
804     dnl libmplex < 1.9rc? has fuzzy ABI, valgrind and other problems
805     PKG_CHECK_MODULES(MPLEX, mjpegtools >= 1.9.0, [
806       dnl switch over to c++ to test things
807       AC_LANG_CPLUSPLUS
808       OLD_CPPFLAGS="$CPPFLAGS"
809       CPPFLAGS="$CPPFLAGS $MPLEX_CFLAGS"
810       AC_CHECK_HEADER(interact.hpp, [
811         MPLEX_LIBS="$MPLEX_LIBS -lmplex2 -lm"
812         OLD_LIBS="$LIBS"
813         LIBS="$LIBS $MPLEX_LIBS"
814         dnl older libmplex uses off_t SegmentSize (), which leads to fuzzy ABI;
815         dnl don't want this here
816         AC_MSG_CHECKING([for valid mplex objects])
817         AC_TRY_RUN([
818
819 #include <interact.hpp>
820 #include <outputstrm.hpp>
821 #include <multiplexor.hpp>
822 int
823 main (int   argc,
824       char *argv[])
825 {
826   class TestOutputStream : public OutputStream {
827   public:
828     TestOutputStream () : OutputStream () { }
829     void Write (uint8_t *a, unsigned int b) { }
830     void NextSegment () { }
831     uint64_t SegmentSize () { }
832     void Close () { }
833     int Open () { }
834 };
835   MultiplexJob *job = new MultiplexJob ();
836   vector<IBitStream *> inputs;
837   job->SetupInputStreams (inputs);
838   TestOutputStream *out = new TestOutputStream ();
839   Multiplexor *mux = new Multiplexor(*job, *out, NULL);
840   return 0;
841 }
842         ],[
843           HAVE_MPLEX="yes"
844           AC_SUBST(MPLEX_CFLAGS)
845           AC_SUBST(MPLEX_LIBS)
846           AC_MSG_RESULT(yes)
847         ], AC_MSG_RESULT(no))
848         LIBS="$OLD_LIBS"
849       ])
850       CPPFLAGS="$OLD_CPPFLAGS"
851       AC_LANG_C
852     ], HAVE_MPLEX="no")
853   fi
854 ])
855
856 dnl *** musepack ***
857 translit(dnm, m, l) AM_CONDITIONAL(USE_MUSEPACK, true)
858 AG_GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
859   AC_CHECK_HEADER([mpc/mpcdec.h], [
860     HAVE_MUSEPACK="yes"
861     MUSEPACK_LIBS="-lmpcdec"
862     AC_SUBST(MUSEPACK_LIBS)
863     ], [AC_CHECK_HEADER([mpcdec/mpcdec.h], [
864       HAVE_MUSEPACK="yes"
865       MUSEPACK_LIBS="-lmpcdec"
866       AC_DEFINE(MPC_IS_OLD_API, 1, [Define if the old MusePack API is used])
867       AC_SUBST(MUSEPACK_LIBS)
868     ], [HAVE_MUSEPACK="no"])])
869 ])
870
871 dnl *** musicbrainz ***
872 translit(dnm, m, l) AM_CONDITIONAL(USE_MUSICBRAINZ, true)
873 AG_GST_CHECK_FEATURE(MUSICBRAINZ, [musicbrainz tag generation], musicbrainz, [
874   PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz >= 2.1.0, HAVE_MUSICBRAINZ="yes", HAVE_MUSICBRAINZ="no")
875   AC_SUBST(MUSICBRAINZ_CFLAGS)
876   AC_SUBST(MUSICBRAINZ_LIBS)
877 ])
878
879 dnl *** MythTV ***
880 translit(dnm, m, l) AM_CONDITIONAL(USE_MYTHTV, true)
881 AG_GST_CHECK_FEATURE(MYTHTV, [MythTV client plugins], mythtvsrc, [
882   PKG_CHECK_MODULES(GMYTH, gmyth >= 0.4 gmyth <= 0.7.99, HAVE_MYTHTV="yes", [
883     HAVE_MYTHTV="no"
884     AC_MSG_RESULT(no)
885   ])
886   AC_SUBST(GMYTH_CFLAGS)
887   AC_SUBST(GMYTH_LIBS)
888 ])
889
890 dnl *** nas ***
891 translit(dnm, m, l) AM_CONDITIONAL(USE_NAS, true)
892 AG_GST_CHECK_FEATURE(NAS, [nas plug-in], nassink, [
893   HAVE_NAS="no"
894   AG_GST_CHECK_X
895   if test "x$HAVE_X" = "xyes"; then
896     save_cppflags=$CFLAGS
897     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
898     AG_GST_CHECK_LIBHEADER(NAS, audio, AuOpenServer, $X_LIBS, audio/audiolib.h,
899       NAS_LIBS="$X_LIBS -laudio" NAS_CFLAGS="$X_CFLAGS")
900     CPPFLAGS="$save_cppflags"
901   fi
902   AC_SUBST(NAS_CFLAGS)
903   AC_SUBST(NAS_LIBS)
904 ])
905
906 dnl *** neon ***
907 translit(dnm, m, l) AM_CONDITIONAL(USE_NEON, true)
908 AG_GST_CHECK_FEATURE(NEON, [neon http client plugins], neonhttpsrc, [
909   PKG_CHECK_MODULES(NEON, neon >= 0.26.0  neon <= 0.28.99, HAVE_NEON="yes", [
910     HAVE_NEON="no"
911     AC_MSG_RESULT(no)
912   ])
913   AC_SUBST(NEON_CFLAGS)
914   AC_SUBST(NEON_LIBS)
915 ])
916
917 dnl *** ofa ***
918 translit(dnm, m, l) AM_CONDITIONAL(USE_OFA, true)
919 AG_GST_CHECK_FEATURE(OFA, [ofa plugins], ofa, [
920   PKG_CHECK_MODULES(OFA, libofa >= 0.9.3, HAVE_OFA="yes", [
921     HAVE_OFA="no"
922     AC_MSG_RESULT(no)
923   ])
924   AC_SUBST(OFA_CFLAGS)
925   AC_SUBST(OFA_LIBS)
926 ])
927
928 dnl *** timidity ***
929 translit(dnm, m, l) AM_CONDITIONAL(USE_TIMIDITY, true)
930 AG_GST_CHECK_FEATURE(TIMIDITY, [timidity midi soft synth plugin], timidity, [
931   PKG_CHECK_MODULES(TIMIDITY, libtimidity, [
932     HAVE_TIMIDITY="yes",
933         AC_MSG_CHECKING([for timidity.cfg])
934         timidity_cfg=""
935         if test -r /etc/timidity.cfg; then
936           timidity_cfg=/etc/timidity.cfg
937         elif test -r /etc/timidity/timidity.cfg; then
938           timidity_cfg=/etc/timidity/timidity.cfg
939         elif test -r /usr/share/timidity/timidity.cfg; then
940           timidity_cfg=/usr/share/timidity/timidity.cfg
941         elif test -r /usr/local/share/timidity/timidity.cfg; then
942           timidity_cfg=/usr/local/share/timidity/timidity.cfg
943         fi
944         if test "x$timidity_cfg" != "x"; then
945           AC_MSG_RESULT($timidity_cfg)
946       AC_DEFINE_UNQUOTED(TIMIDITY_CFG, "$timidity_cfg", [Define location of timidity.cfg])
947         else
948           AC_MSG_RESULT([not found])
949         fi
950   ], [
951     HAVE_TIMIDITY="no"
952     AC_MSG_RESULT(no)
953   ])
954   AC_SUBST(TIMIDITY_CFLAGS)
955   AC_SUBST(TIMIDITY_LIBS)
956 ])
957
958 dnl *** wildmidi ***
959 translit(dnm, m, l) AM_CONDITIONAL(USE_WILDMIDI, true)
960 AG_GST_CHECK_FEATURE(WILDMIDI, [wildmidi midi soft synth plugin], wildmidi, [
961   AC_CHECK_HEADER([wildmidi_lib.h],HAVE_WILDMIDI=yes, HAVE_WILDMIDI=no)
962   if test "x$HAVE_WILDMIDI" = "xyes"; then
963          WILDMIDI_CFLAGS=
964          WILDMIDI_LIBS=-lWildMidi
965          AC_MSG_NOTICE(compiling gstWildMidi)
966   else
967          WILDMIDI_CFLAGS=
968          WILDMIDI_LIBS=
969          AC_MSG_WARN(no WildMidi library found (libWildMidi))
970   fi
971   AC_SUBST(WILDMIDI_CFLAGS)
972   AC_SUBST(WILDMIDI_LIBS)
973 ])
974
975 dnl *** SDL ***
976 translit(dnm, m, l) AM_CONDITIONAL(USE_SDL, true)
977 AG_GST_CHECK_FEATURE(SDL, [SDL plug-in], sdlvideosink sdlaudiosink, [
978     AM_PATH_SDL(, HAVE_SDL=yes, HAVE_SDL=no)
979 ])
980
981 dnl *** sndfile ***
982 translit(dnm, m, l) AM_CONDITIONAL(USE_SNDFILE, true)
983 AG_GST_CHECK_FEATURE(SNDFILE, [sndfile plug-in], sfsrc sfsink, [
984   PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.16, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
985   AC_SUBST(SNDFILE_CFLAGS)
986   AC_SUBST(SNDFILE_LIBS)
987 ])
988
989 dnl *** soundtouch ***
990 translit(dnm, m, l) AM_CONDITIONAL(USE_SOUNDTOUCH, true)
991 AG_GST_CHECK_FEATURE(SOUNDTOUCH, [soundtouch plug-in], soundtouch, [
992   PKG_CHECK_MODULES(SOUNDTOUCH, soundtouch-1.0,
993     HAVE_SOUNDTOUCH=yes, 
994     [PKG_CHECK_MODULES(SOUNDTOUCH, libSoundTouch,
995       HAVE_SOUNDTOUCH=yes,
996       HAVE_SOUNDTOUCH=no)])
997   AC_SUBST(SOUNDTOUCH_CFLAGS)
998   AC_SUBST(SOUNDTOUCH_LIBS)
999   if test "x$HAVE_CXX" != "xyes"; then
1000     USE_SOUNDTOUCH=false
1001     AC_MSG_NOTICE([Not building soundtouch plugin: no C++ compiler found])
1002   fi
1003 ])
1004
1005 dnl *** spc ***
1006 translit(dnm, m, l) AM_CONDITIONAL(USE_SPC, true)
1007 AG_GST_CHECK_FEATURE(SPC, [spc decoder], spc, [
1008   AC_CHECK_HEADER(openspc.h, [
1009     AC_CHECK_LIB(openspc, OSPC_Init, [
1010       SPC_LIBS="-lopenspc"
1011       AC_SUBST(SPC_LIBS)
1012       HAVE_SPC=yes
1013     ], [
1014       HAVE_SPC=no
1015     ])
1016   ], [
1017     HAVE_SPC=no
1018   ])
1019 ])
1020
1021 dnl *** swfdec ***
1022 translit(dnm, m, l) AM_CONDITIONAL(USE_SWFDEC, true)
1023 AG_GST_CHECK_FEATURE(SWFDEC, [swfdec plug-in], swfdec, [
1024   PKG_CHECK_MODULES(SWFDEC, swfdec-0.3 >= 0.3.6, HAVE_SWFDEC=yes, [
1025     HAVE_SWFDEC=no
1026     AC_MSG_RESULT(no)
1027   ])
1028   AC_SUBST(SWFDEC_CFLAGS)
1029   AC_SUBST(SWFDEC_LIBS)
1030 ])
1031
1032 dnl *** theora ***
1033 translit(dnm, m, l) AM_CONDITIONAL(USE_THEORADEC, true)
1034 AG_GST_CHECK_FEATURE(THEORADEC, [ogg theora codec], theoraexpdec, [
1035   PKG_CHECK_MODULES(THEORADEC, theoradec, HAVE_THEORADEC="yes", [
1036     HAVE_THEORADEC="no"
1037     AC_MSG_RESULT(no)
1038   ])
1039   AC_SUBST(THEORADEC_LIBS)
1040   AC_SUBST(THEORADEC_CFLAGS)
1041 ])
1042
1043 dnl *** x264 (MPEG-4 part 10/h.264/AVC encoder) ***
1044 translit(dnm, m, l) AM_CONDITIONAL(USE_X264, true)
1045 AG_GST_CHECK_FEATURE(X264, [x264 plug-in], x264, [
1046   AG_GST_CHECK_LIBHEADER(X264, x264, x264_nal_encode, -lm, x264.h,
1047       X264_LIBS="$LDFLAGS -lx264 -lm"
1048       X264_CFLAGS="$CFLAGS"
1049       AC_SUBST(X264_LIBS)
1050       AC_SUBST(X264_CFLAGS))
1051 ])
1052
1053 dnl *** XVID ***
1054 translit(dnm, m, l) AM_CONDITIONAL(USE_XVID, true)
1055 AG_GST_CHECK_FEATURE(XVID, [xvid plugins], xvid, [
1056   HAVE_XVID=no
1057   AC_CHECK_HEADER(xvid.h, [
1058     OLD_LIBS="$LIBS"
1059     LIBS="-lm"
1060     AC_CHECK_LIB(xvidcore, xvid_encore, [
1061       AC_CHECK_LIB(xvidcore, xvid_decore, [
1062         AC_CHECK_LIB(xvidcore, xvid_global, [
1063           AC_MSG_CHECKING([for uptodate XviD API version])
1064           AC_TRY_COMPILE([#include <xvid.h>], [
1065               #if XVID_API_MAJOR(XVID_API) != 4
1066               #error "Incompatible XviD API version"
1067               #endif
1068           ],[ AC_MSG_RESULT(yes)
1069             XVID_LIBS="-lxvidcore -lm"
1070             AC_SUBST(XVID_LIBS)
1071             HAVE_XVID=yes
1072           ], AC_MSG_RESULT(no) )
1073         ], )
1074       ], )
1075     ], )
1076     LIBS="$OLD_LIBS"
1077   ], )
1078 ])
1079
1080 dnl *** dvb ***
1081 translit(dnm, m, l) AM_CONDITIONAL(USE_DVB, true)
1082 AG_GST_CHECK_FEATURE(DVB, [DVB Source], dvb, [
1083   AC_MSG_CHECKING([Checking for up to date dvb installation])
1084   AC_CHECK_HEADER(linux/dvb/frontend.h, [HAVE_DVB="yes"], [HAVE_DVB="no"])
1085 ])
1086
1087 dnl *** oss4 ***
1088 translit(dnm, m, l) AM_CONDITIONAL(USE_OSS4, true)
1089 AG_GST_CHECK_FEATURE(OSS4, [Open Sound System 4], oss4, [
1090   AC_MSG_CHECKING([Checking if we can build the OSS4 elements])
1091   AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/stat.h sys/types.h],
1092       [test -z "$OSS4_MISSING_HEADER" && HAVE_OSS4="yes"],
1093       [OSS4_MISSING_HEADER="yes";HAVE_OSS4="no"])
1094 ])
1095
1096 dnl *** wininet ***
1097 translit(dnm, m, l) AM_CONDITIONAL(USE_WININET, true)
1098 AG_GST_CHECK_FEATURE(WININET, [Windows internet library], wininet, [
1099   AC_MSG_CHECKING([Checking for windows internet support])
1100   AC_CHECK_HEADERS([windows.h wininet.h],
1101       [HAVE_WININET="yes"], [HAVE_WININET="no"])
1102 ])
1103
1104 else
1105
1106 dnl not building plugins with external dependencies,
1107 dnl but we still need to set the conditionals
1108
1109 AM_CONDITIONAL(USE_QUICKTIME, false)
1110 AM_CONDITIONAL(USE_VCD, false)
1111 AM_CONDITIONAL(USE_ALSA, false)
1112 AM_CONDITIONAL(USE_AMRWB, false)
1113 AM_CONDITIONAL(USE_BZ2, false)
1114 AM_CONDITIONAL(USE_CDAUDIO, false)
1115 AM_CONDITIONAL(USE_CELT, false)
1116 AM_CONDITIONAL(USE_DC1394, false)
1117 AM_CONDITIONAL(USE_DIRECTFB, false)
1118 AM_CONDITIONAL(USE_DTS, false)
1119 AM_CONDITIONAL(USE_DIRAC, false)
1120 AM_CONDITIONAL(USE_DIVX, false)
1121 AM_CONDITIONAL(USE_DVB, false)
1122 AM_CONDITIONAL(USE_FAAC, false)
1123 AM_CONDITIONAL(USE_FAAD, false)
1124 AM_CONDITIONAL(USE_FBDEV, false)
1125 AM_CONDITIONAL(USE_GSM, false)
1126 AM_CONDITIONAL(USE_IVORBIS, false)
1127 AM_CONDITIONAL(USE_JACK, false)
1128 AM_CONDITIONAL(USE_LADSPA, false)
1129 AM_CONDITIONAL(USE_LIBMMS, false)
1130 AM_CONDITIONAL(USE_METADATA, false)
1131 AM_CONDITIONAL(USE_MPEG2ENC, false)
1132 AM_CONDITIONAL(USE_MPLEX, false)
1133 AM_CONDITIONAL(USE_MUSEPACK, false)
1134 AM_CONDITIONAL(USE_MUSICBRAINZ, false)
1135 AM_CONDITIONAL(USE_MYTHTV, false)
1136 AM_CONDITIONAL(USE_NAS, false)
1137 AM_CONDITIONAL(USE_NEON, false)
1138 AM_CONDITIONAL(USE_OFA, false)
1139 AM_CONDITIONAL(USE_OSS4, false)
1140 AM_CONDITIONAL(USE_SDL, false)
1141 AM_CONDITIONAL(USE_SNDFILE, false)
1142 AM_CONDITIONAL(USE_SOUNDTOUCH, false)
1143 AM_CONDITIONAL(USE_SPC, false)
1144 AM_CONDITIONAL(USE_SWFDEC, false)
1145 AM_CONDITIONAL(USE_THEORADEC, false)
1146 AM_CONDITIONAL(USE_TIMIDITY, false)
1147 AM_CONDITIONAL(USE_X264, false)
1148 AM_CONDITIONAL(USE_XVID, false)
1149 AM_CONDITIONAL(USE_WILDMIDI, false)
1150 AM_CONDITIONAL(USE_WININET, false)
1151
1152 fi dnl of EXT plugins
1153
1154 dnl *** finalize CFLAGS, LDFLAGS, LIBS
1155
1156 dnl Overview:
1157 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
1158 dnl GST_*:              flags shared by built objects to link against GStreamer
1159 dnl GST_ALL_LDFLAGS:    linker flags shared by all
1160 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
1161 dnl GST_LT_LDFLAGS:     library versioning of our libraries
1162 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
1163
1164 dnl GST_OPTION_CFLAGS
1165 if test "x$USE_DEBUG" = xyes; then
1166    PROFILE_CFLAGS="-g"
1167 fi
1168 AC_SUBST(PROFILE_CFLAGS)
1169
1170 if test "x$PACKAGE_VERSION_NANO" = "x1"; then
1171   dnl Define _only_ during CVS (not pre-releases or releases)
1172   DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
1173 else
1174   DEPRECATED_CFLAGS=""
1175 fi
1176 AC_SUBST(DEPRECATED_CFLAGS)
1177
1178 dnl every flag in GST_OPTION_CFLAGS and GST_OPTION_CXXFLAGS can be overridden
1179 dnl at make time with e.g. make ERROR_CFLAGS=""
1180 GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
1181 GST_OPTION_CXXFLAGS="\$(ERROR_CXXFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
1182 AC_SUBST(GST_OPTION_CFLAGS)
1183 AC_SUBST(GST_OPTION_CXXFLAGS)
1184
1185 dnl FIXME: do we want to rename to GST_ALL_* ?
1186 dnl prefer internal headers to already installed ones
1187 dnl also add builddir include for enumtypes and marshal
1188 dnl add GST_OPTION_CFLAGS, but overridable
1189 GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS \$(GST_OPTION_CFLAGS)"
1190 GST_CXXFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CXXFLAGS \$(GST_OPTION_CXXFLAGS)"
1191 AC_SUBST(GST_CFLAGS)
1192 AC_SUBST(GST_CXXFLAGS)
1193 AC_SUBST(GST_LIBS)
1194
1195 dnl LDFLAGS really should only contain flags, not libs - they get added before
1196 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
1197 GST_ALL_LDFLAGS="-no-undefined"
1198 AC_SUBST(GST_ALL_LDFLAGS)
1199
1200 dnl this really should only contain flags, not libs - they get added before
1201 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
1202 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' $GST_ALL_LDFLAGS"
1203 AC_SUBST(GST_PLUGIN_LDFLAGS)
1204
1205 dnl *** output files ***
1206
1207 dnl po/Makefile.in
1208
1209
1210 AC_CONFIG_FILES(
1211 Makefile
1212 gst-plugins-bad.spec
1213 gst/Makefile
1214 gst/app/Makefile
1215 gst/bayer/Makefile
1216 gst/cdxaparse/Makefile
1217 gst/deinterlace/Makefile
1218 gst/deinterlace2/Makefile
1219 gst/dvdspu/Makefile
1220 gst/festival/Makefile
1221 gst/filter/Makefile
1222 gst/flv/Makefile
1223 gst/freeze/Makefile
1224 gst/h264parse/Makefile
1225 gst/librfb/Makefile
1226 gst/modplug/Makefile
1227 gst/modplug/libmodplug/Makefile
1228 gst/mpegtsparse/Makefile
1229 gst/mpeg4videoparse/Makefile
1230 gst/mpegvideoparse/Makefile
1231 gst/mve/Makefile
1232 gst/nsf/Makefile
1233 gst/nuvdemux/Makefile
1234 gst/rawparse/Makefile
1235 gst/rtpmanager/Makefile
1236 gst/sdp/Makefile
1237 gst/selector/Makefile
1238 gst/speed/Makefile
1239 gst/speexresample/Makefile
1240 gst/subenc/Makefile
1241 gst/stereo/Makefile
1242 gst/tta/Makefile
1243 gst/videosignal/Makefile
1244 gst/vmnc/Makefile
1245 gst/real/Makefile
1246 gst/y4m/Makefile
1247 gst-libs/Makefile
1248 gst-libs/gst/Makefile
1249 gst-libs/gst/app/Makefile
1250 gst-libs/gst/dshow/Makefile
1251 sys/Makefile
1252 sys/dshowdecwrapper/Makefile
1253 sys/dshowsrcwrapper/Makefile
1254 sys/dshowvideosink/Makefile
1255 sys/dvb/Makefile
1256 sys/fbdev/Makefile
1257 sys/oss4/Makefile
1258 sys/qtwrapper/Makefile
1259 sys/vcd/Makefile
1260 sys/wininet/Makefile
1261 examples/Makefile
1262 examples/app/Makefile
1263 examples/directfb/Makefile
1264 examples/switch/Makefile
1265 ext/amrwb/Makefile
1266 ext/alsaspdif/Makefile
1267 ext/bz2/Makefile
1268 ext/cdaudio/Makefile
1269 ext/celt/Makefile
1270 ext/dc1394/Makefile
1271 ext/dirac/Makefile
1272 ext/directfb/Makefile
1273 ext/divx/Makefile
1274 ext/dts/Makefile
1275 ext/metadata/Makefile
1276 ext/faac/Makefile
1277 ext/faad/Makefile
1278 ext/gsm/Makefile
1279 ext/ivorbis/Makefile
1280 ext/jack/Makefile
1281 ext/ladspa/Makefile
1282 ext/libmms/Makefile
1283 ext/Makefile
1284 ext/nas/Makefile
1285 ext/mpeg2enc/Makefile
1286 ext/mplex/Makefile
1287 ext/musepack/Makefile
1288 ext/musicbrainz/Makefile
1289 ext/mythtv/Makefile
1290 ext/neon/Makefile
1291 ext/ofa/Makefile
1292 ext/resindvd/Makefile
1293 ext/sdl/Makefile
1294 ext/sndfile/Makefile
1295 ext/soundtouch/Makefile
1296 ext/spc/Makefile
1297 ext/swfdec/Makefile
1298 ext/theora/Makefile
1299 ext/timidity/Makefile
1300 ext/x264/Makefile
1301 ext/xvid/Makefile
1302 po/Makefile.in
1303 docs/Makefile
1304 docs/plugins/Makefile
1305 docs/version.entities
1306 common/Makefile
1307 common/m4/Makefile
1308 m4/Makefile
1309 tests/Makefile
1310 tests/check/Makefile
1311 tests/icles/Makefile
1312 win32/common/config.h
1313 )
1314 AC_OUTPUT
1315
1316 AG_GST_OUTPUT_PLUGINS