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