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