Fix API.
[shishi.git] / configure.ac
blobefb19009e74bc30c1579f4c6bd00848d61bddc55
1 # Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2002, 2003 Simon Josefsson.
4 # This file is part of Shishi.
6 # Shishi is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # Shishi is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Shishi; see the file COPYING.  If not, write to
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
21 AC_PREREQ(2.50)
22 AC_INIT(shishi, 0.0.6, bug-shishi@josefsson.org)
24 # Interfaces removed:    CURRENT++, AGE=0, REVISION=0
25 # Interfaces added:      CURRENT++, AGE++, REVISION=0
26 # No interfaces changed:                   REVISION++
27 LT_CURRENT=0
28 LT_AGE=0
29 LT_REVISION=6
30 AC_SUBST(LT_CURRENT)
31 AC_SUBST(LT_AGE)
32 AC_SUBST(LT_REVISION)
34 AM_INIT_AUTOMAKE(gnits)
35 AM_CONFIG_HEADER(config.h)
37 # Checks for header files.
38 AC_PROG_CC
39 AC_GNU_SOURCE
40 gl_USE_SYSTEM_EXTENSIONS
41 AC_HEADER_STDC
42 AC_CHECK_HEADERS(stdlib.h string.h strings.h memory.h \
43         sys/types.h sys/socket.h sys/poll.h sys/time.h sys/select.h \
44         sys/socket.h sys/stat.h \
45         unistd.h netdb.h time.h termios.h signal.h pwd.h errno.h syslog.h \
46         locale.h resolv.h fcntl.h \
47         arpa/nameser.h arpa/inet.h netinet/in.h netinet/in6.h)
49 # Checks for programs.
50 AC_PROG_LIBTOOL
51 AM_GNU_GETTEXT(external)
52 AM_GNU_GETTEXT_VERSION(0.12.1)
53 AM_MISSING_PROG(PERL, perl, $missing_dir)
54 AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
55 AM_MISSING_PROG(ASN1PARSER, asn1Parser, $missing_dir)
56 AM_WITH_DMALLOC
58 # Checks for typedefs, structures, and compiler characteristics.
59 AC_C_CONST
60 AC_TYPE_SIZE_T
61 AC_TYPE_UID_T
62 AC_TYPE_SIGNAL
63 AC_HEADER_TIME
64 AX_CREATE_STDINT_H(lib/shishi-int.h)
65 AC_CHECK_DECLS(h_errno)
66 AC_CHECK_TYPE([socklen_t],, [AC_DEFINE([socklen_t], [size_t],
67               [Define to `size_t' if `socklen_t' is missing.])], [
68 #ifdef HAVE_SYS_TYPES_H
69 #include <sys/types.h>
70 #endif
71 #ifdef HAVE_SYS_SOCKET_H
72 #include <sys/socket.h>
73 #endif
74 #ifdef HAVE_NETDB_H
75 #include <netdb.h>
76 #endif
78 # For libtasn1
79 AC_CHECK_SIZEOF(unsigned long long, 8)
80 AC_CHECK_SIZEOF(unsigned long int, 4)
81 AC_CHECK_SIZEOF(unsigned int, 4)
82 AC_CHECK_SIZEOF(unsigned short int, 2)
83 AC_CHECK_SIZEOF(unsigned char, 1)
85 # Check for PAM
86 AC_ARG_ENABLE(pam,
87   AC_HELP_STRING([--disable-pam], [Don't use PAM even if available]))
88 if test "$enable_pam" != "no"; then
89         AC_CHECK_HEADERS(security/pam_appl.h)
90         AC_CHECK_HEADERS(security/pam_modules.h, [], [],
91         [
92 #if HAVE_SECURITY_PAM_APPL_H
93 #include <security/pam_appl.h>
94 #endif
96   AC_CHECK_HEADERS(security/_pam_macros.h)
97   enable_pam=$ac_cv_header_security_pam_modules_h
99 if test "$enable_pam" != "no"; then
100         PAM_SHISHI=pam_shishi
101 else
102         AC_MSG_WARN([[The Shishi PAM module will not be built.]])
104 AC_SUBST(PAM_SHISHI)
105 AC_MSG_CHECKING([if PAM should be used])
106 AC_MSG_RESULT($enable_pam)
108 # Check for IPv6
109 AC_ARG_ENABLE(ipv6,
110   AC_HELP_STRING([--disable-ipv6], [Don't use IPv6 even if available]))
111 if test "$enable_ipv6" != "no"; then
112   enable_ipv6=yes
113   AC_CHECK_DECLS([AF_INET6, IN6ADDR_ANY_INIT],,enable_ipv6=no,[
114   #ifdef HAVE_SYS_TYPES_H
115   #include <sys/types.h>
116   #endif
117   #ifdef HAVE_SYS_SOCKET_H
118   #include <sys/socket.h>
119   #endif
120   #ifdef HAVE_NETINET_IN_H
121   #include <netinet/in.h>
122   #endif
123   #ifdef HAVE_NETINET_IN6_H
124   #include <netinet/in6.h>
125   #endif
126   ])
127   AC_CHECK_TYPE(struct sockaddr_in6,,enable_ipv6=no,[
128   #ifdef HAVE_SYS_TYPES_H
129   #include <sys/types.h>
130   #endif
131   #ifdef HAVE_SYS_SOCKET_H
132   #include <sys/socket.h>
133   #endif
134   #ifdef HAVE_NETINET_IN_H
135   #include <netinet/in.h>
136   #endif
137   #ifdef HAVE_NETINET_IN6_H
138   #include <netinet/in6.h>
139   #endif
140   ])
142 if test "$enable_ipv6" != "no"; then
143   AC_DEFINE(WITH_IPV6, 1, [Define to 1 if you want IPv6.])
144 else
145   AC_MSG_WARN([[IPv6 support is disabled.]])
147 AC_MSG_CHECKING([if IPv6 should be used])
148 AC_MSG_RESULT($enable_ipv6)
150 # Check gdbm
151 #AC_ARG_WITH(system-gdbm,
152 #  AC_HELP_STRING([--without-system-gdbm], [Don't use the system's gdbm]))
153 #if test "$with_system_gdbm" != "no" ; then
154 #  AC_CHECK_LIB(gdbm, gdbm_open,,with_system_gdbm=no)
156 #LIBGDBM=""
157 #if test "$with_system_gdbm" = "no" ; then
158 #  LIBGDBM="\$(top_builddir)/gdbm/libgdbm.a"
159 #  CFLAGS="$CFLAGS -I\$(top_srcdir)/gdbm"
160 #  GDBM=gdbm
161 #  AC_SUBST(GDBM)
163 #AC_SUBST(LIBGDBM)
165 # Check for idn
166 AC_ARG_WITH(stringprep,
167   AC_HELP_STRING([--without-stringprep],
168                 [don't use libidn even if available]))
169 if test "$with_stringprep" != "no" ; then
170         PKG_CHECK_MODULES(LIBIDN, libidn >= 0.1.0,, with_stringprep=no)
172 if test "$with_stringprep" != "no"; then
173         AC_DEFINE(WITH_STRINGPREP, 1, [Define to 1 if you want to use libidn.])
174 else
175         AC_MSG_WARN([[String processing disabled due to no libidn.]])
178 # Check for libtasn1
179 AC_ARG_WITH(system-asn1,
180         AC_HELP_STRING([--with-system-asn1], [Use the system's libtasn1]),
181         system_asn1=$withval, system_asn1=no)
182 if test "$system_asn1" = "yes"; then
183         AC_CHECK_LIB(tasn1, asn1_read_tag, :,
184                 system_asn1=no
185                 AC_MSG_WARN([Libtasn1 0.2.x not found. Using included one.]))
187 AC_MSG_CHECKING([whether to use the system's libtasn1])
188 AC_MSG_RESULT($system_asn1)
189 if test "$system_asn1" = "yes"; then
190  LIBTASN1_LIBS=-ltasn1
191 else
192  ASN1=asn1
193  LIBTASN1_LIBS="-L../asn1 -lminitasn1"
195 AC_SUBST(ASN1)
196 AC_SUBST(LIBTASN1_LIBS)
198 # Check for libgcrypt
199 AC_ARG_WITH(libgcrypt,
200   AC_HELP_STRING([--with-libgcrypt], [use libgcrypt for low-level crypto]),
201   libgcrypt=$withval, libgcrypt=no)
202 if test "$libgcrypt" != "no" ; then
203         AM_PATH_LIBGCRYPT(1.1.42, :, [
204                 libgcrypt=no
205                 AC_MSG_WARN([Libgcrypt >= 1.1.42 not found.])
206         ])
208 AC_MSG_CHECKING([whether to use libgcrypt])
209 AC_MSG_RESULT($libgcrypt)
210 if test "$libgcrypt" != "no" ; then
211         AC_DEFINE(USE_GCRYPT, 1, [Define to 1 if you want to use libgcrypt.])
212 else
213         CRYPTO=crypto
214         CRYPTO_CFLAGS="-I\$(top_srcdir)/crypto"
215         CRYPTO_LIBS="-L../crypto -lnettle"
217 AM_CONDITIONAL(LIBGCRYPT, test "$libgcrypt" != "no")
218 AM_CONDITIONAL(NETTLE, test "$libgcrypt" = "no")
219 AC_SUBST(CRYPTO)
220 AC_SUBST(CRYPTO_CFLAGS)
221 AC_SUBST(CRYPTO_LIBS)
223 # Check for library
224 AC_CHECK_LIB(resolv, res_query,, AC_MSG_WARN([[no libresolv, SRV RRs not used]]))
225 AC_SEARCH_LIBS(socket, socket)
226 AC_SEARCH_LIBS(gethostbyname, nsl)
227 AC_SEARCH_LIBS(syslog, syslog)
229 # Check for gnutls.
230 AC_ARG_ENABLE(tls,
231         AC_HELP_STRING([--enable-tls], [enable unfinished TLS support]),
232         tls=$enableval, tls=no)
233 if test "$tls" != "no"; then
234         AM_PATH_LIBGNUTLS(0.8.8, tls=yes, tls=no)
236 if test "$tls" != "no"; then
237         AC_DEFINE(USE_GNUTLS, 1, [Define to 1 if you want TLS.])
239 AC_MSG_CHECKING([if unfinished TLS support should be enabled])
240 AC_MSG_RESULT($tls)
242 # For gnulib stuff in gl/.
243 gl_C_RESTRICT
244 gl_FUNC_ALLOCA
245 gl_ARGP
246 gl_ERROR
247 gl_EXITFAIL
248 gl_GETDATE
249 gl_FUNC_GETHOSTNAME
250 gl_GETOPT
251 jm_FUNC_MALLOC
252 gl_FUNC_MEMMOVE
253 gl_FUNC_MEMPCPY
254 gl_FUNC_MEMSET
255 gl_FUNC_MKTIME
256 gl_FUNC_TIMEGM
257 jm_FUNC_REALLOC
258 gt_FUNC_SETENV
259 gl_STRCASE
260 gl_FUNC_STRCHRNUL
261 gl_FUNC_STRDUP
262 gl_FUNC_STRERROR
263 gl_FUNC_STRNDUP
264 gl_FUNC_STRNLEN
265 gl_SYSEXITS
266 jm_FUNC_GLIBC_UNLOCKED_IO
267 gl_FUNC_VASNPRINTF
268 gl_FUNC_VASPRINTF
269 gl_XALLOC
270 gl_XSTRNDUP
271 gl_TIME_R
273 # Checks for library functions.
274 AC_FUNC_STRFTIME
275 AC_CHECK_FUNCS(signal select ngettext gethostbyname)
277 # Check for gtk-doc.
278 AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
279 if test "x$with_html_dir" = "x" ; then
280   HTML_DIR='${datadir}/gtk-doc/html'
281 else
282   HTML_DIR=$with_html_dir
284 AC_SUBST(HTML_DIR)
285 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
286 gtk_doc_min_version=0.6
287 if $GTKDOC ; then 
288     gtk_doc_version=`gtkdoc-mkdb --version`
289     AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
290     if perl <<EOF ; then
291       exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
292             ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
294       AC_MSG_RESULT(yes)
295    else
296       AC_MSG_RESULT(no)
297       GTKDOC=false
298    fi
301 # Let people disable the gtk-doc stuff.
302 AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
303 if test x$enable_gtk_doc = xauto ; then
304   if test x$GTKDOC = xtrue ; then
305     enable_gtk_doc=yes
306   else
307     enable_gtk_doc=no 
308   fi
310 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
312 AC_CONFIG_FILES(Makefile po/Makefile.in m4/Makefile \
313         asn1/Makefile crypto/Makefile examples/Makefile \
314         lib/Makefile lib/shishi.h src/Makefile tests/Makefile doc/Makefile \
315         doc/reference/Makefile \
316         extra/Makefile extra/pam_shishi/Makefile extra/rsh-redone/Makefile \
317         gl/Makefile gl/m4/Makefile shishi.pc shishi.conf shishi.skel)
319 # We are done
320 AC_OUTPUT