Don't scare people about disabled dependencies
[swfdec.git] / configure.ac
blob2dc0eedbc42085c5f2bc1c139cf906e2df755b9c
1 AC_PREREQ([2.58])
2 AC_INIT(swfdec,0.5.3.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="3: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.10
76 PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_VER gobject-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 >= $GLIB_VER and gobject-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 we detect gthread seperately for now, since we don't want to link libswfdec to it (yet)
85 PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GLIB_VER,
86                 HAVE_GLIB=yes, HAVE_GLIB=no)
87 if test "$HAVE_GTHREAD" = "no"; then
88   AC_MSG_ERROR([gthread-2.0 >= $GLIB_VER is required to build swfdec])
90 dnl FIXME: detect these executables correctly
91 GLIB_GENMARSHAL=glib-genmarshal
92 AC_SUBST(GLIB_GENMARSHAL)
93 GLIB_MKENUMS=glib-mkenums
94 AC_SUBST(GLIB_MKENUMS)
96 PKG_CHECK_MODULES(PANGO, pangocairo, HAVE_PANGO=yes, HAVE_PANGO=no)
97 if test "$HAVE_PANGO" = "no"; then
98   AC_MSG_ERROR([pangocairo is required to build swfdec])
100 AC_SUBST(PANGO_LIBS)
101 AC_SUBST(PANGO_CFLAGS)
103 AC_ARG_ENABLE(gtk,
104         AS_HELP_STRING([--enable-gtk],
105                         [enable Gtk integration (default=yes)])],
106         enable_gtk=$enableval,
107         enable_gtk="yes")
109 dnl 
110 dnl GTK: We want this for swfdec-gtk
112 GTK_VER=2.8.0
113 AC_SUBST(GTK_VER)
114 if test "$enable_gtk" = "yes"; then
115         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_VER, HAVE_GTK=yes, HAVE_GTK=no)
116         if test "x$HAVE_GTK" = xyes; then
117           AC_DEFINE(HAVE_GTK, 1, [Define if Gtk is enabled])
118         else
119           AC_MSG_ERROR([Couldn't find a suitable Gtk version. You need at least version $GTK_VER])
120         fi
121 else
122         AC_MSG_WARN([*** Gtk support was not enabled. ***])
124 AM_CONDITIONAL(WITH_GTK, [test "x$HAVE_GTK" = xyes])
127 dnl audio backend
129 AC_ARG_WITH(audio,
130             [AC_HELP_STRING([--with-audio=@<:@auto/alsa/oss/none@:>@],
131                             [audio backend to use])],,
132             [with_audio=auto])
134 AUDIO_TYPE=
135 if test "$with_audio" = "auto" -o "$with_audio" = "alsa"; then
136   PKG_CHECK_MODULES(ALSA, alsa >= 1.0, AUDIO_TYPE=alsa)
137   if test "$AUDIO_TYPE" = "alsa"; then
138     with_audio=alsa
139     AUDIO_CFLAGS=$ALSA_CFLAGS
140     AUDIO_LIBS=$ALSA_LIBS
141   else
142     if test "$with_audio" = "alsa"; then
143       AC_MSG_ERROR([no alsa audio support])
144     else
145       AC_MSG_WARN([no alsa audio support])
146     fi
147   fi
150 dnl Assume OSS is available if ALSA wasn't found and we're "auto".
151 if test "$with_audio" = "auto" -o "$with_audio" = "oss"; then
152   with_audio="oss"
153   AUDIO_CFLAGS=
154   AUDIO_LIBS=
155   AUDIO_TYPE=oss
158 if test "$with_audio" = "auto" -o "$with_audio" = "none"; then
159   AUDIO_CFLAGS=
160   AUDIO_LIBS=
161   AUDIO_TYPE=none
164 if test "x$AUDIO_TYPE" = "x"; then
165   AC_MSG_ERROR([desired audio support could not be used])
166 else
167   AC_MSG_NOTICE([audio backend: $AUDIO_TYPE])
169 AC_SUBST(AUDIO_LIBS)
170 AC_SUBST(AUDIO_CFLAGS)
171 AC_SUBST(AUDIO_TYPE)
173 LIBOIL_VER=0.3.1
174 PKG_CHECK_MODULES(LIBOIL, liboil-0.3 >= $LIBOIL_VER, HAVE_LIBOIL=yes, HAVE_LIBOIL=no)
175 AC_SUBST(LIBOIL_LIBS)
176 AC_SUBST(LIBOIL_CFLAGS)
177 if test "$HAVE_LIBOIL" = "no"; then
178   AC_MSG_ERROR([liboil-0.3 >= $LIBOIL_VER is required to build swfdec])
181 CAIRO_VER=1.2.0
182 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VER, HAVE_CAIRO=yes, HAVE_CAIRO=no)
183 AC_SUBST(CAIRO_LIBS)
184 AC_SUBST(CAIRO_CFLAGS)
185 if test "$HAVE_CAIRO" = "no"; then
186   AC_MSG_ERROR([cairo >= $CAIRO_VER is required to build swfdec])
189 AC_ARG_ENABLE(mad,
190         AS_HELP_STRING([--enable-mad],
191                         [enable mad audio (default=yes)])],
192         enable_mad=$enableval,
193         enable_mad="yes")
195 if test "$enable_mad" = "yes"; then
196         AC_CHECK_LIB(mad, mad_decoder_finish, HAVE_MAD="yes" MAD_LIBS="-lmad", HAVE_MAD="no")
197         AC_SUBST(MAD_LIBS)
198         if test "x$HAVE_MAD" = xyes; then
199           AC_DEFINE(HAVE_MAD, 1, [Define if mad is enabled])
200         else
201           AC_MSG_ERROR([Couldn't find mad. You might need to install the libmad0-dev package.])
202         fi
203 else
204         AC_MSG_NOTICE([mad audio support was not enabled.])
206 AM_CONDITIONAL(HAVE_MAD, [test "x$HAVE_MAD" = xyes])
208 dnl  I'd put a required version in here if distros can agree on a way
209 dnl  to detect ffmpeg. But as it stands even pkg-config versions are weird.
210 dnl  So you'll have to update your ffmpeg checkout if compilation fails.
211 dnl  Or you submit a patch that detects ffmpeg reliably on the distros.
212 AC_ARG_ENABLE(ffmpeg,
213         AS_HELP_STRING([--enable-ffmpeg],
214                         [enable ffmpeg support (default=yes)])],
215         enable_ffmpeg=$enableval,
216         enable_ffmpeg="yes")
218 if test "$enable_ffmpeg" = "yes"; then
219         PKG_CHECK_MODULES(FFMPEG, libavcodec libswscale, HAVE_FFMPEG=yes, HAVE_FFMPEG=no)
220         AC_SUBST(FFMPEG_CFLAGS)
221         AC_SUBST(FFMPEG_LIBS)
222         if test "x$HAVE_FFMPEG" = xyes; then
223           AC_DEFINE(HAVE_FFMPEG, 1, [Define if ffmpeg is enabled])
224         else
225           AC_MSG_ERROR([Couldn't find ffmpeg. You might need to install the libavcodec-dev and libswscale-dev packages.])
226         fi
227 else
228         AC_MSG_NOTICE([ffmpeg support was not enabled.])
230 AM_CONDITIONAL(HAVE_FFMPEG, [test "x$HAVE_FFMPEG" = xyes])
231 AC_ARG_ENABLE(gstreamer,
232         AS_HELP_STRING([--enable-gstreamer],
233                         [enable GStreamer support (default=yes)])],
234         enable_gstreamer=$enableval,
235         enable_gstreamer="yes")
237 if test "$enable_gstreamer" = "yes"; then
238         GST_REQUIRED=0.10.11
239         PKG_CHECK_MODULES(GST, gstreamer-0.10 >= $GST_REQUIRED, HAVE_GST=yes, HAVE_GST=no)
240         if test "x$HAVE_GST" = xyes; then
241           AC_DEFINE(HAVE_GST, 1, [Define if GStreamer is enabled])
242         else
243           AC_MSG_ERROR([Couldn't find GStreamer $GST_REQUIRED.])
244         fi
245 else
246         AC_MSG_NOTICE([GStreamer support was not enabled.])
248 AM_CONDITIONAL(HAVE_GST, [test "x$HAVE_GST" = xyes])
251 AC_ARG_ENABLE(soup,
252         AS_HELP_STRING([--enable-soup],
253                         [enable libsoup HTTP support for swfdec-gtk (default=yes)])],
254         enable_libsoup=$enableval,
255         enable_libsoup="yes")
257 if test "$enable_libsoup" = "yes"; then
258         PKG_CHECK_MODULES(HTTP, libsoup-2.2 >= 2.2.0, HAVE_HTTP=yes, HAVE_HTTP=no)
259         if test "x$HAVE_HTTP" = xyes; then
260           AC_DEFINE(HAVE_HTTP, 1, [Define if libsoup is enabled])
261         else
262           AC_MSG_ERROR([Couldn't find libsoup-2.2.])
263         fi
264 else
265         AC_MSG_NOTICE([libsoup HTTP support was not enabled.])
267 AM_CONDITIONAL(HAVE_HTTP, [test "x$HAVE_HTTP" = xyes])
269 AC_ARG_ENABLE(vivified,
270         AS_HELP_STRING([--enable-vivified],
271                         [enable Vivified Flash debugger (default=no)])],
272         enable_vivi=$enableval,
273         enable_vivi="no")
274 if test "$enable_vivi" = "yes"; then
275         MING_REQUIRED=0.4.0.beta5
276         VIVI_GTK_REQUIRED=2.11.6
277         PKG_CHECK_MODULES(VIVI, libming >= $MING_REQUIRED gmodule-export-2.0 gtk+-2.0 >= $VIVI_GTK_REQUIRED, HAVE_VIVI=yes, HAVE_VIVI=no)
278         if test "x$HAVE_VIVI" = xyes; then
279           AC_DEFINE(HAVE_VIVI, 1, [Define if Vivified is enabled])
280         else
281           AC_MSG_ERROR([Vivified requirements not met. You need libming >= $MING_REQUIRED and Gtk+ >= $VIVI_GTK_REQUIRED.])
282         fi
283 else
284         AC_MSG_NOTICE([Vivified was not enabled.])
286 AM_CONDITIONAL(HAVE_VIVI, [test "x$HAVE_VIVI" = xyes])
289 AC_SUBST(GLOBAL_CFLAGS)
290 AC_SUBST(GLOBAL_CFLAGS)
292 SWFDEC_CFLAGS="-I\$(top_srcdir) $GLIB_CFLAGS $CAIRO_CFLAGS"
293 SWFDEC_LIBS="\$(top_builddir)/libswfdec/libswfdec-$SWFDEC_MAJORMINOR.la $GLIB_LIBS $CAIRO_LIBS -lz"
294 AC_SUBST(SWFDEC_LIBS)
295 AC_SUBST(SWFDEC_CFLAGS)
297 SWFDEC_GTK_CFLAGS="$SWFDEC_CFLAGS $GTK_CFLAGS"
298 SWFDEC_GTK_LIBS="\$(top_builddir)/libswfdec-gtk/libswfdec-gtk-$SWFDEC_MAJORMINOR.la $SWFDEC_LIBS $GTK_LIBS"
299 AC_SUBST(SWFDEC_GTK_LIBS)
300 AC_SUBST(SWFDEC_GTK_CFLAGS)
302 GTK_DOC_CHECK([1.6])
304 if test "x${prefix}" = "xNONE"; then
305   PACKAGE_PREFIX=${ac_default_prefix}
306 else
307   PACKAGE_PREFIX=${prefix}
309 AC_DEFINE_UNQUOTED(PACKAGE_PREFIX, "$PACKAGE_PREFIX", [Define the package prefix])
310 AC_SUBST(PACKAGE_PREFIX)
312 dnl #########################
313 dnl # Make the output files #
314 dnl #########################
316 dnl testsuite/autoplug/Makefile
317 dnl testsuite/Makefile
318 AC_CONFIG_FILES(
319 Makefile
320 data/Makefile
321 data/icons/Makefile
322 data/icons/16x16/Makefile
323 data/icons/22x22/Makefile
324 data/icons/24x24/Makefile
325 data/icons/32x32/Makefile
326 data/icons/48x48/Makefile
327 data/icons/scalable/Makefile
328 data/swfdec.pc
329 data/swfdec-gtk.pc
330 doc/Makefile
331 libswfdec/Makefile
332 libswfdec/jpeg/Makefile
333 libswfdec-gtk/Makefile
334 player/Makefile
335 test/Makefile
336 test/image/Makefile
337 test/sound/Makefile
338 test/trace/Makefile
339 test/various/Makefile
340 vivified/Makefile
341 vivified/core/Makefile
342 vivified/dock/Makefile
343 vivified/ui/Makefile
346 AC_OUTPUT