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