1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
3 AC_PREREQ(2.14.-1.1)dnl 2.14a
4 AC_INIT(heimdal, 0.3f, heimdal-bugs@pdc.kth.se)
5 AM_CONFIG_HEADER(include/config.h)
7 dnl Checks for programs.
12 AM_INIT_AUTOMAKE(heimdal,0.3f)
14 AC_PREFIX_DEFAULT(/usr/heimdal)
18 AC_SUBST(CANONICAL_HOST)
35 if test "$sunos" != no; then
36 AC_DEFINE_UNQUOTED(SunOS, $sunos,
37 [Define to what version of SunOS you are running.])
50 test -z "$CFLAGS" && CFLAGS="-g"
64 libdir="$libdir$abilibdirext"
71 AC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
75 dnl AC_ROKEN(10,[/usr/heimdal /usr/athena],[lib/roken],[$(top_builddir)/lib/roken/libroken.la],[-I$(top_builddir)/lib/roken -I$(top_srcdir)/lib/roken])
78 LIB_roken="\$(top_builddir)/lib/vers/libvers.la $LIB_roken"
80 AC_TEST_PACKAGE_NEW(openldap,
83 [-lldap -llber],,,OPENLDAP)
85 if test "$openldap_libdir"; then
86 LIB_openldap="-R $openldap_libdir $LIB_openldap"
89 AC_TEST_PACKAGE_NEW(krb4,[#include <krb.h>],-lkrb,-ldes,/usr/athena, KRB4)
92 if test "$with_krb4" != "no"; then
94 CFLAGS="$CFLAGS $INCLUDE_krb4"
96 LIBS="$LIB_krb4 -ldes $LIBS"
99 AC_CACHE_CHECK(for four valued krb_put_int, ac_cv_func_krb_put_int_four,
100 [AC_TRY_COMPILE([#include <krb.h>],[
102 krb_put_int(17, tmp, 4, sizeof(tmp));],
103 ac_cv_func_krb_put_int_four=yes,
104 ac_cv_func_krb_put_int_four=no)
106 if test "$ac_cv_func_krb_put_int_four" = yes; then
107 AC_DEFINE(HAVE_FOUR_VALUED_KRB_PUT_INT, 1,
108 [define if krb_put_int takes four arguments.])
110 AH_BOTTOM([#if defined(HAVE_FOUR_VALUED_KRB_PUT_INT) || !defined(KRB4)
111 #define KRB_PUT_INT(F, T, L, S) krb_put_int((F), (T), (L), (S))
113 #define KRB_PUT_INT(F, T, L, S) krb_put_int((F), (T), (S))
116 AC_CACHE_CHECK(for KRB_VERIFY_SECURE, ac_cv_func_krb_verify_secure,
117 [AC_TRY_COMPILE([#include <krb.h>],[
118 int x = KRB_VERIFY_SECURE],
119 ac_cv_func_krb_verify_secure=yes,
120 ac_cv_func_krb_verify_secure=no)
122 if test "$ac_cv_func_krb_verify_secure" != yes; then
123 AC_DEFINE(KRB_VERIFY_SECURE, 1,
124 [Define to one if your krb.h doesn't])
125 AC_DEFINE(KRB_VERIFY_SECURE_FAIL, 2,
126 [Define to two if your krb.h doesn't])
128 AC_CACHE_CHECK(for KRB_VERIFY_NOT_SECURE,
129 ac_cv_func_krb_verify_not_secure,
130 [AC_TRY_COMPILE([#include <krb.h>],[
131 int x = KRB_VERIFY_NOT_SECURE],
132 ac_cv_func_krb_verify_not_secure=yes,
133 ac_cv_func_krb_verify_not_secure=no)
135 if test "$ac_cv_func_krb_verify_not_secure" != yes; then
136 AC_DEFINE(KRB_VERIFY_NOT_SECURE, 0,
137 [Define to zero if your krb.h doesn't])
139 AC_FIND_FUNC(krb_enable_debug)
140 AC_FIND_FUNC(krb_disable_debug)
141 AC_FIND_FUNC(krb_get_our_ip_for_realm)
142 AC_CACHE_CHECK(for krb_mk_req with const arguments,
143 ac_cv_func_krb_mk_req_const,
144 [AC_TRY_COMPILE([#include <krb.h>
145 int krb_mk_req(KTEXT a, const char *s, const char *i,
146 const char *r, int32_t checksum)
148 ac_cv_func_krb_mk_req_const=yes,
149 ac_cv_func_krb_mk_req_const=no)
151 if test "$ac_cv_func_krb_mk_req_const" = "yes"; then
152 AC_DEFINE(KRB_MK_REQ_CONST, 1,
153 [Define if krb_mk_req takes cons char *])
157 CFLAGS="$save_CFLAGS"
158 LIB_kdb="-lkdb -lkrb"
159 test_LIB_krb4="$LIB_krb4"
160 if test "$krb4_libdir"; then
161 LIB_krb4="-R $krb4_libdir $LIB_krb4"
162 LIB_kdb="-R $krb4_libdir -L$krb4_libdir $LIB_kdb"
165 AM_CONDITIONAL(KRB4, test "$with_krb4" != "no")
166 AM_CONDITIONAL(KRB5, true)
167 AM_CONDITIONAL(do_roken_rename, true)
169 AC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
172 AC_ARG_ENABLE(dce, [ --enable-dce if you want support for DCE/DFS PAG's.])
173 if test "$enable_dce" = yes; then
174 AC_DEFINE(DCE, 1, [Define if you want support for DCE/DFS PAG's.])
176 AM_CONDITIONAL(DCE, test "$enable_dce" = yes)
178 ## XXX quite horrible:
179 if test -f /etc/ibmcxx.cfg; then
180 dpagaix_LDADD=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/libraries/{;s/^[[^=]]*=\(.*\)/\1/;s/,/ /gp;}'`
181 dpagaix_CFLAGS=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/options/{;s/^[[^=]]*=\(.*\)/\1/;s/-q[^,]*//;s/,/ /gp;}'`
183 dpagaix_CFLAGS="-D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce"
184 dpagaix_LDADD="-L/usr/lib/threads -ldcelibc_r -ldcepthreads -lpthreads_compat lpthreads -lc_r"
185 dpagaix_LDFLAGS="-Wl,-bI:dfspag.exp"
187 AC_SUBST(dpagaix_CFLAGS)
188 AC_SUBST(dpagaix_LDADD)
191 AC_ARG_ENABLE(kaserver,
192 [ --enable-kaserver if you want the KDC to try to emulate a kaserver])
193 if test "$enable_kaserver" = yes; then
194 AC_DEFINE(KASERVER, 1,
195 [Define if you want to use the KDC as a kaserver.])
196 if test "$with_krb4" = "no"; then
197 AC_MSG_ERROR(kaserver requires krb4)
202 AC_ARG_ENABLE(kaserver-db,
203 [ --enable-kaserver-db if you want support for reading kaserver databases in hprop])
204 if test "$enable_kaserver_db" = yes; then
205 AC_DEFINE(KASERVER_DB, 1,
206 [Define if you want support in hprop for reading kaserver databases])
207 if test "$with_krb4" = "no"; then
208 AC_MSG_ERROR(kaserver-db requires krb4)
215 [ --disable-otp if you don't want OTP support],
217 if test "$enableval" = "no"; then
221 if test "$otp" = "yes"; then
222 AC_DEFINE(OTP, 1, [Define if you want OTP support in applications.])
223 LIB_otp='$(top_builddir)/lib/otp/libotp.la'
226 AM_CONDITIONAL(OTP, test "$otp" = yes)dnl
232 AC_TEST_PACKAGE_NEW(readline,
234 #include <readline.h>],-lreadline,,, READLINE)
236 AC_TEST_PACKAGE_NEW(hesiod,[#include <hesiod.h>],-lhesiod,,, HESIOD)
246 AM_CONDITIONAL(HAVE_X, test "$no_x" != yes)
252 dnl Checks for typedefs, structures, and compiler characteristics.
256 AC_CHECK_TYPE_EXTRA(ssize_t, int, [#include <unistd.h>])
259 AC_CHECK_TYPE_EXTRA(mode_t, unsigned short, [])
260 AC_CHECK_TYPE_EXTRA(sig_atomic_t, int, [#include <signal.h>])
261 AC_HAVE_TYPE([long long])
265 dnl Checks for header files.
295 netinet/in6_machtypes.h \
307 security/pam_modules.h \
360 CHECK_NETINET_IP_AND_TCP
363 AC_ARG_ENABLE(netinfo,
364 [ --enable-netinfo enable netinfo for configuration lookup])
366 if test "$ac_cv_header_netinfo_ni_h" = yes -a "$enable_netinfo" = yes; then
367 AC_DEFINE(HAVE_NETINFO, 1,
368 [Define if you want to use Netinfo instead of krb5.conf.])
371 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
372 AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
374 dnl Checks for libraries.
376 AC_FIND_FUNC(socket, socket)
377 AC_FIND_FUNC(gethostbyname, nsl)
378 AC_FIND_FUNC(syslog, syslog)
382 AC_FIND_FUNC_NO_LIBS(logwtmp, util)
383 AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses)
384 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
386 AC_FIND_FUNC(res_search, resolv,
389 #ifdef HAVE_SYS_TYPES_H
390 #include <sys/types.h>
392 #ifdef HAVE_NETINET_IN_H
393 #include <netinet/in.h>
395 #ifdef HAVE_ARPA_NAMESER_H
396 #include <arpa/nameser.h>
404 AC_FIND_FUNC(dn_expand, resolv,
407 #ifdef HAVE_SYS_TYPES_H
408 #include <sys/types.h>
410 #ifdef HAVE_NETINET_IN_H
411 #include <netinet/in.h>
413 #ifdef HAVE_ARPA_NAMESER_H
414 #include <arpa/nameser.h>
422 dnl Checks for library functions.
458 yp_get_default_domain \
463 AC_CHECK_GETPWNAM_R_POSIX
465 AC_FIND_FUNC_NO_LIBS(getsockopt,,
466 [#ifdef HAVE_SYS_TYPES_H
467 #include <sys/types.h>
469 #ifdef HAVE_SYS_SOCKET_H
470 #include <sys/socket.h>
473 AC_FIND_FUNC_NO_LIBS(setsockopt,,
474 [#ifdef HAVE_SYS_TYPES_H
475 #include <sys/types.h>
477 #ifdef HAVE_SYS_SOCKET_H
478 #include <sys/socket.h>
483 AC_CHECK_FUNCS(getudbnam setlim)
489 dnl AC_KRB_FUNC_GETCWD_BROKEN
492 dnl Check for fields in struct utmp
495 AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr, [#include <utmp.h>])
496 AC_HAVE_STRUCT_FIELD(struct utmp, ut_host, [#include <utmp.h>])
497 AC_HAVE_STRUCT_FIELD(struct utmp, ut_id, [#include <utmp.h>])
498 AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid, [#include <utmp.h>])
499 AC_HAVE_STRUCT_FIELD(struct utmp, ut_type, [#include <utmp.h>])
500 AC_HAVE_STRUCT_FIELD(struct utmp, ut_user, [#include <utmp.h>])
501 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit, [#include <utmpx.h>])
502 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen, [#include <utmpx.h>])
505 dnl Check for fields in struct tm
508 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
509 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
512 dnl or do we have a variable `timezone' ?
515 rk_CHECK_VAR(timezone, [#include <time.h>])
517 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
519 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
521 AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
523 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
525 AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
528 dnl Check for struct winsize
531 AC_KRB_STRUCT_WINSIZE
534 dnl Check for struct spwd
540 dnl Check for sa_len in struct sockaddr
543 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
544 #include <sys/socket.h>])
547 AC_GROK_TYPES([int8_t int16_t int32_t int64_t \
548 u_int8_t u_int16_t u_int32_t u_int64_t \
549 uint8_t uint16_t uint32_t uint64_t])
552 dnl crypto functions tests
563 AC_FIND_FUNC_NO_LIBS2(MD4_Init, crypto des, [], [], [], [$test_LIB_krb4])
564 AC_FIND_FUNC_NO_LIBS2(MD5_Init, crypto des, [], [], [], [$test_LIB_krb4])
565 AC_FIND_FUNC_NO_LIBS2(SHA1_Init, crypto des, [], [], [], [$test_LIB_krb4])
566 AC_FIND_FUNC_NO_LIBS2(des_cbc_encrypt, crypto des, [], [], [], [$test_LIB_krb4])
567 AC_FIND_FUNC_NO_LIBS2(RC4, crypto des, [], [], [], [$test_LIB_krb4])
568 if test "$ac_cv_func_des_cbc_encrypt" = "yes" -a \
569 "$ac_cv_func_MD4_Init" = "yes" -a \
570 "$ac_cv_func_MD5_Init" = "yes" -a \
571 "$ac_cv_func_SHA1_Init" = "yes" -a \
572 "$ac_cv_func_RC4" = "yes"; then
575 if test "$krb4_libdir" != "" -a "$ac_cv_funclib_des_cbc_encrypt" = "-ldes"; then
576 LIB_des="-R $krb4_libdir -L$krb4_libdir"
578 LIB_des="$LIB_des $ac_cv_funclib_MD4_Init"
579 LIB_des_appl="$LIB_des"
582 LIB_des='$(top_builddir)/lib/des/libdes.la'
587 AC_SUBST(LIB_des_appl)
591 dnl telnet muck --------------------------------------------------
593 AC_DEFINE(AUTHENTICATION, 1,
594 [Define if you want authentication support in telnet.])dnl
595 AC_DEFINE(ENCRYPTION, 1,
596 [Define if you want encryption support in telnet.])dnl
597 AC_DEFINE(DES_ENCRYPTION, 1,
598 [Define if you want to use DES encryption in telnet.])dnl
599 AC_DEFINE(DIAGNOSTICS, 1,
600 [Define this to enable diagnostics in telnet.])dnl
601 AC_DEFINE(OLD_ENVIRON, 1,
602 [Define this to enable old environment option in telnet.])dnl
604 AC_DEFINE(ENV_HACK, 1,
605 [Define this if you want support for broken ENV_{VAR,VAL} telnets.])
608 # Simple test for streamspty, based on the existance of getmsg(), alas
609 # this breaks on SunOS4 which have streams but BSD-like ptys
611 # And also something wierd has happend with dec-osf1, fallback to bsd-ptys
613 AC_CHECK_FUNC(getmsg)
615 if test "$ac_cv_func_getmsg" = "yes"; then
617 AC_CACHE_CHECK(for working getmsg, ac_cv_func_getmsg_work,
626 ret = getmsg(open("/dev/null", 0), NULL, NULL, NULL);
627 if(ret < 0 && errno == ENOSYS)
631 ], ac_cv_func_getmsg_work=yes, ac_cv_func_getmsg_work=no,
632 ac_cv_func_getmsg_work=no))
633 test "$ac_cv_func_getmsg_work" = "yes" &&
634 AC_DEFINE(HAVE_GETMSG, 1, [Define if you have a working getmsg.])
638 if test "$ac_cv_func_getmsg_work" = yes; then
639 AC_MSG_CHECKING(for streamspty)
641 *-*-aix3*|*-*-sunos4*|*-*-osf*|*-*-hpux1[[01]]*)
642 krb_cv_sys_streamspty=no
645 krb_cv_sys_streamspty=yes
648 AC_MSG_RESULT($krb_cv_sys_streamspty)
650 if test "$krb_cv_sys_streamspty" = yes; then
651 AC_DEFINE(STREAMSPTY, 1, [Define if you have streams ptys.])
656 dnl This is done by AC_OUTPUT but we need the result here.
658 test "x$prefix" = xNONE && prefix=$ac_default_prefix
659 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
661 for i in bin lib libexec sbin; do
663 foo=`echo $i | tr 'xindiscernible' 'XINDISCERNIBLE'`
666 while test "x$y" != "x$x"; do
670 AC_DEFINE_UNQUOTED($foo,"$x")
672 AH_BOTTOM([#undef BINDIR
678 # hack to shut up automake
679 LIBOBJS="$LIBOBJS make-print-version.o"
681 LTLIBOBJS=`echo "$LIBOBJS" | sed 's/\.o/\.lo/g'`
683 AC_CONFIG_FILES(Makefile \
685 include/kadm5/Makefile \
689 lib/auth/afskauthlib/Makefile \
690 lib/auth/pam/Makefile \
691 lib/auth/sia/Makefile \
693 lib/com_err/Makefile \
695 lib/editline/Makefile \
696 lib/gssapi/Makefile \
712 appl/afsutil/Makefile \
714 appl/ftp/common/Makefile \
715 appl/ftp/ftp/Makefile \
716 appl/ftp/ftpd/Makefile \
718 appl/login/Makefile \
720 appl/popper/Makefile \
725 appl/xnlock/Makefile \
726 appl/telnet/Makefile \
727 appl/telnet/libtelnet/Makefile \
728 appl/telnet/telnet/Makefile \
729 appl/telnet/telnetd/Makefile \
732 appl/dceutils/Makefile \
740 dnl This is the release version name-number[beta]
742 HEIMDALVERSION="$PACKAGE-$VERSION"
744 cat > include/newversion.h.in <<EOF
745 const char *heimdal_long_version = "@(#)\$Version: $HEIMDALVERSION by @USER@ on @HOST@ ($host) @DATE@ \$";
746 const char *heimdal_version = "$HEIMDALVERSION";
749 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
750 echo "include/version.h is unchanged"
751 rm -f include/newversion.h.in
753 echo "creating include/version.h"
754 User=${USER-${LOGNAME}}
755 Host=`(hostname || uname -n || echo unknown) 2>/dev/null | sed 1q`
757 mv -f include/newversion.h.in include/version.h.in
758 sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h