* configure.in: Check for various _r functions needed for thread safety. If
[krb5.git] / src / configure.in
1 AC_INIT
2 AC_CONFIG_SRCDIR([aclocal.m4])
3 dnl
4 dnl autoconf 2.49 defaults to a /dev/null cache file, which is what we
5 dnl do not want for performance reasons. 
6 if test "x$cache_file" = "x/dev/null"; then
7   cache_file=./config.cache
8   AC_CACHE_LOAD
9 fi
10 dnl
11 CONFIG_RULES
12 dnl
13 dnl Determine version from patchlevel.h
14 eval `sed 's/#define \([A-Z0-9_]*\)[ \t]*\(.*\)/\1=\2/' < $srcdir/patchlevel.h`
15 KRB5_VERSION="$KRB5_MAJOR_RELEASE.$KRB5_MINOR_RELEASE.$KRB5_PATCHLEVEL"
16 AC_SUBST(KRB5_VERSION)
17 dnl
18 AC_REQUIRE_CPP
19 dnl
20 dnl The following lines are so that configure --help gives some global 
21 dnl configuration options.
22 dnl
23 KRB5_LIB_AUX
24 AC_KRB5_TCL
25 AC_ARG_ENABLE([athena],
26 [  --enable-athena         build with MIT Project Athena configuration],,)
27 dnl
28 if test -z "$KRB4_LIB"; then
29 kadminv4=""
30 krb524=""
31 libkrb4=""
32 KRB4=""
33 else
34 kadminv4=kadmin.v4
35 krb524=krb524
36 libkrb4=lib/krb4
37 KRB4=krb4
38 fi
39 AC_SUBST(KRB4)
40 AC_SUBST(krb524)
41 dnl
42 dnl Begin autoconf tests for the Makefiles generated out of the top-level
43 dnl configure.in...
44 dnl
45 AC_CHECK_FUNCS(memmove)
46 KRB5_BUILD_LIBOBJS
47 KRB5_BUILD_LIBRARY_WITH_DEPS
48 KRB5_BUILD_PROGRAM
49 dnl for slave
50 AC_TYPE_MODE_T
51 AC_PROG_INSTALL
52 KRB5_AC_NEED_DAEMON
53 KRB5_GETSOCKNAME_ARGS
54 KRB5_GETPEERNAME_ARGS
55 LIBUTIL=
56 AC_CHECK_LIB(util,main,[AC_DEFINE(HAVE_LIBUTIL)
57 LIBUTIL=-lutil
58 ])
59 AC_SUBST(LIBUTIL)
60 dnl for kdc
61 AC_CHECK_HEADERS(syslog.h stdarg.h sys/select.h sys/sockio.h ifaddrs.h unistd.h)
62 AC_CHECK_FUNCS(openlog syslog closelog strftime vsprintf)
63 KRB5_NEED_PROTO([#include <string.h>
64 #ifdef HAVE_UNISTD_H
65 #include <unistd.h>
66 #endif
67 /* Solaris 8 declares swab in stdlib.h.  */
68 #include <stdlib.h>
69 ],swab,1)
70 dnl
71 AC_PROG_AWK
72 KRB5_AC_INET6
73 KRB5_SOCKADDR_SA_LEN
74 CHECK_SIGNALS
75 dnl
76 dnl --with-vague-errors disables useful error messages.
77 dnl
78 AC_ARG_WITH([vague-errors],
79 AC_HELP_STRING([--with-vague-errors],[Do not @<:@do@:>@ send helpful errors to client]), , withval=no)dnl
80 if test "$withval" = yes; then
81         AC_MSG_RESULT(Supplying vague error messages to KDC clients)
82         AC_DEFINE(KRBCONF_VAGUE_ERRORS)
83 fi
84 dnl
85 dnl --with-kdc-kdb-update makes the KDC update the database with last request
86 dnl information and failure information.
87 dnl
88 AC_ARG_WITH([kdc-kdb-update],
89 AC_HELP_STRING([--with-kdc-kdb-update],[Update the database @<:@don't update@:>@]), , withval=no)dnl
90 if test "$withval" = yes; then
91         AC_MSG_RESULT(Updating KDC database with each request)
92         AC_DEFINE(KRBCONF_KDC_MODIFIES_KDB)
93 fi
94 dnl
95 dnl Needed for hw-preauth replay detection on KDC.
96 dnl
97 dnl USE_RCACHE enables the replay cache
98 dnl NOCACHE disables the lookaside cache
99 dnl
100 dnl The lookaside cache is checked first; if *exactly* the same message
101 dnl comes in twice, e.g., because the (legitimate) client resent it,
102 dnl the previous response will be resent.  Otherwise, the replay cache
103 dnl is used to check for attempts to fake out the KDC.  Some hardware
104 dnl preauth methods are weak enough that we *really* want to have this
105 dnl checking turned on.
106 dnl
107 AC_ARG_ENABLE([kdc-replay-cache],
108 AC_HELP_STRING([--enable-kdc-replay-cache],[check for replayed/retransmitted KDC requests (recommended when hardware preauthentication is in use) @<:@disabled@:>@]), , enableval=yes)dnl
109 if test "$enableval" = yes ; then
110         AC_DEFINE(USE_RCACHE)
111 else
112         AC_DEFINE(NOCACHE)
113 fi
114 AC_ARG_ENABLE([fakeka],
115 AC_HELP_STRING([--enable-fakeka],[build the Fake KA server (emulates an AFS kaserver) @<:@default: don't build@:>@]), , enableval=no)dnl
116 if test "$enableval" = yes; then
117         FAKEKA=fakeka
118 else
119         FAKEKA=
120 fi
121 AC_SUBST(FAKEKA)
122 KRB5_RUN_FLAGS
123 dnl
124 dnl for krb524
125 AC_TYPE_SIGNAL
126 dnl
127 dnl
128 dnl Check for thread safety issues.
129 dnl (Is there a better place for this?)
130 tsfuncs="getpwnam_r getpwuid_r gethostbyname_r getservbyname_r gmtime_r localtime_r"
131 AC_CHECK_FUNCS($tsfuncs)
132 if test "$enable_thread_support" = yes; then
133   tsmissing=""
134   for ts in $tsfuncs; do
135     if eval "test \"\${ac_cv_func_$ts}\" != yes"; then
136       tsmissing="$tsmissing $ts"
137     fi
138   done
139   if test "$tsmissing" != ""; then
140     AC_MSG_WARN([Some functions that are needed for library thread])
141     AC_MSG_WARN([safety appear to be missing.])
142     for ts in $tsmissing; do
143       AC_MSG_WARN([  missing thread-safe function: $ts])
144     done
145     AC_MSG_WARN([Without these functions, the installed libraries])
146     AC_MSG_WARN([may not be thread-safe.])
147   fi # tsmissing not empty
148 fi # enable_thread_support
149 dnl
150 HOST_TYPE=$krb5_cv_host
151 AC_SUBST(HOST_TYPE)
152 dnl
153 dnl
154 if test "$COM_ERR_VERSION" = k5 ; then
155   AC_CONFIG_SUBDIRS(util/et)
156 fi
157 if test "$SS_VERSION" = k5 ; then
158   AC_CONFIG_SUBDIRS(util/ss)
159 fi
160 AC_CONFIG_SUBDIRS(util/profile util/pty)
161 if test "$DB_VERSION" = k5 ; then
162   AC_CONFIG_SUBDIRS(util/db2)
163 fi
164 AC_CONFIG_SUBDIRS(include lib/crypto lib/krb5 lib/des425 lib/apputils)
165 if test -n "$KRB4_LIB"; then
166   AC_CONFIG_SUBDIRS(lib/krb4)
167 fi
168 AC_CONFIG_SUBDIRS(lib/kdb lib/gssapi lib/rpc lib/kadm5)
169 dnl if test -n "$KRB4_LIB"; then
170 dnl   AC_CONFIG_SUBDIRS(krb524)
171 dnl fi
172
173 AC_CONFIG_SUBDIRS(kadmin clients appl tests)
174 AC_CONFIG_FILES(krb5-config, [chmod +x krb5-config])
175 V5_AC_OUTPUT_MAKEFILE(. util util/support util/send-pr lib kdc slave krb524 config-files gen-manpages)