Crypto modularity proj: SHS_INFO structure is defined differently for crypto impl...
[krb5.git] / src / configure.in
1 K5_AC_INIT([aclocal.m4])
2 #
3 # autoconf 2.49 defaults to a /dev/null cache file, which is what we
4 # do not want for performance reasons. 
5 if test "x$cache_file" = "x/dev/null"; then
6   cache_file=./config.cache
7   AC_CACHE_LOAD
8 fi
9
10 CONFIG_RULES
11 KRB5_VERSION=K5_VERSION
12 AC_SUBST(KRB5_VERSION)
13
14
15 AC_REQUIRE_CPP
16
17 AC_CACHE_CHECK(if va_copy is available, krb5_cv_va_copy,
18 [AC_LINK_IFELSE([
19 #include <stdarg.h>
20 void f(va_list ap) {
21   va_list ap2;
22   va_copy(ap2, ap);
23   va_end(ap2);
24 }
25 va_list x;
26 int main()
27 {
28   f(x);
29   return 0;
30 }], krb5_cv_va_copy=yes, krb5_cv_va_copy=no)])
31 if test "$krb5_cv_va_copy" = yes; then
32   AC_DEFINE(HAS_VA_COPY,1,[Define if va_copy macro or function is available.])
33 fi
34
35 # Note that this isn't checking if the copied value *works*, just
36 # whether the C language constraints permit the copying.  If
37 # va_list is defined as an array type, it can't be assigned.
38 AC_CACHE_CHECK(if va_list objects can be copied by assignment,
39                krb5_cv_va_simple_copy,
40 [AC_COMPILE_IFELSE([
41 #include <stdarg.h>
42 void f(va_list va2) {
43   va_list va1;
44   va1 = va2;
45 }], krb5_cv_va_simple_copy=yes, krb5_cv_va_simple_copy=no)])
46 if test "$krb5_cv_va_simple_copy" = yes; then
47   AC_DEFINE(CAN_COPY_VA_LIST,1,[Define if va_list objects can be simply copied by assignment.])
48 fi
49
50 # The following lines are so that configure --help gives some global 
51 # configuration options.
52
53 KRB5_LIB_AUX
54 AC_KRB5_TCL
55 AC_ARG_ENABLE([athena],
56 [  --enable-athena         build with MIT Project Athena configuration],,)
57
58 # Begin autoconf tests for the Makefiles generated out of the top-level
59 # configure.in...
60
61 AC_CHECK_FUNCS(memmove)
62 KRB5_BUILD_LIBOBJS
63 KRB5_BUILD_LIBRARY
64 KRB5_BUILD_PROGRAM
65 # for slave
66 AC_TYPE_MODE_T
67 AC_PROG_INSTALL
68 KRB5_AC_NEED_DAEMON
69 KRB5_GETSOCKNAME_ARGS
70 KRB5_GETPEERNAME_ARGS
71 LIBUTIL=
72 AC_CHECK_LIB(util,main,[AC_DEFINE(HAVE_LIBUTIL,1,[Define if the util library is available])
73 LIBUTIL=-lutil
74 ])
75 AC_SUBST(LIBUTIL)
76 # for kdc
77 AC_CHECK_HEADERS(syslog.h stdarg.h sys/select.h sys/sockio.h ifaddrs.h unistd.h)
78 AC_CHECK_FUNCS(openlog syslog closelog strftime vsprintf vasprintf vsnprintf)
79 AC_CHECK_FUNCS(strlcpy)
80 EXTRA_SUPPORT_SYMS=
81 AC_CHECK_FUNC(strlcpy, [STRLCPY_ST_OBJ= STRLCPY_OBJ=], [STRLCPY_ST_OBJ=strlcpy.o STRLCPY_OBJ='$(OUTPRE)strlcpy.$(OBJEXT)' EXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_strlcpy krb5int_strlcat"])
82 AC_SUBST(STRLCPY_OBJ)
83 AC_SUBST(STRLCPY_ST_OBJ)
84 AC_CHECK_FUNC(vasprintf,
85 [PRINTF_ST_OBJ=
86 PRINTF_OBJ=],
87 [PRINTF_ST_OBJ=printf.o
88 PRINTF_OBJ='$(OUTPRE)printf.$(OBJEXT)'
89 EXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_asprintf krb5int_vasprintf"])
90 AC_SUBST(PRINTF_OBJ)
91 AC_SUBST(PRINTF_ST_OBJ)
92 KRB5_NEED_PROTO([#include <stdarg.h>
93 #include <stdio.h>
94 ],vasprintf)
95 KRB5_NEED_PROTO([#include <string.h>
96 #ifdef HAVE_UNISTD_H
97 #include <unistd.h>
98 #endif
99 /* Solaris 8 declares swab in stdlib.h.  */
100 #include <stdlib.h>
101 ],swab,1)
102 KRB5_NEED_PROTO([#include <ctype.h>],isblank,1)
103
104 AC_PROG_AWK
105 KRB5_AC_INET6
106 KRB5_SOCKADDR_SA_LEN
107 CHECK_SIGNALS
108
109 # --with-vague-errors disables useful error messages.
110
111 AC_ARG_WITH([vague-errors],
112 AC_HELP_STRING([--with-vague-errors],[Do not @<:@do@:>@ send helpful errors to client]), , withval=no)
113 if test "$withval" = yes; then
114         AC_MSG_RESULT(Supplying vague error messages to KDC clients)
115         AC_DEFINE(KRBCONF_VAGUE_ERRORS,1,[Define if the KDC should return only vague error codes to clients])
116 fi
117
118 # WITH_CRYPTO_IMPL
119
120 CRYPTO_IMPL="builtin"
121 AC_ARG_WITH([crypto-impl],
122 AC_HELP_STRING([--with-crypto-impl=IMPL], [use specified crypto implementation @<:@builtin@:>@]),
123 [CRYPTO_IMPL=$withval
124 AC_MSG_RESULT("k5crypto will use \'$withval\'")
125 ], withval=builtin)
126 AC_SUBST(CRYPTO_IMPL)
127
128 # --with-kdc-kdb-update makes the KDC update the database with last request
129 # information and failure information.
130
131 AC_ARG_WITH([kdc-kdb-update],
132 AC_HELP_STRING([--with-kdc-kdb-update],[Update the database @<:@don't update@:>@]), , withval=no)
133 if test "$withval" = yes; then
134         AC_MSG_RESULT(Updating KDC database with each request)
135         AC_DEFINE(KRBCONF_KDC_MODIFIES_KDB,1,[Define if KDC should update database with each request])
136 fi
137
138 # Needed for hw-preauth replay detection on KDC.
139
140 # USE_RCACHE enables the replay cache
141 # NOCACHE disables the lookaside cache
142
143 # The lookaside cache is checked first; if *exactly* the same message
144 # comes in twice, e.g., because the (legitimate) client resent it,
145 # the previous response will be resent.  Otherwise, the replay cache
146 # is used to check for attempts to fake out the KDC.  Some hardware
147 # preauth methods are weak enough that we *really* want to have this
148 # checking turned on.
149
150 AC_ARG_ENABLE([kdc-replay-cache],
151 AC_HELP_STRING([--enable-kdc-replay-cache],[check for replayed/retransmitted KDC requests (recommended when hardware preauthentication is in use) @<:@disabled@:>@]), , enableval=yes)
152 if test "$enableval" = yes ; then
153         AC_DEFINE(USE_RCACHE,1,[Define if the KDC should use a replay cache])
154 else
155         AC_DEFINE(NOCACHE,1,[Define if the KDC should use no replay cache])
156 fi
157 KRB5_RUN_FLAGS
158
159 AC_TYPE_SIGNAL
160
161 # from old include/configure.in
162 AH_TEMPLATE([HAVE_STRUCT_SOCKADDR_STORAGE], 
163 [Define if "struct sockaddr_storage" is available.])
164
165 AC_CONFIG_HEADERS(include/autoconf.h, [echo timestamp > include/autoconf.stamp])
166 AC_PROG_INSTALL
167 AC_PROG_AWK
168 AC_PROG_LEX
169 AC_C_CONST
170 AC_HEADER_DIRENT
171 AC_CHECK_FUNCS(strdup setvbuf inet_ntoa inet_aton seteuid setresuid setreuid setegid setresgid setregid setsid flock fchmod chmod strftime strptime geteuid setenv unsetenv getenv gethostbyname2 getifaddrs gmtime_r localtime_r pthread_mutex_lock sched_yield bswap16 bswap64 mkstemp getusershell lstat access ftime getcwd srand48 srand srandom stat strchr strerror strerror_r strstr timezone umask waitpid sem_init sem_trywait daemon)
172
173 AC_CHECK_FUNC(mkstemp,
174 [MKSTEMP_ST_OBJ=
175 MKSTEMP_OBJ=],
176 [MKSTEMP_ST_OBJ='mkstemp.o'
177 MKSTEMP_OBJ='$(OUTPRE)mkstemp.$(OBJEXT)'
178 EXTRA_SUPPORT_SYMS="$EXTRA_SUPPORT_SYMS krb5int_mkstemp"])
179 AC_SUBST(MKSTEMP_OBJ)
180 AC_SUBST(MKSTEMP_ST_OBJ)
181 AC_SUBST(EXTRA_SUPPORT_SYMS)
182
183 AC_HEADER_STDARG
184 DECLARE_SYS_ERRLIST
185 AC_CHECK_HEADERS(unistd.h paths.h regex.h regexpr.h fcntl.h memory.h ifaddrs.h sys/filio.h sched.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 pthread.h semaphore.h krb_db.h kdc.h)
186 AC_CHECK_HEADER(regexp.h, [], [],
187 [#define INIT char *sp = instring;
188 #define GETC() (*sp++)
189 #define PEEKC() (*sp)
190 #define UNGETC(c) (--sp)
191 #define RETURN(c) return(c)
192 #define ERROR(c)
193 ])
194 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len, struct sockaddr.sa_len], , ,
195   [#include <sys/types.h>
196 #include <netinet/in.h>])
197 AC_CHECK_MEMBERS([struct stat.st_mtimensec,struct stat.st_mtimespec.tv_nsec,struct stat.st_mtim.tv_nsec],,,[#include <sys/types.h>
198 #include <sys/stat.h>])
199 KRB5_AC_REGEX_FUNCS
200 AC_TYPE_OFF_T
201
202 # Fancy caching of perror result...
203 AC_MSG_CHECKING(for perror declaration)
204 AC_CACHE_VAL(krb5_cv_decl_perror,
205 [AC_EGREP_HEADER(perror, errno.h, 
206   krb5_cv_decl_perror=yes, krb5_cv_decl_perror=no)])
207 AC_MSG_RESULT($krb5_cv_decl_perror)
208 if test $krb5_cv_decl_perror = yes; then
209         AC_DEFINE(HDR_HAS_PERROR,1,[Define if errno.h declares perror])
210 fi
211
212 KRB5_NEED_PROTO([#include <time.h>],strptime)
213 CHECK_WAIT_TYPE
214 CHECK_SIGPROCMASK
215 AC_TYPE_GETGROUPS
216 CHECK_SETJMP
217
218 # *rpcent return types needed for lib/rpc
219
220 AC_MSG_CHECKING([return type of setrpcent])
221 AC_CACHE_VAL(k5_cv_type_setrpcent,
222 [AC_TRY_COMPILE([#include <netdb.h>
223 #ifdef __cplusplus
224 extern "C"
225 #endif
226 extern void setrpcent();],
227 [int i;], k5_cv_type_setrpcent=void, k5_cv_type_setrpcent=int)])
228 AC_MSG_RESULT($k5_cv_type_setrpcent)
229 AC_DEFINE_UNQUOTED(SETRPCENT_TYPE, $k5_cv_type_setrpcent, [Define as return type of setrpcent])
230
231 AC_MSG_CHECKING([return type of endrpcent])
232 AC_CACHE_VAL(k5_cv_type_endrpcent,
233 [AC_TRY_COMPILE([#include <netdb.h>
234 #ifdef __cplusplus
235 extern "C"
236 #endif
237 extern void endrpcent();],
238 [int i;], k5_cv_type_endrpcent=void, k5_cv_type_endrpcent=int)])
239 AC_MSG_RESULT($k5_cv_type_endrpcent)
240 AC_DEFINE_UNQUOTED(ENDRPCENT_TYPE, $k5_cv_type_endrpcent, [Define as return type of endrpcent])
241
242
243 # bswap_16 is a macro in byteswap.h under GNU libc
244 AC_MSG_CHECKING(for bswap_16)
245 AC_CACHE_VAL(krb5_cv_bswap_16,[
246 AC_TRY_LINK([#if HAVE_BYTESWAP_H
247 #include <byteswap.h>
248 #endif],[bswap_16(37);],krb5_cv_bswap_16=yes,krb5_cv_bswap_16=no)])
249 AC_MSG_RESULT($krb5_cv_bswap_16)
250 if test "$krb5_cv_bswap_16" = yes; then
251   AC_DEFINE(HAVE_BSWAP_16,1,[Define to 1 if bswap_16 is available via byteswap.h])
252 fi
253 AC_MSG_CHECKING(for bswap_64)
254 AC_CACHE_VAL(krb5_cv_bswap_64,[
255 AC_TRY_LINK([#if HAVE_BYTESWAP_H
256 #include <byteswap.h>
257 #endif],[bswap_64(37);],krb5_cv_bswap_64=yes,krb5_cv_bswap_64=no)])
258 AC_MSG_RESULT($krb5_cv_bswap_64)
259 if test "$krb5_cv_bswap_64" = yes; then
260   AC_DEFINE(HAVE_BSWAP_64,1,[Define to 1 if bswap_64 is available via byteswap.h])
261 fi
262
263 # Needed for ksu and some appl stuff.
264
265 case $krb5_cv_host in
266 alpha*-dec-osf*)
267         AC_CHECK_LIB(security,setluid,
268                 AC_DEFINE(HAVE_SETLUID,1,[Define if setluid provided in OSF/1 security library])
269                 KSU_LIBS="-lsecurity"
270         )
271         ;;
272 esac
273 AC_SUBST(KSU_LIBS)
274
275 if test $ac_cv_func_setenv = no || test $ac_cv_func_unsetenv = no \
276   || test $ac_cv_func_getenv = no; then
277   SETENVOBJ=setenv.o
278 else
279   SETENVOBJ=
280 fi
281 AC_SUBST(SETENVOBJ)
282
283 # Check what the return types for gethostbyname_r and getservbyname_r are.
284
285 AC_CHECK_FUNC(gethostbyname_r,[
286 ac_cv_func_gethostbyname_r=yes
287 if test "$ac_cv_func_gethostbyname_r" = yes; then
288   AC_MSG_CHECKING([if gethostbyname_r returns an int])
289   AC_CACHE_VAL(krb5_cv_gethostbyname_r_returns_int,
290   [AC_TRY_COMPILE([#include <netdb.h>
291   extern int gethostbyname_r ();], [1;],
292   krb5_cv_gethostbyname_r_returns_int=yes,
293   krb5_cv_gethostbyname_r_returns_int=no)])
294   AC_MSG_RESULT($krb5_cv_gethostbyname_r_returns_int)
295
296   AC_MSG_CHECKING([if gethostbyname_r returns a pointer])
297   AC_CACHE_VAL(krb5_cv_gethostbyname_r_returns_ptr,
298   [AC_TRY_COMPILE([#include <netdb.h>
299   extern struct hostent *gethostbyname_r ();], [1;],
300   krb5_cv_gethostbyname_r_returns_ptr=yes,
301   krb5_cv_gethostbyname_r_returns_ptr=no)])
302   AC_MSG_RESULT($krb5_cv_gethostbyname_r_returns_ptr)
303
304   if test "$krb5_cv_gethostbyname_r_returns_int" = "$krb5_cv_gethostbyname_r_returns_ptr"; then
305     AC_MSG_WARN(cannot determine return type of gethostbyname_r -- disabling)
306     ac_cv_func_gethostbyname_r=no
307   fi
308   if test "$krb5_cv_gethostbyname_r_returns_int" = yes; then
309     AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns int rather than struct hostent * ])
310   fi
311 fi
312 if test "$ac_cv_func_gethostbyname_r" = yes; then
313   AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1, [Define if gethostbyname_r exists and its return type is known])
314   AC_CHECK_FUNC(gethostbyaddr_r)
315 fi
316 ])
317
318
319 AC_CHECK_FUNC(getpwnam_r,ac_cv_func_getpwnam_r=yes,ac_cv_func_getpwnam_r=no)
320 AC_CHECK_FUNC(getpwuid_r,ac_cv_func_getpwuid_r=yes,ac_cv_func_getpwuid_r=no)
321 if test "$ac_cv_func_getpwnam_r" = yes; then
322   AC_MSG_CHECKING([return type of getpwnam_r])
323   AC_CACHE_VAL(krb5_cv_getpwnam_r_return_type,
324   [AC_TRY_COMPILE([#include <pwd.h>
325    extern int getpwnam_r();], [1;],
326    getpwnam_r_returns_int=yes,getpwnam_r_returns_int=no)
327    AC_TRY_COMPILE([#include <pwd.h>
328    extern struct passwd *getpwnam_r();], [1;],
329    getpwnam_r_returns_ptr=yes,getpwnam_r_returns_ptr=no)
330    case "$getpwnam_r_returns_int/$getpwnam_r_returns_ptr" in
331      yes/no) krb5_cv_getpwnam_r_return_type=int ;;
332      no/yes) krb5_cv_getpwnam_r_return_type=ptr ;;
333      *) krb5_cv_getpwnam_r_return_type=unknown ;;
334    esac])
335   AC_MSG_RESULT($krb5_cv_getpwnam_r_return_type)
336   if test $krb5_cv_getpwnam_r_return_type = int; then
337     AC_DEFINE(GETPWNAM_R_RETURNS_INT, 1, [Define if getpwnam_r returns an int])
338   elif test $krb5_cv_getpwnam_r_return_type = unknown; then
339     AC_MSG_WARN([Cannot determine getpwnam_r return type, disabling getpwnam_r])
340     ac_cv_func_getpwnam_r=no
341   fi
342 fi
343 if test "$ac_cv_func_getpwnam_r" = yes; then
344   AC_MSG_CHECKING([number of arguments to getpwnam_r])
345   AC_CACHE_VAL(krb5_cv_getpwnam_r_args,
346   [AC_TRY_COMPILE([#include <pwd.h>
347    struct passwd pwx; char buf[1024];],
348    [getpwnam_r("", &pwx, buf, sizeof(buf));], args4=yes, args4=no)
349    AC_TRY_COMPILE([#include <pwd.h>
350    struct passwd pwx, *p; char buf[1024];],
351    [getpwnam_r("", &pwx, buf, sizeof(buf), &p);], args5=yes, args5=no)
352    case $args4/$args5 in
353      yes/no) krb5_cv_getpwnam_r_args=4 ;;
354      no/yes) krb5_cv_getpwnam_r_args=5 ;;
355      *) krb5_cv_getpwnam_r_args=unknown ;;
356    esac])
357   AC_MSG_RESULT($krb5_cv_getpwnam_r_args)
358   if test "$krb5_cv_getpwnam_r_args" = unknown; then
359     AC_MSG_WARN([Cannot determine number of arguments to getpwnam_r, disabling its use.])
360     ac_cv_func_getpwnam_r=no
361   else
362     AC_DEFINE(HAVE_GETPWNAM_R,1,[Define if getpwnam_r is available and useful.])
363     if test "$krb5_cv_getpwnam_r_args" = 4; then
364       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).])
365     fi
366   fi
367 fi
368
369 if test "$ac_cv_func_getpwnam_r" = no && test "$ac_cv_func_getpwuid_r" = yes; then
370   # Actually, we could do this check, and the corresponding checks
371   # for return type and number of arguments, but I doubt we'll run
372   # into a system where we'd get to use getpwuid_r but not getpwnam_r.
373   AC_MSG_NOTICE([getpwnam_r not useful, so disabling getpwuid_r too])
374   ac_cv_func_getpwuid_r=no
375 fi
376 if test "$ac_cv_func_getpwuid_r" = yes; then
377   AC_DEFINE(HAVE_GETPWUID_R,1,[Define if getpwuid_r is available and useful.])
378   # Hack: Assume getpwuid_r is the shorter form if getpwnam_r is.
379   if test "$krb5_cv_getpwnam_r_args" = 4; then
380     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).])
381   fi
382 fi
383
384 if test "$ac_cv_func_gmtime_r" = yes; then
385   AC_MSG_CHECKING([whether gmtime_r returns int])
386   AC_CACHE_VAL(krb5_cv_gmtime_r_returns_int,
387   [AC_TRY_COMPILE([#include <time.h>
388    extern int gmtime_r ();], [1;], return_int=yes, return_int=no)
389    AC_TRY_COMPILE([#include <time.h>
390    extern struct tm *gmtime_r ();], [1;], return_ptr=yes, return_ptr=no)
391    case $return_int/$return_ptr in
392      yes/no) krb5_cv_gmtime_r_returns_int=yes ;;
393      no/yes) krb5_cv_gmtime_r_returns_int=no ;;
394      *)      # Can't figure it out, punt the function.
395              ac_cv_func_gmtime_r=no ;;
396    esac])
397   if test "$ac_cv_func_gmtime_r" = no; then
398     AC_MSG_RESULT(unknown -- ignoring gmtime_r)
399   else
400     AC_MSG_RESULT($krb5_cv_gmtime_r_returns_int)
401     if test "$krb5_cv_gmtime_r_returns_int" = yes; then
402       AC_DEFINE(GMTIME_R_RETURNS_INT,1,[Define if gmtime_r returns int instead of struct tm pointer, as on old HP-UX systems.])
403     fi
404   fi
405 fi
406
407 AC_CHECK_FUNC(getservbyname_r,[
408 ac_cv_func_getservbyname_r=yes
409 if test "$ac_cv_func_getservbyname_r" = yes; then
410   AC_MSG_CHECKING([if getservbyname_r returns an int])
411   AC_CACHE_VAL(krb5_cv_getservbyname_r_returns_int,
412   [AC_TRY_COMPILE([#include <netdb.h>
413   extern int getservbyname_r ();], [1;],
414   krb5_cv_getservbyname_r_returns_int=yes,
415   krb5_cv_getservbyname_r_returns_int=no)])
416   AC_MSG_RESULT($krb5_cv_getservbyname_r_returns_int)
417
418   AC_MSG_CHECKING([if getservbyname_r returns a pointer])
419   AC_CACHE_VAL(krb5_cv_getservbyname_r_returns_ptr,
420   [AC_TRY_COMPILE([#include <netdb.h>
421   extern struct servent *getservbyname_r ();], [1;],
422   krb5_cv_getservbyname_r_returns_ptr=yes,
423   krb5_cv_getservbyname_r_returns_ptr=no)])
424   AC_MSG_RESULT($krb5_cv_getservbyname_r_returns_ptr)
425
426   if test "$krb5_cv_getservbyname_r_returns_int" = "$krb5_cv_getservbyname_r_returns_ptr"; then
427     AC_MSG_WARN(cannot determine return type of getservbyname_r -- disabling)
428     ac_cv_func_getservbyname_r=no
429   fi
430   if test "$krb5_cv_getservbyname_r_returns_int" = yes; then
431     AC_DEFINE(GETSERVBYNAME_R_RETURNS_INT, 1, [Define if getservbyname_r returns int rather than struct servent * ])
432   fi
433 fi
434 if test "$ac_cv_func_getservbyname_r" = yes; then
435   AC_DEFINE(HAVE_GETSERVBYNAME_R, 1, [Define if getservbyname_r exists and its return type is known])
436   AC_CHECK_FUNC(getservbyport_r)
437 fi
438 ])
439
440 HAVE_YYLINENO
441 CHECK_DIRENT
442 AC_TYPE_UID_T
443 AC_TYPE_MODE_T
444
445 AC_CHECK_HEADER(termios.h,
446 [AC_CHECK_FUNC([tcsetattr],
447   AC_DEFINE(POSIX_TERMIOS,1,[Define if termios.h exists and tcsetattr exists]))])
448
449 KRB5_SIGTYPE
450 AC_CHECK_HEADERS(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)
451 AC_HEADER_STDARG
452 KRB5_AC_INET6
453
454 # If compiling with IPv6 support, test if in6addr_any functions.
455 # Irix 6.5.16 defines it, but lacks support in the C library.
456 if test $krb5_cv_inet6 = yes || test "$krb5_cv_inet6_with_dinet6" = yes ; then
457 AC_CACHE_CHECK([for in6addr_any definition in library], 
458   krb5_cv_var_in6addr_any,
459 [AC_TRY_LINK([
460 #ifdef HAVE_SYS_TYPES_H
461 #include <sys/types.h>
462 #endif
463 #include <sys/socket.h>
464 #include <netinet/in.h>
465 #include <netdb.h>
466 ],[
467   struct sockaddr_in6 in;
468   in.sin6_addr = in6addr_any;
469   printf("%x", &in);
470 ],krb5_cv_var_in6addr_any=yes, krb5_cv_var_in6addr_any=no)])
471   if test $krb5_cv_var_in6addr_any = no; then
472     AC_DEFINE(NEED_INSIXADDR_ANY,1,[Define if in6addr_any is not defined in libc])
473   fi
474 fi
475
476
477
478 # check for ANSI stdio, esp "b" option to fopen().  This (unfortunately)
479 # requires a run check...
480
481 AC_MSG_CHECKING([for ANSI stdio])
482 AC_CACHE_VAL(krb5_cv_has_ansi_stdio,
483 [AC_TRY_RUN(
484 [#include <stdio.h>
485 int main()
486 {
487   FILE *conftest;
488   if ((conftest = fopen("conftest.dat", "w")) == NULL) exit(1);
489   if (fclose(conftest)) exit(1);
490   if ((conftest = fopen("conftest.dat", "rb+")) == NULL) exit(1);
491   if (fputs("testing ANSI for stdio\n", conftest) == EOF) exit(1);
492   exit(0);
493 }],
494 krb5_cv_has_ansi_stdio=yes, krb5_cv_has_ansi_stdio=no,
495 krb5_cv_has_ansi_stdio=yes)])# assume ANSI in cross environment
496 AC_MSG_RESULT($krb5_cv_has_ansi_stdio)
497 if test $krb5_cv_has_ansi_stdio = yes; then
498 AC_DEFINE(ANSI_STDIO,1,[Define if ANSI stdio is present (in particular "b" option to fopen)])
499 fi
500
501 # then from osconf.h, we have
502
503 AC_HEADER_TIME
504 AC_CHECK_TYPE(time_t, long)
505
506 # Determine where to put the replay cache.
507
508 AC_MSG_CHECKING([for replay cache directory])
509 AC_CACHE_VAL(krb5_cv_sys_rcdir,
510 [
511 for t_dir in /var/tmp /usr/tmp /var/usr/tmp /tmp ; do
512         test -d $t_dir || continue
513         krb5_cv_sys_rcdir=$t_dir
514         break
515 done])
516 AC_MSG_RESULT($krb5_cv_sys_rcdir)
517 KRB5_RCTMPDIR=$krb5_cv_sys_rcdir
518 AC_SUBST(KRB5_RCTMPDIR)
519
520
521 AC_MSG_CHECKING(for socklen_t)
522 AC_CACHE_VAL(krb5_cv_has_type_socklen_t,
523 [AC_TRY_COMPILE(
524 [#include <sys/types.h>
525 #include <sys/socket.h>
526 ],[sizeof (socklen_t);],
527 krb5_cv_has_type_socklen_t=yes,krb5_cv_has_type_socklen_t=no)])
528 AC_MSG_RESULT($krb5_cv_has_type_socklen_t)
529 if test $krb5_cv_has_type_socklen_t = yes; then
530     AC_DEFINE(HAVE_SOCKLEN_T,1,[Define if there is a socklen_t type. If not, probably use size_t])
531 fi
532
533 AC_MSG_CHECKING(for struct lifconf)
534 AC_CACHE_VAL(krb5_cv_has_struct_lifconf,
535 [AC_TRY_COMPILE(
536 [#include <sys/socket.h>
537 #include <net/if.h>
538 ],[sizeof (struct lifconf);],
539 krb5_cv_has_struct_lifconf=yes,krb5_cv_has_struct_lifconf=no)])
540 AC_MSG_RESULT($krb5_cv_has_struct_lifconf)
541 if test $krb5_cv_has_struct_lifconf = yes; then
542     AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
543 fi
544 # HP-UX 11 uses stuct if_laddrconf
545 AC_MSG_CHECKING(for struct if_laddrconf)
546 AC_CACHE_VAL(krb5_cv_has_struct_if_laddrconf,
547 [AC_TRY_COMPILE(
548 [#include <sys/socket.h>
549 #include <net/if.h>
550 #include <net/if6.h>
551 ],[sizeof (struct if_laddrconf);],
552 krb5_cv_has_struct_if_laddrconf=yes,krb5_cv_has_struct_if_laddrconf=no)])
553 AC_MSG_RESULT($krb5_cv_has_struct_if_laddrconf)
554 if test $krb5_cv_has_struct_if_laddrconf = yes; then
555     AC_DEFINE(HAVE_STRUCT_IF_LADDRCONF,1,[Define if there is a struct if_laddrconf.])
556 fi
557
558
559 AC_MSG_CHECKING([for h_errno in netdb.h])
560 AC_CACHE_VAL(krb5_cv_header_netdb_h_h_errno,
561 [AC_TRY_COMPILE(
562         [#include <netdb.h>],
563         [int x = h_errno;], krb5_cv_header_netdb_h_h_errno=yes,
564         krb5_cv_header_netdb_h_h_errno=no)])
565 AC_MSG_RESULT($krb5_cv_header_netdb_h_h_errno)
566 if test $krb5_cv_header_netdb_h_h_errno = yes; then
567     AC_DEFINE([HAVE_NETDB_H_H_ERRNO], 1,
568         [Define if netdb.h declares h_errno])
569 fi
570
571
572 AC_ARG_ENABLE([athena],
573 [  --enable-athena         build with MIT Project Athena configuration],
574 AC_DEFINE(KRB5_ATHENA_COMPAT,1,[Define if MIT Project Athena default configuration should be used]),)
575
576
577 AC_C_INLINE
578 AH_TOP([
579 #ifndef KRB5_AUTOCONF_H
580 #define KRB5_AUTOCONF_H
581 ])
582 AH_BOTTOM([
583 #if defined(__GNUC__) && !defined(inline)
584 /* Silence gcc pedantic warnings about ANSI C.  */
585 # define inline __inline__
586 #endif
587 #endif /* KRB5_AUTOCONF_H */
588 ])
589
590 # Not used yet, but let's find out what we've got on the platforms
591 # we're working with....
592 AC_CHECK_HEADERS(inttypes.h stdint.h)
593 AC_CHECK_TYPES([uint32_t, int32_t, uint64_t, int64_t, uint_least32_t, uintptr_t, uintmax_t, long long], , , [
594 #ifdef HAVE_STDINT_H
595 # include <stdint.h>
596 #elif defined(HAVE_INTTYPES_H)
597 # include <inttypes.h>
598 #endif
599 ])
600 AC_CHECK_TYPES([struct cmsghdr, struct in_pktinfo, struct in6_pktinfo, struct sockaddr_storage], , , [
601 #include <sys/types.h>
602 #include <sys/socket.h>
603 #include <netinet/in.h>
604 ])
605 AC_CHECK_TYPES([struct rt_msghdr], , , [
606 #include <sys/socket.h>
607 #include <net/if.h>
608 #include <net/route.h>
609 ])
610
611 # stuff for util/profile
612
613 # AC_KRB5_TCL already done
614 DO_TCL=
615 test "$TCL_LIBS" != "" && DO_TCL=ok
616 AC_SUBST(DO_TCL)
617
618 # types libdb2 wants
619
620 AC_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])
621
622 # Some libdb2 test programs want a shell that supports functions.
623 FCTSH=false
624 AC_PATH_PROG(SH,sh,false)
625 AC_PATH_PROG(SH5,sh5,false)
626 AC_PATH_PROG(BASH,bash,false)
627 for prog in $SH $SH5 $BASH; do
628   AC_MSG_CHECKING(if $prog supports functions)
629   if $prog -c 'foo() { true; }; foo' >/dev/null 2>&1; then
630     AC_MSG_RESULT(yes)
631     FCTSH=$prog
632     break
633   else
634     AC_MSG_RESULT(no)
635   fi
636 done
637 AC_SUBST(FCTSH)
638
639 # Test for POSIX 2001 *printf support (X/Open System Interfaces extension
640 # to ANSI/ISO C 1999 specification).  Specifically, positional
641 # specifications; not checking for other features like %zx at present.
642 AC_MSG_CHECKING(for POSIX printf positional specification support)
643 AC_CACHE_VAL(ac_cv_printf_positional,[
644 AC_TRY_RUN([
645 #include <stdio.h>
646 #include <string.h>
647 const char expected[] = "200 100";
648 int main () {
649     char buf[30];
650     sprintf(buf, "%2\$x %1\$d", 100, 512);
651     if (strcmp(expected, buf)) {
652         fprintf(stderr,"bad result: <%s> wanted: <%s>\n", buf, expected);
653         return 1;
654     }
655     return 0;
656 }],
657   ac_cv_printf_positional=yes,
658   ac_cv_printf_positional=no,
659   AC_MSG_ERROR([Cannot test for printf positional argument support when cross compiling]))])
660 # Nothing for autoconf.h for now.
661 AC_MSG_RESULT($ac_cv_printf_positional)
662
663
664 # for kadmin
665
666 AC_PROG_YACC
667 ath_compat=
668 AC_ARG_ENABLE([athena],
669 [  --enable-athena         build with MIT Project Athena configuration],
670 ath_compat=compat,)
671 # The following are tests for the presence of programs required for
672 # kadmin testing.
673 AC_CHECK_PROG(have_RUNTEST,runtest,runtest)
674 AC_CHECK_PROG(have_PERL,perl,perl)
675 AC_KRB5_TCL     
676 if test "$have_PERL" = perl -a "$have_RUNTEST" = runtest -a "$TCL_LIBS" != ""; then
677         DO_TEST=ok
678 fi
679 AC_SUBST(DO_TEST) 
680
681 # The following are substituted into kadmin/testing/scripts/env-setup.sh
682 RBUILD=`pwd`
683 AC_SUBST(RBUILD)
684 case "$srcdir" in
685 /*)     S_TOP=$srcdir ;;
686 *)      S_TOP=`pwd`/$srcdir ;;
687 esac
688 AC_SUBST(S_TOP)
689 AC_PATH_PROG(PERL_PATH,perl)
690 AC_PATH_PROG(EXPECT,expect)
691 # For kadmin/testing/util/Makefile.in
692 if test "$TCL_LIBS" != "" ;  then
693         DO_ALL=tcl
694 fi
695 AC_SUBST(DO_ALL)
696 KRB5_AC_PRIOCNTL_HACK
697 K5_GEN_FILE(kadmin/testing/scripts/env-setup.sh:kadmin/testing/scripts/env-setup.shin)
698 # for lib/kadm5
699 AC_CHECK_PROG(RUNTEST,runtest,runtest)
700 AC_CHECK_PROG(PERL,perl,perl)
701
702 # lib/gssapi
703 AC_CHECK_HEADER(stdint.h,[
704         include_stdint='awk '\''END{printf("%cinclude <stdint.h>\n", 35);}'\'' < /dev/null'],
705         include_stdint='echo "/* no stdint.h */"')
706 AC_SUBST(include_stdint)
707 AC_CHECK_HEADER(inttypes.h,[
708         include_inttypes='awk '\''END{printf("%cinclude <inttypes.h>\n", 35);}'\'' < /dev/null'],
709         include_inttypes='echo "/* no inttypes.h */"')
710 AC_SUBST(include_inttypes)
711 AC_CHECK_HEADER(xom.h,[
712         include_xom='awk '\''END{printf("%cinclude <xom.h>\n", 35);}'\'' < /dev/null'], [
713         include_xom='echo "/* no xom.h */"'])
714 AC_SUBST(include_xom)
715
716
717 # lib/rpc
718 ### Check where struct rpcent is declared.
719
720 # This is necessary to determine:
721 # 1. If /usr/include/netdb.h declares struct rpcent
722 # 2. If /usr/include/rpc/netdb.h declares struct rpcent
723
724 # We have our own rpc/netdb.h, and if /usr/include/netdb.h includes
725 # rpc/netdb.h, then nastiness could happen.
726
727 # Logic: If /usr/include/netdb.h declares struct rpcent, then check
728 # rpc/netdb.h.  If /usr/include/rpc/netdb.h declares struct rpcent,
729 # then define STRUCT_RPCENT_IN_RPC_NETDB_H, otherwise do not.  If
730 # neither netdb.h nor rpc/netdb.h declares struct rpcent, then define
731 # STRUCT_RPCENT_IN_RPC_NETDB_H anyway.
732
733 AC_MSG_CHECKING([where struct rpcent is declared])
734 AC_TRY_COMPILE([#include <netdb.h>],
735 [struct rpcent e;
736 char c = e.r_name[0];
737 int i = e.r_number;],
738 [AC_TRY_COMPILE([#include <rpc/netdb.h>],
739 [struct rpcent e;
740 char c = e.r_name[0];
741 int i = e.r_number;],
742 [AC_MSG_RESULT([rpc/netdb.h])
743 rpcent_define='#define STRUCT_RPCENT_IN_RPC_NETDB_H'],
744 [AC_MSG_RESULT([netdb.h])])],
745 [AC_MSG_RESULT([nowhere])
746 rpcent_define='#define STRUCT_RPCENT_IN_RPC_NETDB_H'])
747 AC_SUBST(rpcent_define)
748
749 AC_CHECK_HEADERS(sys/select.h sys/time.h unistd.h)
750 if test $ac_cv_header_sys_select_h = yes; then
751   GSSRPC__SYS_SELECT_H='#include <sys/select.h>'
752 else
753   GSSRPC__SYS_SELECT_H='/* #include <sys/select.h> */'
754 fi
755 AC_SUBST(GSSRPC__SYS_SELECT_H)
756 if test $ac_cv_header_sys_time_h = yes; then
757   GSSRPC__SYS_TIME_H='#include <sys/time.h>'
758 else
759   GSSRPC__SYS_TIME_H='/* #include <sys/time.h> */'
760 fi
761 AC_SUBST(GSSRPC__SYS_TIME_H)
762 if test $ac_cv_header_unistd_h = yes; then
763   GSSRPC__UNISTD_H='#include <unistd.h>'
764 else
765   GSSRPC__UNISTD_H='/* #include <unistd.h> */'
766 fi
767 AC_SUBST(GSSRPC__UNISTD_H)
768
769 AC_CACHE_CHECK([for MAXHOSTNAMELEN in sys/param.h],
770   [krb5_cv_header_sys_param_h_maxhostnamelen],
771   [AC_TRY_COMPILE([#include <sys/param.h>],
772     [int i = MAXHOSTNAMELEN;],
773     [krb5_cv_header_sys_param_h_maxhostnamelen=yes],
774     [krb5_cv_header_sys_param_h_maxhostnamelen=no])])
775 AC_CACHE_CHECK([for MAXHOSTNAMELEN in netdb.h],
776   [krb5_cv_header_netdb_h_maxhostnamelen],
777   [AC_TRY_COMPILE([#include <netdb.h>],
778     [int i = MAXHOSTNAMELEN;],
779     [krb5_cv_header_netdb_h_maxhostnamelen=yes],
780     [krb5_cv_header_netdb_h_maxhostnamelen=no])])
781
782 GSSRPC__SYS_PARAM_H='/* #include <sys/param.h> */'
783 GSSRPC__NETDB_H='/* #include <netdb.h> */'
784 if test $krb5_cv_header_sys_param_h_maxhostnamelen = yes; then
785   GSSRPC__SYS_PARAM_H='#include <sys/param.h>'
786 else
787   if test $krb5_cv_header_netdb_h_maxhostnamelen = yes; then
788     GSSRPC__NETDB_H='#include <netdb.h>'
789   else
790     AC_MSG_WARN([can't find MAXHOSTNAMELEN definition; faking it])
791   fi
792 fi
793 AC_SUBST(GSSRPC__SYS_PARAM_H)
794 AC_SUBST(GSSRPC__NETDB_H)
795
796 AC_CACHE_CHECK([for uint32_t in sys/types.h],
797   [krb5_cv_header_sys_types_h_uint32_t],
798   [AC_TRY_COMPILE([#include <sys/types.h>],
799       [uint32_t i = 0;],
800       [krb5_cv_header_sys_types_h_uint32_t=yes],
801       [krb5_cv_header_sys_types_h_uint32_t=no])])
802 AC_CACHE_CHECK([for uint32_t in stdint.h],
803   [krb5_cv_header_stdint_h_uint32_t],
804   [AC_TRY_COMPILE([#include <stdint.h>],
805       [uint32_t i = 0;],
806       [krb5_cv_header_stdint_h_uint32_t=yes],
807       [krb5_cv_header_stdint_h_uint32_t=no])])
808 AC_CACHE_CHECK([for uint32_t in inttypes.h],
809   [krb5_cv_header_inttypes_h_uint32_t],
810   [AC_TRY_COMPILE([#include <inttypes.h>],
811       [uint32_t i = 0;],
812       [krb5_cv_header_inttypes_h_uint32_t=yes],
813       [krb5_cv_header_inttypes_h_uint32_t=no])])
814 GSSRPC__STDINT_H='/* #include <stdint.h> */'
815 GSSRPC__INTTYPES_H='/* #include <inttypes.h> */'
816 GSSRPC__FAKE_UINT32='/* #undef GSSRPC__FAKE_INT32 */'
817 if test $krb5_cv_header_sys_types_h_uint32_t = yes; then
818   : # already included sys/types.h
819 else
820   if test $krb5_cv_header_stdint_h_uint32_t = yes; then
821     GSSRPC__STDINT_H='#include <stdint.h>'
822   else
823     if test $krb5_cv_header_inttypes_h_uint32_t = yes; then
824       GSSRPC__INTTYPES_H='#include <inttypes.h>'
825     else
826       AC_MSG_WARN([can't find a fixed-width 32-bit type anywhere; faking it])
827       GSSRPC__FAKE_UINT32='#define GSSRPC__FAKE_UINT32 1'
828     fi
829   fi
830 fi
831 AC_SUBST(GSSRPC__STDINT_H)
832 AC_SUBST(GSSRPC__INTTYPES_H)
833 AC_SUBST(GSSRPC__FAKE_UINT32)
834
835 AC_CACHE_CHECK([for BSD type aliases], [krb5_cv_type_bsdaliases],
836   [AC_TRY_COMPILE(
837     [#include <sys/types.h>
838 #if HAVE_UNISTD_H
839 #include <unistd.h>
840 #endif],
841     [u_char c;
842 u_int i;
843 u_long l;], [krb5_cv_type_bsdaliases=yes], [krb5_cv_type_bsdaliases=no])])
844 if test $krb5_cv_type_bsdaliases = yes; then
845   GSSRPC__BSD_TYPEALIASES='/* #undef GSSRPC__BSD_TYPEALIASES */'
846 else
847   GSSRPC__BSD_TYPEALIASES='#define GSSRPC__BSD_TYPEALIASES 1'
848 fi
849 AC_SUBST(GSSRPC__BSD_TYPEALIASES)
850
851 # sockaddr length field checks
852
853 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len], , ,
854   [#include <sys/types.h>
855 @%:@include <netinet/in.h>])
856 AC_CHECK_MEMBERS([struct sockaddr.sa_len], , ,
857   [#include <sys/types.h>
858 @%:@include <sys/socket.h>])
859
860 AC_MSG_CHECKING([return type of setrpcent])
861 AC_CACHE_VAL(k5_cv_type_setrpcent,
862 [AC_TRY_COMPILE([#include <netdb.h>
863 #ifdef __cplusplus
864 extern "C"
865 #endif
866 extern void setrpcent();],
867 [int i;], k5_cv_type_setrpcent=void, k5_cv_type_setrpcent=int)])
868 AC_MSG_RESULT($k5_cv_type_setrpcent)
869 AC_DEFINE_UNQUOTED(SETRPCENT_TYPE, $k5_cv_type_setrpcent, [Define as return type of setrpcent])
870
871 AC_MSG_CHECKING([return type of endrpcent])
872 AC_CACHE_VAL(k5_cv_type_endrpcent,
873 [AC_TRY_COMPILE([#include <netdb.h>
874 #ifdef __cplusplus
875 extern "C"
876 #endif
877 extern void endrpcent();],
878 [int i;], k5_cv_type_endrpcent=void, k5_cv_type_endrpcent=int)])
879 AC_MSG_RESULT($k5_cv_type_endrpcent)
880 AC_DEFINE_UNQUOTED(ENDRPCENT_TYPE, $k5_cv_type_endrpcent, [Define as return type of endrpcent])
881 K5_GEN_FILE(include/gssrpc/types.h:include/gssrpc/types.hin)
882 changequote(<<, >>)
883 case "$krb5_cv_host" in
884 *-*-solaris2.[012345]*)
885         PASS=tcp
886         ;;
887 *)
888         PASS="tcp udp"
889         ;;
890 esac
891 changequote([, ])
892 AC_SUBST(PASS)
893
894 # for pkinit
895 AC_ARG_ENABLE([pkinit],
896 [  --disable-pkinit        disable PKINIT plugin support],,
897 enable_pkinit=try)
898 if test "$enable_pkinit" = yes || test "$enable_pkinit" = try; then
899   AC_CACHE_CHECK(for a recent enough OpenSSL, k5_cv_openssl_version_okay,
900 [AC_COMPILE_IFELSE([#include <openssl/opensslv.h>
901 #if OPENSSL_VERSION_NUMBER < 0x00908000L
902 # error openssl is too old, need 0.9.8
903 #endif
904 int i = 1;
905 ], k5_cv_openssl_version_okay=yes, k5_cv_openssl_version_okay=no)])
906   old_LIBS="$LIBS"
907   AC_CHECK_LIB(crypto, PKCS7_get_signer_info)
908   LIBS="$old_LIBS"
909 fi
910 if test "$k5_cv_openssl_version_okay" = yes && (test "$enable_pkinit" = yes || test "$enable_pkinit" = try); then
911   K5_GEN_MAKEFILE(plugins/preauth/pkinit)
912 elif test "$k5_cv_openssl_version_okay" = no && test "$enable_pkinit" = yes; then
913   AC_MSG_ERROR([Version of OpenSSL is too old; cannot enable PKINIT.])
914 else
915   AC_DEFINE([DISABLE_PKINIT], 1, [Define to disable PKINIT plugin support])
916   AC_MSG_NOTICE([Disabling PKINIT support.])
917 fi
918
919 # for lib/apputils
920 AC_REPLACE_FUNCS(daemon)
921
922 # for tests/
923 if test x"$RUNTEST" != x; then
924         HAVE_RUNTEST=yes
925 else
926         HAVE_RUNTEST=no
927 fi
928 AC_SUBST(HAVE_RUNTEST)
929
930 # for plugins/kdb/db2
931
932 # AIX is unusual in that it wants all symbols resolved at link time
933 #  Fortunately, it will allow us to link the kdb library now, even if
934 # it is linked again later.
935 case $krb5_cv_host in
936 *-*-aix*)
937         DB_EXTRA_LIBS=-ldb
938         ;;
939 *)
940         DB_EXTRA_LIBS=
941         ;;
942 esac
943 AC_SUBST(DB_EXTRA_LIBS)
944
945
946
947 # Check for thread safety issues.
948 # (Is there a better place for this?)
949 # tsfuncs="getpwnam_r getpwuid_r gethostbyname_r getservbyname_r gmtime_r localtime_r"
950 # Removed getpwnam_r and getpwuid_r because include/configure.in has some
951 # more careful checks, and may decide to pretend that they're not found if
952 # the function signatures can't be figured out.
953 tsfuncs="gethostbyname_r getservbyname_r gmtime_r localtime_r"
954 AC_CHECK_FUNCS($tsfuncs)
955 if test "$enable_thread_support" = yes; then
956   tsmissing=""
957   for ts in $tsfuncs; do
958     if eval "test \"\${ac_cv_func_$ts}\" != yes"; then
959       tsmissing="$tsmissing $ts"
960     fi
961   done
962   if test "$ac_cv_func_res_nsearch/$ac_cv_lib_resolv_res_nsearch" = "no/no"; then
963     tsmissing="$tsmissing res_nsearch"
964   fi
965   if test "$tsmissing" != ""; then
966     AC_MSG_WARN([Some functions that are needed for library thread])
967     AC_MSG_WARN([safety appear to be missing.])
968     for ts in $tsmissing; do
969       AC_MSG_WARN([  missing thread-safe function: $ts])
970     done
971     AC_MSG_WARN([Without these functions, the installed libraries])
972     AC_MSG_WARN([may not be thread-safe.])
973   fi # tsmissing not empty
974 fi # enable_thread_support
975
976 # Sadly, we seem to have accidentally committed ourselves in 1.4 to
977 # an ABI that includes the existence of libkrb5support.0 even
978 # though random apps should never use anything from it.  And on
979 # the Mac, to which that didn't apply, we can't use major version 0.
980
981 case $krb5_cv_host in
982 *-*-darwin* | *-*-rhapsody*) SUPPORTLIB_MAJOR=1 ;;
983 *)                           SUPPORTLIB_MAJOR=0 ;;
984 esac
985 AC_SUBST(SUPPORTLIB_MAJOR)
986
987 # On the Mac we need CoreFoundation for UCS-2 conversion for RC4.
988 case $krb5_cv_host in
989 *-*-darwin* | *-*-rhapsody*) CRYPTO_LIBS="-framework CoreFoundation" ;;
990 *)                           CRYPTO_LIBS="" ;;
991 esac
992 AC_SUBST(CRYPTO_LIBS)
993
994
995 if test "$COM_ERR_VERSION" = k5 ; then
996   K5_GEN_MAKEFILE(util/et)
997 fi
998 if test "$SS_VERSION" = k5 ; then
999   K5_GEN_MAKEFILE(util/ss)
1000 fi
1001
1002
1003 ldap_plugin_dir=""
1004 ldap_lib=""
1005 if test -n "$OPENLDAP_PLUGIN"; then
1006   AC_CHECK_HEADERS(ldap.h lber.h, :, [AC_MSG_ERROR($ac_header not found)])
1007   AC_CHECK_LIB(ldap, ldap_init, :, [AC_MSG_ERROR(libldap not found or missing ldap_init)])
1008   old_LIBS="$LIBS"
1009   LIBS="$LIBS -lldap"
1010   AC_CHECK_FUNCS(ldap_initialize ldap_url_parse_nodn ldap_unbind_ext_s ldap_str2dn ldap_explode_dn)
1011   LIBS="$old_LIBS"
1012
1013   BER_OKAY=0
1014   AC_CHECK_LIB(ldap, ber_init, [BER_OKAY=1])
1015   if test "$BER_OKAY" = "1"; then 
1016     LDAP_LIBS='-lldap'
1017   else
1018     AC_CHECK_LIB(lber, ber_init, [BER_OKAY=1], [AC_MSG_WARN([libber not found])])
1019     if test "$BER_OKAY" = "1"; then 
1020       LDAP_LIBS='-lldap -llber'
1021     else
1022       AC_ERROR("BER library missing - cannot build LDAP database module")
1023     fi
1024   fi
1025   AC_DEFINE([ENABLE_LDAP], 1, [Define if LDAP KDB support within the Kerberos library (mainly ASN.1 code) should be enabled.])
1026   AC_SUBST(LDAP_LIBS)
1027
1028   K5_GEN_MAKEFILE(plugins/kdb/ldap)
1029   K5_GEN_MAKEFILE(plugins/kdb/ldap/ldap_util)
1030   K5_GEN_MAKEFILE(plugins/kdb/ldap/libkdb_ldap)
1031   ldap_plugin_dir=plugins/kdb/ldap
1032   LDAP=yes
1033 else
1034   LDAP=no
1035 fi
1036 AC_SUBST(ldap_plugin_dir)
1037 AC_SUBST(LDAP)
1038
1039 # We really should look for and use python-config.
1040 PYTHON_LIB=
1041 AC_CHECK_HEADERS(Python.h python2.3/Python.h python2.5/Python.h)
1042 AC_CHECK_LIB(python2.3,main,[PYTHON_LIB=-lpython2.3],
1043   AC_CHECK_LIB(python2.5,main,[PYTHON_LIB=-lpython2.5]))
1044 AC_SUBST(PYTHON_LIB)
1045
1046
1047 # Kludge for simple server --- FIXME is this the best way to do this?
1048
1049 if test "$ac_cv_lib_socket" = "yes" -a "$ac_cv_lib_nsl" = "yes"; then
1050         AC_DEFINE(BROKEN_STREAMS_SOCKETS,1,[Define if socket can't be bound to 0.0.0.0])
1051 fi
1052
1053 AC_CONFIG_SUBDIRS(appl/libpty appl/bsd appl/gssftp appl/telnet)
1054
1055 AC_CONFIG_FILES(krb5-config, [chmod +x krb5-config])
1056 V5_AC_OUTPUT_MAKEFILE(.
1057
1058         util util/support util/profile util/send-pr
1059
1060         lib lib/kdb
1061
1062         lib/crypto lib/crypto/krb lib/crypto/krb/crc32 lib/crypto/builtin/des
1063         lib/crypto/krb/dk lib/crypto/builtin/enc_provider
1064         lib/crypto/builtin/hash_provider lib/crypto/krb/keyhash_provider
1065         lib/crypto/krb/prf lib/crypto/krb/rand2key
1066         lib/crypto/builtin lib/crypto/builtin/md4 lib/crypto/builtin/md5
1067         lib/crypto/krb/old lib/crypto/krb/raw lib/crypto/builtin/sha1
1068         lib/crypto/builtin/arcfour lib/crypto/krb/yarrow lib/crypto/builtin/aes
1069         lib/crypto/crypto_tests
1070
1071         lib/krb5 lib/krb5/error_tables lib/krb5/asn.1 lib/krb5/ccache
1072 dnl     lib/krb5/ccache/ccapi
1073         lib/krb5/keytab lib/krb5/krb lib/krb5/rcache lib/krb5/os
1074         lib/krb5/unicode
1075
1076         lib/gssapi lib/gssapi/generic lib/gssapi/krb5 lib/gssapi/spnego
1077         lib/gssapi/mechglue
1078
1079         lib/rpc lib/rpc/unit-test
1080
1081         lib/kadm5 lib/kadm5/clnt lib/kadm5/srv lib/kadm5/unit-test
1082
1083         lib/apputils
1084
1085 dnl     ccapi ccapi/lib ccapi/lib/unix ccapi/server ccapi/server/unix ccapi/test
1086
1087         kdc slave config-files gen-manpages include
1088
1089         plugins/locate/python
1090         plugins/kdb/db2
1091         plugins/kdb/db2/libdb2
1092         plugins/kdb/db2/libdb2/hash
1093         plugins/kdb/db2/libdb2/btree
1094         plugins/kdb/db2/libdb2/db
1095         plugins/kdb/db2/libdb2/mpool
1096         plugins/kdb/db2/libdb2/recno
1097         plugins/kdb/db2/libdb2/test
1098         plugins/preauth/cksum_body plugins/preauth/encrypted_challenge
1099         plugins/preauth/wpse
1100         plugins/authdata/greet
1101
1102         clients clients/klist clients/kinit clients/kvno
1103         clients/kdestroy clients/kpasswd clients/ksu
1104
1105         kadmin kadmin/cli kadmin/dbutil kadmin/ktutil kadmin/server
1106         kadmin/testing kadmin/testing/scripts kadmin/testing/util
1107
1108         appl
1109         appl/sample appl/sample/sclient appl/sample/sserver
1110         appl/simple appl/simple/client appl/simple/server
1111         appl/gss-sample appl/user_user
1112
1113         tests tests/resolve tests/asn.1 tests/create tests/hammer
1114         tests/verify tests/gssapi tests/dejagnu tests/threads tests/shlib
1115         tests/gss-threads tests/misc tests/mkeystash_compat
1116         util/collected-client-lib
1117 )