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