[BACK]Return to configure.in CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

File: [local] / src / usr.bin / ssh / Attic / configure.in (download)

Revision 1.1, Sun Sep 26 20:53:35 1999 UTC (24 years, 8 months ago) by deraadt
Branch: MAIN

i bet a lot of people didn't know what ssh 1.2.16 had a nice license.
well, except for the patent issues.  someone in sweden (forget their
name at the moment) cleaned out most of the patented code, and now
this code removes rsa code.  when this is done, it will link against
libssl, but the work isn't completely done yet.  then we need to bring
this up to modern days, featurewise.

#
# configure.in
#
# Author: Tatu Ylonen <ylo@cs.hut.fi>
#
# Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#                    All rights reserved
#
# Created: Wed Mar 22 18:02:48 1995 ylo
#
# $Id: configure.in,v 1.1 1999/09/26 20:53:35 deraadt Exp $
#

AC_INIT(sshd.c)
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.4)

AC_CANONICAL_HOST

AC_PROG_CC
AC_PROG_CPP

case "$host" in
  *-*-sunos4.1.1*)
    os_sunos=yes
    # Tim Adam <tma@osa.com.au> says speed_t is defined in stdtypes.h
    AC_DEFINE(SPEED_T_IN_STDTYPES_H)
    ;;
  *-*-sunos*)
    os_sunos=yes
    ;;
  *-sgi-irix5*)
    # Irix stuff from snabb@niksula.hut.fi and tsurmacz@asic.ict.pwr.wroc.pl.
    no_libsocket=yes
    no_libsun=yes
    ;;
  *-sgi-irix6*)
    # from d-champion@uchicago.edu
    no_libsocket=yes
    no_libsun=yes
    if test "`uname -s`" = "IRIX64"; then
      CFLAGS="-32 $CFLAGS"
      LDFLAGS="-32 $LDFLAGS"
    fi
    ;;
  *-ibm-aix3.2|*-ibm-aix3.2.0|*-ibm-aix3.2.1|*-ibm-aix3.2.2|*-ibm-aix3.2.3|*-ibm-aix3.2.4)
    os_aix=yes
    AC_CHECK_LIB(s, getuserattr)
    ;;
  *-ibm-aix*)
    os_aix=yes
    AC_CHECK_LIB(s, getuserattr)
    ;;
  mips-dec-mach3*)
    # Mach3 stuff from kivinen@hut.fi
    no_vhangup=yes
    ;;
  *-dec-ultrix*)
    # Ultrix stuff from dmckilli@qc.bell.ca, jbotz@orixa.mtholyoke.edu.
    AC_DEFINE(O_NONBLOCK_BROKEN)
    no_vhangup=yes
    AC_TRY_COMPILE([#include <syslog.h>],
		   [int foo = LOG_DAEMON; ],
		   ,
		   AC_DEFINE(NEED_SYS_SYSLOG_H))
    ;;
  *-*-hpux*)
    # HPUX flags from jgotts@engin.umich.edu
    if test -z "$GCC"; then
      CFLAGS="$CFLAGS -Aa -D_HPUX_SOURCE"
    fi
    AC_DEFINE(HPSUX_NONSTANDARD_X11_KLUDGE)
    ;;
  alpha-dec-osf*)
    AC_DEFINE(TTY_GROUP, "terminal")
    AC_CHECK_LIB(security, set_auth_parameters)
    AC_MSG_CHECKING(for OSF/1 C2 security package)
    osfc2sec=`/usr/sbin/setld -i | grep '^OSFC2SEC'`
    if test -n "$osfc2sec"; then
      AC_MSG_RESULT(yes)
      AC_DEFINE(HAVE_OSF1_C2_SECURITY)
      AC_CHECK_LIB(security, set_auth_parameters,
                   LIBS="$LIBS -lsecurity",
                   AC_MSG_ERROR("Could not find libsecurity even though C2 security installed."))
      CONFOBJS="$CONFOBJS osfc2.o"
    else
      AC_MSG_RESULT(no)
    fi
    ;;
  *-*-nextstep*)
    # Nextstep support from a person who wants to remain anonymous
    no_termios=yes
    AC_DEFINE(SPEED_T_IN_STDTYPES_H)
    ;;
  *-*-linux*)
    # Linux shadow password support (Andrew.Macpherson.1248566@bnr.co.uk)
    if test -f /etc/shadow && test -f /etc/login.defs; then
      AC_MSG_RESULT(Using linux John Haugh shadow passwords and pw_encrypt for password encryption)
      AC_DEFINE(crypt,pw_encrypt)
      LIBS="$LIBS -lshadow"
    fi
    ;;
  i*86-*-bsdi*)
    no_pipe=yes
    ;;
  i*86-unknown-bsd*)
    # Assume 386BSD.  pgut01@cs.auckland.ac.nz reported this makes it compile.
    AC_DEFINE(__FreeBSD__)
    ;;
  m68k-sony-newsos*)
    # From snabb@niksula.hut.fi
    no_vhangup=yes
    ;;
  m88k-dg-dgux*)
    AC_DEFINE(BROKEN_INET_ADDR)
    ;;
  *-cray-unicos*)
    CFLAGS="$CFLAGS -DCRAY_STACKSEG_END=_getb67"
    ;;
  *-*-sysv4*)
    AC_CHECK_LIB(gen, openlog)
    ;;
  *-*-machten*)
    AC_DEFINE(USE_STRLEN_FOR_AF_UNIX)
    ;;
  i*86-unknown-sco*)
    # From moi@dio.com
    AC_DEFINE(HAVE_SCO_ETC_SHADOW)
    AC_DEFINE(SCO)
    no_ranlib=yes
    LIBS="-L/usr/lib/libp -lprot -lx $LIBS"
    ;;
  *-convex-bsd*)
    # From mark.martinec@nsc.ijs.si
    # On Convex, getpwnam sets pw_passwd if running as root
    no_shadows_password_checking=yes
    ;;
  *-*-freebsd*)
    # From Ollivier Robert: FreeBSD and NetBSD use master.passwd, but set
    # pw_passwd automatically when running as root.
    no_shadow_password_checking=yes
    ;;
  *-*-netbsd*)
    # From Ollivier Robert: FreeBSD and NetBSD use master.passwd, but set
    # pw_passwd automatically when running as root.
    no_shadow_password_checking=yes
    ;;
  *-*-openbsd*)
    no_shadow_password_checking=yes
    ;;
  *)
    ;;
esac

# Socket pairs appear to be broken on several systems.  I don't know exactly
# where, so I'll use pipes everywhere for now.
AC_DEFINE(USE_PIPES)

AC_MSG_CHECKING([that the compiler works])
AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)
    AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.),
    AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.))

if test -z "$no_pipe"; then
if test -n "$GCC"; then
  AC_MSG_CHECKING([if the compiler understands -pipe])
  OLDCC="$CC"
  CC="$CC -pipe"
  AC_TRY_COMPILE(,,
    AC_MSG_RESULT(yes),
    CC="$OLDCC"
    AC_MSG_RESULT(no))
fi
fi

AC_ARG_ENABLE(warnings,
[  --enable-warnings       Enable -Wall if using gcc.],
[ if test -n "$GCC"; then 
    AC_MSG_RESULT(Adding -Wall to CFLAGS.)
    CFLAGS="$CFLAGS -Wall"
  fi])

if test -z "$no_vhangup"; then
  AC_CHECK_FUNCS(vhangup)
fi

if test -z "$no_setsid"; then
  AC_CHECK_FUNCS(setsid)
fi

AC_MSG_CHECKING(where to find mandatory GMP library)
AC_ARG_WITH(gmp,
[  --with-gmp[=PATH]      Where to find GMP library.],
[ case "$withval" in
  no)
    echo "GMP is mandatory! Aborting!"
    exit 1
    ;;
  *)
    ;;
  esac ],
[ with_gmp=yes ]
)
# gmp continued
echo argument="$with_gmp"
case "$with_gmp" in
yes)
  AC_CHECK_HEADERS(gmp.h)
  if test "$ac_cv_header_gmp_h" != yes; then
    echo "Can't find include file gmp.h! Aborting!"
    echo "You must first build and install GMP, please read the file INSTALL"
    exit 1
  fi
  AC_CHECK_LIB(gmp, main)
  if test "$ac_cv_lib_gmp_main" != yes; then
    echo "Can't find library gmp (libgmp.a)! Aborting"
    echo "You must first build and install GMP, please read the file INSTALL"
    exit 1
  fi
  GMPINCS=""
  GMPLIBS="-lgmp"
  ;;
*)
  GMPINCS="-I$with_gmp/include"
  GMPLIBS="-L$with_gmp/lib -lgmp"
  ;;
esac
AC_SUBST(GMPINCS) dnl
AC_SUBST(GMPLIBS) dnl

AC_CHECK_FUNCS(_getpty clock fchmod getdtablesize gethostname getrusage)
AC_CHECK_FUNCS(gettimeofday initgroups innetgr memcpy openpty popen seteuid)
AC_CHECK_FUNCS(setlogin setluid setrlimit strchr times ulimit umask vsnprintf)

AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_MODE_T
AC_STRUCT_ST_BLKSIZE

AC_C_CONST
AC_C_INLINE
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short)

if test -z "$no_termios"; then
  AC_CHECK_HEADERS(termios.h)
fi

AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(unistd.h rusage.h sys/time.h lastlog.h utmp.h utmpx.h)
AC_CHECK_HEADERS(sgtty.h sys/select.h sys/ioctl.h sys/filio.h)
AC_CHECK_HEADERS(paths.h usersec.h utime.h netinet/in_systm.h ulimit.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_EGREP_HEADER(ut_pid, utmp.h, AC_DEFINE(HAVE_PID_IN_UTMP))
AC_EGREP_HEADER(ut_name, utmp.h, AC_DEFINE(HAVE_NAME_IN_UTMP))
AC_EGREP_HEADER(ut_id, utmp.h, AC_DEFINE(HAVE_ID_IN_UTMP))
AC_EGREP_HEADER(ut_host, utmp.h, AC_DEFINE(HAVE_HOST_IN_UTMP))
AC_EGREP_HEADER(ut_addr, utmp.h, AC_DEFINE(HAVE_ADDR_IN_UTMP))

AC_EGREP_HEADER(ut_session, utmpx.h, AC_DEFINE(HAVE_UT_SESSION))
AC_EGREP_HEADER(ut_syslen, utmpx.h, AC_DEFINE(HAVE_UT_SYSLEN))

AC_CHECK_LIB(c, crypt, [true], AC_CHECK_LIB(crypt, crypt))
AC_CHECK_LIB(nsl, main)
if test -z "$no_libsocket"; then
  AC_CHECK_LIB(socket, socket)
fi
if test -z "$no_libsun"; then
  AC_CHECK_LIB(sun, getpwnam)
fi
AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN)
			  LIBS="$LIBS -lutil")

AC_CHECK_LIB(des, main)

AC_REPLACE_FUNCS(strerror memmove remove random putenv socketpair)

AC_PROG_LN_S
AC_PROG_INSTALL
if test -z "$no_ranlib"; then
  AC_PROG_RANLIB
else
  RANLIB=":"
fi
AC_PROGRAMS_CHECK(MAKEDEP, makedepend makedep, makedepend)
AC_PATH_PROGS(WISH, wish8.0 wish wishx wish4.1 true)
if test `basename $WISH` = "true"; then
  AC_MSG_WARN(the wish program was not found - ssh-askpass will not work.)
  WISH="/usr/local/bin/wish"
fi
AC_PATH_PROG(XAUTH_PATH, xauth, , $PATH:/usr/X11R6/bin)
if test -n "$XAUTH_PATH"; then
  AC_DEFINE_UNQUOTED(XAUTH_PATH, "$XAUTH_PATH")
fi

AC_MSG_CHECKING(for pseudo ttys)
if test -c /dev/ptmx && test -c /dev/pts/0
then
  AC_DEFINE(HAVE_DEV_PTMX)
  AC_MSG_RESULT(streams ptys)
else
if test -c /dev/pts && test -c /dev/ptc
then
  AC_DEFINE(HAVE_DEV_PTS_AND_PTC)
  AC_MSG_RESULT(/dev/pts and /dev/ptc)
else
  AC_MSG_RESULT(bsd-style ptys)
fi
fi

AC_MSG_CHECKING(for /etc/default/login)
if test -f /etc/default/login; then
  AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

if test -z "$no_shadows_password_checking"; then
  AC_MSG_CHECKING(for shadow passwords)
  if test -f /etc/shadow; then
    AC_DEFINE(HAVE_ETC_SHADOW)
    AC_MSG_RESULT(/etc/shadow)
  elif test -n "$os_aix"; then
    AC_DEFINE(HAVE_ETC_SECURITY_PASSWD)
    AC_MSG_RESULT(/etc/security/passwd)
  elif test -n "$os_sunos"; then
    AC_DEFINE(HAVE_ETC_SECURITY_PASSWD_ADJUNCT)
    AC_MSG_RESULT(/etc/security/passwd.adjunct)
  else
    AC_MSG_RESULT(no)
  fi
fi

AC_MSG_CHECKING(location of mail spool files)
for dir in /var/spool/mail /var/mail /usr/spool/mail /usr/mail NEWMAIL
do
  if test "$dir" = "NEWMAIL"; then
    AC_DEFINE(HAVE_TILDE_NEWMAIL)
    AC_MSG_RESULT(\$HOME/newmail)
    AC_MSG_WARN(mail spool directory was not found: assuming you use \$HOME/newmail)
  elif test -d $dir; then
    AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIRECTORY, "$dir")
    AC_MSG_RESULT($dir)
    break
  fi
done

AC_MSG_CHECKING(location of utmp)
if test -f /var/run/utmp; then
  AC_DEFINE(SSH_UTMP, "/var/run/utmp")
  AC_MSG_RESULT(/var/run/utmp)
elif test -f /var/log/utmp; then
  AC_DEFINE(SSH_UTMP, "/var/log/utmp")
  AC_MSG_RESULT(/var/log/utmp)
elif test -f /var/adm/utmp; then
  AC_DEFINE(SSH_UTMP, "/var/adm/utmp")
  AC_MSG_RESULT(/var/adm/utmp)
elif test -f /usr/adm/utmp; then
  AC_DEFINE(SSH_UTMP, "/usr/adm/utmp")
  AC_MSG_RESULT(/usr/adm/utmp)
elif test -f /etc/utmp; then
  AC_DEFINE(SSH_UTMP, "/etc/utmp")
  AC_MSG_RESULT(/etc/utmp)
else
  AC_MSG_RESULT(not found)
fi

AC_MSG_CHECKING(location of wtmp)
if test -f /var/log/wtmp; then
  AC_DEFINE(SSH_WTMP, "/var/log/wtmp")
  AC_MSG_RESULT(/var/log/wtmp)
elif test -f /var/adm/wtmp; then
  AC_DEFINE(SSH_WTMP, "/var/adm/wtmp")
  AC_MSG_RESULT(/var/adm/wtmp)
elif test -f /usr/adm/wtmp; then
  AC_DEFINE(SSH_WTMP, "/usr/adm/wtmp")
  AC_MSG_RESULT(/usr/adm/wtmp)
elif test -f /etc/wtmp; then
  AC_DEFINE(SSH_WTMP, "/etc/wtmp")
  AC_MSG_RESULT(/etc/wtmp)
else
  AC_DEFINE(SSH_WTMP, "/var/adm/wtmp")
  AC_MSG_RESULT(not found)
fi

AC_MSG_CHECKING(location of lastlog)
if test -f /var/log/lastlog || test -d /var/log/lastlog; then
  AC_DEFINE(SSH_LASTLOG, "/var/log/lastlog")
  AC_DEFINE(HAVE_LASTLOG)
  LASTLOG=/var/log/lastlog
  AC_MSG_RESULT(/var/log/lastlog)
elif test -f /var/adm/lastlog || test -d /var/adm/lastlog; then
  AC_DEFINE(SSH_LASTLOG, "/var/adm/lastlog")
  AC_DEFINE(HAVE_LASTLOG)
  LASTLOG=/var/adm/lastlog
  AC_MSG_RESULT(/var/adm/lastlog)
elif test -f /usr/adm/lastlog || test -d /usr/adm/lastlog; then
  AC_DEFINE(SSH_LASTLOG, "/usr/adm/lastlog")
  AC_DEFINE(HAVE_LASTLOG)
  LASTLOG=/usr/adm/lastlog
  AC_MSG_RESULT(/usr/adm/lastlog)
elif test -f /etc/lastlog || test -d /etc/lastlog; then
  AC_DEFINE(SSH_LASTLOG, "/etc/lastlog")
  AC_DEFINE(HAVE_LASTLOG)
  LASTLOG=/etc/lastlog
  AC_MSG_RESULT(/etc/lastlog)
else
  AC_MSG_RESULT(not found)
  AC_DEFINE(SSH_LASTLOG, "/var/log/lastlog")
  LASTLOG=/var/log/lastlog
fi

AC_MSG_CHECKING(whether $LASTLOG is a directory)
if test -d $LASTLOG
then
  AC_MSG_RESULT(yes)
  AC_DEFINE(LASTLOG_IS_DIR)
else
  AC_MSG_RESULT(no)
fi

AC_MSG_CHECKING(whether to include the IDEA encryption algorithm)
AC_ARG_WITH(idea,
[  --with-idea             Use IDEA (not default).
  --without-idea          Don't use IDEA: avoids patent problems in commercial use],
[ case "$withval" in
  yes)
    AC_MSG_RESULT(yes)
    CONFOBJS="$CONFOBJS idea.o"
    AC_DEFINE(WITH_IDEA)
    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to include the RC4 encryption algorithm)
AC_ARG_WITH(rc4,
[  --with-rc4          Include RC4 support.
  --without-rc4       Don't include RC4 support (default)],
[ case "$withval" in
  yes)
    AC_MSG_RESULT(yes)
    CONFOBJS="$CONFOBJS rc4.o"
    AC_DEFINE(WITH_RC4)
    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to include the Blowfish encryption algorithm)
AC_ARG_WITH(blowfish,
[  --with-blowfish          Include Blowfish support (default).
  --without-blowfish       Don't include Blowfish support],
[ case "$withval" in
  no)
    ;;
  *)
    with_blowfish=yes
    ;;
  esac ],
  with_blowfish=yes
)

case "$with_blowfish" in
yes)
    AC_DEFINE(WITH_BLOWFISH)
    CONFOBJS="$CONFOBJS bf_skey.o bf_enc.o"
    AC_MSG_RESULT(yes)
    ;;
no)
    AC_MSG_RESULT(no)
    ;;
esac

AC_MSG_CHECKING(whether to use rsaref)
AC_ARG_WITH(rsaref,
[  --with-rsaref           Use RSAREF (try to avoid patent problems in U.S.)
  --without-rsaref        Use normal RSA routines (default). ],
[ case "$withval" in
  no)
       AC_MSG_RESULT(no)
       ;;
  *)
       AC_MSG_RESULT(yes)
       AC_DEFINE(RSAREF)
       RSAREFDEP="rsaref2/source/librsaref.a"
       LIBS="-lrsaref $LIBS"
       LDFLAGS="-Lrsaref2/source $LDFLAGS"
       ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to use ssl)
AC_ARG_WITH(ssl,
[  --with-ssl           Use SSL (try to avoid patent problems in U.S.)
  --without-ssl         Use normal RSA routines (default). ],
[ case "$withval" in
  no)
       AC_MSG_RESULT(no)
       ;;
  *)
       AC_MSG_RESULT(yes)
       AC_DEFINE(DO_SSL)
       LIBS="-lcrypto $LIBS"
       ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to use rsh)
AC_ARG_WITH(rsh, 
[  --with-rsh=PATH         Specify where to find rsh.
  --without-rsh           Do not use rsh under any conditions. ],
[ case "$withval" in
    no) 
        AC_MSG_RESULT(no)
	;;
    yes) 
	 AC_MSG_RESULT(yes)
	 AC_PATH_PROGS(RSH_PATH, remsh rsh)
         AC_DEFINE_UNQUOTED(RSH_PATH, "$RSH_PATH")
	;;
    *) 
       AC_MSG_RESULT($withval)
       AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
       ;;
  esac ],
  [ AC_MSG_RESULT(yes)
    AC_PATH_PROGS(RSH_PATH, remsh rsh)
    AC_DEFINE_UNQUOTED(RSH_PATH, "$RSH_PATH") ]
)

# Code to permit setting default path for users (alden@math.ohio-state.edu)
AC_MSG_CHECKING(default path)
AC_ARG_WITH(path,
[  --with-path=PATH        Default path passed to user shell by sshd.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(use system default)
    ;;
  *)
    AC_MSG_RESULT($withval)
    AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$withval")
    ;;
  esac ],
  AC_MSG_RESULT(use system default)
)

AC_MSG_CHECKING(etcdir)
AC_ARG_WITH(etcdir,
[  --with-etcdir=PATH      Directory containing ssh system files (default /etc).],
[ case "$withval" in
  no)
    AC_MSG_ERROR(Need ETCDIR.)
    ;;
  yes)
    ETCDIR="/etc"
    AC_MSG_RESULT(/etc)
    ;;
  *)
    ETCDIR="$withval"
    AC_MSG_RESULT($withval)
    ;;
  esac ],
  ETCDIR="/etc"
  AC_MSG_RESULT(/etc)
)

AC_MSG_CHECKING(whether to support SecurID)
AC_ARG_WITH(securid,
[  --with-securid[=PATH]   Enable support for Security Dynamics SecurID card.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  yes)
    AC_MSG_RESULT(yes)
    if test '!' -f /usr/ace/sdiclient.a; then
      AC_ERROR(SecurID sdiclient.a not found in /usr/ace: you must supply the path.)
    fi
    AC_MSG_RESULT(yes)
    AC_MSG_RESULT(Assuming SecurID headers and libraries are in /usr/ace.)
    AC_DEFINE(HAVE_SECURID)
    CFLAGS="$CFLAGS -I/usr/ace"
    LIBS="/usr/ace/sdiclient.a $LIBS"
    ;;
  *)
    AC_MSG_RESULT(yes)
    if test '!' -f $withval/sdiclient.a; then
      AC_ERROR(SecurID sdiclient.a not found in $withval: please supply the correct path.)
    fi
    AC_MSG_RESULT(Assuming SecurID headers and libraries are in $withval.)
    AC_DEFINE(HAVE_SECURID)
    CFLAGS="$CFLAGS -I$withval"
    LIBS="$withval/sdiclient.a $LIBS"
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to include compression support)
AC_ARG_WITH(zlib,
[  --with-zlib            Use zlib (default).
  --without-zlib          Don't use zlib.],
[ case "$withval" in
  no)
    ;;
  *)
    with_zlib=yes
    ;;
  esac ],
  with_zlib=yes
)

case "$with_zlib" in
yes)
    AC_MSG_RESULT(yes)
    AC_CHECK_HEADERS(zlib.h)
    if test "$ac_cv_header_zlib_h" != yes; then
      echo "Can't find zlib.h, disable with --without-zlib"
      exit 1
    fi
    AC_CHECK_LIB(z, main)
    if test "$ac_cv_lib_z_main" != yes; then
      echo "Can't find library z (libz.a), disable with --without-zlib"
      exit 1
    fi
    CONFOBJS="$CONFOBJS compress.o"
    AC_DEFINE(WITH_ZLIB)
    ;;
no)
    AC_MSG_RESULT(no)
    ;;
esac

AC_MSG_CHECKING(whether to use Kerberos v4)
AC_ARG_WITH(krb4,
[  --with-krb4[=PATH]      Compile in Kerberos v4 support.],
[ case "$withval" in
  yes)
    ;;
  no)
    ;;
  *)
    ;;
  esac ],
[ with_krb4=default ]
)
# krb4 continued
case "$with_krb4" in
no)
  AC_MSG_RESULT(no)
  ;;
yes)
  AC_MSG_RESULT(yes)
  AC_CHECK_HEADERS(krb.h)
  if test "$ac_cv_header_krb_h" != yes; then
    echo "Can't find include file krb.h! Aborting!"
    exit 1
  fi
  AC_CHECK_LIB(krb, main)
  if test "$ac_cv_lib_krb_main" != yes; then
    echo "Can't find library krb (libkrb.a)! Aborting"
    exit 1
  fi
  AC_DEFINE(KRB4)
  KRB4_AUTH="auth-krb4.o"
  KRB4_ROOT=""
  KRB4_INCS=""
  KRB4_LIBS="-lkrb -ldes"
  AC_CHECK_LIB(resolv, dn_expand, KRB4_LIBS="$KRB4_LIBS -lresolv")
  ;;
default)
  AC_CHECK_HEADERS(krb.h)
  AC_CHECK_LIB(krb, main)
  if test "$ac_cv_header_krb_h" = yes -a "$ac_cv_lib_krb_main" = yes; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(KRB4)
    KRB4_AUTH="auth-krb4.o"
    KRB4_ROOT=""
    KRB4_INCS=""
    KRB4_LIBS="-lkrb -ldes"
    AC_CHECK_LIB(resolv, dn_expand, KRB4_LIBS="$KRB4_LIBS -lresolv")
  else
    AC_MSG_RESULT(no)
  fi
  ;;
*)
  AC_MSG_RESULT(yes)
  AC_DEFINE(KRB4)
  KRB4_AUTH="auth-krb4.o"
  KRB4_ROOT="$with_krb4"
  KRB4_INCS="-I\$(KRB4_ROOT)/include"
  KRB4_LIBS="-L\$(KRB4_ROOT)/lib -lkrb -ldes"
  AC_CHECK_LIB(resolv, dn_expand, KRB4_LIBS="$KRB4_LIBS -lresolv")
  ;;
esac
AC_SUBST(KRB4_AUTH) dnl
AC_SUBST(KRB4_ROOT) dnl
AC_SUBST(KRB4_INCS) dnl
AC_SUBST(KRB4_LIBS) dnl

AC_MSG_CHECKING(whether to use AFS)
AC_ARG_WITH(afs,
[  --with-afs              Compile in AFS support (requires KTH krb4).],
if test "$with_afs" = no; then
      AC_MSG_RESULT(no)
    else
      AC_MSG_RESULT(yes)
  AC_DEFINE(AFS)
  AC_DEFINE(KERBEROS_TGT_PASSING)
  RADIX="radix.o"
  if test "$with_krb4" = no; then
    AC_MSG_RESULT(no)
    AC_MSG_WARN("AFS requires Kerberos v4 support.")
  else
    KRB4_LIBS="${KRB4_LIBS} -lkafs"
    if test -n "$os_aix"; then
      KRB4_LIBS="${KRB4_LIBS} -lld"
    fi
  fi
fi
)
AC_SUBST(RADIX)dnl

AC_MSG_CHECKING(whether to use libwrap)
AC_ARG_WITH(libwrap,
[  --with-libwrap[=PATH]   Compile in libwrap (tcp_wrappers) support.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  yes)
    AC_MSG_RESULT(yes)
    AC_DEFINE(LIBWRAP)
    LIBS="-lwrap $LIBS"
    AC_TRY_LINK([ int allow_severity; int deny_severity; ],
                [ hosts_access(); ],
		[],
		[ AC_MSG_ERROR(Could not find the libwrap.a library.  You must first install tcp_wrappers.) ])
    ;;
  *)
    AC_MSG_RESULT(yes)
    AC_DEFINE(LIBWRAP)
    LIBS="$withval $LIBS"
    AC_TRY_LINK([ int allow_severity; int deny_severity; ],
                [ hosts_access(); ],
		[],
		[ AC_MSG_ERROR(Could not find the $withval library.  You must first install tcp_wrappers.) ])
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to support SOCKS)
AC_ARG_WITH(socks,
[  --with-socks[=PATH]     Compile with SOCKS firewall traversal support.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  *)
    AC_MSG_RESULT(yes)
    AC_DEFINE(SOCKS)
    AC_DEFINE(connect, Rconnect)
    AC_DEFINE(getsockname, Rgetsockname)
    AC_DEFINE(bind, Rbind)
    AC_DEFINE(accept, Raccept)
    AC_DEFINE(listen, Rlisten)
    AC_DEFINE(select, Rselect)
    if test "x$withval" = "xyes"; then
      withval="-lsocks"
    fi
    LIBS="$withval $LIBS"
    AC_TRY_LINK([],
                [ Rconnect(); ],
		[],
		[ AC_MSG_ERROR(Could not find the $withval library.  You must first install socks.) ])
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

PIDDIR="/var/run"
AC_MSG_CHECKING(where to put sshd.pid)
if test '!' -d $PIDDIR; then
  PIDDIR="$ETCDIR"
fi
AC_MSG_RESULT($PIDDIR)

AC_ARG_PROGRAM

AC_SUBST(ETCDIR)
AC_SUBST(PIDDIR)
AC_SUBST(RSAREFDEP)
AC_SUBST(CONFOBJS)

AC_OUTPUT(Makefile sshd.8 ssh.1)