summaryrefslogtreecommitdiffstats
path: root/crypto/kerberosIV/configure.in
blob: ec17759c0d4dad4b0c7e7993c1e19500e0e8c125 (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
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
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.415.2.9 $)
AC_INIT(lib/krb/getrealm.c)
AC_CONFIG_HEADER(include/config.h)

dnl
dnl definitions
dnl

PACKAGE=krb4
AC_SUBST(PACKAGE)dnl
VERSION=0.10.1
AC_SUBST(VERSION)dnl
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])dnl
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])dnl

# This may be overridden using --prefix=/usr to configure
AC_PREFIX_DEFAULT(/usr/athena)

AC_CANONICAL_HOST
CANONICAL_HOST=$host
AC_SUBST(CANONICAL_HOST)

dnl OS specific defines

sunos=no
case "$host" in 
*-*-sunos4*)
	sunos=40
	;;
*-*-solaris2.7)
	sunos=57
	;;
*-*-solaris2*)
	sunos=50
	;;
esac
if test "$sunos" != no; then
	AC_DEFINE_UNQUOTED(SunOS, $sunos, 
		[Define to what version of SunOS you are running.])
fi

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
dnl AC_PROG_AWK
dnl mawk seems to mishandle \# in lib/roken/roken.awk
AC_CHECK_PROGS(AWK, gawk nawk awk, )
AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, :)

dnl Use make Wall or make WFLAGS=".."
WFLAGS=""
WFLAGS_NOUNUSED=""
WFLAGS_NOIMPLICITINT=""
AC_SUBST(WFLAGS) dnl
AC_SUBST(WFLAGS_NOUNUSED) dnl
AC_SUBST(WFLAGS_NOIMPLICITINT) dnl

dnl
dnl check for build options
dnl

AC_TEST_PACKAGE_NEW(socks,[#include <socks.h>],-lsocks5)
CFLAGS="$INCLUDE_socks $CFLAGS"
LIBS="$LIB_socks $LIBS"

AC_ARG_ENABLE(legacy-kdestroy,
[  --enable-legacy-kdestroy    kdestroy doesn't destroy tokens by default],[
if test "$enableval" = "yes"; then
	AC_DEFINE(LEGACY_KDESTROY,1, [Define to enable old kdestroy behavior.])
fi
])

AC_ARG_ENABLE(match-subdomains,
[  --enable-match-subdomains	match realm in subdomains],
[if test "$enableval" = "yes"; then
	AC_DEFINE(MATCH_SUBDOMAINS,1, [Define if you want to match subdomains.])
fi
])

AC_ARG_WITH(ld-flags,
[  --with-ld-flags=flags   what flags use when linking])

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", [Define this to be the directory where the 
	dictionary for cracklib resides.])

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

test -n "$with_mailspool" &&
AC_DEFINE_UNQUOTED(KRB4_MAILDIR, "$with_mailspool", [Define this to the path of the mail spool directory.])

AC_ARG_WITH(db-dir,
[  --with-db-dir=dir	   this is the database directory (default /var/kerberos)])

test -n "$with_db_dir" &&
AC_DEFINE_UNQUOTED(DB_DIR, "$with_db_dir", [Define this to the kerberos database directory.])

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

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

otp=yes
AC_ARG_ENABLE(otp,
[  --disable-otp           if you don't want OTP support],
[
if test "$enableval" = "no"; then
	otp=no
fi
])

if test "$otp" = "yes"; then
	AC_DEFINE(OTP)
	LIB_otp='-L$(top_builddir)/lib/otp -lotp'
	OTP_dir=otp
	LIB_SUBDIRS="$LIB_SUBDIRS otp"
fi
AC_SUBST(LIB_otp)
AC_SUBST(OTP_dir)

AC_CHECK_OSFC2

mmap=yes
AC_ARG_ENABLE(mmap,
[  --disable-mmap          disable use of mmap],
[
if test "$enableval" = "no"; then
	mmap=no
fi
])
if test "$mmap" = "no"; then
	AC_DEFINE(NO_MMAP, 1, [Define if you don't want to use mmap.])
fi

aix_dynamic_afs=yes
AC_ARG_ENABLE(dynamic-afs,
[  --disable-dynamic-afs   don't use loaded AFS library with AIX],[
if test "$enableval" = "no"; then
	aix_dynamic_afs=no
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, 1, [Define if you don't wan't support for 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_x=DES_QUAD_NEW
elif test "$des_quad" = "old"; then
	ac_x=DES_QUAD_OLD
else
	ac_x=DES_QUAD_GUESS
fi	
AC_DEFINE_UNQUOTED(DES_QUAD_DEFAULT,$ac_x, 
	[Set this to the type of des-quad-cheksum to use.])

AC_ARG_WITH(afsws,
[  --with-afsws=dir        use AFS includes and libraries from dir=/usr/afsws],
AFSWS=$withval,
AFSWS=/usr/afsws
)
test "$AFSWS" = "yes" && AFSWS=/usr/afsws
AC_SUBST(AFSWS)

AC_ARG_ENABLE(rxkad,
[  --enable-rxkad           build rxkad library],,[
test -f $AFSWS/include/rx/rx.h && enable_rxkad=yes
])

if test "$afs_support" = yes -a "$enable_rxkad" = yes; then
	LIB_SUBDIRS="$LIB_SUBDIRS rxkad"
fi
AC_SUBST(LIB_SUBDIRS)

AC_ARG_ENABLE(cat-manpages,
[  --disable-cat-manpages   don't install any preformatted manpages],
[
if test "$enableval" = "no"; then
	disable_cat_manpages=yes
fi
])

AC_SUBST(disable_cat_manpages)dnl

AC_TEST_PACKAGE_NEW(readline,[
#include <stdio.h>
#include <readline.h>
],-lreadline)

AC_MIPS_ABI

AC_TEST_PACKAGE_NEW(hesiod,[#include <hesiod.h>],-lhesiod)

AC_SHARED_LIBS

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 inline keyword
dnl
AC_C_INLINE

dnl
dnl Check for __attribute__
dnl
AC_C___ATTRIBUTE__

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
	if test "$aix_dynamic_afs" = yes; then
		AFS_EXTRA_OBJS=
		AFS_EXTRA_LIBS=afslib.so
		# this works differently in AIX <=3 and 4
		if test `uname -v` = 4 ; then
			AFS_EXTRA_LD="-bnoentry"
		else
			AFS_EXTRA_LD="-e _nostart"
		fi
		AFS_EXTRA_DEFS=
		AC_FIND_FUNC_NO_LIBS(dlopen, dl)
		if test "$ac_cv_funclib_dlopen" = yes; then
			AIX_EXTRA_KAFS=
		elif test "$ac_cv_funclib_dlopen" != no; then
			AIX_EXTRA_KAFS="$ac_cv_funclib_dlopen"
		else
			AFS_EXTRA_OBJS="$AFS_EXTRA_OBJS dlfcn.o"
			AIX_EXTRA_KAFS=-lld
		fi
	else
		AFS_EXTRA_OBJS='$(srcdir)/afsl.exp afslib.o'
		AFS_EXTRA_LIBS=
		AFS_EXTRA_DEFS='-DSTATIC_AFS_SYSCALLS'
		AIX_EXTRA_KAFS=
	fi
	AC_SUBST(AFS_EXTRA_OBJS)dnl
	AC_SUBST(AFS_EXTRA_LIBS)dnl
	AC_SUBST(AFS_EXTRA_LD)dnl
	AC_SUBST(AFS_EXTRA_DEFS)dnl
	AC_SUBST(AIX_EXTRA_KAFS)dnl
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,-bnolibpath -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				\
	arpa/telnet.h				\
	bsd/bsd.h				\
	bsdsetjmp.h				\
	capability.h				\
	crypt.h					\
	curses.h				\
	db.h					\
	dbm.h					\
	dirent.h				\
	err.h					\
	errno.h					\
	fcntl.h					\
	fnmatch.h				\
	grp.h					\
	inttypes.h				\
	io.h					\
	lastlog.h				\
	libutil.h				\
	limits.h				\
	login.h					\
	maillock.h				\
	ndbm.h					\
	net/if.h				\
	net/if_tun.h				\
	net/if_var.h				\
	netdb.h					\
	netinet/in.h				\
	netinet/in6_machtypes.h			\
	netinet/in_systm.h			\
	paths.h					\
	pty.h					\
	pwd.h					\
	resolv.h				\
	rpcsvc/dbm.h				\
	rpcsvc/ypclnt.h				\
	sac.h					\
	security/pam_modules.h			\
	shadow.h				\
	siad.h					\
	signal.h				\
	stropts.h				\
	sys/bitypes.h				\
	sys/capability.h			\
	sys/category.h				\
	sys/file.h				\
	sys/filio.h				\
	sys/ioccom.h				\
	sys/ioctl.h				\
	sys/locking.h				\
	sys/mman.h				\
	sys/param.h				\
	sys/proc.h				\
	sys/pty.h				\
	sys/ptyio.h				\
	sys/ptyvar.h				\
	sys/resource.h				\
	sys/select.h				\
	sys/socket.h				\
	sys/sockio.h				\
	sys/stat.h				\
	sys/str_tty.h				\
	sys/stream.h				\
	sys/stropts.h				\
	sys/strtty.h				\
	sys/syscall.h				\
	sys/sysctl.h				\
	sys/termio.h				\
	sys/time.h				\
	sys/timeb.h				\
	sys/times.h				\
	sys/tty.h				\
	sys/types.h				\
	sys/uio.h				\
	sys/un.h				\
	sys/utsname.h				\
	sys/wait.h				\
	syslog.h				\
	term.h					\
	termcap.h				\
	termio.h				\
	termios.h				\
	tmpdir.h				\
	ttyent.h				\
	udb.h					\
	ulimit.h				\
	unistd.h				\
	userpw.h				\
	usersec.h				\
	util.h					\
	utime.h					\
	utmp.h					\
	utmpx.h					\
	wait.h])

AC_HEADER_TIME
AC_DECL_SYS_SIGLIST

CHECK_NETINET_IP_AND_TCP

EXTRA_LOCL_HEADERS=
EXTRA_HEADERS=
if test "$ac_cv_header_err_h" != yes; then
	EXTRA_HEADERS="$EXTRA_HEADERS err.h"
fi
if test "$ac_cv_header_fnmatch_h" != yes; then
	EXTRA_LOCL_HEADERS="$EXTRA_LOCL_HEADERS fnmatch.h"
fi
AC_SUBST(EXTRA_HEADERS)
AC_SUBST(EXTRA_LOCL_HEADERS)

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)

AC_MSG_CHECKING(for strange sys/bitypes.h)
AC_CACHE_VAL(krb_cv_int8_t_ifdef, [
AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
#ifdef HAVE_NETINET_IN6_MACHTYPES_H
#include <netinet/in6_machtypes.h>
#endif
],
int8_t x;
,
krb_cv_int8_t_ifdef=no,
krb_cv_int8_t_ifdef=yes)])
AC_MSG_RESULT($krb_cv_int8_t_ifdef)
if test "$krb_cv_int8_t_ifdef" = "yes"; then
  AC_DEFINE(HAVE_STRANGE_INT8_T, 1, [Huh?])dnl
fi

dnl
dnl Various checks for libraries and their contents
dnl

AC_FIND_FUNC_NO_LIBS(crypt, crypt)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 ncurses curses)
	
dnl 
dnl See if there is any X11 present
dnl
KRB_CHECK_X
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

AC_CHECK_XAU

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

KRB_FIND_DB("" $berkeley_db gdbm ndbm)

AC_FIND_FUNC(syslog, syslog)

AC_BROKEN_SNPRINTF
AC_BROKEN_GLOB

if test "$ac_cv_func_glob_working" != yes; then
	EXTRA_LOCL_HEADERS="$EXTRA_LOCL_HEADERS glob.h"
	LIBOBJS="$LIBOBJS glob.o"
fi

AC_CHECK_FUNCS(asnprintf asprintf vasprintf vasnprintf vsnprintf)

AC_CHECK_FUNCS(atexit _getpty _scrsize _setsid _stricmp chroot fattach fchmod)
AC_CHECK_FUNCS(fcntl forkpty frevoke getlogin getpriority)
AC_CHECK_FUNCS(getrlimit getservbyname getspnam getspuid gettimeofday)
AC_CHECK_FUNCS(gettosbyname getuid grantpt mktime parsetos ptsname)
AC_CHECK_FUNCS(rand random revoke setitimer setlogin setpgid setpriority)
AC_CHECK_FUNCS(setproctitle setregid setresgid setresuid setreuid setsid)
AC_CHECK_FUNCS(setutent sigaction sysconf sysctl ttyname ttyslot)
AC_CHECK_FUNCS(ulimit uname unlockpt vhangup yp_get_default_domain)
AC_CHECK_FUNCS(on_exit sgi_getcapabilitybyname cap_set_proc)

AC_CHECK_GETPWNAM_R_POSIX

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_SUBST(LIB_res_search)dnl
AC_SUBST(LIB_dn_expand)dnl

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, [Define if getlogin has POSIX flavour (and not BSD).])
fi
fi

AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
[#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],
17)
if test "$ac_cv_func_hstrerror" = yes; then
AC_NEED_PROTO([
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],
hstrerror)
fi

AC_BROKEN(chown daemon err errx fchown flock fnmatch)
AC_BROKEN(getcwd getdtablesize gethostname geteuid getgid getegid)
AC_BROKEN(getopt getusershell inet_aton initgroups innetgr iruserok lstat)
AC_BROKEN(memmove mkstemp putenv rcmd readv setegid setenv seteuid)
AC_BROKEN(strcasecmp strncasecmp strdup strerror strftime strlwr)
AC_BROKEN(strndup strnlen strsep strtok_r strupr)
AC_BROKEN(swab unsetenv verr verrx vsyslog)
AC_BROKEN(vwarn vwarnx warn warnx writev)

if test "$ac_cv_func_gethostname" = "yes"; then
AC_NEED_PROTO([
#include <unistd.h>],
gethostname)
fi

if test "$ac_cv_func_mkstemp" = "yes"; then
AC_NEED_PROTO([
#include <unistd.h>],
mkstemp)
fi

if test "$ac_cv_func_inet_aton" = "yes"; then
AC_NEED_PROTO([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif],
inet_aton)
fi

AC_CACHE_CHECK(if realloc is broken, ac_cv_func_realloc_broken, [
ac_cv_func_realloc_broken=no
AC_TRY_RUN([
#include <stddef.h>
#include <stdlib.h>

int main()
{
	return realloc(NULL, 17) == NULL;
}
],:, ac_cv_func_realloc_broken=yes, :)
])
if test "$ac_cv_func_realloc_broken" = yes ; then
	AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL, X) doesn't work.])
fi

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 -a "$enable_shared" = 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_PROTO_COMPAT([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
],
gethostbyname, struct hostent *gethostbyname(const char *))

AC_PROTO_COMPAT([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
],
gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))

AC_PROTO_COMPAT([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
],
getservbyname, struct servent *getservbyname(const char *, const char *))

AC_PROTO_COMPAT([
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif
],
openlog, void openlog(const char *, int, int))

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

AC_NEED_PROTO([
#include <stdio.h>
],
fclose)

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

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

AC_NEED_PROTO([
#include <unistd.h>
],
getusershell)

AC_NEED_PROTO([
#ifdef HAVE_UTIME_H
#include <utime.h>
#endif
],
utime)

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)

AC_CHECK_DECLARATION([#include <stdlib.h>], environ)

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, [Define if RETSIGTYPE == void.])
fi

dnl
dnl Check for fields in struct utmp
dnl

AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmp, ut_host,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmp, ut_id,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmp, ut_type,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmp, ut_user,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit,
[#include <sys/types.h>
 #include <utmp.h>])
AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen,
[#include <sys/types.h>
 #include <utmp.h>])

AC_KRB_STRUCT_SPWD

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

AC_CHECK_TYPE_EXTRA(ssize_t, int, [
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif])

dnl
dnl Check for broken ultrix sys/socket.h
dnl

AC_MSG_CHECKING(for broken sys/socket.h)
AC_CACHE_VAL(krb_cv_header_sys_socket_h_broken, [
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socket.h>],[],
krb_cv_header_sys_socket_h_broken=no,
krb_cv_header_sys_socket_h_broken=yes)])
AC_MSG_RESULT($krb_cv_header_sys_socket_h_broken)
AC_SUBST(krb_cv_header_sys_socket_h_broken)

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

AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
#include <sys/socket.h>])

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

if test "$ac_cv_header_siad_h" = yes; then
AC_HAVE_STRUCT_FIELD(SIAENTITY, ouid, [#include <siad.h>])
fi

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

AC_CHECK_FUNCS(getmsg)

if test "$ac_cf_func_getmsg" = "yes"; then

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, 1, [Define if you have a working getmsg.])

fi

dnl
dnl Tests for editline
dnl

dnl el_init

AC_FIND_FUNC_NO_LIBS(el_init, edit)
if test "$ac_cv_func_el_init" = yes ; then
	AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
		AC_TRY_COMPILE([#include <stdio.h>
			#include <histedit.h>],
			[el_init("", NULL, NULL, NULL);],
			ac_cv_func_el_init_four=yes,
			ac_cv_func_el_init_four=no)])
	if test "$ac_cv_func_el_init_four" = yes; then
		AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
	fi
fi

dnl readline

save_LIBS="$LIBS"
LIBS="$LIB_tgetent $LIBS"
AC_FIND_FUNC_NO_LIBS(readline, edit readline)
LIBS="$save_LIBS"
el_yes="# "
if test "$with_readline" -a "$with_readline" != "no"; then
	:
elif test "$ac_cv_func_readline" = yes; then
	INCLUDE_readline=
elif test "$ac_cv_func_el_init" = yes; then
	el_yes=
	LIB_readline="-L\$(top_builddir)/lib/editline -lel_compat $LIB_el_init"
	INCLUDE_readline='-I$(top_srcdir)/lib/editline'
else
	LIB_readline='-L$(top_builddir)/lib/editline -leditline'
	INCLUDE_readline='-I$(top_srcdir)/lib/editline'
fi
LIB_readline="$LIB_readline \$(LIB_tgetent)"
AC_DEFINE(HAVE_READLINE, 1, [Define if you have a readline function.])dnl XXX
AC_SUBST(LIB_readline)
AC_SUBST(INCLUDE_readline)
AC_SUBST(el_yes)

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, 1, [Define if you have working stream ptys.])
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, 1, [Define if /bin/ls has a \`-A' flag.])
	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\$(top_builddir)/lib/kafs -lkafs $AIX_EXTRA_KAFS"
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				\
						\
man/Makefile					\
						\
lib/Makefile					\
lib/com_err/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/rxkad/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/popper/Makefile				\
appl/movemail/Makefile				\
appl/push/Makefile				\
appl/sample/Makefile				\
appl/xnlock/Makefile				\
appl/kx/Makefile				\
appl/kip/Makefile				\
appl/otp/Makefile				\
doc/Makefile					\
) dnl end of AC_OUTPUT

AC_KRB_VERSION
OpenPOWER on IntegriCloud