more cleanups
[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 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="cat m4/*.m4 >acinclude.m4;$ACLOCAL $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 dnl Check for atomic.h
121 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
122 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
123 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
124 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
125 if test x$HAVE_ATOMIC_H = xyes; then
126   AC_TRY_RUN([
127 #include "asm/atomic.h"
128 main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
129   ],, [
130     # Not successful
131     if test x$HAVE_ATOMIC_H = xyes; then
132       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
133     fi
134     HAVE_ATOMIC_H=no
135   ], [
136     # Cross compiling
137     AC_MSG_RESULT(yes)
138     AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
139   ])
140 fi
141
142 dnl ==========================================================================
143 dnl ============================= gst plugins ================================
144 dnl ==========================================================================
145 GST_PLUGIN_LDFLAGS='-module -avoid-version'
146 AC_SUBST(GST_PLUGIN_LDFLAGS)
147
148 dnl ######################################################################
149 dnl # Check command line parameters, and set shell variables accordingly #
150 dnl ######################################################################
151
152 dnl FIXME: simplify all this down using a few m4 macros
153
154 AC_ARG_ENABLE(libmmx,
155 AC_HELP_STRING([--enable-libmmx][use libmmx, if available]),
156 [case "${enableval}" in
157   yes) USE_LIBMMX=$HAVE_LIBMMX ;;
158   no)  USE_LIBMMX=no ;;
159   *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmmx) ;;
160 esac], 
161 [USE_LIBMMX=$HAVE_LIBMMX]) dnl Default value
162
163 AC_ARG_ENABLE(atomic,
164 AC_HELP_STRING([--enable-atomic][use atomic reference counting header]),
165 [case "${enableval}" in
166   yes) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
167   noset) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
168   no)  USE_ATOMIC_H=no;;
169   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
170 esac], 
171 [USE_ATOMIC_H=$HAVE_ATOMIC_H]) dnl Default value
172
173 AC_ARG_ENABLE(plugin-builddir,
174 AC_HELP_STRING([--enable-plugin-builddir][allow tests/demos to use non-installed plugins]),
175 [case "${enableval}" in
176   yes) PLUGINS_USE_BUILDDIR=yes ;;
177   no)  PLUGINS_USE_BUILDDIR=no ;;
178   *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugin-builddir) ;;
179 esac], 
180 [PLUGINS_USE_BUILDDIR=no]) dnl Default value
181
182 AC_ARG_ENABLE(debug,
183 AC_HELP_STRING([--disable-debug][disable addition of -g debugging info]),
184 [case "${enableval}" in
185   yes) USE_DEBUG=yes ;;
186   no)  USE_DEBUG=no ;;
187   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
188 esac], 
189 [USE_DEBUG=yes]) dnl Default value
190
191 AC_ARG_ENABLE(DEBUG,
192 AC_HELP_STRING([--disable-DEBUG][disables compilation of debugging messages]),
193 [case "${enableval}" in
194   yes) ENABLE_DEBUG=yes ;;
195   no)  ENABLE_DEBUG=no ;;
196   *) AC_MSG_ERROR(bad value ${enableval} for --enable-DEBUG) ;;
197 esac], 
198 [ENABLE_DEBUG=yes]) dnl Default value
199 if test x$ENABLE_DEBUG = xyes; then
200   AC_DEFINE(GST_DEBUG_ENABLED, 1, [Define if DEBUG statements should be compiled in])
201 fi
202
203 AC_ARG_ENABLE(INFO,
204 AC_HELP_STRING([--disable-INFO][disables compilation of informational messages]),
205 [case "${enableval}" in
206   yes) ENABLE_INFO=yes ;;
207   no)  ENABLE_INFO=no ;;
208   *) AC_MSG_ERROR(bad value ${enableval} for --enable-INFO) ;;
209 esac], 
210 [ENABLE_INFO=yes]) dnl Default value
211 if test x$ENABLE_INFO = xyes; then
212   AC_DEFINE(GST_INFO_ENABLED, 1, [Define if INFO statements should be compiled in])
213 fi
214
215 AC_ARG_ENABLE(debug-color,
216 AC_HELP_STRING([--disable-debug-color][disables color output of DEBUG and INFO output]),
217 [case "${enableval}" in
218   yes) ENABLE_DEBUG_COLOR=yes ;;
219   no)  ENABLE_DEBUG_COLOR=no ;;
220   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-color) ;;
221 esac], 
222 [ENABLE_DEBUG_COLOR=yes]) dnl Default value
223 if test "x$ENABLE_DEBUG_COLOR" = xyes; then
224   AC_DEFINE(GST_DEBUG_COLOR, 1, [Define if debugging messages should be colorized])
225 fi
226
227 AC_ARG_ENABLE(profiling,
228 AC_HELP_STRING([--enable-profiling][adds -pg to compiler commandline, for profiling]),
229 [case "${enableval}" in
230   yes) USE_PROFILING=yes ;;
231   no)  UES_PROFILING=no ;;
232   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
233 esac], 
234 [USE_PROFILING=no]) dnl Default value
235
236 dnl default to building registry in the source tree if we are enabling plugin build dir
237 if test "x$PLUGINS_USE_BUILDDIR" = "xyes"; then
238   GST_CONFIG_DIR=`pwd`
239 else
240   GST_CONFIG_DIR=/etc/gstreamer
241 fi
242 AC_ARG_WITH(configdir,
243 AC_HELP_STRING([--with-configdir][specify path to use for plugin and command completion registries]),
244 [case "${withval}" in
245   yes) AC_MSG_ERROR(bad value ${withval} for --with-configdir) ;;
246   no) AC_MSG_ERROR(bad value ${withval} for --with-configdir) ;;
247   *) GST_CONFIG_DIR="${withval}" ;;
248 esac], 
249 [:]) dnl Default value
250
251 AC_ARG_ENABLE(tests,
252 AC_HELP_STRING([--disable-tests][disable building test apps]),
253 [case "${enableval}" in
254   yes) BUILD_TESTS=yes ;;
255   no)  BUILD_TESTS=no ;;
256   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
257 esac], 
258 [BUILD_TESTS=yes]) dnl Default value
259
260 AC_ARG_ENABLE(examples,
261 AC_HELP_STRING([--disable-examples][disable building examples]),
262 [case "${enableval}" in
263   yes) BUILD_EXAMPLES=yes ;;
264   no)  BUILD_EXAMPLES=no ;;
265   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
266 esac], 
267 [BUILD_EXAMPLES=yes]) dnl Default value
268
269 dnl Next, check for the optional components:
270 dnl ========================================
271
272 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true)
273 GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
274 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true)
275 GST_SUBSYSTEM_DISABLE(TYPEFIND,[typefind plugin],)
276 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_AUTOPLUG, true)
277 GST_SUBSYSTEM_DISABLE(AUTOPLUG,[autoplugger subsystem])
278 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true)
279 GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
280 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true)
281 GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
282 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true)
283 GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
284
285 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES"
286
287 dnl ################################################
288 dnl # Set defines according to variables set above #
289 dnl ################################################
290
291
292 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
293 dnl HAVE_ and it is likely to be easier to stick with the old name
294 if test "x$USE_LIBMMX" = xyes; then
295   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
296 fi
297
298 if test "x$USE_ATOMIC_H" = xyes; then
299   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
300 fi
301
302 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
303   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
304 fi
305
306 dnl if test "x$USE_DEBUG" = xyes; then
307 dnl   CFLAGS="$CFLAGS -g"
308 dnl fi
309
310 if test "x$USE_PROFILING" = xyes; then
311 dnl  CFLAGS="$CFLAGS -pg -fprofile-arcs"
312   FOMIT_FRAME_POINTER=""
313 else
314   FOMIT_FRAME_POINTER="-fomit-frame-pointer"
315 fi
316
317 dnl
318 dnl AC_SUBST(FOMIT_FRAME_POINTER)
319 dnl
320
321 dnl #############################
322 dnl # Set automake conditionals #
323 dnl #############################
324
325 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
326 dnl HAVE_ and it is likely to be easier to stick with the old name
327 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
328
329 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
330 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
331
332 AM_CONDITIONAL(HAVE_NASM,           test "x$HAVE_NASM" = "xyes")
333 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
334 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "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")
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")
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")
358 AC_SUBST(PLUGINS_BUILDDIR)
359
360 dnl finalize _CFLAGS and _LIBS
361 dnl add GLIB and XML if necessary to EXT_*
362 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $XML_CFLAGS $GLIB_CFLAGS"
363 GST_EXT_LIBS="$GST_EXT_LIBS $XML_LIBS $GLIB_LIBS"
364
365 dnl for pkg-config
366 GST_PKG_CFLAGS=$GST_EXT_CFLAGS
367 GST_PKG_LIBS=$GST_EXT_LIBS
368 AC_SUBST(GST_PKG_CFLAGS)
369 AC_SUBST(GST_PKG_LIBS)
370
371 dnl Private vars for libgst only
372 LIBGST_LIBS="$GST_EXT_LIBS"
373 LIBGST_CFLAGS="$GST_EXT_CFLAGS -I\$(top_srcdir)"
374 AC_SUBST(LIBGST_LIBS)
375 AC_SUBST(LIBGST_CFLAGS)
376
377 dnl Vars for everyone else
378 GST_INT_LIBS="\$(top_builddir)/gst/libgst.la"
379 GST_INT_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir)/include -I\$(top_srcdir) -Wall"
380
381 AC_SUBST(GST_CFLAGS, "$GST_EXT_CFLAGS $GST_INT_CFLAGS")
382 AC_SUBST(GST_LIBS, "$GST_EXT_LIBS $GST_INT_LIBS")
383
384 dnl AC_CONFIG_SUBDIRS(gst/cothreads)
385
386 dnl ##################################################
387 dnl # Prepare informative messages to display at end #
388 dnl ##################################################
389
390 infomessages=
391
392 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
393   infomessages="$infomessages
394 *** Warning: You have configured using the --enable-plugin-builddir option.
395
396 This option is for development purposes only: binaries built with
397 it should be used with code in the build tree only.  To build an
398 installable version, use ./configure without the --enable-plugin-builddir
399 option.  Note that the autogen.sh script supplies the plugin builddir
400 option automatically -- run ./autogen.sh --disable-plugin-buildddir to make
401 an installable build.
402
403 "
404 fi
405
406 dnl #########################
407 dnl # Make the output files #
408 dnl #########################
409
410 dnl libs/ext/Makefile
411 AC_OUTPUT(
412 Makefile
413 include/Makefile
414 m4/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 )