Point the tests at the uninstalled backends.
[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], [3])
6 m4_define([folks_micro_version], [1])
7 m4_define([folks_nano_version], [1])
8
9 # If library source has changed since last release, increment revision
10 # If interfaces have been added, removed or changed since last release,
11 #  increment current and set revision to 0
12 # If interfaces have been added since last release, increment age
13 # If interfaces have been removed since last release, set age to 0
14 m4_define([folks_lt_current], [17])
15 m4_define([folks_lt_revision], [0])
16 m4_define([folks_lt_age], [1])
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-bzip2 no-define
46                   no-dist-gzip tar-ustar -Wno-portability])
47 AM_MAINTAINER_MODE
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
55 AC_SUBST([CFLAGS])
56 AC_SUBST([CPPFLAGS])
57 AC_SUBST([LDFLAGS])
58
59 LT_CURRENT=folks_lt_current
60 LT_REVISION=folks_lt_revision
61 LT_AGE=folks_lt_age
62 AC_SUBST([LT_CURRENT])
63 AC_SUBST([LT_REVISION])
64 AC_SUBST([LT_AGE])
65
66 FOLKS_MAJOR_MINOR_VERSION=folks_major_minor_version
67 AC_SUBST([FOLKS_MAJOR_MINOR_VERSION])
68
69 # -----------------------------------------------------------
70 # Dependencies
71 # -----------------------------------------------------------
72
73 GLIB_REQUIRED=2.24.0
74 TP_GLIB_REQUIRED=0.13.1
75 VALA_REQUIRED=0.10.0
76
77 AM_PROG_VALAC([$VALA_REQUIRED])
78
79 # require GLib >= 2.24 so GLib.Array, etc. reffing is handled automatically
80 VALAFLAGS="$VALAFLAGS --target-glib=2.24"
81 AC_SUBST([VALAFLAGS])
82 AC_SUBST([VAPIGENFLAGS])
83 AC_SUBST([VAPIDIR])
84
85 AC_PATH_PROG([VAPIGEN], [vapigen], [vapigen])
86 AS_IF([test "$VAPIGEN" = ""],
87       [AC_MSG_ERROR([Vala must be built with --enable-vapigen])])
88
89 GOBJECT_INTROSPECTION_REQUIRE([0.9.12])
90
91 PKG_CHECK_MODULES([GLIB],
92                   [glib-2.0 >= $GLIB_REQUIRED
93                    gobject-2.0 >= $GLIB_REQUIRED])
94 PKG_CHECK_MODULES([GMODULE], [gmodule-no-export-2.0])
95 PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_REQUIRED])
96 PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
97
98 # FIXME: We depend on libgee < 0.7 because 0.7 breaks API. bgo#627746
99 PKG_CHECK_MODULES([GEE], [gee-1.0 < 0.7])
100 PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
101 VALA_CHECK_PACKAGES([telepathy-glib
102                      dbus-glib-1
103                      gio-2.0
104                      gee-1.0])
105
106 # Various functions that we need (used in C code generated from Vala)
107 AC_CHECK_FUNCS([memset])
108 AC_CHECK_FUNCS([strstr])
109
110 # -----------------------------------------------------------
111 # Backends
112 # -----------------------------------------------------------
113
114 FOLKS_MODULE_VERSION=folks_module_version
115 AC_SUBST([FOLKS_MODULE_VERSION])
116 AC_DEFINE([MODULE_VERSION], "folks_module_version", [Module interface version])
117
118 BACKEND_DIR='$(libdir)/folks/$(FOLKS_MODULE_VERSION)/backends'
119 AC_SUBST([BACKEND_DIR])
120
121 BACKEND_KF='$(top_builddir)/backends/key-file/.libs/libfolks-backend-key-file.so'
122 AC_SUBST([BACKEND_KF])
123 BACKEND_TP='$(top_builddir)/backends/telepathy/.libs/libfolks-backend-telepathy.so'
124 AC_SUBST([BACKEND_TP])
125
126 # All of the backend libraries in our tree; to be used by the tests
127 BACKEND_UNINST_PATH='$(BACKEND_KF):$(BACKEND_TP)'
128 AC_SUBST([BACKEND_UNINST_PATH])
129
130 # -----------------------------------------------------------
131 # Tools
132 # -----------------------------------------------------------
133
134 AC_ARG_ENABLE([import-tool],
135               AS_HELP_STRING([--enable-import-tool],
136                              [Enable building the meta-contact import tool]),
137               [enable_import_tool=$enableval with_import_tool=$enableval],
138               [enable_import_tool=maybe with_import_tool=no])
139 AS_IF([test "$enable_import_tool" != "no"],
140       [PKG_CHECK_MODULES([LIBXML], [libxml-2.0],
141                          [with_import_tool=yes], [with_import_tool=no])])
142 AS_IF([test "$enable_import_tool" = "yes" -a "$with_import_tool" = "no"],
143       [AC_MSG_ERROR([Import tool explicitly enabled, but libxml2 not found])])
144 AM_CONDITIONAL([ENABLE_IMPORT_TOOL], [test "$with_import_tool" = "yes"])
145
146 # -----------------------------------------------------------
147 # Documentation
148 # -----------------------------------------------------------
149
150 AC_ARG_ENABLE([docs],
151               AS_HELP_STRING([--enable-docs],[Enable documentation generation]),
152               [enable_docs=$enableval], [enable_docs=no])
153 AM_CONDITIONAL([ENABLE_DOCS], [test x$enable_docs = xyes])
154
155 AS_IF([test "x$enable_docs" != xno],
156       [AC_PATH_PROG([VALADOC], [valadoc], [:])
157        AS_IF([test "$VALADOC" = :],
158              [AC_MSG_ERROR([valadoc not found])])])
159
160 # -----------------------------------------------------------
161 # Gettext
162 # -----------------------------------------------------------
163
164 GETTEXT_PACKAGE=AC_PACKAGE_NAME
165 AC_SUBST(GETTEXT_PACKAGE)
166 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define the gettext package to be used])
167 AM_GNU_GETTEXT_VERSION([0.17])
168 AM_GNU_GETTEXT([external])
169 IT_PROG_INTLTOOL([0.35.0])
170
171 # -----------------------------------------------------------
172 # Error flags
173 # -----------------------------------------------------------
174
175 AS_COMPILER_FLAG([-Wall], [ERROR_CFLAGS="-Wall"], [ERROR_CFLAGS=""])
176 AS_COMPILER_FLAG([-Werror], [werror=yes], [werror=no])
177
178 AC_ARG_ENABLE([debug],
179               AS_HELP_STRING([--disable-debug],[compile without debug code]),
180               [enable_debug=$enableval], [enable_debug=yes])
181
182 AC_ARG_ENABLE([Werror],
183               AS_HELP_STRING([--disable-Werror],
184                              [compile without -Werror (normally enabled in
185                               development builds)]),
186               [werror=$enableval], [werror=yes])
187
188 AS_COMPILER_FLAG([-Wextra], [wextra=yes], [wextra=no])
189 AS_COMPILER_FLAG([-Wno-missing-field-initializers],
190                  [wno_missing_field_initializers=yes],
191                  [wno_missing_field_initializers=no])
192 AS_COMPILER_FLAG([-Wno-unused-parameter],
193                  [wno_unused_parameter=yes], [wno_unused_parameter=no])
194
195 m4_if(folks_released, [1], [],
196     [
197         ERROR_INTROSPECTION_SCANNER_ARGS="$ERROR_INTROSPECTION_SCANNER_ARGS \
198                 --warn-error"
199         ERROR_VALAFLAGS="$ERROR_VALAFLAGS --fatal-warnings"
200         if test x$werror = xyes; then
201             ERROR_CFLAGS="$ERROR_CFLAGS -Werror"
202         fi
203         if test x$wextra = xyes -a \
204             x$wno_missing_field_initializers = xyes -a \
205             x$wno_unused_parameter = xyes; then
206             ERROR_CFLAGS="$ERROR_CFLAGS -Wextra \
207                 -Wno-missing-field-initializers -Wno-unused-parameter"
208         fi
209     ])
210
211 AS_COMPILER_FLAG([-D_POSIX_SOURCE], [ERROR_CFLAGS="$ERROR_CFLAGS -D_POSIX_SOURCE"])
212 AS_COMPILER_FLAG([-std=c99], [ERROR_CFLAGS="$ERROR_CFLAGS -std=c99"])
213 AS_COMPILER_FLAG([-Wshadow], [ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow"])
214 AS_COMPILER_FLAG([-Wmissing-prototypes], [ERROR_CFLAGS="$ERROR_CFLAGS \
215                                           -Wmissing-prototypes"])
216 AS_COMPILER_FLAG([-Wmissing-declarations], [ERROR_CFLAGS="$ERROR_CFLAGS \
217                                             -Wmissing-declarations"])
218 AS_COMPILER_FLAG([-Wstrict-prototypes], [ERROR_CFLAGS="$ERROR_CFLAGS \
219                                          -Wstrict-prototypes"])
220
221 AC_SUBST([ERROR_INTROSPECTION_SCANNER_ARGS])
222 AC_SUBST([ERROR_VALAFLAGS])
223 AC_SUBST([ERROR_CFLAGS])
224
225 # -----------------------------------------------------------
226 # Final output
227 # -----------------------------------------------------------
228
229 AC_CONFIG_FILES([
230     backends/telepathy/lib/folks-telepathy.pc
231     backends/telepathy/lib/folks-telepathy-uninstalled.pc
232     folks/folks.pc
233     folks/folks-uninstalled.pc
234     Makefile
235     backends/Makefile
236     backends/key-file/Makefile
237     backends/telepathy/Makefile
238     backends/telepathy/lib/Makefile
239     folks/Makefile
240     docs/Makefile
241     po/Makefile.in
242     tests/Makefile
243     tests/folks/Makefile
244     tests/key-file/Makefile
245     tests/telepathy/Makefile
246     tests/lib/Makefile
247     tests/lib/folks-test-uninstalled.pc
248     tests/lib/key-file/Makefile
249     tests/lib/telepathy/Makefile
250     tests/lib/telepathy/contactlist/Makefile
251     tests/lib/telepathy/contactlist/session.conf
252     tests/tools/Makefile
253     tools/Makefile
254 ])
255
256 AC_OUTPUT
257
258 echo "
259 Configure summary:
260
261         Compiler....................:  ${VALAC}
262         Compiler Flags..............:  ${CFLAGS} ${ERROR_CFLAGS}
263         Prefix......................:  ${prefix}
264         Bugreporting URL............:  ${PACKAGE_BUGREPORT}
265         Documentation...............:  ${enable_docs}
266         Tests.......................:  ${have_tp_glib_for_tests}
267         Import tool.................:  ${with_import_tool}
268
269
270 "