Merge from vendor branch BSDTAR:
[dragonfly.git] / crypto / heimdal / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision: 1.325.2.2 $)
3 AC_PREREQ(2.53)
4 #test -z "$CFLAGS" && CFLAGS="-g"
5 AC_INIT(Heimdal, 0.5.1, heimdal-bugs@pdc.kth.se)
6 AC_CONFIG_SRCDIR([kuser/kinit.c])
7 AM_CONFIG_HEADER(include/config.h)
8
9 dnl Checks for programs.
10 AC_PROG_CC
11 AC_PROG_CPP
12 AC_PROG_CC_STDC
13
14 AM_INIT_AUTOMAKE
15
16 AC_PREFIX_DEFAULT(/usr/heimdal)
17
18 test "$sysconfdir" = '${prefix}/etc' && sysconfdir='/etc'
19 test "$localstatedir" = '${prefix}/var' && localstatedir='/var/heimdal'
20
21 AC_CANONICAL_HOST
22 CANONICAL_HOST=$host
23 AC_SUBST(CANONICAL_HOST)
24
25 AC_SYS_LARGEFILE
26
27 dnl
28 dnl this is needed to run the configure tests against glibc
29 dnl
30 AC_DEFINE([_GNU_SOURCE], 1,
31         [Define to enable extensions on glibc-based systems such as Linux.])
32
33 AC_OBJEXT
34 AC_EXEEXT
35
36 dnl AC_KRB_PROG_YACC
37 AC_PROG_YACC
38 AM_PROG_LEX
39 dnl AC_PROG_RANLIB
40 AC_PROG_AWK
41 AC_KRB_PROG_LN_S
42
43 AC_MIPS_ABI
44 CC="$CC $abi"
45 libdir="$libdir$abilibdirext"
46
47 AC_C___ATTRIBUTE__
48
49 AC_ENABLE_SHARED(no)
50 AC_PROG_LIBTOOL
51
52 AC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
53
54 rk_TEST_PACKAGE(openldap,
55 [#include <lber.h>
56 #include <ldap.h>],
57 [-lldap -llber],,,OPENLDAP)
58
59 rk_TEST_PACKAGE(krb4,[#include <krb.h>],-lkrb,-ldes,/usr/athena, KRB4, krb4-config)
60
61 LIB_kdb=
62 if test "$with_krb4" != "no"; then
63         save_CFLAGS="$CFLAGS"
64         CFLAGS="$CFLAGS $INCLUDE_krb4"
65         save_LIBS="$LIBS"
66         LIBS="$LIB_krb4 $LIBS"
67         EXTRA_LIB45=lib45.a
68         AC_SUBST(EXTRA_LIB45)
69         AC_CACHE_CHECK(for four valued krb_put_int, ac_cv_func_krb_put_int_four,
70                 [AC_TRY_COMPILE([#include <krb.h>],[
71                 char tmp[4];
72                 krb_put_int(17, tmp, 4, sizeof(tmp));],
73                 ac_cv_func_krb_put_int_four=yes,
74                 ac_cv_func_krb_put_int_four=no)
75         ])
76         if test "$ac_cv_func_krb_put_int_four" = yes; then
77                 AC_DEFINE(HAVE_FOUR_VALUED_KRB_PUT_INT, 1,
78                         [define if krb_put_int takes four arguments.])
79         fi
80         AH_BOTTOM([#if defined(HAVE_FOUR_VALUED_KRB_PUT_INT) || !defined(KRB4)
81 #define KRB_PUT_INT(F, T, L, S) krb_put_int((F), (T), (L), (S))
82 #else
83 #define KRB_PUT_INT(F, T, L, S) krb_put_int((F), (T), (S))
84 #endif
85 ])
86         AC_CACHE_CHECK(for KRB_VERIFY_SECURE, ac_cv_func_krb_verify_secure,
87                 [AC_TRY_COMPILE([#include <krb.h>],[
88                 int x = KRB_VERIFY_SECURE],
89                 ac_cv_func_krb_verify_secure=yes,
90                 ac_cv_func_krb_verify_secure=no)
91         ])
92         if test "$ac_cv_func_krb_verify_secure" != yes; then
93                 AC_DEFINE(KRB_VERIFY_SECURE, 1,
94                         [Define to one if your krb.h doesn't])
95                 AC_DEFINE(KRB_VERIFY_SECURE_FAIL, 2,
96                         [Define to two if your krb.h doesn't])
97         fi
98         AC_CACHE_CHECK(for KRB_VERIFY_NOT_SECURE,
99                 ac_cv_func_krb_verify_not_secure,
100                 [AC_TRY_COMPILE([#include <krb.h>],[
101                 int x = KRB_VERIFY_NOT_SECURE],
102                 ac_cv_func_krb_verify_not_secure=yes,
103                 ac_cv_func_krb_verify_not_secure=no)
104         ])
105         if test "$ac_cv_func_krb_verify_not_secure" != yes; then
106                 AC_DEFINE(KRB_VERIFY_NOT_SECURE, 0,
107                         [Define to zero if your krb.h doesn't])
108         fi
109         AC_FIND_FUNC(krb_enable_debug)
110         AC_FIND_FUNC(krb_disable_debug)
111         AC_FIND_FUNC(krb_get_our_ip_for_realm)
112         AC_FIND_FUNC(krb_kdctimeofday)
113         AH_BOTTOM(
114         [#ifndef HAVE_KRB_KDCTIMEOFDAY
115 #define krb_kdctimeofday(X) gettimeofday((X), NULL)
116 #endif])
117         AC_FIND_FUNC(krb_get_kdc_time_diff)
118         AH_BOTTOM(
119         [#ifndef HAVE_KRB_GET_KDC_TIME_DIFF
120 #define krb_get_kdc_time_diff() (0)
121 #endif])
122         AC_CACHE_CHECK([for KRB_SENDAUTH_VERS],
123                 ac_cv_func_krb_sendauth_vers,
124                 [AC_TRY_COMPILE([#include <krb.h>
125                         #include <prot.h>],[
126                 char *x = KRB_SENDAUTH_VERS],
127                 ac_cv_func_krb_sendauth_vers=yes,
128                 ac_cv_func_krb_sendauth_vers=no)
129         ])
130         if test "$ac_cv_func_krb_sendauth_vers" != yes; then
131                 AC_DEFINE(KRB_SENDAUTH_VERS, ["AUTHV0.1"],
132                         [This is the krb4 sendauth version.])
133         fi
134         AC_CACHE_CHECK(for krb_mk_req with const arguments,
135                 ac_cv_func_krb_mk_req_const,
136                 [AC_TRY_COMPILE([#include <krb.h>
137                 int krb_mk_req(KTEXT a, const char *s, const char *i,
138                                const char *r, int32_t checksum)
139                 { return 17; }], [],
140                 ac_cv_func_krb_mk_req_const=yes,
141                 ac_cv_func_krb_mk_req_const=no)
142         ])
143         if test "$ac_cv_func_krb_mk_req_const" = "yes"; then
144                 AC_DEFINE(KRB_MK_REQ_CONST, 1,
145                         [Define if krb_mk_req takes const char *])
146         fi
147
148         LIBS="$save_LIBS"
149         CFLAGS="$save_CFLAGS"
150         LIB_kdb="-lkdb -lkrb"
151 fi
152 AM_CONDITIONAL(KRB4, test "$with_krb4" != "no")
153 AM_CONDITIONAL(KRB5, true)
154 AM_CONDITIONAL(do_roken_rename, true)
155
156 AC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
157 AC_SUBST(LIB_kdb)dnl
158
159 KRB_CRYPTO
160
161 AC_ARG_ENABLE(dce, 
162         AC_HELP_STRING([--enable-dce],[if you want support for DCE/DFS PAG's]))
163 if test "$enable_dce" = yes; then
164     AC_DEFINE(DCE, 1, [Define if you want support for DCE/DFS PAG's.])
165 fi
166 AM_CONDITIONAL(DCE, test "$enable_dce" = yes)
167
168 ## XXX quite horrible:
169 if test -f /etc/ibmcxx.cfg; then
170         dpagaix_ldadd=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/libraries/{;s/^[[^=]]*=\(.*\)/\1/;s/,/ /gp;}'`
171         dpagaix_cflags=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/options/{;s/^[[^=]]*=\(.*\)/\1/;s/-q[^,]*//;s/,/ /gp;}'`
172         dpagaix_ldflags=
173 else
174         dpagaix_cflags="-D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce"
175         dpagaix_ldadd="-L/usr/lib/threads -ldcelibc_r -ldcepthreads -lpthreads_compat lpthreads -lc_r"
176         dpagaix_ldflags="-Wl,-bI:dfspag.exp"
177 fi
178 AC_SUBST(dpagaix_cflags)
179 AC_SUBST(dpagaix_ldadd)
180 AC_SUBST(dpagaix_ldflags)
181
182 rk_DB
183
184 dnl AC_ROKEN(10,[/usr/heimdal /usr/athena],[lib/roken],[$(top_builddir)/lib/roken/libroken.la],[-I$(top_builddir)/lib/roken -I$(top_srcdir)/lib/roken])
185
186 rk_ROKEN(lib/roken)
187 LIB_roken="\$(top_builddir)/lib/vers/libvers.la $LIB_roken"
188
189 rk_OTP
190
191 AC_CHECK_OSFC2
192
193 AC_ARG_ENABLE(mmap,
194         AC_HELP_STRING([--disable-mmap],[disable use of mmap]))
195 if test "$enable_mmap" = "no"; then
196         AC_DEFINE(NO_MMAP, 1, [Define if you don't want to use mmap.])
197 fi
198
199 rk_CHECK_MAN
200
201 rk_TEST_PACKAGE(readline,
202 [#include <stdio.h>
203  #include <readline.h>],-lreadline,,, READLINE)
204
205 rk_TEST_PACKAGE(hesiod,[#include <hesiod.h>],-lhesiod,,, HESIOD)
206
207 KRB_C_BIGENDIAN
208 AC_C_INLINE
209
210 rk_AIX
211 rk_IRIX
212 rk_SUNOS
213
214 KRB_CHECK_X
215
216 AM_CONDITIONAL(HAVE_X, test "$no_x" != yes)
217
218 AC_CHECK_XAU
219
220 dnl AM_C_PROTOTYPES
221
222 dnl Checks for typedefs, structures, and compiler characteristics.
223 AC_C_CONST
224 AC_TYPE_OFF_T
225 AC_CHECK_TYPE_EXTRA(mode_t, unsigned short, [])
226 AC_CHECK_TYPE_EXTRA(sig_atomic_t, int, [#include <signal.h>])
227 AC_HAVE_TYPE([long long])
228 AC_HEADER_TIME
229 AC_STRUCT_TM
230
231 dnl Checks for header files.
232 AC_HEADER_STDC
233
234 AC_CHECK_HEADERS([\
235         arpa/ftp.h                              \
236         arpa/telnet.h                           \
237         bind/bitypes.h                          \
238         bsdsetjmp.h                             \
239         curses.h                                \
240         dlfcn.h                                 \
241         fnmatch.h                               \
242         inttypes.h                              \
243         io.h                                    \
244         libutil.h                               \
245         limits.h                                \
246         maillock.h                              \
247         netgroup.h                              \
248         netinet/in6_machtypes.h                 \
249         netinfo/ni.h                            \
250         pthread.h                               \
251         pty.h                                   \
252         sac.h                                   \
253         security/pam_modules.h                  \
254         sgtty.h                                 \
255         siad.h                                  \
256         signal.h                                \
257         stropts.h                               \
258         sys/bitypes.h                           \
259         sys/category.h                          \
260         sys/file.h                              \
261         sys/filio.h                             \
262         sys/ioccom.h                            \
263         sys/mman.h                              \
264         sys/pty.h                               \
265         sys/ptyio.h                             \
266         sys/ptyvar.h                            \
267         sys/select.h                            \
268         sys/str_tty.h                           \
269         sys/stream.h                            \
270         sys/stropts.h                           \
271         sys/strtty.h                            \
272         sys/syscall.h                           \
273         sys/termio.h                            \
274         sys/timeb.h                             \
275         sys/times.h                             \
276         sys/un.h                                \
277         term.h                                  \
278         termcap.h                               \
279         termio.h                                \
280         time.h                                  \
281         tmpdir.h                                \
282         udb.h                                   \
283         utmp.h                                  \
284         utmpx.h                                 \
285 ])
286
287 AC_ARG_ENABLE(netinfo,
288         AC_HELP_STRING([--enable-netinfo],[enable netinfo for configuration lookup]))
289
290 if test "$ac_cv_header_netinfo_ni_h" = yes -a "$enable_netinfo" = yes; then
291        AC_DEFINE(HAVE_NETINFO, 1,
292                [Define if you want to use Netinfo instead of krb5.conf.])
293 fi
294
295 dnl Checks for libraries.
296
297 AC_FIND_FUNC_NO_LIBS(logwtmp, util)
298 AC_FIND_FUNC_NO_LIBS(logout, util)
299 AC_FIND_FUNC_NO_LIBS(openpty, util)
300 AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses)
301
302 dnl Checks for library functions.
303
304 AC_CHECK_FUNCS([                                \
305         _getpty                                 \
306         _scrsize                                \
307         fcntl                                   \
308         grantpt                                 \
309         mktime                                  \
310         ptsname                                 \
311         rand                                    \
312         revoke                                  \
313         select                                  \
314         setitimer                               \
315         setpcred                                \
316         setpgid                                 \
317         setproctitle                            \
318         setregid                                \
319         setresgid                               \
320         setresuid                               \
321         setreuid                                \
322         setsid                                  \
323         setutent                                \
324         sigaction                               \
325         strstr                                  \
326         timegm                                  \
327         ttyname                                 \
328         ttyslot                                 \
329         umask                                   \
330         unlockpt                                \
331         vhangup                                 \
332         yp_get_default_domain                   \
333 ])
334
335 AC_FUNC_MMAP
336
337 KRB_CAPABILITIES
338
339 AC_CHECK_GETPWNAM_R_POSIX
340
341 dnl Cray stuff
342 AC_CHECK_FUNCS(getudbnam setlim)
343
344 dnl AC_KRB_FUNC_GETCWD_BROKEN
345
346 dnl
347 dnl Check for fields in struct utmp
348 dnl
349
350 AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr, [#include <utmp.h>])
351 AC_HAVE_STRUCT_FIELD(struct utmp, ut_host, [#include <utmp.h>])
352 AC_HAVE_STRUCT_FIELD(struct utmp, ut_id, [#include <utmp.h>])
353 AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid, [#include <utmp.h>])
354 AC_HAVE_STRUCT_FIELD(struct utmp, ut_type, [#include <utmp.h>])
355 AC_HAVE_STRUCT_FIELD(struct utmp, ut_user, [#include <utmp.h>])
356 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit, [#include <utmpx.h>])
357 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen, [#include <utmpx.h>])
358
359 AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, 
360         u_int8_t, u_int16_t, u_int32_t, u_int64_t,
361         uint8_t, uint16_t, uint32_t, uint64_t],,,[
362 #ifdef HAVE_INTTYPES_H
363 #include <inttypes.h>
364 #endif
365 #ifdef HAVE_SYS_TYPES_H
366 #include <sys/types.h>
367 #endif
368 #ifdef HAVE_SYS_BITYPES_H
369 #include <sys/bitypes.h>
370 #endif
371 #ifdef HAVE_BIND_BITYPES_H
372 #include <bind/bitypes.h>
373 #endif
374 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
375 #include <netinet/in6_machtypes.h>
376 #endif
377 ])
378
379 KRB_READLINE
380
381 rk_TELNET
382
383 dnl Some operating systems already have com_err and compile_et
384 CHECK_COMPILE_ET
385
386 rk_AUTH_MODULES([sia afskauthlib])
387
388 rk_DESTDIRS
389
390 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
391         sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
392 AC_SUBST(LTLIBOBJS)
393
394 AH_BOTTOM([#ifdef ROKEN_RENAME
395 #include "roken_rename.h"
396 #endif])
397
398 AC_CONFIG_FILES(Makefile                \
399         include/Makefile                \
400         include/kadm5/Makefile          \
401         lib/Makefile                    \
402         lib/45/Makefile                 \
403         lib/auth/Makefile               \
404         lib/auth/afskauthlib/Makefile   \
405         lib/auth/pam/Makefile           \
406         lib/auth/sia/Makefile           \
407         lib/asn1/Makefile               \
408         lib/com_err/Makefile            \
409         lib/des/Makefile                \
410         lib/editline/Makefile           \
411         lib/gssapi/Makefile             \
412         lib/hdb/Makefile                \
413         lib/kadm5/Makefile              \
414         lib/kafs/Makefile               \
415         lib/kdfs/Makefile               \
416         lib/krb5/Makefile               \
417         lib/otp/Makefile                \
418         lib/roken/Makefile              \
419         lib/sl/Makefile                 \
420         lib/vers/Makefile               \
421         kuser/Makefile                  \
422         kpasswd/Makefile                \
423         kadmin/Makefile                 \
424         admin/Makefile                  \
425         kdc/Makefile                    \
426         appl/Makefile                   \
427         appl/afsutil/Makefile           \
428         appl/ftp/Makefile               \
429         appl/ftp/common/Makefile        \
430         appl/ftp/ftp/Makefile           \
431         appl/ftp/ftpd/Makefile          \
432         appl/kx/Makefile                \
433         appl/login/Makefile             \
434         appl/otp/Makefile               \
435         appl/popper/Makefile            \
436         appl/push/Makefile              \
437         appl/rsh/Makefile               \
438         appl/rcp/Makefile               \
439         appl/su/Makefile                \
440         appl/xnlock/Makefile            \
441         appl/telnet/Makefile            \
442         appl/telnet/libtelnet/Makefile  \
443         appl/telnet/telnet/Makefile     \
444         appl/telnet/telnetd/Makefile    \
445         appl/test/Makefile              \
446         appl/kf/Makefile                \
447         appl/dceutils/Makefile          \
448         doc/Makefile                    \
449         tools/Makefile                  \
450 )
451
452 AC_OUTPUT
453
454 dnl
455 dnl This is the release version name-number[beta]
456 dnl
457
458 cat > include/newversion.h.in <<EOF
459 const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ ($host) @DATE@ \$";
460 const char *heimdal_version = "AC_PACKAGE_STRING";
461 EOF
462
463 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
464         echo "include/version.h is unchanged"
465         rm -f include/newversion.h.in
466 else
467         echo "creating include/version.h"
468         User=${USER-${LOGNAME}}
469         Host=`(hostname || uname -n || echo unknown) 2>/dev/null | sed 1q`
470         Date=`date`
471         mv -f include/newversion.h.in include/version.h.in
472         sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
473 fi