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