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