use the filter on the connection even if the pads don't have caps
[platform/upstream/gstreamer.git] / configure.ac
1 AC_INIT
2 AC_CANONICAL_TARGET([])
3
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 AS_VERSION(gstreamer, GST_VERSION, 0, 5, 1, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror")
7 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
8 AM_MAINTAINER_MODE
9 AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
10
11 dnl our libraries and install dirs use major.minor as a version
12 GST_MAJORMINOR=$GST_VERSION_MAJOR.$GST_VERSION_MINOR
13 AC_SUBST(GST_MAJORMINOR)
14
15 dnl CURRENT, REVISION, AGE
16 dnl - library source changed -> increment REVISION
17 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
18 dnl - interfaces added -> increment AGE
19 dnl - interfaces removed -> AGE = 0
20 AS_LIBTOOL(GST, 2, 0, 0)
21
22 AC_CONFIG_SRCDIR([gst/gst.c])
23 AM_CONFIG_HEADER(config.h)
24
25 dnl Add parameters for aclocal
26 dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
27 ACLOCAL="$ACLOCAL -I common/m4 $ACLOCAL_FLAGS"
28
29 AC_PROG_CC
30 dnl For interactive UNIX (a Sun thing)
31 AC_ISC_POSIX
32 AM_PROG_CC_STDC
33 AM_PROG_AS
34 AS="${CC}"
35
36 dnl We disable static building for development, for time savings
37 dnl *NOTE*: dnl this line before release, so release does static too
38 dnl AM_DISABLE_STATIC
39
40 AC_HEADER_STDC([])
41
42
43 dnl ##############################
44 dnl # Do automated configuration #
45 dnl ##############################
46
47 dnl Check for tools:
48 dnl ================
49
50 dnl allow for different autotools
51 AS_AUTOTOOLS_ALTERNATE()
52
53 dnl modify pkg-config path
54 AC_ARG_WITH(pkg-config-path, 
55    AC_HELP_STRING([--with-pkg-config-path],
56                   [colon-separated list of pkg-config(1) dirs]),
57    [export PKG_CONFIG_PATH=${withval}])
58
59 GST_DOC()
60 GST_ARCH()
61
62 dnl we require bison for building of some of the marshal files
63 dnl FIXME: check if AC_PROG_YACC is suitable here
64 AC_PATH_PROG(BISON_PATH, bison, no)
65 if test x$BISON_PATH = xno; then
66   AC_MSG_ERROR(Could not find bison)
67 fi
68
69 dnl we require flex for building the parser
70 dnl FIXME: check if AC_PROG_LEX is suitable here
71 AC_PATH_PROG(FLEX_PATH, flex, no)
72 if test x$FLEX_PATH = xno; then
73   AC_MSG_ERROR(Could not find flex)
74 fi
75
76 dnl
77 dnl We should really use AC_SYS_LARGEFILE, but the problem is
78 dnl many of the plugins don't include "config.h".  To assure
79 dnl binary compatibility, it is necessary that all gstreamer
80 dnl code be compiled with the same sizeof(off_t), so we use
81 dnl the following crude hack.
82 dnl
83
84 dnl
85 dnl GST_CFLAGS are split up as GST_EXT_CFLAGS and GST_INT_CFLAGS
86 dnl same for libs
87 dnl this is so we can make GST_CFLAGS for external modules available
88 dnl without mixing in internal (uninstalled) CFLAGS
89 dnl
90
91 dnl disable deprecated functions internally
92 GST_INT_CFLAGS="-DGST_DISABLE_DEPRECATED"
93
94 AC_MSG_CHECKING(for large file support)
95 AC_TRY_RUN([
96 #define _LARGEFILE_SOURCE
97 #define _FILE_OFFSET_BITS 64
98 #include <sys/types.h>
99 int main () { return !(sizeof(off_t) == 8); }
100 ],
101 [
102 AC_MSG_RESULT(yes)
103 GST_EXT_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
104 ],
105 [
106 AC_MSG_RESULT(no)
107 ],
108 [
109 AC_MSG_RESULT(no)
110 ])
111
112 dnl check for makecontext and define HAVE_MAKECONTEXT if we have it
113 AC_CHECK_MCSC()
114 if test "$ac_cv_check_mcsc" == "yes"; then
115   AC_DEFINE_UNQUOTED(HAVE_MAKECONTEXT, $HAVE_MAKECONTEXT,
116                      [defined if we have makecontext ()])
117 fi
118
119 dnl Check for a way to display the function name in debug output
120 GST_CHECK_FUNCTION()
121
122 dnl Check for essential libraries first:
123 dnl ====================================
124
125 dnl === GLib 2 ===
126 dnl Minimum required version of GLib2
127 dnl required for compilation without warnings
128 GLIB2_REQ="2.0.1"
129 AC_SUBST(GLIB2_REQ)
130
131 dnl Check for glib2
132 PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQ gobject-2.0 gthread-2.0 gmodule-2.0,HAVE_GLIB2=yes,HAVE_GLIB2=no)
133 GLIB_LIBS=$GLIB2_LIBS
134 GLIB_CFLAGS=$GLIB2_CFLAGS
135 AC_SUBST(GLIB_LIBS)
136 AC_SUBST(GLIB_CFLAGS)
137
138 if test "x$HAVE_GLIB2" = "xno"; then
139   AC_MSG_ERROR([GStreamer requires GLib 2.0 to compile.])
140 fi
141
142 GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
143 AC_SUBST(GST_PKG_DEPS)
144   
145 dnl === libxml 2 ===
146 dnl Minimum required version of libxml2
147 LIBXML2_REQ="2.4.9"
148 AC_SUBST(LIBXML2_REQ)
149
150 dnl check for libxml2
151 GST_LIBXML2_CHECK()
152
153 dnl popt checks
154 GST_CHECK_LIBHEADER(POPT, popt, poptStrippedArgv,, popt.h, POPT_LIBS="-lpopt",
155   AC_MSG_ERROR([popt 1.6.1 or newer is required to build gstreamer. You can
156                 download the latest version from 
157                 ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/])
158 )
159 AC_MSG_NOTICE(Checking for POPT_TABLEEND)
160 AC_COMPILE_IFELSE([
161 #include <popt.h>
162 int main ()
163 {
164 #ifndef POPT_TABLEEND
165 #error
166 #else
167   return 0;
168 #endif
169 }
170 ],, [
171   dnl it failed
172   AC_MSG_ERROR([popt 1.6.1 or newer is required to build gstreamer. You can
173                 download the latest version from 
174                 ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/])
175 ])
176
177 dnl Check for atomic.h
178 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
179 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
180 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
181 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
182 if test x$HAVE_ATOMIC_H = xyes; then
183   AC_LINK_IFELSE([
184 #include "asm/atomic.h"
185 main() {atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
186   ],, [
187     # Not successful
188     if test x$HAVE_ATOMIC_H = xyes; then
189       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
190     fi
191     HAVE_ATOMIC_H=no
192   ])
193 fi
194
195 dnl ######################################################################
196 dnl # Check command line parameters, and set shell variables accordingly #
197 dnl ######################################################################
198
199 dnl FIXME: simplify all this down using a few m4 macros
200
201 AC_ARG_ENABLE(libmmx,
202 AC_HELP_STRING([--enable-libmmx],[use libmmx, if available]),
203 [case "${enableval}" in
204   yes) USE_LIBMMX=$HAVE_LIBMMX ;;
205   no)  USE_LIBMMX=no ;;
206   *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmmx) ;;
207 esac], 
208 [USE_LIBMMX=$HAVE_LIBMMX]) dnl Default value
209
210 AC_ARG_ENABLE(atomic,
211 AC_HELP_STRING([--enable-atomic],[use atomic reference counting header]),
212 [case "${enableval}" in
213   yes) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
214   noset) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
215   no)  USE_ATOMIC_H=no;;
216   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
217 esac], 
218 [USE_ATOMIC_H=$HAVE_ATOMIC_H]) dnl Default value
219
220 AC_ARG_ENABLE(plugin-builddir,
221 AC_HELP_STRING([--enable-plugin-builddir],[allow tests/demos to use non-installed plugins]),
222 [case "${enableval}" in
223   yes) PLUGINS_USE_BUILDDIR=yes ;;
224   no)  PLUGINS_USE_BUILDDIR=no ;;
225   *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugin-builddir) ;;
226 esac], 
227 [PLUGINS_USE_BUILDDIR=no]) dnl Default value
228
229 GST_DEBUGINFO
230
231 AC_ARG_ENABLE(profiling,
232 AC_HELP_STRING([--enable-profiling],[adds -pg to compiler commandline, for profiling]),
233 [case "${enableval}" in
234   yes) USE_PROFILING=yes ;;
235   no)  UES_PROFILING=no ;;
236   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
237 esac], 
238 [USE_PROFILING=no]) dnl Default value
239
240 dnl use a cache dir for storing element registry info.
241 dnl default to building registry in the source tree if we are enabling plugin build dir
242 if test "x$PLUGINS_USE_BUILDDIR" = "xyes"; then
243   GST_CACHE_DIR=`pwd`
244 else
245   dnl ${localstatedir} points to PREFIX/var
246   GST_CACHE_DIR=${localstatedir}/cache/gstreamer-$GST_MAJORMINOR
247 fi
248 AC_ARG_WITH(cachedir,
249 AC_HELP_STRING([--with-cachedir],[specify path to use for plugin and command completion registries]),
250 [case "${withval}" in
251   yes) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
252   no) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
253   *) GST_CACHE_DIR="${withval}" ;;
254 esac], 
255 [:]) dnl Default value
256
257 AS_AC_EXPAND(GST_CACHE_DIR, $GST_CACHE_DIR)
258 AC_MSG_NOTICE(Using $GST_CACHE_DIR as registry cache dir)
259
260
261 dnl building of tests
262 AC_ARG_ENABLE(tests,
263 AC_HELP_STRING([--disable-tests],[disable building test apps]),
264 [case "${enableval}" in
265   yes) BUILD_TESTS=yes ;;
266   no)  BUILD_TESTS=no ;;
267   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
268 esac], 
269 [BUILD_TESTS=yes]) dnl Default value
270 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
271
272 dnl tests known to fail
273 AC_ARG_ENABLE(failing-tests,
274 AC_HELP_STRING([--disable-failing-tests],[disable building tests known to fail]),
275 [case "${enableval}" in
276   yes) BUILD_FAILING_TESTS=yes ;;
277   no)  BUILD_FAILING_TESTS=no ;;
278   *) AC_MSG_ERROR(bad value ${enableval} for --disable-failing-tests) ;;
279 esac], 
280 [BUILD_FAILING_TESTS=no]) dnl Default value
281 AM_CONDITIONAL(BUILD_FAILING_TESTS, test "x$BUILD_FAILING_TESTS" = "xyes")
282 if test x$BUILD_FAILING_TESTS = xyes; then
283   AC_MSG_WARN([building tests known to fail, use --disable-failing-tests to disable])
284 else
285   AC_MSG_WARN([Sissy ! By asking to not build the tests known to fail, you hereby waive your right to customer support.  If you do not agree with this EULA, please press Ctrl-C before the next line is printed.  By allowing the next line to be printed, you expressly acknowledge your acceptance of this EULA.])
286 fi
287
288 AC_ARG_ENABLE(examples,
289 AC_HELP_STRING([--disable-examples],[disable building examples]),
290 [case "${enableval}" in
291   yes) BUILD_EXAMPLES=yes ;;
292   no)  BUILD_EXAMPLES=no ;;
293   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
294 esac], 
295 [BUILD_EXAMPLES=yes]) dnl Default value
296 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
297
298 dnl Next, check for the optional components:
299 dnl ========================================
300
301 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true)
302 GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
303 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true)
304 GST_SUBSYSTEM_DISABLE(TYPEFIND,[typefind plugin],)
305 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_AUTOPLUG, true)
306 GST_SUBSYSTEM_DISABLE(AUTOPLUG,[autoplugger subsystem])
307 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true)
308 GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
309 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true)
310 GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
311 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true)
312 GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
313
314 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES"
315
316 dnl ################################################
317 dnl # Set defines according to variables set above #
318 dnl ################################################
319
320
321 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
322 dnl HAVE_ and it is likely to be easier to stick with the old name
323 if test "x$USE_LIBMMX" = xyes; then
324   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
325 fi
326
327 if test "x$USE_ATOMIC_H" = xyes; then
328   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
329 fi
330
331 dnl test if we have pthread_attr_setstack; if not use the older calls
332 AC_CHECK_LIB(pthread, pthread_attr_setstack, 
333    AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACK, 1, 
334              [Defined if libpthread has pthread_attr_setstack ()]))
335
336 dnl test if we have posix_memalign; FreeBSD doesn't
337 AC_CHECK_FUNC(posix_memalign,
338    AC_DEFINE(HAVE_POSIX_MEMALIGN, 1,
339              [Defined if we have posix_memalign ()]))
340
341 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
342   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
343 fi
344
345 if test "x$USE_DEBUG" = xyes; then
346    GST_INT_CFLAGS="$GST_INT_CFLAGS -g"
347 fi
348
349 if test "x$USE_PROFILING" = xyes; then
350 dnl  CFLAGS="$CFLAGS -pg -fprofile-arcs"
351   FOMIT_FRAME_POINTER=""
352 else
353   FOMIT_FRAME_POINTER="-fomit-frame-pointer"
354 fi
355
356 dnl
357 dnl AC_SUBST(FOMIT_FRAME_POINTER)
358 dnl
359
360 dnl #############################
361 dnl # Set automake conditionals #
362 dnl #############################
363
364 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
365 dnl HAVE_ and it is likely to be easier to stick with the old name
366 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
367
368 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
369 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
370
371 AM_CONDITIONAL(PLUGINS_USE_BUILDDIR,  test "x$PLUGINS_USE_BUILDDIR" = "xyes")
372
373
374 dnl ############################
375 dnl # Set up some more defines #
376 dnl ############################
377
378 dnl Set location of registry dir.
379 AC_DEFINE_UNQUOTED(GST_CACHE_DIR, "$GST_CACHE_DIR", [Define the registry directory])
380 AC_SUBST(GST_CACHE_DIR)
381
382 dnl Set location of plugin directory
383 if test "x${prefix}" = "xNONE"; then
384   PLUGINS_DIR=${ac_default_prefix}/lib/gstreamer-$GST_MAJORMINOR
385 else
386   PLUGINS_DIR=${prefix}/lib/gstreamer-$GST_MAJORMINOR
387 fi
388 AC_DEFINE_UNQUOTED(PLUGINS_DIR, "$PLUGINS_DIR", [Define the plugin directory])
389 AC_SUBST(PLUGINS_DIR)
390
391 dnl Set location of uninstalled plugin directory
392 PLUGINS_BUILDDIR=`pwd`
393 AC_DEFINE_UNQUOTED(PLUGINS_BUILDDIR, "$PLUGINS_BUILDDIR", [Define the uninstalled plugin directory])
394 AC_SUBST(PLUGINS_BUILDDIR)
395
396 dnl since glib and xml are package deps, there's no need to include their cflags
397 dnl in the pkg-config file
398
399 dnl for pkg-config
400 GST_PKG_CFLAGS=$GST_EXT_CFLAGS
401 GST_PKG_LIBS=$GST_EXT_LIBS
402 AC_SUBST(GST_PKG_CFLAGS)
403 AC_SUBST(GST_PKG_LIBS)
404
405 dnl finalize _CFLAGS and _LIBS
406 dnl add GLIB and XML if necessary to EXT_*
407 GST_CFLAGS="$GST_EXT_CFLAGS $XML_CFLAGS $GLIB_CFLAGS"
408 GST_LIBS="$GST_EXT_LIBS $XML_LIBS $GLIB_LIBS -lpopt"
409
410 dnl Private vars for libgst only
411 LIBGST_LIBS="$GST_LIBS"
412 LIBGST_CFLAGS="$GST_CFLAGS -I\$(top_srcdir) $GST_ERROR"
413 AC_SUBST(LIBGST_LIBS)
414 AC_SUBST(LIBGST_CFLAGS)
415
416 dnl Vars for everyone else
417 GST_INT_LIBS="\$(top_builddir)/gst/libgstreamer-$GST_MAJORMINOR.la"
418 GST_INT_CFLAGS="$GST_INT_CFLAGS -I\$(top_srcdir)/libs -I\$(top_srcdir)/include"
419
420 AC_SUBST(GST_CFLAGS, "$LIBGST_CFLAGS $GST_INT_CFLAGS")
421 AC_SUBST(GST_LIBS, "$LIBGST_LIBS $GST_INT_LIBS")
422
423 GST_PLUGIN_LDFLAGS='-module -avoid-version'
424 AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS")
425
426 AC_CONFIG_SUBDIRS(libs/ext/cothreads)
427
428 dnl ##################################################
429 dnl # deps for examples from manual                  #
430 dnl ##################################################
431
432 PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0,
433                   HAVE_LIBGNOMEUI="yes", HAVE_LIBGNOMEUI="no")
434 AC_SUBST(LIBGNOMEUI_CFLAGS)
435 AC_SUBST(LIBGNOMEUI_LIBS)
436 AM_CONDITIONAL(HAVE_LIBGNOMEUI, test "x$HAVE_LIBGNOMEUI" = "xyes")
437
438 dnl ##################################################
439 dnl # Prepare informative messages to display at end #
440 dnl ##################################################
441
442 infomessages=
443
444 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
445   infomessages="$infomessages
446 *** Warning: You have configured using the --enable-plugin-builddir option.
447
448 This option is for development purposes only: binaries built with
449 it should be used with code in the build tree only.  To build an
450 installable version, use ./configure without the --enable-plugin-builddir
451 option.  Note that the autogen.sh script supplies the plugin builddir
452 option automatically -- run ./autogen.sh -- --disable-plugin-builddir to make
453 an installable build.
454
455 "
456 fi
457
458 dnl #########################
459 dnl # Make the output files #
460 dnl #########################
461
462 dnl libs/ext/Makefile
463 dnl nothing there yet !
464 AC_OUTPUT(
465 Makefile
466 include/Makefile
467 gst/Makefile
468 gst/gstversion.h
469 gst/autoplug/Makefile
470 gst/indexers/Makefile
471 gst/elements/Makefile
472 gst/parse/Makefile
473 gst/schedulers/Makefile
474 gst/types/Makefile
475 gst/registries/Makefile
476 libs/Makefile
477 libs/gst/Makefile
478 libs/gst/bytestream/Makefile
479 libs/gst/getbits/Makefile
480 libs/gst/putbits/Makefile
481 libs/gst/control/Makefile
482 libs/ext/Makefile
483 tests/Makefile
484 tests/bufspeed/Makefile
485 tests/memchunk/Makefile
486 tests/muxing/Makefile
487 tests/seeking/Makefile
488 tests/sched/Makefile
489 tests/threadstate/Makefile
490 testsuite/Makefile
491 testsuite/bytestream/Makefile
492 testsuite/caps/Makefile
493 testsuite/cleanup/Makefile
494 testsuite/clock/Makefile
495 testsuite/dynparams/Makefile
496 testsuite/elements/Makefile
497 testsuite/indexers/Makefile
498 testsuite/plugin/Makefile
499 testsuite/refcounting/Makefile
500 testsuite/threads/Makefile
501 examples/Makefile
502 examples/autoplug/Makefile
503 examples/cutter/Makefile
504 examples/helloworld/Makefile
505 examples/helloworld2/Makefile
506 examples/launch/Makefile
507 examples/manual/Makefile
508 examples/mixer/Makefile
509 examples/pingpong/Makefile
510 examples/plugins/Makefile
511 examples/queue/Makefile
512 examples/queue2/Makefile
513 examples/queue3/Makefile
514 examples/queue4/Makefile
515 examples/thread/Makefile
516 examples/typefind/Makefile
517 examples/xml/Makefile
518 tools/Makefile
519 docs/Makefile
520 docs/devhelp/Makefile
521 docs/faq/Makefile
522 docs/gst/Makefile
523 docs/gst/gstreamer.types
524 docs/libs/Makefile
525 docs/manual/Makefile
526 docs/pwg/Makefile
527 docs/plugins/Makefile
528 docs/plugins/gstreamer-plugins.types
529 docs/xsl/Makefile
530 stamp.h
531 gstreamer.pc
532 gstreamer-uninstalled.pc
533 gstreamer.spec,
534 echo "$infomessages", infomessages="$infomessages"
535 )