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