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