9b146ec1a89d6f42b62324059cd2a6558abf6811
[mafwsubrenderer] / configure.ac
1 #
2 # configure.ac for MAFW gstreamer renderer library
3
4 # Author: Visa Smolander <visa.smolander@nokia.com>
5 #
6 # Copyright (C) 2007, 2008, 2009 Nokia. All rights reserved.
7
8 AC_PREREQ([2.53])
9 AC_INIT([mafw-gst-renderer], [0.1.2009.47-1])
10
11 AC_CONFIG_SRCDIR([libmafw-gst-renderer/mafw-gst-renderer.h])
12 AC_CONFIG_HEADERS([config.h])
13 AC_CONFIG_AUX_DIR([build-aux])
14
15 AM_INIT_AUTOMAKE([foreign tar-ustar])
16 AM_MAINTAINER_MODE
17
18 AC_DISABLE_STATIC
19
20 dnl Prevent AC_PROG_CC adding '-g -O2' to CFLAGS.
21 SAVEDCFLAGS="$CFLAGS"
22 AC_PROG_CC
23 if test "x$GCC" = xyes; then
24         CFLAGS="$SAVEDCFLAGS"
25 fi
26
27 AC_PROG_LIBTOOL
28 AC_PROG_INSTALL
29
30 # DISABLED_BY_DEFAULT(NAME, DESCRIPTION)
31 # ---------------------------------
32 # Creates a new --enable-* option, with default value `no'.
33 AC_DEFUN([DISABLED_BY_DEFAULT], [dnl
34          AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2]), [],[dnl
35          m4_bpatsubst([enable_$1], [[^0-9a-z]], [_])=no])dnl
36 ])# DISABLED_BY_DEFAULT
37
38 # ENABLED_BY_DEFAULT(NAME, DESCRIPTION)
39 # ---------------------------------
40 # Creates a new --disable-* option, with default value `yes'.
41 AC_DEFUN([ENABLED_BY_DEFAULT], [dnl
42          AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2]), [],[dnl
43          m4_bpatsubst([enable_$1], [[^0-9a-z]], [_])=yes])dnl
44 ])# ENABLED_BY_DEFAULT
45
46 dnl Prerequisites.
47
48 GSTREAMER_VERSION=0.10.20
49
50 AM_PATH_GLIB_2_0(2.15.0, [], [], [glib])
51 PKG_CHECK_MODULES(DEPS,
52                   gobject-2.0 >= 2.0
53                   gstreamer-0.10 >= $GSTREAMER_VERSION
54                   gstreamer-plugins-base-0.10 >= $GSTREAMER_VERSION
55                   mafw >= 0.1
56                   libosso >= 2.0
57                   x11
58                   hal
59                   totem-plparser
60                   gconf-2.0 >= 2.0
61                   gnome-vfs-2.0
62 )
63
64 dnl Check for GdkPixbuf, needed for dumping current frame
65 GDKPIXBUF_REQUIRED=2.12.0
66 AC_ARG_ENABLE(gdkpixbuf,
67               AS_HELP_STRING([--disable-gdkpixbuf],
68                              [Disable GdkPixbuf support, required for current frame dumping]),,
69               [enable_gdkpixbuf=auto])
70
71 if test "x$enable_gdkpixbuf" != "xno"; then
72    PKG_CHECK_MODULES(GDKPIXBUF,
73                      [gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED],
74                      [have_gdkpixbuf=yes],
75                      [have_gdkpixbuf=no])
76    AC_SUBST(GDKPIXBUF_LIBS)
77    AC_SUBST(GDKPIXBUF_CFLAGS)
78
79    if test "x$have_gdkpixbuf" = "xyes"; then
80       AC_DEFINE(HAVE_GDKPIXBUF, [], [Define if we have GdkPixbuf])
81    fi
82 else
83    have_gdkpixbuf="no (disabled)"
84 fi
85
86 if test "x$enable_gdkpixbuf" = "xyes"; then
87    if test "x$have_gdkpixbuf" != "xyes"; then
88       AC_MSG_ERROR([Couldn't find GdkPixbuf >= $GDKPIXBUF_REQUIRED.])
89    fi
90 fi
91
92 AM_CONDITIONAL(HAVE_GDKPIXBUF, test "x$have_gdkpixbuf" = "xyes")
93
94
95 dnl Check for Conic, needed connection error handling
96 CONIC_REQUIRED=0.16
97 AC_ARG_ENABLE(conic,
98               AS_HELP_STRING([--disable-conic],
99                              [Disable Conic support, required to handle network errors]),,
100               [enable_conic=auto])
101
102 if test "x$enable_conic" != "xno"; then
103    PKG_CHECK_MODULES(CONIC,
104                      [conic >= $CONIC_REQUIRED],
105                      [have_conic=yes],
106                      [have_conic=no])
107    AC_SUBST(CONIC_LIBS)
108    AC_SUBST(CONIC_CFLAGS)
109
110    if test "x$have_conic" = "xyes"; then
111       AC_DEFINE(HAVE_CONIC, [], [Define if we have Conic])
112    fi
113 else
114    have_conic="no (disabled)"
115 fi
116
117 if test "x$enable_conic" = "xyes"; then
118    if test "x$have_conic" != "xyes"; then
119       AC_MSG_ERROR([Couldn't find Conic >= $CONIC_REQUIRED.])
120    fi
121 fi
122
123 AM_CONDITIONAL(HAVE_CONIC, test "x$have_conic" = "xyes")
124
125
126
127 plugindir=`$PKG_CONFIG --variable=plugindir mafw`
128 AC_SUBST(plugindir)
129
130 dnl Default compile flags.  (NOTE: CFLAGS is reserved for the user!)
131
132 AC_SUBST([_CFLAGS])
133 AC_SUBST([_LDFLAGS])
134 _CFLAGS="-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
135 _CFLAGS="$_CFLAGS -ggdb3"
136
137 dnl Configure-time options.
138
139 dnl Debugging.
140 DISABLED_BY_DEFAULT([debug], [compile with debug flags and extra output])
141 if test "x$enable_debug" = xyes; then
142         AC_DEFINE([MAFW_DEBUG], [1], [Enable debugging related parts.])
143         _CFLAGS="$_CFLAGS -O0 -Werror -DGTK_DISABLE_DEPRECATED"
144 else
145         AC_DEFINE([G_DEBUG_DISABLE], [1], [Disable g_debug() calls.])
146         _CFLAGS="$_CFLAGS -O2"
147 fi
148 AS_IF([test "x$enable_debug" = xyes],
149         [AC_DEFINE([MAFW_DEBUG], [1], [Enable extra debug messages])
150          CFLAGS="$CFLAGS -Werror -O0 -ggdb3 -DGTK_DISABLE_DEPRECATED"],
151         [AC_DEFINE([G_DEBUG_DISABLE], [1], [Disable g_debug calls])
152          CFLAGS="$CFLAGS -O2"])
153
154
155 dnl Tests.
156 DISABLED_BY_DEFAULT([tests], [disable unit tests])
157 if test "x${SBOX_DPKG_INST_ARCH}" = "xarmel"; then
158    AC_MSG_WARN([Tests are disabled for compilation in armel])
159    enable_tests="no"
160 fi
161 if test "x$enable_tests" = xyes; then
162         PKG_CHECK_MODULES(CHECKMORE, [checkmore, check >= 0.9.4])
163         if test -z "$CHECKMORE_LIBS"; then
164                 AC_MSG_WARN([checkmore is needed for unit tests!])
165         fi
166 fi
167 AM_CONDITIONAL(ENABLE_TESTS,
168                [test "x$enable_tests" = xyes && test -n "$CHECKMORE_LIBS"])
169
170 dnl Volume handling
171 if test "x${SBOX_DPKG_INST_ARCH}" = "xi386"; then
172    DISABLED_BY_DEFAULT([pulse-volume], [enable volume handling with pulse])
173 else
174    ENABLED_BY_DEFAULT([pulse-volume], [enable volume handling with pulse])
175 fi
176 if test "x$enable_pulse_volume" = xno; then
177         AC_DEFINE([MAFW_GST_RENDERER_DISABLE_PULSE_VOLUME], [1], [Disables volume handling with pulse.])
178 else
179         PKG_CHECK_MODULES(VOLUME, libpulse-mainloop-glib >= 0.9.15)
180 fi
181
182
183 dnl Mute
184 DISABLED_BY_DEFAULT([mute], [enable mute handling])
185 if test "x$enable_mute" = xyes; then
186         AC_DEFINE([MAFW_GST_RENDERER_ENABLE_MUTE], [1], [Enable mute.])
187 fi
188
189 dnl Tracing.
190 DISABLED_BY_DEFAULT([tracing], [enable function instrumentation (tracing)])
191 if test "x$enable_tracing" = xyes; then
192         _CFLAGS="$_CFLAGS -finstrument-functions -rdynamic"
193 fi
194
195 dnl Coverage.
196 DISABLED_BY_DEFAULT([coverage], [enable coverage data generation (gcov)])
197 if test "x$enable_coverage" = xyes; then
198         AC_PATH_PROG(LCOV, [lcov], [lcov])
199         if test "x$LCOV" = x; then
200                 echo You need to install lcov to get actual reports!
201                 echo See http://ltp.sf.net/coverage/lcov.php
202         fi
203         if test "x$SBOX_USE_CCACHE" == xyes; then
204                 AC_MSG_ERROR([Please set SBOX_USE_CCACHE=no to use coverage.])
205         fi
206         _CFLAGS="$_CFLAGS -fprofile-arcs -ftest-coverage"
207         _LDFLAGS="$_LDFLAGS -g -lgcov"
208 fi
209 AM_CONDITIONAL(ENABLE_COVERAGE,
210                [test "x$enable_coverage" != xno && test -n "$LCOV"])
211
212 dnl Output files.
213
214 AC_CONFIG_FILES([
215   Makefile
216   mafw-gst-renderer-uninstalled.pc
217   libmafw-gst-renderer/Makefile
218   tests/Makefile
219   debian/mafw-gst-renderer.install
220 ])
221
222 AC_OUTPUT