added vishnu's doc patch
[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 set up a configuration dir
222 GST_CONFIG_DIR=${sysconfdir}/gstreamer
223 AC_ARG_WITH(configdir,
224 AC_HELP_STRING([--with-configdir],[specify path to use for configuration files]),
225 [case "${withval}" in
226   yes) AC_MSG_ERROR(bad value ${withval} for --with-configdir) ;;
227   no) AC_MSG_ERROR(bad value ${withval} for --with-configdir) ;;
228   *) GST_CONFIG_DIR="${withval}" ;;
229 esac], 
230 [:]) dnl Default value
231
232 AS_AC_EXPAND(GST_CONFIG_DIR, $GST_CONFIG_DIR)
233 AC_MSG_NOTICE(Using $GST_CONFIG_DIR as configuration dir)
234
235
236 dnl use a cache dir for storing element registry info.
237 dnl default to building registry in the source tree if we are enabling plugin build dir
238 if test "x$PLUGINS_USE_BUILDDIR" = "xyes"; then
239   GST_CACHE_DIR=`pwd`
240 else
241   dnl ${localstatedir} points to PREFIX/var
242   GST_CACHE_DIR=${localstatedir}/cache/gstreamer
243 fi
244 AC_ARG_WITH(cachedir,
245 AC_HELP_STRING([--with-cachedir],[specify path to use for plugin and command completion registries]),
246 [case "${withval}" in
247   yes) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
248   no) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
249   *) GST_CACHE_DIR="${withval}" ;;
250 esac], 
251 [:]) dnl Default value
252
253 AS_AC_EXPAND(GST_CACHE_DIR, $GST_CACHE_DIR)
254 AC_MSG_NOTICE(Using $GST_CACHE_DIR as registry cache dir)
255
256
257 dnl building of tests
258 AC_ARG_ENABLE(tests,
259 AC_HELP_STRING([--disable-tests],[disable building test apps]),
260 [case "${enableval}" in
261   yes) BUILD_TESTS=yes ;;
262   no)  BUILD_TESTS=no ;;
263   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
264 esac], 
265 [BUILD_TESTS=yes]) dnl Default value
266 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
267
268 dnl tests known to fail
269 AC_ARG_ENABLE(failing-tests,
270 AC_HELP_STRING([--disable-failing-tests],[disable building tests known to fail]),
271 [case "${enableval}" in
272   yes) BUILD_FAILING_TESTS=yes ;;
273   no)  BUILD_FAILING_TESTS=no ;;
274   *) AC_MSG_ERROR(bad value ${enableval} for --disable-failing-tests) ;;
275 esac], 
276 [BUILD_FAILING_TESTS=no]) dnl Default value
277 AM_CONDITIONAL(BUILD_FAILING_TESTS, test "x$BUILD_FAILING_TESTS" = "xyes")
278 if test x$BUILD_FAILING_TESTS = xyes; then
279   AC_MSG_WARN([building tests known to fail, use --disable-failing-tests to disable])
280 else
281   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.])
282 fi
283
284 AC_ARG_ENABLE(examples,
285 AC_HELP_STRING([--disable-examples],[disable building examples]),
286 [case "${enableval}" in
287   yes) BUILD_EXAMPLES=yes ;;
288   no)  BUILD_EXAMPLES=no ;;
289   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
290 esac], 
291 [BUILD_EXAMPLES=yes]) dnl Default value
292 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
293
294 dnl Next, check for the optional components:
295 dnl ========================================
296
297 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true)
298 GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
299 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true)
300 GST_SUBSYSTEM_DISABLE(TYPEFIND,[typefind plugin],)
301 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_AUTOPLUG, true)
302 GST_SUBSYSTEM_DISABLE(AUTOPLUG,[autoplugger subsystem])
303 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true)
304 GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
305 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true)
306 GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
307 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true)
308 GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
309
310 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES"
311
312 dnl ################################################
313 dnl # Set defines according to variables set above #
314 dnl ################################################
315
316
317 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
318 dnl HAVE_ and it is likely to be easier to stick with the old name
319 if test "x$USE_LIBMMX" = xyes; then
320   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
321 fi
322
323 if test "x$USE_ATOMIC_H" = xyes; then
324   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
325 fi
326
327 dnl test if we have pthread_attr_setstack; if not use the older calls
328 AC_CHECK_LIB(pthread, pthread_attr_setstack, 
329    AC_DEFINE(HAVE_PTHREAD_ATTR_SETSTACK, 1, 
330              [Defined if libpthread has pthread_attr_setstack ()]))
331
332 dnl test if we have posix_memalign; FreeBSD doesn't
333 AC_CHECK_FUNC(posix_memalign,
334    AC_DEFINE(HAVE_POSIX_MEMALIGN, 1,
335              [Defined if we have posix_memalign ()]))
336
337 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
338   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
339 fi
340
341 if test "x$USE_DEBUG" = xyes; then
342    GST_INT_CFLAGS="$GST_INT_CFLAGS -g"
343 fi
344
345 if test "x$USE_PROFILING" = xyes; then
346 dnl  CFLAGS="$CFLAGS -pg -fprofile-arcs"
347   FOMIT_FRAME_POINTER=""
348 else
349   FOMIT_FRAME_POINTER="-fomit-frame-pointer"
350 fi
351
352 dnl
353 dnl AC_SUBST(FOMIT_FRAME_POINTER)
354 dnl
355
356 dnl #############################
357 dnl # Set automake conditionals #
358 dnl #############################
359
360 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
361 dnl HAVE_ and it is likely to be easier to stick with the old name
362 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
363
364 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
365 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
366
367 AM_CONDITIONAL(PLUGINS_USE_BUILDDIR,  test "x$PLUGINS_USE_BUILDDIR" = "xyes")
368
369
370 dnl ############################
371 dnl # Set up some more defines #
372 dnl ############################
373
374 dnl Set location of configuration dir.
375 AC_DEFINE_UNQUOTED(GST_CONFIG_DIR, "$GST_CONFIG_DIR", [Define the configuration directory])
376 AC_SUBST(GST_CONFIG_DIR)
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/gst
385 else
386   PLUGINS_DIR=${prefix}/lib/gst
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.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)
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-buildddir 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 AC_OUTPUT(
464 Makefile
465 include/Makefile
466 gst/Makefile
467 gst/gstversion.h
468 gst/autoplug/Makefile
469 gst/elements/Makefile
470 gst/parse/Makefile
471 gst/schedulers/Makefile
472 gst/types/Makefile
473 gst/registries/Makefile
474 libs/Makefile
475 libs/gst/Makefile
476 libs/gst/bytestream/Makefile
477 libs/gst/getbits/Makefile
478 libs/gst/putbits/Makefile
479 libs/gst/control/Makefile
480 libs/ext/Makefile
481 tests/Makefile
482 tests/bufspeed/Makefile
483 tests/memchunk/Makefile
484 tests/muxing/Makefile
485 tests/seeking/Makefile
486 tests/sched/Makefile
487 tests/threadstate/Makefile
488 testsuite/Makefile
489 testsuite/bytestream/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 )