# THIS FILE WAS AUTOMAGICALLY GENERATED FROM FRAGMENTS. 
# You should edit the fragments instead of editing this file. 

#
# configure.head - first fragment of top-level configure.in
#
# Author: Tatu Ylonen <ylo@ssh.fi>
#
# Copyright (c) 1997-2000 SSH Communications Security, Finland
#                    All rights reserved
#

AC_INIT(lib/sshutil/sshcore/sshbuffer.c)
AC_PREREQ(2.10)

# Check that all files in MANIFEST exist (if MANIFEST exists, of course :-)
if test -f $srcdir/MANIFEST
then
  AC_MSG_CHECKING(distribution consistency)
  cat $srcdir/MANIFEST | while read afile
  do
    if test ! -f $srcdir/$afile
    then
      AC_MSG_WARN(file $afile missing from distribution)
    fi
  done
  AC_MSG_RESULT(done)
fi

AM_CONFIG_HEADER(sshconf.h)

AC_CANONICAL_SYSTEM
AC_MSG_CHECKING(cached information)
hostcheck="$target"
AC_CACHE_VAL(ac_cv_hostcheck, [ ac_cv_hostcheck="$hostcheck" ])
if test "$ac_cv_hostcheck" != "$hostcheck"; then
  AC_MSG_RESULT(changed)
  AC_MSG_WARN(config.cache from a different target platform already exists!)
  AC_MSG_ERROR(you must do 'make distclean' first to compile for different host or different parameters.)
else
  AC_MSG_RESULT(ok)
fi

AM_INIT_AUTOMAKE(sshtree,1.0)

# Compilation environment requires automake to be at least 1.4
if test "x$AUTOMAKE" = "xautomake"
then
  if ($AUTOMAKE --version | egrep 'automake.* 1\.[[456789]]') 2>/dev/null >/dev/null
  then
    :
  else
    AC_MSG_WARN(automake is not (at least) version 1.4, not using automake)
    AUTOMAKE="$missing_dir/missing automake"
  fi
fi

# Compilation environment requires autoconf to be at least 2.13
if test "x$AUTOCONF" = "xautoconf"
then
  # this should match any 2.2* (2.3* etc..) and 2.1x where x >= 3.
  if ($AUTOCONF --version | egrep 'Autoconf version.* [[23456789]]\.([[23456789]]|1[[3456789]])') 2>/dev/null >/dev/null
  then
    :
  else
    AC_MSG_WARN(autoconf is not (at least) version 2.13, not using autoconf)
    AUTOCONF="$missing_dir/missing autoconf"
  fi
fi

# XXX temporarily force no optimization unless explicitly requested to
# ease debugging.
if test '!' -n "$CFLAGS"; then
  CFLAGS="-g"
fi


AC_MSG_CHECKING("using purify")

AC_ARG_WITH(purify,
[  --with-purify=PURIFY    Use purify (default --without-purify) ],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  *)
    AC_MSG_RESULT($withval)
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

# Cross compling support //teiste
AC_CHECK_PROGS(BUILD_CC, gcc cc)
if test "$host_alias" != "$target_alias"; then
  AC_CHECK_PROGS(CC, ${target_alias}-gcc ${target_alias}-cc)
  AC_CHECK_PROGS(RANLIB, ${target_alias}-ranlib)
  AC_CHECK_PROGS(AR, ${target_alias}-ar)
  AC_CHECK_PROGS(LD, ${target_alias}-ld)
fi

AC_PROG_CC
AC_CHECK_TOOL(LD, ld)

# Automake seems to want this if there are any .cpp files in the tree...
# No, it does not need it, commented out, because on some environments we
# do not have C++ compiler at all //kivinen
# AC_PROG_CXX

AC_MSG_CHECKING(whether to enable optimizations)
AC_ARG_ENABLE(compiler-optimizations,
[  --disable-compiler-optimizations   
                          Disable optimization of the binaries],
[ case "$enableval" in
  yes)
    AC_MSG_RESULT(yes)
    compiler_optimizations=yes
    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac], 
[ AC_MSG_RESULT(yes)
  compiler_optimizations=yes])

AC_ISC_POSIX

case "$target" in
  alpha*-dec-osf*)
    # If we are not using gcc, we want the ansi version of cc.
    if test -z "$GCC"; then
      AC_TRY_ADD_CFLAGS(-std1)
      AC_TRY_ADD_CFLAGS(-warnprotos)
      AC_TRY_ADD_CFLAGS(-msg_disable longdoublenyi)
    fi
    CFLAGS="$CFLAGS -D_OSF_SOURCE"
    CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
    CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
    ;;
  *-dec-ultrix*)
    no_termios=yes
    ;;
  *-*-nextstep*)
    no_termios=yes
    ;;
  *-*-linux*|*-*-mklinux*)
    CFLAGS="-D_GNU_SOURCE $CFLAGS"
    ;;
  *-*-hpux*)
    # HPUX flags from jgotts@engin.umich.edu
    if test -z "$GCC"; then
      AC_TRY_ADD_CFLAGS(-Ae)
      CFLAGS="$CFLAGS -D_HPUX_SOURCE"
    fi
    AC_DEFINE(HPSUX_NONSTANDARD_X11_KLUDGE)
    ;;
  *-ibm-aix*)
    # If we are not using gcc, we want the ansi version of cc.
    if test -z "$GCC"; then
      AC_TRY_ADD_CFLAGS(-qlanglvl=ansi)
    fi
    ;;
  *)
    ;;
esac

dnl If we are supposed to optimize binaries, check which compiler flags to use
dnl (we also generally still want to have the debugging info)

if test -n "$compiler_optimizations"; then
  if test "$ac_cv_prog_gcc" = "yes"; then
    AC_TRY_ADD_CFLAGS(-O2)
  else
    case "$target" in
      alpha*-dec-osf*)
  	AC_TRY_ADD_CFLAGS(-g3 -O2, 
  	  AC_TRY_ADD_CFLAGS(-g3 -O,
  	    AC_TRY_ADD_CFLAGS(-O)))
  	;;
      *-*-hpux*)
	# optimization doesn't seem to work at HP-UX cc at all.
        AC_MSG_WARN([optimizations are disabled with HP-UX cc])
        ;;
      *)
  	AC_TRY_ADD_CFLAGS(-O2, AC_TRY_ADD_CFLAGS(-O))
  	;;
    esac
  fi
fi

########################################################################
# Check whether we use 32/64 bit addressing -- this is very dependend
# on hardware and compiler support.

# First, determine the default addressing mode: 32 or 64. By default,
# try 32 (unless overridden by configuration option).

DEFAULT_ADDR_MODEL=ilp32

AC_MSG_CHECKING("memory addressing model")

case "$target" in
  # On sparc machines with solaris 2.7 check for sun4u, in which case
  # we use lp64

  sparc-*-solaris2.7|sparc-*-solaris2.8)
	   if test "`uname -m`" = "sun4u"; then
	     DEFAULT_ADDR_MODEL=lp64
	   fi
	   ;;
esac

ADDR_MODEL=${ADDR_MODEL:-$DEFAULT_ADDR_MODEL}

AC_ARG_WITH(addr-model,
[  --with-addr-model[=NAME]   Memory addressing model to use (ilp32,lp64).],
[ case "$withval" in
  lp64|LP64)
    AC_MSG_RESULT(lp64)
    ADDR_MODEL=lp64
    ;;
  ilp32|ILP32)
    AC_MSG_RESULT(ilp32)
    ADDR_MODEL=ilp32
    ;;
  *)
    AC_MSG_RESULT($ADDR_MODEL)
  esac ],
  AC_MSG_RESULT($ADDR_MODEL)
)

AC_SUBST(ADDR_MODEL)

########################################################################
# Now that we know what addressing model to use (ilp32, lp64) we must
# determine what we should do with the compiler and its flags.
#
# As usual, it's GCC boobytrap mode from here on..

AC_MSG_CHECKING(additional compiler flags)

if test "$ac_cv_prog_gcc" = "yes"; then
    case "$target/$ADDR_MODEL" in
	sparc-*/lp64)
	    KERN_CFLAGS="$KERN_CFLAGS -m64"
	    ;;
	sparc-*/ilp32)
	    KERN_CFLAGS="$KERN_CFLAGS -m32"
	    ;;
	*)
	    ;;
    esac
else
    # If we are not compiling under GCC, we make the simple assumption that
    # we are using the platforms "default" compiler. For example under
    # Solaris this means SparcWorkds C compiler.

    case "$target/$ADDR_MODEL" in
	sparc-*/lp64)
 	    KERN_CFLAGS="$KERN_CFLAGS -xarch=v9 -xcode=abs32"
	    KERN_LDFLAGS="$KERN_LDFLAGS"
	    ;;
	sparc-*/ilp32)
	    KERN_CFLAGS="$KERN_CFLAGS -xarch=v8 -xcode=abs32"
	    KERN_LDFLAGS="$KERN_CFLAGS"
	    ;;
    esac
fi

AC_MSG_RESULT(done)

########################################################################

AC_ADD_GCC_CFLAGS([-Wall])

if test "$ac_cv_prog_gcc" = "yes"; then
  AC_TRY_ADD_CFLAGS(-Wno-unknown-pragmas)
fi

AC_MSG_CHECKING(whether to enable verbose warnings)
AC_ARG_ENABLE(verbose-warnings,
[  --enable-verbose-warnings
                          Enable verbose compiler warnings.],
[ case "$enableval" in
  yes)
    AC_MSG_RESULT(yes)

    AC_ADD_GCC_CFLAGS([-W])
    AC_ADD_GCC_CFLAGS([-Wshadow -Wpointer-arith -Wbad-function-cast])
    AC_ADD_GCC_CFLAGS([-Wcast-align -Wwrite-strings -Waggregate-return])
    AC_ADD_GCC_CFLAGS([-Wmissing-prototypes -Wstrict-prototypes])

    # Disabled because we use long long
    # AC_ADD_GCC_CFLAGS([-pedantic])

    # Disabled because lots of system headers break on this (errno.h)
    # AC_ADD_GCC_CFLAGS([-Wredundant-decls])

    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac ], AC_MSG_RESULT(no)
)

AC_PROG_RANLIB
AC_CHECK_TOOL(AR, ar)
AC_CHECK_PROGS(M4, gm4 m4, m4)
AC_PROG_MAKE_SET
AC_PROG_INSTALL


AC_ARG_PROGRAM

AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT

AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
AC_TYPE_MODE_T

# Check sizes of various basic types, first for usemode compilation.
AC_CHECK_SIZEOF_WITH_PREFIX(usermode,long,4)
AC_CHECK_SIZEOF_WITH_PREFIX(usermode,int,4)
AC_CHECK_SIZEOF_WITH_PREFIX(usermode,short,2)
AC_CHECK_SIZEOF_WITH_PREFIX(usermode,long long,8)

AC_CHECK_FUNCS(getenv geteuid localtime nanosleep sleep)

AC_C_CONST
AC_C_INLINE
AC_SSH_BIGENDIAN

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

AC_MSG_CHECKING(whether to enable light debugging)
debug_light_defined=yes
AC_ARG_ENABLE(debug,
[  --disable-debug         Disable light debugging.],
[ case "$enableval" in
  no)
    AC_MSG_RESULT(no)
    debug_light_defined=no
    ;;
  *)
    AC_MSG_RESULT(yes)
    ;;
  esac ], AC_MSG_RESULT(yes))
if test "X$debug_light_defined" = "Xyes"; then
  AC_DEFINE(DEBUG_LIGHT)
fi

AC_MSG_CHECKING(whether to enable heavy debugging)
AC_ARG_ENABLE(debug-heavy,
[  --enable-debug-heavy    Enable heavy debugging.],
[ case "$enableval" in
  yes)
    AC_MSG_RESULT(yes)
    AC_DEFINE(DEBUG_HEAVY)
    if test "$debug_light_defined" = "no"; then
      AC_DEFINE(DEBUG_LIGHT)
    fi
    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac ], AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether to enable EFENCE memory allocation debugger)
AC_ARG_ENABLE(efence,
[  --enable-efence         Enable EFENCE memory allocation debugger.],
[ case "$enableval" in
  yes)
    AC_MSG_RESULT(yes)
    AC_DEFINE(EFENCE)
    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac ], AC_MSG_RESULT(no)
)

  enable_asm=no

COPY_INCLUDE='$(top_srcdir)/copy_include'
AC_SUBST(COPY_INCLUDE)
AC_SUBST(LIBS)

export CC CFLAGS
AC_CONFIG_SUBDIRS(lib/trq)
# /m/torni/home/u/sjl/ssh_2_2_branch/src/./apps/ssh/configure.in.inc 

#
# configure.in.inc for apps/ssh
#
# Author: Tatu Ylonen <ylo@ssh.com>
#
# Copyright (c) 1997 SSH Communications Security, Finland
#                    All rights reserved
#
# configure.in fragment for the ssh2 application.
#

AC_DEFINE_UNQUOTED(HOSTTYPE, "$host")

# Platform-specific stuff.
case "$host" in
  *-*-sunos*|*-*-solaris*)
    os_sunos=yes
    # For xauth
    PATH="$PATH:/usr/openwin/bin"
    ;;
  *-sgi-irix5*)
    # Irix stuff from snabb@niksula.hut.fi, tsurmacz@asic.ict.pwr.wroc.pl,
    # C.Martin@sheffield.ac.uk, raistlin@uni-paderborn.de
    no_libsocket=yes
    no_libsun=yes
    no_libnsl=yes
    ;;
  *-sgi-irix6*)
    # from d-champion@uchicago.edu
    no_libsocket=yes
    no_libnsl=yes
    no_libsun=yes
    if test -z "$GCC";then
        if test "`uname -s`" = "IRIX64"; then
            CFLAGS="-n32 -D_LONG_LONG_LIMB $CFLAGS"
            LDFLAGS="-n32 $LDFLAGS"
        else
            CFLAGS="-n32 $CFLAGS"
            LDFLAGS="-n32 $LDFLAGS"
        fi
    fi
    ;;
  *-ibm-aix*)
    os_aix=yes
    ;;
  *-dec-ultrix*)
    # Ultrix stuff from dmckilli@qc.bell.ca, jbotz@orixa.mtholyoke.edu,
    # corey@cac.washington.edu
    AC_TRY_COMPILE([#include <syslog.h>],
		   [int foo = LOG_DAEMON; ],
		   ,
		   AC_DEFINE(NEED_SYS_SYSLOG_H))
    ;;
  *-*-nextstep*)
    # Nextstep support from a person who wants to remain anonymous
    no_termios=yes
    ;;
  i*86-*-bsdi2.1*)
    no_pipe=yes
    LIBS="$LIBS -lipc"
    ;;
  i*86-*-bsdi*)
    no_pipe=yes
    ;;
  m68k-apple-aux*)
    # Macintosh A/UX tweaks - prune LIB = -L/usr/local/lib, exceeds ld capacity
    #   add -lposix to it, needed for termio stuff
    LIBS="-lposix"
    AC_DEFINE(_POSIX_SOURCE)
    ;;
  *-*-sysv4*)
    AC_CHECK_LIB(gen, openlog)
    ;;
  i*86-*-sco3.2v4*)
    # From moi@dio.com
    AC_DEFINE(SCO)
    no_ranlib=yes
    CFLAGS="$CFLAGS -UM_I86SM"
    ;;
  i*86-*-sco3.2v5*)
    # From brian@ilinx.com
    AC_DEFINE(SCO)
    AC_DEFINE(SCO5)
    no_ranlib=yes
    CFLAGS="$CFLAGS -UM_I86SM"
    ;;
  *)
    ;;
esac

export CFLAGS CC

if test -z "$no_libnsl"; then
  AC_CHECK_LIB(nsl, main)
fi
if test -z "$no_libsocket"; then
  AC_CHECK_LIB(socket, socket)
fi

AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(lastlog.h utmp.h shadow.h)
AC_CHECK_HEADERS(sys/select.h sys/ioctl.h)
AC_CHECK_HEADERS(utime.h ulimit.h sys/resource.h netdb.h netgroup.h)

AC_CHECK_LIB(bsd, bcopy)

AC_CHECK_FUNCS(gettimeofday times getrusage ftruncate)
AC_CHECK_FUNCS(strchr memcpy clock fchmod ulimit umask)
AC_CHECK_FUNCS(waitpid)

AC_PATH_XTRA

AC_PROG_LN_S
AC_SUBST(LN_S)

if test "$no_x" = yes; then
  CONFPROGRAMS=""
  AC_DEFINE(DISABLE_X11_FORWARDING)
else
  AC_PATH_PROG(XAUTH_PATH, xauth)
  if test -n "$XAUTH_PATH"; then
    AC_DEFINE_UNQUOTED(XAUTH_PATH, "$XAUTH_PATH")
  fi
  if test "x$XAUTH_PATH" = "x"; then
    AC_MSG_ERROR(configuring with X but xauth not found - aborting, make sure xauth is in your path or add --without-x to configure to disable X11)
  fi
  CONFPROGRAMS="ssh-askpass2"
fi

# Try to determine the directory name for unix-domain X11 sockets
if test '!' -d /tmp/.X11-unix; then
  if test -d /var/X/.X11-unix; then
    X11_DIR='"/var/X/.X11-unix"'
    AC_SUBST(X11_DIR)
  else
    if test -d /tmp/.X11-pipe; then
      X11_DIR='"/tmp/.X11-pipe"'
      AC_SUBST(X11_DIR)
    fi
  fi
fi

static_flag=
static_builds_are_default=
STATIC_FLAG=
# Check if we want static builds of ssh-dummy-shell and sftp-server
AC_MSG_CHECKING(whether to build static binaries of ssh-dummy-shell and sftp-server)
AC_ARG_ENABLE(static,
[  --enable-static[=flag]  Enable static building [with <flag>] (default no)
                          (flags by default autodetected if yes)],
[ case "$enableval" in
  yes)
    static_flag="yes"
    ;;
  no)
    static_flag="no"
    ;;
  *)
    if test "x$enableval" = "x";then
      static_flag=" "
      static_builds_are_default="yes"
    else
      static_flag="$enableval"
    fi
    ;;
  esac],
  static_flag="no")

if test "x$static_flag" = "xyes"; then
  if test "$ac_cv_prog_gcc" = "yes"; then
    # We are using gcc
    case "$host" in
    *-*-sunos*|*-*-solaris*|*-*-hpux*|*-*-aix*)
      static_flag=
      ;;
    *)
      static_flag="-static"
      ;;
    esac
  else
    # We are (presumably) using the platforms default compiler
    case "$host" in
    alpha*-dec-osf*)
      static_flag="-non_shared"
      ;;
# static compilation of binaries doesn't work on HP-UX
#    *-*-hpux*)
#      static_flag="-noshared"
#      ;;
# static compilation of binaries doesn't work on Solaris
#    *-*-sunos*|*-*-solaris*)
#      static_flag="-B static"
#      ;;
    *-*-darwin*)
      static_flag="-static"
      ;;
    *)
    # Couldn't autodetect
      static_flag=
    ;;
    esac
  fi
fi

if test "x$static_flag" != "x"; then
  if test "x$static_builds_are_default" != "x"; then
    static_flag=
    echo "static default"
  fi
  #test if it works
  LDFLAGS_store="$LDFLAGS"
  LDFLAGS="$LDFLAGS $static_flag"
  AC_TRY_LINK(,,
              [STATIC_FLAG="$static_flag"
               static_builds="yes"
               AC_MSG_RESULT(yes [("$STATIC_FLAG")])],
              [AC_MSG_RESULT(no)
               static_builds="no"])
  LDFLAGS="$LDFLAGS_store"
  unset LDFLAGS_store
  if test "x$static_builds" = "xyes"; then
    CONFPROGRAMS="$CONFPROGRAMS ssh-dummy-shell.static sftp-server2.static"
    AC_SUBST(STATIC_FLAG)
  fi
else
  AC_MSG_RESULT(no)
fi
unset static_flag
unset static_builds_are_default

AC_SUBST(CONFPROGRAMS)

AC_MSG_CHECKING(whether to support SecurID)
AC_ARG_WITH(securid,
[  --with-securid[=PATH]   Enable support for Security Dynamics SecurID card.
                          (SecurID support not yet implemented.)],
[ 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 support TIS authentication server)
AC_ARG_WITH(tis,
[  --with-tis[=DIR]        Enable support for TIS authentication server.
                          (TIS support not yet implemented.)],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  *)
    AC_MSG_RESULT(yes)
    if test '!' -f $withval/libauth.a -a -f $withval/libfwall.a -a -f $withval/firewall.h; then
      AC_ERROR(TIS libauth.a or libfwall.a or firewall.h not found in $withval: please supply the correct path.)
    fi
    AC_MSG_RESULT(Assuming TIS headers and libraries are in $withval.)
    AC_DEFINE(HAVE_TIS)
    CFLAGS="$CFLAGS -I$withval -DHAVE_TIS"
    LIBS="-L$withval -lauth -lfwall $LIBS"
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

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_CHECK_LIB(wrap, request_init, 
                 [ AC_DEFINE(LIBWRAP)
                   LIBS="-lwrap $LIBS"
                   AC_DEFINE(HAVE_LIBWRAP)],
                 [ AC_MSG_ERROR(Could not find libwrap library. You have to install tcp-wrappers before using --with-libwrap option to configure.) ])
    ;;
  *)
    if test -d "$withval"; then
        LIBS="-L$withval -lwrap $LIBS"
        CFLAGS="-I$withval $CFLAGS"
    else
        LIBS="$withval $LIBS"
	changequote(<<, >>)dnl
	tcpd_path="`echo $withval | sed -e 's@\(.*\)/[^/]*@\1@'`"
	changequote([, ])dnl
        CFLAGS="-I$tcpd_path $CFLAGS"
    fi
    AC_TRY_LINK([ int allow_severity; int deny_severity; ],
                [ hosts_access(); ],
		[ AC_MSG_RESULT($withval) 
                  AC_DEFINE(LIBWRAP)
                  AC_DEFINE(HAVE_LIBWRAP) ],
		[ AC_MSG_ERROR(Could not find the $withval library. Did you specify a valid path?) ])
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

# This allows group writeability in userfile_check_owner_permissions()
AC_MSG_CHECKING(whether to allow group writeability)
AC_ARG_ENABLE(group-writeability,
  [  --enable-group-writeability
                          Allow group writeability in hostbased-
                          and pubkey-authentication. ],
  [ AC_MSG_RESULT(yes)
    AC_DEFINE(ALLOW_GROUP_WRITEABILITY) ],
  [ AC_MSG_RESULT(no) ]
)

# Check ssh1 compatibility
AC_PATH_PROG(SSH1_PATH, ssh1, no-ssh1)
AC_MSG_CHECKING(for compatible ssh1)
if test "$SSH1_PATH" = "no-ssh1"; then
  AC_MSG_RESULT(no ssh1 installed- COMPATIBILITY DISABLED)
else
  AC_MSG_RESULT(yes)
  AC_DEFINE(SSH1_COMPATIBILITY)
  SSHD1_PATH=`echo $SSH1_PATH | sed 's@/bin/ssh1$@/sbin/sshd1@'`
  SCP1_PATH=`echo $SSH1_PATH | sed 's@/bin/ssh1$@/bin/scp1@'`
  AC_DEFINE_UNQUOTED(SSH1_PATH, "$SSH1_PATH")
  AC_DEFINE_UNQUOTED(SSHD1_PATH, "$SSHD1_PATH")
  AC_DEFINE_UNQUOTED(SCP1_PATH, "$SCP1_PATH")
fi

auths_hostbased_includes="#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
#endif /* HAVE_LIBUTIL_H */

#ifdef HAVE_TERMIOS_H
#include <termios.h>
#define USING_TERMIOS
#endif /* HAVE_TERMIOS_H */

#ifdef HAVE_SYS_TERMIOS_H
#include <sys/termios.h>
#define USING_TERMIOS
#endif /* HAVE_SYS_TERMIOS_H */

#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif /* HAVE_SYS_IOCTL_H */

#if defined(HAVE_SGTTY_H) && !defined(USING_TERMIOS)
#include <sgtty.h>
#define USING_SGTTY
#endif /* HAVE_SGTTY_H && !USING_TERMIOS */

#ifndef WIN32
#if !defined(USING_SGTTY) && !defined(USING_TERMIOS)
#error ERROR NO TERMIOS OR SGTTY;
#endif /* !USING_SGTTY && !USING_TERMIOS */
#endif /* WIN32 */

/* Define UID_ROOT to be the user id for root (normally zero, but different
   e.g. on Amiga). */
#ifndef UID_ROOT
#define UID_ROOT 0
#endif

#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif /* HAVE_SYS_RESOURCE_H */

#ifdef _HPUX_SOURCE
#define seteuid(uid) setresuid(-1,(uid),-1)
#endif /* _HPUX_SOURCE */

#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif /* HAVE_NETDB_H */
#ifdef HAVE_NETGROUP_H
#include <netgroup.h>
#endif /* HAVE_NETGROUP_H */"

AC_MSG_CHECKING([whether there is a prototype for innetgr])
AC_CACHE_VAL(ac_cv_have_proto_innetgr,
             [ AC_TRY_COMPILE(changequote(<<, >>)dnl
                              << $auths_hostbased_includes
/* If someone has a prototype like this for anything, then... well. */
void * innetgr(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
>>,
                              changequote([, ])dnl
                              [ ; ],
                              ac_cv_have_proto_innetgr=no,
                              ac_cv_have_proto_innetgr=yes)])
if test "$ac_cv_have_proto_innetgr" = "yes"; then
  AC_DEFINE(HAVE_PROTO_INNETGR)
fi
AC_MSG_RESULT($ac_cv_have_proto_innetgr)

AC_MSG_CHECKING(whether to include the ssh-agent1 compatibility)
AC_ARG_WITH(ssh-agent1-compat,
[  --with-ssh-agent1-compat
                          Include ssh-agent1 compatibility. (default)
  --without-ssh-agent1-compat
                          Leave out ssh-agent1 compatibility.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  *)
    AC_MSG_RESULT(yes)
    AC_DEFINE(WITH_SSH_AGENT1_COMPAT)
    ;;
  esac ],
  AC_MSG_RESULT(yes)
  AC_DEFINE(WITH_SSH_AGENT1_COMPAT)
)


AC_MSG_CHECKING(for default SOCKS server)
AC_ARG_WITH(socks-server,
[  --with-socks-server=VALUE  
                          Use VALUE as default SSH_SOCKS_SERVER value. ],
[ case "$withval" in
  no)
    AC_MSG_RESULT([none (using SSH_SOCKS_SERVER environment variable at run-time)])
    ;;
  yes)
    AC_MSG_ERROR([Must specify default socks server with --socks-server=VALUE.])
    ;;
  *)
    AC_MSG_RESULT([SOCKS server at $withval])
    AC_DEFINE_UNQUOTED(SOCKS_DEFAULT_SERVER, "$withval")
    ;;
  esac ],
  AC_MSG_RESULT([none (using SSH_SOCKS_SERVER environment variable at run-time)])
)

# --with-etcdir

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_SUBST(ETCDIR)

# --(en|dis)able-suid-ssh-signer

AC_MSG_CHECKING(whether to install ssh-signer as suid root)
AC_ARG_ENABLE(suid-ssh-signer,
[  --disable-suid-ssh-signer
                          Install ssh-signer without suid bit],
[ case "$enableval" in
  no)
       AC_MSG_RESULT(no)
       SSHSIGNERINSTALLMODE=0755
       ;;
  *)   AC_MSG_RESULT(yes)
       SSHSIGNERINSTALLMODE=04711
       ;;
  esac ],
  AC_MSG_RESULT(yes)
  SSHSIGNERINSTALLMODE=04711
)
AC_SUBST(SSHSIGNERINSTALLMODE)

AC_MSG_CHECKING(whether to disable tcp-port forwardings)
AC_ARG_ENABLE(tcp-port-forwarding,
[  --disable-tcp-port-forwarding
                          Disable port forwarding support],
[ case "$enableval" in
  no)
       AC_MSG_RESULT(yes)
       AC_DEFINE(DISABLE_PORT_FORWARDING)
       ;;
  *)   AC_MSG_RESULT(no)
       ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_EGREP_HEADER(machine, sys/utsname.h, AC_DEFINE(HAVE_MACHINE_IN_UTSNAME))
AC_EGREP_HEADER(domainname, sys/utsname.h, 
                AC_DEFINE(HAVE_DOMAINNAME_IN_UTSNAME))

AC_MSG_CHECKING(whether to disable X11 forwarding)
AC_ARG_ENABLE(X11-forwarding,
[  --disable-X11-forwarding
                          Disable X11 forwarding support],
[ case "$enableval" in
  no)
       AC_MSG_RESULT(yes)
       AC_DEFINE(DISABLE_X11_FORWARDING)
       ;;
  *)   AC_MSG_RESULT(no)
       ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(ssh-connection-limit)
AC_ARG_WITH(ssh-connection-limit,
[  --with-ssh-connection-limit=limit
                          Maximum number of simultaneous connections to  server.
                          (default unlimited)],
[ case "$withval" in
  no)
    AC_MSG_ERROR(Need number of allowed connections.)
    ;;
  yes)
    AC_MSG_ERROR(Need number of allowed connections.)
    ;;
  *)
    SSH2_MAX_CONNECTIONS="$withval"
    if test "$withval" = "unlimited" ; then
      withval=0
    fi
    expr "$withval" + 1 >/dev/null 2>/dev/null
    if test "$?" -ne "0" ; then
      AC_MSG_ERROR(Need number of allowed connections.)
    fi
    if test "$withval" -eq 0 ; then
      AC_MSG_RESULT(unlimited)
    elif test "$withval" -lt 0 ; then
      AC_MSG_ERROR(Number of allowed connections has to be positive.)
    else
      AC_MSG_RESULT($withval)
    fi
    ;;
  esac ],
  SSH2_MAX_CONNECTIONS="0"
  AC_MSG_RESULT(unlimited)
)
AC_DEFINE_UNQUOTED(SSH2_MAX_CONNECTIONS, $SSH2_MAX_CONNECTIONS)

if test -n "$os_aix"; then
  # AIX compiler is broken.  It embeds -L flagged paths (even ones starting
  # with .. into LDPATH that is used in dynamical linking.  This is 
  # prevented by omitting -L and internal -l flags and providing path
  # names to the libraries within ssh source tree.
  if test -z "$GCC"; then
    ssh2_ldadd_options="-bnolibpath ./libssh2.a ../../lib/libssh.a"
  else
    ssh2_ldadd_options="./libssh2.a ../../lib/libssh.a"
  fi
else
  ssh2_ldadd_options="-L. -L../../lib -lssh2 -lssh"
fi
AC_SUBST(ssh2_ldadd_options)

# /m/torni/home/u/sjl/ssh_2_2_branch/src/./lib/sshcrypt/configure.in.inc 

#
# configure.in fragment for sshcrypt (crypto library)
#
# Author: Tatu Ylonen <ylo@ssh.fi>
#
# Copyright (c) 1997 SSH Communications Security, Finland
#                    All rights reserved
#


AC_SUBST(CRYPTO_CONF_OBJS)

AC_CHECK_FUNCS(times clock)
AC_CHECK_FUNCS(getpid getppid getuid getgid getpgrp)



# Make sure nm is in PATH, because it is needed by the next test.
AC_PATH_PROG(NM_PATH, nm, no-nm)
if test "$NM_PATH" = "no-nm"; then
  AC_MSG_ERROR("The 'nm' program could not be found in PATH.")
fi

AC_MSG_CHECKING(whether compiled symbols are prepended with underscore)

if test "${ac_cv_have_no_symbol_underscore+set}" = set; then
  if test "$ac_cv_have_no_symbol_underscore" = "yes"; then
    echo "(cached) no"
    AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
  else
    echo "(cached) yes"
  fi
else

  AC_TRY_RUN(int underscoretestfunction() { return 0; }
             int main()
             {
                 underscoretestfunction();
	         return 0;
             },
             [if test -n "`nm conftest 2>/dev/null | grep _underscoretestfunction 2>/dev/null`"; then
                AC_MSG_RESULT(yes)
                ac_cv_have_no_symbol_underscore=no
              elif test -n "`nm conftest 2>/dev/null | grep underscoretestfunction 2>/dev/null`"; then
                AC_MSG_RESULT(no)
                AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
                ac_cv_have_no_symbol_underscore=yes
              fi ], 
             AC_MSG_WARN(failed to test underscore.), 
             AC_MSG_WARN(cross compilation isn\'t tested))
fi
# /m/torni/home/u/sjl/ssh_2_2_branch/src/./lib/sshmath/configure.in.inc 

#
# configure.in fragment for sshmath (arithmetic library)
#
# Author: Tatu Ylonen <ylo@ssh.fi>
#
# Copyright (c) 1997 SSH Communications Security, Finland
#                    All rights reserved
#


AC_SUBST(MATH_CONF_OBJS)

AC_CHECK_FUNCS(times clock)
# /m/torni/home/u/sjl/ssh_2_2_branch/src/./lib/sshpgp/configure.in.inc 

#
# configure.in fragment for sshpgp (pgp library)
#
# Author: Timo J. Rinne <tri@ssh.fi>
#
# Copyright (c) 1999 SSH Communications Security, Finland
#                    All rights reserved
#

AC_MSG_CHECKING(whether to include PGP library)
AC_ARG_WITH(pgp,
[  --without-pgp           Do not include PGP library.],
[ case "$withval" in
  no)
    AC_MSG_RESULT(no)
    ;;
  *)
    AC_MSG_RESULT(yes)
    AC_DEFINE(WITH_PGP)
    ;;
  esac ],
  AC_MSG_RESULT(yes)
  AC_DEFINE(WITH_PGP)
)

# /m/torni/home/u/sjl/ssh_2_2_branch/src/./lib/sshreadline/configure.in.inc 
#
# configure.in.inc for sshreadline
#
# Author: Tatu Ylonen <ylo@ssh.fi>
#	  Timo J. Rinne <tri@ssh.fi>
#         Sami Lehtinen <sjl@ssh.fi>
#
# Copyright (c) 1997 SSH Communications Security, Finland
#                    All rights reserved
#

case "$target" in
  *-*-solaris2*)
    test_term_h=yes
    ;;
  *)
    ;;
esac

AC_CHECK_LIB(termcap, tgetent)
AC_CHECK_LIB(xcurses, tgetent)
AC_CHECK_LIB(ncurses, tgetent)
AC_CHECK_HEADERS(termcap.h term.h curses.h termios.h termio.h)

if test "x$test_term_h" = "xyes" ; then
  AC_MSG_CHECKING(whether to use /usr/include/term.h or /usr/xpg4/include/term.h)
  AC_TRY_COMPILE([#ifdef HAVE_TERMIOS_H
                  #include <termios.h>
                  #endif
                  #ifdef HAVE_TERMIO_H
                  #include <termio.h>
                  #endif
                  #ifdef HAVE_CURSES_H
                  #include <curses.h>
                  #endif
                  #include <term.h>],
	         [],
	         AC_MSG_RESULT("/usr/include/term.h"),
                 [if test -f /usr/xpg4/include/term.h; then
                    AC_DEFINE(HAVE_USR_XPG4_INCLUDE_TERM_H)
                    AC_MSG_RESULT("/usr/xpg4/include/term.h")
		  fi])
fi


# /m/torni/home/u/sjl/ssh_2_2_branch/src/./lib/sshsession/configure.in.inc 

#
# configure.in fragment for sshsession (mostly pty and child process handling)
#
# Author: Tatu Ylonen <ylo@ssh.com>
#         Sami Lehtinen <sjl@ssh.com>
#
# Copyright (c) 1997,2000 SSH Communications Security, Finland
#                         All rights reserved
#

pty=""

case "$target" in
  *-*-sunos4.1.1*)
    # Tim Adam <tma@osa.com.au> says speed_t is defined in stdtypes.h
    AC_DEFINE(SPEED_T_IN_STDTYPES_H)
    ;;
  *-*-solaris*)
    AC_DEFINE(NIS_PLUS)
    ;;
  mips-dec-mach3*)
    # Mach3 stuff from kivinen@hut.fi
    no_vhangup=yes
    no_setsid=yes
    ;;
  *-sgi-irix5*)
    # force /etc/shadow support. they can run /sbin/pwconv at any time.
    # if they do so, don't let sshd down:-) appro@fy.chalmers.se
    AC_DEFINE(HAVE_ETC_SHADOW)
    no_shadows_password_checking=yes
    ;;
  *-sgi-irix6*)
    # force /etc/shadow support. they can run /sbin/pwconv at any time.
    # if they do so, don't let sshd down:-) appro@fy.chalmers.se
    AC_DEFINE(HAVE_ETC_SHADOW)
    no_shadows_password_checking=yes
    ;;
  *-*-aix4*)
    no_utmpx=yes
    AC_CHECK_LIB(s, getuserattr)
    ;;
  *-ibm-aix*)
    AC_CHECK_LIB(s, getuserattr)
    ;;
  *-dec-ultrix*)
    # Ultrix stuff from dmckilli@qc.bell.ca, jbotz@orixa.mtholyoke.edu,
    # corey@cac.washington.edu
    AC_DEFINE(HAVE_ULTRIX_SHADOW_PASSWORDS)
    AC_DEFINE(O_NONBLOCK_BROKEN)
    no_vhangup=yes
    no_utmpx=yes
    no_shadows_password_checking=yes
    AC_CHECK_LIB(auth, authenticate_user)
    ;;
  *-*-hpux*)
    AC_MSG_CHECKING(for HPUX tcb auth option)
    if test -f /tcb/files/auth/system/pw_id_map; then
      AC_MSG_RESULT(yes)
      AC_DEFINE(HAVE_HPUX_TCB_AUTH)
      LIBS="$LIBS -lsec"
    else
      AC_MSG_RESULT(no)
    fi
    AC_MSG_CHECKING(for keyserv)
    if test -f /usr/sbin/keyserv; then
      AC_MSG_RESULT(yes)
      AC_DEFINE(SECURE_RPC)
      LIBS="$LIBS -lrpcsvc"
    else
      AC_MSG_RESULT(no)
    fi
    no_utmpx=yes
    ;;
  alpha*-dec-osf*)
    no_utmpx=yes
    AC_DEFINE(TTY_GROUP, "terminal")
    AC_CHECK_FUNC(sia_become_user, 
       [ AC_MSG_RESULT(Including support for Security Integration Architecture)
         AC_DEFINE(HAVE_SIA)
         SSHSESSION_CONFOBJS="$SSHSESSION_CONFOBJS sshsia.o" ],
       [ AC_MSG_RESULT(No support for Security Integration Architecture) ])
    ;;
  *-*-nextstep*)
    # Nextstep support from a person who wants to remain anonymous
    if test -f /usr/include/bsd/sys/termios.h; then
      AC_DEFINE(SPEED_T_IN_STDTYPES_H)
    fi
    ;;
  *-*-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_CHECK_LIB(shadow, pw_encrypt)
      AC_CHECK_FUNCS(pw_encrypt, AC_DEFINE(crypt,pw_encrypt))
    fi

    if test -c /dev/ptmx && test -d /dev/pts
    then
      pty="ptmx"
    fi
    ;;
  m68k-sony-newsos*)
    # From snabb@niksula.hut.fi
    no_vhangup=yes
    ;;
  *-*-machten*)
    no_vhangup=yes
    ;;
  t3e-*-*)
    CFLAGS="$CFLAGS -I."
    LIBS="$LIBS -lrsc"
    ;;
  *-cray-*)
    CFLAGS="$CFLAGS -DCRAY_STACKSEG_END=_getb67"
    LIBS="$LIBS -lrsc"
    pty="cray"
    ;;
  i*86-*-sco3.2v4*)
    # From moi@dio.com
    AC_DEFINE(HAVE_SCO_ETC_SHADOW)
    LIBS="-L/usr/lib/libp -lprot -lx $LIBS"
    ;;
  i*86-*-sco3.2v5*)
    # From brian@ilinx.com
    AC_DEFINE(HAVE_SCO_ETC_SHADOW)
    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
    ;;
  *-sequent-dynix*|*-sequent-ptx*)
    LIBS="-lsec $LIBS"
    ;;
  *-*-freebsd|*-*-netbsd*|*-*-openbsd*)
    # From Ollivier Robert: FreeBSD and NetBSD use master.passwd, but set
    # pw_passwd automatically when running as root.
    # XXX typo. Should be no_shadows_password_checking. Has worked till now,
    #     do we fix this?
    no_shadow_password_checking=yes
    ;;
  *)
    ;;
esac

AC_MSG_CHECKING(whether pty-selection should be overridden)
AC_ARG_WITH(pty,
[  --with-pty=type         Override automatic detection of pty-type. 
                          pty-\$type.c should be found in lib/sshsession.],
[ pty="$withval"
  AC_MSG_RESULT([yes ($pty)])
 ],
[ AC_MSG_RESULT(no) ])

if test -z "$no_utmpx"; then
  AC_CHECK_HEADERS(utmpx.h)
fi

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

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

AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sgtty.h libutil.h usersec.h login_cap.h sys/resource.h)
AC_CHECK_HEADERS(sia.h sys/mkdev.h util.h shadow.h arpa/inet.h)
AC_CHECK_HEADERS(sys/stream.h sys/conf.h sys/termios.h sys/ioctl.h)
AC_CHECK_HEADERS(pty.h stropts.h)
AC_CHECK_FUNCS(revoke openpty _getpty setpgrp setpgid ttyslot authenticate)
AC_CHECK_FUNCS(makeutx setlogin openpty _getpty innetgr initgroups setpgrp)
AC_CHECK_FUNCS(signal setrlimit getrlimit setluid getpt isastream chflags)
AC_CHECK_FUNCS(updwtmpx)
AC_CHECK_LIB(c, crypt, [true], AC_CHECK_LIB(crypt, crypt))
AC_CHECK_LIB(sec, getspnam)
AC_CHECK_LIB(seq, get_process_stats)

AC_CHECK_FUNCS(getspnam daemon)

# check for minor
AC_CHECK_FUNCS(minor)

# check if minor is defined in <sys/mkdev.h> as a macro
# (this is the case atleast in Solaris 2.5.1)

if test "x$ac_cv_func_minor" != "xyes"; then
  AC_MSG_CHECKING(if minor is defined as a macro in <sys/mkdev.h>)
  AC_TRY_LINK([#include <sys/types.h>
	       #include <sys/stat.h>
	       #include <sys/mkdev.h>],
	      [struct stat st;
	       minor(st.st_rdev);],
	      [AC_DEFINE(HAVE_MINOR)
	       AC_MSG_RESULT(yes)],
	      AC_MSG_RESULT(no))
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
      # If we don't have shadow.h, this might be some nonstandard
      # kludging... So better check it out.
    if test "x$ac_cv_header_shadow_h" = "xyes"; then
      AC_DEFINE(HAVE_ETC_SHADOW)
      AC_MSG_RESULT(/etc/shadow)
      # SunOS C2 security uses this style of shadow passwords, but does not
      # have getspent in a system library.  However, a libshadow.a library
      # contaning these is publicly available.
      AC_CHECK_LIB(shadow, getspent)
      AC_MSG_CHECKING([whether spwd have sp_expire field])
      AC_EGREP_HEADER(sp_expire, shadow.h, [ AC_DEFINE(HAVE_STRUCT_SPWD_EXPIRE)
      	AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
      AC_MSG_CHECKING([whether spwd have sp_inact field])
      AC_EGREP_HEADER(sp_inact, shadow.h, [ AC_DEFINE(HAVE_STRUCT_SPWD_INACT)
      	AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
    else
      AC_MSG_RESULT(no)
    fi
  elif test -n "$os_aix"; then
    AC_DEFINE(HAVE_ETC_SECURITY_PASSWD)
    AC_MSG_RESULT(/etc/security/passwd)
  elif test -n "$os_sunos" -a -f /etc/security/passwd.adjunct; 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 FILE
do
  if test "$dir" = "FILE"; then
    if test -f $HOME/.MailBox; then
      AC_MSG_WARN(mail spool directory was not found: assuming you use \$HOME/.MailBox)
      AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, ".MailBox")
      AC_MSG_RESULT(\$HOME/.MailBox)
    else
      AC_MSG_WARN(mail spool directory was not found: assuming you use \$HOME/newmail)
      AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "newmail")
      AC_MSG_RESULT(\$HOME/newmail)
    fi
  elif test -d $dir; then
    AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIRECTORY, "$dir")
    AC_MSG_RESULT($dir)
    break
  fi
done

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))
if test -z "$no_utmpx"; then
  AC_EGREP_HEADER(ut_syslen, utmpx.h, AC_DEFINE(HAVE_SYSLEN_IN_UTMPX))
  AC_EGREP_HEADER(ut_session, utmpx.h, AC_DEFINE(HAVE_SESSION_IN_UTMPX))
  AC_EGREP_HEADER(ut_pid, utmpx.h, AC_DEFINE(HAVE_PID_IN_UTMPX))
fi

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

if test -z "$no_libsun"; then
  AC_CHECK_LIB(sun, getpwnam)
fi
if test -z "$no_libbsd"; then
  AC_CHECK_LIB(bsd, openpty)
fi
AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN)
			  LIBS="$LIBS -lutil")

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(for pseudo ttys)
if test -n "$pty"; then
  AC_MSG_RESULT($pty)
else
if test "$ac_cv_func__getpty" = "yes"; then
  pty="getpty"
  AC_MSG_RESULT(_getpty)
else
if test "$ac_cv_func_openpty" = "yes"; then
  pty="openpty"
  AC_MSG_RESULT(openpty)
else
if test -c /dev/getpty
then
  pty="getpseudotty"
  AC_MSG_RESULT(getpseudotty)
else
if test -c /dev/ptmx && test -c /dev/pts/0
then
  pty="ptmx"
  AC_MSG_RESULT(streams ptys)
else
if test -c /dev/pts && test -c /dev/ptc
then
  pty="pts"
  AC_MSG_RESULT(/dev/pts and /dev/ptc)
else
if test -c /dev/ptyp10
then
  pty="sco"
  AC_MSG_RESULT(sco-style ptys)
else
  pty="bsd"
  AC_MSG_RESULT(bsd-style ptys)
fi
fi
fi
fi
fi
fi
fi

AC_CHECK_HEADERS(grp.h unistd.h)

session_wtmp_includes="#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
#endif /* HAVE_LIBUTIL_H */

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
  
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#define USING_TERMIOS
#endif /* HAVE_TERMIOS_H */
  
#ifdef HAVE_SYS_TERMIOS_H
#include <sys/termios.h>
#define USING_TERMIOS
#endif /* HAVE_SYS_TERMIOS_H */
  
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif /* HAVE_SYS_IOCTL_H */
  
#if defined(HAVE_SGTTY_H) && !defined(USING_TERMIOS)
#include <sgtty.h>
#define USING_SGTTY
#endif /* HAVE_SGTTY_H && !USING_TERMIOS */

#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif /* HAVE_SYS_RESOURCE_H */

#ifdef HAVE_UTIL_H
#include <util.h>
#endif /* HAVE_UTIL_H */

#ifdef HAVE_UTMP_H
#include <utmp.h>
#ifdef HAVE_LASTLOG_H
#include <lastlog.h> /* Some have the definitions in utmp.h. */
#endif /* HAVE_LASTLOG_H */
#endif /* HAVE_UTMP_H */

#ifdef HAVE_UTMPX_H
#include <utmpx.h>
#ifndef SCO
#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>  /* for minor() */
#endif /* HAVE_SYS_MKDEV_H */
#endif
#endif /* HAVE_UTMPX_H */

#ifdef HAVE_USERSEC_H
#include <usersec.h>
#endif /* HAVE_USERSEC_H */

#include <sys/socket.h>
#include <netinet/in.h>  /* for in_addr */

#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif /* HAVE_ARPA_INET_H */

#ifdef HAVE_GRP_H
#include <grp.h>
#endif /* HAVE_GRP_H"

AC_MSG_CHECKING([whether there is a prototype for login])
AC_CACHE_VAL(ac_cv_have_proto_login,
             [ AC_TRY_COMPILE(changequote(<<, >>)dnl
                              << $session_wtmp_includes
/* If someone has a prototype like this for anything, then... well. */
void * login(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
>>,
                              changequote([, ])dnl
                              [ ; ],
                              ac_cv_have_proto_login=no,
                              ac_cv_have_proto_login=yes)])
if test "$ac_cv_have_proto_login" = "yes"; then
  AC_DEFINE(HAVE_PROTO_LOGIN)
fi
AC_MSG_RESULT($ac_cv_have_proto_login)

AC_MSG_CHECKING([whether there is a prototype for logout])
AC_CACHE_VAL(ac_cv_have_proto_logout,
             [ AC_TRY_COMPILE(changequote(<<, >>)dnl
                              << $session_wtmp_includes
/* If someone has a prototype like this for anything, then... well. */
void * logout(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
>>,
                              changequote([, ])dnl
                              [ ; ],
                              ac_cv_have_proto_logout=no,
                              ac_cv_have_proto_logout=yes)])
if test "$ac_cv_have_proto_logout" = "yes"; then
  AC_DEFINE(HAVE_PROTO_LOGOUT)
fi
AC_MSG_RESULT($ac_cv_have_proto_logout)

AC_MSG_CHECKING([whether there is a prototype for logwtmp])
AC_CACHE_VAL(ac_cv_have_proto_logwtmp,
             [ AC_TRY_COMPILE(changequote(<<, >>)dnl
                              << $session_wtmp_includes
/* If someone has a prototype like this for anything, then... well. */
void * logwtmp(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
>>,
                              changequote([, ])dnl
                              [ ; ],
                              ac_cv_have_proto_logwtmp=no,
                              ac_cv_have_proto_logwtmp=yes)])
if test "$ac_cv_have_proto_logwtmp" = "yes"; then
  AC_DEFINE(HAVE_PROTO_LOGWTMP)
fi
AC_MSG_RESULT($ac_cv_have_proto_logwtmp)

AC_CHECK_FUNCS(initgroups)

if test "X$ac_cv_func_initgroups" = "Xyes"; then
  AC_MSG_CHECKING([whether there is a prototype for initgroups])
  AC_CACHE_VAL(ac_cv_have_proto_initgroups,
  	       [ AC_TRY_COMPILE(changequote(<<, >>)dnl
  				<< $session_wtmp_includes
  /* If someone has a prototype like this for anything, then... well. */
  void * initgroups(void *, int *, char *, int, char, void *[6][8][10][3][4], ...);
  >>,
  				changequote([, ])dnl
  				[ ; ],
  				ac_cv_have_proto_initgroups=no,
  				ac_cv_have_proto_initgroups=yes)])
  if test "$ac_cv_have_proto_initgroups" = "yes"; then
    AC_DEFINE(HAVE_PROTO_INITGROUPS)
  fi
  AC_MSG_RESULT($ac_cv_have_proto_initgroups)
fi

unset session_wtmp_includes

SSHSESSION_CONFOBJS="$SSHSESSION_CONFOBJS pty-$pty.o"
AC_SUBST(SSHSESSION_CONFOBJS)

AC_MSG_CHECKING(whether to use Kerberos)
AC_ARG_WITH(kerberos5,
[  --with-kerberos5=[KRB_PREFIX] 
                          Compile in Kerberos5 support. Kerberos support 
                          is EXPERIMENTAL.],
[ 
  with_kerberos5="$withval"
],
[ with_kerberos5=no ]
)
case "$with_kerberos5" in
no)
  AC_MSG_RESULT(no)
  ;;
*)
  if test "X$with_kerberos5" = "Xyes"; then
    case "$target" in
      *-*-linux*|*-*-mklinux*)
    	# at least in RedHat
    	with_kerberos5=/usr/kerberos
    	;;
      *)
    	with_kerberos5=/usr/local
    	;;
      # more cases, please.
    esac
  fi 
  AC_MSG_RESULT(yes)
  CFLAGS_store="$CFLAGS"
  LIBS_store="$LIBS"
  CFLAGS="$CFLAGS -I$with_kerberos5/include"
  LIBS="-L$with_kerberos5/lib $LIBS"
  AC_CHECK_LIB(krb5, 
  	       krb5_auth_con_init,,,-lk5crypto -lcom_err)
  if test "X$ac_cv_lib_krb5_krb5_auth_con_init" = "Xyes"; then
    AC_CHECK_LIB(ndbm, dbm_open)
    AC_DEFINE(KERBEROS)
  else
    AC_MSG_RESULT([No Kerberos5 installed - support disabled.])
    CFLAGS="$CFLAGS_store"
    LIBS="$LIBS_store"
  fi
  unset CFLAGS_store
  unset LIBS_store
  ;;
esac

# /m/torni/home/u/sjl/ssh_2_2_branch/src/./lib/sshutil/configure.in.inc 

#
# configure.in fragment for sshutil (generic utilities and portability stuff)
#
# Author: Tatu Ylonen <ylo@ssh.fi>
#
# Copyright (c) 1997 SSH Communications Security, Finland
#                    All rights reserved
#

# So many systems seem to need this that it is better do it here automatically.
LIBS="-L/usr/local/lib $LIBS"

# Platform-specific stuff.
case "$target" in
  alpha*-dec-osf*)
    AC_DEFINE(HAVE_POSIX_STYLE_SOCKET_PROTOTYPES)
    ;;
  *-*-solaris*)
    AC_DEFINE(SECURE_RPC)
    AC_DEFINE(SECURE_NFS)
    ;;
  m88k-dg-dgux*)
    AC_DEFINE(BROKEN_INET_ADDR)
    ;;
  *-sequent-ptx*)
    # From geek+@cmu.edu
    test_libinet=yes
    ;;
  *-sequent-dynix*|*-sequent-ptx*)
    LIBS="-lseq -lsocket -linet -lnsl $LIBS"
    ;;
  *-*-hpux*)
    AC_MSG_CHECKING(for keyserv)
    if test -f /usr/sbin/keyserv; then
      AC_MSG_RESULT(yes)
      AC_DEFINE(SECURE_RPC)
      LIBS="$LIBS -lrpcsvc"
    else
      AC_MSG_RESULT(no)
    fi
    no_utmpx=yes
    case "$target" in
	*-*-hpux10.*|*-*-hpux[[1-9]].*)
          no_snprintf=yes
	  ;;
	*)
          # Atleast HPUX-11.00 seems to have a working snprintf
	  ;;
    esac
   ;;
  *-*-aix4*)
    no_utmpx=yes
    ;;
  *-*-irix6*)
    AC_DEFINE(BROKEN_INET_ADDR)
    ;;
  *)
    ;;
esac

if test -z "$no_libnsl"; then
  AC_CHECK_LIB(nsl, main)
fi
if test -n "$test_libinet"; then
  AC_CHECK_LIB(inet, inet_network)
fi
if test -z "$no_libsocket"; then
  AC_CHECK_LIB(socket, socket)
fi

AC_CHECK_FUNCS(strchr memcpy gethostname gettimeofday ctime signal)
AC_CHECK_FUNCS(getservbyname getservbyport)
AC_CHECK_FUNCS(popen lockf getrusage uname)
AC_CHECK_FUNCS(getpid getppid getuid getgid getpgrp)
AC_CHECK_FUNCS(endpwent endgrent getgrgid getpwuid)
AC_CHECK_FUNCS(truncate ftruncate chown fchown chmod fchmod fstat)
AC_CHECK_FUNCS(lutimes futimes utime utimes usleep lstat localtime inet_aton)

AC_REPLACE_FUNCS(strerror memmove memset remove random putenv)
AC_REPLACE_FUNCS(strcasecmp strncasecmp crypt getopt)

if test -n "$no_snprintf"; then
  LIBOBJS="$LIBOBJS snprintf.o"
  AC_MSG_WARN("using internal snprintf")
else
  AC_REPLACE_FUNCS(snprintf)
fi

AC_CHECK_HEADERS(unistd.h netinet/in_systm.h netinet/in.h)
AC_CHECK_HEADERS(machine/endian.h endian.h paths.h sys/un.h sys/utsname.h)
AC_CHECK_HEADERS(machine/spl.h sys/callout.h)
AC_CHECK_HEADERS(termcap.h rusage.h pwd.h grp.h sys/time.h dirent.h)

AC_CHECK_LIB(termcap, tgetent)

# Check if /var/run exists (this is used by includes.h to set PIDDIR).
if test -d /var/run; then
  AC_DEFINE(HAVE_VAR_RUN)
fi

AC_MSG_CHECKING(whether inet_ntoa is broken)
AC_TRY_RUN([
struct in_addr {
  unsigned char s_addr[4];
};

char *inet_ntoa(struct in_addr in);

main()
{
   char *addr;
   struct in_addr in;
   unsigned char *b;

   b = in.s_addr;
   *b = 0xef; b++;
   *b = 0xcd; b++;
   *b = 0xab; b++;
   *b = 0x89;
   addr = inet_ntoa(in);
   return ((strcmp(addr, "239.205.171.137") == 0) ? 0 : 1);
}],AC_MSG_RESULT(no),[AC_MSG_RESULT(yes)
broken_inet_ntoa="yes"],[AC_MSG_RESULT(yes)
broken_inet_ntoa="yes"])

if test -n "$broken_inet_ntoa"; then
  LIBOBJS="$LIBOBJS inet_ntoa.o"
  AC_MSG_WARN("using internal inet_ntoa")
fi
 
AC_MSG_CHECKING(whether S_IFSOCK is defined)
AC_TRY_LINK([#include <sys/stat.h>],
	    [int i = S_IFSOCK;],
	    [AC_MSG_RESULT(yes)
             AC_DEFINE(HAVE_S_IFSOCK)],
	    AC_MSG_RESULT(no))

AC_MSG_CHECKING(whether to enable TCP_NODELAY)
AC_ARG_ENABLE(tcp-nodelay,
[  --disable-tcp-nodelay    Enable TCP_NODELAY socket option],
[ case "$enableval" in
  yes)
       AC_MSG_RESULT(yes)
       AC_DEFINE(ENABLE_TCP_NODELAY)
       ;;
  *)
       AC_MSG_RESULT(no)
  esac ],
  AC_MSG_RESULT(yes)
  AC_DEFINE(ENABLE_TCP_NODELAY)
)

AC_MSG_CHECKING(whether to use blocking connect system call)
AC_ARG_ENABLE(blocking-connect,
[  --enable-blocking-connect
                          Use blocking connect system call.],
[ case "$enableval" in
  yes)
    AC_MSG_RESULT(yes)
    AC_DEFINE(NO_NONBLOCKING_CONNECT)
    ;;
  *)
    AC_MSG_RESULT(no)
    ;;
  esac ],
  AC_MSG_RESULT(no)
)

AC_MSG_CHECKING(whether struct tm has member tm_gmtoff)
AC_TRY_COMPILE([#include <sys/types.h>
#include <time.h>
long test()
{
  struct tm tm;
  tm.tm_gmtoff = 0;
  return ((long)(tm.tm_gmtoff));
}],
[],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TM_GMTOFF_IN_STRUCT_TM)],
[AC_MSG_RESULT(no)]
)

AC_MSG_CHECKING(whether struct tm has member tm_isdst)
AC_TRY_COMPILE([#include <sys/types.h>
#include <time.h>
int test()
{
  struct tm tm;
  tm.tm_isdst = 0;
  return ((int)(tm.tm_isdst));
}],
[],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TM_ISDST_IN_STRUCT_TM)],
[AC_MSG_RESULT(no)]
)

AC_MSG_CHECKING(whether to use system provided localtime)
AC_ARG_WITH(internal-localtime,
[  --with-internal-localtime   
                          Use only ssh internal localtime function.],
[ 
  case "$withval" in
  yes)
    AC_MSG_RESULT(no)
    AC_DEFINE(USE_SSH_INTERNAL_LOCALTIME)
    ;;
  *)
    AC_MSG_RESULT(yes)
    ;;
  esac ],
  AC_MSG_RESULT(yes)
)

# Thread packages in the order they should be probed. The first found
# is selected if 
THREADS="pthread none"
AC_MSG_CHECKING(whether to use threads)
AC_ARG_WITH(threads,
[  --with-threads=xxx      Use thread package xxx ($THREADS)],
[
  case "$withval" in
    yes)
      AC_MSG_RESULT(yes, try to find package)
      ;;
    pthread)
      AC_MSG_RESULT(pthread)
      THREADS=pthread
      ;;
    no)
      AC_MSG_RESULT(no)
      THREADS=none
      ;;
    *)
      AC_MSG_RESULT(unknown)
      AC_MSG_ERROR([Unknown thread package selected: $withval, supported packages are: $THREADS])
      ;;
  esac ],
  AC_MSG_RESULT(no)
  THREADS=none
)

THREAD_OBJS=
THREAD_SYSTEM_OBJS=

for i in $THREADS
do
  if test -z "$THREAD"; then
    case "$i" in
      none)
	  THREAD=none
	  THREAD_OBJS=
	  THREAD_SYSTEM_OBJS=
	  ;;
      pthread)
	  AC_MSG_CHECKING(whether $CC accepts -pthread)
	  CFLAGS_store="$CFLAGS"
	  CFLAGS="$CFLAGS -pthread"
	  AC_TRY_COMPILE([#include <pthread.h>],[
pthread_create(NULL, NULL, NULL);],[AC_MSG_RESULT(yes)
		 THREAD=pthread ],
                 [AC_MSG_RESULT(no)
                  CFLAGS="$CFLAGS_store -D_REENTRANT"
		  AC_CHECK_LIB(pthread, main, [
			LIBS="-lpthread $LIBS"
			THREAD=pthread
			AC_CHECK_LIB(exc, main)])
		  ])
	  unset CFLAGS_store
	  if test -n "$THREAD"; then
		THREAD_OBJS="sshmt_pthreads.o sshmt_timeouts.o"
		THREAD_SYSTEM_OBJS="unix/sshmt_pthreads.o unix/sshmt_timeouts.o"
		AC_DEFINE(HAVE_PTHREADS)
		AC_DEFINE(HAVE_THREADS)
	  fi
	  ;;
      *)
	  AC_MSG_ERROR(Unknown thread package selected)
	  ;;
    esac
  fi
done

AC_SUBST(THREAD_OBJS)
AC_SUBST(THREAD_SYSTEM_OBJS)

if test -z "$no_termios"; then
  if test "X$ac_cv_header_termios_h" = "Xyes"; then
    AC_CHECK_HEADERS(sys/modem.h)
    if test "X$ac_cv_header_sys_modem_h" = "Xyes"; then
      AC_MSG_CHECKING(whether termios.h needs sys/modem.h to be included)
      AC_TRY_COMPILE([#include <termios.h>],
                     [#ifdef TIOCM_DTR
		        int flags = 0;
                        flags |= TIOCM_DTR;
                      #endif /* TIOCM_DTR */],
                      AC_MSG_RESULT(no),
                      [ AC_MSG_RESULT(yes)
                        AC_DEFINE(TERMIOS_H_NEEDS_MODEM_H)])

    fi
  fi
fi

#
# configure.tail - last fragment of top-level configure.in
#
# Author: Tatu Ylonen <ylo@ssh.fi>
#
# Copyright (c) 1997-2000 SSH Communications Security, Finland
#                    All rights reserved
#

AC_SUBST(AR)
AC_SUBST(RANLIB)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

AC_SUBST(IPSEC_ARCH_ROUTE)
AC_SUBST(IPSEC_ARCH_INTC)

# If purify is enabled, add it to CC at this point. But only CC, not KERN_CC...
if test "x$with_purify" != "x"; then
  CC="$with_purify $CC"
  AC_DEFINE(WITH_PURIFY)
fi


AC_OUTPUT(Makefile
include/Makefile
lib/Makefile
lib/zlib/Makefile
lib/sshmath/Makefile
lib/sshmath/tests/Makefile
lib/sshutil/Makefile
lib/sshutil/sshadt/Makefile
lib/sshutil/sshadt/tests/Makefile
lib/sshutil/sshcore/Makefile
lib/sshutil/ssheloop/Makefile
lib/sshutil/ssheloop/unix/Makefile
lib/sshutil/sshfsm/Makefile
lib/sshutil/sshmisc/Makefile
lib/sshutil/sshnet/Makefile
lib/sshutil/sshnet/unix/Makefile
lib/sshutil/ssholdadt/Makefile
lib/sshutil/sshpacketstream/Makefile
lib/sshutil/sshstream/Makefile
lib/sshutil/sshsysutil/Makefile
lib/sshutil/sshsysutil/unix/Makefile
lib/sshutil/sshstrutil/Makefile
lib/sshutil/sshtestutil/Makefile
lib/sshutil/tests/Makefile
lib/sshapputil/Makefile
lib/sshapputil/tests/Makefile
lib/sshcrypt/Makefile
lib/sshcrypt/tests/Makefile
lib/sshproto/Makefile
lib/sshproto/tests/Makefile
lib/sshsession/Makefile
lib/sshreadline/Makefile
lib/sshreadline/tests/Makefile
lib/sshpgp/Makefile
lib/sshpgp/tests/Makefile
lib/sshfilexfer/Makefile
lib/sshfilexfer/tests/Makefile
apps/Makefile
apps/ssh/Makefile
apps/ssh/tests/Makefile)
