0cf63a2752610daef9e8cc7f013d03613efbea02
[platform/upstream/gstreamer.git] / configure.ac
1 dnl autoconf configuration file for gst-plugins 
2 AC_INIT
3 AC_CANONICAL_TARGET
4
5 dnl We disable static building for development, for time savings
6 dnl this goes before AS_LIBTOOL to appease autoconf
7 dnl *NOTE*: dnl this line before release, so release does static too
8 AM_DISABLE_STATIC
9
10 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
11 AM_MAINTAINER_MODE
12
13 dnl when going to/from release please set the nano (fourth number) right !
14 dnl releases only do Wall, cvs and prerelease does Werror too
15 AS_VERSION(gst-plugins-base, GST_PLUGINS_VERSION, 0, 9, 1, 1, GST_CVS="no", GST_CVS="yes")
16
17 AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
18
19 dnl our libraries and install dirs use major.minor as a version
20 GST_MAJORMINOR=$GST_PLUGINS_VERSION_MAJOR.$GST_PLUGINS_VERSION_MINOR
21 dnl we override it here if we need to for the release candidate of new series
22 GST_MAJORMINOR=0.9
23 AC_SUBST(GST_MAJORMINOR)
24
25 dnl CURRENT, REVISION, AGE
26 dnl - library source changed -> increment REVISION
27 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
28 dnl - interfaces added -> increment AGE
29 dnl - interfaces removed -> AGE = 0
30 dnl for 0.8.3 release, gst_play_get_all_by_interface was added, so update
31 AS_LIBTOOL(GST_PLUGINS, 1, 0, 1)
32 AS_LIBTOOL_TAGS([])
33 AM_PROG_LIBTOOL
34
35 dnl FIXME take something else ?
36 AC_CONFIG_SRCDIR([gst/sine/gstsinesrc.c])
37 AM_CONFIG_HEADER(config.h)
38
39 dnl Add parameters for aclocal
40 dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
41 ACLOCAL_FLAGS="-I m4 -I common/m4"
42 AC_SUBST(ACLOCAL_AMFLAGS, $ACLOCAL_FLAGS)
43
44 AC_PROG_CC
45 AM_PROG_CC_STDC
46 AM_PROG_AS
47 AS="${CC}"
48 AS_PROG_OBJC
49
50 dnl the gettext stuff needed
51 AM_GNU_GETTEXT_VERSION(0.11.5)
52 AM_GNU_GETTEXT([external])
53                                                                                 
54 GETTEXT_PACKAGE=gst-plugins-base-$GST_MAJORMINOR
55 AC_SUBST(GETTEXT_PACKAGE)
56 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE",
57                    [gettext package name])
58                                                                                 
59 dnl define LOCALEDIR in config.h
60 AS_AC_EXPAND(LOCALEDIR, $datadir/locale)
61 AC_DEFINE_UNQUOTED([LOCALEDIR], "$LOCALEDIR",
62                    [gettext locale dir])
63
64 GST_SET_ERROR_CFLAGS($GST_CVS)
65
66 dnl determine c++ compiler
67 AC_PROG_CXX
68 dnl determine if c++ is available on this system
69 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
70 dnl determine c++ preprocessor
71 AC_PROG_CXXCPP
72 AC_ISC_POSIX
73
74 AC_HEADER_STDC([])
75 AC_C_INLINE
76 AX_CREATE_STDINT_H
77
78 dnl Check for malloc.h
79 AC_CHECK_HEADER(malloc.h,[
80   AC_DEFINE(HAVE_MALLOC_H, 1, [whether malloc.h available])
81 ])
82
83 dnl Check for a way to display the function name in debug output
84 GST_CHECK_FUNCTION()
85
86 dnl define correct errorlevel for debugging messages. We want to have GST_ERROR
87 dnl messages printed when running cvs builds
88 if test "x$GST_CVS" = "xyes"; then
89   AC_DEFINE(GST_LEVEL_DEFAULT, GST_LEVEL_ERROR, [Default errorlevel to use])
90 fi
91
92 dnl Check for FIONREAD ioctl declaration :
93 GST_CHECK_FIONREAD()
94
95 DEFAULT_AUDIOSINK="alsasink"
96 DEFAULT_VIDEOSINK="xvimagesink"
97 DEFAULT_AUDIOSRC="alsasrc"
98 DEFAULT_VIDEOSRC="v4lsrc"
99 DEFAULT_VISUALIZER="goom"
100 case "$host" in 
101   *-sun-* | *pc-solaris* )
102     DEFAULT_AUDIOSINK="sunaudiosink"
103     DEFAULT_VIDEOSINK="ximagesink"
104     DEFAULT_AUDIOSRC="sunaudiosrc"
105     ;;
106   *-darwin* )
107     DEFAULT_AUDIOSINK="osxaudiosink"
108     DEFAULT_AUDIOSRC="osxaudiosrc"
109     DEFAULT_VIDEOSINK="osxvideosink"
110     ;;
111 esac
112
113 AC_SUBST(DEFAULT_AUDIOSINK)
114 AC_DEFINE_UNQUOTED(DEFAULT_AUDIOSINK,"$DEFAULT_AUDIOSINK",[Default audio sink])
115 AC_SUBST(DEFAULT_AUDIOSRC)
116 AC_DEFINE_UNQUOTED(DEFAULT_AUDIOSRC,"$DEFAULT_AUDIOSRC",[Default audio source])
117 AC_SUBST(DEFAULT_VIDEOSINK)
118 AC_DEFINE_UNQUOTED(DEFAULT_VIDEOSINK,"$DEFAULT_VIDEOSINK",[Default video sink])
119 AC_SUBST(DEFAULT_VIDEOSRC)
120 AC_DEFINE_UNQUOTED(DEFAULT_VIDEOSRC,"$DEFAULT_VIDEOSRC",[Default video source])
121 AC_SUBST(DEFAULT_VISUALIZER)
122 AC_DEFINE_UNQUOTED(DEFAULT_VISUALIZER,"$DEFAULT_VISUALIZER",[Default visualizer])
123
124 dnl ############################################
125 dnl # Super Duper options for plug-in building #
126 dnl ############################################
127
128 dnl ext plug-ins; plug-ins that have external dependencies
129 GST_CHECK_FEATURE(EXTERNAL, [enable building of plug-ins with external deps],,
130 [HAVE_EXTERNAL=yes],enabled,
131 [
132   AC_MSG_WARN(building external plug-ins)
133   BUILD_EXTERNAL="yes"
134 ],[
135   AC_MSG_WARN(all plug-ins with external dependencies will not be built)
136   BUILD_EXTERNAL="no"
137 ])
138 # make BUILD_EXTERNAL available to Makefile.am
139 AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes")
140
141 dnl experimental plug-ins; stuff that hasn't had the dust settle yet
142 dnl read 'builds, but might not work'UTO
143 GST_CHECK_FEATURE(EXPERIMENTAL, [enable building of experimental plug-ins],,
144 [HAVE_EXPERIMENTAL=yes],disabled,
145 [
146   AC_MSG_WARN(building experimental plug-ins)
147   USE_TARKIN="yes"
148 ],[
149   AC_MSG_NOTICE(not building experimental plug-ins)
150   USE_TARKIN="no"
151 ])
152
153 dnl broken plug-ins; stuff that doesn't seem to build at the moment
154 GST_CHECK_FEATURE(BROKEN, [enable building of broken plug-ins],,
155 HAVE_BROKEN=yes,disabled,
156 [  
157   AC_MSG_WARN([building broken plug-ins -- no bug reports on these, only patches :)])
158 ],[
159   AC_MSG_NOTICE([not building broken plug-ins])
160 ])
161
162 dnl ##############################
163 dnl # Do automated configuration #
164 dnl ##############################
165
166 dnl Check for tools:
167 dnl ================
168
169 dnl allow for different autotools
170 AS_AUTOTOOLS_ALTERNATE()
171
172 dnl modify pkg-config path
173 AC_ARG_WITH(pkg-config-path, 
174    AC_HELP_STRING([--with-pkg-config-path],[colon-separated list of pkg-config(1) dirs]),
175    [export PKG_CONFIG_PATH=${withval}])
176
177 GST_DOC()
178 dnl check architecture
179 GST_ARCH()
180
181 dnl check for gconftool-2
182
183 dnl this macro defines an am conditional, so it needs to be run always
184 AM_GCONF_SOURCE_2
185
186 translit(dnm, m, l) AM_CONDITIONAL(USE_GCONFTOOL, true)
187 GST_CHECK_FEATURE(GCONFTOOL, [GConf schemas], , [
188   AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
189   if test x$GCONFTOOL = xno; then
190     AC_MSG_WARN(Not installing GConf schemas)
191     HAVE_GCONFTOOL="no"
192   else
193     HAVE_GCONFTOOL="yes"
194   fi
195   AC_SUBST(HAVE_GCONFTOOL)
196 ])
197
198 dnl check for GConf libraries
199 translit(dnm, m, l) AM_CONDITIONAL(USE_GCONF, true)
200 GST_CHECK_FEATURE(GCONF, [GConf libraries], , [
201   PKG_CHECK_MODULES(GCONF, gconf-2.0, HAVE_GCONF="yes", HAVE_GCONF="no")
202   AC_SUBST(GCONF_CFLAGS)
203   AC_SUBST(GCONF_LIBS)
204 ])
205
206 dnl check for gstreamer
207 dnl uninstalled is selected preferentially -- see pkg-config(1)
208 GST_REQ=0.9.0
209 PKG_CHECK_MODULES(GST, gstreamer-$GST_MAJORMINOR >= $GST_REQ,
210   HAVE_GST="yes", HAVE_GST="no")
211
212 if test "x$HAVE_GST" = "xno"; then
213   AC_MSG_ERROR(no GStreamer found)
214 fi
215
216 GST_TOOLS_DIR=`pkg-config --variable=toolsdir gstreamer-$GST_MAJORMINOR`
217 if test -z $GST_TOOLS_DIR; then
218   AC_MSG_ERROR([no tools dir defined in GStreamer pkg-config file; core upgrade needed.])
219 fi
220 AC_SUBST(GST_TOOLS_DIR)
221
222 dnl check for gstreamer-dataprotocol; uninstalled is selected preferentially
223 PKG_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-$GST_MAJORMINOR >= $GST_REQ,
224   HAVE_GST_GDP="yes", HAVE_GST_GDP="no")
225
226 if test "x$HAVE_GST_GDP" = "xno"; then
227   AC_MSG_ERROR(no GStreamer Dataprotocol Libs found)
228 fi
229
230 AC_SUBST(GST_GDP_LIBS)
231
232 PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQ,
233   HAVE_GST_BASE="yes", HAVE_GST_BASE="no")
234
235 if test "x$HAVE_GST_BASE" = "xno"; then
236   AC_MSG_ERROR(no libgstbase found)
237 fi
238
239 AC_SUBST(GST_BASE_LIBS)
240
241 PKG_CHECK_MODULES(GST_CHECK, gstreamer-check-$GST_MAJORMINOR >= $GST_REQ,
242   HAVE_GST_CHECK="yes", HAVE_GST_CHECK="no")
243
244 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
245 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
246
247 dnl Determine endianness
248 AC_C_BIGENDIAN
249
250 dnl Check for fast float to int casting as defined in C99
251 AC_C99_FUNC_LRINT()
252 AC_C99_FUNC_LRINTF()
253
254 dnl Check for essential libraries first:
255 dnl ====================================
256
257 GST_GLIB2_CHECK()
258
259 dnl Check for additional libraries that we might use:
260 dnl =================================================
261 dnl GTK
262 HAVE_GTK=NO
263 PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.2.0, HAVE_GTK_22=yes, HAVE_GTK_22=no)
264 if test "x$HAVE_GTK_22" = "xyes"; then
265   HAVE_GTK=yes
266   GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
267   AC_SUBST(GTK_VERSION)
268   GTK_PREFIX=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
269   GDK_PIXBUF_LIBDIR=`$PKG_CONFIG --variable=libdir gdk-pixbuf-2.0`
270   GDK_PIXBUF_PREFIXDIR=`$PKG_CONFIG --variable=prefix gdk-pixbuf-2.0`
271   AC_SUBST(GTK_BASE_DIR)
272 else
273   PKG_CHECK_MODULES(GTK2, gtk+-2.0, HAVE_GTK_20=yes, HAVE_GTK_20=no)
274 fi
275 if test "x$HAVE_GTK_20" = "xyes"; then
276   HAVE_GTK=yes
277 fi
278 GTK_CFLAGS=$GTK2_CFLAGS
279 GTK_LIBS=$GTK2_LIBS
280 AC_SUBST(GTK_LIBS)
281 AC_SUBST(GTK_CFLAGS)
282 AC_SUBST(HAVE_GTK)
283
284 # gdk_pixbuf gstreamer loader is considered experimental, so disable
285 # by default
286 if test "x$HAVE_GTK_22" = "xyes"; then
287   HAVE_GDK_LOADERS=yes
288 else
289   HAVE_GDK_LOADERS=no
290 fi
291
292 # we set the defaults always to make sure we have non-empty variables
293 # for the Makefile
294
295 # by default, stick to prefix
296 GDK_PIXBUF_LOADER_DIR=${libdir}/gtk-2.0/\${GTK_VERSION}/loaders
297 GDK_PIXBUF_CONF_DIR=${sysconfdir}/gtk-2.0
298
299
300 AC_ARG_ENABLE(gdk-pixbuf-loader,
301   AC_HELP_STRING([--enable-gdk-pixbuf-loader],
302               [whether to enable building of gdk_pixbuf loader]),
303               :, HAVE_GDK_LOADERS="no")
304
305 if test "x$HAVE_GDK_LOADERS" = "xyes"; then
306   AC_PATH_PROG(QUERYLOADERS, gdk-pixbuf-query-loaders, no)
307   # allow customization of pixbuf loader install location
308   # when nothing specified, adhere to prefix settings
309   # when called without any option with this argument, autodetect
310   # when called with a path, set to the given path
311
312   AC_ARG_WITH(gdk-pixbuf-loader-dir, 
313      AC_HELP_STRING([--with-gdk-pixbuf-loader-dir],
314         [directory to install the gdk_pixbuf loader (none for pkg-config default)]),
315      [
316       if test "x${withval}" != xyes ; then
317         GDK_PIXBUF_LOADER_DIR="${withval}"
318       else
319         GDK_PIXBUF_LOADER_DIR="$GDK_PIXBUF_LIBDIR/gtk-2.0/\$GTK_VERSION/loaders"
320       fi
321      ]
322   )
323   AS_AC_EXPAND(GDK_PIXBUF_LOADER_DIR, $GDK_PIXBUF_LOADER_DIR)
324   AC_SUBST(GDK_PIXBUF_LOADER_DIR)
325   AC_MSG_NOTICE([Putting GTK+-2 pixbuf loaders in $GDK_PIXBUF_LOADER_DIR])
326   
327   # allow customization of pixbuf loader configuration file
328   # when nothing specified, adhere to prefix settings
329   # when called without any option with this argument, autodetect
330   # when called with a path, set to the given path
331
332   AC_ARG_WITH(gdk-pixbuf-conf-dir, 
333      AC_HELP_STRING([--with-gdk-pixbuf-conf-dir],
334         [directory to install the gdk_pixbuf config (none for pkg-config default)]),
335      [
336       if test "x${withval}" != xyes ; then
337         GDK_PIXBUF_CONF_DIR="${withval}"
338       else
339         GDK_PIXBUF_CONF_DIR="$GDK_PIXBUF_PREFIXDIR/etc/gtk-2.0/"
340       fi
341      ]
342   )
343   AS_AC_EXPAND(GDK_PIXBUF_CONF_DIR, $GDK_PIXBUF_CONF_DIR)
344   AC_SUBST(GDK_PIXBUF_CONF_DIR)
345   AC_MSG_NOTICE([Putting GTK+-2 pixbuf loader config in $GDK_PIXBUF_CONF_DIR])
346 fi
347 AM_CONDITIONAL(HAVE_GDK_LOADERS, test "x$HAVE_GDK_LOADERS" = "xyes")
348
349 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= 0.3.2, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
350 AC_SUBST(LIBOIL_CFLAGS)
351 AC_SUBST(LIBOIL_LIBS)
352 if test "x${HAVE_LIBOIL}" != xyes ; then
353   AC_ERROR([liboil-0.3 is required])
354 fi
355
356 dnl ===========================================================================
357 dnl ============================= gst plug-ins ================================
358 dnl ===========================================================================
359
360 plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
361 AC_SUBST(plugindir)
362
363 dnl this really should only contain flags, not libs - they get added before
364 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
365 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '[_]*(gst_|Gst|GST_).*'"
366 AC_SUBST(GST_PLUGIN_LDFLAGS)
367
368 dnl these are all the gst plug-ins, compilable without additional libs
369 GST_PLUGINS_ALL="\
370         adder \
371         audioconvert \
372         audioscale \
373         audiorate \
374         ffmpegcolorspace \
375         playback \
376         sine \
377         subparse \
378         tcp \
379         typefind \
380         videotestsrc \
381         videorate \
382         videoscale \
383         volume \
384         "
385
386 dnl see if we can build C++ plug-ins
387 if test "x$HAVE_CXX" = "xyes"; then
388   GST_PLUGINS_ALL="$GST_PLUGINS_ALL"
389 else
390   AC_MSG_WARN([Not compiling plug-ins requiring C++ compiler])
391 fi
392
393 AC_SUBST(GST_PLUGINS_ALL)
394
395 GST_PLUGINS_SELECTED=""
396
397 AC_ARG_WITH(plugins,
398     AC_HELP_STRING([--with-plugins],[comma-separated list of plug-ins to compile]),
399     [for i in `echo $withval | tr , ' '`; do
400         if echo $GST_PLUGINS_ALL | grep $i > /dev/null
401         then
402             GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED $i"
403         else
404             echo "plug-in $i not recognized, ignoring..."
405         fi
406     done],
407     [GST_PLUGINS_SELECTED=$GST_PLUGINS_ALL])
408
409 AC_SUBST(GST_PLUGINS_SELECTED)
410
411 dnl ==========================================================================
412 dnl ============================= sys plug-ins ================================
413 dnl ==========================================================================
414
415 echo
416 AC_MSG_NOTICE([Checking libraries for plugins in sys/])
417 echo
418
419 dnl Check for X11
420 translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
421 GST_CHECK_FEATURE(X, [X libraries and plugins],
422                   [ximagesink], [
423   AC_PATH_XTRA
424   ac_cflags_save="$CFLAGS"
425   ac_cppflags_save="$CPPFLAGS"
426   CFLAGS="$CFLAGS $X_CFLAGS"
427   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
428
429   dnl now try to find the HEADER
430   AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
431
432   if test "x$HAVE_X" = "xno"
433   then
434     AC_MSG_NOTICE([cannot find X11 development files])
435   else
436     dnl this is much more than we want
437     X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
438     dnl AC_PATH_XTRA only defines the path needed to find the X libs,
439     dnl it does not add the libs; therefore we add them here
440     X_LIBS="$X_LIBS -lX11"
441     AC_SUBST(X_CFLAGS)
442     AC_SUBST(X_LIBS)
443   fi
444   AC_SUBST(HAVE_X)
445   CFLAGS="$ac_cflags_save"
446   CPPFLAGS="$ac_cppflags_save"
447 ])
448   
449 dnl *** XVideo ***
450 dnl Look for the PIC library first, Debian requires it.
451 dnl Check debian-devel archives for gory details.
452 dnl 20020110:
453 dnl At the moment XFree86 doesn't distribute shared libXv due
454 dnl to unstable API.  On many platforms you CAN NOT link a shared
455 dnl lib to a static non-PIC lib.  This is what the xvideo GStreamer
456 dnl plug-in wants to do.  So Debian distributes a PIC compiled
457 dnl version of the static lib for plug-ins to link to when it is
458 dnl inappropriate to link the main application to libXv directly.
459 dnl FIXME: add check if this platform can support linking to a
460 dnl        non-PIC libXv, if not then don not use Xv.
461 dnl FIXME: perhaps warn user if they have a shared libXv since
462 dnl        this is an error until XFree86 starts shipping one
463    
464 dnl Check for Xv extension
465 translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
466 GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
467                   [xvimagesink], [
468   if test x$HAVE_X = xyes; then
469     AC_CHECK_LIB(Xv_pic, XvQueryExtension,
470                  HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
471                  $X_LIBS -lXext)
472
473     if test x$HAVE_XVIDEO = xyes; then
474       XVIDEO_LIBS="-lXv_pic -lXext"
475       AC_SUBST(XVIDEO_LIBS)
476     else
477       dnl try again using something else if we didn't find it first
478       if test x$HAVE_XVIDEO = xno; then
479         AC_CHECK_LIB(Xv, XvQueryExtension,
480                    HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
481                    $X_LIBS -lXext)
482
483         if test x$HAVE_XVIDEO = xyes; then
484           XVIDEO_LIBS="-lXv -lXext"
485           AC_SUBST(XVIDEO_LIBS)
486         fi
487       fi
488     fi
489   fi
490 ])
491
492 dnl check for X Shm
493 translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
494 GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], xshm, [
495   if test x$HAVE_X = xyes; then
496     AC_CHECK_LIB(Xext, XShmAttach, 
497                  HAVE_XSHM="yes", HAVE_XSHM="no",
498                  $X_LIBS) 
499     if test "x$HAVE_XSHM" = "xyes"; then
500       XSHM_LIBS="-lXext"
501     else
502       dnl On AIX, it is in XextSam instead, but we still need -lXext
503       AC_CHECK_LIB(XextSam, XShmAttach, 
504                    HAVE_XSHM="yes", HAVE_XSHM="no",
505                    $X_LIBS) 
506       if test "x$HAVE_XSHM" = "xyes"; then
507         XSHM_LIBS="-lXext -lXextSam"
508       fi
509     fi
510   fi
511 ], , [ 
512   AC_SUBST(HAVE_XSHM) 
513   AC_SUBST(XSHM_LIBS) 
514 ] )
515
516 dnl v4l/v4l2 checks have been moved down because they require X
517
518 dnl *** Video 4 Linux ***
519 dnl for information about the header/define, see sys/v4l/gstv4lelement.h
520 dnl renamed to GST_V4L in accordance with V4L2 below
521 translit(dnm, m, l) AM_CONDITIONAL(USE_GST_V4L, true)
522 GST_CHECK_FEATURE(GST_V4L, [Video 4 Linux], v4lsrc v4lmjpegsrc v4lmjpegsink, [
523   # first check X
524   HAVE_GST_V4L="no"
525   if test "$HAVE_X" = "yes"
526   then
527     AC_CHECK_DECL(VID_TYPE_MPEG_ENCODER, HAVE_GST_V4L="yes", HAVE_GST_V4L="no", [
528 #include <sys/types.h>
529 #define _LINUX_TIME_H
530 #define __user
531 #include <linux/videodev.h>
532     ])
533   fi
534 ])
535
536 dnl *** Video 4 Linux 2 ***
537 dnl for information about the header/define, see sys/v4l2/gstv4l2element.h
538 dnl renamed to GST_V4L2 because of some conflict with kernel headers
539 translit(dnm, m, l) AM_CONDITIONAL(USE_GST_V4L2, true)
540 GST_CHECK_FEATURE(GST_V4L2, [Video 4 Linux 2], v4l2src, [
541   HAVE_GST_V4L2="no"
542   if test "$HAVE_X" = "yes"
543   then
544     AC_MSG_CHECKING([Checking for uptodate v4l2 installation])
545     AC_TRY_COMPILE([
546 #include <sys/types.h>
547 #include <linux/types.h>
548 #define _LINUX_TIME_H
549 #define __user
550 #include <linux/videodev2.h>
551 #if defined(V4L2_MAJOR_VERSION) || defined(V4L2_MINOR_VERSION)
552 #error too early v4l2 version or no v4l2 at all
553 #endif
554     ], [
555 return 0;
556     ], [ HAVE_GST_V4L2="yes" && AC_MSG_RESULT(yes)],
557        [ HAVE_GST_V4L2="no"  && AC_MSG_RESULT(no) &&
558          AC_CHECK_HEADER(linux/videodev2.h,
559                          [ AC_MSG_WARN([video4linux2 headers were found, but they're old. Please update v4l2 to compile the v4l2 plugins])],
560                          [ AC_MSG_WARN([video4linux2 was not found])])
561        ])
562   fi
563   dnl check for missing v4l2_buffer declaration (see #135919)
564   if [ test x$HAVE_GST_V4L2 = xyes ]; then
565     MISSING_DECL=0
566     AC_MSG_CHECKING(struct v4l2_buffer declaration)
567     AC_TRY_COMPILE([
568 #include <sys/types.h>
569 #include <linux/types.h>
570 #define _LINUX_TIME_H
571 #define __user
572 #include <linux/videodev2.h>
573     ],[
574 struct v4l2_buffer buf;
575 buf.index = 0;
576 return 0;
577     ], [ AC_MSG_RESULT(yes) ], [ MISSING_DECL=1 && AC_MSG_RESULT(no) ])
578     if [ test x$MISSING_DECL = x1 ]; then
579       AC_DEFINE(GST_V4L2_MISSING_BUFDECL, 1, [struct v4l2_buffer missing])
580     fi
581   fi
582 ])
583
584 dnl Next, check for the optional libraries:
585 dnl These are all libraries used in building plug-ins
586 dnl ================================================
587 dnl let's try and sort them alphabetically, shall we ?
588
589 if test "x$BUILD_EXTERNAL" = "xyes"; then
590
591 echo
592 AC_MSG_NOTICE([Checking libraries for plugins in ext/])
593 echo
594
595 dnl *** alsa ***
596 translit(dnm, m, l) AM_CONDITIONAL(USE_ALSA, true)
597 GST_CHECK_FEATURE(ALSA, [alsa plug-ins], gstalsa, [
598   PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, [
599     HAVE_ALSA="yes"
600     AC_SUBST(ALSA_CFLAGS)
601     AC_SUBST(ALSA_LIBS)
602   ], [
603     AM_PATH_ALSA(0.9.1, HAVE_ALSA="yes", HAVE_ALSA="no")
604   ])
605 ])
606
607 dnl *** CDParanoia ***
608 translit(dnm, m, l) AM_CONDITIONAL(USE_CDPARANOIA, true)
609 GST_CHECK_FEATURE(CDPARANOIA, [CDParanoia], cdparanoia, [
610   GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface, 
611                       cdda_open, -lm, 
612                       cdda_interface.h, 
613                       CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
614                       HEADER_DIR="no"
615                       FOUND_CDPARANOIA="yes")
616   if test "x$FOUND_CDPARANOIA" != "xyes";
617   then
618     GST_CHECK_LIBHEADER(CDPARANOIA, cdda_interface, 
619                         cdda_open, -lm, 
620                         cdda/cdda_interface.h, 
621                         CDPARANOIA_LIBS="-lcdda_interface -lcdda_paranoia"
622                         HEADER_DIR="yes"
623                         FOUND_CDPARANOIA="yes")
624   fi
625   if test "x$HEADER_DIR" = "xyes";
626   then
627     AC_DEFINE_UNQUOTED(CDPARANOIA_HEADERS_IN_DIR, ,
628                        defined if cdda headers are in a cdda/ directory)
629   fi
630   AC_SUBST(CDPARANOIA_LIBS)
631 ])
632 dnl FIXME : add second check somehow if that is necessary
633 dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface )
634 dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no)
635
636 dnl *** Gnome VFS ***
637 translit(dnm, m, l) AM_CONDITIONAL(USE_GNOME_VFS, true)
638 GST_CHECK_FEATURE(GNOME_VFS, [Gnome VFS], gnomevfssrc, [
639   PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0, HAVE_GNOME_VFS="yes", HAVE_GNOME_VFS="no")
640   AC_SUBST(GNOME_VFS_CFLAGS)
641   AC_SUBST(GNOME_VFS_LIBS)
642 ])
643
644 dnl *** libvisual ***
645 USE_LIBVISUAL=no
646 translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
647 GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [
648   PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no")
649   AC_SUBST(LIBVISUAL_CFLAGS)
650   AC_SUBST(LIBVISUAL_LIBS)
651 ])
652
653 dnl *** ogg ***
654 translit(dnm, m, l) AM_CONDITIONAL(USE_OGG, true)
655 GST_CHECK_FEATURE(OGG, [ogg de/encoder], oggdemux oggmux, [
656   PKG_CHECK_MODULES(OGG, ogg >= 1.0, [
657     HAVE_OGG="yes"
658     AC_SUBST(OGG_CFLAGS)
659     AC_SUBST(OGG_LIBS)
660   ], [
661     XIPH_PATH_OGG(HAVE_OGG="yes", HAVE_OGG="no")
662     AS_SCRUB_INCLUDE(OGG_CFLAGS)
663   ])
664 ])
665
666 dnl *** theora ***
667 translit(dnm, m, l) AM_CONDITIONAL(USE_THEORA, true)
668 GST_CHECK_FEATURE(THEORA, [ogg theora codec], theoradec theoraenc, [
669   PKG_CHECK_MODULES(THEORA, theora, [
670     HAVE_THEORA="yes"
671     AC_SUBST(THEORA_LIBS)
672     AC_SUBST(THEORA_CFLAGS)
673   ], [
674     GST_CHECK_LIBHEADER(THEORA, theora, theora_version_string, "-logg", theora/theora.h, THEORA_LIBS="-ltheora -logg")
675     AC_SUBST(THEORA_LIBS)
676   ])
677 ])
678
679 dnl *** vorbis ***
680 dnl AM_PATH_VORBIS only takes two options
681 translit(dnm, m, l) AM_CONDITIONAL(USE_VORBIS, true)
682 GST_CHECK_FEATURE(VORBIS, [vorbis plug-in], vorbisenc vorbisdec, [
683   PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0 vorbisenc >= 1.0, [
684     HAVE_VORBIS="yes"
685   ], [
686     XIPH_PATH_VORBIS(HAVE_VORBIS="yes", HAVE_VORBIS="no")
687     AS_SCRUB_INCLUDE(VORBIS_CFLAGS)
688   ])
689 ])
690 if test "x$HAVE_VORBIS" = "xyes"; then
691   ac_cflags_save="$CFLAGS"
692   dnl FIXME: does this work on non-gcc? -- Company
693   dnl FIXME: no, it doesn't.  Why is this here in the first place ? -- thomasvs
694   CFLAGS="-Wall -Werror"
695   AC_COMPILE_IFELSE(
696     AC_LANG_PROGRAM([
697 #include <vorbis/codec.h>
698                      ],[
699 vorbis_dsp_state *v;
700
701 vorbis_synthesis_restart (v);
702                      ]), HAVE_VSR=yes, HAVE_VSR=no)
703   if test "x$HAVE_VSR" = "xyes"; then
704     AC_DEFINE_UNQUOTED(HAVE_VORBIS_SYNTHESIS_RESTART, 1,
705                        [defined if vorbis_synthesis_restart is present])
706   fi
707   CFLAGS="$ac_cflags_save"
708 fi
709
710 fi dnl of EXT plugins
711
712 dnl Check for atomic.h
713 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
714 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
715 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
716 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
717 if test x$HAVE_ATOMIC_H = xyes; then
718   AC_TRY_RUN([
719 #include "asm/atomic.h"
720 main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
721   ],, [
722     # Not successful
723     if test x$HAVE_ATOMIC_H = xyes; then
724       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
725     fi
726     HAVE_ATOMIC_H=no
727   ], [
728     # Cross compiling
729     AC_MSG_RESULT(yes)
730     AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
731   ])
732 fi
733
734 dnl check for "check", unit testing library/header
735 AM_PATH_CHECK(0.9.2, HAVE_CHECK=yes, HAVE_CHECK=no)
736 AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
737
738 dnl ######################################################################
739 dnl # Check command line parameters, and set shell variables accordingly #
740 dnl ######################################################################
741
742 AC_ARG_ENABLE(atomic,
743   AC_HELP_STRING([--enable-atomic],[use atomic reference counting header]),
744 [case "${enableval}" in
745   yes) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
746   noset) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
747   no)  USE_ATOMIC_H=no;;
748   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
749 esac], 
750 [USE_ATOMIC_H=$HAVE_ATOMIC_H]) dnl Default value
751
752 AC_ARG_ENABLE(profiling,
753   AC_HELP_STRING([--enable-profiling],
754                  [-pg to compiler commandline, for profiling]),
755 [case "${enableval}" in
756   yes) USE_PROFILING=yes ;;
757   no)  UES_PROFILING=no ;;
758   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
759 esac], 
760 [USE_PROFILING=no]) dnl Default value
761
762 AC_ARG_ENABLE(tests,
763   AC_HELP_STRING([--disable-tests],[disable building test apps]),
764 [case "${enableval}" in
765   yes) BUILD_TESTS=yes ;;
766   no)  BUILD_TESTS=no ;;
767   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
768 esac], 
769 [BUILD_TESTS=yes]) dnl Default value
770
771 AC_ARG_ENABLE(examples,
772   AC_HELP_STRING([--disable-examples],[disable building examples]),
773 [case "${enableval}" in
774   yes) BUILD_EXAMPLES=yes ;;
775   no)  BUILD_EXAMPLES=no ;;
776   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
777 esac], 
778 [BUILD_EXAMPLES=yes]) dnl Default value
779
780 dnl seeking needs freetype, so check for it here
781 PKG_CHECK_MODULES(FT2, freetype2 >= 2.0.9, HAVE_FT2="yes", [
782   AC_CHECK_FT2(2.0.9, HAVE_FT2="yes", HAVE_FT2="no")
783 ])
784 dnl make the HAVE_FT2 variable available to automake and Makefile.am
785 AM_CONDITIONAL(HAVE_FT2, test "x$HAVE_FT2" = "xyes")
786 AC_SUBST(FT2_CFLAGS)
787 AC_SUBST(FT2_LIBS)
788
789 dnl ################################################
790 dnl # Set defines according to variables set above #
791 dnl ################################################
792
793
794 if test "x$USE_ATOMIC_H" = xyes; then
795   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
796 fi
797
798 # do not use deprecated stuff
799 GST_CFLAGS="$GST_CFLAGS -DGST_DISABLE_DEPRECATED"
800
801 if test "x$USE_DEBUG" = xyes; then
802   GST_CFLAGS="$GST_CFLAGS -g"
803 fi
804
805 dnl ######################
806 dnl # Checks for gtk-doc #
807 dnl ######################
808
809 GTK_DOC_CHECK([1.3])
810
811 dnl #############################
812 dnl # Set automake conditionals #
813 dnl #############################
814
815 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
816 dnl HAVE_ and it is likely to be easier to stick with the old name
817 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
818
819 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
820 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
821
822 AM_CONDITIONAL(HAVE_NASM,           test "x$HAVE_NASM" = "xyes")
823 AM_CONDITIONAL(HAVE_GTK,            test "x$HAVE_GTK" = "xyes")
824 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
825 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
826 AM_CONDITIONAL(HAVE_FIG2DEV_PNG,    $HAVE_FIG2DEV_PNG)
827 AM_CONDITIONAL(HAVE_FIG2DEV_PDF,    $HAVE_FIG2DEV_PDF)
828 AM_CONDITIONAL(HAVE_RAW1394,        test "x$HAVE_RAW1394" = "xyes")
829
830 dnl prefer internal headers to already installed ones
831 dnl also add builddir include for enumtypes and marshal
832 dnl add ERROR_CFLAGS, but overridable
833 GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS \$(ERROR_CFLAGS)"
834
835 AC_SUBST(GST_LIBS)
836 AC_SUBST(GST_CFLAGS)
837
838 dnl ###########################
839 dnl # Configure external libs #
840 dnl ###########################
841
842 dnl ############################
843 dnl # Set up some more defines #
844 dnl ############################
845
846 dnl set license and copyright notice
847 AC_DEFINE(GST_LICENSE, "LGPL", [GStreamer license])
848
849 dnl package name in plugins
850 AC_ARG_WITH(package-name,
851 AC_HELP_STRING([--with-package-name],[specify package name to use in plugins]),
852 [case "${withval}" in
853   yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
854   no) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
855   *) GST_PACKAGE="${withval}" ;;
856 esac], 
857 [
858 dnl default value
859 if test "x$GST_CVS" = "xyes"
860 then
861   dnl nano >= 1
862   GST_PACKAGE="GStreamer CVS/prerelease"
863 else
864   GST_PACKAGE="GStreamer source release"
865 fi
866 ]
867 )
868 AC_MSG_NOTICE(Using $GST_PACKAGE as package name)
869 AC_DEFINE_UNQUOTED(GST_PACKAGE, "$GST_PACKAGE", [package name in plugins])
870
871 dnl package origin URL
872 AC_ARG_WITH(package-origin,
873 AC_HELP_STRING([--with-package-origin],[specify package origin URL to use in plugins]),
874 [case "${withval}" in
875   yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
876   no) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
877   *) GST_ORIGIN="${withval}" ;;
878 esac], 
879 [GST_ORIGIN="http://gstreamer.freedesktop.org/"]) dnl Default value
880 AC_MSG_NOTICE(Using $GST_ORIGIN as package origin)
881 AC_DEFINE_UNQUOTED(GST_ORIGIN, "$GST_ORIGIN", [package origin])
882
883 dnl #########################
884 dnl # Make the output files #
885 dnl #########################
886
887 AC_CONFIG_FILES(
888 Makefile
889 gst-plugins-base.spec
890 gst/Makefile
891 gst/adder/Makefile
892 gst/audioconvert/Makefile
893 gst/audioscale/Makefile
894 gst/audiorate/Makefile
895 gst/ffmpegcolorspace/Makefile
896 gst/playback/Makefile
897 gst/sine/Makefile
898 gst/subparse/Makefile
899 gst/tcp/Makefile
900 gst/typefind/Makefile
901 gst/videotestsrc/Makefile
902 gst/videorate/Makefile
903 gst/videoscale/Makefile
904 gst/volume/Makefile
905 sys/Makefile
906 sys/ximage/Makefile
907 sys/xvimage/Makefile
908 sys/v4l/Makefile
909 ext/Makefile
910 ext/alsa/Makefile
911 ext/cdparanoia/Makefile
912 ext/gnomevfs/Makefile
913 ext/libvisual/Makefile
914 ext/ogg/Makefile
915 ext/theora/Makefile
916 ext/vorbis/Makefile
917 gst-libs/Makefile
918 gst-libs/gst/Makefile
919 gst-libs/gst/audio/Makefile
920 gst-libs/gst/floatcast/Makefile
921 gst-libs/gst/interfaces/Makefile
922 gst-libs/gst/net/Makefile
923 gst-libs/gst/riff/Makefile
924 gst-libs/gst/rtp/Makefile
925 gst-libs/gst/tag/Makefile
926 gst-libs/gst/video/Makefile
927 gst-libs/ext/Makefile
928 examples/seeking/Makefile
929 examples/Makefile
930 tools/Makefile
931 gconf/Makefile
932 gconf/gstreamer.schemas
933 pkgconfig/Makefile
934 pkgconfig/gstreamer-plugins-base.pc
935 pkgconfig/gstreamer-plugins-base-uninstalled.pc
936 check/Makefile
937 docs/Makefile
938 docs/libs/Makefile
939 docs/plugins/Makefile
940 docs/version.entities
941 po/Makefile.in
942 common/Makefile
943 common/m4/Makefile
944 m4/Makefile
945 )
946 AC_OUTPUT
947
948 echo -n "configure: *** Core plug-ins, always built:"
949 ( for i in $GST_PLUGINS_ALL; do echo $i; done ) | sort
950 echo
951 echo -n "configure: *** Plug-ins relying on libraries that will be built:"
952 echo -e "$GST_PLUGINS_YES" | sort
953 echo
954 echo -n "configure: *** Plug-ins relying on libraries that will NOT be built:"
955 echo -e "$GST_PLUGINS_NO" | sort
956 echo
957 if test "x$BUILD_EXTERNAL" = "xno"; then
958   echo "configure: *** No external plug-ins will be built"
959 fi