update gitignore
[swfdec.git] / configure.ac
blobd0fe49583b1efeec7ba73cfc34ef9d03dddf690e
1 AC_PREREQ([2.58])
3 m4_define(swfdec_major, 0)
4 m4_define(swfdec_minor, 9)
5 m4_define(swfdec_micro, 1)
6 AC_INIT(swfdec,[swfdec_major.swfdec_minor.swfdec_micro])
8 SWFDEC_VERSION_MAJOR=swfdec_major
9 SWFDEC_VERSION_MINOR=swfdec_minor
10 SWFDEC_VERSION_MICRO=swfdec_micro
11 SWFDEC_VERSION=$SWFDEC_VERSION_MAJOR.$SWFDEC_VERSION_MINOR.$SWFDEC_VERSION_MICRO
12 AC_SUBST(SWFDEC_VERSION_MAJOR)
13 AC_SUBST(SWFDEC_VERSION_MINOR)
14 AC_SUBST(SWFDEC_VERSION_MICRO)
15 AC_SUBST(SWFDEC_VERSION)
18 [SWFDEC_DEVEL=$(echo $SWFDEC_VERSION_MICRO | sed 's/[0-9]*[13579]/yes/')]
19 [SWFDEC_SNAPSHOT=$(echo $SWFDEC_VERSION_MINOR | sed 's/[0-9]*[13579]/yes/')]
21 AM_INIT_AUTOMAKE(1.6)
22 dnl AC_CANONICAL_TARGET([])
24 SWFDEC_MAJORMINOR=$SWFDEC_VERSION_MAJOR.$SWFDEC_VERSION_MINOR
25 AC_SUBST(SWFDEC_MAJORMINOR)
27 AM_CONFIG_HEADER(config.h)
28 AC_CONFIG_MACRO_DIR([m4])
30 dnl decide on error flags
31 dnl if we support them, we set them unconditionally
32 dnl FIXME: I want this but stupid headers don't let me: -Wshadow
33 dnl FIXME: readd -Wlogical-op when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513 is solved
34 AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -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 -Winit-self -Wmissing-include-dirs -Wundef -Waddress -Waggregate-return -Wmissing-format-attribute -Wno-multichar -Wnested-externs")
35 dnl if we're in nano >= 1, add -Werror if supported
36 if test x$SWFDEC_DEVEL = xyes ; then
37   AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Werror")
38   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_WARNING"
39 else
40   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_ERROR"
42 AC_DEFINE_UNQUOTED(SWFDEC_LEVEL_DEFAULT, $DEFAULT_DEBUG_LEVEL, [Default debug level used])
44 dnl Compute the libversion automatically, so there's no need to think about it
45 dnl when bumping versions.
46 dnl Note that the libversions are based on Swfdec's current release mechanism 
47 dnl detailed at 
48 dnl http://lists.freedesktop.org/archives/swfdec/2008-January/001131.html
49 dnl If this ever changes (like when Swfdec gets a stable API), don't forget to
50 dnl change this
51 if test x"$SWFDEC_SNAPSHOT" = xyes ; then
52   SWFDEC_LIBVERSION="$SWFDEC_VERSION_MICRO:0:0"
53 else
54   SWFDEC_LIBVERSION="0:0:0"
56 AC_SUBST(SWFDEC_LIBVERSION)
57 AM_PROG_LIBTOOL
59 dnl C99 is only required to get definitions for NAN and INFINITY.
60 AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-std=gnu99")
62 dnl ensures the library is linked against the internal Mozilla
63 dnl if this doesn't work on your platform, I'll take patches :)
64 SYMBOLIC_LDFLAGS="-Wl,-Bsymbolic"
65 AC_SUBST(SYMBOLIC_LDFLAGS)
67 dnl Add parameters for aclocal
68 dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
69 #ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
71 AC_PROG_CC
72 AM_PROG_CC_STDC
73 AM_PROG_CC_C_O
74 AM_PROG_AS
75 AC_PROG_AWK
77 AC_HEADER_STDC
79 AC_MSG_CHECKING([for timezone support])
80 AC_COMPILE_IFELSE([
81   AC_LANG_PROGRAM([[
82     @%:@include <time.h>
83   ]], [[
84     time_t t;
85     localtime (&t)->tm_gmtoff;
86   ]])],
87   HAVE_TIMEZONE="yes",
88   HAVE_TIMEZONE="no")
89 if test "x$HAVE_TIMEZONE" = "xyes"; then
90   AC_MSG_RESULT([yes])
91   AC_DEFINE(HAVE_TIMEZONE, 1, [Define if we can query the timezone])
92 else
93   AC_MSG_RESULT([no])
97 dnl ##############################
98 dnl # Do automated configuration #
99 dnl ##############################
101 dnl Check for tools:
102 dnl ================
104 dnl modify pkg-config path
105 AC_ARG_WITH(pkg-config-path, 
106    AC_HELP_STRING([--with-pkg-config-path],[colon-separated list of pkg-config(1) dirs]),
107    [export PKG_CONFIG_PATH=${withval}])
109 dnl Check for essential libraries first:
110 dnl ====================================
112 GLIB_VER=2.16
113 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_VER gobject-2.0 >= $GLIB_VER gthread-2.0 >= $GLIB_VER,
114                 HAVE_GLIB=yes, HAVE_GLIB=no)
115 if test "$HAVE_GLIB" = "no"; then
116   AC_MSG_ERROR([glib-2.0, gobject-2.0 and gthread-2.0 >= $GLIB_VER are required to build swfdec])
118 AC_SUBST(GLIB_LIBS)
119 AC_SUBST(GLIB_CFLAGS)
120 AC_SUBST(GLIB_VER)
121 dnl FIXME: detect these executables correctly
122 GLIB_GENMARSHAL=glib-genmarshal
123 AC_SUBST(GLIB_GENMARSHAL)
124 GLIB_MKENUMS=glib-mkenums
125 AC_SUBST(GLIB_MKENUMS)
127 PANGO_VER=1.16
128 PKG_CHECK_MODULES(PANGO, pangocairo >= $PANGO_VER, HAVE_PANGO=yes, HAVE_PANGO=no)
129 if test "$HAVE_PANGO" = "no"; then
130   AC_MSG_ERROR([pangocairo >= $PANGO_VER is required to build swfdec])
132 AC_SUBST(PANGO_LIBS)
133 AC_SUBST(PANGO_CFLAGS)
135 AC_ARG_ENABLE(gtk,
136         AS_HELP_STRING([--enable-gtk],
137                         [enable build of swfdec-gtk (default=yes)])],
138         enable_gtk=$enableval,
139         enable_gtk="yes")
141 dnl 
142 dnl GTK: We want this for swfdec-gtk
144 GTK_VER=2.8.0
145 AC_SUBST(GTK_VER)
146 if test "$enable_gtk" = "yes"; then
147         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER libsoup-2.4, HAVE_GTK=yes)
148         AC_DEFINE(HAVE_GTK, 1, [Define if Gtk is enabled])
149 else
150         AC_MSG_NOTICE([Gtk support was not enabled.])
152 AM_CONDITIONAL(WITH_GTK, [test "x$HAVE_GTK" = xyes])
155 dnl audio backend
157 AC_ARG_WITH(audio,
158             [AC_HELP_STRING([--with-audio=@<:@auto/pulse/none@:>@],
159                             [audio backend to use])],,
160             [with_audio=alsa])
162 AUDIO_TYPE=
163 if test "$with_audio" = "alsa"; then
164   PKG_CHECK_MODULES(ALSA, alsa >= 1.0, AUDIO_TYPE=alsa)
165   if test "$AUDIO_TYPE" = "alsa"; then
166     AUDIO_CFLAGS=$ALSA_CFLAGS
167     AUDIO_LIBS=$ALSA_LIBS
168   else
169     if test "$with_audio" = "alsa"; then
170       AC_MSG_ERROR([no alsa audio support])
171     else
172       AC_MSG_WARN([no alsa audio support])
173     fi
174   fi
177 dnl Use PA if ALSA wasn't found and we're auto and it's available.
178 dnl Disabled for now until the PA backend works.
179 if test "$with_audio" = "pulse"; then
180   PKG_CHECK_MODULES(PA, libpulse-mainloop-glib, AUDIO_TYPE="pulse")
181   if test "$AUDIO_TYPE" = "pulse"; then
182     AUDIO_CFLAGS=$PA_CFLAGS
183     AUDIO_LIBS=$PA_LIBS
184   else
185     if test "$with_audio" = "pulse"; then
186       AC_MSG_ERROR([no pulseaudio support])
187     else
188       AC_MSG_WARN([no pulseaudio support])
189     fi
190   fi
193 dnl If all else fails, fall back to none.
194 if test "$with_audio" = "none"; then
195   AUDIO_CFLAGS=
196   AUDIO_LIBS=
197   AUDIO_TYPE=none
200 if test "x$AUDIO_TYPE" = "x"; then
201   AC_MSG_ERROR([audio backend "$with_audio" could not be used])
202 else
203   AC_MSG_NOTICE([audio backend: $AUDIO_TYPE])
205 AC_SUBST(AUDIO_LIBS)
206 AC_SUBST(AUDIO_CFLAGS)
207 AC_SUBST(AUDIO_TYPE)
209 LIBOIL_VER=0.3.1
210 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= $LIBOIL_VER, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
211 AC_SUBST(LIBOIL_LIBS)
212 AC_SUBST(LIBOIL_CFLAGS)
213 if test "$HAVE_LIBOIL" = "no"; then
214   AC_MSG_ERROR([liboil-0.3 >= $LIBOIL_VER is required to build swfdec])
217 CAIRO_VER=1.6.0
218 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VER cairo-png >= $CAIRO_VER, HAVE_CAIRO=yes, HAVE_CAIRO=no)
219 AC_SUBST(CAIRO_LIBS)
220 AC_SUBST(CAIRO_CFLAGS)
221 if test "$HAVE_CAIRO" = "no"; then
222   AC_MSG_ERROR([cairo and cairo-png = $CAIRO_VER is required to build swfdec])
225 AC_ARG_ENABLE(gstreamer,
226         AS_HELP_STRING([--enable-gstreamer],
227                         [enable GStreamer support (default=yes)])],
228         enable_gstreamer=$enableval,
229         enable_gstreamer="yes")
231 if test "$enable_gstreamer" = "yes"; then
232         GST_REQUIRED=0.10.11
233         GST_PB_REQUIRED=0.10.15
234         PKG_CHECK_MODULES(GST, gstreamer-0.10 >= $GST_REQUIRED gstreamer-pbutils-0.10 >= $GST_PB_REQUIRED, HAVE_GST=yes, HAVE_GST=no)
235         if test "x$HAVE_GST" = xyes; then
236           AC_DEFINE(HAVE_GST, 1, [Define if GStreamer is enabled])
237         else
238           AC_MSG_ERROR([Couldn't find GStreamer $GST_REQUIRED and gstreamer-pbutils $GST_PB_REQUIRED.])
239         fi
240 else
241         AC_MSG_NOTICE([GStreamer support was not enabled.])
243 AM_CONDITIONAL(HAVE_GST, [test "x$HAVE_GST" = xyes])
246 AC_ARG_ENABLE(vivified,
247         AS_HELP_STRING([--enable-vivified],
248                         [enable Vivified Flash debugger (default=no)])],
249         enable_vivi=$enableval,
250         enable_vivi="no")
251 if test "$enable_vivi" = "yes"; then
252         AM_PROG_LEX
253         MING_REQUIRED=0.4.0.beta5
254         VIVI_GTK_REQUIRED=2.11.6
255         VIVI_GLIB_REQUIRED=2.14
256         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)
257         if test "x$HAVE_VIVI" = xyes; then
258           AC_DEFINE(HAVE_VIVI, 1, [Define if Vivified is enabled])
259         else
260           AC_MSG_ERROR([Vivified requirements not met. You need libming >= $MING_REQUIRED, glib >= $VIVI_GLIB_REQUIRED and Gtk+ >= $VIVI_GTK_REQUIRED.])
261         fi
262 else
263         AC_MSG_NOTICE([Vivified was not enabled.])
265 AM_CONDITIONAL(HAVE_VIVI, [test "x$HAVE_VIVI" = xyes])
268 AC_SUBST(GLOBAL_CFLAGS)
269 AC_SUBST(GLOBAL_CFLAGS)
271 SWFDEC_CFLAGS="-I\$(top_srcdir) $GLIB_CFLAGS $CAIRO_CFLAGS"
272 SWFDEC_LIBS="\$(top_builddir)/swfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz -lm"
273 AC_SUBST(SWFDEC_LIBS)
274 AC_SUBST(SWFDEC_CFLAGS)
276 SWFDEC_GTK_CFLAGS="$SWFDEC_CFLAGS $GTK_CFLAGS"
277 SWFDEC_GTK_LIBS="\$(top_builddir)/swfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
278 AC_SUBST(SWFDEC_GTK_LIBS)
279 AC_SUBST(SWFDEC_GTK_CFLAGS)
281 GTK_DOC_CHECK([1.6])
283 if test "x${prefix}" = "xNONE"; then
284   PACKAGE_PREFIX=${ac_default_prefix}
285 else
286   PACKAGE_PREFIX=${prefix}
288 AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "$PACKAGE_PREFIX", [Define the package prefix])
289 AC_SUBST(PACKAGE_PREFIX)
291 dnl #########################
292 dnl # Make the output files #
293 dnl #########################
295 dnl testsuite/autoplug/Makefile
296 dnl testsuite/Makefile
297 AC_CONFIG_FILES(
298 Makefile
299 data/Makefile
300 data/swfdec.pc
301 data/swfdec-gtk.pc
302 doc/Makefile
303 swfdec/Makefile
304 swfdec/swfdec_version.h
305 swfdec/jpeg/Makefile
306 swfdec-gtk/Makefile
307 player/Makefile
308 test/Makefile
309 test/custom/Makefile
310 test/gnash/Makefile
311 test/gnash/media/Makefile
312 test/gnash/actionscript.all/Makefile
313 test/gnash/misc-mtasc.all/Makefile
314 test/gnash/misc-swfc.all/Makefile
315 test/gnash/misc-swfmill.all/Makefile
316 test/image/Makefile
317 test/sound/Makefile
318 test/trace/Makefile
319 test/various/Makefile
320 tools/Makefile
321 vivified/Makefile
322 vivified/code/Makefile
323 vivified/code/test/Makefile
324 vivified/code/test/compiler/Makefile
325 vivified/code/test/decompiler/Makefile
326 vivified/core/Makefile
327 vivified/dock/Makefile
328 vivified/ui/Makefile
331 AC_OUTPUT