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