Initial import from FreeBSD RELENG_4:
[dragonfly.git] / crypto / kerberosIV / configure.in
1 dnl
2 dnl *** PLEASE NOTE ***
3 dnl *** PLEASE NOTE ***
4 dnl *** PLEASE NOTE ***
5 dnl
6 dnl Update $VERSION before making a new release
7 dnl
8
9 dnl Process this file with autoconf to produce a configure script.
10 dnl
11 AC_REVISION($Revision: 1.432.2.14 $)
12 AC_INIT(lib/krb/getrealm.c)
13 AC_CONFIG_HEADER(include/config.h)
14
15 dnl
16 dnl definitions
17 dnl
18
19 PACKAGE=krb4
20 AC_SUBST(PACKAGE)dnl
21 VERSION=1.0.5
22 AC_SUBST(VERSION)dnl
23 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])dnl
24 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])dnl
25
26 # This may be overridden using --prefix=/usr to configure
27 AC_PREFIX_DEFAULT(/usr/athena)
28
29 AC_CANONICAL_HOST
30 CANONICAL_HOST=$host
31 AC_SUBST(CANONICAL_HOST)
32
33 dnl OS specific defines
34
35 sunos=no
36 case "$host" in 
37 *-*-sunos4*)
38         sunos=40
39         ;;
40 *-*-solaris2.7)
41         sunos=57
42         ;;
43 *-*-solaris2.8)
44         sunos=58
45         ;;
46 *-*-solaris2*)
47         sunos=50
48         ;;
49 esac
50 if test "$sunos" != no; then
51         AC_DEFINE_UNQUOTED(SunOS, $sunos, 
52                 [Define to what version of SunOS you are running.])
53 fi
54
55 AC_PROG_MAKE_SET
56 AC_ARG_PROGRAM
57
58 # We want these before the checks, so the checks can modify their values.
59 test -z "$LDFLAGS" && LDFLAGS=-g
60
61 dnl
62 dnl check for programs
63 dnl
64
65 AC_KRB_PROG_LN_S
66 AC_PROG_CC
67 AC_PROG_CPP
68 AC_ISC_POSIX
69 AC_KRB_PROG_YACC
70 AC_PROG_LEX
71 AC_PROG_RANLIB
72 AC_PROG_INSTALL
73 AC_PROG_AWK
74 AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, :)
75
76 dnl Use make Wall or make WFLAGS=".."
77 WFLAGS=""
78 WFLAGS_NOUNUSED=""
79 WFLAGS_NOIMPLICITINT=""
80 AC_SUBST(WFLAGS) dnl
81 AC_SUBST(WFLAGS_NOUNUSED) dnl
82 AC_SUBST(WFLAGS_NOIMPLICITINT) dnl
83
84 dnl
85 dnl check for build options
86 dnl
87
88 AC_TEST_PACKAGE_NEW(socks,[#include <socks.h>],-lsocks5)
89 CFLAGS="$INCLUDE_socks $CFLAGS"
90 LIBS="$LIB_socks $LIBS"
91
92 AC_ARG_ENABLE(legacy-kdestroy,
93 [  --enable-legacy-kdestroy    kdestroy doesn't destroy tokens by default],[
94 if test "$enableval" = "yes"; then
95         AC_DEFINE(LEGACY_KDESTROY,1, [Define to enable old kdestroy behavior.])
96 fi
97 ])
98
99 AC_ARG_ENABLE(match-subdomains,
100 [  --enable-match-subdomains    match realm in subdomains],
101 [if test "$enableval" = "yes"; then
102         AC_DEFINE(MATCH_SUBDOMAINS,1, [Define if you want to match subdomains.])
103 fi
104 ])
105
106 AC_ARG_WITH(ld-flags,
107 [  --with-ld-flags=flags   what flags use when linking])
108
109 AC_ARG_WITH(cracklib,
110 [  --with-cracklib=dir     use the cracklib.a in dir],
111 )
112
113 AC_ARG_WITH(dictpath,
114 [  --with-dictpath=path    use this dictionary with cracklib]
115 )
116
117 (test -z "$with_cracklib" && test -n "$with_dictpath") ||
118 (test -n "$with_cracklib" && test -z "$with_dictpath") &&
119 AC_MSG_ERROR(--with-cracklib requires --with-dictpath and vice versa)
120 test -n "$with_cracklib" &&
121 CRACKLIB="-L$with_cracklib -lcrack" &&
122 AC_MSG_RESULT(Using cracklib in $with_cracklib)
123 AC_SUBST(CRACKLIB)dnl
124 test -n "$with_dictpath" &&
125 AC_MSG_RESULT(Using dictpath=$with_dictpath) &&
126 AC_DEFINE_UNQUOTED(DICTPATH,"$with_dictpath", [Define this to be the directory where the 
127         dictionary for cracklib resides.])
128
129 AC_ARG_WITH(mailspool,
130 [  --with-mailspool=dir    this is the mail spool directory]
131 )
132
133 test -n "$with_mailspool" &&
134 AC_DEFINE_UNQUOTED(KRB4_MAILDIR, "$with_mailspool", [Define this to the path of the mail spool directory.])
135
136 AC_ARG_WITH(db-dir,
137 [  --with-db-dir=dir       this is the database directory (default /var/kerberos)])
138
139 test -n "$with_db_dir" &&
140 AC_DEFINE_UNQUOTED(DB_DIR, "$with_db_dir", [Define this to the kerberos database directory.])
141
142 AC_ARG_ENABLE(random-mkey,
143 [  --enable-random-mkey    use new code for master keys],[
144 if test "$enableval" = "yes"; then
145         AC_DEFINE(RANDOM_MKEY,1, [Define to enable new master key code.])
146 fi
147 ])
148
149 AC_ARG_WITH(mkey,
150 [  --with-mkey=file        where to put the master key],[
151 if test -n "$withval"; then
152         AC_DEFINE_UNQUOTED(MKEYFILE,"$withval", [Define this to the location of the master key.])
153 fi
154 ])
155
156 otp=yes
157 AC_ARG_ENABLE(otp,
158 [  --disable-otp           if you don't want OTP support],
159 [
160 if test "$enableval" = "no"; then
161         otp=no
162 fi
163 ])
164
165 if test "$otp" = "yes"; then
166         AC_DEFINE(OTP)
167         LIB_otp='-L$(top_builddir)/lib/otp -lotp'
168         OTP_dir=otp
169         LIB_SUBDIRS="$LIB_SUBDIRS otp"
170 fi
171 AC_SUBST(LIB_otp)
172 AC_SUBST(OTP_dir)
173
174 AC_CHECK_OSFC2
175
176 mmap=yes
177 AC_ARG_ENABLE(mmap,
178 [  --disable-mmap          disable use of mmap],
179 [
180 if test "$enableval" = "no"; then
181         mmap=no
182 fi
183 ])
184 if test "$mmap" = "no"; then
185         AC_DEFINE(NO_MMAP, 1, [Define if you don't want to use mmap.])
186 fi
187
188 aix_dynamic_afs=yes
189 AC_ARG_ENABLE(dynamic-afs,
190 [  --disable-dynamic-afs   don't use loaded AFS library with AIX],[
191 if test "$enableval" = "no"; then
192         aix_dynamic_afs=no
193 fi
194 ])
195
196 berkeley_db=db
197 AC_ARG_WITH(berkeley-db,
198 [  --without-berkeley-db   if you don't want berkeley db],[
199 if test "$withval" = no; then
200         berkeley_db=""
201 fi
202 ])
203
204 afs_support=yes
205 AC_ARG_WITH(afs-support,
206 [  --without-afs-support   if you don't want support for afs],[
207 if test "$withval" = no; then
208         AC_DEFINE(NO_AFS, 1, [Define if you don't wan't support for AFS.])
209         afs_support=no
210 fi
211 ])
212
213 des_quad=guess
214 AC_ARG_WITH(des-quad-checksum,
215 [  --with-des-quad-checksum=kind
216                            default checksum to use (new, old, or guess)],[
217 des_quad="$withval"
218 ])
219 if test "$des_quad" = "new"; then
220         ac_x=DES_QUAD_NEW
221 elif test "$des_quad" = "old"; then
222         ac_x=DES_QUAD_OLD
223 else
224         ac_x=DES_QUAD_GUESS
225 fi      
226 AC_DEFINE_UNQUOTED(DES_QUAD_DEFAULT,$ac_x, 
227         [Set this to the type of des-quad-cheksum to use.])
228
229 AC_ARG_WITH(afsws,
230 [  --with-afsws=dir        use AFS includes and libraries from dir=/usr/afsws],
231 AFSWS=$withval,
232 AFSWS=/usr/afsws
233 )
234 test "$AFSWS" = "yes" && AFSWS=/usr/afsws
235 AC_SUBST(AFSWS)
236
237 AC_ARG_ENABLE(rxkad,
238 [  --enable-rxkad           build rxkad library])
239
240 if test "$afs_support" = yes -a "$enable_rxkad" = yes; then
241         LIB_SUBDIRS="$LIB_SUBDIRS rxkad"
242 fi
243 AC_SUBST(LIB_SUBDIRS)
244
245 AC_ARG_ENABLE(cat-manpages,
246 [  --disable-cat-manpages   don't install any preformatted manpages],
247 [
248 if test "$enableval" = "no"; then
249         disable_cat_manpages=yes
250 fi
251 ])
252
253 AC_SUBST(disable_cat_manpages)dnl
254
255 AC_TEST_PACKAGE_NEW(readline,[
256 #include <stdio.h>
257 #include <readline.h>
258 ],-lreadline)
259
260 AC_MIPS_ABI
261
262 AC_TEST_PACKAGE_NEW(hesiod,[#include <hesiod.h>],-lhesiod)
263
264 AC_SHARED_LIBS
265
266 dnl
267 dnl Check for endian-ness, this breaks cross compilation
268 dnl
269 AC_C_BIGENDIAN
270
271 dnl
272 dnl Check for constness
273 dnl
274 AC_C_CONST
275
276 dnl
277 dnl Check for inline keyword
278 dnl
279 AC_C_INLINE
280
281 dnl
282 dnl Check for __attribute__
283 dnl
284 AC_C___ATTRIBUTE__
285
286 dnl
287 dnl Check for strange operating systems that you need to handle differently
288 dnl
289
290 AC_KRB_SYS_NEXTSTEP
291 AC_KRB_SYS_AIX
292
293 if test "$krb_cv_sys_aix" = yes ;then
294         if test "$aix_dynamic_afs" = yes; then
295                 AFS_EXTRA_OBJS=
296                 AFS_EXTRA_LIBS=afslib.so
297                 # this works differently in AIX <=3 and 4
298                 if test `uname -v` = 4 ; then
299                         AFS_EXTRA_LD="-bnoentry"
300                 else
301                         AFS_EXTRA_LD="-e _nostart"
302                 fi
303                 AFS_EXTRA_DEFS=
304                 AC_FIND_FUNC_NO_LIBS(dlopen, dl)
305                 if test "$ac_cv_funclib_dlopen" = yes; then
306                         AIX_EXTRA_KAFS=
307                 elif test "$ac_cv_funclib_dlopen" != no; then
308                         AIX_EXTRA_KAFS="$ac_cv_funclib_dlopen"
309                 else
310                         AFS_EXTRA_OBJS="$AFS_EXTRA_OBJS dlfcn.o"
311                         AIX_EXTRA_KAFS=-lld
312                 fi
313         else
314                 AFS_EXTRA_OBJS='$(srcdir)/afsl.exp afslib.o'
315                 AFS_EXTRA_LIBS=
316                 AFS_EXTRA_DEFS='-DSTATIC_AFS_SYSCALLS'
317                 AIX_EXTRA_KAFS=
318         fi
319         AC_SUBST(AFS_EXTRA_OBJS)dnl
320         AC_SUBST(AFS_EXTRA_LIBS)dnl
321         AC_SUBST(AFS_EXTRA_LD)dnl
322         AC_SUBST(AFS_EXTRA_DEFS)dnl
323         AC_SUBST(AIX_EXTRA_KAFS)dnl
324 fi
325
326 #
327 # AIX needs /lib/pse.exp for getmsg, but alas that file is broken in
328 # AIX414
329 #
330
331 case "${host}" in
332 *-*-aix4.1*)
333 if test -f /lib/pse.exp ;then
334         LIBS="$LIBS -Wl,-bnolibpath -Wl,-bI:/lib/pse.exp"
335 fi
336 ;;
337 *-*-aix*)
338         LIBS="$LIBS -Wl,-bnolibpath"
339         ;;
340 esac
341
342 dnl
343 dnl Various checks for headers and their contents
344 dnl
345
346 AC_HEADER_STDC
347
348 AC_CHECK_HEADERS([arpa/ftp.h                    \
349         arpa/inet.h                             \
350         arpa/nameser.h                          \
351         arpa/telnet.h                           \
352         bsd/bsd.h                               \
353         bsdsetjmp.h                             \
354         capability.h                            \
355         crypt.h                                 \
356         curses.h                                \
357         db.h                                    \
358         dbm.h                                   \
359         dirent.h                                \
360         err.h                                   \
361         errno.h                                 \
362         fcntl.h                                 \
363         fnmatch.h                               \
364         gdbm/ndbm.h                             \
365         grp.h                                   \
366         inttypes.h                              \
367         io.h                                    \
368         lastlog.h                               \
369         libutil.h                               \
370         limits.h                                \
371         login.h                                 \
372         maillock.h                              \
373         ndbm.h                                  \
374         net/if.h                                \
375         net/if_tun.h                            \
376         net/if_var.h                            \
377         netdb.h                                 \
378         netinet/in.h                            \
379         netinet/in6_machtypes.h                 \
380         netinet/in_systm.h                      \
381         paths.h                                 \
382         pty.h                                   \
383         pwd.h                                   \
384         resolv.h                                \
385         rpcsvc/dbm.h                            \
386         rpcsvc/ypclnt.h                         \
387         sac.h                                   \
388         security/pam_modules.h                  \
389         shadow.h                                \
390         siad.h                                  \
391         signal.h                                \
392         stropts.h                               \
393         sys/bitypes.h                           \
394         sys/category.h                          \
395         sys/file.h                              \
396         sys/filio.h                             \
397         sys/ioccom.h                            \
398         sys/ioctl.h                             \
399         sys/locking.h                           \
400         sys/mman.h                              \
401         sys/param.h                             \
402         sys/proc.h                              \
403         sys/pty.h                               \
404         sys/ptyio.h                             \
405         sys/ptyvar.h                            \
406         sys/resource.h                          \
407         sys/select.h                            \
408         sys/socket.h                            \
409         sys/sockio.h                            \
410         sys/stat.h                              \
411         sys/str_tty.h                           \
412         sys/stream.h                            \
413         sys/stropts.h                           \
414         sys/strtty.h                            \
415         sys/syscall.h                           \
416         sys/sysctl.h                            \
417         sys/termio.h                            \
418         sys/time.h                              \
419         sys/timeb.h                             \
420         sys/times.h                             \
421         sys/tty.h                               \
422         sys/types.h                             \
423         sys/uio.h                               \
424         sys/un.h                                \
425         sys/utsname.h                           \
426         sys/wait.h                              \
427         syslog.h                                \
428         term.h                                  \
429         termcap.h                               \
430         termio.h                                \
431         termios.h                               \
432         tmpdir.h                                \
433         ttyent.h                                \
434         udb.h                                   \
435         ulimit.h                                \
436         unistd.h                                \
437         userpw.h                                \
438         usersec.h                               \
439         util.h                                  \
440         utime.h                                 \
441         utmp.h                                  \
442         utmpx.h                                 \
443         wait.h])
444
445 AC_HEADER_TIME
446 AC_DECL_SYS_SIGLIST
447
448 CHECK_NETINET_IP_AND_TCP
449
450 EXTRA_LOCL_HEADERS=
451 EXTRA_HEADERS=
452 if test "$ac_cv_header_err_h" != yes; then
453         EXTRA_HEADERS="$EXTRA_HEADERS err.h"
454 fi
455 if test "$ac_cv_header_fnmatch_h" != yes; then
456         EXTRA_LOCL_HEADERS="$EXTRA_LOCL_HEADERS fnmatch.h"
457 fi
458 AC_SUBST(EXTRA_HEADERS)
459 AC_SUBST(EXTRA_LOCL_HEADERS)
460
461 AC_GROK_TYPES(int8_t int16_t int32_t int64_t)
462 AC_GROK_TYPES(u_int8_t u_int16_t u_int32_t u_int64_t)
463
464 AC_MSG_CHECKING(for strange sys/bitypes.h)
465 AC_CACHE_VAL(krb_cv_int8_t_ifdef, [
466 AC_TRY_COMPILE([
467 #ifdef HAVE_SYS_TYPES_H
468 #include <sys/types.h>
469 #endif
470 #ifdef HAVE_SYS_BITYPES_H
471 #include <sys/bitypes.h>
472 #endif
473 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
474 #include <netinet/in6_machtypes.h>
475 #endif
476 ],
477 int8_t x;
478 ,
479 krb_cv_int8_t_ifdef=no,
480 krb_cv_int8_t_ifdef=yes)])
481 AC_MSG_RESULT($krb_cv_int8_t_ifdef)
482 if test "$krb_cv_int8_t_ifdef" = "yes"; then
483   AC_DEFINE(HAVE_STRANGE_INT8_T, 1, [Huh?])dnl
484 fi
485
486 dnl
487 dnl Various checks for libraries and their contents
488 dnl
489
490 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
491
492 dnl
493 dnl System V is have misplaced the socket routines, should really be in libc
494 dnl
495
496 AC_FIND_FUNC(socket, socket,
497 [#ifdef HAVE_SYS_TYPES_H
498 #include <sys/types.h>
499 #endif
500 #ifdef HAVE_SYS_SOCKET_H
501 #include <sys/socket.h>
502 #endif],
503 [0,0,0])
504 AC_FIND_FUNC(gethostbyname, nsl,
505 [#ifdef HAVE_SYS_TYPES_H
506 #include <sys/types.h>
507 #endif
508 #ifdef HAVE_SYS_SOCKET_H
509 #include <sys/socket.h>
510 #endif],
511 "foo")
512
513 dnl
514 dnl Horror AIX needs -lodm -lcfg to link login
515 dnl
516
517 AC_FIND_FUNC(odm_initialize, odm)
518 AC_FIND_FUNC(getattr, cfg)
519 AC_FIND_FUNC(setpcred, s)
520 AC_FIND_FUNC(logwtmp, util)
521
522 AC_FIND_FUNC(logout, util)
523 AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses)
524         
525 dnl 
526 dnl See if there is any X11 present
527 dnl
528 KRB_CHECK_X
529 if test "$no_x" = "yes" ; then
530         MAKE_X_PROGS_BIN=""
531         MAKE_X_SCRIPTS_BIN=""
532         MAKE_X_PROGS_LIBEXEC=""
533 else
534         MAKE_X_PROGS_BIN='$(X_PROGS_BIN)'
535         MAKE_X_SCRIPTS_BIN='$(X_SCRIPTS_BIN)'
536         MAKE_X_PROGS_LIBEXEC='$(X_PROGS_LIBEXEC)'
537 fi
538 AC_SUBST(MAKE_X_PROGS_BIN)dnl
539 AC_SUBST(MAKE_X_SCRIPTS_BIN)dnl
540 AC_SUBST(MAKE_X_PROGS_LIBEXEC)dnl
541
542 AC_CHECK_XAU
543
544 dnl
545 dnl Look for berkeley db, gdbm, and ndbm in that order.
546 dnl
547
548 KRB_FIND_DB("" $berkeley_db gdbm ndbm)
549
550 AC_FIND_FUNC(syslog, syslog)
551
552 AC_BROKEN_SNPRINTF
553 AC_BROKEN_GLOB
554
555 if test "$ac_cv_func_glob_working" != yes; then
556         EXTRA_LOCL_HEADERS="$EXTRA_LOCL_HEADERS glob.h"
557         LIBOBJS="$LIBOBJS glob.o"
558 fi
559
560 AC_CHECK_FUNCS([                                \
561         _getpty                                 \
562         _scrsize                                \
563         _setsid                                 \
564         _stricmp                                \
565         asnprintf                               \
566         asprintf                                \
567         atexit                                  \
568         cgetent                                 \
569         chroot                                  \
570         fattach                                 \
571         fchmod                                  \
572         fcntl                                   \
573         forkpty                                 \
574         frevoke                                 \
575         getpriority                             \
576         getrlimit                               \
577         getservbyname                           \
578         getspnam                                \
579         gettimeofday                            \
580         gettosbyname                            \
581         getuid                                  \
582         grantpt                                 \
583         mktime                                  \
584         on_exit                                 \
585         parsetos                                \
586         ptsname                                 \
587         rand                                    \
588         random                                  \
589         revoke                                  \
590         setitimer                               \
591         setpgid                                 \
592         setpriority                             \
593         setproctitle                            \
594         setregid                                \
595         setresgid                               \
596         setresuid                               \
597         setreuid                                \
598         setsid                                  \
599         setutent                                \
600         sigaction                               \
601         sysconf                                 \
602         sysctl                                  \
603         ttyname                                 \
604         ttyslot                                 \
605         ulimit                                  \
606         uname                                   \
607         unlockpt                                \
608         vasnprintf                              \
609         vasprintf                               \
610         vhangup                                 \
611         vsnprintf                               \
612         yp_get_default_domain                   \
613         ])
614
615 KRB_CAPABILITIES
616
617 AC_CHECK_GETPWNAM_R_POSIX
618
619 AC_FIND_FUNC_NO_LIBS(getsockopt,,
620 [#ifdef HAVE_SYS_TYPES_H
621 #include <sys/types.h>
622 #endif
623 #ifdef HAVE_SYS_SOCKET_H
624 #include <sys/socket.h>
625 #endif],
626 [0,0,0,0,0])
627 AC_FIND_FUNC_NO_LIBS(setsockopt,,
628 [#ifdef HAVE_SYS_TYPES_H
629 #include <sys/types.h>
630 #endif
631 #ifdef HAVE_SYS_SOCKET_H
632 #include <sys/socket.h>
633 #endif],
634 [0,0,0,0,0])
635
636 dnl Cray stuff
637 AC_CHECK_FUNCS(getudbnam setlim)
638
639 AC_FIND_FUNC(res_search, resolv,
640 [
641 #include <stdio.h>
642 #ifdef HAVE_SYS_TYPES_H
643 #include <sys/types.h>
644 #endif
645 #ifdef HAVE_NETINET_IN_H
646 #include <netinet/in.h>
647 #endif
648 #ifdef HAVE_ARPA_NAMESER_H
649 #include <arpa/nameser.h>
650 #endif
651 #ifdef HAVE_RESOLV_H
652 #include <resolv.h>
653 #endif
654 ],
655 [0,0,0,0,0])
656
657 AC_FIND_FUNC(dn_expand, resolv,
658 [
659 #include <stdio.h>
660 #ifdef HAVE_SYS_TYPES_H
661 #include <sys/types.h>
662 #endif
663 #ifdef HAVE_NETINET_IN_H
664 #include <netinet/in.h>
665 #endif
666 #ifdef HAVE_ARPA_NAMESER_H
667 #include <arpa/nameser.h>
668 #endif
669 #ifdef HAVE_RESOLV_H
670 #include <resolv.h>
671 #endif
672 ],
673 [0,0,0,0,0])
674
675 AC_SUBST(LIB_res_search)dnl
676 AC_SUBST(LIB_dn_expand)dnl
677
678 AC_FUNC_MMAP
679 AC_FUNC_ALLOCA
680
681 AC_FUNC_GETLOGIN
682
683 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
684 [#ifdef HAVE_NETDB_H
685 #include <netdb.h>
686 #endif],
687 17)
688 if test "$ac_cv_func_hstrerror" = yes; then
689 AC_NEED_PROTO([
690 #ifdef HAVE_NETDB_H
691 #include <netdb.h>
692 #endif],
693 hstrerror)
694 fi
695
696 AC_BROKEN(chown copyhostent daemon err errx fchown flock fnmatch freehostent)
697 AC_BROKEN(getcwd getdtablesize gethostname getipnodebyaddr getipnodebyname)
698 AC_BROKEN(geteuid getgid getegid)
699 AC_BROKEN(getopt getusershell)
700 AC_BROKEN(inet_aton inet_ntop inet_pton initgroups innetgr iruserok lstat)
701 AC_BROKEN(memmove)
702 AC_BROKEN(mkstemp putenv rcmd readv recvmsg sendmsg setegid setenv seteuid)
703 AC_BROKEN(strcasecmp strncasecmp strdup strerror strftime)
704 AC_BROKEN(strlcat strlcpy strlwr)
705 AC_BROKEN(strndup strnlen strptime strsep strtok_r strupr)
706 AC_BROKEN(swab unsetenv verr verrx vsyslog)
707 AC_BROKEN(vwarn vwarnx warn warnx writev)
708
709 if test "$ac_cv_func_gethostname" = "yes"; then
710 AC_NEED_PROTO([
711 #include <unistd.h>],
712 gethostname)
713 fi
714
715 if test "$ac_cv_func_mkstemp" = "yes"; then
716 AC_NEED_PROTO([
717 #include <unistd.h>],
718 mkstemp)
719 fi
720
721 if test "$ac_cv_func_inet_aton" = "yes"; then
722 AC_NEED_PROTO([
723 #ifdef HAVE_SYS_TYPES_H
724 #include <sys/types.h>
725 #endif
726 #ifdef HAVE_SYS_SOCKET_H
727 #include <sys/socket.h>
728 #endif
729 #ifdef HAVE_NETINET_IN_H
730 #include <netinet/in.h>
731 #endif
732 #ifdef HAVE_ARPA_INET_H
733 #include <arpa/inet.h>
734 #endif],
735 inet_aton)
736 fi
737
738 AC_CACHE_CHECK(if realloc is broken, ac_cv_func_realloc_broken, [
739 ac_cv_func_realloc_broken=no
740 AC_TRY_RUN([
741 #include <stddef.h>
742 #include <stdlib.h>
743
744 int main()
745 {
746         return realloc(NULL, 17) == NULL;
747 }
748 ],:, ac_cv_func_realloc_broken=yes, :)
749 ])
750 if test "$ac_cv_func_realloc_broken" = yes ; then
751         AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL, X) doesn't work.])
752 fi
753
754 AC_KRB_FUNC_GETCWD_BROKEN
755
756 dnl
757 dnl Figure what authentication modules should be built
758 dnl
759
760 AC_MSG_CHECKING(which authentication modules should be built)
761
762 LIB_AUTH_SUBDIRS=
763
764 if test "$ac_cv_header_siad_h" = yes; then
765         LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
766 fi
767
768 if test "$ac_cv_header_security_pam_modules_h" = yes -a "$enable_shared" = yes; then
769         LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
770 fi
771
772 case "${host}" in
773 changequote(,)dnl
774 *-*-irix[56]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
775 changequote([,])dnl
776 esac
777
778 AC_MSG_RESULT($LIB_AUTH_SUBDIRS)
779
780 AC_SUBST(LIB_AUTH_SUBDIRS)dnl
781
782 dnl
783 dnl Checks for prototypes and declarations
784 dnl
785
786 AC_PROTO_COMPAT([
787 #ifdef HAVE_SYS_TYPES_H
788 #include <sys/types.h>
789 #endif
790 #ifdef HAVE_SYS_SOCKET_H
791 #include <sys/socket.h>
792 #endif
793 #ifdef HAVE_NETINET_IN_H
794 #include <netinet/in.h>
795 #endif
796 #ifdef HAVE_ARPA_INET_H
797 #include <arpa/inet.h>
798 #endif
799 #ifdef HAVE_NETDB_H
800 #include <netdb.h>
801 #endif
802 ],
803 gethostbyname, struct hostent *gethostbyname(const char *))
804
805 AC_PROTO_COMPAT([
806 #ifdef HAVE_SYS_TYPES_H
807 #include <sys/types.h>
808 #endif
809 #ifdef HAVE_SYS_SOCKET_H
810 #include <sys/socket.h>
811 #endif
812 #ifdef HAVE_NETINET_IN_H
813 #include <netinet/in.h>
814 #endif
815 #ifdef HAVE_ARPA_INET_H
816 #include <arpa/inet.h>
817 #endif
818 #ifdef HAVE_NETDB_H
819 #include <netdb.h>
820 #endif
821 ],
822 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
823
824 AC_PROTO_COMPAT([
825 #ifdef HAVE_SYS_TYPES_H
826 #include <sys/types.h>
827 #endif
828 #ifdef HAVE_SYS_SOCKET_H
829 #include <sys/socket.h>
830 #endif
831 #ifdef HAVE_NETINET_IN_H
832 #include <netinet/in.h>
833 #endif
834 #ifdef HAVE_ARPA_INET_H
835 #include <arpa/inet.h>
836 #endif
837 #ifdef HAVE_NETDB_H
838 #include <netdb.h>
839 #endif
840 ],
841 getservbyname, struct servent *getservbyname(const char *, const char *))
842
843 AC_PROTO_COMPAT([
844 #ifdef HAVE_SYSLOG_H
845 #include <syslog.h>
846 #endif
847 ],
848 openlog, void openlog(const char *, int, int))
849
850 AC_NEED_PROTO([
851 #ifdef HAVE_CRYPT_H
852 #include <crypt.h>
853 #endif
854 #ifdef HAVE_UNISTD_H
855 #include <unistd.h>
856 #endif
857 ],
858 crypt)
859
860 AC_NEED_PROTO([
861 #include <stdio.h>
862 ],
863 fclose)
864
865 AC_NEED_PROTO([
866 #include <string.h>
867 ],
868 strtok_r)
869
870 AC_NEED_PROTO([
871 #include <string.h>
872 ],
873 strsep)
874
875 AC_NEED_PROTO([
876 #include <unistd.h>
877 ],
878 getusershell)
879
880 AC_NEED_PROTO([
881 #ifdef HAVE_UTIME_H
882 #include <utime.h>
883 #endif
884 ],
885 utime)
886
887 AC_CHECK_VAR([#ifdef HAVE_SYS_TYPES_H
888 #include <sys/types.h>
889 #endif
890 #ifdef HAVE_NETDB_H
891 #include <netdb.h>
892 #endif],
893 h_errno)
894
895 AC_CHECK_VAR([#ifdef HAVE_NETDB_H
896 #include <netdb.h>
897 #endif],
898 h_errlist)
899
900 AC_CHECK_VAR([#ifdef HAVE_NETDB_H
901 #include <netdb.h>
902 #endif],
903 h_nerr)
904
905 AC_CHECK_VAR([#ifdef HAVE_ERR_H
906 #include <err.h>
907 #endif],[__progname])
908
909 AC_CHECK_DECLARATION([#include <stdlib.h>
910 #ifdef HAVE_UNISTD_H
911 #include <unistd.h>
912 #endif], optarg)
913 AC_CHECK_DECLARATION([#include <stdlib.h>
914 #ifdef HAVE_UNISTD_H
915 #include <unistd.h>
916 #endif], optind)
917 AC_CHECK_DECLARATION([#include <stdlib.h>
918 #ifdef HAVE_UNISTD_H
919 #include <unistd.h>
920 #endif], opterr)
921 AC_CHECK_DECLARATION([#include <stdlib.h>
922 #ifdef HAVE_UNISTD_H
923 #include <unistd.h>
924 #endif], optopt)
925
926 AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
927
928 dnl
929 dnl According to ANSI you are explicitly allowed to cast to void,
930 dnl but the standard fails to say what should happen. Some compilers
931 dnl think this is illegal:
932 dnl
933 dnl void foo(void)
934 dnl {
935 dnl   return (void)0;
936 dnl }
937 dnl
938 dnl Thus explicitly test for void
939 dnl
940 AC_TYPE_SIGNAL
941 if test "$ac_cv_type_signal" = "void" ; then
942         AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if RETSIGTYPE == void.])
943 fi
944
945 dnl
946 dnl Check for fields in struct utmp
947 dnl
948
949 AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr,
950 [#include <sys/types.h>
951  #include <utmp.h>])
952 AC_HAVE_STRUCT_FIELD(struct utmp, ut_host,
953 [#include <sys/types.h>
954  #include <utmp.h>])
955 AC_HAVE_STRUCT_FIELD(struct utmp, ut_id,
956 [#include <sys/types.h>
957  #include <utmp.h>])
958 AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid,
959 [#include <sys/types.h>
960  #include <utmp.h>])
961 AC_HAVE_STRUCT_FIELD(struct utmp, ut_type,
962 [#include <sys/types.h>
963  #include <utmp.h>])
964 AC_HAVE_STRUCT_FIELD(struct utmp, ut_user,
965 [#include <sys/types.h>
966  #include <utmp.h>])
967 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit,
968 [#include <sys/types.h>
969  #include <utmp.h>])
970 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen,
971 [#include <sys/types.h>
972  #include <utmp.h>])
973
974 dnl
975 dnl Check for fields in struct tm
976 dnl
977
978 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
979 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
980
981 dnl
982 dnl or do we have a variable `timezone' ?
983 dnl
984
985 AC_CHECK_VAR(
986 [#include <time.h>],
987 timezone)
988
989 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
990
991 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
992  
993 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
994
995 AC_KRB_STRUCT_SPWD
996
997 AC_STRUCT_ST_BLKSIZE
998
999 dnl
1000 dnl Check for struct winsize
1001 dnl
1002
1003 AC_KRB_STRUCT_WINSIZE
1004
1005 dnl
1006 dnl Check for some common types
1007 dnl
1008
1009 AC_TYPE_PID_T
1010 AC_TYPE_UID_T
1011 AC_TYPE_OFF_T
1012 AC_TYPE_SIZE_T
1013
1014 AC_CHECK_TYPE_EXTRA(ssize_t, int, [
1015 #ifdef HAVE_UNISTD_H
1016 #include <unistd.h>
1017 #endif])
1018
1019 AC_CHECK_TYPE_EXTRA(sig_atomic_t, int, [#include <signal.h>])
1020
1021 dnl
1022 dnl Check for broken ultrix sys/socket.h
1023 dnl
1024
1025 AC_MSG_CHECKING(for broken sys/socket.h)
1026 AC_CACHE_VAL(krb_cv_header_sys_socket_h_broken, [
1027 AC_TRY_COMPILE(
1028 [#include <sys/types.h>
1029 #include <sys/socket.h>
1030 #include <sys/socket.h>],[],
1031 krb_cv_header_sys_socket_h_broken=no,
1032 krb_cv_header_sys_socket_h_broken=yes)])
1033 AC_MSG_RESULT($krb_cv_header_sys_socket_h_broken)
1034 AC_SUBST(krb_cv_header_sys_socket_h_broken)
1035
1036 dnl
1037 dnl Check for broken ultrix netdb.h
1038 dnl
1039
1040 AC_MSG_CHECKING(for broken netdb.h)
1041 AC_CACHE_VAL(krb_cv_header_netdb_h_broken, [
1042 AC_TRY_COMPILE(
1043 [#include <sys/types.h>
1044 #include <netdb.h>
1045 #include <netdb.h>],[],
1046 krb_cv_header_netdb_h_broken=no,
1047 krb_cv_header_netdb_h_broken=yes)])
1048 AC_MSG_RESULT($krb_cv_header_netdb_h_broken)
1049 AC_SUBST(krb_cv_header_netdb_h_broken)
1050 if test "$krb_cv_header_netdb_h_broken" = "yes"; then
1051   EXTRA_HEADERS="$EXTRA_HEADERS netdb.h"
1052 fi
1053
1054 dnl
1055 dnl Check for sa_len in sys/socket.h
1056 dnl
1057
1058 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
1059 #include <sys/socket.h>])
1060
1061 dnl
1062 dnl Check for ouid in sys/siad.h
1063 dnl
1064
1065 if test "$ac_cv_header_siad_h" = yes; then
1066 AC_HAVE_STRUCT_FIELD(SIAENTITY, ouid, [#include <siad.h>])
1067 fi
1068
1069 dnl
1070 dnl you can link with getmsg on AIX 3.2 but you cannot run the program
1071 dnl
1072
1073 AC_CHECK_FUNC(getmsg)
1074
1075 if test "$ac_cv_func_getmsg" = "yes"; then
1076
1077 AC_CACHE_CHECK(for working getmsg, ac_cv_func_getmsg_work,
1078 AC_TRY_RUN(
1079 [
1080 #include <stdio.h>
1081 #include <errno.h>
1082
1083 int main()
1084 {
1085   int ret;
1086   ret = getmsg(open("/dev/null", 0), NULL, NULL, NULL);
1087   if(ret < 0 && errno == ENOSYS)
1088     return 1;
1089   return 0;
1090 }
1091 ], ac_cv_func_getmsg_work=yes, ac_cv_func_getmsg_work=no,
1092 ac_cv_func_getmsg_work=no))
1093 test "$ac_cv_func_getmsg_work" = "yes" &&
1094 AC_DEFINE(HAVE_GETMSG, 1, [Define if you have a working getmsg.])
1095
1096 fi
1097
1098 dnl
1099 dnl Tests for editline
1100 dnl
1101
1102 dnl el_init
1103
1104 AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
1105 if test "$ac_cv_func_el_init" = yes ; then
1106         AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
1107                 AC_TRY_COMPILE([#include <stdio.h>
1108                         #include <histedit.h>],
1109                         [el_init("", NULL, NULL, NULL);],
1110                         ac_cv_func_el_init_four=yes,
1111                         ac_cv_func_el_init_four=no)])
1112         if test "$ac_cv_func_el_init_four" = yes; then
1113                 AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
1114         fi
1115 fi
1116
1117 dnl readline
1118
1119 save_LIBS="$LIBS"
1120 LIBS="$LIB_tgetent $LIBS"
1121 AC_FIND_FUNC_NO_LIBS(readline, edit readline)
1122 LIBS="$save_LIBS"
1123 el_yes="# "
1124 if test "$with_readline" -a "$with_readline" != "no"; then
1125         :
1126 elif test "$ac_cv_func_readline" = yes; then
1127         INCLUDE_readline=
1128 elif test "$ac_cv_func_el_init" = yes; then
1129         el_yes=
1130         LIB_readline="-L\$(top_builddir)/lib/editline -lel_compat $LIB_el_init"
1131         INCLUDE_readline='-I$(top_srcdir)/lib/editline'
1132 else
1133         LIB_readline='-L$(top_builddir)/lib/editline -leditline'
1134         INCLUDE_readline='-I$(top_srcdir)/lib/editline'
1135 fi
1136 LIB_readline="$LIB_readline \$(LIB_tgetent)"
1137 AC_DEFINE(HAVE_READLINE, 1, [Define if you have a readline function.])dnl XXX
1138 AC_SUBST(LIB_readline)
1139 AC_SUBST(INCLUDE_readline)
1140 AC_SUBST(el_yes)
1141
1142 dnl telnet muck --------------------------------------------------
1143
1144 AC_DEFINE(AUTHENTICATION)dnl
1145 AC_DEFINE(KRB4)dnl
1146 AC_DEFINE(ENCRYPTION)dnl
1147 AC_DEFINE(DES_ENCRYPTION)dnl
1148 AC_DEFINE(DIAGNOSTICS)dnl
1149 AC_DEFINE(OLD_ENVIRON)dnl
1150
1151 # Simple test for streamspty, based on the existance of getmsg(), alas
1152 # this breaks on SunOS4 which have streams but BSD-like ptys
1153 #
1154 # And also something wierd has happend with dec-osf1, fallback to bsd-ptys
1155
1156 AC_MSG_CHECKING(for streamspty)
1157 case "`uname -sr`" in
1158 SunOS\ 4*|OSF1*|IRIX\ 4*|HP-UX\ ?.1[[01]].*)
1159         krb_cv_sys_streamspty=no
1160         ;;
1161 AIX*)
1162         os_rel=`uname -v`.`uname -r`
1163         if expr "$os_rel" : "3*" >/dev/null 2>&1; then
1164                 krb_cv_sys_streamspty=no
1165         else
1166                 krb_cv_sys_streamspty="$ac_cv_func_getmsg_work"
1167         fi
1168         ;;
1169 *)
1170         krb_cv_sys_streamspty="$ac_cv_func_getmsg_work"
1171         ;;
1172 esac
1173 if test "$krb_cv_sys_streamspty" = yes; then
1174         AC_DEFINE(STREAMSPTY, 1, [Define if you have working stream ptys.])
1175 fi
1176 dnl AC_SUBST(STREAMSPTY)
1177 AC_MSG_RESULT($krb_cv_sys_streamspty)
1178
1179 AC_MSG_CHECKING([if /bin/ls takes -A])
1180 if /bin/ls -A > /dev/null 2>&1 ;then
1181         AC_DEFINE(HAVE_LS_A, 1, [Define if /bin/ls has a \`-A' flag.])
1182         krb_ls_a=yes
1183 else
1184         krb_ls_a=no
1185 fi
1186 AC_MSG_RESULT($krb_ls_a)
1187         
1188 dnl ------------------------------------------------------------
1189 AC_CACHE_CHECK(for suffix of preformatted manual pages, krb_cv_sys_cat_suffix,
1190 if grep _version /etc/man.conf > /dev/null 2>&1; then
1191         krb_cv_sys_cat_suffix=0
1192 else
1193         krb_cv_sys_cat_suffix=number
1194 fi)
1195 if test "$krb_cv_sys_cat_suffix" = number; then
1196                 CATSUFFIX='$$s'
1197 else
1198                 CATSUFFIX=0
1199 fi
1200 AC_SUBST(CATSUFFIX)
1201
1202 dnl ------------------------------------------------------------
1203
1204 KRB_KAFS_LIB="-L\$(top_builddir)/lib/kafs -lkafs $AIX_EXTRA_KAFS"
1205 AC_SUBST(KRB_KAFS_LIB)dnl
1206
1207 dnl ------------------------------------------------------------
1208
1209
1210 dnl This is done by AC_OUTPUT but we need the result here.
1211
1212 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1213 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1214
1215 for i in bin lib libexec sbin; do
1216         i=${i}dir
1217         foo=`echo $i | tr 'xindiscernible' 'XINDISCERNIBLE'`
1218         x="\$${i}"
1219         eval y="$x"
1220         while test "x$y" != "x$x"; do
1221                 x="$y"
1222                 eval y="$x"
1223         done
1224         AC_DEFINE_UNQUOTED($foo,"$x")
1225 done
1226
1227 dnl
1228 dnl We are all set to emit the Makefiles and config.h
1229 dnl
1230 AC_OUTPUT(                                      \
1231 Makefile                                        \
1232 include/Makefile                                \
1233 include/sys/Makefile                            \
1234                                                 \
1235 man/Makefile                                    \
1236                                                 \
1237 lib/Makefile                                    \
1238 lib/com_err/Makefile                            \
1239 lib/des/Makefile                                \
1240 lib/krb/Makefile                                \
1241 lib/kdb/Makefile                                \
1242 lib/kadm/Makefile                               \
1243 lib/acl/Makefile                                \
1244 lib/kafs/Makefile                               \
1245 lib/roken/Makefile                              \
1246 lib/otp/Makefile                                \
1247 lib/sl/Makefile                                 \
1248 lib/editline/Makefile                           \
1249 lib/rxkad/Makefile                              \
1250 lib/auth/Makefile                               \
1251 lib/auth/pam/Makefile                           \
1252 lib/auth/sia/Makefile                           \
1253 lib/auth/afskauthlib/Makefile                   \
1254                                                 \
1255 kuser/Makefile                                  \
1256 server/Makefile                                 \
1257 slave/Makefile                                  \
1258 admin/Makefile                                  \
1259 kadmin/Makefile                                 \
1260                                                 \
1261 appl/Makefile                                   \
1262                                                 \
1263 appl/afsutil/Makefile                           \
1264 appl/ftp/Makefile                               \
1265 appl/ftp/common/Makefile                        \
1266 appl/ftp/ftp/Makefile                           \
1267 appl/ftp/ftpd/Makefile                          \
1268 appl/telnet/Makefile                            \
1269 appl/telnet/libtelnet/Makefile                  \
1270 appl/telnet/telnet/Makefile                     \
1271 appl/telnet/telnetd/Makefile                    \
1272 appl/bsd/Makefile                               \
1273 appl/kauth/Makefile                             \
1274 appl/popper/Makefile                            \
1275 appl/movemail/Makefile                          \
1276 appl/push/Makefile                              \
1277 appl/sample/Makefile                            \
1278 appl/xnlock/Makefile                            \
1279 appl/kx/Makefile                                \
1280 appl/kip/Makefile                               \
1281 appl/otp/Makefile                               \
1282 doc/Makefile                                    \
1283 etc/inetd.conf.changes                          \
1284 ) dnl end of AC_OUTPUT
1285
1286 AC_KRB_VERSION