Don't use the GNOME coverage macros
[platform/upstream/gcr.git] / configure.ac
1 AC_PREREQ([2.63])
2 AC_INIT([gcr], [3.8.1],
3         [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-keyring&component=gcr],
4         [gcr])
5
6 dnl ****************************************************************************
7 dnl Library package and libtool versioning
8 dnl
9 dnl Updating the libtool versions, follow these instructions sequentially:
10 dnl  1. If the library source code has changed at all since the last update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
11 dnl  2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
12 dnl  3. If any interfaces have been added since the last public release, then increment age.
13 dnl  4. If any interfaces have been removed or changed since the last public release, then set age to 0.
14
15 # GCK package versioning
16 GCK_MAJOR=1
17 GCK_MINOR=0
18 GCK_MICRO=0
19
20 # GCK libtool versioning
21 GCK_CURRENT=0
22 GCK_REVISION=0
23 GCK_AGE=0
24
25 # GCR package versioning
26 GCR_MAJOR=3
27 GCR_MINOR=0
28 GCR_MICRO=0
29
30 # GCR libtool versioning
31 GCR_CURRENT=1
32 GCR_REVISION=0
33 GCR_AGE=0
34
35 dnl ****************************************************************************
36
37 AC_CONFIG_MACRO_DIR([build/m4])
38 AM_INIT_AUTOMAKE([1.11 tar-ustar foreign -Wno-portability])
39 AM_SANITY_CHECK
40 AC_CONFIG_HEADERS(config.h)
41 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
42 AM_MAINTAINER_MODE([enable])
43
44 # -----------------------------------------------------------------------------
45 # Basic tools
46
47 AC_GNU_SOURCE
48 AC_ISC_POSIX
49 AC_PROG_CC
50 AC_PROG_CPP
51 AM_PROG_CC_C_O
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54 AC_PROG_MAKE_SET
55 AM_DISABLE_STATIC
56 AM_PROG_LIBTOOL
57 IT_PROG_INTLTOOL([0.35.0])
58 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
59
60 GETTEXT_PACKAGE=gcr
61 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The gettext domain name])
62 AC_SUBST(GETTEXT_PACKAGE)
63 AM_GLIB_GNU_GETTEXT
64
65 # -----------------------------------------------------------------------------
66 # GLib and GTK+ stuff
67
68 PKG_CHECK_MODULES(GLIB,
69         glib-2.0 >= 2.32.0
70         gmodule-no-export-2.0
71         gthread-2.0
72         gobject-2.0
73         gio-2.0 gio-unix-2.0)
74 AC_SUBST(GLIB_CFLAGS)
75 AC_SUBST(GLIB_LIBS)
76
77 GLIB_GSETTINGS
78 GOBJECT_INTROSPECTION_CHECK([1.34])
79 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
80 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
81
82 GTK_DOC_CHECK(1.9)
83
84 # --------------------------------------------------------------------
85 # Optional GTK+ widgets build, avoid building gtk-doc wihtout GTK+
86 #
87 AC_ARG_WITH(gtk, [
88             AC_HELP_STRING([--without-gtk],
89             [do not build code that uses GTK+]),
90             ], [], [with_gtk=yes])
91 AM_CONDITIONAL(WITH_GTK, test "$with_gtk" != "no")
92
93 if test "x$with_gtk" != "xno"; then
94         PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0)
95         AC_SUBST(GTK_CFLAGS)
96         AC_SUBST(GTK_LIBS)
97 fi
98
99 if test "x$enable_gtk_doc" = "xyes"; then
100   if test "x$with_gtk" = "xno"; then
101     AC_MSG_ERROR([Cannot build documentation if building GTK+ widgets is disabled])
102   fi
103 fi
104
105 # --------------------------------------------------------------------
106 # Checks for functions
107 #
108
109 AC_CHECK_FUNCS(timegm, AC_DEFINE(HAVE_TIMEGM,1,[Have timegm]))
110 AC_CHECK_FUNCS(mlock)
111
112 # --------------------------------------------------------------------
113 # p11-kit
114
115 PKG_CHECK_MODULES([P11_KIT], p11-kit-1 >= 0.6)
116 AC_SUBST(P11_KIT_CFLAGS)
117 AC_SUBST(P11_KIT_LIBS)
118
119 AC_MSG_CHECKING([where to put pkcs11 module configuration])
120 P11_SYSTEM_CONFIG_MODULES=$($PKG_CONFIG p11-kit-1 --variable=p11_system_config_modules)
121 AC_MSG_RESULT($P11_SYSTEM_CONFIG_MODULES)
122 AC_SUBST(P11_SYSTEM_CONFIG_MODULES)
123
124 if test "$P11_SYSTEM_CONFIG_MODULES" = ""; then
125         AC_MSG_ERROR([Could not find location for pkcs11 module config])
126 fi
127
128 AC_MSG_CHECKING([module path to install pkcs11 modules])
129 AC_ARG_WITH(pkcs11-modules, [
130             AC_HELP_STRING([--with-pkcs11-modules=<dir>],
131                            [directory to install PKCS#11 modules])
132             ])
133 if test -z "$with_pkcs11_modules" ; then
134         P11_MODULE_PATH=$($PKG_CONFIG p11-kit-1 --variable=p11_module_path)
135 else
136         P11_MODULE_PATH="$with_pkcs11_modules"
137 fi
138 if test "$P11_MODULE_PATH" = ""; then
139         AC_MSG_ERROR([Could not find directory to install pkcs11 modules])
140 fi
141 AC_MSG_RESULT($P11_MODULE_PATH)
142 AC_SUBST(P11_MODULE_PATH)
143
144 pkcs11standalonedir="${libdir}/gnome-keyring/devel"
145 AC_SUBST(pkcs11standalonedir)
146
147 # --------------------------------------------------------------------
148 # GPG support
149
150 AC_PATH_PROGS([GNUPG], [gpg gpg2], ["gpg"])
151 AC_DEFINE_UNQUOTED([GPG_EXECUTABLE], ["$GNUPG"], [Path to gpg executable.])
152
153 # --------------------------------------------------------------------
154 # libgcrypt
155 #
156
157 GCRYPT_VERSION=1.2.2
158 GCRYPT_LIBVER=1
159
160 AM_PATH_LIBGCRYPT($GCRYPT_LIBVER:$GCRYPT_VERSION,,
161         AC_MSG_ERROR([[
162 ***
163 *** libgcrypt was not found. You may want to get it from
164 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
165 ***
166 ]]))
167 libgcrypt=yes
168 AC_DEFINE_UNQUOTED(LIBGCRYPT_VERSION, "$GCRYPT_VERSION", [Version of GCRYPT we expect])
169
170 AC_SUBST([LIBGCRYPT_CFLAGS])
171 AC_SUBST([LIBGCRYPT_LIBS])
172
173 # -------------------------------------------------------------------
174 # libtasn1
175 #
176
177 AC_PATH_PROG(ASN1PARSER, asn1Parser, no)
178 if test "$ASN1PARSER" = "no" ; then
179         AC_MSG_ERROR([asn1Parser tool is not installed, try libtasn1 or a related package])
180 fi
181
182 # ----------------------------------------------------------------------
183 # mime-database
184
185 AC_ARG_ENABLE(update-mime,
186         AC_HELP_STRING([--disable-update-mime],
187         [don't run update-mime-database utility (useful for packages) ]))
188 AM_CONDITIONAL(WITH_UPDATE_MIME, test "$enable_update_mime" != "no")
189
190 AC_ARG_ENABLE(update-icon-cache,
191         AC_HELP_STRING([--disable-update-icon-cache],
192         [don't run gtk-update-icon-cache utility (useful for packages) ]))
193 AM_CONDITIONAL(WITH_UPDATE_ICON_CACHE, test "$enable_update_icon_cache" != "no")
194
195 # ----------------------------------------------------------------------
196 # DBus services
197
198 AC_ARG_WITH(dbus-services,
199                   [AC_HELP_STRING([--with-dbus-services=<dir>],
200                   [where D-BUS session services directory is])])
201 if ! test -z "$with_dbus_services" ; then
202         DBUS_SERVICES_DIR="$with_dbus_services"
203 else
204         DBUS_SERVICES_DIR="$datadir/dbus-1/services"
205 fi
206
207 AC_SUBST(DBUS_SERVICES_DIR)
208
209 # --------------------------------------------------------------------
210 # Compilation and linking options
211 #
212
213 AC_MSG_CHECKING([for debug mode])
214 AC_ARG_ENABLE(debug,
215               AC_HELP_STRING([--enable-debug=no/default/yes],
216               [Turn on or off debugging]))
217
218 if test "$enable_debug" != "no"; then
219         AC_DEFINE_UNQUOTED(WITH_DEBUG, 1, [Print debug output])
220         AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
221         CFLAGS="$CFLAGS -g"
222 fi
223
224 if test "$enable_debug" = "yes"; then
225         debug_status="yes (-g, -O0, debug output, testable)"
226         AC_DEFINE_UNQUOTED(GCR_DISABLE_GRABS, 1, [Disable grabs])
227         CFLAGS="$CFLAGS -O0"
228 elif test "$enable_debug" = "no"; then
229         debug_status="no (no debug output, not testable, G_DISABLE_ASSERT)"
230         AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
231 else
232         debug_status="default (-g, debug output, testable)"
233 fi
234
235 AC_MSG_RESULT($debug_status)
236
237 AC_MSG_CHECKING(for more warnings)
238 if test "$GCC" = "yes"; then
239         AC_MSG_RESULT(yes)
240         CFLAGS="\
241         -Wall \
242         -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
243         -Wnested-externs -Wpointer-arith \
244         -Wcast-align -Wsign-compare \
245         $CFLAGS"
246
247         # Disable -Werror for now, because of issues with
248         # strange gtk-doc programs not building cleanly.
249         # -Werror \
250
251         for option in -Wno-strict-aliasing -Wno-sign-compare; do
252                 SAVE_CFLAGS="$CFLAGS"
253                 CFLAGS="$CFLAGS $option"
254                 AC_MSG_CHECKING([whether gcc understands $option])
255                 AC_TRY_COMPILE([], [],
256                         has_option=yes,
257                         has_option=no,)
258                 if test $has_option = no; then
259                         CFLAGS="$SAVE_CFLAGS"
260                 fi
261                 AC_MSG_RESULT($has_option)
262                 unset has_option
263                 unset SAVE_CFLAGS
264         done
265         unset option
266 else
267         AC_MSG_RESULT(no)
268 fi
269
270 AC_ARG_ENABLE(strict, [
271                AS_HELP_STRING([--enable-strict], [Strict code compilation])
272              ])
273
274 AC_MSG_CHECKING([build strict])
275
276 if test "$enable_strict" = "yes"; then
277         CFLAGS="$CFLAGS -Werror \
278                 -DGTK_DISABLE_DEPRECATED \
279                 -DGDK_DISABLE_DEPRECATED \
280                 -DG_DISABLE_DEPRECATED \
281                 -DGDK_PIXBUF_DISABLE_DEPRECATED"
282         TEST_MODE="thorough"
283         INTROSPECTION_FLAGS="--warn-error"
284         AC_DEFINE_UNQUOTED(WITH_STRICT, 1, [More strict checks])
285         strict_status="yes (-Werror, thorough tests, fatals, no deprecations)"
286 else
287         TEST_MODE="quick"
288         INTROSPECTION_FLAGS=""
289         strict_status="no (quick tests, non-fatal warnings)"
290 fi
291
292 AC_MSG_RESULT($strict_status)
293 AC_SUBST(INTROSPECTION_FLAGS)
294 AC_SUBST(TEST_MODE)
295
296 AC_MSG_RESULT([$enable_coverage])
297
298 AC_MSG_CHECKING([code coverage])
299
300 if test "$enable_coverage" = "yes"; then
301         if test "$GCC" != "yes"; then
302                 AC_MSG_ERROR(Coverage testing requires GCC)
303         fi
304
305         AC_PATH_PROG(GCOV, gcov, no)
306         if test "$GCOV" = "no" ; then
307                 AC_MSG_ERROR(gcov tool is not available)
308         fi
309
310         CFLAGS="$CFLAGS -O0 -g --coverage"
311         LDFLAGS="$LDFLAGS --coverage"
312 fi
313
314 AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
315
316 AC_MSG_RESULT($enable_coverage)
317
318 AC_ARG_ENABLE(valgrind,
319         AC_HELP_STRING([--enable-valgrind],
320         [Run gnome-keyring-daemon using valgrind]))
321
322 AC_MSG_CHECKING([valgrind])
323 valgrind_status="yes"
324
325 AM_CONDITIONAL(WITH_VALGRIND, test "$enable_valgrind" = "run")
326
327 # Run gnome-keyring-daemon under valgrind as default
328 if test "$enable_valgrind" = "run"; then
329         AC_PATH_PROG(VALGRIND, valgrind, no)
330         if test "$VALGRIND" = "no" ; then
331                 AC_MSG_ERROR(valgrind tool is not installed)
332         fi
333
334         VALGRIND_ARG="--log-file=/tmp/gkr-valgrind.log.%p"
335         VALGRIND_RUN="$VALGRIND $VALGRIND_ARG "
336
337         AC_DEFINE_UNQUOTED(VALGRIND, "$VALGRIND", [Path to valgrind executable])
338         AC_DEFINE_UNQUOTED(VALGRIND_ARG, "$VALGRIND_ARG", [Valgrind arguments])
339
340         enable_valgrind="yes"
341         valgrind_status="run"
342 fi
343
344 AC_SUBST(VALGRIND)
345 AC_SUBST(VALGRIND_ARG)
346 AC_SUBST(VALGRIND_RUN)
347
348 # Build valgrind support into code
349 if test "$enable_valgrind" = "yes"; then
350         AC_CHECK_HEADER([valgrind/valgrind.h], have_valgrind=yes, have_valgrind=no)
351         if test "$have_valgrind" = "no"; then
352                 AC_MSG_ERROR(The valgrind headers are missing)
353         fi
354         AC_DEFINE_UNQUOTED(WITH_VALGRIND, 1, [Run under valgrind])
355         AC_MSG_RESULT(yes)
356
357
358 # No valgrind
359 else
360         AC_MSG_RESULT(no)
361         valgrind_status="no"
362 fi
363
364 # ----------------------------------------------------------------------
365
366 GCK_LT_RELEASE=$GCK_CURRENT:$GCK_REVISION:$GCK_AGE
367 AC_SUBST(GCK_LT_RELEASE)
368 AC_SUBST(GCK_MAJOR)
369 AC_SUBST(GCK_MINOR)
370
371 GCR_LT_RELEASE=$GCR_CURRENT:$GCR_REVISION:$GCR_AGE
372 AC_SUBST(GCR_CURRENT)
373 AC_SUBST(GCR_LT_RELEASE)
374 AC_SUBST(GCR_MAJOR)
375 AC_SUBST(GCR_MINOR)
376
377 AC_OUTPUT([
378 Makefile
379 build/Makefile
380 docs/Makefile
381 docs/reference/Makefile
382 docs/reference/gck/Makefile
383 docs/reference/gck/version.xml
384 docs/reference/gcr/Makefile
385 docs/reference/gcr/version.xml
386 egg/Makefile
387 egg/tests/Makefile
388 gck/gck.pc
389 gck/Makefile
390 gck/tests/Makefile
391 gcr/gcr-base.pc
392 gcr/Makefile
393 gcr/tests/Makefile
394 po/Makefile.in
395 schema/Makefile
396 testing/Makefile
397 ui/gcr.pc
398 ui/gcr-ui.pc
399 ui/icons/Makefile
400 ui/icons/16x16/Makefile
401 ui/icons/22x22/Makefile
402 ui/icons/24x24/Makefile
403 ui/icons/32x32/Makefile
404 ui/icons/48x48/Makefile
405 ui/icons/256x256/Makefile
406 ui/Makefile
407 ui/tests/Makefile
408 ])
409
410 # ------------------------------------------------------------------------------
411 # Summary
412 #
413
414 echo
415 echo "BUILD"
416 echo "  Debug Build:          $debug_status"
417 echo "  Strict Compilation:   $strict_status"
418 echo "  GTK+ Widgets:         $with_gtk"
419 echo "  Introspection:        $found_introspection"
420 echo "  Valgrind:             $valgrind_status"
421 echo "  Test Coverage:        ${enable_coverage:-no}"
422 echo