configure.ac: Back to CVS.
[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.5.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 AM_PROG_LIBTOOL
45
46 dnl *** required versions of GStreamer stuff ***
47 dnl *** remove rtpmanager/equalizer stuff below when this is updated
48 GST_REQ=0.10.13
49 GSTPB_REQ=0.10.13
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_EXAMPLES
79
80 dnl these are all the gst plug-ins, compilable without additional libs
81 GST_PLUGINS_ALL="\
82   app \
83   bayer \
84   cdxaparse \
85   deinterlace \
86   equalizer \
87   filter \
88   freeze \
89   h264parse \
90   interleave \
91   librfb \
92   modplug \
93   mpegvideoparse \
94   multifile \
95   mve \
96   nsf \
97   nuvdemux \
98   real \
99   replaygain \
100   rtpmanager \
101   spectrum \
102   speed \
103   switch \
104   tta \
105   videoparse \
106   videosignal \
107   vmnc \
108   xingheader \
109   y4m \
110   "
111
112 AC_SUBST(GST_PLUGINS_ALL)
113
114 AG_GST_ARG_WITH_PLUGINS
115
116 AG_GST_ARG_ENABLE_EXTERNAL
117
118 AG_GST_ARG_ENABLE_EXPERIMENTAL
119
120 USE_TARKIN=$BUILD_EXPERIMENTAL
121
122 dnl *** checks for platform ***
123
124 dnl * hardware/architecture *
125
126 dnl common/m4/gst-arch.m4
127 dnl check CPU type
128 AG_GST_ARCH
129
130 dnl Determine endianness
131 AC_C_BIGENDIAN
132
133 dnl *** checks for programs ***
134
135 dnl find a compiler
136 AC_PROG_CC
137
138 dnl determine c++ compiler
139 AC_PROG_CXX
140 dnl determine if c++ is available on this system
141 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
142
143 AS_PROG_OBJC
144
145 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
146 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
147
148 dnl check for documentation tools
149 GTK_DOC_CHECK([1.3])
150 AS_PATH_PYTHON([2.1])
151
152 dnl *** checks for libraries ***
153
154 dnl check for libm, for sin() etc.
155 AC_CHECK_LIBM
156 AC_SUBST(LIBM)
157
158 dnl *** checks for header files ***
159
160 dnl used by ext/dts
161 AX_CREATE_STDINT_H
162
163 dnl *** checks for types/defines ***
164
165 dnl *** checks for structures ***
166
167 dnl *** checks for compiler characteristics ***
168
169 dnl *** checks for library functions ***
170
171 dnl *** checks for dependency libraries ***
172
173 dnl GLib is required
174 AG_GST_GLIB_CHECK([2.6])
175
176 dnl liboil is required
177 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= 0.3.2, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
178 if test "x${HAVE_LIBOIL}" != xyes ; then
179   AC_ERROR([liboil-0.3 is required])
180 fi
181
182 dnl checks for gstreamer
183 dnl uninstalled is selected preferentially -- see pkg-config(1)
184 AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQ])
185 AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQ])
186 AG_GST_CHECK_GST_GDP($GST_MAJORMINOR, [$GST_REQ])
187 AG_GST_CHECK_GST_CHECK($GST_MAJORMINOR, [$GST_REQ], no)
188 AG_GST_CHECK_GST_CONTROLLER($GST_MAJORMINOR, [$GST_REQ])
189 AG_GST_CHECK_GST_PLUGINS_BASE($GST_MAJORMINOR, [$GSTPB_REQ], no)
190 GSTPB_PLUGINS_DIR=`$PKG_CONFIG gstreamer-plugins-base-$GST_MAJORMINOR --variable pluginsdir`
191 AC_SUBST(GSTPB_PLUGINS_DIR)
192 AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
193
194 dnl FIXME: get rid of this by making sure gstreamer-check brings it in
195 dnl check for "check", unit testing library/header
196 AM_PATH_CHECK(0.9.2, HAVE_CHECK=yes, HAVE_CHECK=no)
197 AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
198
199 dnl Check for documentation xrefs
200 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
201 GST_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-$GST_MAJORMINOR`"
202 GSTPB_PREFIX="`$PKG_CONFIG --variable=prefix gstreamer-plugins-base-$GST_MAJORMINOR`"
203 AC_SUBST(GLIB_PREFIX)
204 AC_SUBST(GST_PREFIX)
205 AC_SUBST(GSTPB_PREFIX)
206
207 dnl GTK is optional and used in examples
208 HAVE_GTK=NO
209 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0, HAVE_GTK_22=yes, HAVE_GTK_22=no)
210 if test "x$HAVE_GTK_22" = "xyes"; then
211   HAVE_GTK=yes
212   GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
213   AC_SUBST(GTK_VERSION)
214   GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
215   AC_SUBST(GTK_BASE_DIR)
216   GDK_PIXBUF_LIBDIR=`$PKG_CONFIG --variable=libdir gdk-pixbuf-2.0`
217   GDK_PIXBUF_PREFIXDIR=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
218   AC_SUBST(GTK_BASE_DIR)
219 else
220   PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK_20=yes, HAVE_GTK_20=no)
221 fi
222 if test "x$HAVE_GTK_20" = "xyes"; then
223   HAVE_GTK=yes
224 fi
225 GTK_CFLAGS=$GTK2_CFLAGS
226 GTK_LIBS=$GTK2_LIBS
227 AC_SUBST(GTK_LIBS)
228 AC_SUBST(GTK_CFLAGS)
229 AC_SUBST(HAVE_GTK)
230 AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
231
232 dnl set license and copyright notice
233 GST_LICENSE="LGPL"
234 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
235 AC_SUBST(GST_LICENSE)
236
237 dnl set location of plugin directory
238 AG_GST_SET_PLUGINDIR
239
240 dnl define an ERROR_CFLAGS Makefile variable
241 AG_GST_SET_ERROR_CFLAGS($GST_CVS)
242
243 dnl define correct level for debugging messages
244 AG_GST_SET_LEVEL_DEFAULT($GST_CVS)
245
246 dnl *** plug-ins to exclude ***
247
248 dnl see if we can build C++ plug-ins
249 if test "x$HAVE_CXX" != "xyes"; then
250   AC_MSG_WARN([Not compiling plug-ins requiring C++ compiler])
251   GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | sed 's/modplug//g'`
252 fi
253
254 dnl real plugin only works on i386 and x86_64 for the time being.
255 if test "x$HAVE_CPU_I386" != "xyes" && test "x$HAVE_CPU_X86_64" != "xyes"; then
256   AC_MSG_WARN([Not building real plugin, only works on 32bit and 64bit x86 platforms])
257   GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | sed 's/real//g'`
258 fi
259
260 dnl disable gst plugins we might not be able to build on this
261 dnl platform: librfb (ugly but minimally invasive)
262 dnl FIXME: maybe move to sys, or make work with winsock2
263 AC_CHECK_HEADERS([sys/socket.h], HAVE_SYS_SOCKET_H=yes)
264 AC_CHECK_HEADERS([winsock2.h], HAVE_WINSOCK2_H=yes)
265
266 if test "x$HAVE_SYS_SOCKET_H" != "xyes"; then
267   GST_PLUGINS_SELECTED=`echo $GST_PLUGINS_SELECTED | $SED -e s/librfb//`
268 fi
269
270 AC_SUBST(GST_PLUGINS_SELECTED)
271
272
273 dnl *** sys plug-ins ***
274
275 dnl OpenGL
276 translit(dnm, m, l) AM_CONDITIONAL(USE_OPENGL, true)
277 AG_GST_CHECK_X
278 save_CPPFLAGS="$CPPFLAGS"
279 save_LIBS="$LIBS"
280 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
281 LIBS="$LIBS $X_LIBS"
282 AG_GST_CHECK_FEATURE(OPENGL, [Open GL], glsink, [
283   AG_GST_CHECK_LIBHEADER(GL, GL, glTexImage2D,,
284                       GL/gl.h, HAVE_OPENGL="yes", HAVE_OPENGL="no")
285 ])
286 CPPFLAGS="$save_CPPFLAGS"
287 LIBS="$save_LIBS"
288
289 dnl check for Video CD
290 translit(dnm, m, l) AM_CONDITIONAL(USE_VCD, true)
291 AG_GST_CHECK_FEATURE(VCD, [Video CD], vcdsrc, [
292   AC_CHECK_HEADER(linux/cdrom.h, HAVE_VCD="yes", HAVE_VCD="no")
293 ])
294
295 dnl Check for X11
296 translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
297 AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
298                   [ximagesrc], [
299   AC_PATH_XTRA
300
301   dnl now try to find the HEADER
302   ac_cflags_save="$CFLAGS"
303   ac_cppflags_save="$CPPFLAGS"
304   CFLAGS="$CFLAGS $X_CFLAGS"
305   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
306   AC_CHECK_HEADER(X11/X.h, HAVE_X="yes", HAVE_X="no")
307
308   if test "x$HAVE_X" = "xno"
309   then
310     AC_MSG_NOTICE([cannot find X11 development files])
311   else
312     dnl this is much more than we want
313     X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
314     dnl AC_PATH_XTRA only defines the path needed to find the X libs,
315     dnl it does not add the libs; therefore we add them here
316     X_LIBS="$X_LIBS -lX11"
317     AC_SUBST(X_CFLAGS)
318     AC_SUBST(X_LIBS)
319   fi
320   AC_SUBST(HAVE_X)
321   CFLAGS="$ac_cflags_save"
322   CPPFLAGS="$ac_cppflags_save"
323 ])
324
325
326 dnl *** ext plug-ins ***
327 dnl keep this list sorted alphabetically !
328
329 if test "x$BUILD_EXTERNAL" = "xyes"; then
330
331 dnl *** alsa ***
332 translit(dnm, m, l) AM_CONDITIONAL(USE_ALSA, true)
333 AG_GST_CHECK_FEATURE(ALSA, [alsa plug-ins], gstalsa, [
334   PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, [
335     HAVE_ALSA="yes"
336     AC_SUBST(ALSA_CFLAGS)
337     AC_SUBST(ALSA_LIBS)
338   ], [
339     AM_PATH_ALSA(0.9.1, HAVE_ALSA="yes", HAVE_ALSA="no")
340   ])
341 ])
342
343 dnl *** amrwb ***
344 translit(dnm, m, l) AM_CONDITIONAL(USE_AMRWB, true)
345 AG_GST_CHECK_FEATURE(AMRWB, [amrwb library], amrwb, [
346   AG_GST_CHECK_LIBHEADER(AMRWB, amrwb,
347                         GP3D_IF_decode, ,
348                         amrwb/dec.h,
349                         AMRWB_LIBS="-lamrwb"
350                         AC_SUBST(AMRWB_LIBS))
351 ])
352
353 dnl *** BZ2 ***
354 translit(dnm, m, l) AM_CONDITIONAL(USE_BZ2, true)
355 AG_GST_CHECK_FEATURE(BZ2, [bz2 library], bz2, [
356   AG_GST_CHECK_LIBHEADER(BZ2, bz2, BZ2_bzCompress, ,bzlib.h, BZ2_LIBS="-lbz2")
357   AC_SUBST(BZ2_LIBS)
358 ])
359
360 #dnl *** cairo ***
361 #translit(dnm, m, l) AM_CONDITIONAL(USE_CAIRO, true)
362 #AG_GST_CHECK_FEATURE(CAIRO, [cairo plug-in], cairo, [
363 #  PKG_CHECK_MODULES(CAIRO, cairo >= 1.0 glitz-glx, HAVE_CAIRO=yes, [
364 #    HAVE_CAIRO=no
365 #    AC_MSG_RESULT(no)
366 #  ])
367 #  AC_SUBST(CAIRO_CFLAGS)
368 #  AC_SUBST(CAIRO_LIBS)
369 #])
370
371 dnl *** cdaudio ***
372 translit(dnm, m, l) AM_CONDITIONAL(USE_CDAUDIO, true)
373 AG_GST_CHECK_FEATURE(CDAUDIO, [cdaudio], cdaudio, [
374   AG_GST_CHECK_CONFIGPROG(CDAUDIO, libcdaudio-config)
375   AC_SUBST(CDAUDIO_CFLAGS)
376   AC_SUBST(CDAUDIO_LIBS)
377 ])
378
379 dnl **** DirectFB ****
380 translit(dnm, m, l) AM_CONDITIONAL(USE_DIRECTFB, true)
381 AG_GST_CHECK_FEATURE(DIRECTFB, [directfb], dfbvideosink , [
382   PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.24, HAVE_DIRECTFB="yes", [
383     HAVE_DIRECTFB="no"
384     AC_MSG_RESULT(no)
385   ])
386 ])
387
388 dnl *** DTS ***
389 translit(dnm, m, l) AM_CONDITIONAL(USE_DTS, true)
390 AG_GST_CHECK_FEATURE(DTS, [dts library], dtsdec, [
391   AG_GST_CHECK_LIBHEADER(DTS, dts_pic, dts_init, -lm, dts.h,
392     DTS_LIBS="-ldts_pic -lm")
393   AC_SUBST(DTS_LIBS)
394 ])
395
396 dnl *** DIVX ***
397 translit(dnm, m, l) AM_CONDITIONAL(USE_DIVX, true)
398 AG_GST_CHECK_FEATURE(DIVX, [divx plugins], divx, [
399   HAVE_DIVX=yes
400   AC_CHECK_HEADER(encore2.h, , [
401     AC_MSG_WARN([Divx4linux encore headers not found])
402     HAVE_DIVX=no
403   ])
404   if [ test x$HAVE_DIVX = xyes ]; then
405     AC_MSG_CHECKING([Checking for valid divx4linux encore version])
406     AC_TRY_COMPILE([
407 #include <encore2.h>
408 #if ENCORE_VERSION != 20021024
409 #error Wrong version of divx encore libraries
410 #endif
411     ], [
412 return 0;
413     ], [
414       HAVE_DIVX=yes
415       AC_MSG_RESULT(yes)
416     ], [
417       HAVE_DIVX=no
418       AC_MSG_RESULT(no)
419       AC_MSG_WARN([Wrong version of divx4linux installed])
420     ])
421   fi
422   if [ test x$HAVE_DIVX = xyes ]; then
423     AC_CHECK_HEADER(decore.h, , [
424       AC_MSG_WARN([Divx4linux decoder headers not found])
425       HAVE_DIVX=no
426     ])
427   fi
428   if [ test x$HAVE_DIVX = xyes ]; then
429     AC_MSG_CHECKING([Checking for valid divx4linux decore version])
430     AC_TRY_COMPILE([
431 #include <decore.h>
432 #if DECORE_VERSION != 20021112
433 #error Wrong version of divx decore libraries
434 #endif
435     ], [
436 return 0;
437     ], [
438       HAVE_DIVX=yes
439       AC_MSG_RESULT(yes)
440     ], [
441       HAVE_DIVX=no
442       AC_MSG_RESULT(no)
443       AC_MSG_WARN([Wrong version of divx4linux installed])
444     ])
445   fi
446   LIBS="-lm"
447   if test x$HAVE_DIVX = xyes; then
448     AC_CHECK_LIB(divxencore, encore, , [
449       AC_MSG_WARN([Divx4linux encore libs not found])
450       HAVE_DIVX=no
451     ])
452   fi
453   if test x$HAVE_DIVX = xyes; then
454     AC_CHECK_LIB(divxdecore, decore, , [
455       AC_MSG_WARN([Divx4linux decore libs not found])
456       HAVE_DIVX=no
457   ])
458   fi
459   if test x$HAVE_DIVX = xyes; then
460     DIVXENC_LIBS="-ldivxencore -lm"
461     DIVXDEC_LIBS="-ldivxdecore -lm"
462     AC_SUBST(DIVXENC_LIBS)
463     AC_SUBST(DIVXDEC_LIBS)
464   fi
465 ])
466
467 dnl **** Free AAC Encoder (FAAC) ****
468 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAC, true)
469 AG_GST_CHECK_FEATURE(FAAC, [AAC encoder plug-in], faac, [
470   AG_GST_CHECK_LIBHEADER(FAAC, faac, faacEncOpen, -lm, faac.h,
471     FAAC_LIBS="-lfaac -lm")
472   AS_SCRUB_INCLUDE(FAAC_CFLAGS)
473   AC_SUBST(FAAC_LIBS)
474 ])
475
476 dnl **** Free AAC Decoder (FAAD) ****
477 translit(dnm, m, l) AM_CONDITIONAL(USE_FAAD, true)
478 AG_GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
479   HAVE_FAAD="yes"
480   AG_GST_CHECK_LIBHEADER(FAAD, faad, faacDecOpen, -lm, faad.h,
481     FAAD_LIBS="-lfaad -lm", HAVE_FAAD="no")
482   if test $HAVE_FAAD = "no"; then
483     AG_GST_CHECK_LIBHEADER(FAAD, faad, NeAACDecOpen, -lm, neaacdec.h,
484       [ FAAD_LIBS="-lfaad -lm"
485                 AC_DEFINE(FAAD_IS_NEAAC, 1, [Define if AAC is using new api prefix])
486           ],
487           HAVE_FAAD="no",)
488   fi
489   if test $HAVE_FAAD = "yes"; then
490     AC_MSG_CHECKING([Checking for FAAD >= 2])
491     AC_TRY_RUN([
492
493 #include <faad.h>
494 #if !defined(FAAD2_VERSION) || !defined(FAAD_FMT_DOUBLE)
495 #error Not faad2
496 #else
497 #include <string.h>
498
499 int main()
500 {
501 char version[9] = FAAD2_VERSION;
502 // a release candidate of 2.0 is not enought for us
503 if ( strstr( version, "2.0 RC" ) ) { return 1; }
504
505 return 0;
506 }
507
508 #endif
509     ], [
510       HAVE_FAAD="yes"
511       AC_MSG_RESULT(yes)
512     ], [
513       HAVE_FAAD="no"
514       AC_MSG_RESULT(no)
515     ])
516   fi
517   AS_SCRUB_INCLUDE(FAAD_CFLAGS)
518   AC_SUBST(FAAD_LIBS)
519   AC_SUBST(FAAD_IS_NEAAC)
520 ])
521
522 dnl *** gsm ***
523 translit(dnm, m, l) AM_CONDITIONAL(USE_GSM, true)
524 AG_GST_CHECK_FEATURE(GSM, [GSM library], gsmenc gsmdec, [
525   AG_GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm.h, GSM_LIBS="-lgsm")
526   if test $HAVE_GSM != "yes"; then
527     AG_GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm/gsm.h, GSM_LIBS="-lgsm")
528     if test $HAVE_GSM = "yes"; then
529       AC_DEFINE(GSM_HEADER_IN_SUBDIR, 1, [Define if GSM header in gsm/ subdir])
530     fi
531   fi
532   AC_SUBST(GSM_LIBS)
533 ])
534
535 dnl *** ivorbis ***
536 dnl AM_PATH_IVORBIS only takes two options
537 translit(dnm, m, l) AM_CONDITIONAL(USE_IVORBIS, true)
538 AG_GST_CHECK_FEATURE(IVORBIS, [integer vorbis plug-in], ivorbisdec, [
539   IVORBIS_LIBS=
540   IVORBIS_CFLAGS=
541   AC_CHECK_LIB(vorbisidec, vorbis_block_init,
542     [IVORBIS_LIBS=-lvorbisidec
543      HAVE_IVORBIS=yes
544      case $host in
545      arm-*-*)
546        IVORBIS_CFLAGS="-D_ARM_ASSEM_ $IVORBIS_CFLAGS"
547      esac
548     ],
549     HAVE_IVORBIS=no)
550   AC_SUBST(IVORBIS_LIBS)
551   AC_SUBST(IVORBIS_CFLAGS)
552 ])
553
554 dnl *** Jack ***
555 translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
556 AG_GST_CHECK_FEATURE(JACK, Jack, jack, [
557   PKG_CHECK_MODULES(JACK, jack >= 0.99.10, HAVE_JACK="yes", HAVE_JACK="no")
558   AC_SUBST(JACK_CFLAGS)
559   AC_SUBST(JACK_LIBS)
560 ])
561
562 dnl *** ladspa ***
563 translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true)
564 AG_GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [
565   AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA="yes", HAVE_LADSPA="no")
566 ])
567
568 dnl *** libmms ***
569 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBMMS, true)
570 AG_GST_CHECK_FEATURE(LIBMMS, [mms protocol library], libmms, [
571   dnl check with pkg-config first
572   PKG_CHECK_MODULES(LIBMMS, libmms >= 0.2, HAVE_LIBMMS="yes", [
573     HAVE_LIBMMS="no"
574     AC_MSG_RESULT(no)
575   ])
576 ])
577 AC_SUBST(LIBMMS_LIBS)
578
579 dnl *** mjpegtools version info ***
580 dnl some may prefer older version (given quirks above)
581 dnl hm, no version info seems available within mjpegtools headers
582 PKG_CHECK_EXISTS(mjpegtools >= 1.8.0 mjpegtools < 1.9.0, [
583   AC_DEFINE(GST_MJPEGTOOLS_18x, 1, [mjpegtools >= 1.8.0 is used])
584   have_mpjegtools_18x=yes
585   ], [
586   have_mpjegtools_18x=no])
587
588 dnl *** mpeg2enc ***
589 translit(dnm, m, l) AM_CONDITIONAL(USE_MPEG2ENC, true)
590 AG_GST_CHECK_FEATURE(MPEG2ENC, [mpeg2enc], mpeg2enc, [
591   HAVE_MPEG2ENC="no"
592   dnl we require a c++ compiler for this one
593   if [ test x$HAVE_CXX = xyes ]; then
594     dnl libmpeg2enc was first included in mjpegtools-1.6.2-rc3 (1.6.1.92)
595     dnl since many distros include mjpegtools specifically without mplex
596     dnl and mpeg2enc, we check for mpeg2enc on its own, too.
597     PKG_CHECK_MODULES(MPEG2ENC, mjpegtools >= 1.6.1.93, [
598       dnl HACK because mpeg2enc 1.8.0 header files have a spurious 'include config.h'
599       touch config.h
600       dnl switch over to c++ to test things
601       AC_LANG_CPLUSPLUS
602       OLD_CPPFLAGS="$CPPFLAGS"
603       dnl HACK as above
604       CPPFLAGS_GOOD="$CPPFLAGS $MPEG2ENC_CFLAGS"
605       CPPFLAGS="$CPPFLAGS_GOOD -I."
606       dnl check headers
607       mpeg2enc_headers_ok=no
608       AC_CHECK_HEADER([mpeg2encoder.hh], [
609         MPEG2ENC_LIBS="$MPEG2ENC_LIBS -lmpeg2encpp -lm -lpthread"
610         OLD_LIBS="$LIBS"
611         LIBS="$LIBS $MPEG2ENC_LIBS"
612         AC_MSG_CHECKING([for valid mpeg2enc objects])
613         AC_TRY_RUN([
614           #include <mpeg2encoder.hh>
615           #include <mpeg2encoptions.hh>
616
617           int
618           main (int   argc,
619                 char *argv[])
620           {
621             MPEG2EncOptions *options = new MPEG2EncOptions ();
622             MPEG2Encoder *encoder = new MPEG2Encoder (*options);
623             return 0;
624           }
625         ],[
626           AC_MSG_RESULT(yes)
627           dnl so far so good, let's check more things:
628           dnl mjpegtools-1.8.0 does not install the required
629           dnl mpeg2syntaxcodes.h header by default, and a new release
630           dnl is not in sight, so check for this oversight in case
631           dnl distros or folks have fixed this themselves
632           if test "x$have_mpjegtools_18x" = "xyes"; then
633             AC_CHECK_HEADER([mpeg2syntaxcodes.h], [
634                 mpeg2enc_headers_ok=yes
635               ], [
636                 mpeg2enc_headers_ok=no
637               ])
638           fi
639           if test "x$mpeg2enc_headers_ok" = "xyes"; then
640             HAVE_MPEG2ENC="yes"
641           fi
642           CPP_FLAGS="$CPPFLAGS_GOOD"
643           AC_SUBST(MPEG2ENC_CFLAGS)
644           AC_SUBST(MPEG2ENC_LIBS)
645         ], [
646           AC_MSG_RESULT(no)
647         ])
648         LIBS="$OLD_LIBS"
649       ])
650
651       CPPFLAGS="$OLD_CPPFLAGS"
652       AC_LANG_C
653     ], [
654       HAVE_MPEG2ENC="no"
655     ])
656   fi
657 ])
658
659 dnl *** musepack ***
660 translit(dnm, m, l) AM_CONDITIONAL(USE_MUSEPACK, true)
661 AG_GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
662   AC_LANG_CPLUSPLUS
663   AC_CHECK_HEADER([mpcdec/mpcdec.h], [
664     HAVE_MUSEPACK="yes"
665     MUSEPACK_LIBS="-lmpcdec"
666     AC_SUBST(MUSEPACK_LIBS)
667     ], [HAVE_MUSEPACK="no"])
668   AC_LANG_C
669 ])
670
671 dnl *** musicbrainz ***
672 translit(dnm, m, l) AM_CONDITIONAL(USE_MUSICBRAINZ, true)
673 AG_GST_CHECK_FEATURE(MUSICBRAINZ, [musicbrainz tag generation], musicbrainz, [
674   PKG_CHECK_MODULES(MUSICBRAINZ, libmusicbrainz >= 2.1.0, HAVE_MUSICBRAINZ="yes", HAVE_MUSICBRAINZ="no")
675   AC_SUBST(MUSICBRAINZ_CFLAGS)
676   AC_SUBST(MUSICBRAINZ_LIBS)
677 ])
678
679 dnl *** MythTV ***
680 translit(dnm, m, l) AM_CONDITIONAL(USE_MYTHTV, true)
681 AG_GST_CHECK_FEATURE(MYTHTV, [MythTV client plugins], mythtvsrc, [
682   PKG_CHECK_MODULES(GMYTH, gmyth-0.1 >= 0.1.0.3, HAVE_MYTHTV="yes", [
683     HAVE_MYTHTV="no"
684     AC_MSG_RESULT(no)
685   ])
686   AC_SUBST(GMYTH_CFLAGS)
687   AC_SUBST(GMYTH_LIBS)
688 ])
689
690 dnl *** nas ***
691 translit(dnm, m, l) AM_CONDITIONAL(USE_NAS, true)
692 AG_GST_CHECK_FEATURE(NAS, [nas plug-in], nassink, [
693   HAVE_NAS="no"
694   if test "x$HAVE_X" = "xyes"; then
695     save_cppflags=$CFLAGS
696     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
697     AG_GST_CHECK_LIBHEADER(NAS, audio, AuOpenServer, $X_LIBS, audio/audiolib.h,
698       NAS_LIBS="$X_LIBS -laudio" NAS_CFLAGS="$X_CFLAGS")
699     CPPFLAGS="$save_cppflags"
700   fi
701   AC_SUBST(NAS_CFLAGS)
702   AC_SUBST(NAS_LIBS)
703 ])
704
705 dnl *** neon ***
706 translit(dnm, m, l) AM_CONDITIONAL(USE_NEON, true)
707 AG_GST_CHECK_FEATURE(NEON, [neon http client plugins], neonhttpsrc, [
708   PKG_CHECK_MODULES(NEON, neon >= 0.25.5  neon <= 0.26.99, HAVE_NEON="yes", [
709     HAVE_NEON="no"
710     AC_MSG_RESULT(no)
711   ])
712   AC_SUBST(NEON_CFLAGS)
713   AC_SUBST(NEON_LIBS)
714 ])
715
716 dnl *** timidity ***
717 translit(dnm, m, l) AM_CONDITIONAL(USE_TIMIDITY, true)
718 AG_GST_CHECK_FEATURE(TIMIDITY, [timidity midi soft synth plugin], timidity, [
719   PKG_CHECK_MODULES(TIMIDITY, libtimidity, [
720     HAVE_TIMIDITY="yes",
721         AC_MSG_CHECKING([for timidity.cfg])
722         timidity_cfg=""
723         if test -r /etc/timidity.cfg; then
724           timidity_cfg=/etc/timidity.cfg
725         elif test -r /etc/timidity/timidity.cfg; then
726           timidity_cfg=/etc/timidity/timidity.cfg
727         elif test -r /usr/share/timidity/timidity.cfg; then
728           timidity_cfg=/usr/share/timidity/timidity.cfg
729         elif test -r /usr/local/share/timidity/timidity.cfg; then
730           timidity_cfg=/usr/local/share/timidity/timidity.cfg
731         fi
732         if test "x$timidity_cfg" != "x"; then
733           AC_MSG_RESULT($timidity_cfg)
734       AC_DEFINE_UNQUOTED(TIMIDITY_CFG, "$timidity_cfg", [Define location of timidity.cfg])
735         else
736           AC_MSG_RESULT([not found])
737         fi
738   ], [
739     HAVE_TIMIDITY="no"
740     AC_MSG_RESULT(no)
741   ])
742   AC_SUBST(TIMIDITY_CFLAGS)
743   AC_SUBST(TIMIDITY_LIBS)
744 ])
745
746 dnl *** wildmidi ***
747 translit(dnm, m, l) AM_CONDITIONAL(USE_WILDMIDI, true)
748 AG_GST_CHECK_FEATURE(WILDMIDI, [wildmidi midi soft synth plugin], wildmidi, [
749   AC_CHECK_HEADER([wildmidi_lib.h],HAVE_WILDMIDI=yes, HAVE_WILDMIDI=no)
750   if test "x$HAVE_WILDMIDI" = "xyes"; then
751          WILDMIDI_CFLAGS=
752          WILDMIDI_LIBS=-lWildMidi
753          AC_MSG_NOTICE(compiling gstWildMidi)
754   else
755          WILDMIDI_CFLAGS=
756          WILDMIDI_LIBS=
757          AC_MSG_WARN(no WildMidi library found (libWildMidi))
758   fi
759   AC_SUBST(WILDMIDI_CFLAGS)
760   AC_SUBST(WILDMIDI_LIBS)
761 ])
762
763 dnl *** SDL ***
764 translit(dnm, m, l) AM_CONDITIONAL(USE_SDL, true)
765 AG_GST_CHECK_FEATURE(SDL, [SDL plug-in], sdlvideosink sdlaudiosink, [
766     AM_PATH_SDL(, HAVE_SDL=yes, HAVE_SDL=no)
767 ])
768
769 dnl *** sndfile ***
770 translit(dnm, m, l) AM_CONDITIONAL(USE_SNDFILE, true)
771 AG_GST_CHECK_FEATURE(SNDFILE, [sndfile plug-in], sfsrc sfsink, [
772   PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.16, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
773   AC_SUBST(SNDFILE_CFLAGS)
774   AC_SUBST(SNDFILE_LIBS)
775 ])
776
777 dnl *** soundtouch ***
778 translit(dnm, m, l) AM_CONDITIONAL(USE_SOUNDTOUCH, true)
779 AG_GST_CHECK_FEATURE(SOUNDTOUCH, [soundtouch plug-in], soundtouch, [
780   PKG_CHECK_MODULES(SOUNDTOUCH, libSoundTouch, HAVE_SOUNDTOUCH=yes, [
781     HAVE_SOUNDTOUCH=no
782      AC_MSG_RESULT(no)])
783   AC_SUBST(SOUNDTOUCH_CFLAGS)
784   AC_SUBST(SOUNDTOUCH_LIBS)
785   if test "x$HAVE_CXX" != "xyes"; then
786     USE_SOUNDTOUCH=false
787     AC_MSG_NOTICE([Not building soundtouch plugin: no C++ compiler found])
788   fi
789 ])
790
791 dnl *** spc ***
792 translit(dnm, m, l) AM_CONDITIONAL(USE_SPC, true)
793 AG_GST_CHECK_FEATURE(SPC, [spc decoder], spc, [
794   AC_CHECK_HEADER(openspc.h, [
795     AC_CHECK_LIB(openspc, OSPC_Init, [
796       SPC_LIBS="-lopenspc"
797       AC_SUBST(SPC_LIBS)
798       HAVE_SPC=yes
799     ], [
800       HAVE_SPC=no
801     ])
802   ], [
803     HAVE_SPC=no
804   ])
805 ])
806
807 dnl *** swfdec ***
808 translit(dnm, m, l) AM_CONDITIONAL(USE_SWFDEC, true)
809 AG_GST_CHECK_FEATURE(SWFDEC, [swfdec plug-in], swfdec, [
810   PKG_CHECK_MODULES(SWFDEC, swfdec-0.3 >= 0.3.6, HAVE_SWFDEC=yes, [
811     HAVE_SWFDEC=no
812     AC_MSG_RESULT(no)
813   ])
814   AC_SUBST(SWFDEC_CFLAGS)
815   AC_SUBST(SWFDEC_LIBS)
816 ])
817
818 dnl *** theora ***
819 translit(dnm, m, l) AM_CONDITIONAL(USE_THEORADEC, true)
820 AG_GST_CHECK_FEATURE(THEORADEC, [ogg theora codec], theoraexpdec, [
821   PKG_CHECK_MODULES(THEORADEC, theoradec, HAVE_THEORADEC="yes", [
822     HAVE_THEORADEC="no"
823     AC_MSG_RESULT(no)
824   ])
825   AC_SUBST(THEORADEC_LIBS)
826   AC_SUBST(THEORADEC_CFLAGS)
827 ])
828
829 dnl *** x264 (MPEG-4 part 10/h.264/AVC encoder) ***
830 translit(dnm, m, l) AM_CONDITIONAL(USE_X264, true)
831 AG_GST_CHECK_FEATURE(X264, [x264 plug-in], x264, [
832   AG_GST_CHECK_LIBHEADER(X264, x264, x264_nal_encode, -lm, x264.h,
833       X264_LIBS="$LDFLAGS -lx264 -lm"
834       X264_CFLAGS="$CFLAGS"
835       AC_SUBST(X264_LIBS)
836       AC_SUBST(X264_CFLAGS))
837 ])
838
839 dnl *** XVID ***
840 translit(dnm, m, l) AM_CONDITIONAL(USE_XVID, true)
841 AG_GST_CHECK_FEATURE(XVID, [xvid plugins], xvid, [
842   HAVE_XVID=no
843   AC_CHECK_HEADER(xvid.h, [
844     OLD_LIBS="$LIBS"
845     LIBS="-lm"
846     AC_CHECK_LIB(xvidcore, xvid_encore, [
847       AC_CHECK_LIB(xvidcore, xvid_decore, [
848         AC_CHECK_LIB(xvidcore, xvid_global, [
849           AC_MSG_CHECKING([for uptodate XviD API version])
850           AC_TRY_RUN([
851 #include <xvid.h>
852 #if XVID_API_MAJOR(XVID_API) != 4
853 #error "Incompatible XviD API version"
854 #endif
855 int main () { return 0; }
856           ],[ AC_MSG_RESULT(yes)
857             XVID_LIBS="-lxvidcore -lm"
858             AC_SUBST(XVID_LIBS)
859             HAVE_XVID=yes
860           ], AC_MSG_RESULT(no) )
861         ], )
862       ], )
863     ], )
864     LIBS="$OLD_LIBS"
865   ], )
866 ])
867
868 dnl *** dvb ***
869 translit(dnm, m, l) AM_CONDITIONAL(USE_DVB, true)
870 AG_GST_CHECK_FEATURE(DVB, [DVB Source], dvb, [
871   AC_MSG_CHECKING([Checking for up to date dvb installation])
872   AC_CHECK_HEADER(linux/dvb/frontend.h, [HAVE_DVB="yes"], [HAVE_DVB="no"])
873 ])
874
875 else
876
877 dnl not building plugins with external dependencies,
878 dnl but we still need to set the conditionals
879
880 AM_CONDITIONAL(USE_OPENGL, false)
881 AM_CONDITIONAL(USE_VCD, false)
882 AM_CONDITIONAL(USE_X, false)
883 AM_CONDITIONAL(USE_ALSA, false)
884 AM_CONDITIONAL(USE_AMRWB, false)
885 AM_CONDITIONAL(USE_BZ2, false)
886 AM_CONDITIONAL(USE_CDAUDIO, false)
887 AM_CONDITIONAL(USE_DIRECTFB, false)
888 AM_CONDITIONAL(USE_DTS, false)
889 AM_CONDITIONAL(USE_DIVX, false)
890 AM_CONDITIONAL(USE_FAAC, false)
891 AM_CONDITIONAL(USE_FAAD, false)
892 AM_CONDITIONAL(USE_GSM, false)
893 AM_CONDITIONAL(USE_IVORBIS, false)
894 AM_CONDITIONAL(USE_JACK, false)
895 AM_CONDITIONAL(USE_LADSPA, false)
896 AM_CONDITIONAL(USE_LIBMMS, false)
897 AM_CONDITIONAL(USE_MPEG2ENC, false)
898 AM_CONDITIONAL(USE_MUSEPACK, false)
899 AM_CONDITIONAL(USE_MUSICBRAINZ, false)
900 AM_CONDITIONAL(USE_MYTHTV, false)
901 AM_CONDITIONAL(USE_NAS, false)
902 AM_CONDITIONAL(USE_NEON, false)
903 AM_CONDITIONAL(USE_SDL, false)
904 AM_CONDITIONAL(USE_SNDFILE, false)
905 AM_CONDITIONAL(USE_SOUNDTOUCH, false)
906 AM_CONDITIONAL(USE_SPC, false)
907 AM_CONDITIONAL(USE_SWFDEC, false)
908 AM_CONDITIONAL(USE_THEORADEC, false)
909 AM_CONDITIONAL(USE_TIMIDITY, false)
910 AM_CONDITIONAL(USE_X264, false)
911 AM_CONDITIONAL(USE_XVID, false)
912 AM_CONDITIONAL(USE_WILDMIDI, false)
913 AM_CONDITIONAL(USE_DVB, false)
914
915 fi dnl of EXT plugins
916
917 dnl *** finalize CFLAGS, LDFLAGS, LIBS
918
919 dnl Overview:
920 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
921 dnl GST_*:              flags shared by built objects to link against GStreamer
922 dnl GST_ALL_LDFLAGS:    linker flags shared by all
923 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
924 dnl GST_LT_LDFLAGS:     library versioning of our libraries
925 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
926
927 dnl GST_OPTION_CFLAGS
928 if test "x$USE_DEBUG" = xyes; then
929    PROFILE_CFLAGS="-g"
930 fi
931 AC_SUBST(PROFILE_CFLAGS)
932
933 DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
934 AC_SUBST(DEPRECATED_CFLAGS)
935
936 dnl every flag in GST_OPTION_CFLAGS can be overridden at make time
937 GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
938 AC_SUBST(GST_OPTION_CFLAGS)
939
940 dnl FIXME: do we want to rename to GST_ALL_* ?
941 dnl prefer internal headers to already installed ones
942 dnl also add builddir include for enumtypes and marshal
943 dnl add GST_OPTION_CFLAGS, but overridable
944 GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS \$(GST_OPTION_CFLAGS)"
945 AC_SUBST(GST_CFLAGS)
946 AC_SUBST(GST_LIBS)
947
948 dnl LDFLAGS really should only contain flags, not libs - they get added before
949 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
950 GST_ALL_LDFLAGS="-no-undefined"
951 AC_SUBST(GST_ALL_LDFLAGS)
952
953 dnl this really should only contain flags, not libs - they get added before
954 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
955 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' $GST_ALL_LDFLAGS"
956 AC_SUBST(GST_PLUGIN_LDFLAGS)
957
958 dnl *** output files ***
959
960 dnl po/Makefile.in
961
962
963 AC_CONFIG_FILES(
964 Makefile
965 gst-plugins-bad.spec
966 gst/Makefile
967 gst/app/Makefile
968 gst/bayer/Makefile
969 gst/cdxaparse/Makefile
970 gst/deinterlace/Makefile
971 gst/equalizer/Makefile
972 gst/filter/Makefile
973 gst/freeze/Makefile
974 gst/h264parse/Makefile
975 gst/interleave/Makefile
976 gst/librfb/Makefile
977 gst/modplug/Makefile
978 gst/modplug/libmodplug/Makefile
979 gst/mpegvideoparse/Makefile
980 gst/multifile/Makefile
981 gst/mve/Makefile
982 gst/nsf/Makefile
983 gst/nuvdemux/Makefile
984 gst/replaygain/Makefile
985 gst/rtpmanager/Makefile
986 gst/spectrum/Makefile
987 gst/speed/Makefile
988 gst/switch/Makefile
989 gst/tta/Makefile
990 gst/videoparse/Makefile
991 gst/videosignal/Makefile
992 gst/vmnc/Makefile
993 gst/xingheader/Makefile
994 gst/real/Makefile
995 gst/y4m/Makefile
996 gst-libs/Makefile
997 gst-libs/gst/Makefile
998 gst-libs/gst/app/Makefile
999 sys/Makefile
1000 sys/glsink/Makefile
1001 sys/dvb/Makefile
1002 sys/vcd/Makefile
1003 examples/Makefile
1004 examples/app/Makefile
1005 examples/directfb/Makefile
1006 examples/switch/Makefile
1007 ext/amrwb/Makefile
1008 ext/alsaspdif/Makefile
1009 ext/bz2/Makefile
1010 ext/cdaudio/Makefile
1011 ext/directfb/Makefile
1012 ext/divx/Makefile
1013 ext/dts/Makefile
1014 ext/faac/Makefile
1015 ext/faad/Makefile
1016 ext/gsm/Makefile
1017 ext/ivorbis/Makefile
1018 ext/jack/Makefile
1019 ext/ladspa/Makefile
1020 ext/libmms/Makefile
1021 ext/Makefile
1022 ext/nas/Makefile
1023 ext/mpeg2enc/Makefile
1024 ext/musepack/Makefile
1025 ext/musicbrainz/Makefile
1026 ext/mythtv/Makefile
1027 ext/neon/Makefile
1028 ext/sdl/Makefile
1029 ext/sndfile/Makefile
1030 ext/soundtouch/Makefile
1031 ext/spc/Makefile
1032 ext/swfdec/Makefile
1033 ext/theora/Makefile
1034 ext/timidity/Makefile
1035 ext/x264/Makefile
1036 ext/xvid/Makefile
1037 po/Makefile.in
1038 docs/Makefile
1039 docs/plugins/Makefile
1040 docs/version.entities
1041 common/Makefile
1042 common/m4/Makefile
1043 m4/Makefile
1044 tests/Makefile
1045 tests/check/Makefile
1046 tests/icles/Makefile
1047 )
1048 AC_OUTPUT
1049
1050 AG_GST_OUTPUT_PLUGINS