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