Release version 0.15
[platform/upstream/libsecret.git] / configure.ac
1 AC_PREREQ(2.63)
2
3 AC_INIT([libsecret],[0.15],
4         [http://bugzilla.gnome.org/enter_bug.cgi?product=libsecret],
5         [libsecret])
6
7 dnl ****************************************************************************
8 dnl Library package and libtool versioning
9 dnl
10 dnl Updating the libtool versions, follow these instructions sequentially:
11 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’).
12 dnl  2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
13 dnl  3. If any interfaces have been added since the last public release, then increment age.
14 dnl  4. If any interfaces have been removed or changed since the last public release, then set age to 0.
15
16 SECRET_MAJOR=1
17 SECRET_MINOR=0
18 SECRET_MICRO=0
19
20 SECRET_CURRENT=0
21 SECRET_REVISION=0
22 SECRET_AGE=0
23
24 # -----------------------------------------------------------------------------
25
26 AC_CONFIG_MACRO_DIR([build/m4])
27 AM_INIT_AUTOMAKE([1.11 tar-ustar foreign -Wno-portability])
28 AM_SANITY_CHECK
29 AC_CONFIG_HEADERS(config.h)
30 AC_CONFIG_SRCDIR([libsecret/secret-value.c])
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
32 AM_MAINTAINER_MODE([enable])
33
34 # -----------------------------------------------------------------------------
35 # Basic tools
36
37 AC_GNU_SOURCE
38 AC_ISC_POSIX
39 AC_PROG_CC
40 AC_PROG_CPP
41 AM_PROG_CC_C_O
42 AC_PROG_INSTALL
43 AC_PROG_LN_S
44 AC_PROG_MAKE_SET
45 AM_PROG_LIBTOOL
46 IT_PROG_INTLTOOL([0.35.0])
47 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
48
49 GETTEXT_PACKAGE=libsecret
50 AC_SUBST([GETTEXT_PACKAGE])
51 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
52 AM_GLIB_GNU_GETTEXT
53
54 # --------------------------------------------------------------------
55 # Checks for functions
56
57 AC_CHECK_FUNCS(mlock)
58
59 # --------------------------------------------------------------------
60 # GLib
61
62 PKG_CHECK_MODULES(GLIB,
63         glib-2.0 >= 2.32.0
64         gio-2.0 >= 2.32.0
65         gio-unix-2.0)
66 LIBS="$LIBS $GLIB_LIBS"
67 CFLAGS="$CFLAGS $GLIB_CFLAGS"
68
69 GTK_DOC_CHECK(1.9)
70
71 GOBJECT_INTROSPECTION_CHECK([1.29])
72 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
73
74 # --------------------------------------------------------------------
75 # Manual pages
76
77 AC_ARG_ENABLE(manpages,
78               AC_HELP_STRING([--disable-man-pages], [Build manual pages]))
79 if test "$enable_manpages" != "no"; then
80         enable_manpages="yes"
81         AC_PATH_PROG([XSLTPROC], [xsltproc])
82         if test x$XSLTPROC = x; then
83                 AC_MSG_ERROR([xsltproc is required to build manual pages])
84         fi
85 fi
86 AM_CONDITIONAL(WITH_MANPAGES, test x$enable_manpages = xyes)
87
88 # --------------------------------------------------------------------
89 # Vala
90
91 VALA_REQUIRED=0.17.2.12
92
93 VAPIGEN_CHECK($VALA_REQUIRED)
94
95 if test "$enable_vala" != "no"; then
96         AC_PATH_PROG([VALAC], [valac], [])
97 fi
98 AM_CONDITIONAL(HAVE_VALAC, test "x$VALAC" != "x")
99
100 # --------------------------------------------------------------------
101 # libgcrypt
102
103 GCRYPT_VERSION=1.2.2
104 GCRYPT_LIBVER=1
105
106 AC_ARG_ENABLE(gcrypt,
107               [AC_HELP_STRING([--disable-gcrypt],
108                               [without gcrypt and transport encryption])
109               ])
110
111 if test "$enable_gcrypt" != "no"; then
112
113         have_gcrypt="no"
114         m4_ifdef([AM_PATH_LIBGCRYPT],
115                  [AM_PATH_LIBGCRYPT($GCRYPT_LIBVER:$GCRYPT_VERSION, have_gcrypt=yes)])
116
117         if test $have_gcrypt != "yes"; then
118                 AC_MSG_ERROR([[
119 ***
120 *** libgcrypt was not found. You may want to get it from
121 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
122 ***
123                 ]])
124         fi
125
126         AC_DEFINE(WITH_GCRYPT, 1, [Build with libgcypt and transport encryption])
127         AC_DEFINE_UNQUOTED(LIBGCRYPT_VERSION, "$GCRYPT_VERSION",
128                            [Version of GCRYPT we expect])
129
130         AC_SUBST([LIBGCRYPT_CFLAGS])
131         AC_SUBST([LIBGCRYPT_LIBS])
132
133         gcrypt_status=$GCRYPT_VERSION
134         enable_gcrypt="yes"
135 else
136         gcrypt_status="no"
137 fi
138
139 AM_CONDITIONAL(WITH_GCRYPT, test "$enable_gcrypt" = "yes")
140
141 # --------------------------------------------------------------------
142 # Compilation options
143
144 if test "$GCC" = "yes"; then
145         CFLAGS="$CFLAGS \
146                 -Wall -Wmissing-declarations \
147                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
148                 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
149                 -Waggregate-return"
150
151         for option in -Wmissing-include-dirs -Wundef; do
152                 SAVE_CFLAGS="$CFLAGS"
153                 CFLAGS="$CFLAGS $option"
154                 AC_MSG_CHECKING([whether gcc understands $option])
155                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
156                                   [has_option=yes],
157                                   [has_option=no])
158                 AC_MSG_RESULT($has_option)
159                 if test $has_option = no; then
160                         CFLAGS="$SAVE_CFLAGS"
161                 fi
162         done
163 fi
164
165 AC_ARG_ENABLE(strict, [
166                AS_HELP_STRING([--enable-strict], [Strict code compilation])
167              ])
168
169 AC_MSG_CHECKING([build strict])
170
171 if test "$enable_strict" = "yes"; then
172         CFLAGS="$CFLAGS -Werror \
173                 -DGTK_DISABLE_DEPRECATED \
174                 -DGDK_DISABLE_DEPRECATED \
175                 -DG_DISABLE_DEPRECATED \
176                 -DGDK_PIXBUF_DISABLE_DEPRECATED"
177         INTROSPECTION_FLAGS="--warn-error"
178         TEST_MODE="thorough"
179 else
180         CFLAGS="$CFLAGS -Wno-error"
181         TEST_MODE="quick"
182         INTROSPECTION_FLAGS=""
183         enable_strict="no"
184 fi
185
186 AC_MSG_RESULT($enable_strict)
187 AC_SUBST(INTROSPECTION_FLAGS)
188 AC_SUBST(TEST_MODE)
189
190 AC_MSG_CHECKING([for debug mode])
191 AC_ARG_ENABLE(debug,
192               AC_HELP_STRING([--enable-debug=no/default/yes],
193                              [Turn on or off debugging])
194              )
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 if test "$enable_debug" = "yes"; then
202         debug_status="yes"
203         CFLAGS="$CFLAGS -O0"
204 elif test "$enable_debug" = "no"; then
205         debug_status="no"
206         CFLAGS="$CFLAGS -O2"
207         AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
208 else
209         debug_status="default"
210 fi
211
212 AC_MSG_RESULT($debug_status)
213
214 AC_MSG_CHECKING([whether to build with gcov testing])
215 AC_ARG_ENABLE([coverage],
216               AS_HELP_STRING([--enable-coverage],
217                              [Whether to enable coverage testing ]),
218               [], [enable_coverage=no])
219 AC_MSG_RESULT([$enable_coverage])
220
221 if test "$enable_coverage" = "yes"; then
222         if test "$GCC" != "yes"; then
223                 AC_MSG_ERROR(Coverage testing requires GCC)
224         fi
225
226         AC_PATH_PROG(GCOV, gcov, no)
227         if test "$GCOV" = "no" ; then
228                 AC_MSG_ERROR(gcov tool is not available)
229         fi
230
231         AC_PATH_PROG(LCOV, lcov, no)
232         if test "$LCOV" = "no" ; then
233                 AC_MSG_ERROR(lcov tool is not installed)
234         fi
235
236         AC_PATH_PROG(GENHTML, genhtml, no)
237         if test "$GENHTML" = "no" ; then
238                 AC_MSG_ERROR(lcov's genhtml tool is not installed)
239         fi
240
241         CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
242         LDFLAGS="$LDFLAGS -lgcov"
243 fi
244
245 AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
246 AC_SUBST(LCOV)
247 AC_SUBST(GCOV)
248 AC_SUBST(GENHTML)
249
250 # ------------------------------------------------------------------------------
251 # Results
252 #
253
254 SECRET_LT_RELEASE=$SECRET_CURRENT:$SECRET_REVISION:$SECRET_AGE
255 AC_SUBST(SECRET_LT_RELEASE)
256 AC_SUBST(SECRET_MAJOR)
257 AC_SUBST(SECRET_MINOR)
258
259 AC_CONFIG_FILES([
260         Makefile
261         build/Makefile
262         docs/Makefile
263         docs/man/Makefile
264         docs/reference/Makefile
265         docs/reference/libsecret/Makefile
266         docs/reference/libsecret/version.xml
267         docs/reference/libsecret/version-major.xml
268         egg/Makefile
269         egg/tests/Makefile
270         po/Makefile.in
271         po/Makefile
272         libsecret/Makefile
273         libsecret/libsecret.pc
274         libsecret/libsecret-unstable.pc
275         libsecret/tests/Makefile
276         tool/Makefile
277 ])
278 AC_OUTPUT
279
280 echo
281 echo "CFLAGS: $CFLAGS"
282 echo
283 echo "OPTIONS:"
284 echo "  libgcrypt:     $gcrypt_status"
285 echo "  vala:          $enable_vala"
286 echo "  Debug:         $debug_status"
287 echo "  Coverage:      $enable_coverage"
288 echo "  Manual Page:   $enable_manpages"
289 echo