make swfdec_movie_queue_script not return TRUE/FALSE
[swfdec.git] / configure.ac
blobbb86e8f04dd2dac39894cbe472fcb5ba29ee0caa
1 AC_PREREQ([2.58])
2 AC_INIT(swfdec,0.5.4.1)
4 [nano=$(echo $PACKAGE_VERSION | sed 's/[0-9]\.[0-9]\.[0-9][0-9]*\.*//')]
5 if test x"$nano" = x1 ; then
6   SWFDEC_CVS="yes"
7 else
8   SWFDEC_CVS="no"
9 fi
11 AM_INIT_AUTOMAKE(1.6)
12 dnl AC_CANONICAL_TARGET([])
13 AM_MAINTAINER_MODE
15 SWFDEC_MAJORMINOR=0.5
16 AC_SUBST(SWFDEC_MAJORMINOR)
18 AM_CONFIG_HEADER(config.h)
19 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
21 dnl decide on error flags
22 dnl if we support them, we set them unconditionally
23 AS_COMPILER_FLAG(-Wall, GLOBAL_CFLAGS="-Wall", GLOBAL_CFLAGS="")
24 dnl I want this but stupid headers don't let me
25 dnl AS_COMPILER_FLAG(-Wshadow, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wshadow")
26 AS_COMPILER_FLAG(-Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Wswitch-enum -Wswitch-default, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Wswitch-enum -Wswitch-default")
27 dnl if we're in nano >= 1, add -Werror if supported
28 if test x$SWFDEC_CVS = xyes ; then
29   AS_COMPILER_FLAG(-Werror, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Werror")
30   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_WARNING"
31 else
32   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_ERROR"
34 AC_DEFINE_UNQUOTED(SWFDEC_LEVEL_DEFAULT, $DEFAULT_DEBUG_LEVEL, [Default debug level used])
36 SWFDEC_LIBVERSION="4:0:0"
37 AC_SUBST(SWFDEC_LIBVERSION)
38 AM_PROG_LIBTOOL
40 dnl C99 is only required to get definitions for NAN and INFINITY.
41 AS_COMPILER_FLAG(-std=gnu99, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -std=gnu99")
43 dnl ensures the library is linked against the internal Mozilla
44 dnl if this doesn't work on your platform, I'll take patches :)
45 SYMBOLIC_LDFLAGS="-Wl,-Bsymbolic"
46 AC_SUBST(SYMBOLIC_LDFLAGS)
48 dnl Add parameters for aclocal
49 dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
50 #ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
52 AC_PROG_CC
53 AM_PROG_CC_STDC
54 AM_PROG_CC_C_O
55 AM_PROG_AS
56 AC_PROG_AWK
58 AC_HEADER_STDC([])
60 dnl ##############################
61 dnl # Do automated configuration #
62 dnl ##############################
64 dnl Check for tools:
65 dnl ================
67 dnl modify pkg-config path
68 AC_ARG_WITH(pkg-config-path, 
69    AC_HELP_STRING([--with-pkg-config-path],[colon-separated list of pkg-config(1) dirs]),
70    [export PKG_CONFIG_PATH=${withval}])
72 dnl Check for essential libraries first:
73 dnl ====================================
75 GLIB_VER=2.12
76 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_VER gobject-2.0 >= $GLIB_VER gthread-2.0 >= $GLIB_VER,
77                 HAVE_GLIB=yes, HAVE_GLIB=no)
78 if test "$HAVE_GLIB" = "no"; then
79   AC_MSG_ERROR([glib-2.0, gobject-2.0 and gthread-2.0 >= $GLIB_VER are required to build swfdec])
81 AC_SUBST(GLIB_LIBS)
82 AC_SUBST(GLIB_CFLAGS)
83 AC_SUBST(GLIB_VER)
84 dnl FIXME: detect these executables correctly
85 GLIB_GENMARSHAL=glib-genmarshal
86 AC_SUBST(GLIB_GENMARSHAL)
87 GLIB_MKENUMS=glib-mkenums
88 AC_SUBST(GLIB_MKENUMS)
90 PANGO_VER=1.16
91 PKG_CHECK_MODULES(PANGO, pangocairo >= $PANGO_VER, HAVE_PANGO=yes, HAVE_PANGO=no)
92 if test "$HAVE_PANGO" = "no"; then
93   AC_MSG_ERROR([pangocairo >= $PANGO_VER is required to build swfdec])
95 AC_SUBST(PANGO_LIBS)
96 AC_SUBST(PANGO_CFLAGS)
98 AC_ARG_ENABLE(gtk,
99         AS_HELP_STRING([--enable-gtk],
100                         [enable Gtk integration (default=yes)])],
101         enable_gtk=$enableval,
102         enable_gtk="yes")
104 dnl 
105 dnl GTK: We want this for swfdec-gtk
107 GTK_VER=2.8.0
108 AC_SUBST(GTK_VER)
109 if test "$enable_gtk" = "yes"; then
110         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER, HAVE_GTK=yes, HAVE_GTK=no)
111         if test "x$HAVE_GTK" = xyes; then
112           AC_DEFINE(HAVE_GTK, 1, [Define if Gtk is enabled])
113         else
114           AC_MSG_ERROR([Couldn't find a suitable Gtk version. You need at least version $GTK_VER])
115         fi
116 else
117         AC_MSG_NOTICE([Gtk support was not enabled.])
119 AM_CONDITIONAL(WITH_GTK, [test "x$HAVE_GTK" = xyes])
122 dnl audio backend
124 AC_ARG_WITH(audio,
125             [AC_HELP_STRING([--with-audio=@<:@auto/alsa/oss/none@:>@],
126                             [audio backend to use])],,
127             [with_audio=auto])
129 AUDIO_TYPE=
130 if test "$with_audio" = "auto" -o "$with_audio" = "alsa"; then
131   PKG_CHECK_MODULES(ALSA, alsa >= 1.0, AUDIO_TYPE=alsa)
132   if test "$AUDIO_TYPE" = "alsa"; then
133     with_audio=alsa
134     AUDIO_CFLAGS=$ALSA_CFLAGS
135     AUDIO_LIBS=$ALSA_LIBS
136   else
137     if test "$with_audio" = "alsa"; then
138       AC_MSG_ERROR([no alsa audio support])
139     else
140       AC_MSG_WARN([no alsa audio support])
141     fi
142   fi
145 dnl Use PA if ALSA wasn't found and we're auto and it's available.
146 dnl Disabled for now until the PA backend works.
147 if test "$with_audio" = "auto" -o "$with_audio" = "pa"; then
148   PKG_CHECK_MODULES(PA, libpulse-mainloop-glib, AUDIO_TYPE=pa)
149   if test "$AUDIO_TYPE" = "pa"; then
150     with_audio=pa
151     AUDIO_CFLAGS=$PA_CFLAGS
152     AUDIO_LIBS=$PA_LIBS
153   else
154     if test "$with_audio" = "pa"; then
155       AC_MSG_ERROR([no pulseaudio support])
156     else
157       AC_MSG_WARN([no pulseaudio support])
158     fi
159   fi
162 dnl Assume OSS is available if ALSA wasn't found and we're "auto".
163 if test "$with_audio" = "auto" -o "$with_audio" = "oss"; then
164   with_audio="oss"
165   AUDIO_CFLAGS=
166   AUDIO_LIBS=
167   AUDIO_TYPE=oss
170 dnl If all else fails, fall back to none.
171 if test "$with_audio" = "auto" -o "$with_audio" = "none"; then
172   AUDIO_CFLAGS=
173   AUDIO_LIBS=
174   AUDIO_TYPE=none
177 if test "x$AUDIO_TYPE" = "x"; then
178   AC_MSG_ERROR([desired audio support could not be used])
179 else
180   AC_MSG_NOTICE([audio backend: $AUDIO_TYPE])
182 AC_SUBST(AUDIO_LIBS)
183 AC_SUBST(AUDIO_CFLAGS)
184 AC_SUBST(AUDIO_TYPE)
186 LIBOIL_VER=0.3.1
187 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= $LIBOIL_VER, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
188 AC_SUBST(LIBOIL_LIBS)
189 AC_SUBST(LIBOIL_CFLAGS)
190 if test "$HAVE_LIBOIL" = "no"; then
191   AC_MSG_ERROR([liboil-0.3 >= $LIBOIL_VER is required to build swfdec])
194 CAIRO_VER=1.2.0
195 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VER cairo-png >= $CAIRO_VER, HAVE_CAIRO=yes, HAVE_CAIRO=no)
196 AC_SUBST(CAIRO_LIBS)
197 AC_SUBST(CAIRO_CFLAGS)
198 if test "$HAVE_CAIRO" = "no"; then
199   AC_MSG_ERROR([cairo and cairo-png = $CAIRO_VER is required to build swfdec])
202 AC_ARG_ENABLE(mad,
203         AS_HELP_STRING([--enable-mad],
204                         [enable mad audio (default=no)])],
205         enable_mad=$enableval,
206         enable_mad="no")
208 if test "$enable_mad" = "yes"; then
209         PKG_CHECK_EXISTS([mad],[
210                 MAD_VER=0.15.0
211                 PKG_CHECK_MODULES(MAD, mad >= $MAD_VER mad >= $MAD_VER, HAVE_MAD=yes, HAVE_MAD=no)
212         ], [
213                 AC_CHECK_LIB(mad, mad_decoder_finish, HAVE_MAD="yes" MAD_LIBS="-lmad", HAVE_MAD="no")
214         ])
215         AC_SUBST(MAD_LIBS)
216         if test "x$HAVE_MAD" = xyes; then
217           AC_DEFINE(HAVE_MAD, 1, [Define if mad is enabled])
218         else
219           AC_MSG_ERROR([Couldn't find mad. You might need to install the libmad0-dev package.])
220         fi
221 else
222         AC_MSG_NOTICE([mad audio support was not enabled.])
224 AM_CONDITIONAL(HAVE_MAD, [test "x$HAVE_MAD" = xyes])
226 dnl  I'd put a required version in here if distros can agree on a way
227 dnl  to detect ffmpeg. But as it stands even pkg-config versions are weird.
228 dnl  So you'll have to update your ffmpeg checkout if compilation fails.
229 dnl  Or you submit a patch that detects ffmpeg reliably on the distros.
230 AC_ARG_ENABLE(ffmpeg,
231         AS_HELP_STRING([--enable-ffmpeg],
232                         [enable ffmpeg support (default=no)])],
233         enable_ffmpeg=$enableval,
234         enable_ffmpeg="no")
236 if test "$enable_ffmpeg" = "yes"; then
237         PKG_CHECK_MODULES(FFMPEG, libavcodec libswscale, HAVE_FFMPEG=yes, HAVE_FFMPEG=no)
238         AC_SUBST(FFMPEG_CFLAGS)
239         AC_SUBST(FFMPEG_LIBS)
240         if test "x$HAVE_FFMPEG" = xyes; then
241           AC_DEFINE(HAVE_FFMPEG, 1, [Define if ffmpeg is enabled])
242         else
243           AC_MSG_ERROR([Couldn't find ffmpeg. You might need to install the libavcodec-dev and libswscale-dev packages.])
244         fi
245 else
246         AC_MSG_NOTICE([ffmpeg support was not enabled.])
248 AM_CONDITIONAL(HAVE_FFMPEG, [test "x$HAVE_FFMPEG" = xyes])
249 AC_ARG_ENABLE(gstreamer,
250         AS_HELP_STRING([--enable-gstreamer],
251                         [enable GStreamer support (default=yes)])],
252         enable_gstreamer=$enableval,
253         enable_gstreamer="yes")
255 if test "$enable_gstreamer" = "yes"; then
256         GST_REQUIRED=0.10.11
257         PKG_CHECK_MODULES(GST, gstreamer-0.10 >= $GST_REQUIRED, HAVE_GST=yes, HAVE_GST=no)
258         if test "x$HAVE_GST" = xyes; then
259           AC_DEFINE(HAVE_GST, 1, [Define if GStreamer is enabled])
260         else
261           AC_MSG_ERROR([Couldn't find GStreamer $GST_REQUIRED.])
262         fi
263 else
264         AC_MSG_NOTICE([GStreamer support was not enabled.])
266 AM_CONDITIONAL(HAVE_GST, [test "x$HAVE_GST" = xyes])
269 AC_ARG_ENABLE(soup,
270         AS_HELP_STRING([--enable-soup],
271                         [enable libsoup HTTP support for swfdec-gtk (default=yes)])],
272         enable_libsoup=$enableval,
273         enable_libsoup="yes")
275 if test "$enable_libsoup" = "yes"; then
276         PKG_CHECK_MODULES(HTTP, libsoup-2.2 >= 2.2.0, HAVE_HTTP=yes, HAVE_HTTP=no)
277         if test "x$HAVE_HTTP" = xyes; then
278           AC_DEFINE(HAVE_HTTP, 1, [Define if libsoup is enabled])
279         else
280           AC_MSG_ERROR([Couldn't find libsoup-2.2.])
281         fi
282 else
283         AC_MSG_NOTICE([libsoup HTTP support was not enabled.])
285 AM_CONDITIONAL(HAVE_HTTP, [test "x$HAVE_HTTP" = xyes])
287 AC_ARG_ENABLE(vivified,
288         AS_HELP_STRING([--enable-vivified],
289                         [enable Vivified Flash debugger (default=no)])],
290         enable_vivi=$enableval,
291         enable_vivi="no")
292 if test "$enable_vivi" = "yes"; then
293         MING_REQUIRED=0.4.0.beta5
294         VIVI_GTK_REQUIRED=2.11.6
295         VIVI_GLIB_REQUIRED=2.14
296         PKG_CHECK_MODULES(VIVI, libming >= $MING_REQUIRED gmodule-export-2.0 gtk+-2.0 >= $VIVI_GTK_REQUIRED glib-2.0 >= $VIVI_GLIB_REQUIRED, HAVE_VIVI=yes, HAVE_VIVI=no)
297         if test "x$HAVE_VIVI" = xyes; then
298           AC_DEFINE(HAVE_VIVI, 1, [Define if Vivified is enabled])
299         else
300           AC_MSG_ERROR([Vivified requirements not met. You need libming >= $MING_REQUIRED, glib >= $VIVI_GLIB_REQUIRED and Gtk+ >= $VIVI_GTK_REQUIRED.])
301         fi
302 else
303         AC_MSG_NOTICE([Vivified was not enabled.])
305 AM_CONDITIONAL(HAVE_VIVI, [test "x$HAVE_VIVI" = xyes])
308 AC_SUBST(GLOBAL_CFLAGS)
309 AC_SUBST(GLOBAL_CFLAGS)
311 SWFDEC_CFLAGS="-I\$(top_srcdir) $GLIB_CFLAGS $CAIRO_CFLAGS"
312 SWFDEC_LIBS="\$(top_builddir)/libswfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz"
313 AC_SUBST(SWFDEC_LIBS)
314 AC_SUBST(SWFDEC_CFLAGS)
316 SWFDEC_GTK_CFLAGS="$SWFDEC_CFLAGS $GTK_CFLAGS"
317 SWFDEC_GTK_LIBS="\$(top_builddir)/libswfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
318 AC_SUBST(SWFDEC_GTK_LIBS)
319 AC_SUBST(SWFDEC_GTK_CFLAGS)
321 GTK_DOC_CHECK([1.6])
323 if test "x${prefix}" = "xNONE"; then
324   PACKAGE_PREFIX=${ac_default_prefix}
325 else
326   PACKAGE_PREFIX=${prefix}
328 AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "$PACKAGE_PREFIX", [Define the package prefix])
329 AC_SUBST(PACKAGE_PREFIX)
331 dnl #########################
332 dnl # Make the output files #
333 dnl #########################
335 dnl testsuite/autoplug/Makefile
336 dnl testsuite/Makefile
337 AC_CONFIG_FILES(
338 Makefile
339 data/Makefile
340 data/icons/Makefile
341 data/icons/16x16/Makefile
342 data/icons/22x22/Makefile
343 data/icons/24x24/Makefile
344 data/icons/32x32/Makefile
345 data/icons/48x48/Makefile
346 data/icons/scalable/Makefile
347 data/swfdec.pc
348 data/swfdec-gtk.pc
349 doc/Makefile
350 libswfdec/Makefile
351 libswfdec/jpeg/Makefile
352 libswfdec-gtk/Makefile
353 player/Makefile
354 test/Makefile
355 test/image/Makefile
356 test/sound/Makefile
357 test/trace/Makefile
358 test/various/Makefile
359 vivified/Makefile
360 vivified/core/Makefile
361 vivified/dock/Makefile
362 vivified/ui/Makefile
365 AC_OUTPUT