xref: /freebsd/crypto/krb5/src/configure.ac (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy SchubertK5_AC_INIT([aclocal.m4])
2*7f2fe78bSCy Schubert
3*7f2fe78bSCy Schubert# If $runstatedir isn't set by autoconf (<2.70), set it manually.
4*7f2fe78bSCy Schubertif test x"$runstatedir" = x; then
5*7f2fe78bSCy Schubert  runstatedir='${localstatedir}/run'
6*7f2fe78bSCy Schubertfi
7*7f2fe78bSCy SchubertAC_SUBST(runstatedir)
8*7f2fe78bSCy Schubert
9*7f2fe78bSCy Schubert# Don't make duplicate profile path entries for /etc/krb5.conf if
10*7f2fe78bSCy Schubert# $sysconfdir is /etc
11*7f2fe78bSCy Schubertif test "$sysconfdir" = /etc; then
12*7f2fe78bSCy Schubert  SYSCONFCONF=""
13*7f2fe78bSCy Schubertelse
14*7f2fe78bSCy Schubert  SYSCONFCONF=":${sysconfdir}/krb5.conf"
15*7f2fe78bSCy Schubertfi
16*7f2fe78bSCy SchubertAC_SUBST(SYSCONFCONF)
17*7f2fe78bSCy Schubert
18*7f2fe78bSCy SchubertCONFIG_RULES
19*7f2fe78bSCy SchubertKRB5_VERSION=K5_VERSION
20*7f2fe78bSCy SchubertAC_SUBST(KRB5_VERSION)
21*7f2fe78bSCy Schubert
22*7f2fe78bSCy Schubert
23*7f2fe78bSCy SchubertAC_REQUIRE_CPP
24*7f2fe78bSCy Schubert
25*7f2fe78bSCy SchubertPKG_PROG_PKG_CONFIG
26*7f2fe78bSCy Schubert
27*7f2fe78bSCy SchubertAC_CHECK_HEADER([stdint.h], [],
28*7f2fe78bSCy Schubert  [AC_MSG_ERROR([stdint.h is required])])
29*7f2fe78bSCy Schubert
30*7f2fe78bSCy SchubertAC_CACHE_CHECK([whether integers are two's complement],
31*7f2fe78bSCy Schubert  [krb5_cv_ints_twos_compl],
32*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
33*7f2fe78bSCy Schubert    [AC_LANG_BOOL_COMPILE_TRY(
34*7f2fe78bSCy Schubert[#include <limits.h>
35*7f2fe78bSCy Schubert],
36*7f2fe78bSCy Schubert	[/* Basic two's complement check */
37*7f2fe78bSCy Schubert	  ~(-1) == 0 && ~(-1L) == 0L &&
38*7f2fe78bSCy Schubert	  /* Check that values with sign bit 1 and value bits 0 are valid */
39*7f2fe78bSCy Schubert	  -(INT_MIN + 1) == INT_MAX && -(LONG_MIN + 1) == LONG_MAX &&
40*7f2fe78bSCy Schubert	  /* Check that unsigned-to-signed conversions preserve bit patterns */
41*7f2fe78bSCy Schubert	  (int)((unsigned int)INT_MAX + 1) == INT_MIN &&
42*7f2fe78bSCy Schubert	  (long)((unsigned long)LONG_MAX + 1) == LONG_MIN])],
43*7f2fe78bSCy Schubert    [krb5_cv_ints_twos_compl=yes],
44*7f2fe78bSCy Schubert    [krb5_cv_ints_twos_compl=no])])
45*7f2fe78bSCy Schubert
46*7f2fe78bSCy Schubertif test "$krb5_cv_ints_twos_compl" = "no"; then
47*7f2fe78bSCy Schubert  AC_MSG_ERROR([integers are not two's complement])
48*7f2fe78bSCy Schubertfi
49*7f2fe78bSCy Schubert
50*7f2fe78bSCy SchubertAC_CACHE_CHECK([whether CHAR_BIT is 8],
51*7f2fe78bSCy Schubert  [krb5_cv_char_bit_8],
52*7f2fe78bSCy Schubert  [AC_PREPROC_IFELSE([AC_LANG_SOURCE(
53*7f2fe78bSCy Schubert[[#include <limits.h>
54*7f2fe78bSCy Schubert#if CHAR_BIT != 8
55*7f2fe78bSCy Schubert  #error CHAR_BIT != 8
56*7f2fe78bSCy Schubert#endif
57*7f2fe78bSCy Schubert]])],
58*7f2fe78bSCy Schubert    [krb5_cv_char_bit_8=yes], [krb5_cv_char_bit_8=no])])
59*7f2fe78bSCy Schubert
60*7f2fe78bSCy Schubertif test "$krb5_cv_char_bit_8" = "no"; then
61*7f2fe78bSCy Schubert  AC_MSG_ERROR([CHAR_BIT is not 8])
62*7f2fe78bSCy Schubertfi
63*7f2fe78bSCy Schubert
64*7f2fe78bSCy SchubertAC_CACHE_CHECK(if va_copy is available, krb5_cv_va_copy,
65*7f2fe78bSCy Schubert[AC_LINK_IFELSE([AC_LANG_SOURCE([
66*7f2fe78bSCy Schubert#include <stdarg.h>
67*7f2fe78bSCy Schubertvoid f(va_list ap) {
68*7f2fe78bSCy Schubert  va_list ap2;
69*7f2fe78bSCy Schubert  va_copy(ap2, ap);
70*7f2fe78bSCy Schubert  va_end(ap2);
71*7f2fe78bSCy Schubert}
72*7f2fe78bSCy Schubertva_list x;
73*7f2fe78bSCy Schubertint main()
74*7f2fe78bSCy Schubert{
75*7f2fe78bSCy Schubert  f(x);
76*7f2fe78bSCy Schubert  return 0;
77*7f2fe78bSCy Schubert}])], krb5_cv_va_copy=yes, krb5_cv_va_copy=no)])
78*7f2fe78bSCy Schubertif test "$krb5_cv_va_copy" = yes; then
79*7f2fe78bSCy Schubert  AC_DEFINE(HAS_VA_COPY,1,[Define if va_copy macro or function is available.])
80*7f2fe78bSCy Schubertfi
81*7f2fe78bSCy Schubert
82*7f2fe78bSCy Schubert# Note that this isn't checking if the copied value *works*, just
83*7f2fe78bSCy Schubert# whether the C language constraints permit the copying.  If
84*7f2fe78bSCy Schubert# va_list is defined as an array type, it can't be assigned.
85*7f2fe78bSCy SchubertAC_CACHE_CHECK(if va_list objects can be copied by assignment,
86*7f2fe78bSCy Schubert	       krb5_cv_va_simple_copy,
87*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE([
88*7f2fe78bSCy SchubertAC_LANG_SOURCE([#include <stdarg.h>
89*7f2fe78bSCy Schubertvoid f(va_list va2) {
90*7f2fe78bSCy Schubert  va_list va1;
91*7f2fe78bSCy Schubert  va1 = va2;
92*7f2fe78bSCy Schubert}])], krb5_cv_va_simple_copy=yes, krb5_cv_va_simple_copy=no)])
93*7f2fe78bSCy Schubertif test "$krb5_cv_va_simple_copy" = yes; then
94*7f2fe78bSCy Schubert  AC_DEFINE(CAN_COPY_VA_LIST,1,[Define if va_list objects can be simply copied by assignment.])
95*7f2fe78bSCy Schubertfi
96*7f2fe78bSCy Schubert
97*7f2fe78bSCy Schubert# The following lines are so that configure --help gives some global
98*7f2fe78bSCy Schubert# configuration options.
99*7f2fe78bSCy Schubert
100*7f2fe78bSCy SchubertKRB5_LIB_AUX
101*7f2fe78bSCy SchubertAC_ARG_ENABLE([athena],
102*7f2fe78bSCy Schubert[  --enable-athena         build with MIT Project Athena configuration],,)
103*7f2fe78bSCy Schubert
104*7f2fe78bSCy Schubert# Begin autoconf tests for the Makefiles generated out of the top-level
105*7f2fe78bSCy Schubert# configure.in...
106*7f2fe78bSCy Schubert
107*7f2fe78bSCy SchubertKRB5_BUILD_LIBOBJS
108*7f2fe78bSCy SchubertKRB5_BUILD_LIBRARY
109*7f2fe78bSCy SchubertKRB5_BUILD_PROGRAM
110*7f2fe78bSCy Schubert# for kprop
111*7f2fe78bSCy SchubertAC_TYPE_MODE_T
112*7f2fe78bSCy SchubertAC_PROG_INSTALL
113*7f2fe78bSCy SchubertKRB5_AC_NEED_DAEMON
114*7f2fe78bSCy SchubertKRB5_GETSOCKNAME_ARGS
115*7f2fe78bSCy SchubertKRB5_GETPEERNAME_ARGS
116*7f2fe78bSCy SchubertLIBUTIL=
117*7f2fe78bSCy SchubertAC_CHECK_LIB(util,main,[AC_DEFINE(HAVE_LIBUTIL,1,[Define if the util library is available])
118*7f2fe78bSCy SchubertLIBUTIL=-lutil
119*7f2fe78bSCy Schubert])
120*7f2fe78bSCy SchubertAC_SUBST(LIBUTIL)
121*7f2fe78bSCy Schubert
122*7f2fe78bSCy Schubert# Determine if NLS is desired and supported.
123*7f2fe78bSCy Schubertpo=
124*7f2fe78bSCy SchubertAC_ARG_ENABLE([nls],
125*7f2fe78bSCy Schubert  [AS_HELP_STRING([--disable-nls], [disable native language support])],
126*7f2fe78bSCy Schubert  [], [enable_nls=check])
127*7f2fe78bSCy Schubertif test "$enable_nls" != no; then
128*7f2fe78bSCy Schubert  AC_CHECK_HEADER(libintl.h, [
129*7f2fe78bSCy Schubert    AC_SEARCH_LIBS(dgettext, intl, [
130*7f2fe78bSCy Schubert      AC_DEFINE(ENABLE_NLS, 1,
131*7f2fe78bSCy Schubert                [Define if translation functions should be used.])
132*7f2fe78bSCy Schubert      nls_enabled=yes])])
133*7f2fe78bSCy Schubert
134*7f2fe78bSCy Schubert  AC_CHECK_PROG(MSGFMT,msgfmt,msgfmt)
135*7f2fe78bSCy Schubert  if test x"$MSGFMT" != x; then
136*7f2fe78bSCy Schubert    K5_GEN_MAKEFILE(po)
137*7f2fe78bSCy Schubert    po=po
138*7f2fe78bSCy Schubert  fi
139*7f2fe78bSCy Schubert
140*7f2fe78bSCy Schubert  # Error out if --enable-nls was explicitly requested but can't be enabled.
141*7f2fe78bSCy Schubert  if test "$enable_nls" = yes; then
142*7f2fe78bSCy Schubert    if test "$nls_enabled" != yes -o "x$po" = x; then
143*7f2fe78bSCy Schubert      AC_MSG_ERROR([NLS support requested but cannot be built])
144*7f2fe78bSCy Schubert    fi
145*7f2fe78bSCy Schubert  fi
146*7f2fe78bSCy Schubertfi
147*7f2fe78bSCy SchubertAC_SUBST(po)
148*7f2fe78bSCy Schubert
149*7f2fe78bSCy Schubert# for kdc
150*7f2fe78bSCy SchubertAC_CHECK_HEADERS(sys/sockio.h ifaddrs.h unistd.h fnmatch.h)
151*7f2fe78bSCy SchubertAC_CHECK_FUNCS(vsprintf vasprintf vsnprintf strlcpy fnmatch secure_getenv)
152*7f2fe78bSCy Schubert
153*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS=
154*7f2fe78bSCy SchubertAC_CHECK_FUNC(strlcpy,
155*7f2fe78bSCy Schubert[STRLCPY_ST_OBJ=
156*7f2fe78bSCy SchubertSTRLCPY_OBJ=],
157*7f2fe78bSCy Schubert[STRLCPY_ST_OBJ=strlcpy.o
158*7f2fe78bSCy SchubertSTRLCPY_OBJ='$(OUTPRE)strlcpy.$(OBJEXT)'
159*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_strlcpy krb5int_strlcat"])
160*7f2fe78bSCy SchubertAC_SUBST(STRLCPY_OBJ)
161*7f2fe78bSCy SchubertAC_SUBST(STRLCPY_ST_OBJ)
162*7f2fe78bSCy Schubert
163*7f2fe78bSCy SchubertAC_CHECK_FUNC(getopt,
164*7f2fe78bSCy Schubert[GETOPT_ST_OBJ=
165*7f2fe78bSCy SchubertGETOPT_OBJ=
166*7f2fe78bSCy SchubertAC_DEFINE(HAVE_GETOPT, 1, [Define if system getopt should be used.])],
167*7f2fe78bSCy Schubert[GETOPT_ST_OBJ='getopt.o'
168*7f2fe78bSCy SchubertGETOPT_OBJ='$(OUTPRE)getopt.$(OBJEXT)'
169*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS k5_optind k5_optarg k5_opterr k5_optopt k5_getopt"])
170*7f2fe78bSCy SchubertAC_SUBST(GETOPT_OBJ)
171*7f2fe78bSCy SchubertAC_SUBST(GETOPT_ST_OBJ)
172*7f2fe78bSCy Schubert
173*7f2fe78bSCy SchubertAC_CHECK_FUNC(getopt_long,
174*7f2fe78bSCy Schubert[GETOPT_LONG_ST_OBJ=
175*7f2fe78bSCy SchubertGETOPT_LONG_OBJ=
176*7f2fe78bSCy SchubertAC_DEFINE(HAVE_GETOPT_LONG, 1, [Define if system getopt_long should be used.])],
177*7f2fe78bSCy Schubert[GETOPT_LONG_ST_OBJ='getopt_long.o'
178*7f2fe78bSCy SchubertGETOPT_LONG_OBJ='$(OUTPRE)getopt_long.$(OBJEXT)'
179*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS k5_getopt_long"])
180*7f2fe78bSCy SchubertAC_SUBST(GETOPT_LONG_OBJ)
181*7f2fe78bSCy SchubertAC_SUBST(GETOPT_LONG_ST_OBJ)
182*7f2fe78bSCy Schubert
183*7f2fe78bSCy SchubertAC_CHECK_FUNC(fnmatch,
184*7f2fe78bSCy Schubert[FNMATCH_ST_OBJ=
185*7f2fe78bSCy SchubertFNMATCH_OBJ=],
186*7f2fe78bSCy Schubert[FNMATCH_ST_OBJ=fnmatch.o
187*7f2fe78bSCy SchubertFNMATCH_OBJ='$(OUTPRE)fnmatch.$(OBJEXT)'
188*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS k5_fnmatch"])
189*7f2fe78bSCy SchubertAC_SUBST(FNMATCH_OBJ)
190*7f2fe78bSCy SchubertAC_SUBST(FNMATCH_ST_OBJ)
191*7f2fe78bSCy Schubert
192*7f2fe78bSCy SchubertAC_CHECK_FUNC(vasprintf,
193*7f2fe78bSCy Schubert[PRINTF_ST_OBJ=
194*7f2fe78bSCy SchubertPRINTF_OBJ=],
195*7f2fe78bSCy Schubert[PRINTF_ST_OBJ=printf.o
196*7f2fe78bSCy SchubertPRINTF_OBJ='$(OUTPRE)printf.$(OBJEXT)'
197*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_asprintf krb5int_vasprintf"])
198*7f2fe78bSCy SchubertAC_SUBST(PRINTF_OBJ)
199*7f2fe78bSCy SchubertAC_SUBST(PRINTF_ST_OBJ)
200*7f2fe78bSCy SchubertKRB5_NEED_PROTO([#include <stdarg.h>
201*7f2fe78bSCy Schubert#include <stdio.h>
202*7f2fe78bSCy Schubert],vasprintf)
203*7f2fe78bSCy SchubertKRB5_NEED_PROTO([#include <string.h>
204*7f2fe78bSCy Schubert#ifdef HAVE_UNISTD_H
205*7f2fe78bSCy Schubert#include <unistd.h>
206*7f2fe78bSCy Schubert#endif
207*7f2fe78bSCy Schubert/* Solaris 8 declares swab in stdlib.h.  */
208*7f2fe78bSCy Schubert#include <stdlib.h>
209*7f2fe78bSCy Schubert],swab,1)
210*7f2fe78bSCy Schubert
211*7f2fe78bSCy SchubertAC_CHECK_FUNC(secure_getenv,
212*7f2fe78bSCy Schubert[SECURE_GETENV_ST_OBJ=
213*7f2fe78bSCy SchubertSECURE_GETENV_OBJ=
214*7f2fe78bSCy SchubertSECURE_GETENV_INIT=],
215*7f2fe78bSCy Schubert[SECURE_GETENV_ST_OBJ=secure_getenv.o
216*7f2fe78bSCy SchubertSECURE_GETENV_OBJ='$(OUTPRE)secure_getenv.$(OBJEXT)'
217*7f2fe78bSCy SchubertSECURE_GETENV_INIT=k5_secure_getenv_init
218*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS k5_secure_getenv"])
219*7f2fe78bSCy SchubertAC_SUBST(SECURE_GETENV_OBJ)
220*7f2fe78bSCy SchubertAC_SUBST(SECURE_GETENV_ST_OBJ)
221*7f2fe78bSCy SchubertAC_SUBST(SECURE_GETENV_INIT)
222*7f2fe78bSCy Schubert
223*7f2fe78bSCy SchubertAC_PROG_AWK
224*7f2fe78bSCy SchubertKRB5_AC_INET6
225*7f2fe78bSCy SchubertKRB5_SOCKADDR_SA_LEN
226*7f2fe78bSCy SchubertCHECK_SIGNALS
227*7f2fe78bSCy Schubert
228*7f2fe78bSCy Schubert# --with-vague-errors disables useful error messages.
229*7f2fe78bSCy Schubert
230*7f2fe78bSCy SchubertAC_ARG_WITH([vague-errors],
231*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-vague-errors],
232*7f2fe78bSCy Schubert    [Do not @<:@do@:>@ send helpful errors to client])],
233*7f2fe78bSCy Schubert  [], [withval=no])
234*7f2fe78bSCy Schubertif test "$withval" = yes; then
235*7f2fe78bSCy Schubert	AC_MSG_NOTICE(Supplying vague error messages to KDC clients)
236*7f2fe78bSCy Schubert	AC_DEFINE(KRBCONF_VAGUE_ERRORS,1,[Define if the KDC should return only vague error codes to clients])
237*7f2fe78bSCy Schubertfi
238*7f2fe78bSCy Schubert
239*7f2fe78bSCy Schubert# Check which (if any) audit plugin to build
240*7f2fe78bSCy Schubertaudit_plugin=""
241*7f2fe78bSCy SchubertAC_ARG_ENABLE([audit-plugin],
242*7f2fe78bSCy Schubert  [AS_HELP_STRING([--enable-audit-plugin=IMPL],
243*7f2fe78bSCy Schubert    [use audit plugin @<:@ do not use audit @:>@])],
244*7f2fe78bSCy Schubert  [], enableval=no)
245*7f2fe78bSCy Schubertif test "$enableval" != no; then
246*7f2fe78bSCy Schubert    case "$enableval" in
247*7f2fe78bSCy Schubert    simple)
248*7f2fe78bSCy Schubert        # if audit_log_user_message is found, we assume
249*7f2fe78bSCy Schubert        # that audit_open and audit_close are also defined.
250*7f2fe78bSCy Schubert        AC_CHECK_LIB(audit, audit_log_user_message,
251*7f2fe78bSCy Schubert                     [AUDIT_IMPL_LIBS=-laudit
252*7f2fe78bSCy Schubert                     K5_GEN_MAKEFILE(plugins/audit/simple)
253*7f2fe78bSCy Schubert                     audit_plugin=plugins/audit/simple ],
254*7f2fe78bSCy Schubert                     AC_MSG_ERROR([libaudit not found or undefined symbol audit_log_user_message]))
255*7f2fe78bSCy Schubert        ;;
256*7f2fe78bSCy Schubert    *)
257*7f2fe78bSCy Schubert        AC_MSG_ERROR([Unknown audit plugin implementation $enableval.])
258*7f2fe78bSCy Schubert        ;;
259*7f2fe78bSCy Schubert    esac
260*7f2fe78bSCy Schubertfi
261*7f2fe78bSCy SchubertAC_SUBST(AUDIT_IMPL_LIBS)
262*7f2fe78bSCy SchubertAC_SUBST(audit_plugin)
263*7f2fe78bSCy Schubert
264*7f2fe78bSCy Schubert# WITH_CRYPTO_IMPL
265*7f2fe78bSCy Schubert
266*7f2fe78bSCy SchubertCRYPTO_IMPL=builtin
267*7f2fe78bSCy SchubertAC_ARG_WITH([crypto-impl],
268*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-crypto-impl=IMPL],
269*7f2fe78bSCy Schubert    [use specified crypto implementation @<:@builtin@:>@])],
270*7f2fe78bSCy Schubert  [CRYPTO_IMPL=$withval
271*7f2fe78bSCy Schubert   AC_MSG_NOTICE(k5crypto will use '$withval')])
272*7f2fe78bSCy Schubert
273*7f2fe78bSCy SchubertCRYPTO_BUILTIN_TESTS=no
274*7f2fe78bSCy Schubertcase $CRYPTO_IMPL in
275*7f2fe78bSCy Schubertbuiltin)
276*7f2fe78bSCy Schubert  CRYPTO_BUILTIN_TESTS=yes
277*7f2fe78bSCy Schubert  ;;
278*7f2fe78bSCy Schubertopenssl)
279*7f2fe78bSCy Schubert  AC_CHECK_LIB(crypto, PKCS7_get_signer_info)
280*7f2fe78bSCy Schubert  AC_DEFINE([CRYPTO_OPENSSL], 1, [Define to use OpenSSL crypto library])
281*7f2fe78bSCy Schubert  ;;
282*7f2fe78bSCy Schubert*)
283*7f2fe78bSCy Schubert  AC_MSG_ERROR([Unknown crypto implementation $withval])
284*7f2fe78bSCy Schubert  ;;
285*7f2fe78bSCy Schubertesac
286*7f2fe78bSCy SchubertAC_SUBST([CRYPTO_IMPL_CFLAGS])
287*7f2fe78bSCy SchubertAC_SUBST([CRYPTO_IMPL_LIBS])
288*7f2fe78bSCy SchubertAC_SUBST([CRYPTO_BUILTIN_TESTS])
289*7f2fe78bSCy Schubert
290*7f2fe78bSCy Schubert# WITH_TLS_IMPL
291*7f2fe78bSCy Schubert
292*7f2fe78bSCy SchubertAC_ARG_WITH([tls-impl],
293*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-tls-impl=IMPL],
294*7f2fe78bSCy Schubert    [use specified TLS implementation @<:@auto@:>@])],
295*7f2fe78bSCy Schubert  [TLS_IMPL=$withval], [TLS_IMPL=auto])
296*7f2fe78bSCy Schubertcase "$TLS_IMPL" in
297*7f2fe78bSCy Schubertopenssl|auto)
298*7f2fe78bSCy Schubert  AC_CHECK_LIB(ssl,SSL_CTX_new,[have_lib_ssl=true],[have_lib_ssl=false],
299*7f2fe78bSCy Schubert               -lcrypto)
300*7f2fe78bSCy Schubert  AC_MSG_CHECKING([for OpenSSL])
301*7f2fe78bSCy Schubert  if test x$have_lib_ssl = xtrue ; then
302*7f2fe78bSCy Schubert    AC_DEFINE(TLS_IMPL_OPENSSL,1,[Define if TLS implementation is OpenSSL])
303*7f2fe78bSCy Schubert    AC_MSG_RESULT([yes])
304*7f2fe78bSCy Schubert    TLS_IMPL_LIBS="-lssl -lcrypto"
305*7f2fe78bSCy Schubert    TLS_IMPL=openssl
306*7f2fe78bSCy Schubert    AC_MSG_NOTICE([TLS module will use OpenSSL])
307*7f2fe78bSCy Schubert  else
308*7f2fe78bSCy Schubert    if test "$TLS_IMPL" = openssl ; then
309*7f2fe78bSCy Schubert      AC_MSG_ERROR([OpenSSL not found!])
310*7f2fe78bSCy Schubert    else
311*7f2fe78bSCy Schubert      AC_MSG_WARN([OpenSSL not found!])
312*7f2fe78bSCy Schubert    fi
313*7f2fe78bSCy Schubert    TLS_IMPL=no
314*7f2fe78bSCy Schubert    AC_MSG_NOTICE(building without TLS support)
315*7f2fe78bSCy Schubert  fi
316*7f2fe78bSCy Schubert  ;;
317*7f2fe78bSCy Schubertno)
318*7f2fe78bSCy Schubert  AC_MSG_NOTICE(building without TLS support)
319*7f2fe78bSCy Schubert  ;;
320*7f2fe78bSCy Schubert*)
321*7f2fe78bSCy Schubert  AC_MSG_ERROR([Unsupported TLS implementation $withval])
322*7f2fe78bSCy Schubert  ;;
323*7f2fe78bSCy Schubertesac
324*7f2fe78bSCy Schubert
325*7f2fe78bSCy Schubertif test "$TLS_IMPL" = no; then
326*7f2fe78bSCy Schubert   AC_DEFINE(TLS_IMPL_NONE,1,[Define if no TLS implementation is selected])
327*7f2fe78bSCy Schubertfi
328*7f2fe78bSCy Schubert
329*7f2fe78bSCy SchubertAC_SUBST(TLS_IMPL)
330*7f2fe78bSCy SchubertAC_SUBST(TLS_IMPL_CFLAGS)
331*7f2fe78bSCy SchubertAC_SUBST(TLS_IMPL_LIBS)
332*7f2fe78bSCy Schubert
333*7f2fe78bSCy SchubertAC_ARG_WITH([keyutils],
334*7f2fe78bSCy Schubert  [AS_HELP_STRING([--without-keyutils], [do not link with libkeyutils])],
335*7f2fe78bSCy Schubert  [], [with_keyutils=check])
336*7f2fe78bSCy Schubertif test "$with_keyutils" != no; then
337*7f2fe78bSCy Schubert  have_keyutils=false
338*7f2fe78bSCy Schubert  AC_CHECK_HEADERS([keyutils.h],
339*7f2fe78bSCy Schubert    AC_CHECK_LIB(keyutils, add_key, [have_keyutils=true]))
340*7f2fe78bSCy Schubert  if test "$have_keyutils" = true; then
341*7f2fe78bSCy Schubert    AC_DEFINE(USE_KEYRING_CCACHE, 1,
342*7f2fe78bSCy Schubert              [Define if the keyring ccache should be enabled])
343*7f2fe78bSCy Schubert    LIBS="-lkeyutils $LIBS"
344*7f2fe78bSCy Schubert    # If libkeyutils supports persistent keyrings, use them.
345*7f2fe78bSCy Schubert    AC_CHECK_LIB(keyutils, keyctl_get_persistent,
346*7f2fe78bSCy Schubert      [AC_DEFINE(HAVE_PERSISTENT_KEYRING, 1,
347*7f2fe78bSCy Schubert                 [Define if persistent keyrings are supported])
348*7f2fe78bSCy Schubert      ])
349*7f2fe78bSCy Schubert  elif test "$with_keyutils" = yes; then
350*7f2fe78bSCy Schubert    AC_MSG_ERROR([libkeyutils not found])
351*7f2fe78bSCy Schubert  fi
352*7f2fe78bSCy Schubertfi
353*7f2fe78bSCy Schubert
354*7f2fe78bSCy Schubert# The SPAKE preauth plugin currently supports edwards25519 natively,
355*7f2fe78bSCy Schubert# and can support three NIST groups using OpenSSL.
356*7f2fe78bSCy SchubertHAVE_SPAKE_OPENSSL=no
357*7f2fe78bSCy SchubertAC_ARG_WITH([spake-openssl],
358*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-spake-openssl],
359*7f2fe78bSCy Schubert    [use OpenSSL for SPAKE preauth @<:@auto@:>@])],
360*7f2fe78bSCy Schubert  [], [withval=auto])
361*7f2fe78bSCy Schubertif test "$withval" = auto -o "$withval" = yes; then
362*7f2fe78bSCy Schubert  AC_CHECK_LIB([crypto],[EC_POINT_new],[have_crypto=true],[have_crypto=false])
363*7f2fe78bSCy Schubert  if test "$have_crypto" = true; then
364*7f2fe78bSCy Schubert    AC_DEFINE(SPAKE_OPENSSL,1,[Define to use OpenSSL for SPAKE preauth])
365*7f2fe78bSCy Schubert    SPAKE_OPENSSL_LIBS=-lcrypto
366*7f2fe78bSCy Schubert    HAVE_SPAKE_OPENSSL=yes
367*7f2fe78bSCy Schubert  elif test "$withval" = yes; then
368*7f2fe78bSCy Schubert    AC_MSG_ERROR([OpenSSL libcrypto not found])
369*7f2fe78bSCy Schubert  fi
370*7f2fe78bSCy Schubertfi
371*7f2fe78bSCy SchubertAC_SUBST(HAVE_SPAKE_OPENSSL)
372*7f2fe78bSCy SchubertAC_SUBST(SPAKE_OPENSSL_LIBS)
373*7f2fe78bSCy Schubert
374*7f2fe78bSCy SchubertAC_ARG_ENABLE([aesni],
375*7f2fe78bSCy Schubert  [AS_HELP_STRING([--disable-aesni], [Do not build with AES-NI support])],
376*7f2fe78bSCy Schubert  [], [enable_aesni=check])
377*7f2fe78bSCy Schubertif test "$CRYPTO_IMPL" = builtin -a "x$enable_aesni" != xno; then
378*7f2fe78bSCy Schubert    case "$host" in
379*7f2fe78bSCy Schubert    i686-*)
380*7f2fe78bSCy Schubert	aesni_obj=iaesx86.o
381*7f2fe78bSCy Schubert	aesni_machine=x86
382*7f2fe78bSCy Schubert	;;
383*7f2fe78bSCy Schubert    x86_64-*)
384*7f2fe78bSCy Schubert	aesni_obj=iaesx64.o
385*7f2fe78bSCy Schubert	aesni_machine=amd64
386*7f2fe78bSCy Schubert	;;
387*7f2fe78bSCy Schubert    esac
388*7f2fe78bSCy Schubert    case "$host" in
389*7f2fe78bSCy Schubert    *-*-linux* | *-*-gnu* | *-*-*bsd* | *-*-solaris*)
390*7f2fe78bSCy Schubert	# All Unix-like platforms need -D__linux__ for iaesx64.s to
391*7f2fe78bSCy Schubert	# use the System V x86-64 calling convention.
392*7f2fe78bSCy Schubert	aesni_flags="-D__linux__ -f elf -m $aesni_machine"
393*7f2fe78bSCy Schubert	;;
394*7f2fe78bSCy Schubert    esac
395*7f2fe78bSCy Schubert    if test "x$aesni_obj" != x && test "x$aesni_flags" != x; then
396*7f2fe78bSCy Schubert	AC_CHECK_PROG(YASM,yasm,yasm)
397*7f2fe78bSCy Schubert	AC_CHECK_HEADERS(cpuid.h)
398*7f2fe78bSCy Schubert	if test x"$YASM" != x -a "x$ac_cv_header_cpuid_h" = xyes; then
399*7f2fe78bSCy Schubert	    AESNI_OBJ=$aesni_obj
400*7f2fe78bSCy Schubert	    AESNI_FLAGS=$aesni_flags
401*7f2fe78bSCy Schubert	    AC_DEFINE(AESNI,1,[Define if AES-NI support is enabled])
402*7f2fe78bSCy Schubert	    AC_MSG_NOTICE([Building with AES-NI support])
403*7f2fe78bSCy Schubert	fi
404*7f2fe78bSCy Schubert    fi
405*7f2fe78bSCy Schubert    if test "x$enable_aesni" = xyes -a "x$AESNI_OBJ" = x; then
406*7f2fe78bSCy Schubert	AC_MSG_ERROR([AES-NI support requested but cannot be built])
407*7f2fe78bSCy Schubert    fi
408*7f2fe78bSCy Schubertfi
409*7f2fe78bSCy SchubertAC_SUBST(AESNI_OBJ)
410*7f2fe78bSCy SchubertAC_SUBST(AESNI_FLAGS)
411*7f2fe78bSCy Schubert
412*7f2fe78bSCy SchubertAC_ARG_ENABLE([kdc-lookaside-cache],
413*7f2fe78bSCy Schubert  AS_HELP_STRING([--disable-kdc-lookaside-cache],
414*7f2fe78bSCy Schubert    [Disable the cache which detects client retransmits]),
415*7f2fe78bSCy Schubert  [], [enableval=yes])
416*7f2fe78bSCy Schubertif test "$enableval" = no ; then
417*7f2fe78bSCy Schubert	AC_DEFINE(NOCACHE,1,[Define if the KDC should use no lookaside cache])
418*7f2fe78bSCy Schubertfi
419*7f2fe78bSCy SchubertKRB5_RUN_FLAGS
420*7f2fe78bSCy Schubert
421*7f2fe78bSCy Schubert# asan is a gcc and clang facility to instrument the code with memory
422*7f2fe78bSCy Schubert# error checking.  To use it, we compile C and C++ source files with
423*7f2fe78bSCy Schubert# -fsanitize=address, and set ASAN=yes to suppress the undefined
424*7f2fe78bSCy Schubert# symbols check when building shared libraries.
425*7f2fe78bSCy SchubertAC_ARG_ENABLE([asan],
426*7f2fe78bSCy Schubert  [AS_HELP_STRING([--enable-asan], [Build with asan memory checking])],
427*7f2fe78bSCy Schubert  [], [enable_asan=no])
428*7f2fe78bSCy Schubertif test "$enable_asan" != no; then
429*7f2fe78bSCy Schubert    if test "$enable_asan" = yes; then
430*7f2fe78bSCy Schubert        enable_asan=address
431*7f2fe78bSCy Schubert    fi
432*7f2fe78bSCy Schubert    ASAN_FLAGS="$DEFS -fsanitize=$enable_asan"
433*7f2fe78bSCy Schubert    ASAN=yes
434*7f2fe78bSCy Schubert    UNDEF_CHECK=
435*7f2fe78bSCy Schubertelse
436*7f2fe78bSCy Schubert    ASAN_FLAGS=
437*7f2fe78bSCy Schubert    ASAN=no
438*7f2fe78bSCy Schubertfi
439*7f2fe78bSCy SchubertAC_SUBST(ASAN_FLAGS)
440*7f2fe78bSCy SchubertAC_SUBST(ASAN)
441*7f2fe78bSCy Schubert
442*7f2fe78bSCy Schubert# from old include/configure.in
443*7f2fe78bSCy SchubertAH_TEMPLATE([HAVE_STRUCT_SOCKADDR_STORAGE],
444*7f2fe78bSCy Schubert[Define if "struct sockaddr_storage" is available.])
445*7f2fe78bSCy Schubert
446*7f2fe78bSCy SchubertAC_CONFIG_HEADERS(include/autoconf.h, [echo timestamp > include/autoconf.stamp])
447*7f2fe78bSCy SchubertAC_C_CONST
448*7f2fe78bSCy SchubertAC_HEADER_DIRENT
449*7f2fe78bSCy SchubertAC_FUNC_STRERROR_R
450*7f2fe78bSCy SchubertAC_CHECK_FUNCS(strdup setvbuf seteuid setresuid setreuid setegid setresgid setregid setsid flock fchmod chmod strptime geteuid setenv unsetenv getenv gmtime_r localtime_r bswap16 bswap64 mkstemp getusershell access getcwd srand48 srand srandom stat strchr strerror timegm explicit_bzero explicit_memset getresuid getresgid)
451*7f2fe78bSCy Schubert
452*7f2fe78bSCy SchubertAC_CHECK_FUNC(mkstemp,
453*7f2fe78bSCy Schubert[MKSTEMP_ST_OBJ=
454*7f2fe78bSCy SchubertMKSTEMP_OBJ=],
455*7f2fe78bSCy Schubert[MKSTEMP_ST_OBJ='mkstemp.o'
456*7f2fe78bSCy SchubertMKSTEMP_OBJ='$(OUTPRE)mkstemp.$(OBJEXT)'
457*7f2fe78bSCy SchubertEXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_mkstemp"])
458*7f2fe78bSCy SchubertAC_SUBST(MKSTEMP_OBJ)
459*7f2fe78bSCy SchubertAC_SUBST(MKSTEMP_ST_OBJ)
460*7f2fe78bSCy Schubert
461*7f2fe78bSCy SchubertAC_CHECK_FUNC(gettimeofday,
462*7f2fe78bSCy Schubert	[GETTIMEOFDAY_ST_OBJ=
463*7f2fe78bSCy Schubert	GETTIMEOFDAY_OBJ=
464*7f2fe78bSCy Schubert	AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Have the gettimeofday function])
465*7f2fe78bSCy Schubert],
466*7f2fe78bSCy Schubert	[GETTIMEOFDAY_ST_OBJ='gettimeofday.o'
467*7f2fe78bSCy Schubert	GETTIMEOFDAY_OBJ='$(OUTPRE)gettimeofday.$(OBJEXT)'
468*7f2fe78bSCy Schubert	EXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_gettimeofday"])
469*7f2fe78bSCy SchubertAC_SUBST(GETTIMEOFDAY_OBJ)
470*7f2fe78bSCy SchubertAC_SUBST(GETTIMEOFDAY_ST_OBJ)
471*7f2fe78bSCy SchubertAC_SUBST(EXTRA_SUPPORT_SYMS)
472*7f2fe78bSCy Schubert
473*7f2fe78bSCy SchubertDECLARE_SYS_ERRLIST
474*7f2fe78bSCy SchubertAC_CHECK_HEADERS(unistd.h paths.h regex.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h byteswap.h machine/endian.h machine/byte_order.h sys/bswap.h endian.h pwd.h arpa/inet.h alloca.h dlfcn.h limits.h)
475*7f2fe78bSCy SchubertAC_CHECK_HEADER(regexp.h, [], [],
476*7f2fe78bSCy Schubert[#define INIT char *sp = instring;
477*7f2fe78bSCy Schubert#define GETC() (*sp++)
478*7f2fe78bSCy Schubert#define PEEKC() (*sp)
479*7f2fe78bSCy Schubert#define UNGETC(c) (--sp)
480*7f2fe78bSCy Schubert#define RETURN(c) return(c)
481*7f2fe78bSCy Schubert#define ERROR(c)
482*7f2fe78bSCy Schubert])
483*7f2fe78bSCy SchubertAC_CHECK_MEMBERS([struct stat.st_mtimensec,struct stat.st_mtimespec.tv_nsec,struct stat.st_mtim.tv_nsec],,,[#include <sys/types.h>
484*7f2fe78bSCy Schubert#include <sys/stat.h>])
485*7f2fe78bSCy SchubertKRB5_AC_REGEX_FUNCS
486*7f2fe78bSCy SchubertAC_TYPE_OFF_T
487*7f2fe78bSCy Schubert
488*7f2fe78bSCy Schubert# Fancy caching of perror result...
489*7f2fe78bSCy SchubertAC_MSG_CHECKING(for perror declaration)
490*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_decl_perror,
491*7f2fe78bSCy Schubert[AC_EGREP_HEADER(perror, errno.h,
492*7f2fe78bSCy Schubert  krb5_cv_decl_perror=yes, krb5_cv_decl_perror=no)])
493*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_decl_perror)
494*7f2fe78bSCy Schubertif test $krb5_cv_decl_perror = yes; then
495*7f2fe78bSCy Schubert	AC_DEFINE(HDR_HAS_PERROR,1,[Define if errno.h declares perror])
496*7f2fe78bSCy Schubertfi
497*7f2fe78bSCy Schubert
498*7f2fe78bSCy SchubertKRB5_NEED_PROTO([#include <time.h>],strptime)
499*7f2fe78bSCy SchubertCHECK_WAIT_TYPE
500*7f2fe78bSCy SchubertCHECK_SIGPROCMASK
501*7f2fe78bSCy SchubertAC_TYPE_GETGROUPS
502*7f2fe78bSCy SchubertCHECK_SETJMP
503*7f2fe78bSCy Schubert
504*7f2fe78bSCy Schubert# *rpcent return types needed for lib/rpc
505*7f2fe78bSCy Schubert
506*7f2fe78bSCy SchubertAC_MSG_CHECKING([return type of setrpcent])
507*7f2fe78bSCy SchubertAC_CACHE_VAL(k5_cv_type_setrpcent,
508*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
509*7f2fe78bSCy Schubert  [AC_LANG_SOURCE([[#include <netdb.h>
510*7f2fe78bSCy Schubert                    extern void setrpcent();]])],
511*7f2fe78bSCy Schubert  [k5_cv_type_setrpcent=void],
512*7f2fe78bSCy Schubert  [k5_cv_type_setrpcent=int])])
513*7f2fe78bSCy SchubertAC_MSG_RESULT($k5_cv_type_setrpcent)
514*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(SETRPCENT_TYPE, $k5_cv_type_setrpcent, [Define as return type of setrpcent])
515*7f2fe78bSCy Schubert
516*7f2fe78bSCy SchubertAC_MSG_CHECKING([return type of endrpcent])
517*7f2fe78bSCy SchubertAC_CACHE_VAL(k5_cv_type_endrpcent,
518*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
519*7f2fe78bSCy Schubert  [AC_LANG_SOURCE(
520*7f2fe78bSCy Schubert    [[#include <netdb.h>
521*7f2fe78bSCy Schubert      extern void endrpcent();]])],
522*7f2fe78bSCy Schubert  [k5_cv_type_endrpcent=void], [k5_cv_type_endrpcent=int])])
523*7f2fe78bSCy SchubertAC_MSG_RESULT($k5_cv_type_endrpcent)
524*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(ENDRPCENT_TYPE, $k5_cv_type_endrpcent, [Define as return type of endrpcent])
525*7f2fe78bSCy Schubert
526*7f2fe78bSCy Schubert
527*7f2fe78bSCy Schubert# bswap_16 is a macro in byteswap.h under GNU libc
528*7f2fe78bSCy SchubertAC_MSG_CHECKING(for bswap_16)
529*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_bswap_16,
530*7f2fe78bSCy Schubert[AC_LINK_IFELSE(
531*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
532*7f2fe78bSCy Schubert    [[#if HAVE_BYTESWAP_H
533*7f2fe78bSCy Schubert      #include <byteswap.h>
534*7f2fe78bSCy Schubert      #endif
535*7f2fe78bSCy Schubert    ]],
536*7f2fe78bSCy Schubert    [[bswap_16(37);]])],
537*7f2fe78bSCy Schubert  [krb5_cv_bswap_16=yes], [krb5_cv_bswap_16=no])])
538*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_bswap_16)
539*7f2fe78bSCy Schubertif test "$krb5_cv_bswap_16" = yes; then
540*7f2fe78bSCy Schubert  AC_DEFINE(HAVE_BSWAP_16,1,[Define to 1 if bswap_16 is available via byteswap.h])
541*7f2fe78bSCy Schubertfi
542*7f2fe78bSCy SchubertAC_MSG_CHECKING(for bswap_64)
543*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_bswap_64,
544*7f2fe78bSCy Schubert[AC_LINK_IFELSE(
545*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
546*7f2fe78bSCy Schubert    [[#if HAVE_BYTESWAP_H
547*7f2fe78bSCy Schubert      #include <byteswap.h>
548*7f2fe78bSCy Schubert      #endif
549*7f2fe78bSCy Schubert    ]],
550*7f2fe78bSCy Schubert    [[bswap_64(37);]])],
551*7f2fe78bSCy Schubert  [krb5_cv_bswap_64=yes], [krb5_cv_bswap_64=no])])
552*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_bswap_64)
553*7f2fe78bSCy Schubertif test "$krb5_cv_bswap_64" = yes; then
554*7f2fe78bSCy Schubert  AC_DEFINE(HAVE_BSWAP_64,1,[Define to 1 if bswap_64 is available via byteswap.h])
555*7f2fe78bSCy Schubertfi
556*7f2fe78bSCy Schubert
557*7f2fe78bSCy Schubert# Needed for ksu and some appl stuff.
558*7f2fe78bSCy Schubert
559*7f2fe78bSCy Schubertcase $krb5_cv_host in
560*7f2fe78bSCy Schubertalpha*-dec-osf*)
561*7f2fe78bSCy Schubert	AC_CHECK_LIB(security,setluid,
562*7f2fe78bSCy Schubert		AC_DEFINE(HAVE_SETLUID,1,[Define if setluid provided in OSF/1 security library])
563*7f2fe78bSCy Schubert		KSU_LIBS="-lsecurity"
564*7f2fe78bSCy Schubert	)
565*7f2fe78bSCy Schubert	;;
566*7f2fe78bSCy Schubertesac
567*7f2fe78bSCy SchubertAC_SUBST(KSU_LIBS)
568*7f2fe78bSCy Schubert
569*7f2fe78bSCy Schubertif test $ac_cv_func_setenv = no || test $ac_cv_func_unsetenv = no \
570*7f2fe78bSCy Schubert  || test $ac_cv_func_getenv = no; then
571*7f2fe78bSCy Schubert  SETENVOBJ=setenv.o
572*7f2fe78bSCy Schubertelse
573*7f2fe78bSCy Schubert  SETENVOBJ=
574*7f2fe78bSCy Schubertfi
575*7f2fe78bSCy SchubertAC_SUBST(SETENVOBJ)
576*7f2fe78bSCy Schubert
577*7f2fe78bSCy Schubert# Check what the return types for gethostbyname_r and getservbyname_r are.
578*7f2fe78bSCy Schubert
579*7f2fe78bSCy SchubertAC_CHECK_FUNC(gethostbyname_r,[
580*7f2fe78bSCy Schubertac_cv_func_gethostbyname_r=yes
581*7f2fe78bSCy Schubertif test "$ac_cv_func_gethostbyname_r" = yes; then
582*7f2fe78bSCy Schubert  AC_MSG_CHECKING([if gethostbyname_r returns an int])
583*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_gethostbyname_r_returns_int,
584*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
585*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
586*7f2fe78bSCy Schubert      [[#include <netdb.h>
587*7f2fe78bSCy Schubert        extern int gethostbyname_r();]])],
588*7f2fe78bSCy Schubert    [krb5_cv_gethostbyname_r_returns_int=yes],
589*7f2fe78bSCy Schubert    [krb5_cv_gethostbyname_r_returns_int=no])])
590*7f2fe78bSCy Schubert  AC_MSG_RESULT($krb5_cv_gethostbyname_r_returns_int)
591*7f2fe78bSCy Schubert
592*7f2fe78bSCy Schubert  AC_MSG_CHECKING([if gethostbyname_r returns a pointer])
593*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_gethostbyname_r_returns_ptr,
594*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
595*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
596*7f2fe78bSCy Schubert      [[#include <netdb.h>
597*7f2fe78bSCy Schubert        extern struct hostent *gethostbyname_r();]])],
598*7f2fe78bSCy Schubert    [krb5_cv_gethostbyname_r_returns_ptr=yes],
599*7f2fe78bSCy Schubert    [krb5_cv_gethostbyname_r_returns_ptr=no])])
600*7f2fe78bSCy Schubert  AC_MSG_RESULT($krb5_cv_gethostbyname_r_returns_ptr)
601*7f2fe78bSCy Schubert
602*7f2fe78bSCy Schubert  if test "$krb5_cv_gethostbyname_r_returns_int" = "$krb5_cv_gethostbyname_r_returns_ptr"; then
603*7f2fe78bSCy Schubert    AC_MSG_WARN(cannot determine return type of gethostbyname_r -- disabling)
604*7f2fe78bSCy Schubert    ac_cv_func_gethostbyname_r=no
605*7f2fe78bSCy Schubert  fi
606*7f2fe78bSCy Schubert  if test "$krb5_cv_gethostbyname_r_returns_int" = yes; then
607*7f2fe78bSCy Schubert    AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns int rather than struct hostent * ])
608*7f2fe78bSCy Schubert  fi
609*7f2fe78bSCy Schubertfi
610*7f2fe78bSCy Schubertif test "$ac_cv_func_gethostbyname_r" = yes; then
611*7f2fe78bSCy Schubert  AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1, [Define if gethostbyname_r exists and its return type is known])
612*7f2fe78bSCy Schubert  AC_CHECK_FUNC(gethostbyaddr_r)
613*7f2fe78bSCy Schubertfi
614*7f2fe78bSCy Schubert])
615*7f2fe78bSCy Schubert
616*7f2fe78bSCy Schubert
617*7f2fe78bSCy Schubert# PTHREAD_CFLAGS changes which variant of these functions is declared
618*7f2fe78bSCy Schubert# on Solaris 11, so use it for these tests.
619*7f2fe78bSCy Schubertold_CFLAGS=$CFLAGS
620*7f2fe78bSCy SchubertCFLAGS="$CFLAGS $PTHREAD_CFLAGS"
621*7f2fe78bSCy SchubertAC_CHECK_FUNC(getpwnam_r,ac_cv_func_getpwnam_r=yes,ac_cv_func_getpwnam_r=no)
622*7f2fe78bSCy SchubertAC_CHECK_FUNC(getpwuid_r,ac_cv_func_getpwuid_r=yes,ac_cv_func_getpwuid_r=no)
623*7f2fe78bSCy Schubertif test "$ac_cv_func_getpwnam_r" = yes; then
624*7f2fe78bSCy Schubert  AC_MSG_CHECKING([return type of getpwnam_r])
625*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_getpwnam_r_return_type,
626*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
627*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
628*7f2fe78bSCy Schubert      [[#include <pwd.h>
629*7f2fe78bSCy Schubert        extern int getpwnam_r();]])],
630*7f2fe78bSCy Schubert    [getpwnam_r_returns_int=yes], [getpwnam_r_returns_int=no])
631*7f2fe78bSCy Schubert   AC_COMPILE_IFELSE(
632*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
633*7f2fe78bSCy Schubert      [[#include <pwd.h>
634*7f2fe78bSCy Schubert        extern struct passwd *getpwnam_r();]])],
635*7f2fe78bSCy Schubert    [getpwnam_r_returns_ptr=yes], [getpwnam_r_returns_ptr=no])
636*7f2fe78bSCy Schubert   case "$getpwnam_r_returns_int/$getpwnam_r_returns_ptr" in
637*7f2fe78bSCy Schubert     yes/no) krb5_cv_getpwnam_r_return_type=int ;;
638*7f2fe78bSCy Schubert     no/yes) krb5_cv_getpwnam_r_return_type=ptr ;;
639*7f2fe78bSCy Schubert     *) krb5_cv_getpwnam_r_return_type=unknown ;;
640*7f2fe78bSCy Schubert   esac])
641*7f2fe78bSCy Schubert  AC_MSG_RESULT($krb5_cv_getpwnam_r_return_type)
642*7f2fe78bSCy Schubert  if test $krb5_cv_getpwnam_r_return_type = int; then
643*7f2fe78bSCy Schubert    AC_DEFINE(GETPWNAM_R_RETURNS_INT, 1, [Define if getpwnam_r returns an int])
644*7f2fe78bSCy Schubert  elif test $krb5_cv_getpwnam_r_return_type = unknown; then
645*7f2fe78bSCy Schubert    AC_MSG_WARN([Cannot determine getpwnam_r return type, disabling getpwnam_r])
646*7f2fe78bSCy Schubert    ac_cv_func_getpwnam_r=no
647*7f2fe78bSCy Schubert  fi
648*7f2fe78bSCy Schubertfi
649*7f2fe78bSCy Schubertif test "$ac_cv_func_getpwnam_r" = yes; then
650*7f2fe78bSCy Schubert  AC_MSG_CHECKING([number of arguments to getpwnam_r])
651*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_getpwnam_r_args,
652*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
653*7f2fe78bSCy Schubert    [AC_LANG_PROGRAM(
654*7f2fe78bSCy Schubert      [[#include <pwd.h>
655*7f2fe78bSCy Schubert        struct passwd pwx; char buf[1024];]],
656*7f2fe78bSCy Schubert      [[getpwnam_r("", &pwx, buf, sizeof(buf));]])],
657*7f2fe78bSCy Schubert    [args4=yes], [args4=no])
658*7f2fe78bSCy Schubert   AC_COMPILE_IFELSE(
659*7f2fe78bSCy Schubert     [AC_LANG_PROGRAM(
660*7f2fe78bSCy Schubert       [[#include <pwd.h>
661*7f2fe78bSCy Schubert         struct passwd pwx, *p;
662*7f2fe78bSCy Schubert         char buf[1024];]],
663*7f2fe78bSCy Schubert       [[getpwnam_r("", &pwx, buf, sizeof(buf), &p);]])],
664*7f2fe78bSCy Schubert     [args5=yes], [args5=no])
665*7f2fe78bSCy Schubert   case $args4/$args5 in
666*7f2fe78bSCy Schubert     yes/no) krb5_cv_getpwnam_r_args=4 ;;
667*7f2fe78bSCy Schubert     no/yes) krb5_cv_getpwnam_r_args=5 ;;
668*7f2fe78bSCy Schubert     *) krb5_cv_getpwnam_r_args=unknown ;;
669*7f2fe78bSCy Schubert   esac])
670*7f2fe78bSCy Schubert  AC_MSG_RESULT($krb5_cv_getpwnam_r_args)
671*7f2fe78bSCy Schubert  if test "$krb5_cv_getpwnam_r_args" = unknown; then
672*7f2fe78bSCy Schubert    AC_MSG_WARN([Cannot determine number of arguments to getpwnam_r, disabling its use.])
673*7f2fe78bSCy Schubert    ac_cv_func_getpwnam_r=no
674*7f2fe78bSCy Schubert  else
675*7f2fe78bSCy Schubert    AC_DEFINE(HAVE_GETPWNAM_R,1,[Define if getpwnam_r is available and useful.])
676*7f2fe78bSCy Schubert    if test "$krb5_cv_getpwnam_r_args" = 4; then
677*7f2fe78bSCy Schubert      AC_DEFINE(GETPWNAM_R_4_ARGS,1,[Define if getpwnam_r exists but takes only 4 arguments (e.g., POSIX draft 6 implementations like some Solaris releases).])
678*7f2fe78bSCy Schubert    fi
679*7f2fe78bSCy Schubert  fi
680*7f2fe78bSCy Schubertfi
681*7f2fe78bSCy SchubertCFLAGS=$old_CFLAGS
682*7f2fe78bSCy Schubert
683*7f2fe78bSCy Schubertif test "$ac_cv_func_getpwnam_r" = no && test "$ac_cv_func_getpwuid_r" = yes; then
684*7f2fe78bSCy Schubert  # Actually, we could do this check, and the corresponding checks
685*7f2fe78bSCy Schubert  # for return type and number of arguments, but I doubt we'll run
686*7f2fe78bSCy Schubert  # into a system where we'd get to use getpwuid_r but not getpwnam_r.
687*7f2fe78bSCy Schubert  AC_MSG_NOTICE([getpwnam_r not useful, so disabling getpwuid_r too])
688*7f2fe78bSCy Schubert  ac_cv_func_getpwuid_r=no
689*7f2fe78bSCy Schubertfi
690*7f2fe78bSCy Schubertif test "$ac_cv_func_getpwuid_r" = yes; then
691*7f2fe78bSCy Schubert  AC_DEFINE(HAVE_GETPWUID_R,1,[Define if getpwuid_r is available and useful.])
692*7f2fe78bSCy Schubert  # Hack: Assume getpwuid_r is the shorter form if getpwnam_r is.
693*7f2fe78bSCy Schubert  if test "$krb5_cv_getpwnam_r_args" = 4; then
694*7f2fe78bSCy Schubert    AC_DEFINE(GETPWUID_R_4_ARGS,1,[Define if getpwuid_r exists but takes only 4 arguments (e.g., POSIX draft 6 implementations like some Solaris releases).])
695*7f2fe78bSCy Schubert  fi
696*7f2fe78bSCy Schubertfi
697*7f2fe78bSCy Schubert
698*7f2fe78bSCy Schubertif test "$ac_cv_func_gmtime_r" = yes; then
699*7f2fe78bSCy Schubert  AC_MSG_CHECKING([whether gmtime_r returns int])
700*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_gmtime_r_returns_int,
701*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
702*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
703*7f2fe78bSCy Schubert      [[#include <time.h>
704*7f2fe78bSCy Schubert        extern int gmtime_r();]])],
705*7f2fe78bSCy Schubert    [return_int=yes], [return_int=no])
706*7f2fe78bSCy Schubert   AC_COMPILE_IFELSE([
707*7f2fe78bSCy Schubert     AC_LANG_SOURCE(
708*7f2fe78bSCy Schubert       [[#include <time.h>
709*7f2fe78bSCy Schubert         extern struct tm *gmtime_r();]])],
710*7f2fe78bSCy Schubert     [return_ptr=yes], [return_ptr=no])
711*7f2fe78bSCy Schubert   case $return_int/$return_ptr in
712*7f2fe78bSCy Schubert     yes/no) krb5_cv_gmtime_r_returns_int=yes ;;
713*7f2fe78bSCy Schubert     no/yes) krb5_cv_gmtime_r_returns_int=no ;;
714*7f2fe78bSCy Schubert     *)      # Can't figure it out, punt the function.
715*7f2fe78bSCy Schubert             ac_cv_func_gmtime_r=no ;;
716*7f2fe78bSCy Schubert   esac])
717*7f2fe78bSCy Schubert  if test "$ac_cv_func_gmtime_r" = no; then
718*7f2fe78bSCy Schubert    AC_MSG_RESULT(unknown -- ignoring gmtime_r)
719*7f2fe78bSCy Schubert  else
720*7f2fe78bSCy Schubert    AC_MSG_RESULT($krb5_cv_gmtime_r_returns_int)
721*7f2fe78bSCy Schubert    if test "$krb5_cv_gmtime_r_returns_int" = yes; then
722*7f2fe78bSCy Schubert      AC_DEFINE(GMTIME_R_RETURNS_INT,1,[Define if gmtime_r returns int instead of struct tm pointer, as on old HP-UX systems.])
723*7f2fe78bSCy Schubert    fi
724*7f2fe78bSCy Schubert  fi
725*7f2fe78bSCy Schubertfi
726*7f2fe78bSCy Schubert
727*7f2fe78bSCy SchubertAC_CHECK_FUNC(getservbyname_r,[
728*7f2fe78bSCy Schubertac_cv_func_getservbyname_r=yes
729*7f2fe78bSCy Schubertif test "$ac_cv_func_getservbyname_r" = yes; then
730*7f2fe78bSCy Schubert  AC_MSG_CHECKING([if getservbyname_r returns an int])
731*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_getservbyname_r_returns_int,
732*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
733*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
734*7f2fe78bSCy Schubert      [[#include <netdb.h>
735*7f2fe78bSCy Schubert        extern int getservbyname_r();]])],
736*7f2fe78bSCy Schubert    [krb5_cv_getservbyname_r_returns_int=yes],
737*7f2fe78bSCy Schubert    [krb5_cv_getservbyname_r_returns_int=no])])
738*7f2fe78bSCy Schubert  AC_MSG_RESULT($krb5_cv_getservbyname_r_returns_int)
739*7f2fe78bSCy Schubert
740*7f2fe78bSCy Schubert  AC_MSG_CHECKING([if getservbyname_r returns a pointer])
741*7f2fe78bSCy Schubert  AC_CACHE_VAL(krb5_cv_getservbyname_r_returns_ptr,
742*7f2fe78bSCy Schubert  [AC_COMPILE_IFELSE(
743*7f2fe78bSCy Schubert    [AC_LANG_SOURCE(
744*7f2fe78bSCy Schubert      [[#include <netdb.h>
745*7f2fe78bSCy Schubert        extern struct servent *getservbyname_r();]])],
746*7f2fe78bSCy Schubert    [krb5_cv_getservbyname_r_returns_ptr=yes],
747*7f2fe78bSCy Schubert    [krb5_cv_getservbyname_r_returns_ptr=no])])
748*7f2fe78bSCy Schubert  AC_MSG_RESULT($krb5_cv_getservbyname_r_returns_ptr)
749*7f2fe78bSCy Schubert
750*7f2fe78bSCy Schubert  if test "$krb5_cv_getservbyname_r_returns_int" = "$krb5_cv_getservbyname_r_returns_ptr"; then
751*7f2fe78bSCy Schubert    AC_MSG_WARN(cannot determine return type of getservbyname_r -- disabling)
752*7f2fe78bSCy Schubert    ac_cv_func_getservbyname_r=no
753*7f2fe78bSCy Schubert  fi
754*7f2fe78bSCy Schubert  if test "$krb5_cv_getservbyname_r_returns_int" = yes; then
755*7f2fe78bSCy Schubert    AC_DEFINE(GETSERVBYNAME_R_RETURNS_INT, 1, [Define if getservbyname_r returns int rather than struct servent * ])
756*7f2fe78bSCy Schubert  fi
757*7f2fe78bSCy Schubertfi
758*7f2fe78bSCy Schubertif test "$ac_cv_func_getservbyname_r" = yes; then
759*7f2fe78bSCy Schubert  AC_DEFINE(HAVE_GETSERVBYNAME_R, 1, [Define if getservbyname_r exists and its return type is known])
760*7f2fe78bSCy Schubert  AC_CHECK_FUNC(getservbyport_r)
761*7f2fe78bSCy Schubertfi
762*7f2fe78bSCy Schubert])
763*7f2fe78bSCy Schubert
764*7f2fe78bSCy SchubertCHECK_DIRENT
765*7f2fe78bSCy SchubertAC_TYPE_UID_T
766*7f2fe78bSCy Schubert
767*7f2fe78bSCy SchubertAC_CHECK_HEADER(termios.h,
768*7f2fe78bSCy Schubert[AC_CHECK_FUNC([tcsetattr],
769*7f2fe78bSCy Schubert  AC_DEFINE(POSIX_TERMIOS,1,[Define if termios.h exists and tcsetattr exists]))])
770*7f2fe78bSCy Schubert
771*7f2fe78bSCy SchubertAC_CHECK_HEADERS(poll.h stdlib.h string.h stddef.h sys/types.h sys/file.h sys/param.h sys/stat.h sys/time.h netinet/in.h sys/uio.h sys/filio.h sys/select.h time.h paths.h errno.h)
772*7f2fe78bSCy Schubert
773*7f2fe78bSCy Schubert# If compiling with IPv6 support, test if in6addr_any functions.
774*7f2fe78bSCy Schubert# Irix 6.5.16 defines it, but lacks support in the C library.
775*7f2fe78bSCy Schubertif test $krb5_cv_inet6 = yes || test "$krb5_cv_inet6_with_dinet6" = yes ; then
776*7f2fe78bSCy Schubert  AC_CACHE_CHECK([for in6addr_any definition in library],
777*7f2fe78bSCy Schubert  [krb5_cv_var_in6addr_any],
778*7f2fe78bSCy Schubert  [AC_LINK_IFELSE(
779*7f2fe78bSCy Schubert    [AC_LANG_PROGRAM(
780*7f2fe78bSCy Schubert      [[#ifdef HAVE_SYS_TYPES_H
781*7f2fe78bSCy Schubert        #include <sys/types.h>
782*7f2fe78bSCy Schubert        #endif
783*7f2fe78bSCy Schubert        #include <sys/socket.h>
784*7f2fe78bSCy Schubert        #include <netinet/in.h>
785*7f2fe78bSCy Schubert        #include <netdb.h>
786*7f2fe78bSCy Schubert        #include <stdio.h>
787*7f2fe78bSCy Schubert      ]],
788*7f2fe78bSCy Schubert      [[struct sockaddr_in6 in;
789*7f2fe78bSCy Schubert        in.sin6_addr = in6addr_any;
790*7f2fe78bSCy Schubert        printf("%x", &in);]])],
791*7f2fe78bSCy Schubert    [krb5_cv_var_in6addr_any=yes], [krb5_cv_var_in6addr_any=no])])
792*7f2fe78bSCy Schubert  if test $krb5_cv_var_in6addr_any = no; then
793*7f2fe78bSCy Schubert    AC_DEFINE(NEED_INSIXADDR_ANY,1,[Define if in6addr_any is not defined in libc])
794*7f2fe78bSCy Schubert  fi
795*7f2fe78bSCy Schubertfi
796*7f2fe78bSCy Schubert
797*7f2fe78bSCy Schubert# then from osconf.h, we have
798*7f2fe78bSCy Schubert
799*7f2fe78bSCy SchubertAC_CHECK_TYPE(time_t, long)
800*7f2fe78bSCy SchubertAC_CHECK_SIZEOF(time_t)
801*7f2fe78bSCy SchubertSIZEOF_TIME_T=$ac_cv_sizeof_time_t
802*7f2fe78bSCy SchubertAC_SUBST(SIZEOF_TIME_T)
803*7f2fe78bSCy Schubert
804*7f2fe78bSCy Schubert# Determine where to put the replay cache.
805*7f2fe78bSCy Schubert
806*7f2fe78bSCy SchubertAC_MSG_CHECKING([for replay cache directory])
807*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_sys_rcdir,
808*7f2fe78bSCy Schubert[
809*7f2fe78bSCy Schubertif test $cross_compiling = yes; then
810*7f2fe78bSCy Schubert	krb5_cv_sys_rcdir=/var/tmp
811*7f2fe78bSCy Schubertelse
812*7f2fe78bSCy Schubert	for t_dir in /var/tmp /usr/tmp /var/usr/tmp /tmp ; do
813*7f2fe78bSCy Schubert		test -d $t_dir || continue
814*7f2fe78bSCy Schubert		krb5_cv_sys_rcdir=$t_dir
815*7f2fe78bSCy Schubert		break
816*7f2fe78bSCy Schubert	done
817*7f2fe78bSCy Schubertfi])
818*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_sys_rcdir)
819*7f2fe78bSCy SchubertKRB5_RCTMPDIR=$krb5_cv_sys_rcdir
820*7f2fe78bSCy SchubertAC_SUBST(KRB5_RCTMPDIR)
821*7f2fe78bSCy Schubert
822*7f2fe78bSCy Schubert
823*7f2fe78bSCy SchubertAC_MSG_CHECKING(for socklen_t)
824*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_has_type_socklen_t,
825*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
826*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
827*7f2fe78bSCy Schubert    [[#include <sys/types.h>
828*7f2fe78bSCy Schubert      #include <sys/socket.h>
829*7f2fe78bSCy Schubert    ]],
830*7f2fe78bSCy Schubert    [[sizeof(socklen_t);]])],
831*7f2fe78bSCy Schubert  [krb5_cv_has_type_socklen_t=yes], [krb5_cv_has_type_socklen_t=no])])
832*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_has_type_socklen_t)
833*7f2fe78bSCy Schubertif test $krb5_cv_has_type_socklen_t = yes; then
834*7f2fe78bSCy Schubert    AC_DEFINE(HAVE_SOCKLEN_T,1,[Define if there is a socklen_t type. If not, probably use size_t])
835*7f2fe78bSCy Schubertfi
836*7f2fe78bSCy Schubert
837*7f2fe78bSCy SchubertAC_MSG_CHECKING(for struct lifconf)
838*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_has_struct_lifconf,
839*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
840*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
841*7f2fe78bSCy Schubert    [[#include <sys/socket.h>
842*7f2fe78bSCy Schubert      #include <net/if.h>
843*7f2fe78bSCy Schubert    ]],
844*7f2fe78bSCy Schubert    [[sizeof (struct lifconf);]])],
845*7f2fe78bSCy Schubert  [krb5_cv_has_struct_lifconf=yes], [krb5_cv_has_struct_lifconf=no])])
846*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_has_struct_lifconf)
847*7f2fe78bSCy Schubertif test $krb5_cv_has_struct_lifconf = yes; then
848*7f2fe78bSCy Schubert    AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
849*7f2fe78bSCy Schubertfi
850*7f2fe78bSCy Schubert# HP-UX 11 uses stuct if_laddrconf
851*7f2fe78bSCy SchubertAC_MSG_CHECKING(for struct if_laddrconf)
852*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_has_struct_if_laddrconf,
853*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
854*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
855*7f2fe78bSCy Schubert    [[#include <sys/socket.h>
856*7f2fe78bSCy Schubert      #include <net/if.h>
857*7f2fe78bSCy Schubert      #include <net/if6.h>
858*7f2fe78bSCy Schubert    ]],
859*7f2fe78bSCy Schubert    [[sizeof(struct if_laddrconf);]])],
860*7f2fe78bSCy Schubert  [krb5_cv_has_struct_if_laddrconf=yes],
861*7f2fe78bSCy Schubert  [krb5_cv_has_struct_if_laddrconf=no])])
862*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_has_struct_if_laddrconf)
863*7f2fe78bSCy Schubertif test $krb5_cv_has_struct_if_laddrconf = yes; then
864*7f2fe78bSCy Schubert    AC_DEFINE(HAVE_STRUCT_IF_LADDRCONF,1,[Define if there is a struct if_laddrconf.])
865*7f2fe78bSCy Schubertfi
866*7f2fe78bSCy Schubert
867*7f2fe78bSCy Schubert
868*7f2fe78bSCy SchubertAC_MSG_CHECKING([for h_errno in netdb.h])
869*7f2fe78bSCy SchubertAC_CACHE_VAL(krb5_cv_header_netdb_h_h_errno,
870*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
871*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
872*7f2fe78bSCy Schubert    [[#include <netdb.h>]],
873*7f2fe78bSCy Schubert    [[int x = h_errno;]])],
874*7f2fe78bSCy Schubert    [krb5_cv_header_netdb_h_h_errno=yes],
875*7f2fe78bSCy Schubert    [krb5_cv_header_netdb_h_h_errno=no])])
876*7f2fe78bSCy SchubertAC_MSG_RESULT($krb5_cv_header_netdb_h_h_errno)
877*7f2fe78bSCy Schubertif test $krb5_cv_header_netdb_h_h_errno = yes; then
878*7f2fe78bSCy Schubert    AC_DEFINE([HAVE_NETDB_H_H_ERRNO], 1,
879*7f2fe78bSCy Schubert	[Define if netdb.h declares h_errno])
880*7f2fe78bSCy Schubertfi
881*7f2fe78bSCy Schubert
882*7f2fe78bSCy Schubert
883*7f2fe78bSCy SchubertAC_ARG_ENABLE([athena],
884*7f2fe78bSCy Schubert[  --enable-athena         build with MIT Project Athena configuration],
885*7f2fe78bSCy SchubertAC_DEFINE(KRB5_ATHENA_COMPAT,1,[Define if MIT Project Athena default configuration should be used]),)
886*7f2fe78bSCy Schubert
887*7f2fe78bSCy Schubert
888*7f2fe78bSCy SchubertAC_C_INLINE
889*7f2fe78bSCy SchubertAH_TOP([
890*7f2fe78bSCy Schubert#ifndef KRB5_AUTOCONF_H
891*7f2fe78bSCy Schubert#define KRB5_AUTOCONF_H
892*7f2fe78bSCy Schubert])
893*7f2fe78bSCy SchubertAH_BOTTOM([
894*7f2fe78bSCy Schubert#if defined(__GNUC__) && !defined(inline)
895*7f2fe78bSCy Schubert/* Silence gcc pedantic warnings about ANSI C.  */
896*7f2fe78bSCy Schubert# define inline __inline__
897*7f2fe78bSCy Schubert#endif
898*7f2fe78bSCy Schubert#endif /* KRB5_AUTOCONF_H */
899*7f2fe78bSCy Schubert])
900*7f2fe78bSCy Schubert
901*7f2fe78bSCy SchubertAC_CHECK_TYPES([struct cmsghdr, struct in_pktinfo, struct in6_pktinfo, struct sockaddr_storage], , , [
902*7f2fe78bSCy Schubert#include <sys/types.h>
903*7f2fe78bSCy Schubert#include <sys/socket.h>
904*7f2fe78bSCy Schubert#include <netinet/in.h>
905*7f2fe78bSCy Schubert])
906*7f2fe78bSCy SchubertAC_CHECK_TYPES([struct rt_msghdr], , , [
907*7f2fe78bSCy Schubert#include <sys/socket.h>
908*7f2fe78bSCy Schubert#include <net/if.h>
909*7f2fe78bSCy Schubert#include <net/route.h>
910*7f2fe78bSCy Schubert])
911*7f2fe78bSCy Schubert
912*7f2fe78bSCy Schubert# Tests for 64-bit edwards25519 code.
913*7f2fe78bSCy SchubertAC_CHECK_SIZEOF([size_t])
914*7f2fe78bSCy SchubertAC_CHECK_TYPES([__int128_t, __uint128_t])
915*7f2fe78bSCy Schubert
916*7f2fe78bSCy Schubert# types libdb2 wants
917*7f2fe78bSCy Schubert
918*7f2fe78bSCy SchubertAC_CHECK_TYPES([ssize_t, u_char, u_int, u_long, u_int8_t, u_int16_t, u_int32_t, int8_t, int16_t, int32_t])
919*7f2fe78bSCy Schubert
920*7f2fe78bSCy Schubert# Some libdb2 test programs want a shell that supports functions.
921*7f2fe78bSCy SchubertFCTSH=false
922*7f2fe78bSCy SchubertAC_PATH_PROG(SH,sh,false)
923*7f2fe78bSCy SchubertAC_PATH_PROG(SH5,sh5,false)
924*7f2fe78bSCy SchubertAC_PATH_PROG(BASH,bash,false)
925*7f2fe78bSCy Schubertfor prog in $SH $SH5 $BASH; do
926*7f2fe78bSCy Schubert  AC_MSG_CHECKING(if $prog supports functions)
927*7f2fe78bSCy Schubert  if $prog -c 'foo() { true; }; foo' >/dev/null 2>&1; then
928*7f2fe78bSCy Schubert    AC_MSG_RESULT(yes)
929*7f2fe78bSCy Schubert    FCTSH=$prog
930*7f2fe78bSCy Schubert    break
931*7f2fe78bSCy Schubert  else
932*7f2fe78bSCy Schubert    AC_MSG_RESULT(no)
933*7f2fe78bSCy Schubert  fi
934*7f2fe78bSCy Schubertdone
935*7f2fe78bSCy SchubertAC_SUBST(FCTSH)
936*7f2fe78bSCy Schubert
937*7f2fe78bSCy Schubert# Test for POSIX 2001 *printf support (X/Open System Interfaces extension
938*7f2fe78bSCy Schubert# to ANSI/ISO C 1999 specification).  Specifically, positional
939*7f2fe78bSCy Schubert# specifications; not checking for other features like %zx at present.
940*7f2fe78bSCy SchubertAC_MSG_CHECKING(for POSIX printf positional specification support)
941*7f2fe78bSCy SchubertAC_CACHE_VAL(ac_cv_printf_positional,
942*7f2fe78bSCy Schubert[AC_RUN_IFELSE(
943*7f2fe78bSCy Schubert  [AC_LANG_SOURCE(
944*7f2fe78bSCy Schubert    [[#include <stdio.h>
945*7f2fe78bSCy Schubert      #include <string.h>
946*7f2fe78bSCy Schubert      const char expected[] = "200 100";
947*7f2fe78bSCy Schubert      int main()
948*7f2fe78bSCy Schubert      {
949*7f2fe78bSCy Schubert          char buf[30];
950*7f2fe78bSCy Schubert          sprintf(buf, "%2\$x %1\$d", 100, 512);
951*7f2fe78bSCy Schubert          if (strcmp(expected, buf)) {
952*7f2fe78bSCy Schubert              fprintf(stderr, "bad result: <%s> wanted: <%s>\n",
953*7f2fe78bSCy Schubert                      buf, expected);
954*7f2fe78bSCy Schubert              return 1;
955*7f2fe78bSCy Schubert          }
956*7f2fe78bSCy Schubert          return 0;
957*7f2fe78bSCy Schubert      }]])],
958*7f2fe78bSCy Schubert  [ac_cv_printf_positional=yes], [ac_cv_printf_positional=no],
959*7f2fe78bSCy Schubert  [AC_MSG_ERROR(Cannot test for printf positional argument support when cross compiling)])])
960*7f2fe78bSCy Schubert# Nothing for autoconf.h for now.
961*7f2fe78bSCy SchubertAC_MSG_RESULT($ac_cv_printf_positional)
962*7f2fe78bSCy Schubert
963*7f2fe78bSCy Schubert
964*7f2fe78bSCy Schubert# for t_locate_kdc test
965*7f2fe78bSCy Schubert
966*7f2fe78bSCy SchubertAC_PATH_PROG(DIG, dig, false)
967*7f2fe78bSCy SchubertAC_PATH_PROG(NSLOOKUP, nslookup, false)
968*7f2fe78bSCy Schubert
969*7f2fe78bSCy Schubert# for kadmin
970*7f2fe78bSCy Schubert
971*7f2fe78bSCy SchubertAC_PROG_YACC
972*7f2fe78bSCy Schubertath_compat=
973*7f2fe78bSCy SchubertAC_ARG_ENABLE([athena],
974*7f2fe78bSCy Schubert[  --enable-athena         build with MIT Project Athena configuration],
975*7f2fe78bSCy Schubertath_compat=compat,)
976*7f2fe78bSCy Schubert
977*7f2fe78bSCy SchubertKRB5_AC_PRIOCNTL_HACK
978*7f2fe78bSCy Schubert
979*7f2fe78bSCy SchubertAC_CHECK_PROG(PERL,perl,perl)
980*7f2fe78bSCy Schubert
981*7f2fe78bSCy Schubert# lib/gssapi
982*7f2fe78bSCy SchubertAC_CHECK_HEADER(xom.h,[
983*7f2fe78bSCy Schubert	include_xom='awk '\''END{printf("%cinclude <xom.h>\n", 35);}'\'' < /dev/null'], [
984*7f2fe78bSCy Schubert	include_xom='echo "/* no xom.h */"'])
985*7f2fe78bSCy SchubertAC_SUBST(include_xom)
986*7f2fe78bSCy Schubert
987*7f2fe78bSCy Schubert
988*7f2fe78bSCy Schubert# lib/rpc
989*7f2fe78bSCy Schubert### Check where struct rpcent is declared.
990*7f2fe78bSCy Schubert
991*7f2fe78bSCy Schubert# This is necessary to determine:
992*7f2fe78bSCy Schubert# 1. If /usr/include/netdb.h declares struct rpcent
993*7f2fe78bSCy Schubert# 2. If /usr/include/rpc/netdb.h declares struct rpcent
994*7f2fe78bSCy Schubert
995*7f2fe78bSCy Schubert# We have our own rpc/netdb.h, and if /usr/include/netdb.h includes
996*7f2fe78bSCy Schubert# rpc/netdb.h, then nastiness could happen.
997*7f2fe78bSCy Schubert
998*7f2fe78bSCy Schubert# Logic: If /usr/include/netdb.h declares struct rpcent, then check
999*7f2fe78bSCy Schubert# rpc/netdb.h.  If /usr/include/rpc/netdb.h declares struct rpcent,
1000*7f2fe78bSCy Schubert# then define STRUCT_RPCENT_IN_RPC_NETDB_H, otherwise do not.  If
1001*7f2fe78bSCy Schubert# neither netdb.h nor rpc/netdb.h declares struct rpcent, then define
1002*7f2fe78bSCy Schubert# STRUCT_RPCENT_IN_RPC_NETDB_H anyway.
1003*7f2fe78bSCy Schubert
1004*7f2fe78bSCy SchubertAC_MSG_CHECKING([where struct rpcent is declared])
1005*7f2fe78bSCy SchubertAC_COMPILE_IFELSE(
1006*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
1007*7f2fe78bSCy Schubert    [[#include <netdb.h>
1008*7f2fe78bSCy Schubert    ]],
1009*7f2fe78bSCy Schubert    [[struct rpcent e;
1010*7f2fe78bSCy Schubert      char c = e.r_name[0];
1011*7f2fe78bSCy Schubert      int i = e.r_number;]])],
1012*7f2fe78bSCy Schubert    [netdb_rpcent=yes], [netdb_rpcent=no])
1013*7f2fe78bSCy Schubertif test "$netdb_rpcent" = yes; then
1014*7f2fe78bSCy Schubert  AC_COMPILE_IFELSE(
1015*7f2fe78bSCy Schubert    [AC_LANG_PROGRAM(
1016*7f2fe78bSCy Schubert      [[#include <rpc/netdb.h>
1017*7f2fe78bSCy Schubert      ]],
1018*7f2fe78bSCy Schubert      [[struct rpcent e;
1019*7f2fe78bSCy Schubert        char c = e.r_name[0];
1020*7f2fe78bSCy Schubert        int i = e.r_number;]])],
1021*7f2fe78bSCy Schubert    [rpc_netdb_rpcent=yes], [rpc_netdb_rpcent=no])
1022*7f2fe78bSCy Schubert  if test "$rpc_netdb_rpcent" = yes; then
1023*7f2fe78bSCy Schubert    AC_MSG_RESULT([rpc/netdb.h])
1024*7f2fe78bSCy Schubert    rpcent_define='#define STRUCT_RPCENT_IN_RPC_NETDB_H'
1025*7f2fe78bSCy Schubert  else
1026*7f2fe78bSCy Schubert    AC_MSG_RESULT([netdb.h])
1027*7f2fe78bSCy Schubert  fi
1028*7f2fe78bSCy Schubertelse
1029*7f2fe78bSCy Schubert  AC_MSG_RESULT([nowhere])
1030*7f2fe78bSCy Schubert  rpcent_define='#define STRUCT_RPCENT_IN_RPC_NETDB_H'
1031*7f2fe78bSCy Schubertfi
1032*7f2fe78bSCy SchubertAC_SUBST(rpcent_define)
1033*7f2fe78bSCy Schubert
1034*7f2fe78bSCy SchubertAC_CHECK_HEADERS(sys/select.h sys/time.h unistd.h)
1035*7f2fe78bSCy Schubertif test $ac_cv_header_sys_select_h = yes; then
1036*7f2fe78bSCy Schubert  GSSRPC__SYS_SELECT_H='#include <sys/select.h>'
1037*7f2fe78bSCy Schubertelse
1038*7f2fe78bSCy Schubert  GSSRPC__SYS_SELECT_H='/* #include <sys/select.h> */'
1039*7f2fe78bSCy Schubertfi
1040*7f2fe78bSCy SchubertAC_SUBST(GSSRPC__SYS_SELECT_H)
1041*7f2fe78bSCy Schubertif test $ac_cv_header_sys_time_h = yes; then
1042*7f2fe78bSCy Schubert  GSSRPC__SYS_TIME_H='#include <sys/time.h>'
1043*7f2fe78bSCy Schubertelse
1044*7f2fe78bSCy Schubert  GSSRPC__SYS_TIME_H='/* #include <sys/time.h> */'
1045*7f2fe78bSCy Schubertfi
1046*7f2fe78bSCy SchubertAC_SUBST(GSSRPC__SYS_TIME_H)
1047*7f2fe78bSCy Schubertif test $ac_cv_header_unistd_h = yes; then
1048*7f2fe78bSCy Schubert  GSSRPC__UNISTD_H='#include <unistd.h>'
1049*7f2fe78bSCy Schubertelse
1050*7f2fe78bSCy Schubert  GSSRPC__UNISTD_H='/* #include <unistd.h> */'
1051*7f2fe78bSCy Schubertfi
1052*7f2fe78bSCy SchubertAC_SUBST(GSSRPC__UNISTD_H)
1053*7f2fe78bSCy Schubert
1054*7f2fe78bSCy SchubertAC_CACHE_CHECK([for MAXHOSTNAMELEN in sys/param.h],
1055*7f2fe78bSCy Schubert[krb5_cv_header_sys_param_h_maxhostnamelen],
1056*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
1057*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
1058*7f2fe78bSCy Schubert    [[#include <sys/param.h>
1059*7f2fe78bSCy Schubert    ]],
1060*7f2fe78bSCy Schubert    [[int i = MAXHOSTNAMELEN;]])],
1061*7f2fe78bSCy Schubert    [krb5_cv_header_sys_param_h_maxhostnamelen=yes],
1062*7f2fe78bSCy Schubert    [krb5_cv_header_sys_param_h_maxhostnamelen=no])])
1063*7f2fe78bSCy SchubertAC_CACHE_CHECK([for MAXHOSTNAMELEN in netdb.h],
1064*7f2fe78bSCy Schubert[krb5_cv_header_netdb_h_maxhostnamelen],
1065*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
1066*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
1067*7f2fe78bSCy Schubert    [[#include <netdb.h>
1068*7f2fe78bSCy Schubert    ]],
1069*7f2fe78bSCy Schubert    [[int i = MAXHOSTNAMELEN;]])],
1070*7f2fe78bSCy Schubert    [krb5_cv_header_netdb_h_maxhostnamelen=yes],
1071*7f2fe78bSCy Schubert    [krb5_cv_header_netdb_h_maxhostnamelen=no])])
1072*7f2fe78bSCy Schubert
1073*7f2fe78bSCy SchubertGSSRPC__SYS_PARAM_H='/* #include <sys/param.h> */'
1074*7f2fe78bSCy SchubertGSSRPC__NETDB_H='/* #include <netdb.h> */'
1075*7f2fe78bSCy Schubertif test $krb5_cv_header_sys_param_h_maxhostnamelen = yes; then
1076*7f2fe78bSCy Schubert  GSSRPC__SYS_PARAM_H='#include <sys/param.h>'
1077*7f2fe78bSCy Schubertelse
1078*7f2fe78bSCy Schubert  if test $krb5_cv_header_netdb_h_maxhostnamelen = yes; then
1079*7f2fe78bSCy Schubert    GSSRPC__NETDB_H='#include <netdb.h>'
1080*7f2fe78bSCy Schubert  else
1081*7f2fe78bSCy Schubert    AC_MSG_WARN([can't find MAXHOSTNAMELEN definition; faking it])
1082*7f2fe78bSCy Schubert  fi
1083*7f2fe78bSCy Schubertfi
1084*7f2fe78bSCy SchubertAC_SUBST(GSSRPC__SYS_PARAM_H)
1085*7f2fe78bSCy SchubertAC_SUBST(GSSRPC__NETDB_H)
1086*7f2fe78bSCy Schubert
1087*7f2fe78bSCy SchubertAC_CACHE_CHECK([for BSD type aliases], [krb5_cv_type_bsdaliases],
1088*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
1089*7f2fe78bSCy Schubert  [AC_LANG_PROGRAM(
1090*7f2fe78bSCy Schubert    [[#include <sys/types.h>
1091*7f2fe78bSCy Schubert      #if HAVE_UNISTD_H
1092*7f2fe78bSCy Schubert      #include <unistd.h>
1093*7f2fe78bSCy Schubert      #endif
1094*7f2fe78bSCy Schubert    ]],
1095*7f2fe78bSCy Schubert    [[u_char c;
1096*7f2fe78bSCy Schubert      u_int i;
1097*7f2fe78bSCy Schubert      u_long l;]])],
1098*7f2fe78bSCy Schubert  [krb5_cv_type_bsdaliases=yes], [krb5_cv_type_bsdaliases=no])])
1099*7f2fe78bSCy Schubertif test $krb5_cv_type_bsdaliases = yes; then
1100*7f2fe78bSCy Schubert  GSSRPC__BSD_TYPEALIASES='/* #undef GSSRPC__BSD_TYPEALIASES */'
1101*7f2fe78bSCy Schubertelse
1102*7f2fe78bSCy Schubert  GSSRPC__BSD_TYPEALIASES='#define GSSRPC__BSD_TYPEALIASES 1'
1103*7f2fe78bSCy Schubertfi
1104*7f2fe78bSCy SchubertAC_SUBST(GSSRPC__BSD_TYPEALIASES)
1105*7f2fe78bSCy Schubert
1106*7f2fe78bSCy SchubertAC_MSG_CHECKING([return type of setrpcent])
1107*7f2fe78bSCy SchubertAC_CACHE_VAL(k5_cv_type_setrpcent,
1108*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
1109*7f2fe78bSCy Schubert  [AC_LANG_SOURCE(
1110*7f2fe78bSCy Schubert    [[#include <netdb.h>
1111*7f2fe78bSCy Schubert      extern void setrpcent();]])],
1112*7f2fe78bSCy Schubert  [k5_cv_type_setrpcent=void], [k5_cv_type_setrpcent=int])])
1113*7f2fe78bSCy SchubertAC_MSG_RESULT($k5_cv_type_setrpcent)
1114*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(SETRPCENT_TYPE, $k5_cv_type_setrpcent, [Define as return type of setrpcent])
1115*7f2fe78bSCy Schubert
1116*7f2fe78bSCy SchubertAC_MSG_CHECKING([return type of endrpcent])
1117*7f2fe78bSCy SchubertAC_CACHE_VAL(k5_cv_type_endrpcent,
1118*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE(
1119*7f2fe78bSCy Schubert  [AC_LANG_SOURCE(
1120*7f2fe78bSCy Schubert    [[#include <netdb.h>
1121*7f2fe78bSCy Schubert      extern void endrpcent();]])],
1122*7f2fe78bSCy Schubert  [k5_cv_type_endrpcent=void], [k5_cv_type_endrpcent=int])])
1123*7f2fe78bSCy SchubertAC_MSG_RESULT($k5_cv_type_endrpcent)
1124*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(ENDRPCENT_TYPE, $k5_cv_type_endrpcent, [Define as return type of endrpcent])
1125*7f2fe78bSCy SchubertK5_GEN_FILE(include/gssrpc/types.h:include/gssrpc/types.hin)
1126*7f2fe78bSCy Schubert
1127*7f2fe78bSCy Schubert# for pkinit
1128*7f2fe78bSCy SchubertAC_ARG_ENABLE([pkinit],
1129*7f2fe78bSCy Schubert[  --disable-pkinit        disable PKINIT plugin support],,
1130*7f2fe78bSCy Schubertenable_pkinit=try)
1131*7f2fe78bSCy Schubertif test "$enable_pkinit" = yes || test "$enable_pkinit" = try; then
1132*7f2fe78bSCy Schubert  AC_CACHE_CHECK(for a recent enough OpenSSL, k5_cv_openssl_version_okay,
1133*7f2fe78bSCy Schubert[AC_COMPILE_IFELSE([AC_LANG_SOURCE([#include <openssl/opensslv.h>
1134*7f2fe78bSCy Schubert#if OPENSSL_VERSION_NUMBER < 0x10000000L
1135*7f2fe78bSCy Schubert# error openssl is too old, need 1.0.0
1136*7f2fe78bSCy Schubert#endif
1137*7f2fe78bSCy Schubertint i = 1;
1138*7f2fe78bSCy Schubert])], k5_cv_openssl_version_okay=yes, k5_cv_openssl_version_okay=no)])
1139*7f2fe78bSCy Schubert  old_LIBS="$LIBS"
1140*7f2fe78bSCy Schubert  AC_CHECK_LIB(crypto, PKCS7_get_signer_info)
1141*7f2fe78bSCy Schubert  AC_CHECK_FUNCS(EVP_PKEY_get_bn_param)
1142*7f2fe78bSCy Schubert  LIBS="$old_LIBS"
1143*7f2fe78bSCy Schubertfi
1144*7f2fe78bSCy Schubertif test "$k5_cv_openssl_version_okay" = yes && (test "$enable_pkinit" = yes || test "$enable_pkinit" = try); then
1145*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(plugins/preauth/pkinit)
1146*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(tests/softpkcs11)
1147*7f2fe78bSCy Schubert  PKINIT=yes
1148*7f2fe78bSCy Schubertelif test "$k5_cv_openssl_version_okay" = no && test "$enable_pkinit" = yes; then
1149*7f2fe78bSCy Schubert  AC_MSG_ERROR([Version of OpenSSL is too old; cannot enable PKINIT.])
1150*7f2fe78bSCy Schubertelse
1151*7f2fe78bSCy Schubert  AC_DEFINE([DISABLE_PKINIT], 1, [Define to disable PKINIT plugin support])
1152*7f2fe78bSCy Schubert  AC_MSG_NOTICE([Disabling PKINIT support.])
1153*7f2fe78bSCy Schubert  PKINIT=no
1154*7f2fe78bSCy Schubertfi
1155*7f2fe78bSCy SchubertAC_SUBST(PKINIT)
1156*7f2fe78bSCy Schubert
1157*7f2fe78bSCy Schubert# for lib/apputils
1158*7f2fe78bSCy SchubertAC_REPLACE_FUNCS(daemon)
1159*7f2fe78bSCy Schubert
1160*7f2fe78bSCy Schubert# For Python tests.  Python version 3.2.4 is required as prior
1161*7f2fe78bSCy Schubert# versions do not accept string input to subprocess.Popen.communicate
1162*7f2fe78bSCy Schubert# when universal_newlines is set.
1163*7f2fe78bSCy SchubertPYTHON_MINVERSION=3.2.4
1164*7f2fe78bSCy SchubertAC_SUBST(PYTHON_MINVERSION)
1165*7f2fe78bSCy SchubertAC_CHECK_PROG(PYTHON,python3,python3)
1166*7f2fe78bSCy Schubertif test x"$PYTHON" = x; then
1167*7f2fe78bSCy Schubert	AC_CHECK_PROG(PYTHON,python,python)
1168*7f2fe78bSCy Schubertfi
1169*7f2fe78bSCy SchubertHAVE_PYTHON=no
1170*7f2fe78bSCy Schubertif test x"$PYTHON" != x; then
1171*7f2fe78bSCy Schubert	wantver="(sys.hexversion >= 0x30204F0)"
1172*7f2fe78bSCy Schubert	if "$PYTHON" -c "import sys; sys.exit(not $wantver and 1 or 0)"; then
1173*7f2fe78bSCy Schubert		HAVE_PYTHON=yes
1174*7f2fe78bSCy Schubert	fi
1175*7f2fe78bSCy Schubertfi
1176*7f2fe78bSCy SchubertAC_SUBST(HAVE_PYTHON)
1177*7f2fe78bSCy Schubert
1178*7f2fe78bSCy Schubert# For cmocka tests.
1179*7f2fe78bSCy SchubertCMOCKA_LIBS=
1180*7f2fe78bSCy SchubertHAVE_CMOCKA=no
1181*7f2fe78bSCy SchubertHAVE_CMOCKA_H=no
1182*7f2fe78bSCy SchubertHAVE_CMOCKA_LIB=no
1183*7f2fe78bSCy SchubertAC_CHECK_HEADER(cmocka.h, [HAVE_CMOCKA_H=yes], :, [
1184*7f2fe78bSCy Schubert#include <stdarg.h>
1185*7f2fe78bSCy Schubert#include <stddef.h>
1186*7f2fe78bSCy Schubert#include <setjmp.h> ])
1187*7f2fe78bSCy SchubertAC_CHECK_LIB(cmocka, _cmocka_run_group_tests, [HAVE_CMOCKA_LIB=yes])
1188*7f2fe78bSCy Schubertif test "$HAVE_CMOCKA_LIB" = yes && test "$HAVE_CMOCKA_H" = yes; then
1189*7f2fe78bSCy Schubert    HAVE_CMOCKA=yes
1190*7f2fe78bSCy Schubert    CMOCKA_LIBS='-lcmocka'
1191*7f2fe78bSCy Schubert    AC_DEFINE([HAVE_CMOCKA],1,[Define if cmocka library is available.])
1192*7f2fe78bSCy Schubertfi
1193*7f2fe78bSCy SchubertAC_SUBST(HAVE_CMOCKA)
1194*7f2fe78bSCy SchubertAC_SUBST(CMOCKA_LIBS)
1195*7f2fe78bSCy Schubert
1196*7f2fe78bSCy Schubert# For URI lookup tests. Requires resolv_wrapper >= 1.1.5 for URI
1197*7f2fe78bSCy Schubert# support.
1198*7f2fe78bSCy SchubertHAVE_RESOLV_WRAPPER=0
1199*7f2fe78bSCy SchubertPKG_CHECK_EXISTS([resolv_wrapper >= 1.1.5], [HAVE_RESOLV_WRAPPER=1])
1200*7f2fe78bSCy SchubertAC_SUBST(HAVE_RESOLV_WRAPPER)
1201*7f2fe78bSCy Schubert
1202*7f2fe78bSCy Schubert# for plugins/kdb/db2
1203*7f2fe78bSCy Schubert
1204*7f2fe78bSCy Schubert# AIX is unusual in that it wants all symbols resolved at link time
1205*7f2fe78bSCy Schubert#  Fortunately, it will allow us to link the kdb library now, even if
1206*7f2fe78bSCy Schubert# it is linked again later.
1207*7f2fe78bSCy Schubertcase $krb5_cv_host in
1208*7f2fe78bSCy Schubert*-*-aix*)
1209*7f2fe78bSCy Schubert	DB_EXTRA_LIBS=-ldb
1210*7f2fe78bSCy Schubert	;;
1211*7f2fe78bSCy Schubert*)
1212*7f2fe78bSCy Schubert	DB_EXTRA_LIBS=
1213*7f2fe78bSCy Schubert	;;
1214*7f2fe78bSCy Schubertesac
1215*7f2fe78bSCy SchubertAC_SUBST(DB_EXTRA_LIBS)
1216*7f2fe78bSCy Schubert
1217*7f2fe78bSCy Schubert
1218*7f2fe78bSCy Schubert
1219*7f2fe78bSCy Schubert# Warn about possible thread safety issues.  These functions have all
1220*7f2fe78bSCy Schubert# been checked for previously.
1221*7f2fe78bSCy Schuberttsfuncs="getpwnam_r getpwuid_r gethostbyname_r getservbyname_r gmtime_r localtime_r"
1222*7f2fe78bSCy Schubertif test "$enable_thread_support" = yes; then
1223*7f2fe78bSCy Schubert  tsmissing=""
1224*7f2fe78bSCy Schubert  for ts in $tsfuncs; do
1225*7f2fe78bSCy Schubert    if eval "test \"\${ac_cv_func_$ts}\" != yes"; then
1226*7f2fe78bSCy Schubert      tsmissing="$tsmissing $ts"
1227*7f2fe78bSCy Schubert    fi
1228*7f2fe78bSCy Schubert  done
1229*7f2fe78bSCy Schubert  if test "$ac_cv_func_res_nsearch/$ac_cv_lib_resolv_res_nsearch" = "no/no"; then
1230*7f2fe78bSCy Schubert    tsmissing="$tsmissing res_nsearch"
1231*7f2fe78bSCy Schubert  fi
1232*7f2fe78bSCy Schubert  if test "$tsmissing" != ""; then
1233*7f2fe78bSCy Schubert    AC_MSG_WARN([Some functions that are needed for library thread])
1234*7f2fe78bSCy Schubert    AC_MSG_WARN([safety appear to be missing.])
1235*7f2fe78bSCy Schubert    for ts in $tsmissing; do
1236*7f2fe78bSCy Schubert      AC_MSG_WARN([  missing thread-safe function: $ts])
1237*7f2fe78bSCy Schubert    done
1238*7f2fe78bSCy Schubert    AC_MSG_WARN([Without these functions, the installed libraries])
1239*7f2fe78bSCy Schubert    AC_MSG_WARN([may not be thread-safe.])
1240*7f2fe78bSCy Schubert  fi # tsmissing not empty
1241*7f2fe78bSCy Schubertfi # enable_thread_support
1242*7f2fe78bSCy Schubert
1243*7f2fe78bSCy Schubert# Sadly, we seem to have accidentally committed ourselves in 1.4 to
1244*7f2fe78bSCy Schubert# an ABI that includes the existence of libkrb5support.0 even
1245*7f2fe78bSCy Schubert# though random apps should never use anything from it.  And on
1246*7f2fe78bSCy Schubert# the Mac, to which that didn't apply, we can't use major version 0.
1247*7f2fe78bSCy Schubert
1248*7f2fe78bSCy Schubertcase $krb5_cv_host in
1249*7f2fe78bSCy Schubert*-*-darwin* | *-*-rhapsody*) SUPPORTLIB_MAJOR=1 ;;
1250*7f2fe78bSCy Schubert*)			     SUPPORTLIB_MAJOR=0 ;;
1251*7f2fe78bSCy Schubertesac
1252*7f2fe78bSCy SchubertAC_SUBST(SUPPORTLIB_MAJOR)
1253*7f2fe78bSCy Schubert
1254*7f2fe78bSCy Schubert
1255*7f2fe78bSCy Schubertif test "$COM_ERR_VERSION" = k5 ; then
1256*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(util/et)
1257*7f2fe78bSCy Schubertfi
1258*7f2fe78bSCy Schubertif test "$SS_VERSION" = k5 ; then
1259*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(util/ss)
1260*7f2fe78bSCy Schubertfi
1261*7f2fe78bSCy Schubert
1262*7f2fe78bSCy Schubert
1263*7f2fe78bSCy Schubertldap_plugin_dir=""
1264*7f2fe78bSCy Schubertldap_lib=""
1265*7f2fe78bSCy Schubertif test -n "$OPENLDAP_PLUGIN"; then
1266*7f2fe78bSCy Schubert  AC_CHECK_HEADERS(ldap.h lber.h, :, [AC_MSG_ERROR($ac_header not found)])
1267*7f2fe78bSCy Schubert  AC_CHECK_LIB(ldap, ldap_str2dn, :, [AC_MSG_ERROR(libldap not found or missing ldap_str2dn)])
1268*7f2fe78bSCy Schubert
1269*7f2fe78bSCy Schubert  BER_OKAY=0
1270*7f2fe78bSCy Schubert  AC_CHECK_LIB(ldap, ber_init, [BER_OKAY=1])
1271*7f2fe78bSCy Schubert  if test "$BER_OKAY" = "1"; then
1272*7f2fe78bSCy Schubert    LDAP_LIBS='-lldap'
1273*7f2fe78bSCy Schubert  else
1274*7f2fe78bSCy Schubert    AC_CHECK_LIB(lber, ber_init, [BER_OKAY=1], [AC_MSG_WARN([libber not found])])
1275*7f2fe78bSCy Schubert    if test "$BER_OKAY" = "1"; then
1276*7f2fe78bSCy Schubert      LDAP_LIBS='-lldap -llber'
1277*7f2fe78bSCy Schubert    else
1278*7f2fe78bSCy Schubert      AC_MSG_ERROR("BER library missing - cannot build LDAP database module")
1279*7f2fe78bSCy Schubert    fi
1280*7f2fe78bSCy Schubert  fi
1281*7f2fe78bSCy Schubert  AC_DEFINE([ENABLE_LDAP], 1, [Define if LDAP KDB support within the Kerberos library (mainly ASN.1 code) should be enabled.])
1282*7f2fe78bSCy Schubert  AC_SUBST(LDAP_LIBS)
1283*7f2fe78bSCy Schubert
1284*7f2fe78bSCy Schubert  AC_CHECK_HEADERS([sasl/sasl.h], [HAVE_SASL=yes], [HAVE_SASL=no])
1285*7f2fe78bSCy Schubert  AC_SUBST(HAVE_SASL)
1286*7f2fe78bSCy Schubert  if test "$HAVE_SASL" = no; then
1287*7f2fe78bSCy Schubert    AC_MSG_WARN([not building LDAP SASL support])
1288*7f2fe78bSCy Schubert  fi
1289*7f2fe78bSCy Schubert
1290*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(plugins/kdb/ldap)
1291*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(plugins/kdb/ldap/ldap_util)
1292*7f2fe78bSCy Schubert  K5_GEN_MAKEFILE(plugins/kdb/ldap/libkdb_ldap)
1293*7f2fe78bSCy Schubert  ldap_plugin_dir='plugins/kdb/ldap plugins/kdb/ldap/ldap_util'
1294*7f2fe78bSCy Schubert  LDAP=yes
1295*7f2fe78bSCy Schubertelse
1296*7f2fe78bSCy Schubert  LDAP=no
1297*7f2fe78bSCy Schubertfi
1298*7f2fe78bSCy SchubertAC_SUBST(ldap_plugin_dir)
1299*7f2fe78bSCy SchubertAC_SUBST(LDAP)
1300*7f2fe78bSCy Schubert# This check is for plugins/preauth/securid_sam2
1301*7f2fe78bSCy Schubertsam2_plugin=""
1302*7f2fe78bSCy Schubertold_CFLAGS=$CFLAGS
1303*7f2fe78bSCy SchubertCFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1304*7f2fe78bSCy SchubertAC_CHECK_LIB(aceclnt, SD_Init, [
1305*7f2fe78bSCy Schubert	     AC_MSG_NOTICE([Enabling RSA securID support])
1306*7f2fe78bSCy Schubert	     K5_GEN_MAKEFILE(plugins/preauth/securid_sam2)
1307*7f2fe78bSCy Schubert	     sam2_plugin=plugins/preauth/securid_sam2
1308*7f2fe78bSCy Schubert	     ])
1309*7f2fe78bSCy SchubertAC_SUBST(sam2_plugin)
1310*7f2fe78bSCy SchubertCFLAGS=$old_CFLAGS
1311*7f2fe78bSCy Schubert
1312*7f2fe78bSCy Schubertlmdb_plugin_dir=""
1313*7f2fe78bSCy SchubertHAVE_LMDB=no
1314*7f2fe78bSCy SchubertAC_ARG_WITH([lmdb],
1315*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-lmdb],
1316*7f2fe78bSCy Schubert    [compile LMDB database backend module @<:@auto@:>@])],
1317*7f2fe78bSCy Schubert  [], [withval=auto])
1318*7f2fe78bSCy Schubertif test "$withval" = auto -o "$withval" = yes; then
1319*7f2fe78bSCy Schubert  AC_CHECK_LIB([lmdb],[mdb_env_create],[have_lmdb=true],[have_lmdb=false])
1320*7f2fe78bSCy Schubert  if test "$have_lmdb" = true; then
1321*7f2fe78bSCy Schubert    LMDB_LIBS=-llmdb
1322*7f2fe78bSCy Schubert    HAVE_LMDB=yes
1323*7f2fe78bSCy Schubert    lmdb_plugin_dir='plugins/kdb/lmdb'
1324*7f2fe78bSCy Schubert    K5_GEN_MAKEFILE(plugins/kdb/lmdb)
1325*7f2fe78bSCy Schubert  elif test "$withval" = yes; then
1326*7f2fe78bSCy Schubert    AC_MSG_ERROR([liblmdb not found])
1327*7f2fe78bSCy Schubert  fi
1328*7f2fe78bSCy Schubertfi
1329*7f2fe78bSCy SchubertAC_SUBST(HAVE_LMDB)
1330*7f2fe78bSCy SchubertAC_SUBST(LMDB_LIBS)
1331*7f2fe78bSCy SchubertAC_SUBST(lmdb_plugin_dir)
1332*7f2fe78bSCy Schubert
1333*7f2fe78bSCy Schubert# Kludge for simple server --- FIXME is this the best way to do this?
1334*7f2fe78bSCy Schubert
1335*7f2fe78bSCy Schubertif test "$ac_cv_lib_socket" = "yes" -a "$ac_cv_lib_nsl" = "yes"; then
1336*7f2fe78bSCy Schubert	AC_DEFINE(BROKEN_STREAMS_SOCKETS,1,[Define if socket can't be bound to 0.0.0.0])
1337*7f2fe78bSCy Schubertfi
1338*7f2fe78bSCy Schubert
1339*7f2fe78bSCy Schubert# Compile with libedit support in ss by default if available.  Compile
1340*7f2fe78bSCy Schubert# with readline only if asked, to avoid a default GPL dependency.
1341*7f2fe78bSCy SchubertAC_ARG_WITH([libedit],
1342*7f2fe78bSCy Schubert  [AS_HELP_STRING([--without-libedit], [do not compile with libedit])],
1343*7f2fe78bSCy Schubert  [], [with_libedit=default])
1344*7f2fe78bSCy SchubertAC_ARG_WITH([readline],
1345*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-readline], [compile with GNU Readline])],
1346*7f2fe78bSCy Schubert  [], [with_readline=no])
1347*7f2fe78bSCy Schubertif test "x$with_readline" = xyes; then
1348*7f2fe78bSCy Schubert  with_libedit=no
1349*7f2fe78bSCy Schubertfi
1350*7f2fe78bSCy SchubertRL_CFLAGS=
1351*7f2fe78bSCy SchubertRL_LIBS=
1352*7f2fe78bSCy Schubertif test "x$with_libedit" != xno; then
1353*7f2fe78bSCy Schubert  PKG_CHECK_MODULES(LIBEDIT, libedit, [have_libedit=yes], [have_libedit=no])
1354*7f2fe78bSCy Schubert  if test "x$have_libedit" = xyes; then
1355*7f2fe78bSCy Schubert    RL_CFLAGS=$LIBEDIT_CFLAGS
1356*7f2fe78bSCy Schubert    RL_LIBS=$LIBEDIT_LIBS
1357*7f2fe78bSCy Schubert    AC_DEFINE([HAVE_LIBEDIT], 1, [Define if building with libedit.])
1358*7f2fe78bSCy Schubert    AC_MSG_NOTICE([Using libedit for readline support])
1359*7f2fe78bSCy Schubert  elif test "x$with_libedit" = xyes; then
1360*7f2fe78bSCy Schubert    # We were explicitly asked for libedit and couldn't find it.
1361*7f2fe78bSCy Schubert    AC_MSG_ERROR([Could not detect libedit with pkg-config])
1362*7f2fe78bSCy Schubert  else
1363*7f2fe78bSCy Schubert    AC_MSG_NOTICE([Not using any readline support])
1364*7f2fe78bSCy Schubert  fi
1365*7f2fe78bSCy Schubertelif test "x$with_readline" = xyes; then
1366*7f2fe78bSCy Schubert  AC_MSG_NOTICE([Using GNU Readline])
1367*7f2fe78bSCy Schubert  AC_CHECK_LIB([readline], [main], :,
1368*7f2fe78bSCy Schubert	       AC_MSG_FAILURE([Cannot find readline library.]))
1369*7f2fe78bSCy Schubert  AC_DEFINE([HAVE_READLINE], 1, [Define if building with GNU Readline.])
1370*7f2fe78bSCy Schubert  RL_LIBS='-lreadline'
1371*7f2fe78bSCy Schubertelse
1372*7f2fe78bSCy Schubert  AC_MSG_RESULT([Not using any readline support])
1373*7f2fe78bSCy Schubertfi
1374*7f2fe78bSCy SchubertAC_SUBST([RL_CFLAGS])
1375*7f2fe78bSCy SchubertAC_SUBST([RL_LIBS])
1376*7f2fe78bSCy Schubert
1377*7f2fe78bSCy SchubertAC_ARG_WITH([system-verto],
1378*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-system-verto], [always use system verto library])],
1379*7f2fe78bSCy Schubert  [], [with_system_verto=default])
1380*7f2fe78bSCy SchubertVERTO_VERSION=k5
1381*7f2fe78bSCy Schubertif test "x$with_system_verto" != xno; then
1382*7f2fe78bSCy Schubert  PKG_CHECK_MODULES(VERTO, libverto, [have_sysverto=yes], [have_sysverto=no])
1383*7f2fe78bSCy Schubert  if test "x$have_sysverto" = xyes; then
1384*7f2fe78bSCy Schubert    VERTO_VERSION=sys
1385*7f2fe78bSCy Schubert  elif test "x$with_system_verto" = xyes; then
1386*7f2fe78bSCy Schubert    AC_MSG_ERROR([cannot detect system libverto])
1387*7f2fe78bSCy Schubert  fi
1388*7f2fe78bSCy Schubertfi
1389*7f2fe78bSCy Schubertif test "x$VERTO_VERSION" = xsys; then
1390*7f2fe78bSCy Schubert  AC_MSG_NOTICE([Using system libverto])
1391*7f2fe78bSCy Schubertelse
1392*7f2fe78bSCy Schubert  VERTO_CFLAGS=
1393*7f2fe78bSCy Schubert  VERTO_LIBS="-lverto"
1394*7f2fe78bSCy Schubert  AC_MSG_NOTICE([Using built-in libverto])
1395*7f2fe78bSCy Schubertfi
1396*7f2fe78bSCy SchubertAC_SUBST([VERTO_CFLAGS])
1397*7f2fe78bSCy SchubertAC_SUBST([VERTO_LIBS])
1398*7f2fe78bSCy SchubertAC_SUBST([VERTO_VERSION])
1399*7f2fe78bSCy Schubert
1400*7f2fe78bSCy SchubertAC_PATH_PROG(GROFF, groff)
1401*7f2fe78bSCy Schubert
1402*7f2fe78bSCy Schubert# Make localedir work in autoconf 2.5x.
1403*7f2fe78bSCy Schubertif test "${localedir+set}" != set; then
1404*7f2fe78bSCy Schubert    localedir='$(datadir)/locale'
1405*7f2fe78bSCy Schubertfi
1406*7f2fe78bSCy SchubertAC_SUBST(localedir)
1407*7f2fe78bSCy Schubert
1408*7f2fe78bSCy Schubert# Determine the default macOS ccache type and whether to build the KCM
1409*7f2fe78bSCy Schubert# Mach RPC support.
1410*7f2fe78bSCy SchubertMACOS_FRAMEWORK=
1411*7f2fe78bSCy Schubertdnl The outer brackets around the case statement prevent m4 from
1412*7f2fe78bSCy Schubertdnl eating the brackets in the glob patterns, but also prevent us from
1413*7f2fe78bSCy Schubertdnl using AC_DEFINE within the body.
1414*7f2fe78bSCy Schubert[case $host in
1415*7f2fe78bSCy Schubert*-*-darwin[0-9].* | *-*-darwin10.*)
1416*7f2fe78bSCy Schubert  # Use the normal default cache type for macOS 10.6 (Darwin 10) and
1417*7f2fe78bSCy Schubert  # prior.  Build the KCM Mach RPC support.
1418*7f2fe78bSCy Schubert  OSX=osx
1419*7f2fe78bSCy Schubert  ;;
1420*7f2fe78bSCy Schubert*-*-darwin*)
1421*7f2fe78bSCy Schubert  # macOS 10.6 (Darwin 11) uses the KCM type by default.  macOS 11
1422*7f2fe78bSCy Schubert  # (Darwin 20) uses an xpc-based cache type called XCACHE by default.
1423*7f2fe78bSCy Schubert  # We can access either of these collections via a macos-specific
1424*7f2fe78bSCy Schubert  # implementation of the API cache type.  Build the KCM Mach RPC
1425*7f2fe78bSCy Schubert  # support.
1426*7f2fe78bSCy Schubert  OSX=osx
1427*7f2fe78bSCy Schubert  macos_defccname=API:
1428*7f2fe78bSCy Schubert  MACOS_FRAMEWORK="-framework Kerberos"
1429*7f2fe78bSCy Schubert  ;;
1430*7f2fe78bSCy Schubert*)
1431*7f2fe78bSCy Schubert  # This is not macOS; do not build the Mach RPC support and use the
1432*7f2fe78bSCy Schubert  # normal default cache type.
1433*7f2fe78bSCy Schubert  OSX=no
1434*7f2fe78bSCy Schubert  ;;
1435*7f2fe78bSCy Schubertesac]
1436*7f2fe78bSCy Schubertif test "$macos_defccname" = API:; then
1437*7f2fe78bSCy Schubert  AC_DEFINE(USE_CCAPI_MACOS, 1, [Define to build macOS CCAPI client])
1438*7f2fe78bSCy Schubertfi
1439*7f2fe78bSCy SchubertAC_SUBST(OSX)
1440*7f2fe78bSCy SchubertAC_SUBST(MACOS_FRAMEWORK)
1441*7f2fe78bSCy Schubert
1442*7f2fe78bSCy Schubert# Build-time default ccache, keytab, and client keytab names.  These
1443*7f2fe78bSCy Schubert# can be given as variable arguments DEFCCNAME, DEFKTNAME, and
1444*7f2fe78bSCy Schubert# DEFCKTNAME.  Otherwise, we try to get the OS defaults from
1445*7f2fe78bSCy Schubert# krb5-config if we can, or fall back to hardcoded defaults.
1446*7f2fe78bSCy SchubertAC_ARG_VAR(DEFCCNAME, [Default ccache name])
1447*7f2fe78bSCy SchubertAC_ARG_VAR(DEFKTNAME, [Default keytab name])
1448*7f2fe78bSCy SchubertAC_ARG_VAR(DEFCKTNAME, [Default client keytab name])
1449*7f2fe78bSCy SchubertAC_ARG_WITH([krb5-config],
1450*7f2fe78bSCy Schubert  [AS_HELP_STRING([--with-krb5-config=PATH],
1451*7f2fe78bSCy Schubert    [path to existing krb5-config program for defaults])],
1452*7f2fe78bSCy Schubert  [], [with_krb5_config=krb5-config])
1453*7f2fe78bSCy Schubertif test "x$with_krb5_config" != xno; then
1454*7f2fe78bSCy Schubert	if test "x$with_krb5_config" = xyes; then
1455*7f2fe78bSCy Schubert		with_krb5_config=krb5-config
1456*7f2fe78bSCy Schubert	fi
1457*7f2fe78bSCy Schubert	if $with_krb5_config --help 2>&1 | grep defccname >/dev/null; then
1458*7f2fe78bSCy Schubert		AC_MSG_NOTICE([Using $with_krb5_config for build defaults])
1459*7f2fe78bSCy Schubert		: "${DEFCCNAME=`$with_krb5_config --defccname`}"
1460*7f2fe78bSCy Schubert		: "${DEFKTNAME=`$with_krb5_config --defktname`}"
1461*7f2fe78bSCy Schubert		: "${DEFCKTNAME=`$with_krb5_config --defcktname`}"
1462*7f2fe78bSCy Schubert	fi
1463*7f2fe78bSCy Schubertfi
1464*7f2fe78bSCy Schubertif test "${DEFCCNAME+set}" != set; then
1465*7f2fe78bSCy Schubert	if test "${macos_defccname+set}" = set; then
1466*7f2fe78bSCy Schubert		DEFCCNAME=$macos_defccname
1467*7f2fe78bSCy Schubert	else
1468*7f2fe78bSCy Schubert		DEFCCNAME=FILE:/tmp/krb5cc_%{uid}
1469*7f2fe78bSCy Schubert	fi
1470*7f2fe78bSCy Schubertfi
1471*7f2fe78bSCy Schubertif test "${DEFKTNAME+set}" != set; then
1472*7f2fe78bSCy Schubert	DEFKTNAME=FILE:/etc/krb5.keytab
1473*7f2fe78bSCy Schubertfi
1474*7f2fe78bSCy Schubertif test "${DEFCKTNAME+set}" != set; then
1475*7f2fe78bSCy Schubert	AX_RECURSIVE_EVAL($localstatedir, exp_localstatedir)
1476*7f2fe78bSCy Schubert	DEFCKTNAME=FILE:$exp_localstatedir/krb5/user/%{euid}/client.keytab
1477*7f2fe78bSCy Schubertfi
1478*7f2fe78bSCy SchubertAC_MSG_NOTICE([Default ccache name: $DEFCCNAME])
1479*7f2fe78bSCy SchubertAC_MSG_NOTICE([Default keytab name: $DEFKTNAME])
1480*7f2fe78bSCy SchubertAC_MSG_NOTICE([Default client keytab name: $DEFCKTNAME])
1481*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(DEFCCNAME, ["$DEFCCNAME"], [Define to default ccache name])
1482*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(DEFKTNAME, ["$DEFKTNAME"], [Define to default keytab name])
1483*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(DEFCKTNAME, ["$DEFCKTNAME"],
1484*7f2fe78bSCy Schubert                   [Define to default client keytab name])
1485*7f2fe78bSCy Schubert
1486*7f2fe78bSCy SchubertAC_ARG_VAR(PKCS11_MODNAME, [Default PKCS11 module name])
1487*7f2fe78bSCy Schubertif test "${PKCS11_MODNAME+set}" != set; then
1488*7f2fe78bSCy Schubert	PKCS11_MODNAME=opensc-pkcs11.so
1489*7f2fe78bSCy Schubertfi
1490*7f2fe78bSCy SchubertAC_MSG_NOTICE([Default PKCS11 module name: $PKCS11_MODNAME])
1491*7f2fe78bSCy SchubertAC_DEFINE_UNQUOTED(PKCS11_MODNAME, ["$PKCS11_MODNAME"],
1492*7f2fe78bSCy Schubert                   [Default PKCS11 module name])
1493*7f2fe78bSCy Schubert
1494*7f2fe78bSCy SchubertAC_CONFIG_FILES([build-tools/krb5-config], [chmod +x build-tools/krb5-config])
1495*7f2fe78bSCy SchubertAC_CONFIG_FILES([build-tools/kadm-server.pc
1496*7f2fe78bSCy Schubert	build-tools/kadm-client.pc
1497*7f2fe78bSCy Schubert	build-tools/kdb.pc
1498*7f2fe78bSCy Schubert	build-tools/krb5.pc
1499*7f2fe78bSCy Schubert	build-tools/krb5-gssapi.pc
1500*7f2fe78bSCy Schubert	build-tools/mit-krb5.pc
1501*7f2fe78bSCy Schubert	build-tools/mit-krb5-gssapi.pc
1502*7f2fe78bSCy Schubert	build-tools/gssrpc.pc
1503*7f2fe78bSCy Schubert])
1504*7f2fe78bSCy SchubertV5_AC_OUTPUT_MAKEFILE(.
1505*7f2fe78bSCy Schubert
1506*7f2fe78bSCy Schubert	util util/support util/profile util/profile/testmod
1507*7f2fe78bSCy Schubert	util/verto
1508*7f2fe78bSCy Schubert
1509*7f2fe78bSCy Schubert	lib lib/kdb
1510*7f2fe78bSCy Schubert
1511*7f2fe78bSCy Schubert	lib/crypto lib/crypto/krb lib/crypto/crypto_tests
1512*7f2fe78bSCy Schubert	lib/crypto/builtin lib/crypto/builtin/des
1513*7f2fe78bSCy Schubert	lib/crypto/builtin/aes lib/crypto/builtin/camellia
1514*7f2fe78bSCy Schubert	lib/crypto/builtin/md4 lib/crypto/builtin/md5
1515*7f2fe78bSCy Schubert	lib/crypto/builtin/sha1 lib/crypto/builtin/sha2
1516*7f2fe78bSCy Schubert	lib/crypto/builtin/enc_provider lib/crypto/builtin/hash_provider
1517*7f2fe78bSCy Schubert	lib/crypto/openssl lib/crypto/openssl/des
1518*7f2fe78bSCy Schubert	lib/crypto/openssl/enc_provider lib/crypto/openssl/hash_provider
1519*7f2fe78bSCy Schubert
1520*7f2fe78bSCy Schubert	lib/krb5 lib/krb5/error_tables lib/krb5/asn.1 lib/krb5/ccache
1521*7f2fe78bSCy Schubert	lib/krb5/keytab lib/krb5/krb lib/krb5/rcache lib/krb5/os
1522*7f2fe78bSCy Schubert	lib/krb5/unicode
1523*7f2fe78bSCy Schubert
1524*7f2fe78bSCy Schubert	lib/gssapi lib/gssapi/generic lib/gssapi/krb5 lib/gssapi/spnego
1525*7f2fe78bSCy Schubert	lib/gssapi/mechglue
1526*7f2fe78bSCy Schubert
1527*7f2fe78bSCy Schubert	lib/rpc lib/rpc/unit-test
1528*7f2fe78bSCy Schubert
1529*7f2fe78bSCy Schubert	lib/kadm5 lib/kadm5/clnt lib/kadm5/srv
1530*7f2fe78bSCy Schubert	lib/krad
1531*7f2fe78bSCy Schubert	lib/apputils
1532*7f2fe78bSCy Schubert
1533*7f2fe78bSCy Schubert	kdc kprop config-files build-tools man doc include
1534*7f2fe78bSCy Schubert
1535*7f2fe78bSCy Schubert	plugins/certauth/test
1536*7f2fe78bSCy Schubert	plugins/gssapi/negoextest
1537*7f2fe78bSCy Schubert	plugins/hostrealm/test
1538*7f2fe78bSCy Schubert	plugins/localauth/test
1539*7f2fe78bSCy Schubert	plugins/kadm5_hook/test
1540*7f2fe78bSCy Schubert	plugins/kadm5_auth/test
1541*7f2fe78bSCy Schubert	plugins/pwqual/test
1542*7f2fe78bSCy Schubert	plugins/audit
1543*7f2fe78bSCy Schubert	plugins/audit/test
1544*7f2fe78bSCy Schubert	plugins/kdb/db2
1545*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2
1546*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2/hash
1547*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2/btree
1548*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2/db
1549*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2/mpool
1550*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2/recno
1551*7f2fe78bSCy Schubert	plugins/kdb/db2/libdb2/test
1552*7f2fe78bSCy Schubert	plugins/kdb/test
1553*7f2fe78bSCy Schubert	plugins/kdcpolicy/test
1554*7f2fe78bSCy Schubert	plugins/preauth/otp
1555*7f2fe78bSCy Schubert	plugins/preauth/spake
1556*7f2fe78bSCy Schubert	plugins/preauth/test
1557*7f2fe78bSCy Schubert	plugins/authdata/greet_client
1558*7f2fe78bSCy Schubert	plugins/authdata/greet_server
1559*7f2fe78bSCy Schubert	plugins/tls/k5tls
1560*7f2fe78bSCy Schubert
1561*7f2fe78bSCy Schubert	clients clients/klist clients/kinit clients/kvno
1562*7f2fe78bSCy Schubert	clients/kdestroy clients/kpasswd clients/ksu clients/kswitch
1563*7f2fe78bSCy Schubert
1564*7f2fe78bSCy Schubert	kadmin kadmin/cli kadmin/dbutil kadmin/ktutil kadmin/server
1565*7f2fe78bSCy Schubert
1566*7f2fe78bSCy Schubert	appl
1567*7f2fe78bSCy Schubert	appl/sample appl/sample/sclient appl/sample/sserver
1568*7f2fe78bSCy Schubert	appl/simple appl/simple/client appl/simple/server
1569*7f2fe78bSCy Schubert	appl/gss-sample appl/user_user
1570*7f2fe78bSCy Schubert
1571*7f2fe78bSCy Schubert	tests tests/asn.1 tests/create tests/hammer tests/verify tests/gssapi
1572*7f2fe78bSCy Schubert	tests/threads tests/shlib tests/gss-threads tests/misc
1573*7f2fe78bSCy Schubert)
1574