configure.ac 6.83 KB
Newer Older
Stef Walter's avatar
Stef Walter committed
1
AC_PREREQ(2.63)
2

Stef Walter's avatar
Stef Walter committed
3
AC_INIT([libsecret],[0.8],
Stef Walter's avatar
Stef Walter committed
4
5
        [http://bugzilla.gnome.org/enter_bug.cgi?product=libsecret],
        [libsecret])
6

7
8
9
10
11
12
13
14
15
dnl ****************************************************************************
dnl Library package and libtool versioning
dnl
dnl Updating the libtool versions, follow these instructions sequentially:
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’).
dnl  2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
dnl  3. If any interfaces have been added since the last public release, then increment age.
dnl  4. If any interfaces have been removed or changed since the last public release, then set age to 0.

16
SECRET_MAJOR=1
17
18
19
20
21
22
23
SECRET_MINOR=0
SECRET_MICRO=0

SECRET_CURRENT=0
SECRET_REVISION=0
SECRET_AGE=0

Stef Walter's avatar
Stef Walter committed
24
# -----------------------------------------------------------------------------
25

Stef Walter's avatar
Stef Walter committed
26
27
28
29
AC_CONFIG_MACRO_DIR([build/m4])
AM_INIT_AUTOMAKE([1.11 tar-ustar foreign -Wno-portability])
AM_SANITY_CHECK
AM_CONFIG_HEADER(config.h)
30
AC_CONFIG_SRCDIR([libsecret/secret-value.c])
Stef Walter's avatar
Stef Walter committed
31
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
32
33
AM_MAINTAINER_MODE([enable])

Stef Walter's avatar
Stef Walter committed
34
35
36
37
38
# -----------------------------------------------------------------------------
# Basic tools

AC_GNU_SOURCE
AC_ISC_POSIX
39
40
41
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
Stef Walter's avatar
Stef Walter committed
42
43
44
45
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
46
IT_PROG_INTLTOOL([0.35.0])
Stef Walter's avatar
Stef Walter committed
47
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
48

Stef Walter's avatar
Stef Walter committed
49
GETTEXT_PACKAGE=libsecret
50
51
52
53
AC_SUBST([GETTEXT_PACKAGE])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
AM_GLIB_GNU_GETTEXT

Stef Walter's avatar
Stef Walter committed
54
55
56
57
58
# --------------------------------------------------------------------
# Checks for functions

AC_CHECK_FUNCS(mlock)

Stef Walter's avatar
Stef Walter committed
59
60
# --------------------------------------------------------------------
# GLib
61

62
PKG_CHECK_MODULES(GLIB,
63
64
	glib-2.0 >= 2.31.0
	gio-2.0 >= 2.31.0
65
	gio-unix-2.0)
66
67
68
LIBS="$LIBS $GLIB_LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"

Stef Walter's avatar
Stef Walter committed
69
70
GTK_DOC_CHECK(1.9)

71
GOBJECT_INTROSPECTION_CHECK([1.29])
72
73
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)

Evan Nemerson's avatar
Evan Nemerson committed
74
75
76
77
78
79
80
81
82
83
84
85
# --------------------------------------------------------------------
# Vala

VALA_REQUIRED=0.17.2.12

VAPIGEN_CHECK($VALA_REQUIRED)

if test "$enable_vala" != "no"; then
	AC_PATH_PROG([VALAC], [valac], [])
fi
AM_CONDITIONAL(HAVE_VALAC, test "x$VALAC" != "x")

Stef Walter's avatar
Stef Walter committed
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# --------------------------------------------------------------------
# libgcrypt

GCRYPT_VERSION=1.2.2
GCRYPT_LIBVER=1

AC_ARG_ENABLE(gcrypt,
              [AC_HELP_STRING([--disable-gcrypt],
                              [without gcrypt and transport encryption])
              ])

if test "$enable_gcrypt" != "no"; then
	AM_PATH_LIBGCRYPT($GCRYPT_LIBVER:$GCRYPT_VERSION,,
	                  AC_MSG_ERROR([[
***
*** libgcrypt was not found. You may want to get it from
*** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
***
	                  ]]))

	AC_DEFINE(WITH_GCRYPT, 1, [Build with libgcypt and transport encryption])
	AC_DEFINE_UNQUOTED(LIBGCRYPT_VERSION, "$GCRYPT_VERSION",
	                   [Version of GCRYPT we expect])

	AC_SUBST([LIBGCRYPT_CFLAGS])
	AC_SUBST([LIBGCRYPT_LIBS])

113
114
115
116
	gcrypt_status=$GCRYPT_VERSION
	enable_gcrypt="yes"
else
	gcrypt_status="no"
Stef Walter's avatar
Stef Walter committed
117
118
119
120
fi

AM_CONDITIONAL(WITH_GCRYPT, test "$enable_gcrypt" = "yes")

121
122
# --------------------------------------------------------------------
# Compilation options
123

Stef Walter's avatar
Stef Walter committed
124
if test "$GCC" = "yes"; then
125
	CFLAGS="$CFLAGS \
Stef Walter's avatar
Stef Walter committed
126
		-Wall -Wmissing-declarations \
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
		-Wdeclaration-after-statement -Wformat=2 -Winit-self \
		-Waggregate-return -Wmissing-format-attribute"

	for option in -Wmissing-include-dirs -Wundef; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
				  [has_option=yes],
				  [has_option=no])
		AC_MSG_RESULT($has_option)
		if test $has_option = no; then
			CFLAGS="$SAVE_CFLAGS"
		fi
	done
fi

Stef Walter's avatar
Stef Walter committed
145
146
147
148
AC_ARG_ENABLE(strict, [
               AS_HELP_STRING([--enable-strict], [Strict code compilation])
             ])

149
150
AC_MSG_CHECKING([build strict])

Stef Walter's avatar
Stef Walter committed
151
152
153
154
if test "$enable_strict" = "yes"; then
	CFLAGS="$CFLAGS -Werror \
		-DGTK_DISABLE_DEPRECATED \
		-DGDK_DISABLE_DEPRECATED \
155
156
		-DG_DISABLE_DEPRECATED \
		-DGDK_PIXBUF_DISABLE_DEPRECATED"
157
	INTROSPECTION_FLAGS="--warn-error"
158
	TEST_MODE="thorough"
Stef Walter's avatar
Stef Walter committed
159
160
else
	CFLAGS="$CFLAGS -Wno-error"
161
	TEST_MODE="quick"
162
	INTROSPECTION_FLAGS=""
Kalev Lember's avatar
Kalev Lember committed
163
	enable_strict="no"
164
165
166
fi

AC_MSG_RESULT($enable_strict)
167
AC_SUBST(INTROSPECTION_FLAGS)
168
169
170
171
172
173
174
175
176
177
178
179
AC_SUBST(TEST_MODE)

AC_MSG_CHECKING([for debug mode])
AC_ARG_ENABLE(debug,
              AC_HELP_STRING([--enable-debug=no/default/yes],
                             [Turn on or off debugging])
             )

if test "$enable_debug" != "no"; then
	AC_DEFINE_UNQUOTED(WITH_DEBUG, 1, [Print debug output])
	AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
	CFLAGS="$CFLAGS -g"
Stef Walter's avatar
Stef Walter committed
180
fi
181
182
183
184
185
if test "$enable_debug" = "yes"; then
	debug_status="yes"
	CFLAGS="$CFLAGS -O0"
elif test "$enable_debug" = "no"; then
	debug_status="no"
Stef Walter's avatar
Stef Walter committed
186
	CFLAGS="$CFLAGS -O2"
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
	AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
else
	debug_status="default"
fi

AC_MSG_RESULT($debug_status)

AC_MSG_CHECKING([whether to build with gcov testing])
AC_ARG_ENABLE([coverage],
              AS_HELP_STRING([--enable-coverage],
                             [Whether to enable coverage testing ]),
              [], [enable_coverage=no])
AC_MSG_RESULT([$enable_coverage])

if test "$enable_coverage" = "yes"; then
	if test "$GCC" != "yes"; then
		AC_MSG_ERROR(Coverage testing requires GCC)
	fi

	AC_PATH_PROG(GCOV, gcov, no)
	if test "$GCOV" = "no" ; then
		AC_MSG_ERROR(gcov tool is not available)
	fi

	AC_PATH_PROG(LCOV, lcov, no)
	if test "$LCOV" = "no" ; then
		AC_MSG_ERROR(lcov tool is not installed)
	fi

	AC_PATH_PROG(GENHTML, genhtml, no)
	if test "$GENHTML" = "no" ; then
		AC_MSG_ERROR(lcov's genhtml tool is not installed)
	fi

	CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
	LDFLAGS="$LDFLAGS -lgcov"
fi

AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
AC_SUBST(LCOV)
AC_SUBST(GCOV)
AC_SUBST(GENHTML)

# ------------------------------------------------------------------------------
# Results
#
Stef Walter's avatar
Stef Walter committed
233

234
235
236
237
238
SECRET_LT_RELEASE=$SECRET_CURRENT:$SECRET_REVISION:$SECRET_AGE
AC_SUBST(SECRET_LT_RELEASE)
AC_SUBST(SECRET_MAJOR)
AC_SUBST(SECRET_MINOR)

239
240
AC_CONFIG_FILES([
	Makefile
241
	build/Makefile
Stef Walter's avatar
Stef Walter committed
242
243
244
245
	docs/Makefile
	docs/reference/Makefile
	docs/reference/libsecret/Makefile
	docs/reference/libsecret/version.xml
246
	docs/reference/libsecret/version-major.xml
247
	egg/Makefile
248
	egg/tests/Makefile
249
250
	po/Makefile.in
	po/Makefile
251
252
	libsecret/Makefile
	libsecret/libsecret.pc
253
	libsecret/libsecret-unstable.pc
254
	libsecret/tests/Makefile
Stef Walter's avatar
Stef Walter committed
255
	tool/Makefile
256
])
257
AC_OUTPUT
Stef Walter's avatar
Stef Walter committed
258
259
260
261
262

echo
echo "CFLAGS: $CFLAGS"
echo
echo "OPTIONS:"
263
264
265
echo "  libgcrypt:            $gcrypt_status"
echo "  Debug:                $debug_status"
echo "  Coverage:             $enable_coverage"
Stef Walter's avatar
Stef Walter committed
266
echo