AC_INIT(ssh.c)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_CHECK_PROG(AR, ar, ar)
AC_PATH_PROG(PERL, perl)
AC_SUBST(PERL)
AC_PATH_PROG(ENT, ent)
AC_SUBST(ENT)
if test -z "$LD" ; then
LD=$CC
fi
AC_SUBST(LD)
# C Compiler features
AC_C_INLINE
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall"
fi
# Check for some target-specific stuff
case "$host" in
*-*-aix*)
AFS_LIBS="-lld"
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
if (test "$LD" != "gcc" && test -z "$blibpath"); then
blibpath="/usr/lib:/lib:/usr/local/lib"
fi
AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
AC_DEFINE(BROKEN_GETADDRINFO)
MANTYPE='$(CATMAN)'
mansubdir=cat
dnl AIX handles lastlog as part of its login message
AC_DEFINE(DISABLE_LASTLOG)
;;
*-*-hpux10*)
if test -z "$GCC"; then
CFLAGS="$CFLAGS -Ae"
fi
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
AC_DEFINE(IPADDR_IN_DISPLAY)
AC_MSG_CHECKING(for HPUX trusted system password database)
if test -f /tcb/files/auth/system/default; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
LIBS="$LIBS -lsec"
AC_MSG_WARN([This configuration is untested])
else
AC_MSG_RESULT(no)
AC_DEFINE(DISABLE_SHADOW)
fi
MANTYPE='$(CATMAN)'
mansubdir=cat
;;
*-*-hpux11*)
if test -z "$GCC"; then
CFLAGS="$CFLAGS -Ae"
fi
CFLAGS="$CFLAGS -D_HPUX_SOURCE"
AC_DEFINE(IPADDR_IN_DISPLAY)
AC_MSG_CHECKING(for HPUX trusted system password database)
if test -f /tcb/files/auth/system/default; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
LIBS="$LIBS -lsec"
AC_MSG_WARN([This configuration is untested])
else
AC_MSG_RESULT(no)
AC_DEFINE(DISABLE_SHADOW)
fi
MANTYPE='$(CATMAN)'
mansubdir=cat
;;
*-*-irix5*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS"
MANTYPE='$(CATMAN)'
no_libsocket=1
no_libnsl=1
;;
*-*-irix6*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS"
MANTYPE='$(CATMAN)'
AC_DEFINE(WITH_IRIX_ARRAY)
AC_DEFINE(WITH_IRIX_PROJECT)
AC_DEFINE(WITH_IRIX_AUDIT)
no_libsocket=1
no_libnsl=1
;;
*-*-linux*)
no_dev_ptmx=1
AC_DEFINE(DONT_TRY_OTHER_AF)
inet6_default_4in6=yes
;;
*-*-netbsd*)
need_dash_r=1
;;
*-next-*)
# hardwire lastlog location (can't detect it on some versions)
conf_lastlog_location="/usr/adm/lastlog"
AC_DEFINE(HAVE_NEXT)
CFLAGS="$CFLAGS -I/usr/local/include"
MAIL=/usr/spool/mail
conf_utmp_location=/etc/utmp
AC_MSG_WARN([*** Tested: PA-RISC/m68k Untested: Sparc/Intel])
AC_MSG_WARN([*** Expect 'scp' to fail!])
AC_MSG_WARN([*** Please report any problems, thanks])
;;
*-*-solaris*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
need_dash_r=1
# hardwire lastlog location (can't detect it on some versions)
conf_lastlog_location="/var/adm/lastlog"
AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
if test "$sol2ver" -ge 8; then
AC_MSG_RESULT(yes)
AC_DEFINE(DISABLE_UTMP)
AC_DEFINE(DISABLE_WTMP)
else
AC_MSG_RESULT(no)
fi
;;
*-*-sunos4*)
CFLAGS="$CFLAGS -DSUNOS4"
AC_CHECK_FUNCS(getpwanam)
;;
*-*-sysv*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
MANTYPE='$(CATMAN)'
mansubdir=cat
LIBS="$LIBS -lgen -lsocket"
;;
*-*-sco3*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
MANTYPE='$(CATMAN)'
mansubdir=cat
LIBS="$LIBS -lgen -lsocket"
no_dev_ptmx=1
;;
*-dec-osf*)
# This is untested
if test ! -z "USE_SIA" ; then
AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
if test -f /etc/sia/matrix.conf; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_OSF_SIA)
AC_DEFINE(DISABLE_LOGIN)
LIBS="$LIBS -lsecurity -ldb -lm -laud"
else
AC_MSG_RESULT(no)
fi
fi
;;
esac
# Allow user to specify flags
AC_ARG_WITH(cflags,
[ --with-cflags Specify additional flags to pass to compiler],
[
if test "x$withval" != "xno" ; then
CFLAGS="$CFLAGS $withval"
fi
]
)
AC_ARG_WITH(ldflags,
[ --with-ldlags Specify additional flags to pass to linker],
[
if test "x$withval" != "xno" ; then
LDFLAGS="$LDFLAGS $withval"
fi
]
)
AC_ARG_WITH(libs,
[ --with-libs Specify additional libraries to link with],
[
if test "x$withval" != "xno" ; then
LIBS="$LIBS $withval"
fi
]
)
# Checks for libraries.
AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
if test -z "$no_libsocket" ; then
AC_CHECK_LIB(nsl, yp_match, , )
fi
if test -z "$no_libnsl" ; then
AC_CHECK_LIB(socket, main, , )
fi
# Checks for header files.
AC_CHECK_HEADERS(bstring.h endian.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h util.h utmp.h utmpx.h)
# Checks for library functions.
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy vsnprintf vhangup _getpty __b64_ntop)
dnl checks for time functions
AC_CHECK_FUNCS(gettimeofday time)
dnl checks for libutil functions
AC_CHECK_FUNCS(login logout updwtmp logwtmp)
dnl checks for utmp functions
AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
AC_CHECK_FUNCS(utmpname)
dnl checks for utmpx functions
AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
AC_CHECK_FUNCS(setutxent utmpxname)
AC_CHECK_FUNC(login,
[AC_DEFINE(HAVE_LOGIN)],
[AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
)
AC_CHECK_FUNC(daemon,
[AC_DEFINE(HAVE_DAEMON)],
[AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
)
AC_CHECK_FUNC(getpagesize,
[AC_DEFINE(HAVE_GETPAGESIZE)],
[AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
)
PAM_MSG="no"
AC_ARG_WITH(pam,
[ --without-pam Disable PAM support ],
[
if test "x$withval" = "xno" ; then
no_pam=1
AC_DEFINE(DISABLE_PAM)
PAM_MSG="disabled"
fi
]
)
if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
AC_CHECK_LIB(dl, dlopen, , )
LIBS="$LIBS -lpam"
AC_CHECK_FUNCS(pam_getenvlist)
disable_shadow=yes
PAM_MSG="yes"
# Check PAM strerror arguments (old PAM)
AC_MSG_CHECKING([whether pam_strerror takes only one argument])
AC_TRY_COMPILE(
[
#include <stdlib.h>
#include <security/pam_appl.h>
],
[(void)pam_strerror((pam_handle_t *)NULL, -1);],
[AC_MSG_RESULT(no)],
[
AC_DEFINE(HAVE_OLD_PAM)
AC_MSG_RESULT(yes)
PAM_MSG="yes (old library)"
]
)
fi
# The big search for OpenSSL
AC_ARG_WITH(ssl-dir,
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
[
if test "x$withval" != "$xno" ; then
tryssldir=$withval
fi
]
)
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
if test "x$prefix" != "xNONE" ; then
tryssldir="$tryssldir $prefix"
fi
AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
for s