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