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