Make zeitgeist optional again
[platform/upstream/folks.git] / configure.ac
1 # If not 1, append datestamp to the version number
2 m4_define([folks_released], [0])
3
4 m4_define([folks_major_version], [0])
5 m4_define([folks_minor_version], [9])
6 m4_define([folks_micro_version], [0])
7 m4_define([folks_nano_version], [0])
8
9 # If library source has changed since last release, increment revision
10 # If public symbols have been added, removed or changed since last release,
11 #  increment current and set revision to 0
12 # If public symbols have been added since last release, increment age
13 # If public symbols have been removed since last release, set age to 0
14 m4_define([folks_lt_current], [37])
15 m4_define([folks_lt_revision], [1])
16 m4_define([folks_lt_age], [12])
17
18 # Display the nano_version only if it's not '0'
19 m4_define([folks_base_version],
20           folks_major_version.folks_minor_version.folks_micro_version)
21 m4_define([folks_full_version],
22           [m4_if(folks_nano_version, [0],
23                  folks_base_version, folks_base_version.folks_nano_version)])
24
25 m4_define([folks_maybe_datestamp],
26           m4_if(folks_released, [1],
27                 [], [m4_esyscmd([date +.%Y%m%d | tr -d '\n\r'])]))
28
29 m4_define([folks_version], folks_full_version[]folks_maybe_datestamp)
30 m4_define([folks_major_minor_version], folks_major_version.folks_minor_version)
31 m4_define([folks_module_version], folks_lt_current)
32
33 AC_INIT([folks], folks_version,
34         [https://bugzilla.gnome.org/browse.cgi?product=folks], [folks],
35         [http://telepathy.freedesktop.org/wiki/Folks])
36 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
37
38 AC_PREREQ([2.65])
39 AC_COPYRIGHT([Copyright (C) 2010 Collabora Ltd.])
40
41 AC_CONFIG_MACRO_DIR([m4])
42 AC_CONFIG_SRCDIR([Makefile.am])
43 AC_CONFIG_HEADERS(config.h)
44 AC_CONFIG_SRCDIR([configure.ac])
45 AM_INIT_AUTOMAKE([1.11 dist-xz no-define
46                   no-dist-gzip tar-ustar -Wno-portability color-tests])
47 AM_MAINTAINER_MODE([enable])
48
49 AC_PROG_CC
50 AM_PROG_CC_C_O
51 AC_DISABLE_STATIC
52 LT_INIT
53 PKG_PROG_PKG_CONFIG([0.21])
54 GLIB_GSETTINGS
55
56 AC_SUBST([CFLAGS])
57 AC_SUBST([CPPFLAGS])
58 AC_SUBST([LDFLAGS])
59
60 LT_CURRENT=folks_lt_current
61 LT_REVISION=folks_lt_revision
62 LT_AGE=folks_lt_age
63 AC_SUBST([LT_CURRENT])
64 AC_SUBST([LT_REVISION])
65 AC_SUBST([LT_AGE])
66
67 FOLKS_MAJOR_MINOR_VERSION=folks_major_minor_version
68 AC_SUBST([FOLKS_MAJOR_MINOR_VERSION])
69
70 API_VERSION=0.6
71 AC_SUBST([API_VERSION])
72
73 AC_ARG_ENABLE(tracker-backend,
74         AC_HELP_STRING([--enable-tracker-backend],
75                        [ build the Tracker backend]),
76         enable_tracker_backend=$enableval,
77         enable_tracker_backend=no )
78
79 AM_CONDITIONAL([ENABLE_TRACKER], [test "x$enable_tracker_backend" = "xyes"])
80
81 AS_IF([test "x$enable_tracker_backend" = "xyes"], [
82         AC_DEFINE(HAVE_TRACKER, [1],
83                   [Define as 1 if you have the Tracker backend])
84 ], [
85         AC_DEFINE(HAVE_TRACKER, [0],
86                   [Define as 1 if you have the Tracker backend])
87 ])
88
89 AC_ARG_ENABLE(eds-backend,
90         AC_HELP_STRING([--enable-eds-backend],
91                        [ build the E-D-S backend]),
92         enable_eds_backend=$enableval,
93         enable_eds_backend=yes )
94
95 AS_IF([test "x$enable_eds_backend" = "xyes"], [
96         AC_DEFINE(HAVE_EDS, [1], [Define as 1 if you have the eds backend])
97 ], [
98         AC_DEFINE(HAVE_EDS, [0], [Define as 1 if you have the eds backend])
99 ])
100
101 AM_CONDITIONAL([ENABLE_EDS], [test "x$enable_eds_backend" = "xyes"])
102
103 AC_ARG_ENABLE(ofono-backend,
104         AC_HELP_STRING([--enable-ofono-backend],
105                        [ build the ofono backend]),
106         enable_ofono_backend=$enableval,
107         enable_ofono_backend=yes )
108
109 AS_IF([test "x$enable_ofono_backend" = "xyes"], [
110         AC_DEFINE(HAVE_OFONO, [1], [Define as 1 if you have the ofono backend])
111 ], [
112         AC_DEFINE(HAVE_OFONO, [0], [Define as 1 if you have the ofono backend])
113 ])
114
115 AM_CONDITIONAL([ENABLE_OFONO], [test "x$enable_ofono_backend" = "xyes"])
116
117 AC_ARG_ENABLE(telepathy-backend,
118         AC_HELP_STRING([--enable-telepathy-backend],
119                        [ build the Telepathy backend]),
120         enable_telepathy_backend=$enableval,
121         enable_telepathy_backend=yes )
122
123 AS_IF([test "x$enable_telepathy_backend" = "xyes"], [
124         AC_DEFINE(HAVE_TELEPATHY, [1], [Define as 1 if you have the Telepathy backend])
125 ], [
126         AC_DEFINE(HAVE_TELEPATHY, [0], [Define as 1 if you have the Telepathy backend])
127 ])
128
129 AM_CONDITIONAL([ENABLE_TELEPATHY], [test "x$enable_telepathy_backend" = "xyes"])
130
131 # Automatically check the dependencies for the libsocialweb backend
132 SW_CLIENT_REQUIRED=0.25.20
133 AC_ARG_ENABLE(libsocialweb-backend,
134         AC_HELP_STRING([--enable-libsocialweb-backend=@<:@no/yes/auto@:>@],
135                        [build the Libsocialweb backend (default: auto)]),
136         enable_libsocialweb_backend=$enableval,
137         enable_libsocialweb_backend=auto )
138
139 # this may be overwritten farther down
140 AC_DEFINE(HAVE_LIBSOCIALWEB, [0],
141           [Define as 1 if you have the libsocialweb backend])
142 AS_IF([test "x$enable_libsocialweb_backend" != "xno"], [
143   PKG_CHECK_MODULES([SW_CLIENT], [libsocialweb-client >= $SW_CLIENT_REQUIRED],
144       have_libsocialweb_backend="yes", have_libsocialweb_backend="no")
145   AS_IF([test "x$have_libsocialweb_backend" = "xyes" -a \
146           "x$enable_vala" = "xyes"], [
147     VALA_CHECK_PACKAGES([telepathy-glib
148                          gio-2.0
149                          gee-1.0
150                          libsocialweb-client],
151         ,
152         have_libsocialweb_backend="no")
153   ])
154
155   AS_IF([test "x$have_libsocialweb_backend" = "xyes"], [
156     AC_DEFINE(HAVE_LIBSOCIALWEB, [1],
157               [Define if you have the libsocialweb backend])
158   ])
159 ], [
160    have_libsocialweb_backend=no
161 ])
162
163 AS_IF([test "x$enable_libsocialweb_backend" = "xyes" -a \
164   "x$have_libsocialweb_backend" != "xyes"], [
165     AC_MSG_ERROR([Cannot find libsocialweb dependencies.])
166 ])
167
168 AM_CONDITIONAL([ENABLE_LIBSOCIALWEB],
169         [test "x$have_libsocialweb_backend" = "xyes"])
170
171 # -----------------------------------------------------------
172 # Dependencies
173 # -----------------------------------------------------------
174
175 GLIB_REQUIRED=2.32.0
176 VALA_REQUIRED=0.17.6
177 VALADOC_REQUIRED=0.3.1
178 TRACKER_SPARQL_MAJOR=0.14
179 TRACKER_SPARQL_REQUIRED=0.13.1
180 EBOOK_REQUIRED=3.5.3
181 EDATASERVER_REQUIRED=3.5.3.1
182 ZEITGEIST_REQUIRED=0.3.14
183
184 AC_SUBST([TRACKER_SPARQL_MAJOR])
185
186 PKG_CHECK_MODULES([GLIB],
187                   [glib-2.0 >= $GLIB_REQUIRED
188                    gobject-2.0 >= $GLIB_REQUIRED])
189 PKG_CHECK_MODULES([GMODULE], [gmodule-no-export-2.0])
190 PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_REQUIRED])
191 PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
192
193 # FIXME: We depend on libgee < 0.7 because 0.7 breaks API. bgo#627746
194 PKG_CHECK_MODULES([GEE], [gee-1.0 < 0.7],
195                   have_gee_0_6_x="yes",
196                   have_gee_0_6_x="no")
197
198 AS_IF([test "x$have_gee_0_6_x" != "xyes"], [
199     AC_MSG_ERROR([
200 Gee 0.6.x required but not installed.
201
202 Note that Gee 0.8.x provides gee-0.8 (but gee-1.0 is, confusingly, provided by
203 Gee 0.6.x)])
204 ])
205
206 TP_GLIB_REQUIRED=0.19.0
207 AS_IF([test x$enable_telepathy_backend = xyes], [
208         PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
209         PKG_CHECK_MODULES([ZEITGEIST], [zeitgeist-1.0 >= $ZEITGEIST_REQUIRED],
210                            have_zeitgeist="yes",have_zeitgeist="no")])
211 AS_IF([test "x$have_zeitgeist" == "xyes"], [
212    ZEITGEIST_VALAFLAGS="-DHAVE_ZEITGEIST"
213    AC_SUBST([ZEITGEIST_VALAFLAGS])
214    ZEITGEIST_PKG="-pkg zeitgeist"
215    AC_SUBST([ZEITGEIST_PKG])
216 ])
217
218 # Ignore post 0.20 deprecations
219 TP_GLIB_CFLAGS="$TP_GLIB_CFLAGS -DTP_VERSION_MIN_REQUIRED=TP_VERSION_0_20"
220 # Prevent post 0.20 APIs
221 TP_GLIB_CFLAGS="$TP_GLIB_CFLAGS -DTP_VERSION_MAX_ALLOWED=TP_VERSION_0_20"
222
223 AS_IF([test x$enable_tracker_backend = xyes], [
224         PKG_CHECK_MODULES([TRACKER_SPARQL],
225                           [tracker-sparql-$TRACKER_SPARQL_MAJOR >= \
226                            $TRACKER_SPARQL_REQUIRED])
227 ])
228
229 AS_IF([test x$enable_eds_backend = xyes], [
230         PKG_CHECK_MODULES([EBOOK], [libebook-1.2 >= $EBOOK_REQUIRED])
231         PKG_CHECK_MODULES([EDATASERVER], [libedataserver-1.2 >= $EDATASERVER_REQUIRED])
232 ])
233
234 AS_IF([test x$enable_ofono_backend = xyes], [
235         PKG_CHECK_MODULES([EBOOK], [libebook-1.2 >= $EBOOK_REQUIRED])
236 ])
237
238 #
239 # Vala building options -- allows tarball builds without installing Vala
240 #
241 AC_ARG_ENABLE([vala],
242               AS_HELP_STRING([--enable-vala],
243                              [Enable building from the Vala sources]),
244               [enable_vala=$enableval],
245               [enable_vala=no])
246
247 # will be re-set as necessary below
248 AM_CONDITIONAL([HAVE_INTROSPECTION], [test "x$enable_vala" = "xyes"])
249 sd=${srcdir}/
250
251 # Force Vala for non-release builds
252 m4_if(folks_released, [1], [],
253     [
254         enable_vala=yes
255         echo "Vala compiler required for non-release builds; requiring Vala..."
256     ])
257
258 # Force Vala if generated source is missing or outdated
259 AS_IF([test \
260         ! -e ${sd}tools/folks_import_vala.stamp -o \
261         ! -e ${sd}tests/folks/abstract_field_details_vala.stamp -o \
262         ! -e ${sd}tests/folks/aggregation_vala.stamp -o \
263         ! -e ${sd}tests/folks/backend_loading_vala.stamp -o \
264         ! -e ${sd}tests/key-file/individual_retrieval_vala.stamp -o \
265         ! -e ${sd}tests/lib/folks-test.vapi -o \
266         ! -e ${sd}tests/lib/key-file/kf-test.vapi -o \
267         ! -e ${sd}tests/lib/key-file/libkf_test_la_vala.stamp -o \
268         ! -e ${sd}tests/lib/telepathy/contactlist/tp-test-contactlist.gir -o \
269         ! -e ${sd}tests/lib/telepathy/contactlist/tp-test-contactlist.vapi -o \
270         ! -e ${sd}tests/lib/libfolks_test_la_vala.stamp -o \
271         ! -e ${sd}tests/telepathy/persona_store_capabilities_vala.stamp -o \
272         ! -e ${sd}tests/telepathy/individual_retrieval_vala.stamp -o \
273         ! -e ${sd}tests/telepathy/individual_properties_vala.stamp -o \
274         ! -e ${sd}tests/folks/backend_loading_vala.stamp -o \
275         ! -e ${sd}backends/key-file/key_file_la_vala.stamp -o \
276         ! -e ${sd}backends/telepathy/telepathy_la_vala.stamp \
277                 -o \
278         ! -e ${sd}backends/telepathy/lib/folks-telepathy.vapi -o \
279         ! -e ${sd}backends/telepathy/lib/tp-lowlevel.gir -o \
280         ! -e ${sd}backends/telepathy/lib/tp-lowlevel.vapi -o \
281         ! -e ${sd}backends/telepathy/lib/libfolks_telepathy_la_vala.stamp -o \
282         ! -e ${sd}folks/folks-internal.h -o \
283         ! -e ${sd}folks/folks-internal.vapi -o \
284         ! -e ${sd}folks/libfolks_internal_la_vala.stamp -o \
285         ! -e ${sd}folks/folks.vapi -o \
286         ! -e ${sd}folks/libfolks_la_vala.stamp \
287       ], [
288         enable_vala=yes
289         echo "Vala source needs to be re-compiled; requiring Vala..."
290 ])
291
292 AS_IF([test "x$enable_vala" = "xyes"], [
293         AM_PROG_VALAC([$VALA_REQUIRED])
294         AS_IF([test "x$VALAC" = "x"], [
295               AC_MSG_ERROR([Vala requested but valac is not installed])
296         ])
297
298         AC_PATH_PROG([VAPIGEN], [vapigen], [])
299         AS_IF([test "x$VAPIGEN" = "x"], [
300               AC_MSG_ERROR([Vala must be built with --enable-vapigen])
301         ])
302
303         # require GLib >= 2.24 so GLib.Array, etc. reffing is handled
304         # automatically
305         VALAFLAGS="$VALAFLAGS --target-glib=2.24"
306         AC_SUBST([VALAFLAGS])
307         AC_SUBST([VAPIGENFLAGS])
308         AC_SUBST([VAPIDIR])
309
310         VALA_CHECK_PACKAGES([gio-2.0
311                              gee-1.0])
312
313         AS_IF([test x$enable_telepathy_backend = xyes], [
314           VALA_CHECK_PACKAGES([telepathy-glib])
315           AS_IF([test "x$have_zeitgeist" == "xyes"], [
316               VALA_CHECK_PACKAGES([zeitgeist-1.0])
317           ])
318         ])
319
320         AS_IF([test x$enable_tracker_backend = xyes], [
321           VALA_CHECK_PACKAGES([tracker-sparql-$TRACKER_SPARQL_MAJOR])
322         ])
323
324         AS_IF([test x$enable_eds_backend = xyes], [
325           VALA_CHECK_PACKAGES([libebook-1.2 libedataserver-1.2 libxml-2.0])
326         ])
327
328         AS_IF([test x$enable_ofono_backend = xyes], [
329           VALA_CHECK_PACKAGES([libebook-1.2])
330         ])
331 ])
332
333 # this will set HAVE_INTROSPECTION
334 GOBJECT_INTROSPECTION_REQUIRE([1.30])
335
336 AM_CONDITIONAL([HAVE_VALA], [test "x$enable_vala" = "xyes"])
337
338 # Various functions that we need (used in C code generated from Vala)
339 AC_CHECK_FUNCS([memset])
340 AC_CHECK_FUNCS([strstr])
341
342 AM_CONDITIONAL([NOT_RELEASE], [test "x$folks_released" = "x0"])
343
344 # -----------------------------------------------------------
345 # Backends
346 # -----------------------------------------------------------
347
348 FOLKS_MODULE_VERSION=folks_module_version
349 AC_SUBST([FOLKS_MODULE_VERSION])
350 AC_DEFINE([MODULE_VERSION], "folks_module_version", [Module interface version])
351
352 BACKEND_DIR='$(libdir)/folks/$(FOLKS_MODULE_VERSION)/backends'
353 AC_SUBST([BACKEND_DIR])
354
355 BACKEND_KF='$(top_builddir)/backends/key-file/.libs/key-file.so'
356 AC_SUBST([BACKEND_KF])
357 BACKEND_TP='$(top_builddir)/backends/telepathy/.libs/telepathy.so'
358 AC_SUBST([BACKEND_TP])
359
360 AS_IF([test x$have_libsocialweb_backend = xyes], [
361   BACKEND_LIBSOCIALWEB='$(top_builddir)/backends/libsocialweb/.libs/libsocialweb.so'
362   AC_SUBST([BACKEND_LIBSOCIALWEB])
363 ])
364
365 AS_IF([test x$enable_tracker_backend = xyes], [
366   BACKEND_TRACKER='$(top_builddir)/backends/tracker/.libs/tracker.so'
367   AC_SUBST([BACKEND_TRACKER])
368 ])
369
370 AS_IF([test x$enable_eds_backend = xyes], [
371   BACKEND_EDS='$(top_builddir)/backends/eds/.libs/eds.so'
372   AC_SUBST([BACKEND_EDS])
373 ])
374
375 if test x$enable_ofono_backend = xyes; then
376   BACKEND_OFONO='$(top_builddir)/backends/ofono/.libs/ofono.so'
377   AC_SUBST([BACKEND_OFONO])
378 fi
379
380 # All of the backend libraries in our tree; to be used by the tests
381 BACKEND_UNINST_PATH='$(BACKEND_KF):$(BACKEND_TP)'
382 AS_IF([test x$have_libsocialweb_backend = xyes], [
383   LIBSOCIALWEB_BACKEND_UNINST_PATH='$(BACKEND_LIBSOCIALWEB)'
384   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$LIBSOCIALWEB_BACKEND_UNINST_PATH"
385 ])
386 AS_IF([test x$enable_tracker_backend = xyes], [
387   TRACKER_BACKEND_UNINST_PATH='$(BACKEND_TRACKER)'
388   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$TRACKER_BACKEND_UNINST_PATH"
389 ])
390 AS_IF([test x$enable_eds_backend = xyes], [
391   EDS_BACKEND_UNINST_PATH='$(BACKEND_EDS)'
392   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$EDS_BACKEND_UNINST_PATH"
393 ])
394 AS_IF([test x$enable_ofono_backend = xyes], 
395   OFONO_BACKEND_UNINST_PATH='$(BACKEND_OFONO)'
396   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$OFONO_BACKEND_UNINST_PATH"
397 ])
398 AC_SUBST([BACKEND_UNINST_PATH])
399
400 # -----------------------------------------------------------
401 # Tools
402 # -----------------------------------------------------------
403
404 AC_ARG_ENABLE([import-tool],
405               AS_HELP_STRING([--enable-import-tool],
406                              [Enable building the meta-contact import tool]),
407               [enable_import_tool=$enableval with_import_tool=$enableval],
408               [enable_import_tool=maybe with_import_tool=no])
409 AS_IF([test "$enable_import_tool" != "no"],
410       [PKG_CHECK_MODULES([LIBXML], [libxml-2.0],
411                          [with_import_tool=yes], [with_import_tool=no])])
412 AS_IF([test "$enable_import_tool" = "yes" -a "$with_import_tool" = "no"],
413       [AC_MSG_ERROR([Import tool explicitly enabled, but libxml2 not found])])
414 AM_CONDITIONAL([ENABLE_IMPORT_TOOL], [test "$with_import_tool" = "yes"])
415
416 # Readline's required for the folks-inspect program
417 AC_ARG_ENABLE([inspect-tool],
418               AS_HELP_STRING([--enable-inspect-tool],
419                              [Enable building the data inspection tool]),
420               [enable_inspect_tool=$enableval with_inspect_tool=$enableval],
421               [enable_inspect_tool=maybe with_inspect_tool=no])
422 AS_IF([test "$enable_inspect_tool" = "yes" -a "$enable_vala" != "yes"],
423       [AC_MSG_ERROR([Inspect tool explicitly enabled, but Vala wasn't enabled \
424                      using --enable-vala])])
425 AS_IF([test "$enable_inspect_tool" = "maybe" -a "$enable_vala" != "yes"],
426       [AC_MSG_NOTICE([Inspect tool disabled, as Vala wasn't enabled using \
427                       --enable-vala])])
428 AS_IF([test "$enable_inspect_tool" != "no" -a "x$enable_vala" = "xyes"],
429       [AC_CHECK_LIB([readline], [main],
430                     [with_inspect_tool=yes], [with_inspect_tool=no],
431                     [-lncurses])])
432 AS_IF([test "$enable_inspect_tool" != "no" -a "$with_inspect_tool" = "yes" -a \
433        "x$enable_vala" = "xyes"],
434       [VALA_CHECK_PACKAGES([readline])
435        LIBREADLINE="-lreadline -lncurses"
436        AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])
437        AC_SUBST([LIBREADLINE])])
438 AS_IF([test "$enable_inspect_tool" = "yes" -a "$with_inspect_tool" = "no"],
439       [AC_MSG_ERROR([Inspect tool explicitly enabled, but readline not found])])
440 AM_CONDITIONAL([ENABLE_INSPECT_TOOL], [test "$with_inspect_tool" = "yes"])
441
442 # -----------------------------------------------------------
443 # Tests
444 # -----------------------------------------------------------
445
446 AC_ARG_ENABLE([tests],
447               AS_HELP_STRING([--enable-tests],[Enable building of tests]),
448               [enable_tests=$enableval], [enable_tests=yes])
449 AS_IF([test "$enable_tests" = "yes" -a "$enable_telepathy_backend" = "no"],
450       [AC_MSG_ERROR([The Telepathy backend must be enabled to build tests])])
451 AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes])
452
453 # -----------------------------------------------------------
454 # Documentation
455 # -----------------------------------------------------------
456
457 AC_ARG_ENABLE([docs],
458               AS_HELP_STRING([--enable-docs],[Enable documentation generation]),
459               [enable_docs=$enableval], [enable_docs=no])
460 AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes])
461
462 have_valadoc=no
463 AS_IF([test x$enable_docs = xyes], [
464   # make sure the library is new enough and the program exists
465   PKG_CHECK_MODULES([VALADOC], [valadoc-1.0 >= $VALADOC_REQUIRED])
466   AC_PATH_PROG([VALADOC], [valadoc], [:])
467   AS_IF([test "$VALADOC" != :], have_valadoc=yes)
468 ])
469 AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes])
470
471 AS_IF([test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"], [
472     AC_MSG_ERROR([Doc building requested but valadoc not installed.])
473 ])
474
475 # -----------------------------------------------------------
476 # Gettext
477 # -----------------------------------------------------------
478
479 GETTEXT_PACKAGE=AC_PACKAGE_NAME
480 AC_SUBST(GETTEXT_PACKAGE)
481 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
482 IT_PROG_INTLTOOL([0.50.0])
483
484 # -----------------------------------------------------------
485 # Error flags
486 # -----------------------------------------------------------
487
488 # Disable GLib deprecation warnings for now (#670196); GValueArray is deprecated
489 # but we need it for dbus-glib. Porting to GDBus will solve this (#653198)
490 AC_DEFINE(GLIB_DISABLE_DEPRECATION_WARNINGS, 1, [Build with GLib deprecated])
491
492 AS_COMPILER_FLAG([-Wall], [ERROR_CFLAGS="-Wall"], [ERROR_CFLAGS=""])
493 AS_COMPILER_FLAG([-Werror], [werror=yes], [werror=no])
494
495 AC_ARG_ENABLE([debug],
496               AS_HELP_STRING([--disable-debug],[compile without debug code]),
497               [enable_debug=$enableval], [enable_debug=yes])
498
499 AS_COMPILER_FLAG([-Wextra], [wextra=yes], [wextra=no])
500 AS_COMPILER_FLAG([-Wno-missing-field-initializers],
501                  [wno_missing_field_initializers=yes],
502                  [wno_missing_field_initializers=no])
503 AS_COMPILER_FLAG([-Wno-unused-parameter],
504                  [wno_unused_parameter=yes], [wno_unused_parameter=no])
505 AS_COMPILER_FLAG([-Wstrict-prototypes], [wstrict_prototypes=yes],
506                  [wstrict_prototypes=no])
507 AS_COMPILER_FLAG([-Wmissing-prototypes], [wmissing_prototypes=yes],
508                  [wmissing_prototypes=no])
509 AS_COMPILER_FLAG([-Wimplicit-function-declaration],
510                  [wimplicit_function_declaration=yes],
511                  [wimplicit_function_declaration=no])
512 AS_COMPILER_FLAG([-Wpointer-arith], [wpointer_arith=yes], [wpointer_arith=no])
513 AS_COMPILER_FLAG([-Winit-self], [winit_self=yes], [winit_self=no])
514 AS_COMPILER_FLAG([-Wformat=2], [wformat=yes], [wformat=no])
515 AS_COMPILER_FLAG([-Wmissing-include-dirs], [wmissing_include_dirs=yes],
516                  [wmissing_include_dirs=no])
517 AS_COMPILER_FLAG([-Waggregate-return], [waggregate_return=yes],
518                  [waggregate_return=no])
519 AS_COMPILER_FLAG([-Wdeclaration-after-statement],
520                  [wdeclaration_after_statement=yes],
521                  [wdeclaration_after_statement=no])
522
523 m4_if(folks_released, [1], [],
524     [
525         # Iff we support -Werror, then use it with all our compiler warnings.
526         if test x$werror = xyes; then
527             flag="-Werror="
528         else
529             flag="-W"
530         fi
531
532         if test x$wextra = xyes -a \
533             x$wno_missing_field_initializers = xyes -a \
534             x$wno_unused_parameter = xyes -a x$wstrict_prototypes = xyes -a \
535             x$wmissing_prototypes = xyes -a \
536             x$wimplicit_function_declaration = xyes -a x$wpointer_arith = xyes \
537             -a x$winit_self = xyes -a x$wformat = xyes -a \
538             x$wmissing_include_dirs = xyes -a x$waggregate_return = xyes -a \
539             x$wdeclaration_after_statement = xyes; then
540             ERROR_CFLAGS="$ERROR_CFLAGS -Wextra \
541                 -Wno-missing-field-initializers \
542                 -Wno-unused-parameter ${flag}strict-prototypes \
543                 ${flag}missing-prototypes ${flag}implicit-function-declaration \
544                 ${flag}pointer-arith ${flag}init-self ${flag}format=2 \
545                 ${flag}missing-include-dirs ${flag}aggregate-return \
546                 ${flag}declaration-after-statement"
547         fi
548     ])
549
550 AS_COMPILER_FLAG([-D_POSIX_SOURCE], [ERROR_CFLAGS="$ERROR_CFLAGS -D_POSIX_SOURCE"])
551 AS_COMPILER_FLAG([-std=c99], [ERROR_CFLAGS="$ERROR_CFLAGS -std=c99"])
552 AS_COMPILER_FLAG([-Wshadow], [ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow"])
553 AS_COMPILER_FLAG([-Wmissing-prototypes], [ERROR_CFLAGS="$ERROR_CFLAGS \
554                                           -Wmissing-prototypes"])
555 AS_COMPILER_FLAG([-Wmissing-declarations], [ERROR_CFLAGS="$ERROR_CFLAGS \
556                                             -Wmissing-declarations"])
557 AS_COMPILER_FLAG([-Wstrict-prototypes], [ERROR_CFLAGS="$ERROR_CFLAGS \
558                                          -Wstrict-prototypes"])
559
560 AC_SUBST([ERROR_CFLAGS])
561
562 # -----------------------------------------------------------
563 # Code coverage flags
564 # -----------------------------------------------------------
565
566 AC_ARG_ENABLE([code-coverage],
567               AS_HELP_STRING([--enable-code-coverage],
568                              [compile with code coverage code]),
569               [enable_code_coverage=$enableval], [enable_code_coverage=no])
570
571 # Only enable code coverage if this isn't a release.
572 m4_if(folks_released, [1], [],
573     [
574         if test "x$GCC" = "xyes"; then
575             if test "x$enable_code_coverage" = "xyes"; then
576                 CODE_COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage -O0 -ggdb"
577                 CODE_COVERAGE_LDFLAGS="-lgcov"
578             fi
579         fi
580     ])
581
582 AC_SUBST([CODE_COVERAGE_CFLAGS])
583 AC_SUBST([CODE_COVERAGE_LDFLAGS])
584
585 # Vala-related flags
586 AC_ARG_ENABLE([fatal-warnings],
587               AS_HELP_STRING([--disable-fatal-warnings],
588                              [Make warnings from valac and g-ir-scanner non-fatal]),
589               [enable_fatal_warnings=$enableval], [enable_fatal_warnings=yes])
590 AS_IF([test "x$enable_vala" = "xyes" && test "x$enable_fatal_warnings" = "xyes"],
591       [ERROR_INTROSPECTION_SCANNER_ARGS="\
592                         $ERROR_INTROSPECTION_SCANNER_ARGS --warn-error"
593        ERROR_VALAFLAGS="$ERROR_VALAFLAGS --fatal-warnings"])
594
595 # Disable -g if we're building with code coverage enabled, since Vala's
596 # insertion of #line directives into .c files confuses lcov. For the moment,
597 # we'll have to do with looking at code coverage of the generated C files only.
598 # We set the debug flags in CODE_COVERAGE_CFLAGS instead in that case.
599 m4_if(folks_released, [1], [],
600     [
601         if test "x$enable_code_coverage" != "xyes" -o "x$GCC" != "xyes"; then
602             ERROR_VALAFLAGS="$ERROR_VALAFLAGS -g"
603         fi
604     ])
605
606 AC_SUBST([ERROR_INTROSPECTION_SCANNER_ARGS])
607 AC_SUBST([ERROR_VALAFLAGS])
608
609 # -----------------------------------------------------------
610 # Profiling
611 # -----------------------------------------------------------
612
613 AC_ARG_ENABLE([profiling],
614               AS_HELP_STRING([--enable-profiling],
615                              [Enable building profiling points]),
616               [enable_profiling=$enableval],
617               [enable_profiling=no])
618 AM_CONDITIONAL([ENABLE_PROFILING], [test "$enable_profiling" = "yes"])
619
620 # -----------------------------------------------------------
621 # Final output
622 # -----------------------------------------------------------
623
624 AC_CONFIG_FILES([
625     backends/telepathy/lib/folks-telepathy.pc
626     backends/telepathy/lib/folks-telepathy-uninstalled.pc
627     backends/tracker/lib/folks-tracker.deps
628     backends/tracker/lib/folks-tracker.pc
629     backends/tracker/lib/folks-tracker-uninstalled.pc
630     backends/eds/lib/folks-eds.pc
631     backends/eds/lib/folks-eds-uninstalled.pc
632     folks/folks.pc
633     folks/folks-uninstalled.pc
634     folks/org.freedesktop.folks.gschema.xml
635     Makefile
636     backends/Makefile
637     backends/key-file/Makefile
638     backends/libsocialweb/Makefile
639     backends/libsocialweb/lib/Makefile
640     backends/libsocialweb/lib/folks-libsocialweb.pc
641     backends/libsocialweb/lib/folks-libsocialweb-uninstalled.pc
642     backends/telepathy/Makefile
643     backends/telepathy/lib/Makefile
644     backends/tracker/Makefile
645     backends/tracker/lib/Makefile
646     backends/eds/Makefile
647     backends/eds/lib/Makefile
648     backends/ofono/Makefile
649     folks/Makefile
650     docs/Makefile
651     po/Makefile.in
652     tests/Makefile
653     tests/data/Makefile
654     tests/eds/Makefile
655     tests/folks/Makefile
656     tests/key-file/Makefile
657     tests/libsocialweb/Makefile
658     tests/telepathy/Makefile
659     tests/tracker/Makefile
660     tests/lib/Makefile
661     tests/lib/folks-test-uninstalled.pc
662     tests/lib/eds/Makefile
663     tests/lib/key-file/Makefile
664     tests/lib/libsocialweb/Makefile
665     tests/lib/libsocialweb/session.conf
666     tests/lib/telepathy/Makefile
667     tests/lib/tracker/Makefile
668     tests/lib/telepathy/contactlist/Makefile
669     tests/lib/telepathy/contactlist/session.conf
670     tests/tools/Makefile
671     tools/Makefile
672     tools/inspect/Makefile
673 ])
674
675 AC_OUTPUT
676
677 echo "
678 Configure summary:
679
680         Vala........................:  ${enable_vala}
681         Vala Compiler...............:  ${VALAC}
682         C Compiler Flags............:  ${CFLAGS} ${ERROR_CFLAGS} ${CODE_COVERAGE_CFLAGS}
683         Linker Flags................:  ${LDFLAGS} ${CODE_COVERAGE_LDFLAGS}
684         Prefix......................:  ${prefix}
685         Bugreporting URL............:  ${PACKAGE_BUGREPORT}
686         Documentation...............:  ${have_valadoc}
687         Import tool.................:  ${with_import_tool}
688         Inspector tool..............:  ${with_inspect_tool}
689         Telepathy backend...........:  ${enable_telepathy_backend}
690         Tracker backend.............:  ${enable_tracker_backend}
691         Libsocialweb backend........:  ${have_libsocialweb_backend}
692         E-D-S backend...............:  ${enable_eds_backend}
693         Ofono backend...............:  ${enable_ofono_backend}
694         Zeitgeist support...........:  ${have_zeitgeist}
695         Build tests.................:  ${enable_tests}
696 "