Debian Codegraph @

configure.ac

raw
1 # configure.ac - Configure script for Poldi
2 # Copyright (C) 2004, 2005, 2007, 2008, 2009 g10 Code GmbH
3 #
4 # This file is part of Poldi.
5 #
6 # Poldi is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # Poldi is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 # License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA
20
21 # Process this file with autoconf to produce a configure script.
22 AC_PREREQ([2.52])
23 min_automake_version="1.7.9"
24
25 # Version number: Remember to change it immediately *after* a release.
26 # Add a ".git" postfix for non-released code.
27 AC_INIT([poldi],[0.4.2.git],[[email protected]])
28 AC_CONFIG_SRCDIR(src/pam/pam_poldi.c)
29 AC_CONFIG_HEADERS(config.h)
30 AC_CANONICAL_TARGET
31 AM_INIT_AUTOMAKE
32
33 NEED_LIBGCRYPT_VERSION=0
34 NEED_GPG_ERROR_VERSION=0.7
35
36 NEED_KSBA_API=1
37 NEED_KSBA_VERSION=1.0.2
38
39 POLDI_CONF_DIRECTORY="${sysconfdir}/poldi"
40 AC_SUBST(POLDI_CONF_DIRECTORY)
41
42 # Implementation of the --with-pam-module-directory switch.
43 DEFAULT_PAM_MODULE_DIRECTORY="${libdir}/security"
44 AC_ARG_WITH(pam-module-directory,
45 [ --with-pam-module-directory=NAME
46 Use NAME as installation directory for PAM modules ],
47 PAM_MODULE_DIRECTORY="$withval",
48 PAM_MODULE_DIRECTORY="$DEFAULT_PAM_MODULE_DIRECTORY")
49 AC_SUBST(PAM_MODULE_DIRECTORY)
50
51 AC_USE_SYSTEM_EXTENSIONS
52
53 have_gpg_error=no
54 have_libgcrypt=no
55 have_ksba=no
56
57 POLDI_ENABLE_FEATURE(enable_auth_x509, yes, x509-auth, support for X509 authentication)
58 POLDI_ENABLE_FEATURE(enable_auth_localdb, yes, localdb-auth, support for local-db authentication)
59 AC_SUBST(PACKAGE)
60 AC_SUBST(VERSION)
61 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
62 [Bug report address])
63 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
64 [Required version of Libgcrypt])
65 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
66 [Required version of Libksba])
67
68
69 AH_BOTTOM([
70 /* Setup the hardwired names of modules. */
71 #ifndef GNUPG_DEFAULT_GPGCONF
72 #define GNUPG_DEFAULT_GPGCONF GNUPG_BINDIR "/gpgconf"
73 #endif
74 #ifndef GNUPG_DEFAULT_SCD
75 #define GNUPG_DEFAULT_SCD GNUPG_LIBEXECDIR "/scdaemon"
76 #endif
77 ])
78
79 AM_MAINTAINER_MODE
80
81 # Checks for programs.
82 AC_PROG_MAKE_SET
83 AM_SANITY_CHECK
84 missing_dir=`cd $ac_aux_dir && pwd`
85 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
86 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
87 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
88 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
89 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
90 AC_PROG_AWK
91 AC_PROG_CC
92 AM_PROG_CC_C_O
93 AC_PROG_CPP
94 AC_PROG_RANLIB
95 AC_PROG_INSTALL
96 AC_PROG_MAKE_SET
97 AC_SYS_LARGEFILE
98
99 #
100 # Checks for libraries.
101 #
102
103 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_VERSION",
104 have_libgcrypt=yes,have_libgcrypt=no)
105 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
106 have_gpg_error=yes,have_gpg_error=no)
107 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
108
109 AC_CHECK_FUNCS(stpcpy strtoul)
110 AC_CHECK_FUNCS(fopencookie funopen nanosleep)
111
112 # Checks for header files.
113 AC_HEADER_STDC
114
115 # Checks for typedefs, structures, and compiler characteristics.
116 AC_C_CONST
117 AC_C_INLINE
118 AC_TYPE_SIZE_T
119
120 AC_CHECK_SIZEOF(unsigned short)
121 AC_CHECK_SIZEOF(unsigned int)
122 AC_CHECK_SIZEOF(unsigned long)
123
124 # Checks for library functions.
125
126 # FIXME: what is this for?? -moritz
127 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
128
129 if test "$GCC" = yes; then
130 if test "$USE_MAINTAINER_MODE" = "yes"; then
131 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
132 CFLAGS="$CFLAGS -Wformat-nonliteral"
133 else
134 CFLAGS="$CFLAGS -Wall"
135 fi
136 fi
137
138 #
139 # Taken from libassuan source package
140 #
141
142 AC_CHECK_HEADERS([string.h locale.h sys/uio.h])
143 #AC_DEFINE(USE_DESCRIPTOR_PASSING, 0, [We do not need this feature])
144 AC_REPLACE_FUNCS(setenv)
145 # Check for funopen
146 AC_CHECK_FUNCS(funopen)
147 if test $ac_cv_func_funopen != yes; then
148 # No funopen but we can implement that in terms of fopencookie.
149 AC_CHECK_FUNCS(fopencookie)
150 if test $ac_cv_func_fopencookie = yes; then
151 AC_LIBOBJ([funopen])
152 else
153 AC_MSG_WARN([
154 ***
155 *** No implementation of fopencookie or funopen available.
156 *** The assuan_get_data_fp feature won't work.
157 ***])
158 fi
159 fi
160
161 # Native language support:
162 AM_GNU_GETTEXT([external])
163 AM_GNU_GETTEXT_VERSION(0.17)
164
165 #
166 # Decide what to build
167 #
168
169 if test $have_ksba = no; then
170 enable_auth_x509=no
171 fi
172 AM_CONDITIONAL(AUTH_METHOD_X509, test "$enable_auth_x509" = "yes")
173 AM_CONDITIONAL(AUTH_METHOD_LOCALDB, test "$enable_auth_localdb" = "yes")
174
175 if test "$enable_auth_x509" = "yes"; then
176 AC_DEFINE(ENABLE_AUTH_METHOD_X509, 1, [Enable X509 authentication method])
177 fi
178 if test "$enable_auth_localdb" = "yes"; then
179 AC_DEFINE(ENABLE_AUTH_METHOD_LOCALDB, 1, [Enable local-db authentication method])
180 fi
181
182 #
183 # Print errors here so that they are visible all
184 # together and the user can acquire them all together.
185 #
186 die=no
187 if test "$have_gpg_error" = "no"; then
188 die=yes
189 AC_MSG_NOTICE([[
190 ***
191 *** You need libgpg-error to build this program.
192 *** This library is for example available at
193 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgpg-error
194 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
195 ***]])
196 fi
197 if test "$have_libgcrypt" = "no"; then
198 die=yes
199 AC_MSG_NOTICE([[
200 ***
201 *** You need libgcrypt to build this program.
202 *** This library is for example available at
203 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt
204 *** (at least version $NEED_LIBGCRYPT_VERSION is required.)
205 ***]])
206 fi
207 if test "$have_ksba" = "no"; then
208 AC_MSG_NOTICE([[
209 ***
210 *** libksba not found, building without X.509 authentication support.
211 *** libksba can be retrieved from:
212 *** ftp://ftp.gnupg.org/gcrypt/libksba/
213 *** (at least version $NEED_KSBA_VERSION (API $NEED_KSBA_API) is required).
214 ***]])
215 fi
216 if test "$die" = "yes"; then
217 AC_MSG_ERROR([[
218 ***
219 *** Required libraries not found. Please consult the above messages
220 *** and install them before running configure again.
221 ***]])
222 fi
223
224 AC_CONFIG_FILES([Makefile
225 po/Makefile.in
226 m4/Makefile
227 am/Makefile
228 src/Makefile
229 src/assuan/Makefile
230 src/util/Makefile
231 src/util/configure-stamp
232 src/scd/Makefile
233 src/pam/Makefile
234 src/pam/auth-support/Makefile
235 src/pam/auth-method-localdb/Makefile
236 src/pam/auth-method-x509/Makefile
237 doc/Makefile
238 tests/Makefile
239 tools/Makefile
240 conf/Makefile])
241 AC_OUTPUT
242
243 if test "$PAM_MODULE_DIRECTORY" = "$DEFAULT_PAM_MODULE_DIRECTORY"; then
244 AC_MSG_WARN([
245 **
246 ** Warning: using default value ($DEFAULT_PAM_MODULE_DIRECTORY) as
247 ** installation directory for PAM module; this is probably not
248 ** what you want. Either use the configure flag
249 **
250 ** --with-pam-module-directory=DIRECTORY
251 **
252 ** or copy the newly built pam_poldi.so into the correct directory
253 ** manually. Usually PAM modules are located in /lib/security.
254 **])
255 else
256 AC_MSG_NOTICE([PAM module installation directory: $PAM_MODULE_DIRECTORY])
257 fi
258
259 echo "
260 Poldi v${VERSION} has been configured as follows:
261
262 installation directory for PAM module: $PAM_MODULE_DIRECTORY
263 configuration directory: $POLDI_CONF_DIRECTORY
264
265 X509 authentication: $enable_auth_x509
266 local-db authentication: $enable_auth_localdb
267
268 "