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