Use gen-introspect-0.10 instead of gen-introspect
[platform/upstream/folks.git] / configure.ac
1 dnl 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], [1])
6 m4_define([folks_micro_version], [14])
7 m4_define([folks_nano_version], [0])
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
15 m4_define([folks_lt_current], [12])
16 m4_define([folks_lt_revision], [0])
17 m4_define([folks_lt_age], [12])
18
19 dnl Display the nano_version only if it's not '0'
20 m4_define([folks_base_version],
21                 [folks_major_version.folks_minor_version.folks_micro_version])
22 m4_define([folks_full_version],
23                 [m4_if(folks_nano_version, 0, [folks_base_version],
24                         [folks_base_version].[folks_nano_version])])
25
26 m4_define(folks_maybe_datestamp,
27                     m4_esyscmd([if test x]folks_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
28
29 m4_define(folks_version, folks_full_version[]folks_maybe_datestamp)
30
31 # Module API version.
32 m4_define([folks_module_version], [folks_lt_current])
33
34 AC_INIT(folks, folks_version, https://bugzilla.gnome.org/browse.cgi?product=folks)
35 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36
37 AC_PREREQ(2.59)
38 AC_COPYRIGHT([
39   Copyright (C) 2010 Collabora Ltd.
40 ])
41
42 AC_CONFIG_MACRO_DIR([m4])
43 AC_CONFIG_SRCDIR([Makefile.am])
44 AC_CONFIG_HEADERS(config.h)
45 AC_CONFIG_SRCDIR([configure.ac])
46 AM_INIT_AUTOMAKE(1.11 dist-bzip2 no-define 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 AC_PROG_LIBTOOL
53
54 AC_SUBST(CFLAGS)
55 AC_SUBST(CPPFLAGS)
56 AC_SUBST(LDFLAGS)
57
58 # -----------------------------------------------------------
59 # Dependencies
60 # -----------------------------------------------------------
61 GLIB_REQUIRED=2.24.0
62 TP_GLIB_REQUIRED=0.11.11
63 VALA_REQUIRED=0.9.5
64
65 AM_PROG_VALAC([$VALA_REQUIRED])
66
67 PKG_PROG_PKG_CONFIG([0.21])
68
69 LT_CURRENT=folks_lt_current
70 LT_REVISION=folks_lt_revision
71 LT_AGE=folks_lt_age
72 AC_SUBST([LT_CURRENT])
73 AC_SUBST([LT_REVISION])
74 AC_SUBST([LT_AGE])
75
76 PKG_CHECK_MODULES(GLIB,
77                   glib-2.0 >= $GLIB_REQUIRED
78                   gobject-2.0 >= $GLIB_REQUIRED)
79 AC_SUBST(GLIB_CFLAGS)
80 AC_SUBST(GLIB_LIBS)
81
82 PKG_CHECK_MODULES(GIO, gio-2.0 >= $GLIB_REQUIRED)
83 AC_SUBST(GIO_CFLAGS)
84 AC_SUBST(GIO_LIBS)
85
86 PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1)
87 AC_SUBST(DBUS_GLIB_CFLAGS)
88 AC_SUBST(DBUS_GLIB_LIBS)
89
90 # require GLib >= 2.24 so GLib.Array, etc. reffing is handled automatically
91 VALACFLAGS="$VALACFLAGS --target-glib=2.24"
92 AC_SUBST(VALACFLAGS)
93 AC_SUBST(VALAFLAGS)
94 AC_SUBST(VAPIDIR)
95
96 AC_PATH_PROG(VAPIGEN, vapigen, vapigen)
97 AC_SUBST(VAPIGEN)
98
99 # XXX: using this path instead of the wrapper script vala-gen-introspect is
100 # sub-optimal, but the wrapper requires that we use a pkg-config file. Once
101 # the dependencies of bgo#627046 are fixed, we should use g-ir-scanner instead
102 # of vala-gen-introspect anyway.
103 VALA_GEN_INTROSPECT='$(libdir)/vala-0.10/gen-introspect-0.10'
104 AC_SUBST(VALA_GEN_INTROSPECT)
105
106 AS_IF([test "$VAPIGEN" = "" -o "$VALA_GEN_INTROSPECT" = ""],
107         [AC_MSG_ERROR([Vala must be built with --enable-vapigen])])
108
109 PKG_CHECK_MODULES(GEE, gee-1.0)
110 AC_SUBST(GEE_CFLAGS)
111 AC_SUBST(GEE_LIBS)
112
113 PKG_CHECK_MODULES(TP_GLIB, telepathy-glib >= $TP_GLIB_REQUIRED)
114 AC_SUBST(TP_GLIB_CFLAGS)
115 AC_SUBST(TP_GLIB_LIBS)
116
117 # check for tp-glib vala bindings by compiling a trivial program
118 AC_MSG_CHECKING([Telepathy Vala bindings])
119 AS_IF(! [$VALAC $VALACFLAGS $VALAFLAGS --vapidir=$VAPIDIR --pkg telepathy-glib \
120          -o /dev/null "${srcdir}/telepathy-check.vala"],
121         [AC_MSG_ERROR([Missing telepathy-glib Vala bindings])])
122 AC_MSG_RESULT([yes])
123
124 # -----------------------------------------------------------
125 # Backends
126 # -----------------------------------------------------------
127
128 FOLKS_MODULE_VERSION=folks_module_version()
129 AC_SUBST(FOLKS_MODULE_VERSION)
130 AC_DEFINE([MODULE_VERSION], ["folks_module_version()"],
131           [Module interface version])
132
133 BACKEND_DIR='$(libdir)/folks/$(FOLKS_MODULE_VERSION)/backends'
134 AC_SUBST(BACKEND_DIR)
135
136 # -----------------------------------------------------------
137 # Documentation
138 # -----------------------------------------------------------
139 AC_ARG_ENABLE(docs,
140   AC_HELP_STRING([--enable-docs],[Enable documentation generation]),
141     enable_docs=$enableval, enable_docs=no)
142 AM_CONDITIONAL(ENABLE_DOCS, test x$enable_docs = xyes)
143
144 AS_IF([test "x$enable_docs" != xno],
145   [AC_PATH_PROG(VALADOC, valadoc, :)
146    AC_SUBST(VALADOC)
147    AS_IF([test "$VALADOC" = :],
148      [AC_MSG_ERROR([valadoc not found])])])
149
150 # -----------------------------------------------------------
151 # Error flags
152 # -----------------------------------------------------------
153 AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")
154 AS_COMPILER_FLAG(-Werror, werror=yes, werror=no)
155
156 AC_ARG_ENABLE(debug,
157   AC_HELP_STRING([--disable-debug],[compile without debug code]),
158     enable_debug=$enableval, enable_debug=yes)
159
160 AC_ARG_ENABLE(Werror,
161   AC_HELP_STRING([--disable-Werror],[compile without -Werror (normally enabled in development builds)]),
162     werror=$enableval, werror=yes)
163
164 AS_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
165 AS_COMPILER_FLAG(-Wno-missing-field-initializers,
166         wno_missing_field_initializers=yes,
167         wno_missing_field_initializers=no)
168 AS_COMPILER_FLAG(-Wno-unused-parameter,
169         wno_unused_parameter=yes,
170         wno_unused_parameter=no)
171
172 ifelse(folks_released, 1, [],
173     [
174         if test x$werror = xyes; then
175             ERROR_CFLAGS="$ERROR_CFLAGS -Werror"
176         fi
177         if test x$wextra = xyes -a \
178             x$wno_missing_field_initializers = xyes -a \
179             x$wno_unused_parameter = xyes; then
180             ERROR_CFLAGS="$ERROR_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter"
181         fi
182     ])
183
184 AS_COMPILER_FLAG(-D_POSIX_SOURCE, ERROR_CFLAGS="$ERROR_CFLAGS -D_POSIX_SOURCE")
185 AS_COMPILER_FLAG(-std=c99, ERROR_CFLAGS="$ERROR_CFLAGS -std=c99")
186 AS_COMPILER_FLAG(-Wshadow, ERROR_CFLAGS="$ERROR_CFLAGS -Wshadow")
187 AS_COMPILER_FLAG(-Wmissing-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-prototypes")
188 AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CFLAGS="$ERROR_CFLAGS -Wmissing-declarations")
189 AS_COMPILER_FLAG(-Wstrict-prototypes, ERROR_CFLAGS="$ERROR_CFLAGS -Wstrict-prototypes")
190
191 AC_SUBST(ERROR_CFLAGS)
192
193 # -----------------------------------------------------------
194 # Final output
195 # -----------------------------------------------------------
196
197 AC_CONFIG_FILES([
198         backends/telepathy/folks-telepathy.pc
199         backends/telepathy/folks-telepathy-uninstalled.pc
200         folks/folks.pc
201         folks/folks-uninstalled.pc
202         Makefile
203         backends/Makefile
204         backends/key-file/Makefile
205         backends/telepathy/Makefile
206         folks/Makefile
207         docs/Makefile
208 ])
209
210 AC_OUTPUT
211
212 echo "
213 Configure summary:
214
215         Compiler....................:  ${VALAC}
216         Compiler Flags..............:  ${CFLAGS} ${ERROR_CFLAGS}
217         Prefix......................:  ${prefix}
218         Bugreporting URL............:  ${PACKAGE_BUGREPORT}
219         Documentation...............:  ${enable_docs}
220
221
222 "