added changelog
[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 === GLib 2 ===
95 dnl Minimum required version of GLib2
96 GLIB2_REQ="1.3.12"
97 AC_SUBST(GLIB2_REQ)
98
99 dnl Check for glib2
100 PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQ gobject-2.0 gthread-2.0 gmodule-2.0,
101   HAVE_GLIB2=yes,HAVE_GLIB2=no)
102 GLIB_LIBS=$GLIB2_LIBS
103 GLIB_CFLAGS=$GLIB2_CFLAGS
104 AC_SUBST(GLIB_LIBS)
105 AC_SUBST(GLIB_CFLAGS)
106
107 if test "x$HAVE_GLIB2" = "xno"; then
108   AC_MSG_ERROR([GStreamer requires GLib 2.0 to compile.])
109 fi
110
111 GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
112 AC_SUBST(GST_PKG_DEPS)
113   
114 dnl === libxml 2 ===
115 dnl Minimum required version of libxml2
116 LIBXML2_REQ="2.4.0"
117 AC_SUBST(LIBXML2_REQ)
118
119 dnl check for libxml2
120 LIBXML_PKG=', libxml-2.0'
121 PKG_CHECK_MODULES(XML, libxml-2.0 >= $LIBXML2_REQ, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
122 if test "x$HAVE_LIBXML2" = "xyes"; then
123   AC_DEFINE(HAVE_LIBXML2)
124 else
125   AC_MSG_ERROR([Need libxml2 for glib2 builds -- you should be able to do without it -- this needs fixing])
126 fi
127 AC_SUBST(LIBXML_PKG)
128 AC_SUBST(XML_LIBS)
129 AC_SUBST(XML_CFLAGS)
130
131 GST_CHECK_LIBHEADER(POPT, popt, poptStrippedArgv,, popt.h, POPT_LIBS="-lpopt",
132   AC_MSG_ERROR([popt 1.5 or newer is required to build gstreamer. You can
133 download the latest version from ftp://people.redhat.com/sopwith/popt/]))
134
135 dnl Check for atomic.h
136 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
137 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
138 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
139 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
140 if test x$HAVE_ATOMIC_H = xyes; then
141   AC_TRY_RUN([
142 #include "asm/atomic.h"
143 main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
144   ],, [
145     # Not successful
146     if test x$HAVE_ATOMIC_H = xyes; then
147       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
148     fi
149     HAVE_ATOMIC_H=no
150   ], [
151     # Cross compiling
152     AC_MSG_RESULT(yes)
153     AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
154   ])
155 fi
156
157 dnl ==========================================================================
158 dnl ============================= gst plugins ================================
159 dnl ==========================================================================
160 GST_PLUGIN_LDFLAGS='-module -avoid-version'
161 AC_SUBST(GST_PLUGIN_LDFLAGS)
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=/etc/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 AC_ARG_ENABLE(tests,
224 AC_HELP_STRING([--disable-tests][disable building test apps]),
225 [case "${enableval}" in
226   yes) BUILD_TESTS=yes ;;
227   no)  BUILD_TESTS=no ;;
228   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
229 esac], 
230 [BUILD_TESTS=yes]) dnl Default value
231
232 AC_ARG_ENABLE(examples,
233 AC_HELP_STRING([--disable-examples][disable building examples]),
234 [case "${enableval}" in
235   yes) BUILD_EXAMPLES=yes ;;
236   no)  BUILD_EXAMPLES=no ;;
237   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
238 esac], 
239 [BUILD_EXAMPLES=yes]) dnl Default value
240
241 dnl Next, check for the optional components:
242 dnl ========================================
243
244 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true)
245 GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
246 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true)
247 GST_SUBSYSTEM_DISABLE(TYPEFIND,[typefind plugin],)
248 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_AUTOPLUG, true)
249 GST_SUBSYSTEM_DISABLE(AUTOPLUG,[autoplugger subsystem])
250 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true)
251 GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
252 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true)
253 GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
254 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true)
255 GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
256
257 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES"
258
259 dnl ################################################
260 dnl # Set defines according to variables set above #
261 dnl ################################################
262
263
264 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
265 dnl HAVE_ and it is likely to be easier to stick with the old name
266 if test "x$USE_LIBMMX" = xyes; then
267   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
268 fi
269
270 if test "x$USE_ATOMIC_H" = xyes; then
271   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
272 fi
273
274 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
275   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
276 fi
277
278 dnl if test "x$USE_DEBUG" = xyes; then
279 dnl   CFLAGS="$CFLAGS -g"
280 dnl fi
281
282 if test "x$USE_PROFILING" = xyes; then
283 dnl  CFLAGS="$CFLAGS -pg -fprofile-arcs"
284   FOMIT_FRAME_POINTER=""
285 else
286   FOMIT_FRAME_POINTER="-fomit-frame-pointer"
287 fi
288
289 dnl
290 dnl AC_SUBST(FOMIT_FRAME_POINTER)
291 dnl
292
293 dnl #############################
294 dnl # Set automake conditionals #
295 dnl #############################
296
297 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
298 dnl HAVE_ and it is likely to be easier to stick with the old name
299 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
300
301 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
302 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
303
304 AM_CONDITIONAL(HAVE_NASM,           test "x$HAVE_NASM" = "xyes")
305 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
306 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
307 AM_CONDITIONAL(PLUGINS_USE_BUILDDIR,  test "x$PLUGINS_USE_BUILDDIR" = "xyes")
308
309
310 dnl ############################
311 dnl # Set up some more defines #
312 dnl ############################
313
314 dnl Set location of configuration dir.
315 AC_DEFINE_UNQUOTED(GST_CONFIG_DIR,"$GST_CONFIG_DIR")
316 AC_SUBST(GST_CONFIG_DIR)
317
318 dnl Set location of plugin directory
319 if test "x${prefix}" = "xNONE"; then
320   PLUGINS_DIR=${ac_default_prefix}/lib/gst
321 else
322   PLUGINS_DIR=${prefix}/lib/gst
323 fi
324 AC_DEFINE_UNQUOTED(PLUGINS_DIR,"$PLUGINS_DIR")
325 AC_SUBST(PLUGINS_DIR)
326
327 dnl Set location of uninstalled plugin directory
328 PLUGINS_BUILDDIR=`pwd`
329 AC_DEFINE_UNQUOTED(PLUGINS_BUILDDIR,"$PLUGINS_BUILDDIR")
330 AC_SUBST(PLUGINS_BUILDDIR)
331
332 dnl since glib and xml are package deps, there's no need to include their cflags
333 dnl in the pkg-config file
334
335 dnl for pkg-config
336 GST_PKG_CFLAGS=$GST_EXT_CFLAGS
337 GST_PKG_LIBS=$GST_EXT_LIBS
338 AC_SUBST(GST_PKG_CFLAGS)
339 AC_SUBST(GST_PKG_LIBS)
340
341 dnl finalize _CFLAGS and _LIBS
342 dnl add GLIB and XML if necessary to EXT_*
343 GST_CFLAGS="$GST_EXT_CFLAGS $XML_CFLAGS $GLIB_CFLAGS"
344 GST_LIBS="$GST_EXT_LIBS $XML_LIBS $GLIB_LIBS -lpopt"
345
346 dnl Private vars for libgst only
347 LIBGST_LIBS="$GST_LIBS"
348 LIBGST_CFLAGS="$GST_CFLAGS -I\$(top_srcdir) -Wall"
349 AC_SUBST(LIBGST_LIBS)
350 AC_SUBST(LIBGST_CFLAGS)
351
352 dnl Vars for everyone else
353 GST_INT_LIBS="\$(top_builddir)/gst/libgstreamer.la"
354 GST_INT_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir)/include"
355
356 AC_SUBST(GST_CFLAGS, "$LIBGST_CFLAGS $GST_INT_CFLAGS")
357 AC_SUBST(GST_LIBS, "$LIBGST_LIBS $GST_INT_LIBS")
358
359 AC_CONFIG_SUBDIRS(libs/ext/cothreads)
360
361 dnl ##################################################
362 dnl # Prepare informative messages to display at end #
363 dnl ##################################################
364
365 infomessages=
366
367 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
368   infomessages="$infomessages
369 *** Warning: You have configured using the --enable-plugin-builddir option.
370
371 This option is for development purposes only: binaries built with
372 it should be used with code in the build tree only.  To build an
373 installable version, use ./configure without the --enable-plugin-builddir
374 option.  Note that the autogen.sh script supplies the plugin builddir
375 option automatically -- run ./autogen.sh --disable-plugin-buildddir to make
376 an installable build.
377
378 "
379 fi
380
381 dnl #########################
382 dnl # Make the output files #
383 dnl #########################
384
385 dnl libs/ext/Makefile
386 AC_OUTPUT(
387 Makefile
388 include/Makefile
389 gst/Makefile
390 gst/gstversion.h
391 gst/types/Makefile
392 gst/elements/Makefile
393 gst/autoplug/Makefile
394 gst/schedulers/Makefile
395 libs/Makefile
396 libs/gst/Makefile
397 libs/gst/bytestream/Makefile
398 libs/gst/getbits/Makefile
399 libs/gst/putbits/Makefile
400 libs/gst/control/Makefile
401 libs/ext/Makefile
402 tests/Makefile
403 tests/bufspeed/Makefile
404 tests/memchunk/Makefile
405 tests/muxing/Makefile
406 tests/sched/Makefile
407 testsuite/Makefile
408 testsuite/bytestream/Makefile
409 testsuite/caps/Makefile
410 testsuite/cleanup/Makefile
411 testsuite/elements/Makefile
412 testsuite/plugin/Makefile
413 testsuite/dynparams/Makefile
414 examples/Makefile
415 examples/autoplug/Makefile
416 examples/helloworld/Makefile
417 examples/helloworld2/Makefile
418 examples/launch/Makefile
419 examples/queue/Makefile
420 examples/queue2/Makefile
421 examples/queue3/Makefile
422 examples/queue4/Makefile
423 examples/thread/Makefile
424 examples/mixer/Makefile
425 examples/cutter/Makefile
426 examples/launch/Makefile
427 examples/xml/Makefile
428 examples/plugins/Makefile
429 examples/typefind/Makefile
430 examples/mixer/Makefile
431 tools/Makefile
432 docs/Makefile
433 docs/gst/Makefile
434 docs/gst/gstreamer.types
435 docs/libs/Makefile
436 docs/plugins/Makefile
437 docs/plugins/gstreamer-plugins.types
438 docs/manual/Makefile
439 docs/fwg/Makefile
440 docs/xsl/Makefile
441 docs/devhelp/Makefile
442 stamp.h
443 gstreamer.pc
444 gstreamer-uninstalled.pc
445 gstreamer.spec,
446 echo "$infomessages", infomessages="$infomessages"
447 )