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