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