Fix few bugs in SwfdecGtkSocket that made it unusable
[swfdec.git] / configure.ac
blob28ab014f80792950c8f4b8f6fe5cc26f6341426a
1 AC_PREREQ([2.58])
2 AC_INIT(swfdec,0.7.5)
4 [is_dev=$(echo $PACKAGE_VERSION | sed 's/[0-9]\.[0-9][0-9]*\.[0-9]*[13579]/1/')]
5 if test x"$is_dev" = 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([])
14 SWFDEC_MAJORMINOR=0.7
15 AC_SUBST(SWFDEC_MAJORMINOR)
17 AM_CONFIG_HEADER(config.h)
18 AC_CONFIG_MACRO_DIR([m4])
20 dnl decide on error flags
21 dnl if we support them, we set them unconditionally
22 dnl FIXME: I want this but stupid headers don't let me: -Wshadow
23 dnl FIXME: readd -Wlogical-op when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513 is solved
24 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")
25 dnl if we're in nano >= 1, add -Werror if supported
26 if test x$SWFDEC_CVS = xyes ; then
27   AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Werror")
28   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_WARNING"
29 else
30   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_ERROR"
32 AC_DEFINE_UNQUOTED(SWFDEC_LEVEL_DEFAULT, $DEFAULT_DEBUG_LEVEL, [Default debug level used])
34 SWFDEC_LIBVERSION="1:0:0"
35 AC_SUBST(SWFDEC_LIBVERSION)
36 AM_PROG_LIBTOOL
38 dnl C99 is only required to get definitions for NAN and INFINITY.
39 AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-std=gnu99")
41 dnl ensures the library is linked against the internal Mozilla
42 dnl if this doesn't work on your platform, I'll take patches :)
43 SYMBOLIC_LDFLAGS="-Wl,-Bsymbolic"
44 AC_SUBST(SYMBOLIC_LDFLAGS)
46 dnl Add parameters for aclocal
47 dnl (This must come after AM_INIT_AUTOMAKE, since it modifies ACLOCAL)
48 #ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
50 AC_PROG_CC
51 AM_PROG_CC_STDC
52 AM_PROG_CC_C_O
53 AM_PROG_AS
54 AC_PROG_AWK
56 AC_HEADER_STDC
58 AC_MSG_CHECKING([for timezone support])
59 AC_COMPILE_IFELSE([
60   AC_LANG_PROGRAM([[
61     @%:@include <time.h>
62   ]], [[
63     time_t t;
64     localtime (&t)->tm_gmtoff;
65   ]])],
66   HAVE_TIMEZONE="yes",
67   HAVE_TIMEZONE="no")
68 if test "x$HAVE_TIMEZONE" = "xyes"; then
69   AC_MSG_RESULT([yes])
70   AC_DEFINE(HAVE_TIMEZONE, 1, [Define if we can query the timezone])
71 else
72   AC_MSG_RESULT([no])
76 dnl ##############################
77 dnl # Do automated configuration #
78 dnl ##############################
80 dnl Check for tools:
81 dnl ================
83 dnl modify pkg-config path
84 AC_ARG_WITH(pkg-config-path, 
85    AC_HELP_STRING([--with-pkg-config-path],[colon-separated list of pkg-config(1) dirs]),
86    [export PKG_CONFIG_PATH=${withval}])
88 dnl Check for essential libraries first:
89 dnl ====================================
91 GLIB_VER=2.16
92 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_VER gobject-2.0 >= $GLIB_VER gthread-2.0 >= $GLIB_VER,
93                 HAVE_GLIB=yes, HAVE_GLIB=no)
94 if test "$HAVE_GLIB" = "no"; then
95   AC_MSG_ERROR([glib-2.0, gobject-2.0 and gthread-2.0 >= $GLIB_VER are required to build swfdec])
97 AC_SUBST(GLIB_LIBS)
98 AC_SUBST(GLIB_CFLAGS)
99 AC_SUBST(GLIB_VER)
100 dnl FIXME: detect these executables correctly
101 GLIB_GENMARSHAL=glib-genmarshal
102 AC_SUBST(GLIB_GENMARSHAL)
103 GLIB_MKENUMS=glib-mkenums
104 AC_SUBST(GLIB_MKENUMS)
106 PANGO_VER=1.16
107 PKG_CHECK_MODULES(PANGO, pangocairo >= $PANGO_VER, HAVE_PANGO=yes, HAVE_PANGO=no)
108 if test "$HAVE_PANGO" = "no"; then
109   AC_MSG_ERROR([pangocairo >= $PANGO_VER is required to build swfdec])
111 AC_SUBST(PANGO_LIBS)
112 AC_SUBST(PANGO_CFLAGS)
114 AC_ARG_ENABLE(gtk,
115         AS_HELP_STRING([--enable-gtk],
116                         [enable build of swfdec-gtk (default=yes)])],
117         enable_gtk=$enableval,
118         enable_gtk="yes")
120 dnl 
121 dnl GTK: We want this for swfdec-gtk
123 GTK_VER=2.8.0
124 AC_SUBST(GTK_VER)
125 if test "$enable_gtk" = "yes"; then
126         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER libsoup-2.4, HAVE_GTK=yes)
127         AC_DEFINE(HAVE_GTK, 1, [Define if Gtk is enabled])
128 else
129         AC_MSG_NOTICE([Gtk support was not enabled.])
131 AM_CONDITIONAL(WITH_GTK, [test "x$HAVE_GTK" = xyes])
134 dnl audio backend
136 AC_ARG_WITH(audio,
137             [AC_HELP_STRING([--with-audio=@<:@auto/pulse/none@:>@],
138                             [audio backend to use])],,
139             [with_audio=alsa])
141 AUDIO_TYPE=
142 if test "$with_audio" = "alsa"; then
143   PKG_CHECK_MODULES(ALSA, alsa >= 1.0, AUDIO_TYPE=alsa)
144   if test "$AUDIO_TYPE" = "alsa"; then
145     AUDIO_CFLAGS=$ALSA_CFLAGS
146     AUDIO_LIBS=$ALSA_LIBS
147   else
148     if test "$with_audio" = "alsa"; then
149       AC_MSG_ERROR([no alsa audio support])
150     else
151       AC_MSG_WARN([no alsa audio support])
152     fi
153   fi
156 dnl Use PA if ALSA wasn't found and we're auto and it's available.
157 dnl Disabled for now until the PA backend works.
158 if test "$with_audio" = "pulse"; then
159   PKG_CHECK_MODULES(PA, libpulse-mainloop-glib, AUDIO_TYPE="pulse")
160   if test "$AUDIO_TYPE" = "pulse"; then
161     AUDIO_CFLAGS=$PA_CFLAGS
162     AUDIO_LIBS=$PA_LIBS
163   else
164     if test "$with_audio" = "pulse"; then
165       AC_MSG_ERROR([no pulseaudio support])
166     else
167       AC_MSG_WARN([no pulseaudio support])
168     fi
169   fi
172 dnl If all else fails, fall back to none.
173 if test "$with_audio" = "none"; then
174   AUDIO_CFLAGS=
175   AUDIO_LIBS=
176   AUDIO_TYPE=none
179 if test "x$AUDIO_TYPE" = "x"; then
180   AC_MSG_ERROR([audio backend "$with_audio" could not be used])
181 else
182   AC_MSG_NOTICE([audio backend: $AUDIO_TYPE])
184 AC_SUBST(AUDIO_LIBS)
185 AC_SUBST(AUDIO_CFLAGS)
186 AC_SUBST(AUDIO_TYPE)
188 LIBOIL_VER=0.3.1
189 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= $LIBOIL_VER, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
190 AC_SUBST(LIBOIL_LIBS)
191 AC_SUBST(LIBOIL_CFLAGS)
192 if test "$HAVE_LIBOIL" = "no"; then
193   AC_MSG_ERROR([liboil-0.3 >= $LIBOIL_VER is required to build swfdec])
196 CAIRO_VER=1.6.0
197 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VER cairo-png >= $CAIRO_VER, HAVE_CAIRO=yes, HAVE_CAIRO=no)
198 AC_SUBST(CAIRO_LIBS)
199 AC_SUBST(CAIRO_CFLAGS)
200 if test "$HAVE_CAIRO" = "no"; then
201   AC_MSG_ERROR([cairo and cairo-png = $CAIRO_VER is required to build swfdec])
204 AC_ARG_ENABLE(gstreamer,
205         AS_HELP_STRING([--enable-gstreamer],
206                         [enable GStreamer support (default=yes)])],
207         enable_gstreamer=$enableval,
208         enable_gstreamer="yes")
210 if test "$enable_gstreamer" = "yes"; then
211         GST_REQUIRED=0.10.11
212         GST_PB_REQUIRED=0.10.15
213         PKG_CHECK_MODULES(GST, gstreamer-0.10 >= $GST_REQUIRED gstreamer-pbutils-0.10 >= $GST_PB_REQUIRED, HAVE_GST=yes, HAVE_GST=no)
214         if test "x$HAVE_GST" = xyes; then
215           AC_DEFINE(HAVE_GST, 1, [Define if GStreamer is enabled])
216         else
217           AC_MSG_ERROR([Couldn't find GStreamer $GST_REQUIRED and gstreamer-pbutils $GST_PB_REQUIRED.])
218         fi
219 else
220         AC_MSG_NOTICE([GStreamer support was not enabled.])
222 AM_CONDITIONAL(HAVE_GST, [test "x$HAVE_GST" = xyes])
225 AC_ARG_ENABLE(vivified,
226         AS_HELP_STRING([--enable-vivified],
227                         [enable Vivified Flash debugger (default=no)])],
228         enable_vivi=$enableval,
229         enable_vivi="no")
230 if test "$enable_vivi" = "yes"; then
231         AM_PROG_LEX
232         MING_REQUIRED=0.4.0.beta5
233         VIVI_GTK_REQUIRED=2.11.6
234         VIVI_GLIB_REQUIRED=2.14
235         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)
236         if test "x$HAVE_VIVI" = xyes; then
237           AC_DEFINE(HAVE_VIVI, 1, [Define if Vivified is enabled])
238         else
239           AC_MSG_ERROR([Vivified requirements not met. You need libming >= $MING_REQUIRED, glib >= $VIVI_GLIB_REQUIRED and Gtk+ >= $VIVI_GTK_REQUIRED.])
240         fi
241 else
242         AC_MSG_NOTICE([Vivified was not enabled.])
244 AM_CONDITIONAL(HAVE_VIVI, [test "x$HAVE_VIVI" = xyes])
247 AC_SUBST(GLOBAL_CFLAGS)
248 AC_SUBST(GLOBAL_CFLAGS)
250 SWFDEC_CFLAGS="-I\$(top_srcdir) $GLIB_CFLAGS $CAIRO_CFLAGS"
251 SWFDEC_LIBS="\$(top_builddir)/swfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz -lm"
252 AC_SUBST(SWFDEC_LIBS)
253 AC_SUBST(SWFDEC_CFLAGS)
255 SWFDEC_GTK_CFLAGS="$SWFDEC_CFLAGS $GTK_CFLAGS"
256 SWFDEC_GTK_LIBS="\$(top_builddir)/swfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
257 AC_SUBST(SWFDEC_GTK_LIBS)
258 AC_SUBST(SWFDEC_GTK_CFLAGS)
260 GTK_DOC_CHECK([1.6])
262 if test "x${prefix}" = "xNONE"; then
263   PACKAGE_PREFIX=${ac_default_prefix}
264 else
265   PACKAGE_PREFIX=${prefix}
267 AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "$PACKAGE_PREFIX", [Define the package prefix])
268 AC_SUBST(PACKAGE_PREFIX)
270 dnl #########################
271 dnl # Make the output files #
272 dnl #########################
274 dnl testsuite/autoplug/Makefile
275 dnl testsuite/Makefile
276 AC_CONFIG_FILES(
277 Makefile
278 data/Makefile
279 data/swfdec.pc
280 data/swfdec-gtk.pc
281 doc/Makefile
282 swfdec/Makefile
283 swfdec/jpeg/Makefile
284 swfdec-gtk/Makefile
285 player/Makefile
286 test/Makefile
287 test/custom/Makefile
288 test/gnash/Makefile
289 test/gnash/media/Makefile
290 test/gnash/actionscript.all/Makefile
291 test/gnash/misc-mtasc.all/Makefile
292 test/gnash/misc-swfc.all/Makefile
293 test/gnash/misc-swfmill.all/Makefile
294 test/image/Makefile
295 test/sound/Makefile
296 test/trace/Makefile
297 test/various/Makefile
298 tools/Makefile
299 vivified/Makefile
300 vivified/code/Makefile
301 vivified/code/test/Makefile
302 vivified/code/test/compiler/Makefile
303 vivified/code/test/decompiler/Makefile
304 vivified/core/Makefile
305 vivified/dock/Makefile
306 vivified/ui/Makefile
309 AC_OUTPUT