don't set __constructor__ in Flash <= 5
[swfdec.git] / configure.ac
blob3aa5e4caf5163839c0a2b85e1704c92cff359628
1 AC_PREREQ([2.58])
2 AC_INIT(swfdec,0.5.2.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, 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")
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="2: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
57 AC_HEADER_STDC([])
59 dnl ##############################
60 dnl # Do automated configuration #
61 dnl ##############################
63 dnl Check for tools:
64 dnl ================
66 dnl modify pkg-config path
67 AC_ARG_WITH(pkg-config-path, 
68    AC_HELP_STRING([--with-pkg-config-path],[colon-separated list of pkg-config(1) dirs]),
69    [export PKG_CONFIG_PATH=${withval}])
71 dnl Check for essential libraries first:
72 dnl ====================================
74 GLIB_VER=2.4
75 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_VER gobject-2.0 >= $GLIB_VER,
76                 HAVE_GLIB=yes, HAVE_GLIB=no)
77 if test "$HAVE_GLIB" = "no"; then
78   AC_MSG_ERROR([glib-2.0 >= $GLIB_VER and gobject-2.0 >= $GLIB_VER are required to build swfdec])
80 AC_SUBST(GLIB_LIBS)
81 AC_SUBST(GLIB_CFLAGS)
82 AC_SUBST(GLIB_VER)
83 dnl we detect gthread seperately for now, since we don't want to link libswfdec to it (yet)
84 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GLIB_VER,
85                 HAVE_GLIB=yes, HAVE_GLIB=no)
86 if test "$HAVE_GTHREAD" = "no"; then
87   AC_MSG_ERROR([gthread-2.0 >= $GLIB_VER is required to build swfdec])
89 dnl FIXME: detect these executables correctly
90 GLIB_GENMARSHAL=glib-genmarshal
91 AC_SUBST(GLIB_GENMARSHAL)
92 GLIB_MKENUMS=glib-mkenums
93 AC_SUBST(GLIB_MKENUMS)
95 PKG_CHECK_MODULES(PANGO, pangocairo, HAVE_PANGO=yes, HAVE_PANGO=no)
96 if test "$HAVE_PANGO" = "no"; then
97   AC_MSG_ERROR([pangocairo is required to build swfdec])
99 AC_SUBST(PANGO_LIBS)
100 AC_SUBST(PANGO_CFLAGS)
102 AC_ARG_ENABLE(gtk,
103         AS_HELP_STRING([--enable-gtk],
104                         [enable Gtk integration (default=yes)])],
105         enable_gtk=$enableval,
106         enable_gtk="yes")
108 dnl 
109 dnl GTK: We want this for swfdec-gtk
111 GTK_VER=2.8.0
112 AC_SUBST(GTK_VER)
113 if test "$enable_gtk" = "yes"; then
114         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER, HAVE_GTK=yes, HAVE_GTK=no)
115         if test "x$HAVE_GTK" = xyes; then
116           AC_DEFINE(HAVE_GTK, 1, [Define if Gtk is enabled])
117         else
118           AC_MSG_ERROR([Couldn't find a suitable Gtk version. You need at least version $GTK_VER])
119         fi
120 else
121         AC_MSG_WARN([*** Gtk support was not enabled. ***])
123 AM_CONDITIONAL(WITH_GTK, [test "x$HAVE_GTK" = xyes])
126 dnl audio backend
128 AC_ARG_WITH(audio,
129             [AC_HELP_STRING([--with-audio=@<:@auto/alsa/oss/none@:>@],
130                             [audio backend to use])],,
131             [with_audio=auto])
133 AUDIO_TYPE=
134 if test "$with_audio" = "auto" -o "$with_audio" = "alsa"; then
135   PKG_CHECK_MODULES(ALSA, alsa >= 1.0, AUDIO_TYPE=alsa)
136   if test "$AUDIO_TYPE" = "alsa"; then
137     with_audio=alsa
138     AUDIO_CFLAGS=$ALSA_CFLAGS
139     AUDIO_LIBS=$ALSA_LIBS
140   else
141     if test "$with_audio" = "alsa"; then
142       AC_MSG_ERROR([no alsa audio support])
143     else
144       AC_MSG_WARN([no alsa audio support])
145     fi
146   fi
149 dnl Assume OSS is available if ALSA wasn't found and we're "auto".
150 if test "$with_audio" = "auto" -o "$with_audio" = "oss"; then
151   with_audio="oss"
152   AUDIO_CFLAGS=
153   AUDIO_LIBS=
154   AUDIO_TYPE=oss
157 if test "$with_audio" = "auto" -o "$with_audio" = "none"; then
158   AUDIO_CFLAGS=
159   AUDIO_LIBS=
160   AUDIO_TYPE=none
163 if test "x$AUDIO_TYPE" = "x"; then
164   AC_MSG_ERROR([desired audio support could not be used])
165 else
166   AC_MSG_NOTICE([audio backend: $AUDIO_TYPE])
168 AC_SUBST(AUDIO_LIBS)
169 AC_SUBST(AUDIO_CFLAGS)
170 AC_SUBST(AUDIO_TYPE)
172 LIBOIL_VER=0.3.1
173 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= $LIBOIL_VER, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
174 AC_SUBST(LIBOIL_LIBS)
175 AC_SUBST(LIBOIL_CFLAGS)
176 if test "$HAVE_LIBOIL" = "no"; then
177   AC_MSG_ERROR([liboil-0.3 >= $LIBOIL_VER is required to build swfdec])
180 CAIRO_VER=1.2.0
181 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VER, HAVE_CAIRO=yes, HAVE_CAIRO=no)
182 AC_SUBST(CAIRO_LIBS)
183 AC_SUBST(CAIRO_CFLAGS)
184 if test "$HAVE_CAIRO" = "no"; then
185   AC_MSG_ERROR([cairo >= $CAIRO_VER is required to build swfdec])
188 AC_ARG_ENABLE(mad,
189         AS_HELP_STRING([--enable-mad],
190                         [enable mad audio (default=yes)])],
191         enable_mad=$enableval,
192         enable_mad="yes")
194 if test "$enable_mad" = "yes"; then
195         AC_CHECK_LIB(mad, mad_decoder_finish, HAVE_MAD="yes" MAD_LIBS="-lmad", HAVE_MAD="no")
196         AC_SUBST(MAD_LIBS)
197         if test "x$HAVE_MAD" = xyes; then
198           AC_DEFINE(HAVE_MAD, 1, [Define if mad is enabled])
199         else
200           AC_MSG_ERROR([Couldn't find mad. You might need to install the libmad0-dev package.])
201         fi
202 else
203         AC_MSG_WARN([*** mad audio support was not enabled. ***])
205 AM_CONDITIONAL(HAVE_MAD, [test "x$HAVE_MAD" = xyes])
207 dnl  I'd put a required version in here if distros can agree on a way
208 dnl  to detect ffmpeg. But as it stands even pkg-config versions are weird.
209 dnl  So you'll have to update your ffmpeg checkout if compilation fails.
210 dnl  Or you submit a patch that detects ffmpeg reliably on the distros.
211 AC_ARG_ENABLE(ffmpeg,
212         AS_HELP_STRING([--enable-ffmpeg],
213                         [enable ffmpeg support (default=yes)])],
214         enable_ffmpeg=$enableval,
215         enable_ffmpeg="yes")
217 if test "$enable_ffmpeg" = "yes"; then
218         PKG_CHECK_MODULES(FFMPEG, libavcodec libswscale, HAVE_FFMPEG=yes, HAVE_FFMPEG=no)
219         AC_SUBST(FFMPEG_CFLAGS)
220         AC_SUBST(FFMPEG_LIBS)
221         if test "x$HAVE_FFMPEG" = xyes; then
222           AC_DEFINE(HAVE_FFMPEG, 1, [Define if ffmpeg is enabled])
223         else
224           AC_MSG_ERROR([Couldn't find ffmpeg. You might need to install the libavcodec-dev and libswscale-dev packages.])
225         fi
226 else
227         AC_MSG_WARN([*** ffmpeg support was not enabled. ***])
229 AM_CONDITIONAL(HAVE_FFMPEG, [test "x$HAVE_FFMPEG" = xyes])
230 AC_ARG_ENABLE(gstreamer,
231         AS_HELP_STRING([--enable-gstreamer],
232                         [enable GStreamer support (default=yes)])],
233         enable_gstreamer=$enableval,
234         enable_gstreamer="yes")
236 if test "$enable_gstreamer" = "yes"; then
237         GST_REQUIRED=0.10.11
238         PKG_CHECK_MODULES(GST, gstreamer-0.10 >= $GST_REQUIRED, HAVE_GST=yes, HAVE_GST=no)
239         if test "x$HAVE_GST" = xyes; then
240           AC_DEFINE(HAVE_GST, 1, [Define if GStreamer is enabled])
241         else
242           AC_MSG_ERROR([Couldn't find GStreamer $GST_REQUIRED.])
243         fi
244 else
245         AC_MSG_WARN([*** GStreamer support was not enabled. ***])
247 AM_CONDITIONAL(HAVE_GST, [test "x$HAVE_GST" = xyes])
250 AC_ARG_ENABLE(soup,
251         AS_HELP_STRING([--enable-soup],
252                         [enable libaoup HTTP support for swfdec-gtk (default=yes)])],
253         enable_libsoup=$enableval,
254         enable_libsoup="yes")
256 if test "$enable_libsoup" = "yes"; then
257         PKG_CHECK_MODULES(HTTP, libsoup-2.2 >= 2.2.0, HAVE_HTTP=yes, HAVE_HTTP=no)
258         if test "x$HAVE_HTTP" = xyes; then
259           AC_DEFINE(HAVE_HTTP, 1, [Define if libsoup is enabled])
260         else
261           AC_MSG_ERROR([Couldn't find libsoup-2.2.])
262         fi
263 else
264         AC_MSG_WARN([*** libsoup HTTP support was not enabled. ***])
266 AM_CONDITIONAL(HAVE_HTTP, [test "x$HAVE_HTTP" = xyes])
268 AC_ARG_ENABLE(vivified,
269         AS_HELP_STRING([--enable-vivified],
270                         [enable Vivified Flash debugger (default=no)])],
271         enable_vivi=$enableval,
272         enable_vivi="no")
273 if test "$enable_vivi" = "yes"; then
274         MING_REQUIRED=0.4.0.beta5
275         VIVI_GTK_REQUIRED=2.11.6
276         PKG_CHECK_MODULES(VIVI, libming >= $MING_REQUIRED gmodule-export-2.0 gtk+-2.0 >= $VIVI_GTK_REQUIRED, HAVE_VIVI=yes, HAVE_VIVI=no)
277         if test "x$HAVE_VIVI" = xyes; then
278           AC_DEFINE(HAVE_VIVI, 1, [Define if Vivified is enabled])
279         else
280           AC_MSG_ERROR([Vivified requirements not met. You need libming >= $MING_REQUIRED and Gtk+ >= $VIVI_GTK_REQUIRED.])
281         fi
282 else
283         AC_MSG_WARN([*** Vivified was not enabled. ***])
285 AM_CONDITIONAL(HAVE_VIVI, [test "x$HAVE_VIVI" = xyes])
288 AC_SUBST(GLOBAL_CFLAGS)
289 AC_SUBST(GLOBAL_CFLAGS)
291 SWFDEC_CFLAGS="-I\$(top_srcdir) $GLIB_CFLAGS $CAIRO_CFLAGS"
292 SWFDEC_LIBS="\$(top_builddir)/libswfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz"
293 AC_SUBST(SWFDEC_LIBS)
294 AC_SUBST(SWFDEC_CFLAGS)
296 SWFDEC_GTK_CFLAGS="$SWFDEC_CFLAGS $GTK_CFLAGS"
297 SWFDEC_GTK_LIBS="\$(top_builddir)/libswfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
298 AC_SUBST(SWFDEC_GTK_LIBS)
299 AC_SUBST(SWFDEC_GTK_CFLAGS)
301 GTK_DOC_CHECK([1.6])
303 if test "x${prefix}" = "xNONE"; then
304   PACKAGE_PREFIX=${ac_default_prefix}
305 else
306   PACKAGE_PREFIX=${prefix}
308 AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "$PACKAGE_PREFIX", [Define the package prefix])
309 AC_SUBST(PACKAGE_PREFIX)
311 dnl #########################
312 dnl # Make the output files #
313 dnl #########################
315 dnl testsuite/autoplug/Makefile
316 dnl testsuite/Makefile
317 AC_CONFIG_FILES(
318 Makefile
319 doc/Makefile
320 libswfdec/Makefile
321 libswfdec/jpeg/Makefile
322 libswfdec-gtk/Makefile
323 player/Makefile
324 test/Makefile
325 test/image/Makefile
326 test/sound/Makefile
327 test/trace/Makefile
328 test/various/Makefile
329 vivified/Makefile
330 vivified/core/Makefile
331 vivified/dock/Makefile
332 vivified/ui/Makefile
333 swfdec.pc
334 swfdec-gtk.pc
335 swfdec.spec
338 AC_OUTPUT