Bump the version number
[platform/upstream/libsecret.git] / configure.ac
1 AC_PREREQ(2.63)
2
3 AC_INIT([libsecret],[0.4],
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=0
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 AM_CONFIG_HEADER(config.h)
30 AC_CONFIG_SRCDIR([library/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.31.0
64         gio-2.0 >= 2.31.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 # libgcrypt
76
77 GCRYPT_VERSION=1.2.2
78 GCRYPT_LIBVER=1
79
80 AC_ARG_ENABLE(gcrypt,
81               [AC_HELP_STRING([--disable-gcrypt],
82                               [without gcrypt and transport encryption])
83               ])
84
85 if test "$enable_gcrypt" != "no"; then
86         AM_PATH_LIBGCRYPT($GCRYPT_LIBVER:$GCRYPT_VERSION,,
87                           AC_MSG_ERROR([[
88 ***
89 *** libgcrypt was not found. You may want to get it from
90 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
91 ***
92                           ]]))
93
94         AC_DEFINE(WITH_GCRYPT, 1, [Build with libgcypt and transport encryption])
95         AC_DEFINE_UNQUOTED(LIBGCRYPT_VERSION, "$GCRYPT_VERSION",
96                            [Version of GCRYPT we expect])
97
98         AC_SUBST([LIBGCRYPT_CFLAGS])
99         AC_SUBST([LIBGCRYPT_LIBS])
100
101         gcrypt_status=$GCRYPT_VERSION
102         enable_gcrypt="yes"
103 else
104         gcrypt_status="no"
105 fi
106
107 AM_CONDITIONAL(WITH_GCRYPT, test "$enable_gcrypt" = "yes")
108
109 # --------------------------------------------------------------------
110 # Compilation options
111
112 if test "$GCC" = "yes"; then
113         CFLAGS="$CFLAGS \
114                 -Wall -Wmissing-declarations \
115                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
116                 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
117                 -Waggregate-return -Wmissing-format-attribute"
118
119         for option in -Wmissing-include-dirs -Wundef; do
120                 SAVE_CFLAGS="$CFLAGS"
121                 CFLAGS="$CFLAGS $option"
122                 AC_MSG_CHECKING([whether gcc understands $option])
123                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
124                                   [has_option=yes],
125                                   [has_option=no])
126                 AC_MSG_RESULT($has_option)
127                 if test $has_option = no; then
128                         CFLAGS="$SAVE_CFLAGS"
129                 fi
130         done
131 fi
132
133 AC_ARG_ENABLE(strict, [
134                AS_HELP_STRING([--enable-strict], [Strict code compilation])
135              ])
136
137 AC_MSG_CHECKING([build strict])
138
139 if test "$enable_strict" = "yes"; then
140         CFLAGS="$CFLAGS -Werror \
141                 -DGTK_DISABLE_DEPRECATED \
142                 -DGDK_DISABLE_DEPRECATED \
143                 -DG_DISABLE_DEPRECATED \
144                 -DGDK_PIXBUF_DISABLE_DEPRECATED"
145         INTROSPECTION_FLAGS="--warn-error"
146         TEST_MODE="thorough"
147 else
148         CFLAGS="$CFLAGS -Wno-error"
149         TEST_MODE="quick"
150         INTROSPECTION_FLAGS=""
151         enable_strict="no"
152 fi
153
154 AC_MSG_RESULT($enable_strict)
155 AC_SUBST(INTROSPECTION_FLAGS)
156 AC_SUBST(TEST_MODE)
157
158 AC_MSG_CHECKING([for debug mode])
159 AC_ARG_ENABLE(debug,
160               AC_HELP_STRING([--enable-debug=no/default/yes],
161                              [Turn on or off debugging])
162              )
163
164 if test "$enable_debug" != "no"; then
165         AC_DEFINE_UNQUOTED(WITH_DEBUG, 1, [Print debug output])
166         AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
167         CFLAGS="$CFLAGS -g"
168 fi
169 if test "$enable_debug" = "yes"; then
170         debug_status="yes"
171         CFLAGS="$CFLAGS -O0"
172 elif test "$enable_debug" = "no"; then
173         debug_status="no"
174         CFLAGS="$CFLAGS -O2"
175         AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
176 else
177         debug_status="default"
178 fi
179
180 AC_MSG_RESULT($debug_status)
181
182 AC_MSG_CHECKING([whether to build with gcov testing])
183 AC_ARG_ENABLE([coverage],
184               AS_HELP_STRING([--enable-coverage],
185                              [Whether to enable coverage testing ]),
186               [], [enable_coverage=no])
187 AC_MSG_RESULT([$enable_coverage])
188
189 if test "$enable_coverage" = "yes"; then
190         if test "$GCC" != "yes"; then
191                 AC_MSG_ERROR(Coverage testing requires GCC)
192         fi
193
194         AC_PATH_PROG(GCOV, gcov, no)
195         if test "$GCOV" = "no" ; then
196                 AC_MSG_ERROR(gcov tool is not available)
197         fi
198
199         AC_PATH_PROG(LCOV, lcov, no)
200         if test "$LCOV" = "no" ; then
201                 AC_MSG_ERROR(lcov tool is not installed)
202         fi
203
204         AC_PATH_PROG(GENHTML, genhtml, no)
205         if test "$GENHTML" = "no" ; then
206                 AC_MSG_ERROR(lcov's genhtml tool is not installed)
207         fi
208
209         CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
210         LDFLAGS="$LDFLAGS -lgcov"
211 fi
212
213 AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
214 AC_SUBST(LCOV)
215 AC_SUBST(GCOV)
216 AC_SUBST(GENHTML)
217
218 # ------------------------------------------------------------------------------
219 # Results
220 #
221
222 SECRET_LT_RELEASE=$SECRET_CURRENT:$SECRET_REVISION:$SECRET_AGE
223 AC_SUBST(SECRET_LT_RELEASE)
224 AC_SUBST(SECRET_MAJOR)
225 AC_SUBST(SECRET_MINOR)
226
227 AC_CONFIG_FILES([
228         Makefile
229         build/Makefile
230         docs/Makefile
231         docs/reference/Makefile
232         docs/reference/libsecret/Makefile
233         docs/reference/libsecret/version.xml
234         egg/Makefile
235         egg/tests/Makefile
236         po/Makefile.in
237         po/Makefile
238         library/Makefile
239         library/libsecret.pc
240         library/tests/Makefile
241         tool/Makefile
242 ])
243 AC_OUTPUT
244
245 echo
246 echo "CFLAGS: $CFLAGS"
247 echo
248 echo "OPTIONS:"
249 echo "  libgcrypt:            $gcrypt_status"
250 echo "  Debug:                $debug_status"
251 echo "  Coverage:             $enable_coverage"
252 echo