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