Renamed GstCache to GstIndex
[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, 0, 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, 1, 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 AC_MSG_CHECKING(for large file support)
92 AC_TRY_RUN([
93 #define _LARGEFILE_SOURCE
94 #define _FILE_OFFSET_BITS 64
95 #include <sys/types.h>
96 int main () { return !(sizeof(off_t) == 8); }
97 ],
98 [
99 AC_MSG_RESULT(yes)
100 GST_EXT_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
101 ],
102 [
103 AC_MSG_RESULT(no)
104 ],
105 [
106 AC_MSG_RESULT(no)
107 ])
108
109 dnl check for makecontext and define HAVE_MAKECONTEXT if we have it
110 GST_CHECK_MAKECONTEXT()
111
112 dnl Check for a way to display the function name in debug output
113 GST_CHECK_FUNCTION()
114
115 dnl Check for essential libraries first:
116 dnl ====================================
117
118 dnl === GLib 2 ===
119 dnl Minimum required version of GLib2
120 dnl required for compilation without warnings
121 GLIB2_REQ="2.0.1"
122 AC_SUBST(GLIB2_REQ)
123
124 dnl Check for glib2
125 PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQ gobject-2.0 gthread-2.0 gmodule-2.0,
126   HAVE_GLIB2=yes,HAVE_GLIB2=no)
127 GLIB_LIBS=$GLIB2_LIBS
128 GLIB_CFLAGS=$GLIB2_CFLAGS
129 AC_SUBST(GLIB_LIBS)
130 AC_SUBST(GLIB_CFLAGS)
131
132 if test "x$HAVE_GLIB2" = "xno"; then
133   AC_MSG_ERROR([GStreamer requires GLib 2.0 to compile.])
134 fi
135
136 GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
137 AC_SUBST(GST_PKG_DEPS)
138   
139 dnl === libxml 2 ===
140 dnl Minimum required version of libxml2
141 LIBXML2_REQ="2.4.9"
142 AC_SUBST(LIBXML2_REQ)
143
144 dnl check for libxml2
145 GST_LIBXML2_CHECK()
146
147 dnl popt checks
148 GST_CHECK_LIBHEADER(POPT, popt, poptStrippedArgv,, popt.h, POPT_LIBS="-lpopt",
149   AC_MSG_ERROR([popt 1.6.1 or newer is required to build gstreamer. You can
150                 download the latest version from 
151                 ftp://people.redhat.com/sopwith/popt/])
152 )
153 AC_MSG_NOTICE(Checking for POPT_TABLEEND)
154 AC_TRY_RUN([
155 #include <popt.h>
156 int main ()
157 {
158 #ifndef POPT_TABLEEND
159   return 1;
160 #else
161   return 0;
162 #endif
163 }
164 ],, [
165   dnl it failed
166   AC_MSG_ERROR([popt 1.6.1 or newer is required to build gstreamer. You can
167                 download the latest version from 
168                 ftp://people.redhat.com/sopwith/popt/])
169 ])
170
171 dnl Check for atomic.h
172 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
173 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
174 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
175 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
176 if test x$HAVE_ATOMIC_H = xyes; then
177   AC_TRY_RUN([
178 #include "asm/atomic.h"
179 main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
180   ],, [
181     # Not successful
182     if test x$HAVE_ATOMIC_H = xyes; then
183       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
184     fi
185     HAVE_ATOMIC_H=no
186   ], [
187     # Cross compiling
188     AC_MSG_RESULT(yes)
189     AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
190   ])
191 fi
192
193 dnl ######################################################################
194 dnl # Check command line parameters, and set shell variables accordingly #
195 dnl ######################################################################
196
197 dnl FIXME: simplify all this down using a few m4 macros
198
199 AC_ARG_ENABLE(libmmx,
200 AC_HELP_STRING([--enable-libmmx],[use libmmx, if available]),
201 [case "${enableval}" in
202   yes) USE_LIBMMX=$HAVE_LIBMMX ;;
203   no)  USE_LIBMMX=no ;;
204   *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmmx) ;;
205 esac], 
206 [USE_LIBMMX=$HAVE_LIBMMX]) dnl Default value
207
208 AC_ARG_ENABLE(atomic,
209 AC_HELP_STRING([--enable-atomic],[use atomic reference counting header]),
210 [case "${enableval}" in
211   yes) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
212   noset) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
213   no)  USE_ATOMIC_H=no;;
214   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
215 esac], 
216 [USE_ATOMIC_H=$HAVE_ATOMIC_H]) dnl Default value
217
218 AC_ARG_ENABLE(plugin-builddir,
219 AC_HELP_STRING([--enable-plugin-builddir],[allow tests/demos to use non-installed plugins]),
220 [case "${enableval}" in
221   yes) PLUGINS_USE_BUILDDIR=yes ;;
222   no)  PLUGINS_USE_BUILDDIR=no ;;
223   *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugin-builddir) ;;
224 esac], 
225 [PLUGINS_USE_BUILDDIR=no]) dnl Default value
226
227 GST_DEBUGINFO
228
229 AC_ARG_ENABLE(profiling,
230 AC_HELP_STRING([--enable-profiling],[adds -pg to compiler commandline, for profiling]),
231 [case "${enableval}" in
232   yes) USE_PROFILING=yes ;;
233   no)  UES_PROFILING=no ;;
234   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
235 esac], 
236 [USE_PROFILING=no]) dnl Default value
237
238 dnl use a cache dir for storing element registry info.
239 dnl default to building registry in the source tree if we are enabling plugin build dir
240 if test "x$PLUGINS_USE_BUILDDIR" = "xyes"; then
241   GST_CACHE_DIR=`pwd`
242 else
243   dnl ${localstatedir} points to PREFIX/var
244   GST_CACHE_DIR=${localstatedir}/cache/gstreamer-$GST_MAJORMINOR
245 fi
246 AC_ARG_WITH(cachedir,
247 AC_HELP_STRING([--with-cachedir],[specify path to use for plugin and command completion registries]),
248 [case "${withval}" in
249   yes) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
250   no) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
251   *) GST_CACHE_DIR="${withval}" ;;
252 esac], 
253 [:]) dnl Default value
254
255 AS_AC_EXPAND(GST_CACHE_DIR, $GST_CACHE_DIR)
256 AC_MSG_NOTICE(Using $GST_CACHE_DIR as registry cache dir)
257
258
259 dnl building of tests
260 AC_ARG_ENABLE(tests,
261 AC_HELP_STRING([--disable-tests],[disable building test apps]),
262 [case "${enableval}" in
263   yes) BUILD_TESTS=yes ;;
264   no)  BUILD_TESTS=no ;;
265   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
266 esac], 
267 [BUILD_TESTS=yes]) dnl Default value
268 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
269
270 dnl tests known to fail
271 AC_ARG_ENABLE(failing-tests,
272 AC_HELP_STRING([--disable-failing-tests],[disable building tests known to fail]),
273 [case "${enableval}" in
274   yes) BUILD_FAILING_TESTS=yes ;;
275   no)  BUILD_FAILING_TESTS=no ;;
276   *) AC_MSG_ERROR(bad value ${enableval} for --disable-failing-tests) ;;
277 esac], 
278 [BUILD_FAILING_TESTS=no]) dnl Default value
279 AM_CONDITIONAL(BUILD_FAILING_TESTS, test "x$BUILD_FAILING_TESTS" = "xyes")
280 if test x$BUILD_FAILING_TESTS = xyes; then
281   AC_MSG_WARN([building tests known to fail, use --disable-failing-tests to disable])
282 else
283   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.])
284 fi
285
286 AC_ARG_ENABLE(examples,
287 AC_HELP_STRING([--disable-examples],[disable building examples]),
288 [case "${enableval}" in
289   yes) BUILD_EXAMPLES=yes ;;
290   no)  BUILD_EXAMPLES=no ;;
291   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
292 esac], 
293 [BUILD_EXAMPLES=yes]) dnl Default value
294 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
295
296 dnl Next, check for the optional components:
297 dnl ========================================
298
299 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true)
300 GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
301 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true)
302 GST_SUBSYSTEM_DISABLE(TYPEFIND,[typefind plugin],)
303 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_AUTOPLUG, true)
304 GST_SUBSYSTEM_DISABLE(AUTOPLUG,[autoplugger subsystem])
305 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true)
306 GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
307 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true)
308 GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
309 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true)
310 GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
311
312 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES"
313
314 dnl ################################################
315 dnl # Set defines according to variables set above #
316 dnl ################################################
317
318
319 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
320 dnl HAVE_ and it is likely to be easier to stick with the old name
321 if test "x$USE_LIBMMX" = xyes; then
322   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
323 fi
324
325 if test "x$USE_ATOMIC_H" = xyes; then
326   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
327 fi
328
329 dnl test if we have pthread_attr_setstack; if not use the older calls
330 AC_CHECK_LIB(pthread, pthread_attr_setstack, 
331    AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACK, 1, 
332              [Defined if libpthread has pthread_attr_setstack ()]))
333
334 dnl test if we have posix_memalign; FreeBSD doesn't
335 AC_CHECK_FUNC(posix_memalign,
336    AC_DEFINE(HAVE_POSIX_MEMALIGN, 1,
337              [Defined if we have posix_memalign ()]))
338
339 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
340   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
341 fi
342
343 if test "x$USE_DEBUG" = xyes; then
344    GST_INT_CFLAGS="$GST_INT_CFLAGS -g"
345 fi
346
347 if test "x$USE_PROFILING" = xyes; then
348 dnl  CFLAGS="$CFLAGS -pg -fprofile-arcs"
349   FOMIT_FRAME_POINTER=""
350 else
351   FOMIT_FRAME_POINTER="-fomit-frame-pointer"
352 fi
353
354 dnl
355 dnl AC_SUBST(FOMIT_FRAME_POINTER)
356 dnl
357
358 dnl #############################
359 dnl # Set automake conditionals #
360 dnl #############################
361
362 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
363 dnl HAVE_ and it is likely to be easier to stick with the old name
364 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
365
366 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
367 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
368
369 AM_CONDITIONAL(PLUGINS_USE_BUILDDIR,  test "x$PLUGINS_USE_BUILDDIR" = "xyes")
370
371
372 dnl ############################
373 dnl # Set up some more defines #
374 dnl ############################
375
376 dnl Set location of registry dir.
377 AC_DEFINE_UNQUOTED(GST_CACHE_DIR, "$GST_CACHE_DIR", [Define the registry directory])
378 AC_SUBST(GST_CACHE_DIR)
379
380 dnl Set location of plugin directory
381 if test "x${prefix}" = "xNONE"; then
382   PLUGINS_DIR=${ac_default_prefix}/lib/gstreamer-$GST_MAJORMINOR
383 else
384   PLUGINS_DIR=${prefix}/lib/gstreamer-$GST_MAJORMINOR
385 fi
386 AC_DEFINE_UNQUOTED(PLUGINS_DIR, "$PLUGINS_DIR", [Define the plugin directory])
387 AC_SUBST(PLUGINS_DIR)
388
389 dnl Set location of uninstalled plugin directory
390 PLUGINS_BUILDDIR=`pwd`
391 AC_DEFINE_UNQUOTED(PLUGINS_BUILDDIR, "$PLUGINS_BUILDDIR", [Define the uninstalled plugin directory])
392 AC_SUBST(PLUGINS_BUILDDIR)
393
394 dnl since glib and xml are package deps, there's no need to include their cflags
395 dnl in the pkg-config file
396
397 dnl for pkg-config
398 GST_PKG_CFLAGS=$GST_EXT_CFLAGS
399 GST_PKG_LIBS=$GST_EXT_LIBS
400 AC_SUBST(GST_PKG_CFLAGS)
401 AC_SUBST(GST_PKG_LIBS)
402
403 dnl finalize _CFLAGS and _LIBS
404 dnl add GLIB and XML if necessary to EXT_*
405 GST_CFLAGS="$GST_EXT_CFLAGS $XML_CFLAGS $GLIB_CFLAGS"
406 GST_LIBS="$GST_EXT_LIBS $XML_LIBS $GLIB_LIBS -lpopt"
407
408 dnl Private vars for libgst only
409 LIBGST_LIBS="$GST_LIBS"
410 LIBGST_CFLAGS="$GST_CFLAGS -I\$(top_srcdir) $GST_ERROR"
411 AC_SUBST(LIBGST_LIBS)
412 AC_SUBST(LIBGST_CFLAGS)
413
414 dnl Vars for everyone else
415 GST_INT_LIBS="\$(top_builddir)/gst/libgstreamer-$GST_MAJORMINOR.la"
416 GST_INT_CFLAGS="$GST_INT_CFLAGS -I\$(top_srcdir)/libs -I\$(top_srcdir)/include"
417
418 AC_SUBST(GST_CFLAGS, "$LIBGST_CFLAGS $GST_INT_CFLAGS")
419 AC_SUBST(GST_LIBS, "$LIBGST_LIBS $GST_INT_LIBS")
420
421 GST_PLUGIN_LDFLAGS='-module -avoid-version'
422 AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS")
423
424 AC_CONFIG_SUBDIRS(libs/ext/cothreads)
425
426 dnl ##################################################
427 dnl # deps for examples from manual                  #
428 dnl ##################################################
429
430 PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0,
431                   HAVE_LIBGNOMEUI="yes", HAVE_LIBGNOMEUI="no")
432 AC_SUBST(LIBGNOMEUI_CFLAGS)
433 AC_SUBST(LIBGNOMEUI_LIBS)
434 AM_CONDITIONAL(HAVE_LIBGNOMEUI, test "x$HAVE_LIBGNOMEUI" = "xyes")
435
436 dnl ##################################################
437 dnl # Prepare informative messages to display at end #
438 dnl ##################################################
439
440 infomessages=
441
442 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
443   infomessages="$infomessages
444 *** Warning: You have configured using the --enable-plugin-builddir option.
445
446 This option is for development purposes only: binaries built with
447 it should be used with code in the build tree only.  To build an
448 installable version, use ./configure without the --enable-plugin-builddir
449 option.  Note that the autogen.sh script supplies the plugin builddir
450 option automatically -- run ./autogen.sh --disable-plugin-buildddir to make
451 an installable build.
452
453 "
454 fi
455
456 dnl #########################
457 dnl # Make the output files #
458 dnl #########################
459
460 dnl libs/ext/Makefile
461 AC_OUTPUT(
462 Makefile
463 include/Makefile
464 gst/Makefile
465 gst/gstversion.h
466 gst/autoplug/Makefile
467 gst/indexers/Makefile
468 gst/elements/Makefile
469 gst/parse/Makefile
470 gst/schedulers/Makefile
471 gst/types/Makefile
472 gst/registries/Makefile
473 libs/Makefile
474 libs/gst/Makefile
475 libs/gst/bytestream/Makefile
476 libs/gst/getbits/Makefile
477 libs/gst/putbits/Makefile
478 libs/gst/control/Makefile
479 libs/ext/Makefile
480 tests/Makefile
481 tests/bufspeed/Makefile
482 tests/memchunk/Makefile
483 tests/muxing/Makefile
484 tests/seeking/Makefile
485 tests/sched/Makefile
486 tests/threadstate/Makefile
487 testsuite/Makefile
488 testsuite/bytestream/Makefile
489 testsuite/indexers/Makefile
490 testsuite/caps/Makefile
491 testsuite/cleanup/Makefile
492 testsuite/clock/Makefile
493 testsuite/dynparams/Makefile
494 testsuite/elements/Makefile
495 testsuite/plugin/Makefile
496 testsuite/refcounting/Makefile
497 testsuite/threads/Makefile
498 examples/Makefile
499 examples/autoplug/Makefile
500 examples/cutter/Makefile
501 examples/helloworld/Makefile
502 examples/helloworld2/Makefile
503 examples/launch/Makefile
504 examples/manual/Makefile
505 examples/mixer/Makefile
506 examples/pingpong/Makefile
507 examples/plugins/Makefile
508 examples/queue/Makefile
509 examples/queue2/Makefile
510 examples/queue3/Makefile
511 examples/queue4/Makefile
512 examples/thread/Makefile
513 examples/typefind/Makefile
514 examples/xml/Makefile
515 tools/Makefile
516 docs/Makefile
517 docs/devhelp/Makefile
518 docs/devhelp/html2xml.py
519 docs/faq/Makefile
520 docs/gst/Makefile
521 docs/gst/gstreamer.types
522 docs/libs/Makefile
523 docs/manual/Makefile
524 docs/pwg/Makefile
525 docs/plugins/Makefile
526 docs/plugins/gstreamer-plugins.types
527 docs/xsl/Makefile
528 stamp.h
529 gstreamer.pc
530 gstreamer-uninstalled.pc
531 gstreamer.spec,
532 echo "$infomessages", infomessages="$infomessages"
533 )