build: Add/use m4 magic for checking Vala bindings
[profile/ivi/rygel.git] / configure.ac
1 AC_PREREQ(2.53)
2 AC_INIT([rygel],
3         m4_esyscmd([GNOME_TAG_PATTERN=RYGEL build-aux/git-version-gen .tarball-version]),
4         [http://bugzilla.gnome.org/enter_bug.cgi?product=Rygel])
5 AC_CONFIG_AUX_DIR([build-aux])
6
7 # require automake-1.11 for vala support
8 AM_INIT_AUTOMAKE([1.11])
9 AC_CONFIG_SRCDIR([src/rygel/rygel-root-device.vala])
10 AM_CONFIG_HEADER([config.h])
11 AC_CONFIG_MACRO_DIR([m4])
12 AM_MAINTAINER_MODE
13
14 # Disable generation of static libraries
15 AC_DISABLE_STATIC
16
17 AC_ISC_POSIX
18 AC_PROG_CC
19 AC_STDC_HEADERS
20 AC_PROG_LIBTOOL
21 AC_FUNC_MMAP
22
23 VALA_REQUIRED=0.9.5
24 GUPNP_REQUIRED=0.13.4
25 GUPNP_AV_REQUIRED=0.5.8
26 GUPNP_DLNA_REQUIRED=0.2.1
27 GUPNP_VALA_REQUIRED=0.6.10
28 DBUS_GLIB_REQUIRED=0.74
29 GSTREAMER_REQUIRED=0.10.23
30 GSTREAMER_TAG_REQUIRED=0.10.28
31 GSTREAMER_APP_REQUIRED=0.10.28
32 GIO_REQUIRED=2.16
33 GEE_REQUIRED=0.5.2
34 UUID_REQUIRED=1.41.3
35 LIBSOUP_REQUIRED=2.26.0
36 LIBSQLITE3_REQUIRED=3.5
37
38 AC_MSG_CHECKING([which gtk+ version to compile against])
39 AC_ARG_WITH([gtk],
40   [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
41   [case "$with_gtk" in
42      2.0|3.0) ;;
43      *) AC_MSG_ERROR([invalid gtk version specified]) ;;
44    esac],
45   [with_gtk=2.0])
46 AC_MSG_RESULT([$with_gtk])
47
48 case "$with_gtk" in
49   2.0) GTK_VAPI_VERSION=2.0
50        GTK_REQUIRED=2.21.5
51        ;;
52   3.0) GTK_VAPI_VERSION=3.0
53        GTK_REQUIRED=2.90.3
54        ;;
55 esac
56
57
58
59 PKG_CHECK_MODULES(LIBGUPNP, gupnp-1.0 >= $GUPNP_REQUIRED)
60 PKG_CHECK_MODULES(LIBGUPNP_AV, gupnp-av-1.0 >= $GUPNP_AV_REQUIRED)
61 PKG_CHECK_MODULES(LIBGUPNP_DLNA, gupnp-dlna-1.0 >= $GUPNP_DLNA_REQUIRED)
62 PKG_CHECK_MODULES(LIBDBUS_GLIB, dbus-glib-1 >= $DBUS_GLIB_REQUIRED)
63 PKG_CHECK_MODULES(LIBGSTREAMER, gstreamer-0.10 >= $GSTREAMER_REQUIRED)
64 PKG_CHECK_MODULES(LIBGIO, gio-2.0 >= $GIO_REQUIRED)
65 PKG_CHECK_MODULES(GEE, gee-1.0 >= $GEE_REQUIRED)
66 PKG_CHECK_MODULES(UUID, uuid >= $UUID_REQUIRED)
67 PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4 >= $LIBSOUP_REQUIRED)
68
69 # glib-genmarshal
70 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
71 AC_SUBST(GLIB_GENMARSHAL)
72
73 AC_ARG_ENABLE(vala,
74         [  --enable-vala          enable checks for vala],,
75         enable_vala=no)
76 AC_ARG_ENABLE(sql-debugging,
77               [  --enable-sql-debugging         enable SQL statement debugging],,
78                  enable_sql_debugging=no)
79
80 if test x$enable_sql_debugging = xyes ; then
81     VALAFLAGS="$VALAFLAGS -D RYGEL_DEBUG_SQL"
82 fi
83
84 # Enable check for Vala even if not asked to do so if stamp files are absent.
85 if test ! -e src/rygel/rygel_vala.stamp -o \
86         ! -e src/rygel/librygel_configuration_a_vala.stamp -o \
87         ! -e src/ui/rygel_preferences_vala.stamp -o \
88         ! -e src/plugins/playbin/librygel_playbin_la_vala.stamp -o \
89         ! -e src/plugins/tracker/librygel_media_tracker_la_vala.stamp -o \
90         ! -e src/plugins/test/librygel_test_la_vala.stamp -o \
91         ! -e src/plugins/media-export/librygel_media_export_la_vala.stamp -o \
92         ! -e src/plugins/mediathek/librygel_mediathek_la_vala.stamp -o \
93         ! -e src/plugins/gst-launch/librygel_gst_launch_la_vala.stamp -o \
94         ! -e src/plugins/external/librygel_external_la_vala.stamp ; then
95     enable_vala=yes
96 fi
97
98 # Vala
99 if test x$enable_vala = xyes ; then
100     # check for vala
101     AM_PROG_VALAC([$VALA_REQUIRED])
102
103     if test "x$VALAC" = "x"; then
104         AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH])
105     fi
106
107     PKG_CHECK_MODULES(GUPNP_VALA, gupnp-vala-1.0 >= $GUPNP_VALA_REQUIRED)
108
109     VALA_CHECK_PACKAGES([gupnp-1.0
110                          gupnp-av-1.0
111                          gupnp-dlna-1.0
112                          dbus-glib-1
113                          gstreamer-0.10
114                          gstreamer-discoverer-gupnp-dlna-0.10
115                          gio-2.0
116                          gee-1.0
117                          sqlite3
118                          posix])
119 else
120     VAPIDIR=`echo ${datadir}/vala/vapi`
121 fi
122
123 AC_SUBST(VAPIDIR)
124
125 # Maemo support
126 AC_ARG_ENABLE(maemo,
127         [  --enable-maemo          enable maemo support],,
128         enable_maemo=no)
129
130 # Debugging
131 AC_ARG_ENABLE(debug,
132         [  --enable-debug          enable debugging],,
133         enable_debug=no)
134 if test "x$enable_debug" = "xyes"; then
135         CFLAGS="$CFLAGS -O0 -g"
136 fi
137
138 # Strict compiler
139 AC_ARG_ENABLE(strict-cc,
140         [  --enable-strict-cc          enable strict C compiler],,
141         enable_strict_cc=no)
142 if test "x$enable_strict_cc" = "xyes"; then
143         CFLAGS="$CFLAGS -Wall -Werror"
144 else
145         CFLAGS="$CFLAGS -w"
146 fi
147
148 # Run uninstalled
149 AC_ARG_ENABLE(uninstalled,
150         [  --enable-uninstalled          run uninstalled],,
151         enable_uninstalled=no)
152 if test "x$enable_uninstalled" = "xyes"; then
153         AC_MSG_WARN("You want to run the tools uninstalled only? Fine!")
154 fi
155
156 # Check wether user wants to build UIs
157 AC_ARG_WITH( ui,
158   AC_HELP_STRING([--without-ui],[Do not build UI applications]),
159   try_ui=$withval, try_ui=yes )
160
161 HAVE_GTK=no
162 if test x$try_ui = xyes ; then
163     dnl check for gtk
164     PKG_CHECK_MODULES(GTK, gtk+-$GTK_VAPI_VERSION >= $GTK_REQUIRED ,
165       [
166         AC_SUBST(GTK_CFLAGS)
167         AC_SUBST(GTK_LIBS)
168         if test x$enable_vala = xyes ; then
169                 VALA_CHECK_PACKAGES([gtk+-$GTK_VAPI_VERSION])
170         else
171                 HAVE_GTK=yes
172         fi
173       ],
174       [
175         HAVE_GTK=no
176         AC_MSG_WARN([gtk $GTK_REQUIRED or greater not found.])
177         AC_MSG_WARN([UI applications will not be built.])
178       ])
179 else
180     AC_MSG_NOTICE([UI applications disabled.])
181 fi
182
183 if test x$HAVE_GTK = xno; then
184   BUILD_UI=no
185   with_gtk="n/a"
186 else
187   BUILD_UI=yes
188   AC_DEFINE(HAVE_GTK, , [Build UI applications])
189 fi
190
191 AC_SUBST(HAVE_GTK)
192 AM_CONDITIONAL(BUILD_UI, test x$BUILD_UI = xyes)
193
194 # Build test plugin
195 AC_ARG_ENABLE(test-plugin,
196         [  --enable-test-plugin          build test plugin],,
197         enable_test_plugin=no)
198
199 # Build Tracker plugin
200 AC_ARG_ENABLE(tracker-plugin,
201         [  --enable-tracker-plugin      build tracker plugin],,
202         enable_tracker_plugin=yes)
203
204 # Build MediaExport plugin
205 AC_ARG_ENABLE(media-export-plugin,
206         [  --enable-media-export-plugin          build MediaExport plugin],,
207         enable_media_export_plugin=yes)
208
209 # Build External plugin
210 AC_ARG_ENABLE(external-plugin,
211         [  --enable-external-plugin          build External plugin],,
212         enable_external_plugin=yes)
213
214 # Build GstRenderer plugin
215 AC_ARG_ENABLE(playbin-plugin,
216         [  --enable-playbin_plugin          build Gstreamer Playbin plugin],,
217         enable_playbin_plugin=yes)
218
219 # Build Mediathek plugin
220 AC_ARG_ENABLE(mediathek-plugin,
221         [  --enable-mediathek-plugin          build Mediathek plugin],,
222         enable_mediathek_plugin=no)
223
224 # Build GstLaunch plugin
225 AC_ARG_ENABLE(gst-launch-plugin,
226         [  --enable-gst-launch-plugin          build Gstreamer launchline plugin],,
227         enable_gst_launch_plugin=no)
228
229
230 AC_SUBST(abs_top_builddir)
231
232 AM_CONDITIONAL([UNINSTALLED], [test "x$enable_uninstalled" = "xyes"])
233 AM_CONDITIONAL([ENABLE_MAEMO], [test "x$enable_maemo" = "xyes"])
234 AM_CONDITIONAL([BUILD_TEST_PLUGIN], [test "x$enable_test_plugin" = "xyes"])
235 AM_CONDITIONAL([BUILD_TRACKER_PLUGIN],
236                [test "x$enable_tracker_plugin" = "xyes"])
237 AM_CONDITIONAL([BUILD_MEDIATHEK_PLUGIN], [test "x$enable_mediathek_plugin" = "xyes"])
238 AM_CONDITIONAL([BUILD_MEDIA_EXPORT_PLUGIN], [test "x$enable_media_export_plugin" = "xyes"])
239 AM_CONDITIONAL([BUILD_EXTERNAL_PLUGIN], [test "x$enable_external_plugin" = "xyes"])
240 AM_CONDITIONAL([BUILD_PLAYBIN_PLUGIN], [test "x$enable_playbin_plugin" = "xyes"])
241 AM_CONDITIONAL([BUILD_GST_LAUNCH_PLUGIN], [test "x$enable_gst_launch_plugin" = "xyes"])
242
243 if test "x$enable_media_export_plugin" = "xyes";
244 then
245     PKG_CHECK_MODULES(LIBSQLITE3, sqlite3 >= $LIBSQLITE3_REQUIRED)
246     PKG_CHECK_MODULES(GSTREAMER_TAG, gstreamer-tag-0.10 >= $GSTREAMER_TAG_REQUIRED);
247     PKG_CHECK_MODULES(GSTREAMER_APP, gstreamer-app-0.10 >= $GSTREAMER_APP_REQUIRED);
248 fi
249
250 # Gettext
251 GETTEXT_PACKAGE=AC_PACKAGE_NAME
252 AC_SUBST(GETTEXT_PACKAGE)
253 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], 
254   [Define the gettext package to be used])
255
256 AM_GLIB_GNU_GETTEXT
257 IT_PROG_INTLTOOL([0.35.0])
258
259 AC_SUBST(VALAFLAGS)
260
261 dnl Shave the output
262 AM_SILENT_RULES([yes])
263
264 AC_OUTPUT([
265 Makefile
266 src/Makefile
267 src/rygel/Makefile
268 src/ui/Makefile
269 src/plugins/Makefile
270 src/plugins/media-export/Makefile
271 src/plugins/external/Makefile
272 src/plugins/gst-launch/Makefile
273 src/plugins/mediathek/Makefile
274 src/plugins/tracker/Makefile
275 src/plugins/playbin/Makefile
276 src/plugins/test/Makefile
277 data/Makefile
278 data/xml/Makefile
279 data/icons/Makefile
280 data/icons/32x32/Makefile
281 data/icons/48x48/Makefile
282 data/icons/120x120/Makefile
283 data/icons/scalable/Makefile
284 po/Makefile.in
285 rygel-1.0.pc
286 tests/Makefile
287 ])
288
289 echo "
290
291                     ${PACKAGE} ${VERSION}
292                     ============
293
294
295         Prefix:                 ${prefix}
296         Source code location:   ${srcdir}
297         Compiler:               ${CC}
298         CFLAGS:                 ${CFLAGS}
299         uninstalled:            ${enable_uninstalled}
300         maemo support:          ${enable_maemo}
301         preferences ui:         ${BUILD_UI}
302         GTK+ version:           ${with_gtk}
303         SQL debugging:          ${enable_sql_debugging}
304     Plugins:
305         test:                   ${enable_test_plugin}
306         tracker:                ${enable_tracker_plugin}
307         mediathek:              ${enable_mediathek_plugin}
308         media-export            ${enable_media_export_plugin}
309         external:               ${enable_external_plugin}
310         gst-launch:             ${enable_gst_launch_plugin}
311         playbin:                ${enable_playbin_plugin}
312 "