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