added -Werror to compile flags.
[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, 3, 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 dnl required for compilation without warnings
97 GLIB2_REQ="2.0.1"
98 AC_SUBST(GLIB2_REQ)
99
100 dnl Check for glib2
101 PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQ gobject-2.0 gthread-2.0 gmodule-2.0,
102   HAVE_GLIB2=yes,HAVE_GLIB2=no)
103 GLIB_LIBS=$GLIB2_LIBS
104 GLIB_CFLAGS=$GLIB2_CFLAGS
105 AC_SUBST(GLIB_LIBS)
106 AC_SUBST(GLIB_CFLAGS)
107
108 if test "x$HAVE_GLIB2" = "xno"; then
109   AC_MSG_ERROR([GStreamer requires GLib 2.0 to compile.])
110 fi
111
112 GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
113 AC_SUBST(GST_PKG_DEPS)
114   
115 dnl === libxml 2 ===
116 dnl Minimum required version of libxml2
117 LIBXML2_REQ="2.4.0"
118 AC_SUBST(LIBXML2_REQ)
119
120 dnl check for libxml2
121 LIBXML_PKG=', libxml-2.0'
122 PKG_CHECK_MODULES(XML, libxml-2.0 >= $LIBXML2_REQ, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
123 if test "x$HAVE_LIBXML2" = "xyes"; then
124   AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 is available])
125 else
126   AC_MSG_ERROR([Need libxml2 for glib2 builds -- you should be able to do without it -- this needs fixing])
127 fi
128 AC_SUBST(LIBXML_PKG)
129 AC_SUBST(XML_LIBS)
130 AC_SUBST(XML_CFLAGS)
131
132 GST_CHECK_LIBHEADER(POPT, popt, poptStrippedArgv,, popt.h, POPT_LIBS="-lpopt",
133   AC_MSG_ERROR([popt 1.5 or newer is required to build gstreamer. You can
134 download the latest version from ftp://people.redhat.com/sopwith/popt/]))
135
136 dnl Check for atomic.h
137 dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
138 dnl defines the wrong default symbol as well (HAVE_ASM_ATOMIC_H)
139 AC_CHECK_HEADER(asm/atomic.h, HAVE_ATOMIC_H=yes, HAVE_ATOMIC_H=no)
140 dnl Do a compile to check that it has atomic_set (eg, linux 2.0 didn't)
141 if test x$HAVE_ATOMIC_H = xyes; then
142   AC_TRY_RUN([
143 #include "asm/atomic.h"
144 main() { atomic_t t; atomic_set(&t,0); atomic_inc(&t); atomic_add(1,&t);return 0;}
145   ],, [
146     # Not successful
147     if test x$HAVE_ATOMIC_H = xyes; then
148       AC_MSG_WARN(Atomic reference counting is out of date: doing without.)
149     fi
150     HAVE_ATOMIC_H=no
151   ], [
152     # Cross compiling
153     AC_MSG_RESULT(yes)
154     AC_MSG_WARN(Can't check properly for atomic reference counting.  Assuming OK.)
155   ])
156 fi
157
158 dnl ######################################################################
159 dnl # Check command line parameters, and set shell variables accordingly #
160 dnl ######################################################################
161
162 dnl FIXME: simplify all this down using a few m4 macros
163
164 AC_ARG_ENABLE(libmmx,
165 AC_HELP_STRING([--enable-libmmx][use libmmx, if available]),
166 [case "${enableval}" in
167   yes) USE_LIBMMX=$HAVE_LIBMMX ;;
168   no)  USE_LIBMMX=no ;;
169   *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmmx) ;;
170 esac], 
171 [USE_LIBMMX=$HAVE_LIBMMX]) dnl Default value
172
173 AC_ARG_ENABLE(atomic,
174 AC_HELP_STRING([--enable-atomic][use atomic reference counting header]),
175 [case "${enableval}" in
176   yes) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
177   noset) USE_ATOMIC_H=$HAVE_ATOMIC_H;;
178   no)  USE_ATOMIC_H=no;;
179   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
180 esac], 
181 [USE_ATOMIC_H=$HAVE_ATOMIC_H]) dnl Default value
182
183 AC_ARG_ENABLE(plugin-builddir,
184 AC_HELP_STRING([--enable-plugin-builddir][allow tests/demos to use non-installed plugins]),
185 [case "${enableval}" in
186   yes) PLUGINS_USE_BUILDDIR=yes ;;
187   no)  PLUGINS_USE_BUILDDIR=no ;;
188   *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugin-builddir) ;;
189 esac], 
190 [PLUGINS_USE_BUILDDIR=no]) dnl Default value
191
192 GST_DEBUGINFO
193
194 AC_ARG_ENABLE(profiling,
195 AC_HELP_STRING([--enable-profiling][adds -pg to compiler commandline, for profiling]),
196 [case "${enableval}" in
197   yes) USE_PROFILING=yes ;;
198   no)  UES_PROFILING=no ;;
199   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
200 esac], 
201 [USE_PROFILING=no]) dnl Default value
202
203 dnl default to building registry in the source tree if we are enabling plugin build dir
204 if test "x$PLUGINS_USE_BUILDDIR" = "xyes"; then
205   GST_CONFIG_DIR=`pwd`
206 else
207   GST_CONFIG_DIR=/etc/gstreamer
208 fi
209 AC_ARG_WITH(configdir,
210 AC_HELP_STRING([--with-configdir][specify path to use for plugin and command completion registries]),
211 [case "${withval}" in
212   yes) AC_MSG_ERROR(bad value ${withval} for --with-configdir) ;;
213   no) AC_MSG_ERROR(bad value ${withval} for --with-configdir) ;;
214   *) GST_CONFIG_DIR="${withval}" ;;
215 esac], 
216 [:]) dnl Default value
217
218 AC_ARG_ENABLE(tests,
219 AC_HELP_STRING([--disable-tests][disable building test apps]),
220 [case "${enableval}" in
221   yes) BUILD_TESTS=yes ;;
222   no)  BUILD_TESTS=no ;;
223   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
224 esac], 
225 [BUILD_TESTS=yes]) dnl Default value
226
227 AC_ARG_ENABLE(examples,
228 AC_HELP_STRING([--disable-examples][disable building examples]),
229 [case "${enableval}" in
230   yes) BUILD_EXAMPLES=yes ;;
231   no)  BUILD_EXAMPLES=no ;;
232   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
233 esac], 
234 [BUILD_EXAMPLES=yes]) dnl Default value
235
236 dnl Next, check for the optional components:
237 dnl ========================================
238
239 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_LOADSAVE, true)
240 GST_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
241 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TYPEFIND, true)
242 GST_SUBSYSTEM_DISABLE(TYPEFIND,[typefind plugin],)
243 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_AUTOPLUG, true)
244 GST_SUBSYSTEM_DISABLE(AUTOPLUG,[autoplugger subsystem])
245 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_PARSE, true)
246 GST_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
247 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_TRACE, true)
248 GST_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
249 translit(dnm, m, l) AM_CONDITIONAL(GST_DISABLE_REGISTRY, true)
250 GST_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
251
252 GST_EXT_CFLAGS="$GST_EXT_CFLAGS $GST_SUBSYSTEM_DISABLE_DEFINES"
253
254 dnl ################################################
255 dnl # Set defines according to variables set above #
256 dnl ################################################
257
258
259 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
260 dnl HAVE_ and it is likely to be easier to stick with the old name
261 if test "x$USE_LIBMMX" = xyes; then
262   AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available])
263 fi
264
265 if test "x$USE_ATOMIC_H" = xyes; then
266   AC_DEFINE(HAVE_ATOMIC_H, 1, [Define if atomic.h header file is available])
267 fi
268
269 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
270   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
271 fi
272
273 dnl if test "x$USE_DEBUG" = xyes; then
274 dnl   CFLAGS="$CFLAGS -g"
275 dnl fi
276
277 if test "x$USE_PROFILING" = xyes; then
278 dnl  CFLAGS="$CFLAGS -pg -fprofile-arcs"
279   FOMIT_FRAME_POINTER=""
280 else
281   FOMIT_FRAME_POINTER="-fomit-frame-pointer"
282 fi
283
284 dnl
285 dnl AC_SUBST(FOMIT_FRAME_POINTER)
286 dnl
287
288 dnl #############################
289 dnl # Set automake conditionals #
290 dnl #############################
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 AM_CONDITIONAL(HAVE_ATOMIC_H,       test "x$USE_ATOMIC_H" = "xyes")
295
296 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
297 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
298
299 AM_CONDITIONAL(HAVE_NASM,           test "x$HAVE_NASM" = "xyes")
300 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
301 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
302 AM_CONDITIONAL(PLUGINS_USE_BUILDDIR,  test "x$PLUGINS_USE_BUILDDIR" = "xyes")
303
304
305 dnl ############################
306 dnl # Set up some more defines #
307 dnl ############################
308
309 dnl Set location of configuration dir.
310 AC_DEFINE_UNQUOTED(GST_CONFIG_DIR, "$GST_CONFIG_DIR", [Define the configuration directory])
311 AC_SUBST(GST_CONFIG_DIR)
312
313 dnl Set location of plugin directory
314 if test "x${prefix}" = "xNONE"; then
315   PLUGINS_DIR=${ac_default_prefix}/lib/gst
316 else
317   PLUGINS_DIR=${prefix}/lib/gst
318 fi
319 AC_DEFINE_UNQUOTED(PLUGINS_DIR, "$PLUGINS_DIR", [Define the plugin directory])
320 AC_SUBST(PLUGINS_DIR)
321
322 dnl Set location of uninstalled plugin directory
323 PLUGINS_BUILDDIR=`pwd`
324 AC_DEFINE_UNQUOTED(PLUGINS_BUILDDIR, "$PLUGINS_BUILDDIR", [Define the uninstalled plugin directory])
325 AC_SUBST(PLUGINS_BUILDDIR)
326
327 dnl since glib and xml are package deps, there's no need to include their cflags
328 dnl in the pkg-config file
329
330 dnl for pkg-config
331 GST_PKG_CFLAGS=$GST_EXT_CFLAGS
332 GST_PKG_LIBS=$GST_EXT_LIBS
333 AC_SUBST(GST_PKG_CFLAGS)
334 AC_SUBST(GST_PKG_LIBS)
335
336 dnl finalize _CFLAGS and _LIBS
337 dnl add GLIB and XML if necessary to EXT_*
338 GST_CFLAGS="$GST_EXT_CFLAGS $XML_CFLAGS $GLIB_CFLAGS"
339 GST_LIBS="$GST_EXT_LIBS $XML_LIBS $GLIB_LIBS -lpopt"
340
341 dnl Private vars for libgst only
342 LIBGST_LIBS="$GST_LIBS"
343 LIBGST_CFLAGS="$GST_CFLAGS -I\$(top_srcdir) -Wall -Werror"
344 AC_SUBST(LIBGST_LIBS)
345 AC_SUBST(LIBGST_CFLAGS)
346
347 dnl Vars for everyone else
348 GST_INT_LIBS="\$(top_builddir)/gst/libgstreamer.la"
349 GST_INT_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir)/include"
350
351 AC_SUBST(GST_CFLAGS, "$LIBGST_CFLAGS $GST_INT_CFLAGS")
352 AC_SUBST(GST_LIBS, "$LIBGST_LIBS $GST_INT_LIBS")
353
354 GST_PLUGIN_LDFLAGS='-module -avoid-version'
355 AC_SUBST(GST_PLUGIN_LDFLAGS)
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/autoplug/Makefile
390 gst/elements/Makefile
391 gst/parse/Makefile
392 gst/schedulers/Makefile
393 gst/types/Makefile
394 libs/Makefile
395 libs/gst/Makefile
396 libs/gst/bytestream/Makefile
397 libs/gst/getbits/Makefile
398 libs/gst/putbits/Makefile
399 libs/gst/control/Makefile
400 libs/ext/Makefile
401 tests/Makefile
402 tests/bufspeed/Makefile
403 tests/memchunk/Makefile
404 tests/muxing/Makefile
405 tests/sched/Makefile
406 testsuite/Makefile
407 testsuite/bytestream/Makefile
408 testsuite/caps/Makefile
409 testsuite/cleanup/Makefile
410 testsuite/elements/Makefile
411 testsuite/plugin/Makefile
412 testsuite/dynparams/Makefile
413 examples/Makefile
414 examples/autoplug/Makefile
415 examples/helloworld/Makefile
416 examples/helloworld2/Makefile
417 examples/launch/Makefile
418 examples/queue/Makefile
419 examples/queue2/Makefile
420 examples/queue3/Makefile
421 examples/queue4/Makefile
422 examples/thread/Makefile
423 examples/mixer/Makefile
424 examples/cutter/Makefile
425 examples/launch/Makefile
426 examples/xml/Makefile
427 examples/plugins/Makefile
428 examples/typefind/Makefile
429 examples/mixer/Makefile
430 tools/Makefile
431 docs/Makefile
432 docs/gst/Makefile
433 docs/gst/gstreamer.types
434 docs/libs/Makefile
435 docs/plugins/Makefile
436 docs/plugins/gstreamer-plugins.types
437 docs/manual/Makefile
438 docs/fwg/Makefile
439 docs/xsl/Makefile
440 docs/devhelp/Makefile
441 stamp.h
442 gstreamer.pc
443 gstreamer-uninstalled.pc
444 gstreamer.spec,
445 echo "$infomessages", infomessages="$infomessages"
446 )