summaryrefslogtreecommitdiffstats
path: root/crypto/kerberosIV/configure.in
blob: 9265666139fc1a2dc6763991fd5c2e7738414be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
dnl
dnl *** PLEASE NOTE ***
dnl *** PLEASE NOTE ***
dnl *** PLEASE NOTE ***
dnl
dnl Update $VERSION before making a new release
dnl

dnl Process this file with autoconf to produce a configure script.
dnl
AC_REVISION($Revision: 1.285 $)
AC_INIT(lib/krb/getrealm.c)
AC_CONFIG_HEADER(include/config.h)

dnl
dnl definitions
dnl

PACKAGE=krb4
AC_SUBST(PACKAGE)dnl
VERSION=0.9.6
AC_SUBST(VERSION)dnl
# This may be overridden using --prefix=/usr to configure
AC_PREFIX_DEFAULT(/usr/athena)

AC_CANONICAL_HOST
AC_PROG_MAKE_SET
AC_ARG_PROGRAM

# We want these before the checks, so the checks can modify their values.
test -z "$LDFLAGS" && LDFLAGS=-g

dnl
dnl check for programs
dnl

AC_KRB_PROG_LN_S
AC_PROG_CC
AC_PROG_CPP
AC_ISC_POSIX
AC_KRB_PROG_YACC
AC_PROG_LEX
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, :)

dnl
dnl check for build options
dnl

AC_TEST_PACKAGE(socks,socks.h,libsocks5.a,-lsocks5)
CFLAGS="$SOCKSINCLUDE $CFLAGS"
LIBS="$SOCKSLIB $LIBS"

dnl Check if we want to use shared libraries
AC_ARG_WITH(shared,
[  --with-shared           create shared libraries for Kerberos])

AC_ARG_WITH(cracklib,
[  --with-cracklib=dir     use the cracklib.a in dir],
)

AC_ARG_WITH(dictpath,
[  --with-dictpath=path    use this dictionary with cracklib]
)

(test -z "$with_cracklib" && test -n "$with_dictpath") ||
(test -n "$with_cracklib" && test -z "$with_dictpath") &&
AC_MSG_ERROR(--with-cracklib requires --with-dictpath and vice versa)
test -n "$with_cracklib" &&
CRACKLIB="-L$with_cracklib -lcrack" &&
AC_MSG_RESULT(Using cracklib in $with_cracklib)
AC_SUBST(CRACKLIB)dnl
test -n "$with_dictpath" &&
AC_MSG_RESULT(Using dictpath=$with_dictpath) &&
AC_DEFINE_UNQUOTED(DICTPATH,"$with_dictpath")

AC_ARG_WITH(mailspool,
[  --with-mailspool=dir    this is the mail spool directory]
)

test -n "$with_mailspool" &&
AC_DEFINE_UNQUOTED(KRB4_MAILDIR, "$with_mailspool")

AC_ARG_ENABLE(random-mkey,
[  --enable-random-mkey    use new code for master keys],[
if test "$enableval" = "yes"; then
	AC_DEFINE(RANDOM_MKEY,1)
fi
])

AC_ARG_WITH(mkey,
[  --with-mkey=file        where to put the master key],[
if test -n "$withval"; then
	AC_DEFINE_UNQUOTED(MKEYFILE,"$withval")
fi
])

berkeley_db=db
AC_ARG_WITH(berkeley-db,
[  --without-berkeley-db   if you don't want berkeley db],[
if test "$withval" = no; then
	berkeley_db=""
fi
])

afs_support=yes
AC_ARG_WITH(afs-support,
[  --without-afs-support   if you don't want support for afs],[
if test "$withval" = no; then
	AC_DEFINE(NO_AFS)
	afs_support=no
fi
])

des_quad=guess
AC_ARG_WITH(des-quad-checksum,
[  --with-des-quad-checksum=kind
                           default checksum to use (new, old, or guess)],[
des_quad="$withval"
])
if test "$des_quad" = "new"; then
	AC_DEFINE(DES_QUAD_DEFAULT,DES_QUAD_NEW)
elif test "$des_quad" = "old"; then
	AC_DEFINE(DES_QUAD_DEFAULT,DES_QUAD_OLD)
else
	AC_DEFINE(DES_QUAD_DEFAULT,DES_QUAD_GUESS)
fi	

AC_TEST_PACKAGE(readline,readline.h,libreadline.a,-lreadline)

dnl
dnl Shared library stuff has to be different everywhere
dnl

AC_SUBST(CFLAGS)dnl
AC_SUBST(LDFLAGS)dnl

case ${with_shared} in
  yes ) with_shared=yes;;
  no  ) with_shared=no;;
  *   ) with_shared=no;;
esac

# NOTE: Building shared libraries may not work if you do not use gcc!
#
# OS		$SHLIBEXT
# HP-UX		sl
# Linux		so
# NetBSD	so
# FreeBSD	so
# OSF		so
# SunOS5	so
# SunOS4	so.0.5
# Irix		so
#
# LIBEXT is the extension we should build (.a or $SHLIBEXT)
REAL_PICFLAGS="-fpic"
LDSHARED='$(CC) $(PICFLAGS) -shared'
LIBPREFIX=lib
REAL_SHLIBEXT=so
changequote({,})dnl
SHLIB_VERSION=`echo $VERSION | sed 's/\([0-9.]*\).*/\1/'`
changequote([,])dnl
case "${host}" in
*-*-hpux*)
	REAL_SHLIBEXT=sl
	REAL_LD_FLAGS='-Wl,+b$(libdir)'
	if test -z "$GCC"; then
		LDSHARED="ld -b"
		REAL_PICFLAGS="+z"
	fi
	;;
*-*-linux*)
	REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
	;;
*-*-*bsd*)
	REAL_SHLIBEXT=so.$SHLIB_VERSION
	LDSHARED='ld -Bshareable'
	REAL_LD_FLAGS='-Wl,-R$(libdir)'
	;;
*-*-osf*)
	REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
	REAL_PICFLAGS=
	LDSHARED='ld -shared -expect_unresolved \*'
	;;
*-*-solaris2*)
	REAL_LD_FLAGS='-Wl,-R$(libdir)'
	if test -z "$GCC"; then
		LDSHARED='$(CC) -G'
		REAL_PICFLAGS="-Kpic"
	fi
	;;
*-*-sunos*)
	REAL_SHLIBEXT=so.$SHLIB_VERSION
	REAL_LD_FLAGS='-Wl,-L$(libdir)'
	;;
*-*-irix*)
	REAL_LD_FLAGS='-Wl,-rpath,$(libdir)'
	REAL_PICFLAGS=
	;;
*-*-os2_emx*)
	LD_FLAGS='-Zexe'
	LIBPREFIX=
	EXECSUFFIX='.exe'
	RANLIB=EMXOMF
	REAL_SHLIBEXT=nobuild
	;;
*-*-cygwin32*)
	EXECSUFFIX='.exe'
	REAL_SHLIBEXT=nobuild
	;;
*)	REAL_SHLIBEXT=nobuild
	REAL_PICFLAGS= 
	;;
esac

if test "${with_shared}" != "yes" ; then 
 PICFLAGS=""
 SHLIBEXT="nobuild"
 LIBEXT="a"
else
 PICFLAGS="$REAL_PICFLAGS"
 SHLIBEXT="$REAL_SHLIBEXT"
 LIBEXT="$SHLIBEXT"
 LD_FLAGS="$REAL_LD_FLAGS"
fi

AC_SUBST(REAL_PICFLAGS) dnl
AC_SUBST(REAL_SHLIBEXT) dnl
AC_SUBST(REAL_LD_FLAGS) dnl

AC_SUBST(PICFLAGS) dnl
AC_SUBST(SHLIBEXT) dnl
AC_SUBST(LDSHARED) dnl
AC_SUBST(LD_FLAGS) dnl
AC_SUBST(LIBEXT) dnl
AC_SUBST(LIBPREFIX) dnl
AC_SUBST(EXECSUFFIX) dnl

dnl
dnl Check if we need to use weak-stuff
dnl

AC_HAVE_PRAGMA_WEAK

dnl
dnl Check for endian-ness, this breaks cross compilation
dnl
AC_C_BIGENDIAN

dnl
dnl Check for constness
dnl
AC_C_CONST

dnl
dnl Check for strange operating systems that you need to handle differently
dnl

AC_KRB_SYS_NEXTSTEP
AC_KRB_SYS_AIX

if test "$krb_cv_sys_aix" = yes ;then
	AFS_EXTRA_OBJS='$(srcdir)/afsl.exp dlfcn.o'
	AC_SUBST(AFS_EXTRA_OBJS)
	AFS_EXTRA_LIBS=afslib.so
	AC_SUBST(AFS_EXTRA_LIBS)
fi

#
# AIX needs /lib/pse.exp for getmsg, but alas that file is broken in
# AIX414
#

if test -f /lib/pse.exp ;then
	LIBS="$LIBS -Wl,-bI:/lib/pse.exp"
fi

dnl
dnl Various checks for headers and their contents
dnl

AC_HEADER_STDC

AC_CHECK_HEADERS(arpa/ftp.h arpa/inet.h arpa/nameser.h)
AC_CHECK_HEADERS(arpa/telnet.h bind/bitypes.h bsd/bsd.h bsdsetjmp.h)
AC_CHECK_HEADERS(crypt.h dbm.h dirent.h err.h fcntl.h grp.h io.h)
AC_CHECK_HEADERS(lastlog.h login.h maillock.h ndbm.h net/if.h)
AC_CHECK_HEADERS(net/if_tun.h net/if_var.h netdb.h netinet/in.h)
AC_CHECK_HEADERS(netinet/in6_machtypes.h netinet/in_systm.h)
AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h paths.h pty.h pwd.h)
AC_CHECK_HEADERS(resolv.h rpcsvc/dbm.h sac.h security/pam_modules.h)
AC_CHECK_HEADERS(shadow.h siad.h signal.h stropts.h sys/bitypes.h)
AC_CHECK_HEADERS(sys/category.h sys/cdefs.h sys/file.h sys/filio.h)
AC_CHECK_HEADERS(sys/ioccom.h sys/ioctl.h sys/locking.h sys/mman.h)
AC_CHECK_HEADERS(sys/param.h sys/proc.h sys/ptyio.h sys/ptyvar.h)
AC_CHECK_HEADERS(sys/resource.h sys/select.h sys/socket.h)
AC_CHECK_HEADERS(sys/sockio.h sys/stat.h sys/str_tty.h sys/stream.h)
AC_CHECK_HEADERS(sys/stropts.h sys/strtty.h sys/syscall.h)
AC_CHECK_HEADERS(sys/sysctl.h sys/termio.h sys/time.h sys/timeb.h)
AC_CHECK_HEADERS(sys/times.h sys/tty.h sys/types.h sys/uio.h)
AC_CHECK_HEADERS(sys/un.h sys/utsname.h sys/wait.h syslog.h)
AC_CHECK_HEADERS(termio.h termios.h tmpdir.h ttyent.h udb.h ulimit.h)
AC_CHECK_HEADERS(unistd.h userpw.h usersec.h util.h utime.h utmp.h)
AC_CHECK_HEADERS(utmpx.h wait.h winsock.h)

AC_HEADER_TIME
AC_DECL_SYS_SIGLIST
AC_SUBST(ac_cv_header_sys_cdefs_h)dnl
AC_SUBST(ac_cv_header_err_h)dnl

AC_GROK_TYPES(int8_t int16_t int32_t int64_t)
AC_GROK_TYPES(u_int8_t u_int16_t u_int32_t u_int64_t)

dnl
dnl Various checks for libraries and their contents
dnl

dnl
dnl System V is have misplaced the socket routines, should really be in libc
dnl

AC_FIND_FUNC(socket, socket,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif],
[0,0,0])
AC_FIND_FUNC(gethostbyname, nsl,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif],
"foo")

dnl
dnl Horror AIX needs -lodm -lcfg to link login
dnl

AC_FIND_FUNC(odm_initialize, odm)
AC_FIND_FUNC(getattr, cfg)
AC_FIND_FUNC(setpcred, s)
AC_FIND_FUNC(logwtmp, util)

AC_FIND_FUNC(logout, util)
AC_FIND_FUNC_NO_LIBS(tgetent, termcap)
	
dnl 
dnl See if there is any X11 present
dnl
AC_PATH_XTRA
if test "$no_x" = "yes" ; then
	MAKE_X_PROGS_BIN=""
	MAKE_X_PROGS_LIBEXEC=""
else
	MAKE_X_PROGS_BIN='$(X_PROGS_BIN)'
	MAKE_X_PROGS_LIBEXEC='$(X_PROGS_LIBEXEC)'
fi
AC_SUBST(MAKE_X_PROGS_BIN)dnl
AC_SUBST(MAKE_X_PROGS_LIBEXEC)dnl

save_CFLAGS="$CFLAGS"
CFLAGS="$X_CFLAGS $CFLAGS"
save_LIBS="$LIBS"
dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"

AC_FIND_FUNC_NO_LIBS(XauReadAuth, Xau X11)
ac_xxx="$LIBS"
LIBS="$LIB_XauReadAuth $LIBS"
AC_CHECK_FUNCS(XauWriteAuth)
if test "$ac_cv_func_XauWriteAuth" != "yes"; then
  XauWriteAuth_c=writeauth.c
  XauWriteAuth_o=writeauth.o
fi
AC_SUBST(XauWriteAuth_c)dnl
AC_SUBST(XauWriteAuth_o)dnl
LIBS="$ac_xxx"

CFLAGS=$save_CFLAGS
LIBS=$save_LIBS
LDFLAGS=$save_LDFLAGS

dnl
dnl Look for berkeley db, gdbm, and ndbm in that order.
dnl

save_LIBS="$LIBS"
AC_FIND_FUNC_NO_LIBS(dbopen, $berkeley_db)
LIBS="$LIB_dbopen $LIBS"
AC_FIND_FUNC_NO_LIBS(dbm_firstkey, $berkeley_db gdbm ndbm)
if test -n "$LIB_dbopen"; then
  LIB_DBM="$LIB_dbopen"
else
  LIB_DBM="$LIB_dbm_firstkey"
fi
AC_SUBST(LIB_DBM)dnl
LIBS="$save_LIBS"

AC_FIND_FUNC(syslog, syslog)

AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
ac_cv_func_snprintf_working=yes
AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
int main()
{
changequote(`,')dnl
	char foo[3];
changequote([,])dnl
	snprintf(foo, 2, "12");
	return strcmp(foo, "1");
}],:,ac_cv_func_snprintf_working=no,:))
: << END
@@@funcs="$funcs snprintf"@@@
END
if test "$ac_cv_func_snprintf_working" = yes; then
	foo=HAVE_SNPRINTF
	AC_DEFINE_UNQUOTED($foo)
fi

AC_CHECK_FUNCS(asnprintf asprintf vasprintf vasnprintf vsnprintf)


AC_CHECK_FUNCS(_getpty _scrsize _setsid _stricmp fchmod fcntl flock)
AC_CHECK_FUNCS(forkpty frevoke gethostname getlogin getpriority getservbyname)
AC_CHECK_FUNCS(getspnam getspuid gettimeofday getuid grantpt)
AC_CHECK_FUNCS(innetgr iruserok mktime ptsname rand random)
AC_CHECK_FUNCS(revoke setitimer setlogin setpgid setpriority)
AC_CHECK_FUNCS(setproctitle setregid setresgid setresuid setreuid setsid)
AC_CHECK_FUNCS(setutent swab ttyname ttyslot ulimit uname)
AC_CHECK_FUNCS(unlockpt vhangup yp_get_default_domain)
AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
if test "$ac_cv_func_getpwnam_r" = yes; then
	AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
	ac_libs="$LIBS"
	LIBS="$LIBS $LIB_getpwnam_r"
	AC_TRY_RUN([
#include <pwd.h>
int main()
{
	struct passwd pw, *pwd;
	return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
}
],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
LIBS="$ac_libs")
if test "$ac_cv_func_getpwnam_r_posix" = yes; then
	AC_DEFINE(POSIX_GETPWNAM_R)
fi
fi

AC_FIND_FUNC_NO_LIBS(getsockopt, ,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif],
[0,0,0,0,0])
AC_FIND_FUNC_NO_LIBS(setsockopt, ,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif],
[0,0,0,0,0])

dnl Cray stuff
AC_CHECK_FUNCS(getudbnam setlim)

AC_FIND_FUNC(res_search, resolv,
[
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif
],
[0,0,0,0,0])

AC_FIND_FUNC(dn_expand, resolv,
[
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#ifdef HAVE_RESOLV_H
#include <resolv.h>
#endif
],
[0,0,0,0,0])


AC_FUNC_MMAP
AC_FUNC_ALLOCA

#
# Test for POSIX (broken) getlogin
#

if test "$ac_cv_func_getlogin" = yes; then
AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
	ac_cv_func_getlogin_posix=no
else
	ac_cv_func_getlogin_posix=yes
fi
])
if test "$ac_cv_func_getlogin_posix" = yes; then
	AC_DEFINE(POSIX_GETLOGIN, 1)
fi
fi

AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
[#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],
17)

AC_BROKEN(chown daemon err errx fchown getcwd getdtablesize getopt)
AC_BROKEN(getusershell inet_aton initgroups lstat memmove mkstemp)
AC_BROKEN(putenv rcmd setegid setenv seteuid strcasecmp strdup)
AC_BROKEN(strerror strftime strlwr strnlen strtok_r strupr unsetenv)
AC_BROKEN(verr verrx vwarn vwarnx warn warnx)

AC_KRB_FUNC_GETCWD_BROKEN

dnl
dnl Figure what authentication modules should be built
dnl

AC_MSG_CHECKING(which authentication modules should be built)

LIB_AUTH_SUBDIRS=

if test "$ac_cv_header_siad_h" = yes; then
	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
fi

if test "$ac_cv_header_security_pam_modules_h" = yes; then
	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
fi

case "${host}" in
changequote(,)dnl
*-*-irix[56]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
changequote([,])dnl
esac

AC_MSG_RESULT($LIB_AUTH_SUBDIRS)

AC_SUBST(LIB_AUTH_SUBDIRS)dnl

dnl
dnl Figure out if we have tunnels
dnl

AC_MSG_CHECKING(for tunnel devices)

APPL_KIP_DIR=

if test "$ac_cv_header_net_if_tun_h" = "yes"; then
	APPL_KIP_DIR=kip
fi

AC_MSG_RESULT($ac_cv_header_net_if_tun_h)

AC_SUBST(APPL_KIP_DIR)dnl

dnl
dnl Checks for prototypes and declarations
dnl

AC_NEED_PROTO([
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
],
crypt)

AC_NEED_PROTO([
#include <string.h>
],
strtok_r)

AC_CHECK_VAR([#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],
h_errno)

AC_CHECK_VAR([#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],
h_errlist)

AC_CHECK_VAR([#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],
h_nerr)

AC_CHECK_VAR([#ifdef HAVE_ERR_H
#include <err.h>
#endif],[__progname])

AC_CHECK_DECLARATION([#include <stdlib.h>], optarg)
AC_CHECK_DECLARATION([#include <stdlib.h>], optind)
AC_CHECK_DECLARATION([#include <stdlib.h>], opterr)
AC_CHECK_DECLARATION([#include <stdlib.h>], optopt)

dnl
dnl According to ANSI you are explicitly allowed to cast to void,
dnl but the standard fails to say what should happen. Some compilers
dnl think this is illegal:
dnl
dnl void foo(void)
dnl {
dnl   return (void)0;
dnl }
dnl
dnl Thus explicitly test for void
dnl
AC_TYPE_SIGNAL
if test "$ac_cv_type_signal" = "void" ; then
	AC_DEFINE(VOID_RETSIGTYPE, 1)
fi

dnl
dnl Check for fields in struct utmp
dnl
AC_EGREP_HEADER(ut_user, utmp.h, AC_DEFINE(HAVE_UT_USER))
AC_EGREP_HEADER(ut_host, utmp.h, AC_DEFINE(HAVE_UT_HOST))
AC_EGREP_HEADER(ut_addr, utmp.h, AC_DEFINE(HAVE_UT_ADDR))
AC_EGREP_HEADER(ut_type, utmp.h, AC_DEFINE(HAVE_UT_TYPE))
AC_EGREP_HEADER(ut_pid, utmp.h, AC_DEFINE(HAVE_UT_PID))
AC_EGREP_HEADER(ut_id, utmp.h, AC_DEFINE(HAVE_UT_ID))
AC_EGREP_HEADER(ut_syslen, utmpx.h, AC_DEFINE(HAVE_UT_SYSLEN))

AC_STRUCT_ST_BLKSIZE

dnl
dnl Check for struct winsize
dnl

AC_KRB_STRUCT_WINSIZE

dnl
dnl Check for some common types
dnl

AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T

dnl
dnl Check for sa_len in sys/socket.h
dnl

AC_MSG_CHECKING(for sa_len in struct sockaddr)
AC_CACHE_VAL(krb_cv_struct_sockaddr_sa_len, [
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[struct sockaddr sa;
int foo = sa.sa_len;],
krb_cv_struct_sockaddr_sa_len=yes,
krb_cv_struct_sockaddr_sa_len=no)
])
AC_MSG_RESULT($krb_cv_struct_sockaddr_sa_len)
if test "$krb_cv_struct_sockaddr_sa_len" = yes; then
	AC_DEFINE(SOCKADDR_HAS_SA_LEN)
fi

dnl
dnl Check for ouid in sys/siad.h
dnl

if test "$ac_cv_header_siad_h" = yes; then
AC_MSG_CHECKING(for ouid in struct siaentity)
AC_CACHE_VAL(krb_cv_struct_siaentity_ouid, [
AC_TRY_COMPILE(
[#include <siad.h>
],
[SIAENTITY e;
int foo = e.ouid;],
krb_cv_struct_siaentity_ouid=yes,
krb_cv_struct_siaentity_ouid=no)
])
AC_MSG_RESULT($krb_cv_struct_siaentity_ouid)
if test "$krb_cv_struct_siaentity_ouid" = yes; then
	AC_DEFINE(SIAENTITY_HAS_OUID)
fi
fi

dnl
dnl you can link with getmsg on AIX 3.2 but you cannot run the program
dnl

AC_CACHE_CHECK(for working getmsg, ac_cv_func_getmsg,
AC_TRY_RUN(
[
#include <stdio.h>

int main()
{
  getmsg(open("/dev/null", 0), NULL, NULL, NULL);
  return 0;
}
], ac_cv_func_getmsg=yes, ac_cv_func_getmsg=no, ac_cv_func_getmsg=no))
test "$ac_cv_func_getmsg" = "yes" &&
AC_DEFINE(HAVE_GETMSG)

dnl
dnl Test if we are using berkeley db
dnl

save_LIBS="$LIBS"
LIBS="$LIB_DBM $LIBS"
AC_CACHE_CHECK(for berkeley db, krb_cv_lib_berkeleydb,
AC_TRY_RUN(
[
#include <unistd.h>
#include <fcntl.h>
#include <ndbm.h>
int main()
{
  DBM *d;

  d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
  if(d == NULL)
    return 1;
  dbm_close(d);
  return access("conftest.db", F_OK) != 0;
}], krb_cv_lib_berkeleydb=yes, krb_cv_lib_berkeleydb=no,
krb_cv_lib_berkeleydb=no))
test "$krb_cv_lib_berkeleydb" = "yes" &&
AC_DEFINE(HAVE_NEW_DB)
LIBS="$save_LIBS"

dnl
dnl Tests for editline
dnl

AC_FIND_FUNC_NO_LIBS(el_init, edit)
AC_FIND_FUNC_NO_LIBS(readline, readline)

if test "$with_readline"; then
	AC_DEFINE(HAVE_READLINE, 1)
	editline_OBJS=
	LIB_readline="$READLINELIB "'$(LIB_tgetent)'
	INCLUDE_readline="$READLINEINCLUDE"
elif test "$ac_cv_func_el_init" = yes; then
	AC_DEFINE(HAVE_READLINE, 1)

	editline_OBJS=edit_compat.o
	LIB_readline='-L$(topdir)/lib/editline -leditline '"$LIB_el_init"' $(LIB_tgetent)'

	INCLUDE_readline='-I$(topdir)/lib/editline -I$(top_srcdir)/lib/editline'
elif test "$ac_cv_func_readline" = yes; then
	AC_DEFINE(HAVE_READLINE, 1)
	editline_OBJS=
	LIB_readline='-lreadline $(LIB_tgetent)'
	INCLUDE_readline=
else
	AC_DEFINE(HAVE_READLINE, 1)
	editline_OBJS="editline.o complete.o sysunix.o"
	LIB_readline='-L$(topdir)/lib/editline -leditline $(LIB_tgetent)'
	INCLUDE_readline='-I$(topdir)/lib/editline -I$(top_srcdir)/lib/editline'
fi
AC_SUBST(LIB_readline)
AC_SUBST(INCLUDE_readline)
AC_SUBST(editline_OBJS)

dnl telnet muck --------------------------------------------------

AC_DEFINE(AUTHENTICATION)dnl
AC_DEFINE(KRB4)dnl
AC_DEFINE(ENCRYPTION)dnl
AC_DEFINE(DES_ENCRYPTION)dnl
AC_DEFINE(DIAGNOSTICS)dnl
AC_DEFINE(OLD_ENVIRON)dnl

# Simple test for streamspty, based on the existance of getmsg(), alas
# this breaks on SunOS4 which have streams but BSD-like ptys
#
# And also something wierd has happend with dec-osf1, fallback to bsd-ptys

AC_MSG_CHECKING(for streamspty)
case "`uname -sr`" in
SunOS\ 4*|OSF1*|IRIX\ 4*|HP-UX\ ?.10.*)
	krb_cv_sys_streamspty=no
	;;
AIX*)
	os_rel=`uname -v`.`uname -r`
	if expr "$os_rel" : "3*" >/dev/null 2>&1; then
		krb_cv_sys_streamspty=no
	else
		krb_cv_sys_streamspty="$ac_cv_func_getmsg"
	fi
	;;
*)
	krb_cv_sys_streamspty="$ac_cv_func_getmsg"
	;;
esac
if test "$krb_cv_sys_streamspty" = yes; then
	AC_DEFINE(STREAMSPTY)
fi
dnl AC_SUBST(STREAMSPTY)
AC_MSG_RESULT($krb_cv_sys_streamspty)

AC_MSG_CHECKING([if /bin/ls takes -A])
if /bin/ls -A > /dev/null 2>&1 ;then
	AC_DEFINE(HAVE_LS_A)
	krb_ls_a=yes
else
	krb_ls_a=no
fi
AC_MSG_RESULT($krb_ls_a)
	
dnl ------------------------------------------------------------
AC_CACHE_CHECK(for suffix of preformatted manual pages, krb_cv_sys_cat_suffix,
if grep _version /etc/man.conf > /dev/null 2>&1; then
	krb_cv_sys_cat_suffix=0
else
	krb_cv_sys_cat_suffix=number
fi)
if test "$krb_cv_sys_cat_suffix" = number; then
		CATSUFFIX='$$s'
else
		CATSUFFIX=0
fi
AC_SUBST(CATSUFFIX)

dnl ------------------------------------------------------------

KRB_KAFS_LIB='-L$(topdir)/lib/kafs -lkafs'
if test "$krb_cv_sys_aix" = yes; then
	KRB_KAFS_LIB="$KRB_KAFS_LIB -lld"
fi
AC_SUBST(KRB_KAFS_LIB)dnl

dnl ------------------------------------------------------------


dnl This is done by AC_OUTPUT but we need the result here.

test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'

for i in bin lib libexec sbin; do
	i=${i}dir
	foo=`echo $i | tr 'xindiscernible' 'XINDISCERNIBLE'`
	x="\$${i}"
	eval y="$x"
	while test "x$y" != "x$x"; do
		x="$y"
		eval y="$x"
	done
	AC_DEFINE_UNQUOTED($foo,"$x")
done

dnl
dnl We are all set to emit the Makefiles and config.h
dnl
AC_OUTPUT(					\
Makefile 					\
include/Makefile				\
include/sys/Makefile				\
						\
util/Makefile					\
util/et/Makefile				\
						\
man/Makefile					\
						\
lib/Makefile					\
lib/des/Makefile				\
lib/krb/Makefile				\
lib/kdb/Makefile				\
lib/kadm/Makefile				\
lib/acl/Makefile				\
lib/kafs/Makefile				\
lib/roken/Makefile				\
lib/otp/Makefile				\
lib/sl/Makefile					\
lib/editline/Makefile				\
lib/auth/Makefile				\
lib/auth/pam/Makefile				\
lib/auth/sia/Makefile				\
lib/auth/afskauthlib/Makefile			\
						\
kuser/Makefile					\
server/Makefile					\
slave/Makefile					\
admin/Makefile					\
kadmin/Makefile					\
						\
appl/Makefile					\
						\
appl/afsutil/Makefile 				\
appl/ftp/Makefile				\
appl/ftp/common/Makefile			\
appl/ftp/ftp/Makefile				\
appl/ftp/ftpd/Makefile				\
appl/telnet/Makefile				\
appl/telnet/libtelnet/Makefile			\
appl/telnet/telnet/Makefile			\
appl/telnet/telnetd/Makefile			\
appl/bsd/Makefile 				\
appl/kauth/Makefile				\
appl/kpopper/Makefile				\
appl/movemail/Makefile				\
appl/sample/Makefile				\
appl/xnlock/Makefile				\
appl/kx/Makefile				\
appl/kip/Makefile				\
appl/otp/Makefile				\
doc/Makefile					\
) dnl end of AC_OUTPUT

dnl
dnl This is the release version name-number[beta]
dnl Update before making a new release
dnl
KRB4VERSION="$PACKAGE-$VERSION"

cat > include/newversion.h.in <<EOF
char *krb4_long_version = "@(#)\$Version: $KRB4VERSION by @USER@ on @HOST@ ($host) @DATE@ \$";
char *krb4_version = "$KRB4VERSION";
EOF

if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
	echo "include/version.h is unchanged"
	rm -f include/newversion.h.in
else
 	echo "creating include/version.h"
 	User=${USER-${LOGNAME}}
 	Host=`(hostname || uname -n) 2>/dev/null | sed 1q`
 	Date=`date`
	mv -f include/newversion.h.in include/version.h.in
	sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
fi
OpenPOWER on IntegriCloud