restructure configure.ac, use correct libtool LDFLAGS, fix up defines
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ(2.52)
2
3 dnl initialize autoconf
4 dnl we don't specify PACKAGE and VERSION because AS_VERSION puts it together
5 AC_INIT
6
7 dnl when going to/from release please set the nano (fourth number) right !
8 dnl releases only do Wall, cvs and prerelease does Werror too
9 AS_VERSION(gst-plugins-base, GST_PLUGINS_BASE_VERSION, 0, 9, 3, 1,
10     GST_CVS="no", GST_CVS="yes")
11
12 dnl can autoconf find the source ?
13 AC_CONFIG_SRCDIR([gst/sine/gstsinesrc.c])
14
15 dnl define the output header for config
16 AM_CONFIG_HEADER([config.h])
17
18 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
19 AM_MAINTAINER_MODE
20
21 dnl sets host_* variables
22 AC_CANONICAL_HOST
23
24 dnl initialize automake
25 dnl FIXME: this is deprecated use, we should move PACKAGE and VERSION to
26 dnl AC_INIT, but then we need to parse the version to pass to AS_VERSION
27 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
28
29 dnl our libraries and install dirs use major.minor as a version
30 GST_MAJORMINOR=$GST_PLUGINS_BASE_VERSION_MAJOR.$GST_PLUGINS_BASE_VERSION_MINOR
31 dnl we override it here if we need to for the release candidate of new series
32 # GST_MAJORMINOR=0.9
33 AC_SUBST(GST_MAJORMINOR)
34
35 dnl CURRENT, REVISION, AGE
36 dnl - library source changed -> increment REVISION
37 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
38 dnl - interfaces added -> increment AGE
39 dnl - interfaces removed -> AGE = 0
40 dnl sets GST_LT_LDFLAGS
41 AS_LIBTOOL(GST, 2, 0, 0)
42 AS_LIBTOOL_TAGS
43 AM_PROG_LIBTOOL
44
45 dnl *** autotools stuff ****
46
47 dnl allow for different autotools
48 AS_AUTOTOOLS_ALTERNATE
49
50 dnl Add parameters for aclocal
51 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
52
53 dnl set up gettext
54 dnl the version check needs to stay here because autopoint greps for it
55 AM_GNU_GETTEXT_VERSION([0.11.5])
56 AM_GNU_GETTEXT([external])
57 GST_GETTEXT([gst-plugins-base-$GST_MAJORMINOR])
58
59 dnl *** check for arguments to configure ***
60
61 GST_ARG_DEBUG
62 GST_ARG_PROFILING
63 GST_ARG_VALGRIND
64 GST_ARG_GCOV
65
66 GST_ARG_EXAMPLES
67
68 GST_ARG_WITH_PKG_CONFIG_PATH
69 GST_ARG_WITH_PACKAGE_NAME([GStreamer Base Plug-ins])
70 GST_ARG_WITH_PACKAGE_ORIGIN
71
72 dnl *** checks for platform ***
73
74 dnl * hardware/architecture *
75
76 dnl common/m4/gst-arch.m4
77 dnl check CPU type
78 GST_ARCH
79
80 dnl *** checks for programs ***
81
82 dnl find a compiler
83 AC_PROG_CC
84
85 dnl determine c++ compiler
86 AC_PROG_CXX
87 dnl determine if c++ is available on this system
88 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
89
90 dnl determine c++ preprocessor
91 dnl FIXME: do we need this ?
92 AC_PROG_CXXCPP
93
94 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
95 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
96
97 dnl check for documentation tools
98 GTK_DOC_CHECK([1.3])
99 AS_PATH_PYTHON([2.1])
100
101 dnl *** checks for libraries ***
102
103 dnl For interactive UNIX (a Sun thing)
104 dnl FIXME: this adds -lcposix to LIBS, but I doubt we use LIBS
105 AC_ISC_POSIX
106
107 dnl *** checks for header files ***
108
109 dnl check if we have ANSI C header files
110 AC_HEADER_STDC
111
112 dnl used in gst/ffmpegcolorspace/mem.c
113 dnl FIXME: could be fixed by redefining av_malloc and av_free to GLib's
114 AC_CHECK_HEADER([malloc.h])
115
116 dnl *** checks for types/defines ***
117
118 dnl Check for FIONREAD ioctl declaration
119 dnl used in gst/tcp
120 GST_CHECK_FIONREAD
121
122 dnl *** checks for structures ***
123
124 dnl *** checks for compiler characteristics ***
125
126 dnl make sure we can use "inline" from C code
127 AC_C_INLINE
128
129 dnl *** checks for library functions ***
130
131 dnl Check for fast float to int casting as defined in C99
132 dnl used in gst-libs/gst/floatcast/floatcast.h
133 AC_C99_FUNC_LRINT
134 AC_C99_FUNC_LRINTF
135
136 dnl Check for a way to display the function name in debug output
137 GST_CHECK_FUNCTION
138
139 dnl *** checks for dependancy libraries ***
140
141 dnl GLib
142
143 GST_GLIB_CHECK([2.6])
144
145 dnl liboil
146 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= 0.3.2, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
147 if test "x${HAVE_LIBOIL}" != xyes ; then
148   AC_ERROR([liboil-0.3 is required])
149 fi
150
151 dnl *** set variables based on configure arguments ***
152
153 dnl set license and copyright notice
154 GST_LICENSE="LGPL"
155 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
156 AC_SUBST(GST_LICENSE)
157
158 dnl set location of plugin directory
159 GST_SET_PLUGINDIR
160
161 dnl define an ERROR_CFLAGS Makefile variable
162 GST_SET_ERROR_CFLAGS($GST_CVS)
163
164 dnl define correct level for debugging messages
165 GST_SET_LEVEL_DEFAULT($GST_CVS)
166
167 dnl decide on default elements
168 dnl FIXME: provide configure-time options for this
169 dnl FIXME: describe where exactly this gets used
170 dnl FIXME: decide if it's a problem that this could point to sinks from
171 dnl        depending plugin modules
172 DEFAULT_AUDIOSINK="alsasink"
173 DEFAULT_VIDEOSINK="xvimagesink"
174 DEFAULT_AUDIOSRC="alsasrc"
175 DEFAULT_VIDEOSRC="v4lsrc"
176 DEFAULT_VISUALIZER="goom"
177 case "$host" in 
178   *-sun-* | *pc-solaris* )
179     DEFAULT_AUDIOSINK="sunaudiosink"
180     DEFAULT_VIDEOSINK="ximagesink"
181     DEFAULT_AUDIOSRC="sunaudiosrc"
182     ;;
183   *-darwin* )
184     DEFAULT_AUDIOSINK="osxaudiosink"
185     DEFAULT_AUDIOSRC="osxaudiosrc"
186     DEFAULT_VIDEOSINK="osxvideosink"
187     ;;
188 esac
189
190 AC_SUBST(DEFAULT_AUDIOSINK)
191 AC_DEFINE_UNQUOTED(DEFAULT_AUDIOSINK, "$DEFAULT_AUDIOSINK",
192   [Default audio sink])
193 AC_SUBST(DEFAULT_AUDIOSRC)
194 AC_DEFINE_UNQUOTED(DEFAULT_AUDIOSRC, "$DEFAULT_AUDIOSRC",
195   [Default audio source])
196 AC_SUBST(DEFAULT_VIDEOSINK)
197 AC_DEFINE_UNQUOTED(DEFAULT_VIDEOSINK, "$DEFAULT_VIDEOSINK",
198   [Default video sink])
199 AC_SUBST(DEFAULT_VIDEOSRC)
200 AC_DEFINE_UNQUOTED(DEFAULT_VIDEOSRC, "$DEFAULT_VIDEOSRC",
201   [Default video source])
202 AC_SUBST(DEFAULT_VISUALIZER)
203 AC_DEFINE_UNQUOTED(DEFAULT_VISUALIZER, "$DEFAULT_VISUALIZER",
204   [Default visualizer])
205
206 dnl ############################################
207 dnl # Super Duper options for plug-in building #
208 dnl ############################################
209
210 dnl ext plug-ins; plug-ins that have external dependencies
211 GST_CHECK_FEATURE(EXTERNAL, [enable building of plug-ins with external deps],,
212 [HAVE_EXTERNAL=yes],enabled,
213 [
214   AC_MSG_WARN(building external plug-ins)
215   BUILD_EXTERNAL="yes"
216 ],[
217   AC_MSG_WARN(all plug-ins with external dependencies will not be built)
218   BUILD_EXTERNAL="no"
219 ])
220 # make BUILD_EXTERNAL available to Makefile.am
221 AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes")
222
223 dnl ##############################
224 dnl # Do automated configuration #
225 dnl ##############################
226
227 dnl check for gstreamer
228 dnl uninstalled is selected preferentially -- see pkg-config(1)
229 GST_REQ=0.9.0
230 PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ,
231   HAVE_GST="yes", HAVE_GST="no")
232
233 if test "x$HAVE_GST" = "xno"; then
234   AC_MSG_ERROR(no GStreamer found)
235 fi
236
237 GST_TOOLS_DIR=`pkg-config --variable=toolsdir gstreamer-$GST_MAJORMINOR`
238 if test -z $GST_TOOLS_DIR; then
239   AC_MSG_ERROR([no tools dir defined in GStreamer pkg-config file; core upgrade needed.])
240 fi
241 AC_SUBST(GST_TOOLS_DIR)
242
243 dnl check for where core plug-ins got installed
244 dnl this is used for unit tests
245 GST_PLUGINS_DIR=`pkg-config --variable=pluginsdir gstreamer-$GST_MAJORMINOR`
246 if test -z $GST_PLUGINS_DIR; then
247   AC_MSG_ERROR([no plugins dir defined in GStreamer pkg-config file; core upgrade needed.])
248 fi
249 AC_SUBST(GST_PLUGINS_DIR)
250
251 dnl check for gstreamer-dataprotocol; uninstalled is selected preferentially
252 PKG_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-$GST_MAJORMINOR >= $GST_REQ,
253   HAVE_GST_GDP="yes", HAVE_GST_GDP="no")
254
255 if test "x$HAVE_GST_GDP" = "xno"; then
256   AC_MSG_ERROR(no GStreamer Dataprotocol Libs found)
257 fi
258
259 AC_SUBST(GST_GDP_LIBS)
260
261 dnl check for gstreamer-controller; uninstalled is selected preferentially
262 PKG_CHECK_MODULES(GST_CTRL, gstreamer-controller-$GST_MAJORMINOR >= $GST_REQ,
263   HAVE_GST_CTRL="yes", HAVE_GST_CTRL="no")
264
265 if test "x$HAVE_GST_CTRL" = "xno"; then
266   AC_MSG_ERROR(no GStreamer Controller Libs found)
267 fi
268
269 AC_SUBST(GST_CTRL_LIBS)
270
271 PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ,
272   HAVE_GST_BASE="yes", HAVE_GST_BASE="no")
273
274 if test "x$HAVE_GST_BASE" = "xno"; then
275   AC_MSG_ERROR(no libgstbase found)
276 fi
277
278 AC_SUBST(GST_BASE_LIBS)
279
280 PKG_CHECK_MODULES(GST_CHECK, gstreamer-check-$GST_MAJORMINOR >= $GST_REQ,
281   HAVE_GST_CHECK="yes", HAVE_GST_CHECK="no")
282
283
284 dnl Check for additional libraries that we might use:
285 dnl =================================================
286 dnl GTK
287 HAVE_GTK=NO
288 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0, HAVE_GTK_22=yes, HAVE_GTK_22=no)
289 if test "x$HAVE_GTK_22" = "xyes"; then
290   HAVE_GTK=yes
291   GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
292   AC_SUBST(GTK_VERSION)
293   GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
294   AC_SUBST(GTK_BASE_DIR)
295 else
296   PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK_20=yes, HAVE_GTK_20=no)
297 fi
298 if test "x$HAVE_GTK_20" = "xyes"; then
299   HAVE_GTK=yes
300 fi
301 GTK_CFLAGS=$GTK2_CFLAGS
302 GTK_LIBS=$GTK2_LIBS
303 AC_SUBST(GTK_LIBS)
304 AC_SUBST(GTK_CFLAGS)
305 AC_SUBST(HAVE_GTK)
306
307 dnl ===========================================================================
308 dnl ============================= gst plug-ins ================================
309 dnl ===========================================================================
310
311 dnl these are all the gst plug-ins, compilable without additional libs
312 GST_PLUGINS_ALL="\
313         adder \
314         audioconvert \
315         audiorate \
316         audioresample \
317         audiotestsrc \
318         ffmpegcolorspace \
319         playback \
320         sine \
321         subparse \
322         tcp \
323         typefind \
324         videotestsrc \
325         videorate \
326         videoscale \
327         volume \
328         "
329 AC_SUBST(GST_PLUGINS_ALL)
330
331 GST_PLUGINS_SELECTED=""
332
333 AC_ARG_WITH(plugins,
334     AC_HELP_STRING([--with-plugins],[comma-separated list of plug-ins to compile]),
335     [for i in `echo $withval | tr , ' '`; do
336         if echo $GST_PLUGINS_ALL | grep $i > /dev/null
337         then
338             GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED $i"
339         else
340             echo "plug-in $i not recognized, ignoring..."
341         fi
342     done],
343     [GST_PLUGINS_SELECTED=$GST_PLUGINS_ALL])
344
345 AC_SUBST(GST_PLUGINS_SELECTED)
346
347 dnl ==========================================================================
348 dnl ============================= sys plug-ins ================================
349 dnl ==========================================================================
350
351 echo
352 AC_MSG_NOTICE([Checking libraries for plugins in sys/])
353 echo
354
355 dnl Check for X11
356 translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
357 GST_CHECK_FEATURE(X, [X libraries and plugins],
358                   [ximagesink], [
359   AC_PATH_XTRA
360   ac_cflags_save="$CFLAGS"
361   ac_cppflags_save="$CPPFLAGS"
362   CFLAGS="$CFLAGS $X_CFLAGS"
363   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
364
365   dnl now try to find the HEADER
366   AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
367
368   if test "x$HAVE_X" = "xno"
369   then
370     AC_MSG_NOTICE([cannot find X11 development files])
371   else
372     dnl this is much more than we want
373     X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
374     dnl AC_PATH_XTRA only defines the path needed to find the X libs,
375     dnl it does not add the libs; therefore we add them here
376     X_LIBS="$X_LIBS -lX11"
377     AC_SUBST(X_CFLAGS)
378     AC_SUBST(X_LIBS)
379   fi
380   AC_SUBST(HAVE_X)
381   CFLAGS="$ac_cflags_save"
382   CPPFLAGS="$ac_cppflags_save"
383 ])
384   
385 dnl *** XVideo ***
386 dnl Look for the PIC library first, Debian requires it.
387 dnl Check debian-devel archives for gory details.
388 dnl 20020110:
389 dnl At the moment XFree86 doesn't distribute shared libXv due
390 dnl to unstable API.  On many platforms you CAN NOT link a shared
391 dnl lib to a static non-PIC lib.  This is what the xvideo GStreamer
392 dnl plug-in wants to do.  So Debian distributes a PIC compiled
393 dnl version of the static lib for plug-ins to link to when it is
394 dnl inappropriate to link the main application to libXv directly.
395 dnl FIXME: add check if this platform can support linking to a
396 dnl        non-PIC libXv, if not then don not use Xv.
397 dnl FIXME: perhaps warn user if they have a shared libXv since
398 dnl        this is an error until XFree86 starts shipping one
399    
400 dnl Check for Xv extension
401 translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
402 GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
403                   [xvimagesink], [
404   if test x$HAVE_X = xyes; then
405     AC_CHECK_LIB(Xv_pic, XvQueryExtension,
406                  HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
407                  $X_LIBS -lXext)
408
409     if test x$HAVE_XVIDEO = xyes; then
410       XVIDEO_LIBS="-lXv_pic -lXext"
411       AC_SUBST(XVIDEO_LIBS)
412     else
413       dnl try again using something else if we didn't find it first
414       if test x$HAVE_XVIDEO = xno; then
415         AC_CHECK_LIB(Xv, XvQueryExtension,
416                    HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
417                    $X_LIBS -lXext)
418
419         if test x$HAVE_XVIDEO = xyes; then
420           XVIDEO_LIBS="-lXv -lXext"
421           AC_SUBST(XVIDEO_LIBS)
422         fi
423       fi
424     fi
425   fi
426 ])
427
428 dnl check for X Shm
429 translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
430 GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], xshm, [
431   if test x$HAVE_X = xyes; then
432     AC_CHECK_LIB(Xext, XShmAttach, 
433                  HAVE_XSHM="yes", HAVE_XSHM="no",
434                  $X_LIBS) 
435     if test "x$HAVE_XSHM" = "xyes"; then
436       XSHM_LIBS="-lXext"
437     else
438       dnl On AIX, it is in XextSam instead, but we still need -lXext
439       AC_CHECK_LIB(XextSam, XShmAttach, 
440                    HAVE_XSHM="yes", HAVE_XSHM="no",
441                    $X_LIBS) 
442       if test "x$HAVE_XSHM" = "xyes"; then
443         XSHM_LIBS="-lXext -lXextSam"
444       fi
445     fi
446   fi
447 ], , [ 
448   AC_SUBST(HAVE_XSHM) 
449   AC_SUBST(XSHM_LIBS) 
450 ] )
451
452 dnl v4l/v4l2 checks have been moved down because they require X
453
454 dnl *** Video 4 Linux ***
455 dnl for information about the header/define, see sys/v4l/gstv4lelement.h
456 dnl renamed to GST_V4L in accordance with V4L2 below
457 translit(dnm, m, l) AM_CONDITIONAL(USE_GST_V4L, true)
458 GST_CHECK_FEATURE(GST_V4L, [Video 4 Linux], v4lsrc v4lmjpegsrc v4lmjpegsink, [
459   # first check X
460   HAVE_GST_V4L="no"
461   if test "$HAVE_X" = "yes"
462   then
463     AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_GST_V4L="yes", HAVE_GST_V4L="no", [
464 #include <sys/types.h>
465 #define _LINUX_TIME_H
466 #define __user
467 #include <linux/videodev.h>
468     ])
469   fi
470 ])
471
472 dnl Next, check for the optional libraries:
473 dnl These are all libraries used in building plug-ins
474 dnl ================================================
475 dnl let's try and sort them alphabetically, shall we ?
476
477 if test "x$BUILD_EXTERNAL" = "xyes"; then
478
479 echo
480 AC_MSG_NOTICE([Checking libraries for plugins in ext/])
481 echo
482
483 dnl *** alsa ***
484 translit(dnm, m, l) AM_CONDITIONAL(USE_ALSA, true)
485 GST_CHECK_FEATURE(ALSA, [alsa plug-ins], gstalsa, [
486   PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, [
487     HAVE_ALSA="yes"
488     AC_SUBST(ALSA_CFLAGS)
489     AC_SUBST(ALSA_LIBS)
490   ], [
491     AM_PATH_ALSA(0.9.1, HAVE_ALSA="yes", HAVE_ALSA="no")
492   ])
493 ])
494
495 dnl *** CDParanoia ***
496 translit(dnm, m, l) AM_CONDITIONAL(USE_CDPARANOIA, true)
497 GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
498   GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface, 
499                       cdda_open, -lm, 
500                       cdda_interface.h, 
501                       CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
502                       HEADER_DIR="no"
503                       FOUND_CDPARANOIA="yes")
504   if test "x$FOUND_CDPARANOIA" != "xyes";
505   then
506     GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface, 
507                         cdda_open, -lm, 
508                         cdda/cdda_interface.h, 
509                         CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
510                         HEADER_DIR="yes"
511                         FOUND_CDPARANOIA="yes")
512   fi
513   if test "x$HEADER_DIR" = "xyes";
514   then
515     AC_DEFINE_UNQUOTED(CDPARANOIA_HEADERS_IN_DIR, ,
516                        defined if cdda headers are in a cdda/ directory)
517   fi
518   AC_SUBST(CDPARANOIA_LIBS)
519 ])
520 dnl FIXME : add second check somehow if that is necessary
521 dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
522 dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no)
523
524 dnl *** Gnome VFS ***
525 translit(dnm, m, l) AM_CONDITIONAL(USE_GNOME_VFS, true)
526 GST_CHECK_FEATURE(GNOME_VFS, [Gnome VFS], gnomevfssrc, [
527   PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0, HAVE_GNOME_VFS="yes", HAVE_GNOME_VFS="no")
528   AC_SUBST(GNOME_VFS_CFLAGS)
529   AC_SUBST(GNOME_VFS_LIBS)
530 ])
531
532 dnl *** libvisual ***
533 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
534 GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [
535   PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no")
536   AC_SUBST(LIBVISUAL_CFLAGS)
537   AC_SUBST(LIBVISUAL_LIBS)
538 ])
539
540 dnl *** ogg ***
541 translit(dnm, m, l) AM_CONDITIONAL(USE_OGG, true)
542 GST_CHECK_FEATURE(OGG, [ogg de/encoder], oggdemux oggmux, [
543   PKG_CHECK_MODULES(OGG, ogg >= 1.0, [
544     HAVE_OGG="yes"
545     AC_SUBST(OGG_CFLAGS)
546     AC_SUBST(OGG_LIBS)
547   ], [
548     XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
549     AS_SCRUB_INCLUDE(OGG_CFLAGS)
550   ])
551 ])
552
553 dnl *** theora ***
554 translit(dnm, m, l) AM_CONDITIONAL(USE_THEORA, true)
555 GST_CHECK_FEATURE(THEORA, [ogg theora codec], theoradec theoraenc, [
556   PKG_CHECK_MODULES(THEORA, theora, [
557     HAVE_THEORA="yes"
558     AC_SUBST(THEORA_LIBS)
559     AC_SUBST(THEORA_CFLAGS)
560   ], [
561     GST_CHECK_LIBHEADER(THEORA, theora, theora_version_string, "-logg", theora/theora.h, THEORA_LIBS="-ltheora -logg")
562     AC_SUBST(THEORA_LIBS)
563   ])
564 ])
565
566 dnl *** vorbis ***
567 dnl AM_PATH_VORBIS only takes two options
568 translit(dnm, m, l) AM_CONDITIONAL(USE_VORBIS, true)
569 GST_CHECK_FEATURE(VORBIS, [vorbis plug-in], vorbisenc vorbisdec, [
570   PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0 vorbisenc >= 1.0, [
571     HAVE_VORBIS="yes"
572   ], [
573     XIPH_PATH_VORBIS(HAVE_VORBIS="yes", HAVE_VORBIS="no")
574     AS_SCRUB_INCLUDE(VORBIS_CFLAGS)
575   ])
576 ])
577 if test "x$HAVE_VORBIS" = "xyes"; then
578   ac_cflags_save="$CFLAGS"
579   dnl FIXME: does this work on non-gcc? -- Company
580   dnl FIXME: no, it doesn't.  Why is this here in the first place ? -- thomasvs
581   CFLAGS="-Wall -Werror"
582   AC_COMPILE_IFELSE(
583     AC_LANG_PROGRAM([
584 #include <vorbis/codec.h>
585                      ],[
586 vorbis_dsp_state *v;
587
588 vorbis_synthesis_restart (v);
589                      ]), HAVE_VSR=yes, HAVE_VSR=no)
590   if test "x$HAVE_VSR" = "xyes"; then
591     AC_DEFINE_UNQUOTED(HAVE_VORBIS_SYNTHESIS_RESTART, 1,
592                        [defined if vorbis_synthesis_restart is present])
593   fi
594   CFLAGS="$ac_cflags_save"
595 fi
596
597 fi dnl of EXT plugins
598
599 dnl check for "check", unit testing library/header
600 AM_PATH_CHECK(0.9.2, HAVE_CHECK=yes, HAVE_CHECK=no)
601 AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
602
603 dnl ######################################################################
604 dnl # Check command line parameters, and set shell variables accordingly #
605 dnl ######################################################################
606
607 dnl seeking needs freetype, so check for it here
608 PKG_CHECK_MODULES(FT2, freetype2 >= 2.0.9, HAVE_FT2="yes", [
609   AC_CHECK_FT2(2.0.9, HAVE_FT2="yes", HAVE_FT2="no")
610 ])
611 dnl make the HAVE_FT2 variable available to automake and Makefile.am
612 AM_CONDITIONAL(HAVE_FT2, test "x$HAVE_FT2" = "xyes")
613 AC_SUBST(FT2_CFLAGS)
614 AC_SUBST(FT2_LIBS)
615
616 dnl #############################
617 dnl # Set automake conditionals #
618 dnl #############################
619
620 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
621 dnl HAVE_ and it is likely to be easier to stick with the old name
622 AM_CONDITIONAL(HAVE_GTK,            test "x$HAVE_GTK" = "xyes")
623 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
624 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
625
626 dnl *** finalize CFLAGS, LDFLAGS, LIBS
627
628 dnl Overview:
629 dnl GST_OPTION_CFLAGS:  common flags for profiling, debugging, errors, ...
630 dnl GST_*:              flags shared by all built objects
631 dnl GST_LT_LDFLAGS:     library versioning of our libraries
632 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
633
634 dnl GST_OPTION_CFLAGS
635 if test "x$USE_DEBUG" = xyes; then
636    PROFILE_CFLAGS="-g"
637 fi
638 AC_SUBST(PROFILE_CFLAGS)
639
640 DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
641 AC_SUBST(DEPRECATED_CFLAGS)
642
643 dnl every flag in GST_OPTION_CFLAGS can be overridden at make time
644 GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
645 AC_SUBST(GST_OPTION_CFLAGS)
646
647 dnl our libraries need to be versioned correctly
648 AC_SUBST(GST_LT_LDFLAGS)
649
650 dnl FIXME: do we want to rename to GST_ALL_* ?
651 dnl prefer internal headers to already installed ones
652 dnl also add builddir include for enumtypes and marshal
653 dnl add ERROR_CFLAGS, but overridable
654 GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS \$(GST_OPTION_CFLAGS)"
655 AC_SUBST(GST_CFLAGS)
656 AC_SUBST(GST_LIBS)
657
658 dnl this really should only contain flags, not libs - they get added before
659 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
660 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' -no-undefined"
661 AC_SUBST(GST_PLUGIN_LDFLAGS)
662
663 dnl *** output files ***
664
665 AC_CONFIG_FILES(
666 Makefile
667 gst-plugins-base.spec
668 gst/Makefile
669 gst/adder/Makefile
670 gst/audioconvert/Makefile
671 gst/audiorate/Makefile
672 gst/audioresample/Makefile
673 gst/audiotestsrc/Makefile
674 gst/ffmpegcolorspace/Makefile
675 gst/playback/Makefile
676 gst/sine/Makefile
677 gst/subparse/Makefile
678 gst/tcp/Makefile
679 gst/typefind/Makefile
680 gst/videotestsrc/Makefile
681 gst/videorate/Makefile
682 gst/videoscale/Makefile
683 gst/volume/Makefile
684 sys/Makefile
685 sys/ximage/Makefile
686 sys/xvimage/Makefile
687 sys/v4l/Makefile
688 ext/Makefile
689 ext/alsa/Makefile
690 ext/cdparanoia/Makefile
691 ext/gnomevfs/Makefile
692 ext/libvisual/Makefile
693 ext/ogg/Makefile
694 ext/theora/Makefile
695 ext/vorbis/Makefile
696 gst-libs/Makefile
697 gst-libs/gst/Makefile
698 gst-libs/gst/audio/Makefile
699 gst-libs/gst/floatcast/Makefile
700 gst-libs/gst/interfaces/Makefile
701 gst-libs/gst/net/Makefile
702 gst-libs/gst/riff/Makefile
703 gst-libs/gst/rtp/Makefile
704 gst-libs/gst/tag/Makefile
705 gst-libs/gst/video/Makefile
706 gst-libs/ext/Makefile
707 examples/seeking/Makefile
708 examples/Makefile
709 tools/Makefile
710 pkgconfig/Makefile
711 pkgconfig/gstreamer-plugins-base.pc
712 pkgconfig/gstreamer-plugins-base-uninstalled.pc
713 check/Makefile
714 docs/Makefile
715 docs/libs/Makefile
716 docs/plugins/Makefile
717 docs/version.entities
718 po/Makefile.in
719 common/Makefile
720 common/m4/Makefile
721 m4/Makefile
722 )
723 AC_OUTPUT
724
725 echo "configure: *** Core plug-ins, always built:"
726 ( for i in $GST_PLUGINS_ALL; do echo -e '\t'$i; done ) | sort
727 echo
728 echo -n "configure: *** Plug-ins relying on libraries that will be built:"
729 echo -e "$GST_PLUGINS_YES" | sort
730 echo
731 echo -n "configure: *** Plug-ins relying on libraries that will NOT be built:"
732 echo -e "$GST_PLUGINS_NO" | sort
733 echo
734 if test "x$BUILD_EXTERNAL" = "xno"; then
735   echo "configure: *** No external plug-ins will be built"
736 fi