configure.ac: make GST_ERROR_CFLAGS overridable and re-enable Werror
[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, 9, 1, 1, GST_CVS="no", GST_CVS="yes")
7
8 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
9 AM_MAINTAINER_MODE
10 AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
11
12 dnl our libraries and install dirs use major.minor as a version
13 GST_MAJORMINOR=$GST_VERSION_MAJOR.$GST_VERSION_MINOR
14 dnl we override it here for release candidates for a new series
15 # GST_MAJORMINOR=0.9
16 AC_SUBST(GST_MAJORMINOR)
17
18 AC_PROG_CC
19 dnl For interactive UNIX (a Sun thing)
20 AC_ISC_POSIX
21
22 dnl CURRENT, REVISION, AGE
23 dnl - library source changed -> increment REVISION
24 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
25 dnl - interfaces added -> increment AGE
26 dnl - interfaces removed -> AGE = 0
27 AS_LIBTOOL(GST, 6, 0, 0)
28 AM_PROG_LIBTOOL
29
30 AC_CONFIG_SRCDIR([gst/gst.c])
31 AM_CONFIG_HEADER(config.h)
32
33 dnl Add parameters for aclocal
34 AC_SUBST(ACLOCAL_AMFLAGS, "-I common/m4 -I .")
35
36 AM_PROG_CC_STDC
37 AM_PROG_AS
38 AS="${CC}"
39
40 dnl the gettext stuff needed
41 AM_GNU_GETTEXT_VERSION(0.11.5)
42 AM_GNU_GETTEXT([external])
43
44 GETTEXT_PACKAGE=gstreamer-$GST_MAJORMINOR
45 AC_SUBST(GETTEXT_PACKAGE)
46 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE",
47                    [gettext package name])
48
49 dnl define LOCALEDIR in config.h
50 AS_AC_EXPAND(LOCALEDIR, $datadir/locale)
51 AC_DEFINE_UNQUOTED([LOCALEDIR], "$LOCALEDIR",
52                    [gettext locale dir])
53
54 dnl define LIBDIR so we can inform people where we live
55 AS_AC_EXPAND(LIBDIR, $libdir)
56 AC_DEFINE_UNQUOTED([LIBDIR], "$LIBDIR",
57                    [library dir])
58
59 dnl decide on error flags
60 dnl if we support -Wall, set it unconditionally
61 AS_COMPILER_FLAG(-Wall,
62                  GST_ERROR_CFLAGS="-Wall",
63                  GST_ERROR_CFLAGS="")
64 dnl if we're in nano >= 1, add -Werror if supported
65 if test "x$GST_CVS" = "xyes"
66 then
67   AS_COMPILER_FLAG(-Werror, GST_ERROR_CFLAGS="$GST_ERROR_CFLAGS -Werror")
68 fi
69 AC_SUBST(GST_ERROR_CFLAGS)
70
71 dnl We disable static building for development, for time savings
72 dnl *NOTE*: dnl this line before release, so release does static too
73 dnl AM_DISABLE_STATIC
74
75 AC_HEADER_STDC([])
76 AC_C_INLINE
77
78 dnl define correct errorlevel for debugging messages. We want to have GST_ERROR
79 dnl messages printed when running cvs builds
80 if test "x$GST_CVS" = "xyes"; then
81   AC_DEFINE(GST_LEVEL_DEFAULT, GST_LEVEL_ERROR, [Default errorlevel to use])
82 fi
83
84 dnl subsystems - can influence other decisions so needs to be high up
85 dnl we need to do AM_CONDITIONAL them here for automake 1.6.x compatibility
86 GST_CHECK_SUBSYSTEM_DISABLE(GST_DEBUG,[debugging subsystem])
87 AM_CONDITIONAL(GST_DISABLE_GST_DEBUG, test "x$GST_DISABLE_GST_DEBUG" = "xyes")
88 GST_CHECK_SUBSYSTEM_DISABLE(LOADSAVE,[pipeline XML load/save])
89 AM_CONDITIONAL(GST_DISABLE_LOADSAVE, test "x$GST_DISABLE_LOADSAVE" = "xyes")
90 GST_CHECK_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
91 AM_CONDITIONAL(GST_DISABLE_PARSE, test "x$GST_DISABLE_PARSE" = "xyes")
92 GST_CHECK_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
93 AM_CONDITIONAL(GST_DISABLE_TRACE, test "x$GST_DISABLE_TRACE" = "xyes")
94 GST_CHECK_SUBSYSTEM_DISABLE(ALLOC_TRACE,[allocation tracing])
95 AM_CONDITIONAL(GST_DISABLE_ALLOC_TRACE, test "x$GST_DISABLE_ALLOC_TRACE" = "xyes")
96 GST_CHECK_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
97 AM_CONDITIONAL(GST_DISABLE_REGISTRY, test "x$GST_DISABLE_REGISTRY" = "xyes")
98 GST_CHECK_SUBSYSTEM_DISABLE(ENUMTYPES,[enum types])
99 AM_CONDITIONAL(GST_DISABLE_ENUMTYPES, test "x$GST_DISABLE_ENUMTYPES" = "xyes")
100 GST_CHECK_SUBSYSTEM_DISABLE(INDEX,[index])
101 AM_CONDITIONAL(GST_DISABLE_INDEX, test "x$GST_DISABLE_INDEX" = "xyes")
102 GST_CHECK_SUBSYSTEM_DISABLE(PLUGIN,[plugin])
103 AM_CONDITIONAL(GST_DISABLE_PLUGIN, test "x$GST_DISABLE_PLUGIN" = "xyes")
104 GST_CHECK_SUBSYSTEM_DISABLE(URI,[uri handlers])
105 AM_CONDITIONAL(GST_DISABLE_URI, test "x$GST_DISABLE_URI" = "xyes")
106
107 dnl ##############################
108 dnl # Do automated configuration #
109 dnl ##############################
110
111 dnl Check for tools:
112 dnl ================
113
114 dnl allow for different autotools
115 AS_AUTOTOOLS_ALTERNATE()
116
117 dnl modify pkg-config path
118 AC_ARG_WITH(pkg-config-path, 
119    AC_HELP_STRING([--with-pkg-config-path],
120                   [colon-separated list of pkg-config(1) dirs]),
121    [export PKG_CONFIG_PATH=${withval}])
122
123 GST_DOC()
124 GST_ARCH()
125
126 dnl Perl is used in building documentation
127 AC_PATH_PROG(PERL_PATH, perl, no)
128 if test x$PERL_PATH = xno; then
129   AC_MSG_ERROR(Could not find perl)
130 fi
131
132 AC_PROG_AWK
133
134 dnl we require bison for building the parser
135 dnl FIXME: check if AC_PROG_YACC is suitable here
136 AC_PATH_PROG(BISON_PATH, bison, no)
137 if test x$BISON_PATH = xno; then
138   AC_MSG_ERROR(Could not find bison)
139 fi
140
141 dnl check bison version
142 AC_MSG_CHECKING([bison version])
143
144 if $BISON_PATH --version | head -n 1 | $AWK '{ if ($4 < 1.35) exit 1; else exit 0;}'; 
145 then 
146   AC_MSG_RESULT([ok])
147 else 
148   AC_MSG_RESULT([too old.])
149   AC_MSG_ERROR([Your bison version is too old, v1.35 or later is required.])
150 fi
151
152 dnl we require flex for building the parser
153 dnl FIXME: check if AC_PROG_LEX is suitable here
154 AC_PATH_PROG(FLEX_PATH, flex, no)
155 if test x$FLEX_PATH = xno; then
156   AC_MSG_ERROR(Could not find flex)
157 fi
158
159 dnl
160 dnl We should really use AC_SYS_LARGEFILE, but the problem is
161 dnl many of the plugins don't include "config.h".  To assure
162 dnl binary compatibility, it is necessary that all gstreamer
163 dnl code be compiled with the same sizeof(off_t), so we use
164 dnl the following crude hack.
165 dnl
166
167 AC_MSG_CHECKING(for large file support)
168 AC_TRY_RUN([
169 #define _LARGEFILE_SOURCE
170 #define _FILE_OFFSET_BITS 64
171 #include <sys/types.h>
172 int main () { return !(sizeof(off_t) == 8); }
173 ],
174 [
175   AC_MSG_RESULT(yes)
176   GST_PKG_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
177 ],
178 [
179   AC_MSG_RESULT(no)
180 ],
181 [
182   AC_MSG_RESULT(no)
183 ])
184
185 dnl check for mmap
186 AC_FUNC_MMAP()
187 if test "$ac_cv_func_mmap_fixed_mapped" = "yes" ; then
188   GST_DISABLE_OMEGA_COTHREADS=no
189 else
190   GST_DISABLE_OMEGA_COTHREADS=yes
191 fi
192 dnl for future --disabling, maybe.  Right now, it depends on HAVE_MMAP
193 AM_CONDITIONAL(GST_DISABLE_OMEGA_COTHREADS, test "x$GST_DISABLE_OMEGA_COTHREADS" = "xyes")
194
195 dnl check for makecontext and define HAVE_MAKECONTEXT if we have it
196 AC_CHECK_MCSC()
197 if test "$ac_cv_check_mcsc" = "yes"; then
198   AC_DEFINE_UNQUOTED(HAVE_MAKECONTEXT, $HAVE_MAKECONTEXT,
199                      [defined if we have makecontext ()])
200 fi
201
202 dnl Check for a way to display the function name in debug output
203 GST_CHECK_FUNCTION()
204
205 dnl check if we should use -Wa,-mregnames on PowerPC, so we can use
206 dnl symbolic register names in inline asm
207 if test x$HAVE_CPU_PPC = xyes ; then
208   AS_COMPILER_FLAG(["-Wa,-mregnames"],
209     [GST_INT_CFLAGS="$GST_INT_CFLAGS -Wa,-mregnames"],
210     true)
211 fi
212
213 AC_ARG_ENABLE(gcov,
214   AC_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),
215   enable_gcov=$enableval,enable_gcov=no)
216 if test x$enable_gcov = xyes ; then
217   AS_COMPILER_FLAG(["-fprofile-arcs"],
218     [GST_INT_CFLAGS="$GST_INT_CFLAGS -fprofile-arcs"],
219     true)
220   AS_COMPILER_FLAG(["-ftest-coverage"],
221     [GST_INT_CFLAGS="$GST_INT_CFLAGS -ftest-coverage"],
222     true)
223   GST_INT_CFLAGS=`echo "$GST_INT_CFLAGS" | sed -e 's/-O[0-9]*//g'`
224
225   AC_DEFINE_UNQUOTED(GST_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
226 fi
227 AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes)
228
229 dnl Check for some compiler flags that optimize our code.
230 if test "x$GCC" = xyes; then
231   AS_COMPILER_FLAG(-fno-common,GST_INT_CFLAGS="$GST_INT_CFLAGS -fno-common",)
232 fi
233
234 dnl HAVE_WIN32 currently means "disable POSIXisms".
235 case "$host" in
236   *-*-mingw*)
237     AC_DEFINE_UNQUOTED(HAVE_WIN32, 1, [Defined if compiling for Windows])
238     ;;
239   *)
240     ;;
241 esac
242
243 GST_UNALIGNED_ACCESS()
244 if test x${as_cv_unaligned_access} = xyes ; then
245   GST_HAVE_UNALIGNED_ACCESS_DEFINE="#define GST_HAVE_UNALIGNED_ACCESS 1"
246 else
247   GST_HAVE_UNALIGNED_ACCESS_DEFINE="#define GST_HAVE_UNALIGNED_ACCESS 0"
248 fi
249 AC_SUBST(GST_HAVE_UNALIGNED_ACCESS_DEFINE)
250
251 dnl Check for essential libraries first:
252 dnl ====================================
253
254 dnl === GLib 2 ===
255 dnl Minimum required version of GLib2
256 dnl required for compilation without warnings
257 GLIB2_REQ="2.4"
258 AC_SUBST(GLIB2_REQ)
259
260 dnl Check for glib2 with sugar on top
261 PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQ gobject-2.0 gthread-2.0 gmodule-2.0,HAVE_GLIB2=yes,HAVE_GLIB2=no)
262 dnl for the poor souls who for example have glib in /usr/local
263 AS_SCRUB_INCLUDE(GLIB2_CFLAGS)
264 GLIB_LIBS=$GLIB2_LIBS
265 GLIB_CFLAGS=$GLIB2_CFLAGS
266 AC_SUBST(GLIB_LIBS)
267 AC_SUBST(GLIB_CFLAGS)
268
269 if test "x$HAVE_GLIB2" = "xno"; then
270   AC_MSG_ERROR([GStreamer requires GLib $GLIB2_REQ to compile.])
271 fi
272
273 dnl Check for glib2 without extra fat, useful for the unversioned tool frontends
274 PKG_CHECK_MODULES(GLIB_ONLY, glib-2.0 >= $GLIB2_REQ)
275 AC_SUBST(GLIB_ONLY_CFLAGS)
276 AC_SUBST(GLIB_ONLY_LIBS)
277   
278 dnl === libxml 2 ===
279 if test "x$GST_DISABLE_LOADSAVE" = "xyes" && test "x$GST_DISABLE_REGISTRY" = "xyes"
280 then
281   AC_MSG_NOTICE([Registry and load/save are disabled, not checking for libxml2])
282 else
283   dnl check for libxml2 with minimum req version
284   GST_LIBXML2_CHECK(2.4.9)
285 fi
286
287 dnl popt checks
288 dnl FIXME: This test passes on popt 1.6.2, maybe earlier, but popt 1.6.2
289 dnl        causes segfaults on gst_init. Write a working test if possible.
290 GST_CHECK_LIBHEADER(POPT, popt, poptStrippedArgv,, popt.h, POPT_LIBS="-lpopt",
291   AC_MSG_ERROR([popt 1.6.3 or newer is required to build gstreamer. You can
292                 download the latest version from 
293                 ftp://ftp.rpm.org/pub/rpm/dist/])
294 )
295 AC_MSG_NOTICE(Checking for POPT_TABLEEND)
296 AC_COMPILE_IFELSE([
297 #include <popt.h>
298 int main ()
299 {
300 #ifndef POPT_TABLEEND
301 #error
302 #else
303   return 0;
304 #endif
305 }
306 ],, [
307   dnl it failed
308   AC_MSG_ERROR([popt 1.6.3 or newer is required to build gstreamer. You can
309                 download the latest version from 
310                 ftp://ftp.rpm.org/pub/rpm/dist/])
311 ])
312 AC_SUBST(POPT_CFLAGS)
313 AC_SUBST(POPT_LIBS)
314
315 dnl Check for ucontext.h
316 AC_CHECK_HEADER(ucontext.h, AC_DEFINE(HAVE_UCONTEXT_H, 1, [defined if we have ucontext.h]))
317
318 dnl check for "check", unit testing library/header
319 AM_PATH_CHECK(0.9.2, HAVE_CHECK=yes, HAVE_CHECK=no)
320 AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
321
322 dnl ######################################################################
323 dnl # Check command line parameters, and set shell variables accordingly #
324 dnl ######################################################################
325
326 dnl FIXME: simplify all this down using a few m4 macros
327
328 AC_ARG_ENABLE(fast-stack-trash,
329 AC_HELP_STRING([--enable-fast-stack-trash],[use fast memory allocator (i586 or above)]),
330 [case "${enableval}" in
331   yes) USE_FAST_STACK_TRASH=yes;;
332   noset) USE_FAST_STACK_TRASH=no;;
333   no)  USE_FAST_STACK_TRASH=no;;
334   *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic) ;;
335 esac], 
336 [USE_FAST_STACK_TRASH=yes]) dnl Default value
337
338 AC_ARG_ENABLE(plugin-builddir,
339 AC_HELP_STRING([--enable-plugin-builddir],[allow tests/demos to use non-installed plugins]),
340 [case "${enableval}" in
341   yes) PLUGINS_USE_BUILDDIR=yes ;;
342   no)  PLUGINS_USE_BUILDDIR=no ;;
343   *) AC_MSG_ERROR(bad value ${enableval} for --enable-plugin-builddir) ;;
344 esac], 
345 [PLUGINS_USE_BUILDDIR=no]) dnl Default value
346
347 AC_ARG_ENABLE(profiling,
348 AC_HELP_STRING([--enable-profiling],[adds -pg to compiler commandline, for profiling]),
349 [case "${enableval}" in
350   yes) USE_PROFILING=yes ;;
351   no)  USE_PROFILING=no ;;
352   *) AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
353 esac], 
354 [USE_PROFILING=no]) dnl Default value
355
356 dnl use a cache dir for storing element registry info.
357 dnl default to building registry in the source tree if we are enabling plugin build dir
358 if test "x$PLUGINS_USE_BUILDDIR" = "xyes"; then
359   GST_CACHE_DIR=`pwd`
360 else
361   dnl ${localstatedir} points to PREFIX/var
362   GST_CACHE_DIR=${localstatedir}/cache/gstreamer-$GST_MAJORMINOR
363 fi
364 AC_ARG_WITH(cachedir,
365 AC_HELP_STRING([--with-cachedir],[specify path to use for plugin and command completion registries]),
366 [case "${withval}" in
367   yes) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
368   no) AC_MSG_ERROR(bad value ${withval} for --with-cachedir) ;;
369   *) GST_CACHE_DIR="${withval}" ;;
370 esac], 
371 [:]) dnl Default value
372
373 AS_AC_EXPAND(GST_CACHE_DIR, $GST_CACHE_DIR)
374 AC_DEFINE_UNQUOTED(GST_CACHE_DIR, "$GST_CACHE_DIR", [Location of registry])
375 AC_MSG_NOTICE(Using $GST_CACHE_DIR as registry cache dir)
376
377 dnl building of tests
378 AC_ARG_ENABLE(tests,
379 AC_HELP_STRING([--disable-tests],[disable building test apps]),
380 [case "${enableval}" in
381   yes) BUILD_TESTS=yes ;;
382   no)  BUILD_TESTS=no ;;
383   *) AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
384 esac], 
385 [BUILD_TESTS=yes]) dnl Default value
386 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
387
388 dnl tests known to fail
389 AC_ARG_ENABLE(failing-tests,
390 AC_HELP_STRING([--disable-failing-tests],[disable building tests known to fail]),
391 [case "${enableval}" in
392   yes) BUILD_FAILING_TESTS=yes ;;
393   no)  BUILD_FAILING_TESTS=no ;;
394   *) AC_MSG_ERROR(bad value ${enableval} for --disable-failing-tests) ;;
395 esac], 
396 [BUILD_FAILING_TESTS=no]) dnl Default value
397 AM_CONDITIONAL(BUILD_FAILING_TESTS, test "x$BUILD_FAILING_TESTS" = "xyes")
398 if test x$BUILD_FAILING_TESTS = xyes; then
399   AC_MSG_WARN([building tests known to fail, use --disable-failing-tests to disable])
400 else
401   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.])
402 fi
403
404 AC_ARG_ENABLE(examples,
405 AC_HELP_STRING([--disable-examples],[disable building examples]),
406 [case "${enableval}" in
407   yes) BUILD_EXAMPLES=yes ;;
408   no)  BUILD_EXAMPLES=no ;;
409   *) AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
410 esac], 
411 [BUILD_EXAMPLES=yes]) dnl Default value
412 AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
413
414 dnl poison destroyed objects
415 AC_ARG_ENABLE(poisoning,
416 AC_HELP_STRING([--enable-poisoning],[enable poisoning of deallocated objects]),
417 [case "${enableval}" in
418   yes) USE_POISONING=yes ;;
419   no)  USE_POISONING=no ;;
420   *) AC_MSG_ERROR(bad value ${enableval} for --enable-poisoning) ;;
421 esac], 
422 [USE_POISONING=no]) dnl Default value
423
424 dnl Next, check for the optional components:
425 dnl ========================================
426
427 dnl debugging stuff
428 AC_ARG_ENABLE(debug,
429 AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]),
430 [case "${enableval}" in
431   yes) USE_DEBUG=yes ;;
432   no)  USE_DEBUG=no ;;
433   *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
434 esac],
435 [USE_DEBUG=yes]) dnl Default value
436
437 dnl valgrind inclusion
438 AC_ARG_ENABLE(valgrind,
439 AC_HELP_STRING([--disable-valgrind],[disable run-time valgrind detection]),
440 [case "${enableval}" in
441   yes) USE_VALGRIND="$USE_DEBUG" ;;
442   no)  USE_VALGRIND=no ;;
443   *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
444 esac],
445 [USE_VALGRIND="$USE_DEBUG"]) dnl Default value
446 VALGRIND_REQ="2.1"
447 if test "x$USE_VALGRIND" = xyes; then
448
449   PKG_CHECK_MODULES(VALGRIND, valgrind > $VALGRIND_REQ, USE_VALGRIND="yes", USE_VALGRIND="no")
450 fi
451 if test "x$USE_VALGRIND" = xyes; then
452   AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
453   AC_MSG_NOTICE(Using extra code paths for valgrind)
454 fi
455 AC_SUBST(VALGRIND_CFLAGS)
456 AC_SUBST(VALGRIND_LIBS)
457
458 dnl ################################################
459 dnl # Set defines according to variables set above #
460 dnl ################################################
461
462
463 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
464 dnl HAVE_ and it is likely to be easier to stick with the old name
465 if test "x$USE_FAST_STACK_TRASH" = xyes; then
466   AC_DEFINE(USE_FAST_STACK_TRASH, 1, [Define if we should use i586 optimized stack functions])
467 fi
468
469 if test "x$USE_POISONING" = xyes; then
470   AC_DEFINE(USE_POISONING, 1, [Define if we should poison deallocated memory])
471 fi
472
473 dnl test for sigaction()
474 AC_CHECK_FUNC(sigaction,
475    AC_DEFINE(HAVE_SIGACTION, 1,
476              [Defined if we have sigaction ()]))
477
478 dnl test for register_printf_function
479 AC_CHECK_FUNC(register_printf_function,
480   [
481     GST_PRINTF_EXTENSION_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
482     AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
483              [Defined if we have register_printf_function ()])
484   ],
485   GST_PRINTF_EXTENSION_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\""
486 )
487 AC_SUBST(GST_PRINTF_EXTENSION_FORMAT_DEFINE)
488
489 dnl test if we have dladdr(); we use it for debugging
490 save_cflags="$CFLAGS"
491 CFLAGS="$CFLAGS -D_GNU_SOURCE"
492 AC_CHECK_LIB(dl, dladdr,
493    AC_DEFINE(HAVE_DLADDR, 1,
494              [Defined if we have dladdr ()]))
495 CFLAGS="$save_cflags"
496
497 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
498   AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
499 fi
500
501 if test "x$USE_DEBUG" = xyes; then
502    GST_INT_CFLAGS="$GST_INT_CFLAGS -g"
503 fi
504
505 dnl #############################
506 dnl # Set automake conditionals #
507 dnl #############################
508
509 dnl These should be "USE_*" instead of "HAVE_*", but some packages expect
510 dnl HAVE_ and it is likely to be easier to stick with the old name
511 AM_CONDITIONAL(EXPERIMENTAL,        test "$EXPERIMENTAL" = "$xyes")
512 AM_CONDITIONAL(BROKEN,              test "$BROKEN" = "$xyes")
513 AM_CONDITIONAL(PLUGINS_USE_BUILDDIR,  test "x$PLUGINS_USE_BUILDDIR" = "xyes")
514
515
516 dnl ############################
517 dnl # Set up some more defines #
518 dnl ############################
519
520 dnl set license and copyright notice
521 AC_DEFINE(GST_LICENSE, "LGPL", [GStreamer license])
522
523 dnl package name in plugins
524 AC_ARG_WITH(package-name,
525 AC_HELP_STRING([--with-package-name],[specify package name to use in plugins]),
526 [case "${withval}" in
527   yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
528   no) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
529   *) GST_PACKAGE="${withval}" ;;
530 esac], 
531 [
532 dnl default value
533 if test "x$GST_CVS" = "xyes"
534 then
535   dnl nano >= 1
536   GST_PACKAGE="GStreamer CVS/prerelease"
537 else
538   GST_PACKAGE="GStreamer source release"
539 fi
540 ]
541 )
542 AC_MSG_NOTICE(Using $GST_PACKAGE as package name)
543 AC_DEFINE_UNQUOTED(GST_PACKAGE, "$GST_PACKAGE", [package name in plugins])
544
545 dnl package origin URL
546 AC_ARG_WITH(package-origin,
547 AC_HELP_STRING([--with-package-origin],[specify package origin URL to use in plugins]),
548 [case "${withval}" in
549   yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
550   no) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
551   *) GST_ORIGIN="${withval}" ;;
552 esac], 
553 [GST_ORIGIN="http://gstreamer.freedesktop.org/"]) dnl Default value
554 AC_MSG_NOTICE(Using $GST_ORIGIN as package origin)
555 AC_DEFINE_UNQUOTED(GST_ORIGIN, "$GST_ORIGIN", [package origin])
556
557 dnl Set location of plugin directory
558 AS_AC_EXPAND(PLUGINS_DIR, ${libdir}/gstreamer-$GST_MAJORMINOR)
559 AC_DEFINE_UNQUOTED(PLUGINS_DIR, "$PLUGINS_DIR", [Define the plugin directory])
560 AC_SUBST(PLUGINS_DIR)
561 AC_MSG_NOTICE([Using $PLUGINS_DIR as the plugin install location])
562
563 dnl Set location of uninstalled plugin directory
564 PLUGINS_BUILDDIR=`pwd`
565 AC_DEFINE_UNQUOTED(PLUGINS_BUILDDIR, "$PLUGINS_BUILDDIR", [Define the uninstalled plugin directory])
566 AC_SUBST(PLUGINS_BUILDDIR)
567
568 dnl LDFLAGS modifier defining exported symbols from built objects
569 EXPORT_LDFLAGS="-export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*"
570
571 dnl GST_PKG_*:    the flags we use that are also used
572 dnl               for external applications/.pc file
573 dnl GST_LIB_*:    used for the main library
574 dnl GST_OBJ_*:    the flags we use for all the objects internal to the core
575 dnl GST_PLUGIN_*: additional flags we use for all plugins
576
577 dnl finalize _CFLAGS and _LIBS
578 dnl flags exported for external applications and use in our pkg-config .pc files
579 dnl since glib and xml are package deps, there's no need to include their cflags
580 dnl in the pkg-config file
581
582 GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
583 AC_SUBST(GST_PKG_CFLAGS)
584 AC_SUBST(GST_PKG_LIBS)
585 AC_SUBST(GST_PKG_DEPS)
586
587 dnl flags shared for all internal objects (core libs, elements, applications)
588 dnl we disable deprecated internally
589 dnl XML, GLib, popt, GST_INT, VALGRIND, and the right include for CFLAGS
590 dnl no need to add XML, GLib, popt explicitly since libgstreamer pulls them in
591 GST_INT_CFLAGS="$GLIB_CFLAGS $XML_CFLAGS $GST_PKG_CFLAGS \
592  $GST_INT_CFLAGS \$(GST_ERROR_CFLAGS) -DGST_DISABLE_DEPRECATED"
593
594 dnl Private vars for libgst only
595 GST_LIB_CFLAGS="$GST_PKG_CFLAGS $GST_INT_CFLAGS \
596   $VALGRIND_CFLAGS -I\$(top_srcdir)"
597 GST_LIB_LIBS="$XML_LIBS $GLIB_LIBS -lpopt $GST_PKG_LIBS $LTLIBINTL $VALGRIND_LIBS"
598 GST_LIB_LDFLAGS="$GST_LT_LDFLAGS -version-info $GST_LIBVERSION -no-undefined $EXPORT_LDFLAGS"
599 AC_SUBST(GST_LIB_CFLAGS)
600 AC_SUBST(GST_LIB_LIBS)
601 AC_SUBST(GST_LIB_LDFLAGS)
602
603 dnl Vars for all internal objects built on libgstreamer
604 GST_OBJ_CFLAGS="$GST_INT_CFLAGS -I\$(top_srcdir)/libs -I\$(top_srcdir)"
605 GST_OBJ_LIBS="\$(top_builddir)/gst/libgstreamer-$GST_MAJORMINOR.la"
606
607 AC_SUBST(GST_OBJ_CFLAGS, "$GST_OBJ_CFLAGS")
608 AC_SUBST(GST_OBJ_LIBS, "$GST_OBJ_LIBS")
609
610 dnl specific additional LDFLAGS for plugins
611 GST_PLUGIN_LDFLAGS="-module -avoid-version $EXPORT_LDFLAGS"
612 AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS")
613
614 plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
615 AC_SUBST(plugindir)
616
617 dnl ##################################################
618 dnl # deps for examples from manual                  #
619 dnl ##################################################
620
621 PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0,
622                   HAVE_LIBGNOMEUI="yes", HAVE_LIBGNOMEUI="no")
623 AC_SUBST(LIBGNOMEUI_CFLAGS)
624 AC_SUBST(LIBGNOMEUI_LIBS)
625 AM_CONDITIONAL(HAVE_LIBGNOMEUI, test "x$HAVE_LIBGNOMEUI" = "xyes")
626
627 dnl ##################################################
628 dnl # Prepare informative messages to display at end #
629 dnl ##################################################
630
631 infomessages=
632
633 if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
634   infomessages="$infomessages
635 *** Warning: You have configured using the --enable-plugin-builddir option.
636
637 This option is for development purposes only: binaries built with
638 it should be used with code in the build tree only.  To build an
639 installable version, use ./configure without the --enable-plugin-builddir
640 option.  Note that the autogen.sh script supplies the plugin builddir
641 option automatically -- run ./autogen.sh -- --disable-plugin-builddir to make
642 an installable build.
643
644 "
645 fi
646
647 dnl #########################
648 dnl # Make the output files #
649 dnl #########################
650
651 dnl libs/ext/Makefile
652 dnl nothing there yet !
653 AC_OUTPUT(
654 Makefile
655 include/Makefile
656 gst/Makefile
657 gst/gstconfig.h
658 gst/gstversion.h
659 gst/base/Makefile
660 gst/indexers/Makefile
661 gst/elements/Makefile
662 gst/parse/Makefile
663 gst/schedulers/Makefile
664 gst/registries/Makefile
665 libs/Makefile
666 libs/gst/Makefile
667 libs/gst/control/Makefile
668 libs/gst/dataprotocol/Makefile
669 libs/gst/getbits/Makefile
670 po/Makefile.in
671 check/Makefile
672 tests/Makefile
673 tests/instantiate/Makefile
674 tests/memchunk/Makefile
675 tests/muxing/Makefile
676 tests/seeking/Makefile
677 tests/sched/Makefile
678 tests/threadstate/Makefile
679 testsuite/Makefile
680 testsuite/bytestream/Makefile
681 testsuite/caps/Makefile
682 testsuite/cleanup/Makefile
683 testsuite/debug/Makefile
684 testsuite/dlopen/Makefile
685 testsuite/dynparams/Makefile
686 testsuite/elements/Makefile
687 testsuite/indexers/Makefile
688 testsuite/negotiation/Makefile
689 testsuite/pad/Makefile
690 testsuite/parse/Makefile
691 testsuite/plugin/Makefile
692 testsuite/refcounting/Makefile
693 testsuite/schedulers/Makefile
694 testsuite/states/Makefile
695 testsuite/threads/Makefile
696 testsuite/trigger/Makefile
697 examples/Makefile
698 examples/cutter/Makefile
699 examples/helloworld/Makefile
700 examples/launch/Makefile
701 examples/manual/Makefile
702 examples/mixer/Makefile
703 examples/pingpong/Makefile
704 examples/plugins/Makefile
705 examples/pwg/Makefile
706 examples/queue/Makefile
707 examples/retag/Makefile
708 examples/thread/Makefile
709 examples/typefind/Makefile
710 examples/xml/Makefile
711 tools/Makefile
712 common/Makefile
713 common/m4/Makefile
714 docs/Makefile
715 docs/faq/Makefile
716 docs/gst/Makefile
717 docs/libs/Makefile
718 docs/manual/Makefile
719 docs/plugins/Makefile
720 docs/plugins/gstreamer-plugins.types
721 docs/pwg/Makefile
722 docs/xsl/Makefile
723 docs/version.entities
724 pkgconfig/Makefile
725 stamp.h
726 pkgconfig/gstreamer.pc
727 pkgconfig/gstreamer-uninstalled.pc
728 pkgconfig/gstreamer-base.pc
729 pkgconfig/gstreamer-base-uninstalled.pc
730 pkgconfig/gstreamer-control.pc
731 pkgconfig/gstreamer-control-uninstalled.pc
732 pkgconfig/gstreamer-dataprotocol.pc
733 pkgconfig/gstreamer-dataprotocol-uninstalled.pc
734 gstreamer.spec,
735 echo "$infomessages", infomessages="$infomessages"
736 )