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