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