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