configure.in revision 57422
138774Snsouchdnl Process this file with autoconf to produce a configure script.
293023SnsouchAC_REVISION($Revision: 1.218 $)
338774SnsouchAC_INIT(lib/krb5/send_to_kdc.c)
438774SnsouchAM_CONFIG_HEADER(include/config.h)
538774Snsouch
638774SnsouchAM_INIT_AUTOMAKE(heimdal,0.2p)
738774Snsouch
838774SnsouchAC_PREFIX_DEFAULT(/usr/heimdal)
938774Snsouch
1038774SnsouchAC_CANONICAL_HOST
1138774SnsouchCANONICAL_HOST=$host
1238774SnsouchAC_SUBST(CANONICAL_HOST)
1338774Snsouch
1438774Snsouchsunos=no
1538774Snsouchcase "$host" in 
1638774Snsouch*-*-sunos4*)
1738774Snsouch	sunos=40
1838774Snsouch	;;
1938774Snsouch*-*-solaris2.7)
2038774Snsouch	sunos=57
2138774Snsouch	;;
2238774Snsouch*-*-solaris2*)
2338774Snsouch	sunos=50
2438774Snsouch	;;
2538774Snsouchesac
2638774Snsouchif test "$sunos" != no; then
27119418Sobrien	AC_DEFINE_UNQUOTED(SunOS, $sunos, 
28119418Sobrien		[Define to what version of SunOS you are running.])
29119418Sobrienfi
3038774Snsouch
3138774Snsouchaix=no
3238774Snsouchcase "$host" in 
3338774Snsouch*-*-aix3*)
3438774Snsouch	aix=3
3538774Snsouch	;;
3638774Snsouch*-*-aix4*)
37181304Sjhb	aix=4
38167856Simp	;;
3938774Snsouchesac
40181304Sjhb
41282674Sloos#test -z "$CFLAGS" && CFLAGS="-g"
42274641Sian
4338774Snsouchdnl Checks for programs.
4438774SnsouchAC_PROG_CC
4538774Snsouch
4638774SnsouchAC_CYGWIN
4738774SnsouchAC_OBJEXT
4838774SnsouchAC_EXEEXT
4938774Snsouch
50129152Sjoergdnl AC_KRB_PROG_YACC
51129152SjoergAC_PROG_YACC
52129152SjoergAM_PROG_LEX
5340782SnsouchAC_PROG_RANLIB
5440782SnsouchAC_PROG_AWK
5540782SnsouchAC_KRB_PROG_LN_S
56160372Simp
5742442SnsouchAC_MIPS_ABI
58186833SnwhitehornCC="$CC $abi"
59186833Snwhitehornlibdir="$libdir$abilibdirext"
60187457Snwhitehorn
6140782SnsouchAC_C___ATTRIBUTE__
6240782Snsouch
63129152SjoergAM_DISABLE_SHARED
6440782SnsouchAM_PROG_LIBTOOL
6540782Snsouch
6640782SnsouchAC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
6740782Snsouch
6840782Snsouchberkeley_db=db
6940782SnsouchAC_ARG_WITH(berkeley-db,
7040782Snsouch[  --without-berkeley-db   if you don't want berkeley db],[
7140782Snsouchif test "$withval" = no; then
7240782Snsouch	berkeley_db=""
7340782Snsouchfi
7440782Snsouch])
7540782Snsouch
7640782SnsouchAC_TEST_PACKAGE_NEW(krb4,[#include <krb.h>],-lkrb,-ldes,/usr/athena)
7740782Snsouch
7840782SnsouchLIB_kdb=
7940782Snsouchif test "$with_krb4" != "no"; then
8040782Snsouch	save_CFLAGS="$CFLAGS"
8140782Snsouch	CFLAGS="$CFLAGS $INCLUDE_krb4"
8240782Snsouch	save_LIBS="$LIBS"
8340782Snsouch	LIBS="$LIB_krb4 -ldes $LIBS"
8442442Snsouch	EXTRA_LIB45=lib45.a
8540782Snsouch	AC_SUBST(EXTRA_LIB45)
8638774Snsouch	AC_CACHE_CHECK(for four valued krb_put_int, ac_cv_func_krb_put_int_four,
8740782Snsouch		[AC_TRY_COMPILE([#include <krb.h>],[
8840782Snsouch		char tmp[4];
8938774Snsouch		krb_put_int(17, tmp, 4, sizeof(tmp));],
9038774Snsouch		ac_cv_func_krb_put_int_four=yes,
9140782Snsouch		ac_cv_func_krb_put_int_four=no)
9238774Snsouch	])
93129152Sjoerg	if test "$ac_cv_func_krb_put_int_four" = yes; then
94129152Sjoerg		AC_DEFINE(HAVE_FOUR_VALUED_KRB_PUT_INT, 1,
95129152Sjoerg			[define if krb_put_int takes four arguments.])
96167856Simp	fi
97228257Sadrian	AC_CACHE_CHECK(for KRB_VERIFY_SECURE, ac_cv_func_krb_verify_secure,
98129152Sjoerg		[AC_TRY_COMPILE([#include <krb.h>],[
99167856Simp		int x = KRB_VERIFY_SECURE],
100181304Sjhb		ac_cv_func_krb_verify_secure=yes,
101274641Sian		ac_cv_func_krb_verify_secure=no)
10240782Snsouch	])
103228257Sadrian	if test "$ac_cv_func_krb_verify_secure" != yes; then
104228257Sadrian		AC_DEFINE(KRB_VERIFY_SECURE, 1,
105228257Sadrian			[Define to one if your krb.h doesn't])
106228257Sadrian		AC_DEFINE(KRB_VERIFY_SECURE_FAIL, 2,
107228257Sadrian			[Define to two if your krb.h doesn't])
10838774Snsouch	fi
10942442Snsouch	AC_CACHE_CHECK(for KRB_VERIFY_NOT_SECURE,
11042442Snsouch		ac_cv_func_krb_verify_not_secure,
11142442Snsouch		[AC_TRY_COMPILE([#include <krb.h>],[
11242442Snsouch		int x = KRB_VERIFY_NOT_SECURE],
11342442Snsouch		ac_cv_func_krb_verify_not_secure=yes,
114129152Sjoerg		ac_cv_func_krb_verify_not_secure=no)
11540782Snsouch	])
11638774Snsouch	if test "$ac_cv_func_krb_verify_not_secure" != yes; then
11740782Snsouch		AC_DEFINE(KRB_VERIFY_NOT_SECURE, 0,
118129152Sjoerg			[Define to zero if your krb.h doesn't])
11940782Snsouch	fi
12040782Snsouch	AC_FIND_FUNC(krb_enable_debug)
12140782Snsouch	AC_FIND_FUNC(krb_disable_debug)
12240782Snsouch	AC_FIND_FUNC(krb_get_our_ip_for_realm)
12340782Snsouch	LIBS="$save_LIBS"
12442442Snsouch	CFLAGS="$save_CFLAGS"
125181304Sjhb	LIB_kdb="-lkdb -lkrb"
126167856Simp	if test "$krb4_libdir"; then
12738774Snsouch		LIB_krb4="-rpath $krb4_libdir $LIB_krb4"
12838774Snsouch		LIB_kdb="-rpath $krb4_libdir -L$krb4_libdir $LIB_kdb"
12938774Snsouch	fi
13093023Snsouchfi
13193023SnsouchAM_CONDITIONAL(KRB4, test "$with_krb4" != "no")
13293023SnsouchAM_CONDITIONAL(KRB5, true)
13393023SnsouchAC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
134181304SjhbAC_SUBST(LIB_kdb)dnl
135160372SimpAM_CONDITIONAL(AIX, test "$aix" != no)dnl
13693023SnsouchAM_CONDITIONAL(AIX4, test "$aix" = 4)
13793023Snsouchaix_dynamic_afs=yes
138181304SjhbAM_CONDITIONAL(AIX_DYNAMIC_AFS, test "$aix_dynamic_afs" = yes)dnl
13993023Snsouch
14093023SnsouchAC_FIND_FUNC_NO_LIBS(dlopen, dl)
14193023Snsouch
14293023Snsouchif test "$aix" != no; then
143167856Simp	if test "$aix_dynamic_afs" = yes; then
14493023Snsouch		if test "$ac_cv_funclib_dlopen" = yes; then
145167856Simp			AIX_EXTRA_KAFS=
146167856Simp		elif test "$ac_cv_funclib_dlopen" != no; then
147160372Simp			AIX_EXTRA_KAFS="$ac_cv_funclib_dlopen"
148167856Simp		else
149167856Simp			AIX_EXTRA_KAFS=-lld
150167856Simp		fi
151282674Sloos	else
152167856Simp		AIX_EXTRA_KAFS=
153167856Simp	fi
154167856Simpfi
155167856Simp
156167856SimpAM_CONDITIONAL(HAVE_DLOPEN, test "$ac_cv_funclib_dlopen" != no)dnl
157167856SimpAC_SUBST(AFS_EXTRA_LD)dnl
158167856SimpAC_SUBST(AIX_EXTRA_KAFS)dnl
159167856Simp
160167856SimpAC_ARG_ENABLE(kaserver,
161167856Simp[  --enable-kaserver	  if you want the KDC to try to emulate a kaserver])
162282702Sloosif test "$enable_kaserver" = yes; then
163167856Simp	AC_DEFINE(KASERVER, 1,
164167856Simp		[Define if you want to use the KDC as a kaserver.])
165167856Simp	if test "$with_krb4" = "no"; then
166167856Simp		AC_MSG_ERROR(kaserver requires krb4)
167167856Simp		exit 1
168167856Simp	fi
169167856Simpfi
170167856Simp
171167856SimpAC_ARG_ENABLE(kaserver-db,
17293023Snsouch[  --enable-kaserver-db	  if you want support for reading kaserver databases in hprop])
17393023Snsouchif test "$enable_kaserver_db" = yes; then
17493023Snsouch	AC_DEFINE(KASERVER_DB, 1,
175167856Simp		[Define if you want support in hprop for reading kaserver databases])
176167856Simp	if test "$with_krb4" = "no"; then
177167856Simp		AC_MSG_ERROR(kaserver-db requires krb4)
178167856Simp		exit 1
179167856Simp	fi
180167856Simpfi
181167856Simp
182167856Simpotp=yes
183167856SimpAC_ARG_ENABLE(otp,
184188461Simp[  --disable-otp          if you don't want OTP support],
185167856Simp[
186167856Simpif test "$enableval" = "no"; then
187167856Simp	otp=no
188167856Simpfi
189167856Simp])
190167856Simpif test "$otp" = "yes"; then
191167856Simp	AC_DEFINE(OTP, 1, [Define if you want OTP support in applications.])
192209800Snwhitehorn	LIB_otp='$(top_builddir)/lib/otp/libotp.la'
193167856Simpfi
194167856SimpAC_SUBST(LIB_otp)
195167856SimpAM_CONDITIONAL(OTP, test "$otp" = yes)dnl
196167856Simp
197167856SimpAC_CHECK_OSFC2
198167856Simp
199212413SavgAC_CHECK_MAN
200167856Simp
201167856SimpAC_TEST_PACKAGE_NEW(readline,
202167856Simp[#include <stdio.h>
203167856Simp #include <readline.h>],-lreadline)
204167856Simp
205167856SimpAC_TEST_PACKAGE_NEW(hesiod,[#include <hesiod.h>],-lhesiod)
206167856Simp
207167856SimpKRB_C_BIGENDIAN
208167856SimpAC_C_INLINE
209167856Simp
210167856SimpKRB_CHECK_X
211167856Simp
212282674Sloosif test "$no_x" = "yes" ; then
213167856Simp	MAKE_X_PROGS_BIN_PROGS=""
214167856Simp	MAKE_X_PROGS_BIN_SCRPTS=""
215167856Simp	MAKE_X_PROGS_LIBEXEC_PROGS=""
216167856Simpelse
217167856Simp	MAKE_X_PROGS_BIN_PROGS='$(X_PROGS_BIN_PROGS)'
218167856Simp	MAKE_X_PROGS_BIN_SCRPTS='$(X_PROGS_BIN_SCRPTS)'
219167856Simp	MAKE_X_PROGS_LIBEXEC_PROGS='$(X_PROGS_LIBEXEC_PROGS)'
220167856Simpfi
221282674SloosAC_SUBST(MAKE_X_PROGS_BIN_PROGS)dnl
222167856SimpAC_SUBST(MAKE_X_PROGS_BIN_SCRPTS)dnl
223167856SimpAC_SUBST(MAKE_X_PROGS_LIBEXEC_PROGS)dnl
224167856Simp
225167856SimpAC_CHECK_XAU
226167856Simp
227282674Sloosdnl AM_C_PROTOTYPES
228282674Sloos
229282674Sloosdnl Checks for typedefs, structures, and compiler characteristics.
230282674SloosAC_C_CONST
231282674SloosAC_TYPE_OFF_T
232167856SimpAC_TYPE_SIZE_T
233167856SimpAC_CHECK_TYPE_EXTRA(ssize_t, int, [#include <unistd.h>])
234282674SloosAC_TYPE_PID_T
235282674SloosAC_TYPE_UID_T
236282674SloosAC_CHECK_TYPE_EXTRA(mode_t, unsigned short, [])
237282674SloosAC_CHECK_TYPE_EXTRA(sig_atomic_t, int, [#include <signal.h>])
238282674SloosAC_HAVE_TYPE([long long])
239282674SloosAC_HEADER_TIME
240282674SloosAC_STRUCT_TM
241282674Sloos
242282674Sloosdnl Checks for header files.
24338774SnsouchAC_HEADER_STDC
24438774Snsouch
24538774Snsouchif test "$berkeley_db"; then
246160372Simp  AC_CHECK_HEADERS([				\
24738774Snsouch	db.h					\
24838774Snsouch	db_185.h				\
24938774Snsouch  ])
25040782Snsouchfi
25140782Snsouch
25240782SnsouchAC_CHECK_HEADERS([\
253160372Simp	arpa/ftp.h				\
25440782Snsouch	arpa/inet.h				\
25540782Snsouch	arpa/nameser.h				\
25640782Snsouch	arpa/telnet.h				\
25740782Snsouch	bind/bitypes.h				\
25840782Snsouch	bsdsetjmp.h				\
25940782Snsouch	crypt.h					\
260160372Simp	curses.h				\
26140782Snsouch	dbm.h					\
26240782Snsouch	dirent.h				\
26340782Snsouch	dlfcn.h					\
264274641Sian	err.h					\
265274641Sian	errno.h					\
266274641Sian	fcntl.h					\
267274641Sian	fnmatch.h				\
268274641Sian	grp.h					\
269274641Sian	inttypes.h				\
270274641Sian	io.h					\
271274641Sian	limits.h				\
272274641Sian	maillock.h				\
273274641Sian	ndbm.h					\
274274641Sian	net/if.h				\
275274641Sian	netdb.h					\
276274641Sian	netinet/in.h				\
277274641Sian	netinet/in6.h				\
278274641Sian	netinet/in6_machtypes.h			\
279274641Sian	netinet/in6_var.h			\
280274641Sian	netinet/in_systm.h			\
281274641Sian	netinet6/in6.h				\
282274641Sian	netinfo/ni.h				\
283274641Sian	paths.h					\
284274641Sian	pthread.h				\
285274641Sian	pty.h					\
286274641Sian	pwd.h					\
287274641Sian	resolv.h				\
288274641Sian	rpcsvc/dbm.h				\
289274641Sian	sac.h					\
290274641Sian	security/pam_modules.h			\
291274641Sian	sgtty.h					\
292274641Sian	shadow.h				\
293274641Sian	siad.h					\
294274641Sian	signal.h				\
295274641Sian	stropts.h				\
296274641Sian	sys/bitypes.h				\
297274641Sian	sys/category.h				\
298274641Sian	sys/file.h				\
299274641Sian	sys/filio.h				\
300274641Sian	sys/ioccom.h				\
301274641Sian	sys/ioctl.h				\
302274641Sian	sys/param.h				\
303274641Sian	sys/proc.h				\
304274641Sian	sys/pty.h				\
305274641Sian	sys/ptyio.h				\
306274641Sian	sys/ptyvar.h				\
307274641Sian	sys/resource.h				\
308274641Sian	sys/select.h				\
309167856Simp	sys/socket.h				\
310282668Sloos	sys/sockio.h				\
311282668Sloos	sys/stat.h				\
312282668Sloos	sys/str_tty.h				\
313282668Sloos	sys/stream.h				\
314167856Simp	sys/stropts.h				\
315282668Sloos	sys/strtty.h				\
316282674Sloos	sys/syscall.h				\
317282674Sloos	sys/sysctl.h				\
318282674Sloos	sys/termio.h				\
319282674Sloos	sys/time.h				\
320282674Sloos	sys/timeb.h				\
321282702Sloos	sys/times.h				\
322282674Sloos	sys/tty.h				\
323282702Sloos	sys/types.h				\
324282702Sloos	sys/uio.h				\
325282674Sloos	sys/un.h				\
326282668Sloos	sys/utsname.h				\
327282668Sloos	sys/wait.h				\
328167856Simp	syslog.h				\
329167856Simp	term.h					\
330167856Simp	termio.h				\
331167856Simp	termios.h				\
332167856Simp	time.h					\
333167856Simp	tmpdir.h				\
334167856Simp	udb.h					\
335167856Simp	unistd.h				\
336274641Sian	util.h					\
337167856Simp	utmp.h					\
338227843Smarius	utmpx.h					\
339167856Simp])
340167856Simp
341167856SimpCHECK_NETINET_IP_AND_TCP
342167856Simp
343167856Simp
344167856SimpAC_ARG_ENABLE(netinfo,
345167856Simp[  --enable-netinfo      enable netinfo for configuration lookup])
346167856Simp
347167856Simpif test "$ac_cv_header_netinfo_ni_h" = yes -a "$enable_netinfo" = yes; then
348167856Simp       AC_DEFINE(HAVE_NETINFO, 1,
34993023Snsouch               [Define if you want to use Netinfo instead of krb5.conf.])
350187261Snwhitehornfi
351
352AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
353AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
354
355AC_KRB_IPV6
356
357dnl Checks for libraries.
358
359AC_FIND_FUNC(socket, socket)
360AC_FIND_FUNC(gethostbyname, nsl)
361AC_FIND_FUNC(syslog, syslog)
362
363AC_FIND_FUNC_NO_LIBS(logwtmp, util)
364AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses)
365AC_FIND_FUNC(gethostbyname2, inet6 ip6)
366
367AC_FIND_FUNC(res_search, resolv,
368[
369#include <stdio.h>
370#ifdef HAVE_SYS_TYPES_H
371#include <sys/types.h>
372#endif
373#ifdef HAVE_NETINET_IN_H
374#include <netinet/in.h>
375#endif
376#ifdef HAVE_ARPA_NAMESER_H
377#include <arpa/nameser.h>
378#endif
379#ifdef HAVE_RESOLV_H
380#include <resolv.h>
381#endif
382],
383[0,0,0,0,0])
384
385AC_FIND_FUNC(dn_expand, resolv,
386[
387#include <stdio.h>
388#ifdef HAVE_SYS_TYPES_H
389#include <sys/types.h>
390#endif
391#ifdef HAVE_NETINET_IN_H
392#include <netinet/in.h>
393#endif
394#ifdef HAVE_ARPA_NAMESER_H
395#include <arpa/nameser.h>
396#endif
397#ifdef HAVE_RESOLV_H
398#include <resolv.h>
399#endif
400],
401[0,0,0,0,0])
402
403dnl Checks for library functions.
404
405AC_BROKEN_SNPRINTF
406AC_BROKEN_VSNPRINTF
407
408AC_BROKEN_GLOB
409
410if test "$ac_cv_func_glob_working" != yes; then
411	LIBOBJS="$LIBOBJS glob.o"
412fi
413AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
414
415dnl these should happen after tests for *snprintf
416
417AC_FIND_FUNC_NO_LIBS(dbopen, $berkeley_db)
418AC_FIND_FUNC_NO_LIBS(dbm_firstkey, $berkeley_db gdbm ndbm)
419
420DBLIB="$LIB_dbopen"
421if test "$LIB_dbopen" != "$LIB_dbm_firstkey"; then
422	DBLIB="$DBLIB $LIB_dbm_firstkey"
423fi
424AC_SUBST(DBLIB)dnl
425
426AC_CHECK_FUNCS(_getpty _scrsize asnprintf asprintf cgetent fcntl)
427AC_CHECK_FUNCS(getmsg getrlimit getspnam gettimeofday getuid)
428AC_CHECK_FUNCS(grantpt mktime ptsname rand random setproctitle)
429AC_CHECK_FUNCS(revoke select setitimer setpcred setpgid)
430AC_CHECK_FUNCS(setregid setresgid setresuid setreuid setutent)
431AC_CHECK_FUNCS(setsid sigaction strstr)
432AC_CHECK_FUNCS(sysconf sysctl timegm ttyname ttyslot umask uname)
433AC_CHECK_FUNCS(unlockpt vasnprintf vasprintf vhangup)
434AC_CHECK_FUNCS(yp_get_default_domain)
435
436if test "$ac_cv_func_cgetent" = no; then
437	LIBOBJS="$LIBOBJS getcap.o"
438fi
439
440AC_FUNC_GETLOGIN
441
442KRB_CAPABILITIES
443
444AC_CHECK_GETPWNAM_R_POSIX
445
446AC_FIND_FUNC_NO_LIBS(getsockopt,,
447[#ifdef HAVE_SYS_TYPES_H
448#include <sys/types.h>
449#endif
450#ifdef HAVE_SYS_SOCKET_H
451#include <sys/socket.h>
452#endif],
453[0,0,0,0,0])
454AC_FIND_FUNC_NO_LIBS(setsockopt,,
455[#ifdef HAVE_SYS_TYPES_H
456#include <sys/types.h>
457#endif
458#ifdef HAVE_SYS_SOCKET_H
459#include <sys/socket.h>
460#endif],
461[0,0,0,0,0])
462
463dnl Cray stuff
464AC_CHECK_FUNCS(getudbnam setlim)
465
466AC_TYPE_SIGNAL
467if test "$ac_cv_type_signal" = "void" ; then
468	AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
469fi
470AC_SUBST(VOID_RETSIGTYPE)
471
472AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
473[#ifdef HAVE_NETDB_H
474#include <netdb.h>
475#endif],
47617)
477if test "$ac_cv_func_hstrerror" = yes; then
478AC_NEED_PROTO([
479#ifdef HAVE_NETDB_H
480#include <netdb.h>
481#endif],
482hstrerror)
483fi
484
485dnl sigh, wish this could be done in a loop
486if test "$ac_cv_func_asprintf" = yes; then
487AC_NEED_PROTO([
488#include <stdio.h>
489#include <string.h>],
490asprintf)dnl
491fi
492if test "$ac_cv_func_vasprintf" = yes; then
493AC_NEED_PROTO([
494#include <stdio.h>
495#include <string.h>],
496vasprintf)dnl
497fi
498if test "$ac_cv_func_asnprintf" = yes; then
499AC_NEED_PROTO([
500#include <stdio.h>
501#include <string.h>],
502asnprintf)dnl
503fi
504if test "$ac_cv_func_vasnprintf" = yes; then
505AC_NEED_PROTO([
506#include <stdio.h>
507#include <string.h>],
508vasnprintf)dnl
509fi
510
511AC_BROKEN(chown copyhostent daemon err errx fchown flock fnmatch)
512AC_BROKEN(freeaddrinfo freehostent gai_strerror getaddrinfo)
513AC_BROKEN(getcwd getdtablesize gethostname getipnodebyaddr getipnodebyname)
514AC_BROKEN(geteuid getgid getegid)
515AC_BROKEN(getnameinfo getopt getusershell)
516AC_BROKEN(inet_aton inet_ntop inet_pton initgroups innetgr iruserok lstat)
517AC_BROKEN(memmove)
518AC_BROKEN(mkstemp putenv rcmd readv recvmsg sendmsg setegid setenv seteuid)
519AC_BROKEN(strcasecmp strncasecmp strdup strerror strftime)
520AC_BROKEN(strlcat strlcpy strlwr)
521AC_BROKEN(strndup strnlen strptime strsep strtok_r strupr)
522AC_BROKEN(swab unsetenv verr verrx vsyslog)
523AC_BROKEN(vwarn vwarnx warn warnx writev)
524
525AC_NEED_PROTO([#include <stdlib.h>], setenv)
526AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
527AC_NEED_PROTO([#include <unistd.h>], gethostname)
528AC_NEED_PROTO([#include <unistd.h>], mkstemp)
529AC_NEED_PROTO([#include <unistd.h>], getusershell)
530
531AC_NEED_PROTO([
532#ifdef HAVE_SYS_TYPES_H
533#include <sys/types.h>
534#endif
535#ifdef HAVE_SYS_SOCKET_H
536#include <sys/socket.h>
537#endif
538#ifdef HAVE_NETINET_IN_H
539#include <netinet/in.h>
540#endif
541#ifdef HAVE_ARPA_INET_H
542#include <arpa/inet.h>
543#endif],
544inet_aton)
545
546AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
547
548dnl
549dnl libroken references crypt and dbopen
550dnl
551
552LIB_roken='$(top_builddir)/lib/roken/libroken.la $(LIB_crypt) $(LIB_dbopen)'
553AC_SUBST(LIB_roken)dnl
554
555AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
556ac_cv_func_realloc_broken=no
557AC_TRY_RUN([
558#include <stddef.h>
559#include <stdlib.h>
560
561int main()
562{
563	return realloc(NULL, 17) == NULL;
564}
565],:, ac_cv_func_realloc_broken=yes, :)
566])
567if test "$ac_cv_func_realloc_broken" = yes ; then
568	AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL) doesn't work.])
569fi
570
571dnl AC_KRB_FUNC_GETCWD_BROKEN
572
573dnl
574dnl Checks for prototypes and declarations
575dnl
576
577AC_PROTO_COMPAT([
578#ifdef HAVE_SYS_TYPES_H
579#include <sys/types.h>
580#endif
581#ifdef HAVE_SYS_SOCKET_H
582#include <sys/socket.h>
583#endif
584#ifdef HAVE_NETINET_IN_H
585#include <netinet/in.h>
586#endif
587#ifdef HAVE_ARPA_INET_H
588#include <arpa/inet.h>
589#endif
590#ifdef HAVE_NETDB_H
591#include <netdb.h>
592#endif
593],
594gethostbyname, struct hostent *gethostbyname(const char *))
595
596AC_PROTO_COMPAT([
597#ifdef HAVE_SYS_TYPES_H
598#include <sys/types.h>
599#endif
600#ifdef HAVE_SYS_SOCKET_H
601#include <sys/socket.h>
602#endif
603#ifdef HAVE_NETINET_IN_H
604#include <netinet/in.h>
605#endif
606#ifdef HAVE_ARPA_INET_H
607#include <arpa/inet.h>
608#endif
609#ifdef HAVE_NETDB_H
610#include <netdb.h>
611#endif
612],
613gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
614
615AC_PROTO_COMPAT([
616#ifdef HAVE_SYS_TYPES_H
617#include <sys/types.h>
618#endif
619#ifdef HAVE_SYS_SOCKET_H
620#include <sys/socket.h>
621#endif
622#ifdef HAVE_NETINET_IN_H
623#include <netinet/in.h>
624#endif
625#ifdef HAVE_ARPA_INET_H
626#include <arpa/inet.h>
627#endif
628#ifdef HAVE_NETDB_H
629#include <netdb.h>
630#endif
631],
632getservbyname, struct servent *getservbyname(const char *, const char *))
633
634AC_PROTO_COMPAT([
635#ifdef HAVE_SYSLOG_H
636#include <syslog.h>
637#endif
638],
639openlog, void openlog(const char *, int, int))
640
641AC_NEED_PROTO([
642#ifdef HAVE_CRYPT_H
643#include <crypt.h>
644#endif
645#ifdef HAVE_UNISTD_H
646#include <unistd.h>
647#endif
648],
649crypt)
650
651AC_NEED_PROTO([
652#include <string.h>
653],
654strtok_r)
655
656AC_NEED_PROTO([
657#include <string.h>
658],
659strsep)
660
661AC_CHECK_VAR([#ifdef HAVE_SYS_TYPES_H
662#include <sys/types.h>
663#endif
664#ifdef HAVE_NETDB_H
665#include <netdb.h>
666#endif],
667h_errno)
668
669AC_CHECK_VAR([#ifdef HAVE_NETDB_H
670#include <netdb.h>
671#endif],
672h_errlist)
673
674AC_CHECK_VAR([#ifdef HAVE_NETDB_H
675#include <netdb.h>
676#endif],
677h_nerr)
678
679AC_CHECK_VAR([#ifdef HAVE_ERR_H
680#include <err.h>
681#endif],[__progname])
682
683AC_CHECK_DECLARATION([#include <stdlib.h>
684#ifdef HAVE_UNISTD_H
685#include <unistd.h>
686#endif], optarg)
687AC_CHECK_DECLARATION([#include <stdlib.h>
688#ifdef HAVE_UNISTD_H
689#include <unistd.h>
690#endif], optind)
691AC_CHECK_DECLARATION([#include <stdlib.h>
692#ifdef HAVE_UNISTD_H
693#include <unistd.h>
694#endif], opterr)
695AC_CHECK_DECLARATION([#include <stdlib.h>
696#ifdef HAVE_UNISTD_H
697#include <unistd.h>
698#endif], optopt)
699
700AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
701
702dnl
703dnl Check for fields in struct utmp
704dnl
705
706AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr, [#include <utmp.h>])
707AC_HAVE_STRUCT_FIELD(struct utmp, ut_host, [#include <utmp.h>])
708AC_HAVE_STRUCT_FIELD(struct utmp, ut_id, [#include <utmp.h>])
709AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid, [#include <utmp.h>])
710AC_HAVE_STRUCT_FIELD(struct utmp, ut_type, [#include <utmp.h>])
711AC_HAVE_STRUCT_FIELD(struct utmp, ut_user, [#include <utmp.h>])
712AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit, [#include <utmpx.h>])
713AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen, [#include <utmpx.h>])
714
715dnl
716dnl Check for fields in struct tm
717dnl
718
719AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
720AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
721
722dnl
723dnl or do we have a variable `timezone' ?
724dnl
725
726AC_CHECK_VAR(
727[#include <time.h>],
728timezone)
729
730AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
731
732AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
733
734AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
735
736AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
737
738AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
739
740dnl
741dnl Check for struct winsize
742dnl
743
744AC_KRB_STRUCT_WINSIZE
745
746dnl
747dnl Check for struct spwd
748dnl
749
750AC_KRB_STRUCT_SPWD
751
752dnl
753dnl Check for sa_len in struct sockaddr
754dnl
755
756AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
757#include <sys/socket.h>])
758
759
760AC_GROK_TYPES(int8_t int16_t int32_t int64_t)
761AC_GROK_TYPES(u_int8_t u_int16_t u_int32_t u_int64_t)
762
763dnl
764dnl crypto functions tests
765dnl
766
767AC_FIND_FUNC_NO_LIBS(MD4Init, crypto)
768AC_FIND_FUNC_NO_LIBS(MD4_Init, crypto)
769AC_FIND_FUNC_NO_LIBS(MD5Init, crypto)
770AC_FIND_FUNC_NO_LIBS(MD5_Init, crypto)
771AC_FIND_FUNC_NO_LIBS(SHA1Init, crypto)
772AC_FIND_FUNC_NO_LIBS(SHA1_Init, crypto)
773AC_FIND_FUNC_NO_LIBS(des_cbc_encrypt, crypto des)
774
775dnl
776dnl Tests for editline
777dnl
778
779dnl el_init
780
781AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
782if test "$ac_cv_func_el_init" = yes ; then
783	AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
784		AC_TRY_COMPILE([#include <stdio.h>
785			#include <histedit.h>],
786			[el_init("", NULL, NULL, NULL);],
787			ac_cv_func_el_init_four=yes,
788			ac_cv_func_el_init_four=no)])
789	if test "$ac_cv_func_el_init_four" = yes; then
790		AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
791	fi
792fi
793
794dnl readline
795
796ac_foo=no
797if test "$with_readline" = yes; then
798	:
799elif test "$ac_cv_func_readline" = yes; then
800	:
801elif test "$ac_cv_func_el_init" = yes; then
802	ac_foo=yes
803	LIB_readline="\$(top_builddir)/lib/editline/libel_compat.a $LIB_el_init"
804else
805	LIB_readline='$(top_builddir)/lib/editline/libeditline.a'
806fi
807AM_CONDITIONAL(el_compat, test "$ac_foo" = yes)
808if test "$readline_libdir"; then
809	LIB_readline="-rpath $readline_libdir $LIB_readline"
810fi
811LIB_readline="$LIB_readline \$(LIB_tgetent)"
812AC_DEFINE(HAVE_READLINE, 1, 
813	[Define if you have a readline compatible library.])dnl
814
815dnl telnet muck --------------------------------------------------
816
817AC_DEFINE(AUTHENTICATION, 1, 
818	[Define if you want authentication support in telnet.])dnl
819AC_DEFINE(ENCRYPTION, 1,
820	[Define if you want encryption support in telnet.])dnl
821AC_DEFINE(DES_ENCRYPTION, 1,
822	[Define if you want to use DES encryption in telnet.])dnl
823AC_DEFINE(DIAGNOSTICS, 1,
824	[Define this to enable diagnostics in telnet.])dnl
825AC_DEFINE(OLD_ENVIRON, 1,
826	[Define this to enable old environment option in telnet.])dnl
827if false; then
828AC_DEFINE(ENV_HACK, 1,
829	[Define this if you want support for broken ENV_{VAR,VAL} telnets.])
830fi
831
832# Simple test for streamspty, based on the existance of getmsg(), alas
833# this breaks on SunOS4 which have streams but BSD-like ptys
834#
835# And also something wierd has happend with dec-osf1, fallback to bsd-ptys
836
837AC_MSG_CHECKING(for streamspty)
838case "$host" in
839*-*-aix3*|*-*-sunos4*|*-*-osf*|*-*-hpux10*)
840	krb_cv_sys_streamspty=no
841	;;
842*)
843	krb_cv_sys_streamspty="$ac_cv_func_getmsg"
844	;;
845esac
846if test "$krb_cv_sys_streamspty" = yes; then
847	AC_DEFINE(STREAMSPTY, 1, [Define if you have streams ptys.])
848fi
849dnl AC_SUBST(STREAMSPTY)
850AC_MSG_RESULT($krb_cv_sys_streamspty)
851
852AC_AUTH_MODULES
853
854dnl This is done by AC_OUTPUT but we need the result here.
855
856test "x$prefix" = xNONE && prefix=$ac_default_prefix
857test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
858
859for i in bin lib libexec sbin; do
860	i=${i}dir
861	foo=`echo $i | tr 'xindiscernible' 'XINDISCERNIBLE'`
862	x="\$${i}"
863	eval y="$x"
864	while test "x$y" != "x$x"; do
865		x="$y"
866		eval y="$x"
867	done
868	AC_DEFINE_UNQUOTED($foo,"$x")
869done
870
871if false; then
872	# hack to shut up automake
873	LIBOBJS="$LIBOBJS make-print-version.o"
874fi
875LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/\.lo/g'`
876AC_SUBST(LTLIBOBJS)
877AC_OUTPUT(Makefile 			\
878	include/Makefile		\
879	include/kadm5/Makefile		\
880	lib/Makefile			\
881	lib/45/Makefile			\
882	lib/auth/Makefile		\
883	lib/auth/afskauthlib/Makefile	\
884	lib/auth/pam/Makefile		\
885	lib/auth/sia/Makefile		\
886	lib/asn1/Makefile		\
887	lib/com_err/Makefile		\
888	lib/des/Makefile		\
889	lib/editline/Makefile		\
890	lib/gssapi/Makefile		\
891	lib/hdb/Makefile		\
892	lib/kadm5/Makefile		\
893	lib/kafs/Makefile		\
894	lib/krb5/Makefile		\
895	lib/otp/Makefile		\
896	lib/roken/Makefile		\
897	lib/sl/Makefile			\
898	kuser/Makefile			\
899	kpasswd/Makefile		\
900	kadmin/Makefile			\
901	admin/Makefile			\
902	kdc/Makefile			\
903	appl/Makefile			\
904	appl/afsutil/Makefile		\
905	appl/ftp/Makefile		\
906	appl/ftp/common/Makefile	\
907	appl/ftp/ftp/Makefile		\
908	appl/ftp/ftpd/Makefile		\
909	appl/kauth/Makefile		\
910	appl/kx/Makefile		\
911	appl/login/Makefile		\
912	appl/otp/Makefile		\
913	appl/popper/Makefile		\
914	appl/push/Makefile		\
915	appl/rsh/Makefile		\
916	appl/su/Makefile		\
917	appl/xnlock/Makefile		\
918	appl/telnet/Makefile		\
919	appl/telnet/libtelnet/Makefile	\
920	appl/telnet/telnet/Makefile	\
921	appl/telnet/telnetd/Makefile	\
922	appl/test/Makefile		\
923	appl/kf/Makefile		\
924	doc/Makefile			\
925)
926
927dnl
928dnl This is the release version name-number[beta]
929dnl
930HEIMDALVERSION="$PACKAGE-$VERSION"
931
932cat > include/newversion.h.in <<EOF
933char *heimdal_long_version = "@(#)\$Version: $HEIMDALVERSION by @USER@ on @HOST@ ($host) @DATE@ \$";
934char *heimdal_version = "$HEIMDALVERSION";
935EOF
936
937if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
938	echo "include/version.h is unchanged"
939	rm -f include/newversion.h.in
940else
941 	echo "creating include/version.h"
942 	User=${USER-${LOGNAME}}
943 	Host=`(hostname || uname -n || echo unknown) 2>/dev/null | sed 1q`
944 	Date=`date`
945	mv -f include/newversion.h.in include/version.h.in
946	sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
947fi
948