gstreamer-1.0.pc: move gmodule-no-export-2.0 dependency to Requires.private
[platform/upstream/gstreamer.git] / configure.ac
1 AC_PREREQ([2.68])
2
3 dnl initialize autoconf
4 dnl when going to/from release please set the nano (fourth number) right !
5 dnl releases only do Wall, git and prerelease does Werror too
6 dnl
7 AC_INIT([GStreamer],[1.1.0.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],[gstreamer])
8 AG_GST_INIT
9
10 dnl initialize automake (we require GNU make)
11 AM_INIT_AUTOMAKE([-Wno-portability 1.11 no-dist-gzip dist-xz tar-ustar])
12
13 dnl define PACKAGE_VERSION_* variables
14 AS_VERSION
15
16 dnl check if this is a release version
17 AS_NANO(GST_GIT="no", GST_GIT="yes")
18
19 dnl can autoconf find the source ?
20 AC_CONFIG_SRCDIR([gst/gst.c])
21
22 dnl define the output header for config
23 AM_CONFIG_HEADER([config.h])
24
25 dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
26 AM_MAINTAINER_MODE([enable])
27
28 dnl sets host_* variables
29 AC_CANONICAL_HOST
30
31 dnl use pretty build output with automake >= 1.11
32 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
33   [AM_DEFAULT_VERBOSITY=1
34    AC_SUBST(AM_DEFAULT_VERBOSITY)])
35
36 dnl GStreamer versioning, this is mostly informational
37 GST_VERSION_MAJOR=$PACKAGE_VERSION_MAJOR
38 GST_VERSION_MINOR=$PACKAGE_VERSION_MINOR
39 GST_VERSION_MICRO=$PACKAGE_VERSION_MICRO
40 GST_VERSION_NANO=$PACKAGE_VERSION_NANO
41 AC_SUBST(GST_VERSION_MAJOR)
42 AC_SUBST(GST_VERSION_MINOR)
43 AC_SUBST(GST_VERSION_MICRO)
44 AC_SUBST(GST_VERSION_NANO)
45
46 dnl our libraries and install dirs use GST_API_VERSION in the filename
47 dnl to allow side-by-side installation of different API versions
48 GST_API_VERSION=1.0
49 AC_SUBST(GST_API_VERSION)
50 AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
51   [GStreamer API Version])
52
53 dnl CURRENT, REVISION, AGE
54 dnl - library source changed -> increment REVISION
55 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
56 dnl - interfaces added -> increment AGE
57 dnl - interfaces removed -> AGE = 0
58 dnl sets GST_LT_LDFLAGS
59 AS_LIBTOOL(GST, 2, 0, 2)
60
61 dnl *** autotools stuff ****
62
63 dnl allow for different autotools
64 AS_AUTOTOOLS_ALTERNATE
65
66 dnl Add parameters for aclocal (keep in sync with Makefile.am)
67 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
68
69 dnl set up gettext
70 dnl the version check needs to stay here because autopoint greps for it
71 AM_GNU_GETTEXT_VERSION([0.17])
72 AM_GNU_GETTEXT([external])
73 AG_GST_GETTEXT([gstreamer-$GST_API_VERSION])
74
75 dnl *** check for arguments to configure ***
76
77 AG_GST_ARG_DISABLE_FATAL_WARNINGS
78
79 dnl subsystems - can influence other decisions so needs to be high up
80 dnl we need to AM_CONDITIONAL them here for automake 1.6.x compatibility
81 AG_GST_CHECK_SUBSYSTEM_DISABLE(GST_DEBUG,[debugging subsystem])
82 AM_CONDITIONAL(GST_DISABLE_GST_DEBUG, test "x$GST_DISABLE_GST_DEBUG" = "xyes")
83 AG_GST_CHECK_SUBSYSTEM_DISABLE(PARSE,[command-line parser])
84 AM_CONDITIONAL(GST_DISABLE_PARSE, test "x$GST_DISABLE_PARSE" = "xyes")
85 if test "x$GST_DISABLE_PARSE" = xyes; then
86   AC_DEFINE(GST_DISABLE_PARSE, 1,
87     [Define if pipeline parsing code is disabled])
88 fi
89 AG_GST_CHECK_SUBSYSTEM_DISABLE(OPTION_PARSING,[option parsing when gst_init])
90 AM_CONDITIONAL(GST_DISABLE_OPTION_PARSING, test "x$GST_DISABLE_OPTION_PARSING" = "xyes")
91 if test "x$GST_DISABLE_OPTION_PARSING" = xyes; then
92   AC_DEFINE(GST_DISABLE_OPTION_PARSING, 1,
93     [Define if option parsing is disabled])
94 fi
95 AG_GST_CHECK_SUBSYSTEM_DISABLE(TRACE,[tracing subsystem])
96 AM_CONDITIONAL(GST_DISABLE_TRACE, test "x$GST_DISABLE_TRACE" = "xyes")
97 AG_GST_CHECK_SUBSYSTEM_DISABLE(ALLOC_TRACE,[allocation tracing])
98 AM_CONDITIONAL(GST_DISABLE_ALLOC_TRACE, test "x$GST_DISABLE_ALLOC_TRACE" = "xyes")
99 AG_GST_CHECK_SUBSYSTEM_DISABLE(REGISTRY,[plugin registry])
100 AM_CONDITIONAL(GST_DISABLE_REGISTRY, test "x$GST_DISABLE_REGISTRY" = "xyes")
101 dnl define a substitution to use in docs/gst/gstreamer.types
102 if test "x$GST_DISABLE_REGISTRY" = "xyes"
103 then
104   GST_REGISTRY_DOC_TYPES="%"
105 else
106   GST_REGISTRY_DOC_TYPES=
107 fi
108 AC_SUBST(GST_REGISTRY_DOC_TYPES)
109 AG_GST_CHECK_SUBSYSTEM_DISABLE(PLUGIN,[plugin])
110 AM_CONDITIONAL(GST_DISABLE_PLUGIN, test "x$GST_DISABLE_PLUGIN" = "xyes")
111
112 AG_GST_ARG_DEBUG
113 AG_GST_ARG_PROFILING
114 AG_GST_ARG_VALGRIND
115 AG_GST_ARG_GCOV
116
117 AG_GST_ARG_EXAMPLES
118
119 AG_GST_ARG_WITH_PKG_CONFIG_PATH
120 AG_GST_ARG_WITH_PACKAGE_NAME
121 AG_GST_ARG_WITH_PACKAGE_ORIGIN
122
123 AG_GST_PKG_CONFIG_PATH
124
125 AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
126   ["${srcdir}/gstreamer.doap"],
127   [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO])
128
129 dnl building of tests
130 AC_ARG_ENABLE(tests,
131   AS_HELP_STRING([--disable-tests],[disable building test apps]),
132   [
133     case "${enableval}" in
134       yes) BUILD_TESTS=yes ;;
135       no)  BUILD_TESTS=no ;;
136       *)   AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
137     esac
138   ],
139 [BUILD_TESTS=yes]) dnl Default value
140 AM_CONDITIONAL(BUILD_TESTS,         test "x$BUILD_TESTS" = "xyes")
141
142 dnl tests known to fail
143 AC_ARG_ENABLE(failing-tests,
144   AS_HELP_STRING([--disable-failing-tests],[disable building tests known to fail]),
145   [
146     case "${enableval}" in
147       yes) BUILD_FAILING_TESTS=yes ;;
148       no)  BUILD_FAILING_TESTS=no ;;
149       *)   AC_MSG_ERROR(bad value ${enableval} for --disable-failing-tests) ;;
150     esac
151   ],
152   [BUILD_FAILING_TESTS=no]) dnl Default value
153 AM_CONDITIONAL(BUILD_FAILING_TESTS, test "x$BUILD_FAILING_TESTS" = "xyes")
154 if test x$BUILD_FAILING_TESTS = xyes; then
155   AC_MSG_WARN([building tests known to fail, use --disable-failing-tests to disable])
156 else
157   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.])
158 fi
159
160 dnl building of benchmarks
161 AC_ARG_ENABLE(benchmarks,
162   AS_HELP_STRING([--disable-benchmarks],[disable building benchmarks apps]),
163   [
164     case "${enableval}" in
165       yes) BUILD_BENCHMARKS=yes ;;
166       no)  BUILD_BENCHMARKS=no ;;
167       *)   AC_MSG_ERROR(bad value ${enableval} for --disable-benchmarks) ;;
168     esac
169   ],
170 [BUILD_BENCHMARKS=yes]) dnl Default value
171 AM_CONDITIONAL(BUILD_BENCHMARKS, test "x$BUILD_BENCHMARKS" = "xyes")
172
173 dnl building of tools
174 AC_ARG_ENABLE(tools,
175   AS_HELP_STRING([--disable-tools],[disable building tools]),
176   [
177     case "${enableval}" in
178       yes) BUILD_TOOLS=yes ;;
179       no)  BUILD_TOOLS=no ;;
180       *)   AC_MSG_ERROR(bad value ${enableval} for --disable-tools) ;;
181     esac
182   ],
183 [BUILD_TOOLS=yes]) dnl Default value
184 AM_CONDITIONAL(BUILD_TOOLS, test "x$BUILD_TOOLS" = "xyes")
185
186 dnl poison destroyed objects
187 AC_ARG_ENABLE(poisoning,
188   AS_HELP_STRING([--enable-poisoning],[enable poisoning of deallocated objects]),
189   [
190     case "${enableval}" in
191       yes) USE_POISONING=yes ;;
192       no)  USE_POISONING=no ;;
193       *)   AC_MSG_ERROR(bad value ${enableval} for --enable-poisoning) ;;
194     esac
195   ],
196   [USE_POISONING=no]) dnl Default value
197 if test "x$USE_POISONING" = xyes; then
198   AC_DEFINE(USE_POISONING, 1,
199     [Define if we should poison deallocated memory])
200 fi
201
202 dnl *** checks for platform ***
203
204 dnl * hardware/architecture *
205
206 dnl common/m4/gst-arch.m4
207 dnl check CPU type
208 AG_GST_ARCH
209 dnl substitution for win32/common/config.h
210 HOST_CPU=$host_cpu
211 AC_SUBST(HOST_CPU)
212
213 dnl common/m4/gst-arch.m4
214 dnl check for unaligned access
215 AG_GST_UNALIGNED_ACCESS
216 dnl create a configure variable for gst/gstconfig.h
217 if test x${as_cv_unaligned_access} = xyes ; then
218   GST_HAVE_UNALIGNED_ACCESS_DEFINE="#define GST_HAVE_UNALIGNED_ACCESS 1"
219 else
220   GST_HAVE_UNALIGNED_ACCESS_DEFINE="#define GST_HAVE_UNALIGNED_ACCESS 0"
221 fi
222 AC_SUBST(GST_HAVE_UNALIGNED_ACCESS_DEFINE)
223
224 dnl check for platform specific settings
225 AG_GST_PLATFORM
226
227 dnl * software *
228
229 dnl check for large file support
230 dnl affected plugins must include config.h
231 AC_SYS_LARGEFILE
232
233 dnl *** checks for programs ***
234
235 dnl find a compiler
236 AC_PROG_CC
237 AC_PROG_CC_STDC
238
239 dnl check if the compiler supports '-c' and '-o' options
240 AM_PROG_CC_C_O
241
242 dnl find an assembler
243 AM_PROG_AS
244
245 dnl determine if c++ is available on this system
246 AC_PROG_CXX
247 dnl CXX may be set to some default even if no c++ compiler is available
248 dnl (thanks autotools!), so just try to compile some c++ code to make sure
249 AC_LANG_PUSH([C++])
250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ class Foo { int bar; };]], [[]])],[working_cxx=yes],[working_cxx=no])
251 AC_LANG_POP([C++])
252 AC_MSG_NOTICE([working c++ compiler found: $working_cxx])
253 AM_CONDITIONAL(HAVE_CXX, test "x$working_cxx" = "xyes")
254
255 dnl Perl is used in building documentation and in the version checks
256 AC_PATH_PROG(PERL_PATH, perl, no)
257 if test x$PERL_PATH = xno; then
258   AC_MSG_ERROR(Could not find perl)
259 fi
260
261 dnl we require flex and bison for building the parser
262 if test "x$GST_DISABLE_PARSE" != xyes; then
263   AG_GST_BISON_CHECK
264   AG_GST_FLEX_CHECK
265 fi
266
267 AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
268 AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
269
270 dnl check for gobject-introspection
271 GOBJECT_INTROSPECTION_CHECK([1.31.1])
272
273 dnl check for documentation tools
274 AG_GST_DOCBOOK_CHECK
275 GTK_DOC_CHECK([1.12])
276 AG_GST_PLUGIN_DOCS([1.12])
277
278 dnl *** checks for libraries ***
279
280 dnl check for libm, for sin()
281 LT_LIB_M
282 AC_SUBST(LIBM)
283
284 dnl *** checks for header files ***
285
286 dnl check if we have ANSI C header files
287 AC_HEADER_STDC
288
289 dnl Check for ucontext.h
290 AC_CHECK_HEADERS([ucontext.h], [], [], [AC_INCLUDES_DEFAULT])
291
292 dnl Check for sys/socket.h
293 AC_CHECK_HEADERS([sys/socket.h], [HAVE_SYS_SOCKET_H=yes], [HAVE_SYS_SOCKET_H=no], [AC_INCLUDES_DEFAULT])
294 AM_CONDITIONAL(HAVE_SYS_SOCKET_H, test "x$HAVE_SYS_SOCKET_H" = "xyes")
295
296 dnl check for sys/times.h for tests/examples/adapter/
297 AC_CHECK_HEADERS([sys/times.h], [HAVE_SYS_TIMES_H=yes], [HAVE_SYS_TIME_H=no], [AC_INCLUDES_DEFAULT])
298 AC_CHECK_HEADERS([unistd.h], [HAVE_UNISTD_H=yes], [HAVE_UNISTD_H=no], [AC_INCLUDES_DEFAULT])
299 AM_CONDITIONAL(HAVE_SYS_TIMES_H_AND_UNISTD_H, test "x$HAVE_SYS_TIMES_H" = "xyes" -a "x$HAVE_UNISTD_H" = "xyes")
300
301 dnl Check for process.h for getpid() on win32
302 AC_CHECK_HEADERS([process.h], [], [], [AC_INCLUDES_DEFAULT])
303
304 dnl Check for sys/utsname.h for uname
305 AC_CHECK_HEADERS([sys/utsname.h], [], [], [AC_INCLUDES_DEFAULT])
306
307 dnl Check for stdio_ext.f for __fbufsize
308 AC_CHECK_HEADERS([stdio_ext.h], [], [], [AC_INCLUDES_DEFAULT])
309
310 dnl check for pthreads
311 AX_PTHREAD([HAVE_PTHREAD=yes], [HAVE_PTHREAD=no])
312 AM_CONDITIONAL(HAVE_PTHREAD, test "x$HAVE_PTHREAD" = "xyes")
313
314 dnl check for sys/prctl for setting thread name on Linux
315 AC_CHECK_HEADERS([sys/prctl.h], [], [], [AC_INCLUDES_DEFAULT])
316
317 dnl Check for valgrind.h
318 dnl separate from HAVE_VALGRIND because you can have the program, but not
319 dnl the dev package
320 AC_CHECK_HEADERS([valgrind/valgrind.h], [], [], [AC_INCLUDES_DEFAULT])
321
322 dnl used in gst/gstpoll.c
323 AC_CHECK_HEADERS([winsock2.h], [HAVE_WINSOCK2_H=yes], [HAVE_WINSOCK2_H=no], [AC_INCLUDES_DEFAULT])
324 AM_CONDITIONAL(HAVE_WINSOCK2_H, test "x$HAVE_WINSOCK2_H" = "xyes")
325 if test "x$HAVE_WINSOCK2_H" = "xyes"; then
326   WIN32_LIBS="-lws2_32"
327   AC_SUBST(WIN32_LIBS)
328 fi
329
330 dnl check for GMP/GSL, used by the gst_util_uint64_scale unit test only
331 if test "x$BUILD_TESTS" = "xyes"; then
332   AG_GST_CHECK_LIBHEADER(GMP, gmp,
333                          __gmpz_init_set_d, ,
334                          gmp.h,
335                          GMP_LIBS="-lgmp"
336                          AC_SUBST(GMP_LIBS)
337                          AC_DEFINE(HAVE_GMP, [1],[Have GMP library]))
338   AG_GST_CHECK_LIBHEADER(GSL, gsl,
339                          gsl_rng_uniform_int, -lgslcblas,
340                          gsl/gsl_rng.h,
341                          GSL_LIBS="-lgsl -lgslcblas"
342                          AC_SUBST(GSL_LIBS)
343                          AC_DEFINE(HAVE_GSL, [1],[Have GSL library]))
344 fi
345
346 dnl *** checks for types/defines ***
347
348 dnl *** checks for structures ***
349
350 dnl *** checks for compiler characteristics ***
351
352 dnl check if the compiler supports __uint128_t (gcc)
353 dnl Actually check for 128-bit division, since that's what we use
354 dnl uint128_t for.
355 AC_CACHE_CHECK(for __uint128_t, gst_cv_uint128_t,
356     AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
357       static __uint128_t v1 = 100;
358       static __uint128_t v2 = 10;
359       static __uint128_t u;
360       u = v1 / v2;
361     ]])],[
362       gst_cv_uint128_t=yes
363     ],[
364       gst_cv_uint128_t=no
365     ])
366 )
367 if test x$gst_cv_uint128_t = xyes; then
368   AC_DEFINE(HAVE_UINT128_T, 1, [Have __uint128_t type])
369 fi
370
371 dnl *** checking for tm_gmtoff ***
372 AC_MSG_CHECKING([for tm_gmtoff])
373 AC_RUN_IFELSE([AC_LANG_SOURCE([[
374         #include <time.h>
375         int main(void) {
376           struct tm t;
377           t.tm_gmtoff = 0;
378           exit(0);
379         }]])],
380   [have_tm_gmtoff=yes
381    AC_DEFINE(HAVE_TM_GMTOFF,1,[Have tm_gmtoff field in struct tm])],
382   [have_tm_gmtoff=no],
383   [have_tm_gmtoff="no (cross compiling)"])
384 AC_MSG_RESULT($have_tm_gmtoff)
385
386
387 dnl *** checks for library functions ***
388
389 AC_CHECK_FUNCS([gmtime_r])
390 AC_CHECK_FUNCS([localtime_r])
391 AC_CHECK_FUNCS([sigaction])
392
393 dnl check for fseeko()
394 AC_FUNC_FSEEKO
395 dnl check for ftello()
396 AC_CHECK_FUNCS([ftello])
397
398 AC_CHECK_FUNCS([fgetpos])
399 AC_CHECK_FUNCS([fsetpos])
400
401 dnl check for poll(), ppoll() and pselect()
402 AC_CHECK_HEADERS([sys/poll.h], [], [], [AC_INCLUDES_DEFAULT])
403 AC_CHECK_HEADERS([poll.h], [], [], [AC_INCLUDES_DEFAULT])
404 AC_CHECK_FUNCS([poll])
405 AC_CHECK_FUNCS([ppoll])
406 AC_CHECK_FUNCS([pselect])
407
408 dnl ****************************************
409 dnl *** GLib POLL* compatibility defines ***
410 dnl ****************************************
411
412 AC_MSG_CHECKING([for broken poll])
413 AC_RUN_IFELSE([AC_LANG_SOURCE([[
414         #include <stdlib.h>
415         #include <fcntl.h>
416         #ifdef HAVE_SYS_POLL_H
417         #include <sys/poll.h>
418         #endif
419         #ifdef HAVE_POLL_H
420         #include <poll.h>
421         #endif
422         int main(void) {
423           struct pollfd fds[1];
424           int fd;
425           fd = open("/dev/null", 1);
426           fds[0].fd = fd;
427           fds[0].events = POLLIN;
428           fds[0].revents = 0;
429           if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
430                 exit(1);  /* Does not work for devices -- fail */
431           }
432           exit(0);
433         }]])],
434   [broken_poll=no],
435   [broken_poll=yes
436    AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])],
437   [broken_poll="no (cross compiling)"])
438 AC_MSG_RESULT($broken_poll)
439
440 dnl check for mmap()
441 AC_FUNC_MMAP
442 AM_CONDITIONAL(HAVE_MMAP, test "x$ac_cv_func_mmap_fixed_mapped" = "xyes")
443
444 dnl check for posix_memalign(), getpagesize()
445 AC_CHECK_FUNCS([posix_memalign])
446 AC_CHECK_FUNCS([getpagesize])
447
448 dnl Check for POSIX timers
449 AC_CHECK_FUNCS(clock_gettime, [], [
450   AC_CHECK_LIB(rt, clock_gettime, [
451     AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
452     LIBS="$LIBS -lrt"
453   ])
454 ])
455
456 AC_CACHE_CHECK(for posix timers, gst_cv_posix_timers,
457     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
458 #include <time.h>
459 #ifdef HAVE_UNISTD_H
460 #include <unistd.h>
461 #endif
462     ]], [[
463 #if !defined(_POSIX_TIMERS) || _POSIX_TIMERS < 0 || !defined(CLOCK_REALTIME)
464 #error Either _POSIX_TIMERS or CLOCK_REALTIME not defined
465 #endif
466     ]])],[
467       gst_cv_posix_timers=yes
468     ],[
469       gst_cv_posix_timers=no
470     ])
471 )
472
473 if test "$gst_cv_posix_timers" = "yes"; then
474   AC_DEFINE(HAVE_POSIX_TIMERS,1,[Have posix timers])
475   GST_HAVE_POSIX_TIMERS_DEFINE="#define GST_HAVE_POSIX_TIMERS 1"
476 else
477   GST_HAVE_POSIX_TIMERS_DEFINE="#define GST_HAVE_POSIX_TIMERS 0"
478 fi
479 AC_SUBST(GST_HAVE_POSIX_TIMERS_DEFINE)
480 AM_CONDITIONAL(GST_HAVE_POSIX_TIMERS, test "$gst_cv_posix_timers" = "yes")
481
482 AC_CACHE_CHECK(for monotonic clock, gst_cv_monotonic_clock,
483     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
484 #include <time.h>
485 #ifdef HAVE_UNISTD_H
486 #include <unistd.h>
487 #endif
488     ]], [[
489 #if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0 || !defined(CLOCK_MONOTONIC)
490 #error Either _POSIX_MONOTONIC_CLOCK or CLOCK_MONOTONIC not defined
491 #endif
492     ]])],[
493       gst_cv_monotonic_clock=yes
494     ],[
495       gst_cv_monotonic_clock=no
496     ])
497 )
498
499 if test "$gst_cv_monotonic_clock" = "yes"; then
500   AC_DEFINE(HAVE_MONOTONIC_CLOCK,1,[Have a monotonic clock])
501   GST_HAVE_MONOTONIC_CLOCK_DEFINE="#define GST_HAVE_MONOTONIC_CLOCK 1"
502 else
503   GST_HAVE_MONOTONIC_CLOCK_DEFINE="#define GST_HAVE_MONOTONIC_CLOCK 0"
504 fi
505 AC_SUBST(GST_HAVE_MONOTONIC_CLOCK_DEFINE)
506 AM_CONDITIONAL(GST_HAVE_MONOTONIC_CLOCK, test "$gst_cv_monotonic_clock" = "yes")
507
508 dnl Check for a way to display the function name in debug output
509 AG_GST_CHECK_FUNCTION
510
511 dnl test for register_printf_specifier or register_printf_function
512 AC_CHECK_FUNCS([register_printf_specifier register_printf_function],
513     [HAVE_PRINTF_EXTENSION=yes])
514
515 if test "$HAVE_PRINTF_EXTENSION" = yes; then
516   GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\""
517   GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"Q\""
518   GST_USING_PRINTF_EXTENSION_DEFINE="#define GST_USING_PRINTF_EXTENSION"
519   AC_DEFINE(HAVE_PRINTF_EXTENSION, 1,
520       [Defined if we have printf specifier extensions available])
521 else
522     GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\""
523     GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE="#define GST_SEGMENT_FORMAT \"p\""
524     GST_USING_PRINTF_EXTENSION_DEFINE="#undef GST_USING_PRINTF_EXTENSION"
525 fi
526 AC_SUBST(GST_PRINTF_EXTENSION_POINTER_FORMAT_DEFINE)
527 AC_SUBST(GST_PRINTF_EXTENSION_SEGMENT_FORMAT_DEFINE)
528 AC_SUBST(GST_USING_PRINTF_EXTENSION_DEFINE)
529
530 dnl test if we have dladdr(); we use it for debugging; see gst/gstinfo.c
531 save_cflags="$CFLAGS"
532 CFLAGS="$CFLAGS -D_GNU_SOURCE"
533 AC_CHECK_LIB(dl, dladdr,
534    AC_DEFINE(HAVE_DLADDR, 1, [Defined if we have dladdr ()])
535    LIBS="$LIBS -ldl")
536 CFLAGS="$save_cflags"
537
538 dnl *** checks for dependency libraries ***
539
540 dnl GLib
541 GLIB_REQ=2.32.0
542 AG_GST_GLIB_CHECK([$GLIB_REQ])
543
544 dnl Check for documentation xrefs
545 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
546 AC_SUBST(GLIB_PREFIX)
547
548 dnl building of unit test libraries
549 AC_ARG_ENABLE(check,
550   AS_HELP_STRING([--disable-check],[disable building unit test libraries]),
551   [
552     case "${enableval}" in
553       yes) BUILD_CHECK=yes ;;
554       no)  BUILD_CHECK=no ;;
555       *)   AC_MSG_ERROR(bad value ${enableval} for --disable-check) ;;
556     esac
557   ], [
558     dnl Default value
559     case $host_os in
560       mingw* | msvc* | mks*) BUILD_CHECK=no ;;
561       *) BUILD_CHECK=yes ;;
562     esac
563 ])
564 dnl bit of a misnomer, but keep the conditional named like this so we don't
565 dnl have to change too much elsewhere
566 AM_CONDITIONAL(HAVE_CHECK, test "x$BUILD_CHECK" = "xyes")
567
568 dnl configure the desired memory alignment
569 AC_ARG_WITH([memory-alignment],
570   AS_HELP_STRING([--with-memory-alignment],[8,N,malloc,pagesize (default is 32)]),
571   [
572     if test "x$withval" = "xyes"
573     then
574       AC_DEFINE(MEMORY_ALIGNMENT, 32, [Memory alignment to use])
575     else
576       case "${withval}" in
577         malloc) AC_DEFINE(MEMORY_ALIGNMENT_MALLOC, 1, [Memory alignment by malloc default]) ;;
578         pagesize)  AC_DEFINE(MEMORY_ALIGNMENT_PAGESIZE, 1, [Memory alignment by pagesize]) ;;
579         *)   AC_DEFINE_UNQUOTED(MEMORY_ALIGNMENT, ${withval}, [Memory alignment to use]) ;;
580       esac
581     fi
582   ], [
583     AC_DEFINE(MEMORY_ALIGNMENT_MALLOC, 1, [Memory alignment by malloc default]) 
584   ]
585 )
586
587 dnl Check for -Bsymbolic-functions linker flag used to avoid
588 dnl intra-library PLT jumps, if available.
589 AC_ARG_ENABLE(Bsymbolic,
590               [AS_HELP_STRING([--disable-Bsymbolic],[avoid linking with -Bsymbolic])],,
591               [SAVED_LDFLAGS="${LDFLAGS}"
592                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
593                LDFLAGS=-Wl,-Bsymbolic-functions
594                AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int main (void) { return 0; }]])],[
595                            AC_MSG_RESULT(yes)
596                            enable_Bsymbolic=yes],[
597                            AC_MSG_RESULT(no)
598                            enable_Bsymbolic=no])
599                LDFLAGS="${SAVED_LDFLAGS}"])
600
601
602 dnl *** set variables based on configure arguments
603
604 dnl set license and copyright notice
605 GST_LICENSE="LGPL"
606 AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
607 AC_SUBST(GST_LICENSE)
608
609 dnl define LIBDIR, GST_DATADIR so we can inform people where we live
610 AS_AC_EXPAND(LIBDIR, $libdir)
611 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [library dir])
612 AS_AC_EXPAND(DATADIR, $datadir)
613 AC_DEFINE_UNQUOTED(GST_DATADIR, "$DATADIR", [data dir])
614
615 dnl set location of plugin directory
616 AG_GST_SET_PLUGINDIR
617
618 dnl make sure it doesn't complain about unused variables if debugging is disabled
619 NO_WARNINGS=""
620 if test "x${GST_DISABLE_GST_DEBUG}" = "xyes"; then
621   NO_WARNINGS="-Wno-unused"
622 fi
623
624 dnl define an ERROR_CFLAGS Makefile variable
625 AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security -Wold-style-definition -Winit-self -Wmissing-include-dirs -Waddress -Waggregate-return -Wno-multichar -Wnested-externs $NO_WARNINGS])
626
627 dnl define correct level for debugging messages
628 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
629
630 dnl *** finalize CFLAGS, LDFLAGS, LIBS
631
632 dnl Overview:
633 dnl GST_OPTION_CFLAGS:  common cflags for profiling, debugging, errors, ...
634 dnl GST_ALL_*:          vars shared by all built objects
635 dnl GST_LIB_LDFLAGS:    additional linker flags for all libaries
636 dnl GST_OBJ_*:          additional vars to link to the core library
637 dnl                     include GST_ALL_*
638 dnl GST_LT_LDFLAGS:     library versioning of our libraries
639 dnl GST_PLUGIN_LDFLAGS: flags to be used for all plugins
640
641 dnl GST_OPTION_CFLAGS
642 if test "x$USE_DEBUG" = xyes; then
643    PROFILE_CFLAGS="-g"
644 fi
645 AC_SUBST(PROFILE_CFLAGS)
646
647 # GST_DISABLE_DEPRECATED: hide the visibility of deprecated
648 # functionality from the API that gstreamer uses
649 # GST_REMOVE_DEPRECATED: don't compile deprecated functionality (breaks ABI)
650 if test "x$PACKAGE_VERSION_NANO" = "x1"; then
651   dnl Define _only_ when compiling from git (not for pre-releases or releases)
652   DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED"
653 else
654   DEPRECATED_CFLAGS=""
655 fi
656 AC_SUBST(DEPRECATED_CFLAGS)
657
658 dnl every flag in GST_OPTION_CFLAGS can be overridden at make time via e.g.
659 dnl make DEPRECATED_CFLAGS=''
660 GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
661 GST_OPTION_CXXFLAGS="\$(WARNING_CXXFLAGS) \$(ERROR_CXXFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
662 GST_OPTION_CFLAGS="$GST_OPTION_CFLAGS"
663 GST_OPTION_CXXFLAGS="$GST_OPTION_CXXFLAGS"
664 AC_SUBST(GST_OPTION_CFLAGS)
665 AC_SUBST(GST_OPTION_CXXFLAGS)
666
667 dnl GST_ALL_*
668 dnl vars common to for all internal objects (core libs, elements, applications)
669 dnl CFLAGS:
670 dnl - src and build dirs need to be added because every piece that gets built
671 dnl   will need the GStreamer source and generated headers
672 dnl LIBS: XML doesn't need to be added because we don't explicitly use symbols
673 dnl       from LibXML except for in the core library
674 GST_ALL_CXXFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir) -I\$(top_builddir)/libs -I\$(top_builddir) $GLIB_CFLAGS \$(GLIB_EXTRA_CFLAGS) $XML_CFLAGS \$(GST_OPTION_CXXFLAGS) \$(ERROR_CXXFLAGS)"
675 GST_ALL_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir) -I\$(top_builddir)/libs -I\$(top_builddir) $GLIB_CFLAGS \$(GLIB_EXTRA_CFLAGS) $XML_CFLAGS \$(GST_OPTION_CFLAGS) \$(ERROR_CFLAGS)"
676
677 dnl FIXME: check if LTLIBINTL is needed everywhere
678 dnl I presume it is given that it contains the symbols that _() stuff maps to
679 GST_ALL_LIBS="$GLIB_LIBS $LTLIBINTL \$(GCOV_LIBS)"
680
681 dnl LDFLAGS really should only contain flags, not libs - they get added before
682 dnl whatevertarget_LIBS and -L flags here affect the rest of the linking
683 GST_ALL_LDFLAGS="-no-undefined"
684 if test "x${enable_Bsymbolic}" = "xyes"; then
685   GST_ALL_LDFLAGS="$GST_ALL_LDFLAGS -Wl,-Bsymbolic-functions"
686 fi
687
688 AC_SUBST(GST_ALL_CFLAGS)
689 AC_SUBST(GST_ALL_CXXFLAGS)
690 AC_SUBST(GST_ALL_LIBS)
691 AC_SUBST(GST_ALL_LDFLAGS)
692
693 dnl GST_LIB_LDFLAGS
694 dnl linker flags shared by all libraries
695 dnl LDFLAGS modifier defining exported symbols from built libraries
696 GST_LIB_LDFLAGS="-export-symbols-regex \^[_]?\(gst_\|Gst\|GST_\).*"
697 AC_SUBST(GST_LIB_LDFLAGS)
698
699 dnl GST_OBJ_*
700 dnl default vars for all internal objects built on libgstreamer
701 dnl includes GST_ALL_*
702 GST_OBJ_CFLAGS="\$(GST_ALL_CFLAGS)"
703 GST_OBJ_CXXFLAGS="\$(GST_ALL_CXXFLAGS)"
704 GST_OBJ_LIBS="\$(top_builddir)/gst/libgstreamer-$GST_API_VERSION.la \$(GST_ALL_LIBS)"
705 AC_SUBST(GST_OBJ_CFLAGS)
706 AC_SUBST(GST_OBJ_CXXFLAGS)
707 AC_SUBST(GST_OBJ_LIBS)
708
709 dnl GST_PLUGIN_LDFLAGS
710 dnl LDFLAGS for plugins; includes GST_ALL_LDFLAGS
711 GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc.*' $GST_ALL_LDFLAGS"
712 AC_SUBST(GST_PLUGIN_LDFLAGS, "$GST_PLUGIN_LDFLAGS")
713
714 dnl plugin scanner locations
715 AS_AC_EXPAND(GST_PLUGIN_SCANNER_INSTALLED,${libexecdir}/gstreamer-$GST_API_VERSION/gst-plugin-scanner)
716 AC_DEFINE_UNQUOTED(GST_PLUGIN_SCANNER_INSTALLED,
717     "$GST_PLUGIN_SCANNER_INSTALLED", [location of the installed gst-plugin-scanner])
718 AC_SUBST(GST_PLUGIN_SCANNER_INSTALLED)
719
720 dnl things for our internal libcheck (must be called even if building
721 dnl libcheck is disabled because it defines conditionals)
722 AG_GST_CHECK_CHECKS()
723
724 AC_CONFIG_FILES(
725 Makefile
726 gst/Makefile
727 gst/gstconfig.h
728 gst/gstversion.h
729 gst/parse/Makefile
730 libs/Makefile
731 libs/gst/Makefile
732 libs/gst/base/Makefile
733 libs/gst/check/Makefile
734 libs/gst/check/libcheck/Makefile
735 libs/gst/check/libcheck/check.h
736 libs/gst/controller/Makefile
737 libs/gst/helpers/Makefile
738 libs/gst/net/Makefile
739 plugins/Makefile
740 plugins/elements/Makefile
741 po/Makefile.in
742 tests/Makefile
743 tests/benchmarks/Makefile
744 tests/check/Makefile
745 tests/misc/Makefile
746 tests/examples/Makefile
747 tests/examples/adapter/Makefile
748 tests/examples/controller/Makefile
749 tests/examples/stepping/Makefile
750 tests/examples/helloworld/Makefile
751 tests/examples/launch/Makefile
752 tests/examples/manual/Makefile
753 tests/examples/memory/Makefile
754 tests/examples/metadata/Makefile
755 tests/examples/queue/Makefile
756 tests/examples/streams/Makefile
757 tests/examples/typefind/Makefile
758 tools/Makefile
759 common/Makefile
760 common/m4/Makefile
761 docs/Makefile
762 docs/design/Makefile
763 docs/faq/Makefile
764 docs/gst/Makefile
765 docs/gst/gstreamer.types
766 docs/libs/Makefile
767 docs/plugins/Makefile
768 docs/manual/Makefile
769 docs/pwg/Makefile
770 docs/slides/Makefile
771 docs/xsl/Makefile
772 docs/version.entities
773 m4/Makefile
774 pkgconfig/Makefile
775 stamp.h
776 pkgconfig/gstreamer.pc
777 pkgconfig/gstreamer-uninstalled.pc
778 pkgconfig/gstreamer-base.pc
779 pkgconfig/gstreamer-base-uninstalled.pc
780 pkgconfig/gstreamer-check.pc
781 pkgconfig/gstreamer-check-uninstalled.pc
782 pkgconfig/gstreamer-controller.pc
783 pkgconfig/gstreamer-controller-uninstalled.pc
784 pkgconfig/gstreamer-net.pc
785 pkgconfig/gstreamer-net-uninstalled.pc
786 gstreamer.spec
787 )
788
789 dnl Create the config.h file for Visual Studio builds
790 dnl Beware of spaces and /'s in some of the shell variable contents.
791 sed \
792     -e 's/.*config.h.in.*autoheader.*/\/* Autogenerated config.h created for win32 Visual Studio builds *\/\n\n\/* PREFIX -- specifically added for Windows for easier moving *\/\n#define PREFIX "C:\\\\gstreamer"/' \
793     -e 's/.* GETTEXT_PACKAGE$/#define GETTEXT_PACKAGE "'$GETTEXT_PACKAGE'"/' \
794     -e 's/.* GST_DATADIR$/#define GST_DATADIR PREFIX "\\\\share"/' \
795     -e 's/.* GST_LEVEL_DEFAULT$/#define GST_LEVEL_DEFAULT GST_LEVEL_ERROR/' \
796     -e 's/.* GST_LICENSE$/#define GST_LICENSE "'$GST_LICENSE'"/' \
797     -e 's/.* GST_API_VERSION$/#define GST_API_VERSION "'$GST_API_VERSION'"/' \
798     -e "s,.* GST_PACKAGE_NAME$,#define GST_PACKAGE_NAME \"${GST_PACKAGE_NAME}\"," \
799     -e 's/.* GST_PACKAGE_ORIGIN$/#define GST_PACKAGE_ORIGIN "Unknown package origin"/' \
800     -e "s,.* GST_PACKAGE_RELEASE_DATETIME$,#define GST_PACKAGE_RELEASE_DATETIME \"${GST_PACKAGE_RELEASE_DATETIME}\"," \
801     -e 's/.* HAVE_CPU_I386$/#define HAVE_CPU_I386 1/' \
802     -e 's/.* HAVE_FGETPOS$/#define HAVE_FGETPOS 1/' \
803     -e 's/.* HAVE_FSETPOS$/#define HAVE_FSETPOS 1/' \
804     -e 's/.* HAVE_PROCESS_H$/#define HAVE_PROCESS_H 1/' \
805     -e 's/.* HAVE_STDLIB_H$/#define HAVE_STDLIB_H 1/' \
806     -e 's/.* HAVE_STRING_H$/#define HAVE_STRING_H 1/' \
807     -e 's/.* HAVE_SYS_STAT_H$/#define HAVE_SYS_STAT_H 1/' \
808     -e 's/.* HAVE_SYS_TYPES_H$/#define HAVE_SYS_TYPES_H 1/' \
809     -e 's/.* HAVE_WIN32$/#define HAVE_WIN32 1/' \
810     -e 's/.* HAVE_WINSOCK2_H$/#define HAVE_WINSOCK2_H 1/' \
811     -e 's/.* HOST_CPU$/#define HOST_CPU "i686"/' \
812     -e 's/.* MEMORY_ALIGNMENT_MALLOC/#define MEMORY_ALIGNMENT_MALLOC 1/' \
813     -e 's/.* LIBDIR$/#ifdef _DEBUG\n#  define LIBDIR PREFIX "\\\\debug\\\\lib"\n#else\n#  define LIBDIR PREFIX "\\\\lib"\n#endif/' \
814     -e 's/.* LOCALEDIR$/#define LOCALEDIR PREFIX "\\\\share\\\\locale"/' \
815     -e 's/.* PACKAGE$/#define PACKAGE "gstreamer"/' \
816     -e 's/.* PACKAGE_BUGREPORT$/#define PACKAGE_BUGREPORT "http:\/\/bugzilla.gnome.org\/enter_bug.cgi?product=GStreamer"/' \
817     -e 's/.* PACKAGE_NAME$/#define PACKAGE_NAME "'$PACKAGE_NAME'"/' \
818     -e "s/.* PACKAGE_STRING$/#define PACKAGE_STRING \"$PACKAGE_STRING\"/" \
819     -e 's/.* PACKAGE_TARNAME$/#define PACKAGE_TARNAME "'$PACKAGE_TARNAME'"/' \
820     -e 's/.* PACKAGE_VERSION$/#define PACKAGE_VERSION "'$PACKAGE_VERSION'"/' \
821     -e 's/.* PLUGINDIR$/#ifdef _DEBUG\n#  define PLUGINDIR PREFIX "\\\\debug\\\\lib\\\\gstreamer-1.0"\n#else\n#  define PLUGINDIR PREFIX "\\\\lib\\\\gstreamer-1.0"\n#endif/' \
822     -e 's/.* GST_PLUGIN_SCANNER_INSTALLED$/#define GST_PLUGIN_SCANNER_INSTALLED LIBDIR "\\\\gst-plugin-scanner"/' \
823     -e 's/.* VERSION$/#define VERSION "'$VERSION'"/' \
824     config.h.in >win32/common/config.h-new
825
826 AC_OUTPUT
827
828 dnl negate for output
829 if test "x${GST_DISABLE_GST_DEBUG}" = "xno"; then enable_gst_debug="yes"; fi
830 if test "x${GST_DISABLE_PARSE}" = "xno"; then enable_parse="yes"; fi
831 if test "x${GST_DISABLE_OPTION_PARSING}" = "xno"; then enable_option_parsing="yes"; fi
832 if test "x${GST_DISABLE_TRACE}" = "xno"; then enable_trace="yes"; fi
833 if test "x${GST_DISABLE_ALLOC_TRACE}" = "xno"; then enable_alloc_trace="yes"; fi
834 if test "x${GST_DISABLE_PLUGIN}" = "xno"; then enable_plugin="yes"; fi
835 if test "x${GST_DISABLE_REGISTRY}" = "xno"; then enable_registry="yes"; fi
836
837 echo "
838
839 Configuration
840         Version                    : ${VERSION}
841         Source code location       : ${srcdir}
842         Prefix                     : ${prefix}
843         Compiler                   : ${CC}
844         Package name               : ${GST_PACKAGE_NAME}
845         Package origin             : ${GST_PACKAGE_ORIGIN}
846
847         Documentation (manuals)    : ${enable_docbook}
848         Documentation (API)        : ${enable_gtk_doc}
849
850         Debug Logging              : ${enable_gst_debug}
851         Command-line parser        : ${enable_parse}
852         Option parsing in gst_init : ${enable_option_parsing}
853         Tracing subsystem          : ${enable_trace}
854         Allocation tracing         : ${enable_alloc_trace}
855         Plugin registry            : ${enable_registry}
856         Plugin support             : ${enable_plugin}
857         Unit testing support       : ${BUILD_CHECK}
858
859         Debug                      : ${USE_DEBUG}
860         Profiling                  : ${USE_PROFILING}
861
862         Building benchmarks        : ${BUILD_BENCHMARKS}
863         Building examples          : ${BUILD_EXAMPLES}
864         Building test apps         : ${BUILD_TESTS}
865         Building tests that fail   : ${BUILD_FAILING_TESTS}
866         Building tools             : ${BUILD_TOOLS}
867 "