Port folks to libgee 0.8.
[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-0.8
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 GEE_REQUIRED=0.8.4
184
185 AC_SUBST([TRACKER_SPARQL_MAJOR])
186
187 PKG_CHECK_MODULES([GLIB],
188                   [glib-2.0 >= $GLIB_REQUIRED
189                    gobject-2.0 >= $GLIB_REQUIRED])
190 PKG_CHECK_MODULES([GMODULE], [gmodule-no-export-2.0])
191 PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_REQUIRED])
192 PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
193
194 PKG_CHECK_MODULES([GEE], [gee-0.8 >= $GEE_REQUIRED])
195
196 TP_GLIB_REQUIRED=0.19.0
197 AS_IF([test x$enable_telepathy_backend = xyes], [
198         PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
199         PKG_CHECK_MODULES([ZEITGEIST], [zeitgeist-1.0 >= $ZEITGEIST_REQUIRED],
200                            have_zeitgeist="yes",have_zeitgeist="no")])
201 AS_IF([test "x$have_zeitgeist" == "xyes"], [
202    ZEITGEIST_VALAFLAGS="-D HAVE_ZEITGEIST"
203    AC_SUBST([ZEITGEIST_VALAFLAGS])
204    ZEITGEIST_PKG="--pkg zeitgeist-1.0"
205    AC_SUBST([ZEITGEIST_PKG])
206 ])
207
208 # Ignore post 0.20 deprecations
209 TP_GLIB_CFLAGS="$TP_GLIB_CFLAGS -DTP_VERSION_MIN_REQUIRED=TP_VERSION_0_20"
210 # Prevent post 0.20 APIs
211 TP_GLIB_CFLAGS="$TP_GLIB_CFLAGS -DTP_VERSION_MAX_ALLOWED=TP_VERSION_0_20"
212
213 AS_IF([test x$enable_tracker_backend = xyes], [
214         PKG_CHECK_MODULES([TRACKER_SPARQL],
215                           [tracker-sparql-$TRACKER_SPARQL_MAJOR >= \
216                            $TRACKER_SPARQL_REQUIRED])
217 ])
218
219 AS_IF([test x$enable_eds_backend = xyes], [
220         PKG_CHECK_MODULES([EBOOK], [libebook-1.2 >= $EBOOK_REQUIRED])
221         PKG_CHECK_MODULES([EDATASERVER], [libedataserver-1.2 >= $EDATASERVER_REQUIRED])
222 ])
223
224 AS_IF([test x$enable_ofono_backend = xyes], [
225         PKG_CHECK_MODULES([EBOOK], [libebook-1.2 >= $EBOOK_REQUIRED])
226 ])
227
228 #
229 # Vala building options -- allows tarball builds without installing Vala
230 #
231 AC_ARG_ENABLE([vala],
232               AS_HELP_STRING([--enable-vala],
233                              [Enable building from the Vala sources]),
234               [enable_vala=$enableval],
235               [enable_vala=no])
236
237 # will be re-set as necessary below
238 AM_CONDITIONAL([HAVE_INTROSPECTION], [test "x$enable_vala" = "xyes"])
239 sd=${srcdir}/
240
241 # Force Vala for non-release builds
242 m4_if(folks_released, [1], [],
243     [
244         enable_vala=yes
245         echo "Vala compiler required for non-release builds; requiring Vala..."
246     ])
247
248 # Force Vala if generated source is missing or outdated
249 AS_IF([test \
250         ! -e ${sd}tools/folks_import_vala.stamp -o \
251         ! -e ${sd}tests/folks/abstract_field_details_vala.stamp -o \
252         ! -e ${sd}tests/folks/aggregation_vala.stamp -o \
253         ! -e ${sd}tests/folks/backend_loading_vala.stamp -o \
254         ! -e ${sd}tests/key-file/individual_retrieval_vala.stamp -o \
255         ! -e ${sd}tests/lib/folks-test.vapi -o \
256         ! -e ${sd}tests/lib/key-file/kf-test.vapi -o \
257         ! -e ${sd}tests/lib/key-file/libkf_test_la_vala.stamp -o \
258         ! -e ${sd}tests/lib/telepathy/contactlist/tp-test-contactlist.gir -o \
259         ! -e ${sd}tests/lib/telepathy/contactlist/tp-test-contactlist.vapi -o \
260         ! -e ${sd}tests/lib/libfolks_test_la_vala.stamp -o \
261         ! -e ${sd}tests/telepathy/persona_store_capabilities_vala.stamp -o \
262         ! -e ${sd}tests/telepathy/individual_retrieval_vala.stamp -o \
263         ! -e ${sd}tests/telepathy/individual_properties_vala.stamp -o \
264         ! -e ${sd}tests/folks/backend_loading_vala.stamp -o \
265         ! -e ${sd}backends/key-file/key_file_la_vala.stamp -o \
266         ! -e ${sd}backends/telepathy/telepathy_la_vala.stamp \
267                 -o \
268         ! -e ${sd}backends/telepathy/lib/folks-telepathy.vapi -o \
269         ! -e ${sd}backends/telepathy/lib/tp-lowlevel.gir -o \
270         ! -e ${sd}backends/telepathy/lib/tp-lowlevel.vapi -o \
271         ! -e ${sd}backends/telepathy/lib/libfolks_telepathy_la_vala.stamp -o \
272         ! -e ${sd}folks/folks-internal.h -o \
273         ! -e ${sd}folks/folks-internal.vapi -o \
274         ! -e ${sd}folks/libfolks_internal_la_vala.stamp -o \
275         ! -e ${sd}folks/folks.vapi -o \
276         ! -e ${sd}folks/libfolks_la_vala.stamp \
277       ], [
278         enable_vala=yes
279         echo "Vala source needs to be re-compiled; requiring Vala..."
280 ])
281
282 AS_IF([test "x$enable_vala" = "xyes"], [
283         AM_PROG_VALAC([$VALA_REQUIRED])
284         AS_IF([test "x$VALAC" = "x"], [
285               AC_MSG_ERROR([Vala requested but valac is not installed])
286         ])
287
288         AC_PATH_PROG([VAPIGEN], [vapigen], [])
289         AS_IF([test "x$VAPIGEN" = "x"], [
290               AC_MSG_ERROR([Vala must be built with --enable-vapigen])
291         ])
292
293         # require GLib >= 2.24 so GLib.Array, etc. reffing is handled
294         # automatically
295         VALAFLAGS="$VALAFLAGS --target-glib=2.24"
296         AC_SUBST([VALAFLAGS])
297         AC_SUBST([VAPIGENFLAGS])
298         AC_SUBST([VAPIDIR])
299
300         VALA_CHECK_PACKAGES([gio-2.0
301                              gee-0.8])
302
303         AS_IF([test x$enable_telepathy_backend = xyes], [
304           VALA_CHECK_PACKAGES([telepathy-glib])
305           AS_IF([test "x$have_zeitgeist" == "xyes"], [
306               VALA_CHECK_PACKAGES([zeitgeist-1.0])
307           ])
308         ])
309
310         AS_IF([test x$enable_tracker_backend = xyes], [
311           VALA_CHECK_PACKAGES([tracker-sparql-$TRACKER_SPARQL_MAJOR])
312         ])
313
314         AS_IF([test x$enable_eds_backend = xyes], [
315           VALA_CHECK_PACKAGES([libebook-1.2 libedataserver-1.2 libxml-2.0])
316         ])
317
318         AS_IF([test x$enable_ofono_backend = xyes], [
319           VALA_CHECK_PACKAGES([libebook-1.2])
320         ])
321 ])
322
323 # this will set HAVE_INTROSPECTION
324 GOBJECT_INTROSPECTION_REQUIRE([1.30])
325
326 AM_CONDITIONAL([HAVE_VALA], [test "x$enable_vala" = "xyes"])
327
328 # Various functions that we need (used in C code generated from Vala)
329 AC_CHECK_FUNCS([memset])
330 AC_CHECK_FUNCS([strstr])
331
332 AM_CONDITIONAL([NOT_RELEASE], [test "x$folks_released" = "x0"])
333
334 # -----------------------------------------------------------
335 # Backends
336 # -----------------------------------------------------------
337
338 FOLKS_MODULE_VERSION=folks_module_version
339 AC_SUBST([FOLKS_MODULE_VERSION])
340 AC_DEFINE([MODULE_VERSION], "folks_module_version", [Module interface version])
341
342 BACKEND_DIR='$(libdir)/folks/$(FOLKS_MODULE_VERSION)/backends'
343 AC_SUBST([BACKEND_DIR])
344
345 BACKEND_KF='$(top_builddir)/backends/key-file/.libs/key-file.so'
346 AC_SUBST([BACKEND_KF])
347 BACKEND_TP='$(top_builddir)/backends/telepathy/.libs/telepathy.so'
348 AC_SUBST([BACKEND_TP])
349
350 AS_IF([test x$have_libsocialweb_backend = xyes], [
351   BACKEND_LIBSOCIALWEB='$(top_builddir)/backends/libsocialweb/.libs/libsocialweb.so'
352   AC_SUBST([BACKEND_LIBSOCIALWEB])
353 ])
354
355 AS_IF([test x$enable_tracker_backend = xyes], [
356   BACKEND_TRACKER='$(top_builddir)/backends/tracker/.libs/tracker.so'
357   AC_SUBST([BACKEND_TRACKER])
358 ])
359
360 AS_IF([test x$enable_eds_backend = xyes], [
361   BACKEND_EDS='$(top_builddir)/backends/eds/.libs/eds.so'
362   AC_SUBST([BACKEND_EDS])
363 ])
364
365 if test x$enable_ofono_backend = xyes; then
366   BACKEND_OFONO='$(top_builddir)/backends/ofono/.libs/ofono.so'
367   AC_SUBST([BACKEND_OFONO])
368 fi
369
370 # All of the backend libraries in our tree; to be used by the tests
371 BACKEND_UNINST_PATH='$(BACKEND_KF):$(BACKEND_TP)'
372 AS_IF([test x$have_libsocialweb_backend = xyes], [
373   LIBSOCIALWEB_BACKEND_UNINST_PATH='$(BACKEND_LIBSOCIALWEB)'
374   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$LIBSOCIALWEB_BACKEND_UNINST_PATH"
375 ])
376 AS_IF([test x$enable_tracker_backend = xyes], [
377   TRACKER_BACKEND_UNINST_PATH='$(BACKEND_TRACKER)'
378   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$TRACKER_BACKEND_UNINST_PATH"
379 ])
380 AS_IF([test x$enable_eds_backend = xyes], [
381   EDS_BACKEND_UNINST_PATH='$(BACKEND_EDS)'
382   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$EDS_BACKEND_UNINST_PATH"
383 ])
384 AS_IF([test x$enable_ofono_backend = xyes], [
385   OFONO_BACKEND_UNINST_PATH='$(BACKEND_OFONO)'
386   BACKEND_UNINST_PATH="$BACKEND_UNINST_PATH:$OFONO_BACKEND_UNINST_PATH"
387 ])
388 AC_SUBST([BACKEND_UNINST_PATH])
389
390 # -----------------------------------------------------------
391 # Tools
392 # -----------------------------------------------------------
393
394 AC_ARG_ENABLE([import-tool],
395               AS_HELP_STRING([--enable-import-tool],
396                              [Enable building the meta-contact import tool]),
397               [enable_import_tool=$enableval with_import_tool=$enableval],
398               [enable_import_tool=maybe with_import_tool=no])
399 AS_IF([test "$enable_import_tool" != "no"],
400       [PKG_CHECK_MODULES([LIBXML], [libxml-2.0],
401                          [with_import_tool=yes], [with_import_tool=no])])
402 AS_IF([test "$enable_import_tool" = "yes" -a "$with_import_tool" = "no"],
403       [AC_MSG_ERROR([Import tool explicitly enabled, but libxml2 not found])])
404 AM_CONDITIONAL([ENABLE_IMPORT_TOOL], [test "$with_import_tool" = "yes"])
405
406 # Readline's required for the folks-inspect program
407 AC_ARG_ENABLE([inspect-tool],
408               AS_HELP_STRING([--enable-inspect-tool],
409                              [Enable building the data inspection tool]),
410               [enable_inspect_tool=$enableval with_inspect_tool=$enableval],
411               [enable_inspect_tool=maybe with_inspect_tool=no])
412 AS_IF([test "$enable_inspect_tool" = "yes" -a "$enable_vala" != "yes"],
413       [AC_MSG_ERROR([Inspect tool explicitly enabled, but Vala wasn't enabled \
414                      using --enable-vala])])
415 AS_IF([test "$enable_inspect_tool" = "maybe" -a "$enable_vala" != "yes"],
416       [AC_MSG_NOTICE([Inspect tool disabled, as Vala wasn't enabled using \
417                       --enable-vala])])
418 AS_IF([test "$enable_inspect_tool" != "no" -a "x$enable_vala" = "xyes"],
419       [AC_CHECK_LIB([readline], [main],
420                     [with_inspect_tool=yes], [with_inspect_tool=no],
421                     [-lncurses])])
422 AS_IF([test "$enable_inspect_tool" != "no" -a "$with_inspect_tool" = "yes" -a \
423        "x$enable_vala" = "xyes"],
424       [VALA_CHECK_PACKAGES([readline])
425        LIBREADLINE="-lreadline -lncurses"
426        AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if you have libreadline])
427        AC_SUBST([LIBREADLINE])])
428 AS_IF([test "$enable_inspect_tool" = "yes" -a "$with_inspect_tool" = "no"],
429       [AC_MSG_ERROR([Inspect tool explicitly enabled, but readline not found])])
430 AM_CONDITIONAL([ENABLE_INSPECT_TOOL], [test "$with_inspect_tool" = "yes"])
431
432 # -----------------------------------------------------------
433 # Tests
434 # -----------------------------------------------------------
435
436 AC_ARG_ENABLE([tests],
437               AS_HELP_STRING([--enable-tests],[Enable building of tests]),
438               [enable_tests=$enableval], [enable_tests=yes])
439 AS_IF([test "$enable_tests" = "yes" -a "$enable_telepathy_backend" = "no"],
440       [AC_MSG_ERROR([The Telepathy backend must be enabled to build tests])])
441 AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes])
442
443 # -----------------------------------------------------------
444 # Documentation
445 # -----------------------------------------------------------
446
447 AC_ARG_ENABLE([docs],
448               AS_HELP_STRING([--enable-docs],[Enable documentation generation]),
449               [enable_docs=$enableval], [enable_docs=no])
450 AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes])
451
452 have_valadoc=no
453 AS_IF([test x$enable_docs = xyes], [
454   # make sure the library is new enough and the program exists
455   PKG_CHECK_MODULES([VALADOC], [valadoc-1.0 >= $VALADOC_REQUIRED])
456   AC_PATH_PROG([VALADOC], [valadoc], [:])
457   AS_IF([test "$VALADOC" != :], have_valadoc=yes)
458 ])
459 AM_CONDITIONAL([HAVE_VALADOC], [test x$have_valadoc = xyes])
460
461 AS_IF([test "x$enable_docs" = "xyes" -a "x$have_valadoc" != "xyes"], [
462     AC_MSG_ERROR([Doc building requested but valadoc not installed.])
463 ])
464
465 # -----------------------------------------------------------
466 # Gettext
467 # -----------------------------------------------------------
468
469 GETTEXT_PACKAGE=AC_PACKAGE_NAME
470 AC_SUBST(GETTEXT_PACKAGE)
471 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
472 IT_PROG_INTLTOOL([0.50.0])
473
474 # -----------------------------------------------------------
475 # Error flags
476 # -----------------------------------------------------------
477
478 # Disable GLib deprecation warnings for now (#670196); GValueArray is deprecated
479 # but we need it for dbus-glib. Porting to GDBus will solve this (#653198)
480 AC_DEFINE(GLIB_DISABLE_DEPRECATION_WARNINGS, 1, [Build with GLib deprecated])
481
482 AS_COMPILER_FLAG([-Wall], [ERROR_CFLAGS="-Wall"], [ERROR_CFLAGS=""])
483 AS_COMPILER_FLAG([-Werror], [werror=yes], [werror=no])
484
485 AC_ARG_ENABLE([debug],
486               AS_HELP_STRING([--disable-debug],[compile without debug code]),
487               [enable_debug=$enableval], [enable_debug=yes])
488
489 AS_COMPILER_FLAG([-Wextra], [wextra=yes], [wextra=no])
490 AS_COMPILER_FLAG([-Wno-missing-field-initializers],
491                  [wno_missing_field_initializers=yes],
492                  [wno_missing_field_initializers=no])
493 AS_COMPILER_FLAG([-Wno-unused-parameter],
494                  [wno_unused_parameter=yes], [wno_unused_parameter=no])
495 AS_COMPILER_FLAG([-Wstrict-prototypes], [wstrict_prototypes=yes],
496                  [wstrict_prototypes=no])
497 AS_COMPILER_FLAG([-Wmissing-prototypes], [wmissing_prototypes=yes],
498                  [wmissing_prototypes=no])
499 AS_COMPILER_FLAG([-Wimplicit-function-declaration],
500                  [wimplicit_function_declaration=yes],
501                  [wimplicit_function_declaration=no])
502 AS_COMPILER_FLAG([-Wpointer-arith], [wpointer_arith=yes], [wpointer_arith=no])
503 AS_COMPILER_FLAG([-Winit-self], [winit_self=yes], [winit_self=no])
504 AS_COMPILER_FLAG([-Wformat=2], [wformat=yes], [wformat=no])
505 AS_COMPILER_FLAG([-Wmissing-include-dirs], [wmissing_include_dirs=yes],
506                  [wmissing_include_dirs=no])
507 AS_COMPILER_FLAG([-Waggregate-return], [waggregate_return=yes],
508                  [waggregate_return=no])
509 AS_COMPILER_FLAG([-Wdeclaration-after-statement],
510                  [wdeclaration_after_statement=yes],
511                  [wdeclaration_after_statement=no])
512
513 m4_if(folks_released, [1], [],
514     [
515         # Iff we support -Werror, then use it with all our compiler warnings.
516         if test x$werror = xyes; then
517             flag="-Werror="
518         else
519             flag="-W"
520         fi
521
522         if test x$wextra = xyes -a \
523             x$wno_missing_field_initializers = xyes -a \
524             x$wno_unused_parameter = xyes -a x$wstrict_prototypes = xyes -a \
525             x$wmissing_prototypes = xyes -a \
526             x$wimplicit_function_declaration = xyes -a x$wpointer_arith = xyes \
527             -a x$winit_self = xyes -a x$wformat = xyes -a \
528             x$wmissing_include_dirs = xyes -a x$waggregate_return = xyes -a \
529             x$wdeclaration_after_statement = xyes; then
530             ERROR_CFLAGS="$ERROR_CFLAGS -Wextra \
531                 -Wno-missing-field-initializers \
532                 -Wno-unused-parameter ${flag}strict-prototypes \
533                 ${flag}missing-prototypes ${flag}implicit-function-declaration \
534                 ${flag}pointer-arith ${flag}init-self ${flag}format=2 \
535                 ${flag}missing-include-dirs ${flag}aggregate-return \
536                 ${flag}declaration-after-statement"
537         fi
538     ])
539
540 AS_COMPILER_FLAG([-D_POSIX_SOURCE], [ERROR_CFLAGS="$ERROR_CFLAGS -D_POSIX_SOURCE"])
541 AS_COMPILER_FLAG([-std=c99], [ERROR_CFLAGS="$ERROR_CFLAGS -std=c99"])
542 AS_COMPILER_FLAG([-Wshadow], [ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow"])
543 AS_COMPILER_FLAG([-Wmissing-prototypes], [ERROR_CFLAGS="$ERROR_CFLAGS \
544                                           -Wmissing-prototypes"])
545 AS_COMPILER_FLAG([-Wmissing-declarations], [ERROR_CFLAGS="$ERROR_CFLAGS \
546                                             -Wmissing-declarations"])
547 AS_COMPILER_FLAG([-Wstrict-prototypes], [ERROR_CFLAGS="$ERROR_CFLAGS \
548                                          -Wstrict-prototypes"])
549
550 AC_SUBST([ERROR_CFLAGS])
551
552 # -----------------------------------------------------------
553 # Code coverage flags
554 # -----------------------------------------------------------
555
556 AC_ARG_ENABLE([code-coverage],
557               AS_HELP_STRING([--enable-code-coverage],
558                              [compile with code coverage code]),
559               [enable_code_coverage=$enableval], [enable_code_coverage=no])
560
561 # Only enable code coverage if this isn't a release.
562 m4_if(folks_released, [1], [],
563     [
564         if test "x$GCC" = "xyes"; then
565             if test "x$enable_code_coverage" = "xyes"; then
566                 CODE_COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage -O0 -ggdb"
567                 CODE_COVERAGE_LDFLAGS="-lgcov"
568             fi
569         fi
570     ])
571
572 AC_SUBST([CODE_COVERAGE_CFLAGS])
573 AC_SUBST([CODE_COVERAGE_LDFLAGS])
574
575 # Vala-related flags
576 AC_ARG_ENABLE([fatal-warnings],
577               AS_HELP_STRING([--disable-fatal-warnings],
578                              [Make warnings from valac and g-ir-scanner non-fatal]),
579               [enable_fatal_warnings=$enableval], [enable_fatal_warnings=yes])
580 AS_IF([test "x$enable_vala" = "xyes" && test "x$enable_fatal_warnings" = "xyes"],
581       [ERROR_INTROSPECTION_SCANNER_ARGS="\
582                         $ERROR_INTROSPECTION_SCANNER_ARGS --warn-error"
583        ERROR_VALAFLAGS="$ERROR_VALAFLAGS --fatal-warnings"])
584
585 # Disable -g if we're building with code coverage enabled, since Vala's
586 # insertion of #line directives into .c files confuses lcov. For the moment,
587 # we'll have to do with looking at code coverage of the generated C files only.
588 # We set the debug flags in CODE_COVERAGE_CFLAGS instead in that case.
589 m4_if(folks_released, [1], [],
590     [
591         if test "x$enable_code_coverage" != "xyes" -o "x$GCC" != "xyes"; then
592             ERROR_VALAFLAGS="$ERROR_VALAFLAGS -g"
593         fi
594     ])
595
596 AC_SUBST([ERROR_INTROSPECTION_SCANNER_ARGS])
597 AC_SUBST([ERROR_VALAFLAGS])
598
599 # -----------------------------------------------------------
600 # Profiling
601 # -----------------------------------------------------------
602
603 AC_ARG_ENABLE([profiling],
604               AS_HELP_STRING([--enable-profiling],
605                              [Enable building profiling points]),
606               [enable_profiling=$enableval],
607               [enable_profiling=no])
608 AM_CONDITIONAL([ENABLE_PROFILING], [test "$enable_profiling" = "yes"])
609
610 # -----------------------------------------------------------
611 # Final output
612 # -----------------------------------------------------------
613
614 AC_CONFIG_FILES([
615     backends/telepathy/lib/folks-telepathy.pc
616     backends/telepathy/lib/folks-telepathy-uninstalled.pc
617     backends/tracker/lib/folks-tracker.deps
618     backends/tracker/lib/folks-tracker.pc
619     backends/tracker/lib/folks-tracker-uninstalled.pc
620     backends/eds/lib/folks-eds.pc
621     backends/eds/lib/folks-eds-uninstalled.pc
622     folks/folks.pc
623     folks/folks-uninstalled.pc
624     folks/org.freedesktop.folks.gschema.xml
625     Makefile
626     backends/Makefile
627     backends/key-file/Makefile
628     backends/libsocialweb/Makefile
629     backends/libsocialweb/lib/Makefile
630     backends/libsocialweb/lib/folks-libsocialweb.pc
631     backends/libsocialweb/lib/folks-libsocialweb-uninstalled.pc
632     backends/telepathy/Makefile
633     backends/telepathy/lib/Makefile
634     backends/tracker/Makefile
635     backends/tracker/lib/Makefile
636     backends/eds/Makefile
637     backends/eds/lib/Makefile
638     backends/ofono/Makefile
639     folks/Makefile
640     docs/Makefile
641     po/Makefile.in
642     tests/Makefile
643     tests/data/Makefile
644     tests/eds/Makefile
645     tests/folks/Makefile
646     tests/key-file/Makefile
647     tests/libsocialweb/Makefile
648     tests/telepathy/Makefile
649     tests/tracker/Makefile
650     tests/lib/Makefile
651     tests/lib/folks-test-uninstalled.pc
652     tests/lib/eds/Makefile
653     tests/lib/key-file/Makefile
654     tests/lib/libsocialweb/Makefile
655     tests/lib/libsocialweb/session.conf
656     tests/lib/telepathy/Makefile
657     tests/lib/tracker/Makefile
658     tests/lib/telepathy/contactlist/Makefile
659     tests/lib/telepathy/contactlist/session.conf
660     tests/tools/Makefile
661     tools/Makefile
662     tools/inspect/Makefile
663 ])
664
665 AC_OUTPUT
666
667 echo "
668 Configure summary:
669
670         Vala........................:  ${enable_vala}
671         Vala Compiler...............:  ${VALAC}
672         C Compiler Flags............:  ${CFLAGS} ${ERROR_CFLAGS} ${CODE_COVERAGE_CFLAGS}
673         Linker Flags................:  ${LDFLAGS} ${CODE_COVERAGE_LDFLAGS}
674         Prefix......................:  ${prefix}
675         Bugreporting URL............:  ${PACKAGE_BUGREPORT}
676         Documentation...............:  ${have_valadoc}
677         Import tool.................:  ${with_import_tool}
678         Inspector tool..............:  ${with_inspect_tool}
679         Telepathy backend...........:  ${enable_telepathy_backend}
680         Tracker backend.............:  ${enable_tracker_backend}
681         Libsocialweb backend........:  ${have_libsocialweb_backend}
682         E-D-S backend...............:  ${enable_eds_backend}
683         Ofono backend...............:  ${enable_ofono_backend}
684         Zeitgeist support...........:  ${have_zeitgeist}
685         Build tests.................:  ${enable_tests}
686 "