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