blob: 9dce893a132e02fd8d8ed77f43918b14ab7816c9 [file] [log] [blame]
Tim Riceeae17cc2005-03-17 16:52:20 -08001# $Id: configure.ac,v 1.254 2005/03/18 00:52:21 tim Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker59f79c42004-09-30 21:17:08 +100017AC_INIT(OpenSSH, Portable)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080078
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110080if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100081 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110082fi
83
Tim Rice88368a32003-12-08 12:35:59 -080084AC_ARG_WITH(rpath,
85 [ --without-rpath Disable auto-added -R linker paths],
86 [
Tim Riceeae17cc2005-03-17 16:52:20 -080087 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -080088 need_dash_r=""
89 fi
90 if test "x$withval" = "xyes" ; then
91 need_dash_r=1
92 fi
93 ]
94)
95
Damien Millera22ba012000-03-02 23:09:20 +110096# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110097case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110098*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110099 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000100 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800101 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100102 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
108 fi
109 done
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
113 else
114 AC_MSG_RESULT($blibflags)
115 fi
116 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700119 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700121 LIBS="$LIBS -ls"
122 ])
123 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100124 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100125 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
126 passwdexpired], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000127 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100128 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
130 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000131 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000132 [(void)loginfailed("user","host","tty",0);],
133 [AC_MSG_RESULT(yes)
134 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000135 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000136 )],
137 [],
138 [#include <usersec.h>]
139 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000140 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100141 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000142 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000143 AC_DEFINE(SETEUID_BREAKS_SETUID)
144 AC_DEFINE(BROKEN_SETREUID)
145 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000146 dnl AIX handles lastlog as part of its login message
147 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000149 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100150 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100152 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800153 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100154 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000155 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100156 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100157 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000158 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000159 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700160 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100161 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000162*-*-dgux*)
163 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100164 AC_DEFINE(SETEUID_BREAKS_SETUID)
165 AC_DEFINE(BROKEN_SETREUID)
166 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000167 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000168*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000169 AC_MSG_CHECKING(if we have working getaddrinfo)
170 AC_TRY_RUN([#include <mach-o/dyld.h>
171main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
172 exit(0);
173 else
174 exit(1);
175}], [AC_MSG_RESULT(working)],
176 [AC_MSG_RESULT(buggy)
177 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700178 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000179 AC_DEFINE(SETEUID_BREAKS_SETUID)
180 AC_DEFINE(BROKEN_SETREUID)
181 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100182 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000183 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000184*-*-hpux10.26)
185 if test -z "$GCC"; then
186 CFLAGS="$CFLAGS -Ae"
187 fi
188 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
189 IPADDR_IN_DISPLAY=yes
190 AC_DEFINE(HAVE_SECUREWARE)
191 AC_DEFINE(USE_PIPES)
192 AC_DEFINE(LOGIN_NO_ENDOPT)
193 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000194 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000195 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700196 LIBS="$LIBS -lsec -lsecpw"
197 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000198 disable_ptmx_check=yes
199 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100200*-*-hpux10*)
201 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000202 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100203 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000204 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100205 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000206 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000207 AC_DEFINE(LOGIN_NO_ENDOPT)
208 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000209 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000210 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700211 LIBS="$LIBS -lsec"
212 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100213 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000214*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000215 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100216 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100217 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100218 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000219 AC_DEFINE(LOGIN_NO_ENDOPT)
220 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100221 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000222 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000223 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker2fba9932005-02-02 23:30:24 +1100224 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Darren Tucker4398cf52004-04-06 21:39:02 +1000225 check_for_hpux_broken_getaddrinfo=1
Darren Tuckera56f1912004-11-02 20:30:54 +1100226 check_for_conflicting_getspnam=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700227 LIBS="$LIBS -lsec"
228 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000229 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100230*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100231 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000232 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000233 AC_DEFINE(SETEUID_BREAKS_SETUID)
234 AC_DEFINE(BROKEN_SETREUID)
235 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000236 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000237 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100238 ;;
239*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100240 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000241 AC_DEFINE(WITH_IRIX_ARRAY)
242 AC_DEFINE(WITH_IRIX_PROJECT)
243 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000244 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000245 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000246 AC_DEFINE(SETEUID_BREAKS_SETUID)
247 AC_DEFINE(BROKEN_SETREUID)
248 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000249 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000250 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000251 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100252 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100253*-*-linux*)
254 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100255 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000256 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100257 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000258 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000259 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000260 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000261 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100262 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
263 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100264 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000265 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000266 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000267 AC_DEFINE(BROKEN_CMSG_TYPE)
268 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000269 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100270 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000271mips-sony-bsd|mips-sony-newsos4)
272 AC_DEFINE(HAVE_NEWS4)
273 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000274 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100275*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000276 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800277 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800278 need_dash_r=1
279 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100280 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100281*-*-freebsd*)
282 check_for_libcrypt_later=1
283 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000284*-*-bsdi*)
285 AC_DEFINE(SETEUID_BREAKS_SETUID)
286 AC_DEFINE(BROKEN_SETREUID)
287 AC_DEFINE(BROKEN_SETREGID)
288 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000289*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000290 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100291 conf_utmp_location=/etc/utmp
292 conf_wtmp_location=/usr/adm/wtmp
293 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000294 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000295 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000296 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100297 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000298 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100299*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800300 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800301 need_dash_r=1
302 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100303 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000304 AC_DEFINE(LOGIN_NEEDS_UTMPX)
305 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000306 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000307 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000308 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000309 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
310 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000311 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000312 # hardwire lastlog location (can't detect it on some versions)
313 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000314 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
315 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
316 if test "$sol2ver" -ge 8; then
317 AC_MSG_RESULT(yes)
318 AC_DEFINE(DISABLE_UTMP)
319 AC_DEFINE(DISABLE_WTMP)
320 else
321 AC_MSG_RESULT(no)
322 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100323 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000324*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000325 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000326 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100327 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000328 conf_utmp_location=/etc/utmp
329 conf_wtmp_location=/var/adm/wtmp
330 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000331 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000332 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000333*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700334 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000335 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000336 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000337 AC_DEFINE(SETEUID_BREAKS_SETUID)
338 AC_DEFINE(BROKEN_SETREUID)
339 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000340 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000341*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700342 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000343 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100344 # -lresolv needs to be at then end of LIBS or DNS lookups break
345 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100346 IPADDR_IN_DISPLAY=yes
347 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000348 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000349 AC_DEFINE(SETEUID_BREAKS_SETUID)
350 AC_DEFINE(BROKEN_SETREUID)
351 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000352 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000353 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700354 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
355 # Attention: always take care to bind libsocket and libnsl before libc,
356 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000357 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800358# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100359*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100360 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700361 AC_DEFINE(SETEUID_BREAKS_SETUID)
362 AC_DEFINE(BROKEN_SETREUID)
363 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100364 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800365# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100366*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100367 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700368 AC_DEFINE(SETEUID_BREAKS_SETUID)
369 AC_DEFINE(BROKEN_SETREUID)
370 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100371 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100372*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100373 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800374# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100375*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800376 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100377 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800378# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100379*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800380 if test -z "$GCC"; then
381 CFLAGS="$CFLAGS -belf"
382 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100383 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000384 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100385 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000386 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000387 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700388 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700389 AC_DEFINE(SETEUID_BREAKS_SETUID)
390 AC_DEFINE(BROKEN_SETREUID)
391 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700392 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700393 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100394 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100395 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700396 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700397 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000398 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000399*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100400 AC_DEFINE(NO_SSH_LASTLOG)
401 AC_DEFINE(SETEUID_BREAKS_SETUID)
402 AC_DEFINE(BROKEN_SETREUID)
403 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000404 AC_DEFINE(USE_PIPES)
405 AC_DEFINE(DISABLE_FD_PASSING)
406 LDFLAGS="$LDFLAGS"
407 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
408 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000409 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000410*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100411 AC_DEFINE(SETEUID_BREAKS_SETUID)
412 AC_DEFINE(BROKEN_SETREUID)
413 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000414 AC_DEFINE(WITH_ABBREV_NO_TTY)
415 AC_DEFINE(USE_PIPES)
416 AC_DEFINE(DISABLE_FD_PASSING)
417 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100418 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000419 MANTYPE=cat
420 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000421*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100422 AC_DEFINE(SETEUID_BREAKS_SETUID)
423 AC_DEFINE(BROKEN_SETREUID)
424 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000425 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700426 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700427 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000428 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
429 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
430 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700431 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000432*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000433 AC_MSG_CHECKING(for Digital Unix SIA)
434 no_osfsia=""
435 AC_ARG_WITH(osfsia,
436 [ --with-osfsia Enable Digital Unix SIA],
437 [
438 if test "x$withval" = "xno" ; then
439 AC_MSG_RESULT(disabled)
440 no_osfsia=1
441 fi
442 ],
443 )
444 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000445 if test -f /etc/sia/matrix.conf; then
446 AC_MSG_RESULT(yes)
447 AC_DEFINE(HAVE_OSF_SIA)
448 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000449 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000450 LIBS="$LIBS -lsecurity -ldb -lm -laud"
451 else
452 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100453 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000454 fi
455 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000456 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700457 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000458 AC_DEFINE(BROKEN_SETREUID)
459 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000460 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000461
462*-*-nto-qnx)
463 AC_DEFINE(USE_PIPES)
464 AC_DEFINE(NO_X11_UNIX_SOCKETS)
465 AC_DEFINE(MISSING_NFDBITS)
466 AC_DEFINE(MISSING_HOWMANY)
467 AC_DEFINE(MISSING_FD_MASK)
468 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100469esac
470
Damien Millere37bfc12000-06-05 09:37:43 +1000471# Allow user to specify flags
472AC_ARG_WITH(cflags,
473 [ --with-cflags Specify additional flags to pass to compiler],
474 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800475 if test -n "$withval" && test "x$withval" != "xno" && \
476 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000477 CFLAGS="$CFLAGS $withval"
478 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800479 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000480)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000481AC_ARG_WITH(cppflags,
482 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
483 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800484 if test -n "$withval" && test "x$withval" != "xno" && \
485 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000486 CPPFLAGS="$CPPFLAGS $withval"
487 fi
488 ]
489)
Damien Millere37bfc12000-06-05 09:37:43 +1000490AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000491 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000492 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800493 if test -n "$withval" && test "x$withval" != "xno" && \
494 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000495 LDFLAGS="$LDFLAGS $withval"
496 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800497 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000498)
499AC_ARG_WITH(libs,
500 [ --with-libs Specify additional libraries to link with],
501 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800502 if test -n "$withval" && test "x$withval" != "xno" && \
503 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000504 LIBS="$LIBS $withval"
505 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800506 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000507)
508
Darren Tucker6eb93042003-06-29 21:30:41 +1000509AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000510AC_RUN_IFELSE(
511 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000512#include <stdio.h>
513int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000514 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000515 [ AC_MSG_RESULT(yes) ],
516 [
517 AC_MSG_RESULT(no)
518 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000519 ],
520 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000521)
522
Tim Rice4cec93f2002-02-26 08:40:48 -0800523# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000524AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
525 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
526 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100527 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000528 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000529 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
530 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000531 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000532 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
533 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800534
Darren Tucker48d99d32004-08-29 17:04:50 +1000535# sys/ptms.h requires sys/stream.h to be included first on Solaris
536AC_CHECK_HEADERS(sys/ptms.h, [], [], [
537#ifdef HAVE_SYS_STREAM_H
538# include <sys/stream.h>
539#endif
540])
541
Damien Millera22ba012000-03-02 23:09:20 +1100542# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700543AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
544AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000545
Tim Rice1e1ef642003-09-11 22:19:31 -0700546dnl IRIX and Solaris 2.5.1 have dirname() in libgen
547AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
548 AC_CHECK_LIB(gen, dirname,[
549 AC_CACHE_CHECK([for broken dirname],
550 ac_cv_have_broken_dirname, [
551 save_LIBS="$LIBS"
552 LIBS="$LIBS -lgen"
553 AC_TRY_RUN(
554 [
555#include <libgen.h>
556#include <string.h>
557
558int main(int argc, char **argv) {
559 char *s, buf[32];
560
561 strncpy(buf,"/etc", 32);
562 s = dirname(buf);
563 if (!s || strncmp(s, "/", 32) != 0) {
564 exit(1);
565 } else {
566 exit(0);
567 }
568}
569 ],
570 [ ac_cv_have_broken_dirname="no" ],
571 [ ac_cv_have_broken_dirname="yes" ]
572 )
573 LIBS="$save_LIBS"
574 ])
575 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
576 LIBS="$LIBS -lgen"
577 AC_DEFINE(HAVE_DIRNAME)
578 AC_CHECK_HEADERS(libgen.h)
579 fi
580 ])
581])
582
583AC_CHECK_FUNC(getspnam, ,
584 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
585AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
586
Tim Rice13aae5e2001-10-21 17:53:58 -0700587dnl zlib is required
588AC_ARG_WITH(zlib,
589 [ --with-zlib=PATH Use zlib in PATH],
590 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000591 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100592 AC_MSG_ERROR([*** zlib is required ***])
593 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700594 if test -d "$withval/lib"; then
595 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700596 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700597 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700598 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700599 fi
600 else
601 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700602 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700603 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700604 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700605 fi
606 fi
607 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700608 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700609 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700610 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700611 fi
612 ]
613)
614
Tim Ricefcb62202004-01-23 18:35:16 -0800615AC_CHECK_LIB(z, deflate, ,
616 [
617 saved_CPPFLAGS="$CPPFLAGS"
618 saved_LDFLAGS="$LDFLAGS"
619 save_LIBS="$LIBS"
620 dnl Check default zlib install dir
621 if test -n "${need_dash_r}"; then
622 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
623 else
624 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
625 fi
626 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
627 LIBS="$LIBS -lz"
628 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
629 [
630 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
631 ]
632 )
633 ]
634)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100635AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100636
637AC_ARG_WITH(zlib-version-check,
638 [ --without-zlib-version-check Disable zlib version check],
639 [ if test "x$withval" = "xno" ; then
640 zlib_check_nonfatal=1
641 fi
642 ]
643)
644
Darren Tucker2dcd2392004-01-23 17:13:33 +1100645AC_MSG_CHECKING(for zlib 1.1.4 or greater)
Darren Tucker623d92f2004-09-12 22:36:15 +1000646AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2dcd2392004-01-23 17:13:33 +1100647#include <zlib.h>
648int main()
649{
650 int a, b, c, v;
651 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
652 exit(1);
653 v = a*1000000 + b*1000 + c;
654 if (v >= 1001004)
655 exit(0);
656 exit(2);
657}
Darren Tucker623d92f2004-09-12 22:36:15 +1000658 ]])],
Darren Tucker2dcd2392004-01-23 17:13:33 +1100659 AC_MSG_RESULT(yes),
660 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100661 if test -z "$zlib_check_nonfatal" ; then
662 AC_MSG_ERROR([*** zlib too old - check config.log ***
663Your reported zlib version has known security problems. It's possible your
664vendor has fixed these problems without changing the version number. If you
665are sure this is the case, you can disable the check by running
666"./configure --without-zlib-version-check".
667If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
668 else
669 AC_MSG_WARN([zlib version may have security problems])
670 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000671 ],
672 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100673)
Damien Miller6f9c3372000-10-25 10:06:04 +1100674
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000675dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100676AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000677 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
678)
Damien Millera8e06ce2003-11-21 23:48:55 +1100679AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700680 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
681 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000682)
Damien Millerab18c411999-11-11 10:40:23 +1100683
Tim Ricee589a292001-11-03 11:09:32 -0800684dnl Checks for libutil functions
685AC_CHECK_HEADERS(libutil.h)
686AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
687AC_CHECK_FUNCS(logout updwtmp logwtmp)
688
Ben Lindstrom8697e082001-02-24 21:41:10 +0000689AC_FUNC_STRFTIME
690
Damien Miller3c027682001-03-14 11:39:45 +1100691# Check for ALTDIRFUNC glob() extension
692AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
693AC_EGREP_CPP(FOUNDIT,
694 [
695 #include <glob.h>
696 #ifdef GLOB_ALTDIRFUNC
697 FOUNDIT
698 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100699 ],
Damien Miller3c027682001-03-14 11:39:45 +1100700 [
701 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
702 AC_MSG_RESULT(yes)
703 ],
704 [
705 AC_MSG_RESULT(no)
706 ]
707)
Damien Millerab18c411999-11-11 10:40:23 +1100708
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000709# Check for g.gl_matchc glob() extension
710AC_MSG_CHECKING(for gl_matchc field in glob_t)
711AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100712 [
713 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000714 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100715 ],
716 [
717 AC_DEFINE(GLOB_HAS_GL_MATCHC)
718 AC_MSG_RESULT(yes)
719 ],
720 [
721 AC_MSG_RESULT(no)
722 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000723)
724
Damien Miller18bb4732001-03-28 14:35:30 +1000725AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000726AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000727 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000728#include <sys/types.h>
729#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700730int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000731 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100732 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000733 [
734 AC_MSG_RESULT(no)
735 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000736 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800737 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000738 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
739 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000740 ]
741)
742
Damien Miller36f49652004-08-15 18:40:59 +1000743AC_MSG_CHECKING([for /proc/pid/fd directory])
744if test -d "/proc/$$/fd" ; then
745 AC_DEFINE(HAVE_PROC_PID)
746 AC_MSG_RESULT(yes)
747else
748 AC_MSG_RESULT(no)
749fi
750
Damien Millerc547bf12001-02-16 10:18:12 +1100751# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100752SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100753AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100754 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100755 [
756 if test "x$withval" != "xno" ; then
757
758 if test "x$withval" != "xyes" ; then
759 CPPFLAGS="$CPPFLAGS -I${withval}/include"
760 LDFLAGS="$LDFLAGS -L${withval}/lib"
761 fi
762
763 AC_DEFINE(SKEY)
764 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100765 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800766
Tim Rice4cec93f2002-02-26 08:40:48 -0800767 AC_MSG_CHECKING([for s/key support])
768 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100769 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800770#include <stdio.h>
771#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700772int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800773 ],
774 [AC_MSG_RESULT(yes)],
775 [
776 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100777 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
778 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000779 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
780 AC_TRY_COMPILE(
781 [#include <stdio.h>
782 #include <skey.h>],
783 [(void)skeychallenge(NULL,"name","",0);],
784 [AC_MSG_RESULT(yes)
785 AC_DEFINE(SKEYCHALLENGE_4ARG)],
786 [AC_MSG_RESULT(no)]
787 )
Damien Millerc547bf12001-02-16 10:18:12 +1100788 fi
789 ]
790)
791
792# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700793TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100794AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100795 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100796 [
797 if test "x$withval" != "xno" ; then
798 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700799 saved_LDFLAGS="$LDFLAGS"
800 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800801 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800802 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700803 if test -d "${withval}/lib"; then
804 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700805 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700806 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700807 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700808 fi
809 else
810 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700811 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700812 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700813 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700814 fi
815 fi
816 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700821 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800822 LIBWRAP="-lwrap"
823 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100824 AC_MSG_CHECKING(for libwrap)
825 AC_TRY_LINK(
826 [
Damien Miller0ac45002004-04-14 20:14:26 +1000827#include <sys/types.h>
828#include <sys/socket.h>
829#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100830#include <tcpd.h>
831 int deny_severity = 0, allow_severity = 0;
832 ],
833 [hosts_access(0);],
834 [
835 AC_MSG_RESULT(yes)
836 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800837 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700838 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100839 ],
840 [
841 AC_MSG_ERROR([*** libwrap missing])
842 ]
843 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800844 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100845 fi
846 ]
847)
848
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100849# Check whether user wants libedit support
850LIBEDIT_MSG="no"
851AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100852 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100853 [ if test "x$withval" != "xno" ; then
854 AC_CHECK_LIB(edit, el_init,
855 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
856 LIBEDIT="-ledit -lcurses"
857 LIBEDIT_MSG="yes"
858 AC_SUBST(LIBEDIT)
859 ],
860 [], [-lcurses]
861 )
862 fi ]
863)
864
Darren Tuckerd9f88912005-02-20 21:01:48 +1100865AUDIT_MODULE=none
866AC_ARG_WITH(audit,
867 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
868 [
869 AC_MSG_CHECKING(for supported audit module)
870 case "$withval" in
871 bsm)
872 AC_MSG_RESULT(bsm)
873 AUDIT_MODULE=bsm
874 dnl Checks for headers, libs and functions
875 AC_CHECK_HEADERS(bsm/audit.h, [],
876 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
877 AC_CHECK_LIB(bsm, getaudit, [],
878 [AC_MSG_ERROR(BSM enabled and required library not found)])
879 AC_CHECK_FUNCS(getaudit, [],
880 [AC_MSG_ERROR(BSM enabled and required function not found)])
881 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100882 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100883 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
884 ;;
885 debug)
886 AUDIT_MODULE=debug
887 AC_MSG_RESULT(debug)
888 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
889 ;;
890 *)
891 AC_MSG_ERROR([Unknown audit module $withval])
892 ;;
893 esac ]
894)
895
Damien Millerfe1f1432003-02-24 15:45:42 +1100896dnl Checks for library functions. Please keep in alphabetical order
897AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000898 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Darren Tuckerad7646a2005-02-02 10:43:59 +1100899 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
900 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
901 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100902 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000903 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100904 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000905 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100906 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000907 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000908 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100909 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100910)
Tim Rice13aae5e2001-10-21 17:53:58 -0700911
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000912# IRIX has a const char return value for gai_strerror()
913AC_CHECK_FUNCS(gai_strerror,[
914 AC_DEFINE(HAVE_GAI_STRERROR)
915 AC_TRY_COMPILE([
916#include <sys/types.h>
917#include <sys/socket.h>
918#include <netdb.h>
919
920const char *gai_strerror(int);],[
921char *str;
922
923str = gai_strerror(0);],[
924 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
925 [Define if gai_strerror() returns const char *])])])
926
Damien Millercd6853c2003-01-28 11:33:42 +1100927AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
928
Darren Tuckerf1159b52003-07-07 19:44:01 +1000929dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000930AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000931AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000932
Darren Tuckerb2427c82003-09-10 15:22:44 +1000933dnl tcsendbreak might be a macro
934AC_CHECK_DECL(tcsendbreak,
935 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100936 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000937 [#include <termios.h>]
938)
939
Darren Tucker5bb14002004-04-23 18:53:10 +1000940AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
941
Darren Tucker2a6b0292003-12-31 14:59:17 +1100942AC_CHECK_FUNCS(setresuid, [
943 dnl Some platorms have setresuid that isn't implemented, test for this
944 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000945 AC_RUN_IFELSE(
946 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100947#include <stdlib.h>
948#include <errno.h>
949int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000950 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100951 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100952 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000953 AC_MSG_RESULT(not implemented)],
954 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100955 )
956])
Darren Tuckere937be32003-12-17 18:53:26 +1100957
Darren Tucker2a6b0292003-12-31 14:59:17 +1100958AC_CHECK_FUNCS(setresgid, [
959 dnl Some platorms have setresgid that isn't implemented, test for this
960 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000961 AC_RUN_IFELSE(
962 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100963#include <stdlib.h>
964#include <errno.h>
965int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000966 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100967 [AC_MSG_RESULT(yes)],
968 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000969 AC_MSG_RESULT(not implemented)],
970 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100971 )
972])
Darren Tuckere937be32003-12-17 18:53:26 +1100973
Damien Millerad833b32000-08-23 10:46:23 +1000974dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000975AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000976dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000977AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000978AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000979dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000980AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000981AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100982
Damien Millera8e06ce2003-11-21 23:48:55 +1100983AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100984 [AC_DEFINE(HAVE_DAEMON)],
985 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
986)
987
Damien Millera8e06ce2003-11-21 23:48:55 +1100988AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100989 [AC_DEFINE(HAVE_GETPAGESIZE)],
990 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
991)
992
Damien Millercb170cb2000-07-01 16:52:55 +1000993# Check for broken snprintf
994if test "x$ac_cv_func_snprintf" = "xyes" ; then
995 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000996 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000997 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +1000998#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700999int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001000 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001001 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001002 [
1003 AC_MSG_RESULT(no)
1004 AC_DEFINE(BROKEN_SNPRINTF)
1005 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001006 ],
1007 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001008 )
1009fi
1010
Damien Millerb4097182004-05-23 14:09:40 +10001011# Check for missing getpeereid (or equiv) support
1012NO_PEERCHECK=""
1013if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1014 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1015 AC_TRY_COMPILE(
1016 [#include <sys/types.h>
1017 #include <sys/socket.h>],
1018 [int i = SO_PEERCRED;],
1019 [AC_MSG_RESULT(yes)],
1020 [AC_MSG_RESULT(no)
1021 NO_PEERCHECK=1]
1022 )
1023fi
1024
Damien Millere8328192003-01-07 15:18:32 +11001025dnl see whether mkstemp() requires XXXXXX
1026if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1027AC_MSG_CHECKING([for (overly) strict mkstemp])
1028AC_TRY_RUN(
1029 [
1030#include <stdlib.h>
1031main() { char template[]="conftest.mkstemp-test";
1032if (mkstemp(template) == -1)
1033 exit(1);
1034unlink(template); exit(0);
1035}
1036 ],
1037 [
1038 AC_MSG_RESULT(no)
1039 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001040 [
Damien Millere8328192003-01-07 15:18:32 +11001041 AC_MSG_RESULT(yes)
1042 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1043 ],
1044 [
1045 AC_MSG_RESULT(yes)
1046 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001047 ]
Damien Millere8328192003-01-07 15:18:32 +11001048)
1049fi
1050
Darren Tucker70a3d552003-08-21 17:58:29 +10001051dnl make sure that openpty does not reacquire controlling terminal
1052if test ! -z "$check_for_openpty_ctty_bug"; then
1053 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1054 AC_TRY_RUN(
1055 [
1056#include <stdio.h>
1057#include <sys/fcntl.h>
1058#include <sys/types.h>
1059#include <sys/wait.h>
1060
1061int
1062main()
1063{
1064 pid_t pid;
1065 int fd, ptyfd, ttyfd, status;
1066
1067 pid = fork();
1068 if (pid < 0) { /* failed */
1069 exit(1);
1070 } else if (pid > 0) { /* parent */
1071 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001072 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001073 exit(WEXITSTATUS(status));
1074 else
1075 exit(2);
1076 } else { /* child */
1077 close(0); close(1); close(2);
1078 setsid();
1079 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1080 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1081 if (fd >= 0)
1082 exit(3); /* Acquired ctty: broken */
1083 else
1084 exit(0); /* Did not acquire ctty: OK */
1085 }
1086}
1087 ],
1088 [
1089 AC_MSG_RESULT(yes)
1090 ],
1091 [
1092 AC_MSG_RESULT(no)
1093 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1094 ]
1095 )
1096fi
1097
Tim Rice8bb561b2005-03-17 16:23:19 -08001098if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1099 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001100 AC_MSG_CHECKING(if getaddrinfo seems to work)
1101 AC_TRY_RUN(
1102 [
1103#include <stdio.h>
1104#include <sys/socket.h>
1105#include <netdb.h>
1106#include <errno.h>
1107#include <netinet/in.h>
1108
1109#define TEST_PORT "2222"
1110
1111int
1112main(void)
1113{
1114 int err, sock;
1115 struct addrinfo *gai_ai, *ai, hints;
1116 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1117
1118 memset(&hints, 0, sizeof(hints));
1119 hints.ai_family = PF_UNSPEC;
1120 hints.ai_socktype = SOCK_STREAM;
1121 hints.ai_flags = AI_PASSIVE;
1122
1123 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1124 if (err != 0) {
1125 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1126 exit(1);
1127 }
1128
1129 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1130 if (ai->ai_family != AF_INET6)
1131 continue;
1132
1133 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1134 sizeof(ntop), strport, sizeof(strport),
1135 NI_NUMERICHOST|NI_NUMERICSERV);
1136
1137 if (err != 0) {
1138 if (err == EAI_SYSTEM)
1139 perror("getnameinfo EAI_SYSTEM");
1140 else
1141 fprintf(stderr, "getnameinfo failed: %s\n",
1142 gai_strerror(err));
1143 exit(2);
1144 }
1145
1146 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1147 if (sock < 0)
1148 perror("socket");
1149 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1150 if (errno == EBADF)
1151 exit(3);
1152 }
1153 }
1154 exit(0);
1155}
1156 ],
1157 [
1158 AC_MSG_RESULT(yes)
1159 ],
1160 [
1161 AC_MSG_RESULT(no)
1162 AC_DEFINE(BROKEN_GETADDRINFO)
1163 ]
1164 )
1165fi
1166
Tim Rice8bb561b2005-03-17 16:23:19 -08001167if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1168 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001169 AC_MSG_CHECKING(if getaddrinfo seems to work)
1170 AC_TRY_RUN(
1171 [
1172#include <stdio.h>
1173#include <sys/socket.h>
1174#include <netdb.h>
1175#include <errno.h>
1176#include <netinet/in.h>
1177
1178#define TEST_PORT "2222"
1179
1180int
1181main(void)
1182{
1183 int err, sock;
1184 struct addrinfo *gai_ai, *ai, hints;
1185 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1186
1187 memset(&hints, 0, sizeof(hints));
1188 hints.ai_family = PF_UNSPEC;
1189 hints.ai_socktype = SOCK_STREAM;
1190 hints.ai_flags = AI_PASSIVE;
1191
1192 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1193 if (err != 0) {
1194 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1195 exit(1);
1196 }
1197
1198 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1199 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1200 continue;
1201
1202 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1203 sizeof(ntop), strport, sizeof(strport),
1204 NI_NUMERICHOST|NI_NUMERICSERV);
1205
1206 if (ai->ai_family == AF_INET && err != 0) {
1207 perror("getnameinfo");
1208 exit(2);
1209 }
1210 }
1211 exit(0);
1212}
1213 ],
1214 [
1215 AC_MSG_RESULT(yes)
1216 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1217[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1218 ],
1219 [
1220 AC_MSG_RESULT(no)
1221 AC_DEFINE(BROKEN_GETADDRINFO)
1222 ]
1223 )
1224fi
1225
Darren Tuckera56f1912004-11-02 20:30:54 +11001226if test "x$check_for_conflicting_getspnam" = "x1"; then
1227 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1228 AC_COMPILE_IFELSE(
1229 [
1230#include <shadow.h>
1231int main(void) {exit(0);}
1232 ],
1233 [
1234 AC_MSG_RESULT(no)
1235 ],
1236 [
1237 AC_MSG_RESULT(yes)
1238 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1239 [Conflicting defs for getspnam])
1240 ]
1241 )
1242fi
1243
Damien Miller606f8802000-09-16 15:39:56 +11001244AC_FUNC_GETPGRP
1245
Damien Millera64b57a2001-01-17 10:44:13 +11001246# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001247PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001248AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001249 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001250 [
Damien Millera64b57a2001-01-17 10:44:13 +11001251 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001252 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1253 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001254 AC_MSG_ERROR([PAM headers not found])
1255 fi
1256
1257 AC_CHECK_LIB(dl, dlopen, , )
1258 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1259 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001260 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001261
Damien Millera64b57a2001-01-17 10:44:13 +11001262 PAM_MSG="yes"
1263
1264 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001265 if test $ac_cv_lib_dl_dlopen = yes; then
1266 LIBPAM="-lpam -ldl"
1267 else
1268 LIBPAM="-lpam"
1269 fi
1270 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001271 fi
1272 ]
1273)
Damien Millera22ba012000-03-02 23:09:20 +11001274
Damien Millera64b57a2001-01-17 10:44:13 +11001275# Check for older PAM
1276if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001277 # Check PAM strerror arguments (old PAM)
1278 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1279 AC_TRY_COMPILE(
1280 [
Damien Miller81171112000-04-23 11:14:01 +10001281#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001282#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001283#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001284#elif defined (HAVE_PAM_PAM_APPL_H)
1285#include <pam/pam_appl.h>
1286#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001287 ],
1288 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001289 [AC_MSG_RESULT(no)],
1290 [
1291 AC_DEFINE(HAVE_OLD_PAM)
1292 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001293 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001294 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001295 )
Damien Millera22ba012000-03-02 23:09:20 +11001296fi
1297
Tim Riceaef73712002-05-11 13:17:42 -07001298# Search for OpenSSL
1299saved_CPPFLAGS="$CPPFLAGS"
1300saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001301AC_ARG_WITH(ssl-dir,
1302 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1303 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001304 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001305 case "$withval" in
1306 # Relative paths
1307 ./*|../*) withval="`pwd`/$withval"
1308 esac
Tim Riceaef73712002-05-11 13:17:42 -07001309 if test -d "$withval/lib"; then
1310 if test -n "${need_dash_r}"; then
1311 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1312 else
1313 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1314 fi
1315 else
1316 if test -n "${need_dash_r}"; then
1317 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1318 else
1319 LDFLAGS="-L${withval} ${LDFLAGS}"
1320 fi
1321 fi
1322 if test -d "$withval/include"; then
1323 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1324 else
1325 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1326 fi
Damien Millera22ba012000-03-02 23:09:20 +11001327 fi
1328 ]
1329)
Tim Rice3d5352e2004-02-12 09:27:21 -08001330LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001331AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001332 [
Tim Riceaef73712002-05-11 13:17:42 -07001333 dnl Check default openssl install dir
1334 if test -n "${need_dash_r}"; then
1335 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001336 else
Tim Riceaef73712002-05-11 13:17:42 -07001337 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001338 fi
Tim Riceaef73712002-05-11 13:17:42 -07001339 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1340 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1341 [
1342 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1343 ]
1344 )
1345 ]
1346)
1347
Tim Riced730b782002-08-13 18:52:10 -07001348# Determine OpenSSL header version
1349AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001350AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001351 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001352#include <stdio.h>
1353#include <string.h>
1354#include <openssl/opensslv.h>
1355#define DATA "conftest.sslincver"
1356int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001357 FILE *fd;
1358 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001359
Damien Millera8e06ce2003-11-21 23:48:55 +11001360 fd = fopen(DATA,"w");
1361 if(fd == NULL)
1362 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001363
1364 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1365 exit(1);
1366
1367 exit(0);
1368}
Darren Tucker623d92f2004-09-12 22:36:15 +10001369 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001370 [
1371 ssl_header_ver=`cat conftest.sslincver`
1372 AC_MSG_RESULT($ssl_header_ver)
1373 ],
1374 [
1375 AC_MSG_RESULT(not found)
1376 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001377 ],
1378 [
1379 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001380 ]
1381)
1382
1383# Determine OpenSSL library version
1384AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001385AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001386 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001387#include <stdio.h>
1388#include <string.h>
1389#include <openssl/opensslv.h>
1390#include <openssl/crypto.h>
1391#define DATA "conftest.ssllibver"
1392int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001393 FILE *fd;
1394 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001395
Damien Millera8e06ce2003-11-21 23:48:55 +11001396 fd = fopen(DATA,"w");
1397 if(fd == NULL)
1398 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001399
1400 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1401 exit(1);
1402
1403 exit(0);
1404}
Darren Tucker623d92f2004-09-12 22:36:15 +10001405 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001406 [
1407 ssl_library_ver=`cat conftest.ssllibver`
1408 AC_MSG_RESULT($ssl_library_ver)
1409 ],
1410 [
1411 AC_MSG_RESULT(not found)
1412 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001413 ],
1414 [
1415 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001416 ]
1417)
Damien Millera22ba012000-03-02 23:09:20 +11001418
Damien Millerec932372002-01-22 22:16:03 +11001419# Sanity check OpenSSL headers
1420AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001421AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001422 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001423#include <string.h>
1424#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001425int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001426 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001427 [
1428 AC_MSG_RESULT(yes)
1429 ],
1430 [
1431 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001432 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1433Check config.log for details.
1434Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001435 ],
1436 [
1437 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001438 ]
1439)
1440
Tim Rice3d5352e2004-02-12 09:27:21 -08001441# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1442# because the system crypt() is more featureful.
1443if test "x$check_for_libcrypt_before" = "x1"; then
1444 AC_CHECK_LIB(crypt, crypt)
1445fi
1446
Damien Millera8e06ce2003-11-21 23:48:55 +11001447# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001448# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001449if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001450 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001451fi
1452
Damien Miller6c21c512002-01-22 21:57:53 +11001453
1454### Configure cryptographic random number support
1455
1456# Check wheter OpenSSL seeds itself
1457AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001458AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001459 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001460#include <string.h>
1461#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001462int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001463 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001464 [
1465 OPENSSL_SEEDS_ITSELF=yes
1466 AC_MSG_RESULT(yes)
1467 ],
1468 [
1469 AC_MSG_RESULT(no)
1470 # Default to use of the rand helper if OpenSSL doesn't
1471 # seed itself
1472 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001473 ],
1474 [
1475 AC_MSG_WARN([cross compiling: assuming yes])
1476 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001477 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001478 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001479 ]
1480)
1481
1482
1483# Do we want to force the use of the rand helper?
1484AC_ARG_WITH(rand-helper,
1485 [ --with-rand-helper Use subprocess to gather strong randomness ],
1486 [
1487 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001488 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001489 # the previous test showed it to be unseeded.
1490 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1491 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1492 OPENSSL_SEEDS_ITSELF=yes
1493 USE_RAND_HELPER=""
1494 fi
1495 else
1496 USE_RAND_HELPER=yes
1497 fi
1498 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001499)
Damien Miller6c21c512002-01-22 21:57:53 +11001500
1501# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001502if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001503 # OpenSSL only
1504 AC_DEFINE(OPENSSL_PRNG_ONLY)
1505 RAND_MSG="OpenSSL internal ONLY"
1506 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001507elif test ! -z "$USE_RAND_HELPER" ; then
1508 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001509 RAND_MSG="ssh-rand-helper"
1510 INSTALL_SSH_RAND_HELPER="yes"
1511fi
1512AC_SUBST(INSTALL_SSH_RAND_HELPER)
1513
1514### Configuration of ssh-rand-helper
1515
1516# PRNGD TCP socket
1517AC_ARG_WITH(prngd-port,
1518 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1519 [
Damien Millere996d722002-01-23 11:20:59 +11001520 case "$withval" in
1521 no)
1522 withval=""
1523 ;;
1524 [[0-9]]*)
1525 ;;
1526 *)
1527 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1528 ;;
1529 esac
1530 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001531 PRNGD_PORT="$withval"
1532 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1533 fi
1534 ]
1535)
1536
1537# PRNGD Unix domain socket
1538AC_ARG_WITH(prngd-socket,
1539 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1540 [
Damien Millere996d722002-01-23 11:20:59 +11001541 case "$withval" in
1542 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001543 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001544 ;;
1545 no)
1546 withval=""
1547 ;;
1548 /*)
1549 ;;
1550 *)
1551 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1552 ;;
1553 esac
1554
1555 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001556 if test ! -z "$PRNGD_PORT" ; then
1557 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1558 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001559 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001560 AC_MSG_WARN(Entropy socket is not readable)
1561 fi
1562 PRNGD_SOCKET="$withval"
1563 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1564 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001565 ],
1566 [
1567 # Check for existing socket only if we don't have a random device already
1568 if test "$USE_RAND_HELPER" = yes ; then
1569 AC_MSG_CHECKING(for PRNGD/EGD socket)
1570 # Insert other locations here
1571 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1572 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1573 PRNGD_SOCKET="$sock"
1574 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1575 break;
1576 fi
1577 done
1578 if test ! -z "$PRNGD_SOCKET" ; then
1579 AC_MSG_RESULT($PRNGD_SOCKET)
1580 else
1581 AC_MSG_RESULT(not found)
1582 fi
1583 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001584 ]
1585)
1586
1587# Change default command timeout for hashing entropy source
1588entropy_timeout=200
1589AC_ARG_WITH(entropy-timeout,
1590 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1591 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001592 if test -n "$withval" && test "x$withval" != "xno" && \
1593 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001594 entropy_timeout=$withval
1595 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001596 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001597)
Damien Miller6c21c512002-01-22 21:57:53 +11001598AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1599
Damien Millerd3f6ad22002-06-25 10:24:47 +10001600SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001601AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001602 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001603 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001604 if test -n "$withval" && test "x$withval" != "xno" && \
1605 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001606 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001607 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001608 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001609)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001610AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1611AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001612
Tim Rice88f2ab52002-03-17 12:17:34 -08001613# We do this little dance with the search path to insure
1614# that programs that we select for use by installed programs
1615# (which may be run by the super-user) come from trusted
1616# locations before they come from the user's private area.
1617# This should help avoid accidentally configuring some
1618# random version of a program in someone's personal bin.
1619
1620OPATH=$PATH
1621PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001622test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001623test -d /sbin && PATH=$PATH:/sbin
1624test -d /usr/sbin && PATH=$PATH:/usr/sbin
1625PATH=$PATH:/etc:$OPATH
1626
Damien Millera8e06ce2003-11-21 23:48:55 +11001627# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001628OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1629OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1630OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1631OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1632OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1633OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1634OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1635OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1636OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1637OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1638OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1639OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1640OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1641OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1642OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1643OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001644# restore PATH
1645PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001646
1647# Where does ssh-rand-helper get its randomness from?
1648INSTALL_SSH_PRNG_CMDS=""
1649if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1650 if test ! -z "$PRNGD_PORT" ; then
1651 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1652 elif test ! -z "$PRNGD_SOCKET" ; then
1653 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1654 else
1655 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1656 RAND_HELPER_CMDHASH=yes
1657 INSTALL_SSH_PRNG_CMDS="yes"
1658 fi
1659fi
1660AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1661
1662
Ben Lindstromb5628642000-10-18 00:02:25 +00001663# Cheap hack to ensure NEWS-OS libraries are arranged right.
1664if test ! -z "$SONY" ; then
1665 LIBS="$LIBS -liberty";
1666fi
1667
Damien Millera22ba012000-03-02 23:09:20 +11001668# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001669AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001670AC_CHECK_SIZEOF(short int, 2)
1671AC_CHECK_SIZEOF(int, 4)
1672AC_CHECK_SIZEOF(long int, 4)
1673AC_CHECK_SIZEOF(long long int, 8)
1674
Damien Millerfa2bb692002-04-23 23:22:25 +10001675# Sanity check long long for some platforms (AIX)
1676if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1677 ac_cv_sizeof_long_long_int=0
1678fi
1679
Damien Millera22ba012000-03-02 23:09:20 +11001680# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001681AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1682 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001683 [ #include <sys/types.h> ],
1684 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001685 [ ac_cv_have_u_int="yes" ],
1686 [ ac_cv_have_u_int="no" ]
1687 )
1688])
1689if test "x$ac_cv_have_u_int" = "xyes" ; then
1690 AC_DEFINE(HAVE_U_INT)
1691 have_u_int=1
1692fi
1693
Damien Miller61e50f12000-05-08 20:49:37 +10001694AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1695 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001696 [ #include <sys/types.h> ],
1697 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001698 [ ac_cv_have_intxx_t="yes" ],
1699 [ ac_cv_have_intxx_t="no" ]
1700 )
1701])
1702if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1703 AC_DEFINE(HAVE_INTXX_T)
1704 have_intxx_t=1
1705fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001706
1707if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001708 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001709then
1710 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1711 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001712 [ #include <stdint.h> ],
1713 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001714 [
1715 AC_DEFINE(HAVE_INTXX_T)
1716 AC_MSG_RESULT(yes)
1717 ],
1718 [ AC_MSG_RESULT(no) ]
1719 )
1720fi
1721
Damien Miller578783e2000-09-23 14:12:24 +11001722AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1723 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001724 [
1725#include <sys/types.h>
1726#ifdef HAVE_STDINT_H
1727# include <stdint.h>
1728#endif
1729#include <sys/socket.h>
1730#ifdef HAVE_SYS_BITYPES_H
1731# include <sys/bitypes.h>
1732#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001733 ],
1734 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001735 [ ac_cv_have_int64_t="yes" ],
1736 [ ac_cv_have_int64_t="no" ]
1737 )
1738])
1739if test "x$ac_cv_have_int64_t" = "xyes" ; then
1740 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001741fi
1742
Damien Miller61e50f12000-05-08 20:49:37 +10001743AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1744 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001745 [ #include <sys/types.h> ],
1746 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001747 [ ac_cv_have_u_intxx_t="yes" ],
1748 [ ac_cv_have_u_intxx_t="no" ]
1749 )
1750])
1751if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1752 AC_DEFINE(HAVE_U_INTXX_T)
1753 have_u_intxx_t=1
1754fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001755
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001756if test -z "$have_u_intxx_t" ; then
1757 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1758 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001759 [ #include <sys/socket.h> ],
1760 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001761 [
1762 AC_DEFINE(HAVE_U_INTXX_T)
1763 AC_MSG_RESULT(yes)
1764 ],
1765 [ AC_MSG_RESULT(no) ]
1766 )
1767fi
1768
Damien Miller578783e2000-09-23 14:12:24 +11001769AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1770 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001771 [ #include <sys/types.h> ],
1772 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001773 [ ac_cv_have_u_int64_t="yes" ],
1774 [ ac_cv_have_u_int64_t="no" ]
1775 )
1776])
1777if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1778 AC_DEFINE(HAVE_U_INT64_T)
1779 have_u_int64_t=1
1780fi
1781
Tim Rice4cec93f2002-02-26 08:40:48 -08001782if test -z "$have_u_int64_t" ; then
1783 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1784 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001785 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001786 [ u_int64_t a; a = 1],
1787 [
1788 AC_DEFINE(HAVE_U_INT64_T)
1789 AC_MSG_RESULT(yes)
1790 ],
1791 [ AC_MSG_RESULT(no) ]
1792 )
1793fi
1794
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001795if test -z "$have_u_intxx_t" ; then
1796 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1797 AC_TRY_COMPILE(
1798 [
1799#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001800 ],
1801 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001802 [ ac_cv_have_uintxx_t="yes" ],
1803 [ ac_cv_have_uintxx_t="no" ]
1804 )
1805 ])
1806 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1807 AC_DEFINE(HAVE_UINTXX_T)
1808 fi
1809fi
1810
1811if test -z "$have_uintxx_t" ; then
1812 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1813 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001814 [ #include <stdint.h> ],
1815 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001816 [
1817 AC_DEFINE(HAVE_UINTXX_T)
1818 AC_MSG_RESULT(yes)
1819 ],
1820 [ AC_MSG_RESULT(no) ]
1821 )
1822fi
1823
Damien Milleredb82922000-06-20 13:25:52 +10001824if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001825 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001826then
1827 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1828 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001829 [
1830#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001831 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001832 [
Damien Miller70494d12000-04-03 15:57:06 +10001833 int8_t a; int16_t b; int32_t c;
1834 u_int8_t e; u_int16_t f; u_int32_t g;
1835 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001836 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001837 [
1838 AC_DEFINE(HAVE_U_INTXX_T)
1839 AC_DEFINE(HAVE_INTXX_T)
1840 AC_MSG_RESULT(yes)
1841 ],
1842 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001843 )
Damien Millerb29ea912000-01-15 14:12:03 +11001844fi
1845
Damien Miller58be7382001-09-15 21:31:54 +10001846
1847AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1848 AC_TRY_COMPILE(
1849 [
1850#include <sys/types.h>
1851 ],
1852 [ u_char foo; foo = 125; ],
1853 [ ac_cv_have_u_char="yes" ],
1854 [ ac_cv_have_u_char="no" ]
1855 )
1856])
1857if test "x$ac_cv_have_u_char" = "xyes" ; then
1858 AC_DEFINE(HAVE_U_CHAR)
1859fi
1860
Tim Rice13aae5e2001-10-21 17:53:58 -07001861TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001862
Tim Rice200a5c02002-02-26 22:12:34 -08001863AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001864
Damien Miller848b9932005-02-24 12:12:34 +11001865AC_CHECK_TYPES(in_addr_t,,,
1866[#include <sys/types.h>
1867#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001868
Damien Miller61e50f12000-05-08 20:49:37 +10001869AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1870 AC_TRY_COMPILE(
1871 [
1872#include <sys/types.h>
1873 ],
1874 [ size_t foo; foo = 1235; ],
1875 [ ac_cv_have_size_t="yes" ],
1876 [ ac_cv_have_size_t="no" ]
1877 )
1878])
1879if test "x$ac_cv_have_size_t" = "xyes" ; then
1880 AC_DEFINE(HAVE_SIZE_T)
1881fi
Damien Miller95058511999-12-29 10:36:45 +11001882
Damien Miller615f9392000-05-17 22:53:33 +10001883AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1884 AC_TRY_COMPILE(
1885 [
1886#include <sys/types.h>
1887 ],
1888 [ ssize_t foo; foo = 1235; ],
1889 [ ac_cv_have_ssize_t="yes" ],
1890 [ ac_cv_have_ssize_t="no" ]
1891 )
1892])
1893if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1894 AC_DEFINE(HAVE_SSIZE_T)
1895fi
1896
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001897AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1898 AC_TRY_COMPILE(
1899 [
1900#include <time.h>
1901 ],
1902 [ clock_t foo; foo = 1235; ],
1903 [ ac_cv_have_clock_t="yes" ],
1904 [ ac_cv_have_clock_t="no" ]
1905 )
1906])
1907if test "x$ac_cv_have_clock_t" = "xyes" ; then
1908 AC_DEFINE(HAVE_CLOCK_T)
1909fi
1910
Damien Millerb54b40e2000-06-23 08:23:34 +10001911AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1912 AC_TRY_COMPILE(
1913 [
1914#include <sys/types.h>
1915#include <sys/socket.h>
1916 ],
1917 [ sa_family_t foo; foo = 1235; ],
1918 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001919 [ AC_TRY_COMPILE(
1920 [
1921#include <sys/types.h>
1922#include <sys/socket.h>
1923#include <netinet/in.h>
1924 ],
1925 [ sa_family_t foo; foo = 1235; ],
1926 [ ac_cv_have_sa_family_t="yes" ],
1927
Damien Millerb54b40e2000-06-23 08:23:34 +10001928 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001929 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001930 )
1931])
1932if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1933 AC_DEFINE(HAVE_SA_FAMILY_T)
1934fi
1935
Damien Miller0f91b4e2000-06-18 15:43:25 +10001936AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1937 AC_TRY_COMPILE(
1938 [
1939#include <sys/types.h>
1940 ],
1941 [ pid_t foo; foo = 1235; ],
1942 [ ac_cv_have_pid_t="yes" ],
1943 [ ac_cv_have_pid_t="no" ]
1944 )
1945])
1946if test "x$ac_cv_have_pid_t" = "xyes" ; then
1947 AC_DEFINE(HAVE_PID_T)
1948fi
1949
1950AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1951 AC_TRY_COMPILE(
1952 [
1953#include <sys/types.h>
1954 ],
1955 [ mode_t foo; foo = 1235; ],
1956 [ ac_cv_have_mode_t="yes" ],
1957 [ ac_cv_have_mode_t="no" ]
1958 )
1959])
1960if test "x$ac_cv_have_mode_t" = "xyes" ; then
1961 AC_DEFINE(HAVE_MODE_T)
1962fi
1963
Damien Miller61e50f12000-05-08 20:49:37 +10001964
1965AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1966 AC_TRY_COMPILE(
1967 [
Damien Miller81171112000-04-23 11:14:01 +10001968#include <sys/types.h>
1969#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001970 ],
1971 [ struct sockaddr_storage s; ],
1972 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1973 [ ac_cv_have_struct_sockaddr_storage="no" ]
1974 )
1975])
1976if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1977 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1978fi
Damien Miller34132e52000-01-14 15:45:46 +11001979
Damien Miller61e50f12000-05-08 20:49:37 +10001980AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1981 AC_TRY_COMPILE(
1982 [
Damien Miller7b22d652000-06-18 14:07:04 +10001983#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001984#include <netinet/in.h>
1985 ],
1986 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1987 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1988 [ ac_cv_have_struct_sockaddr_in6="no" ]
1989 )
1990])
1991if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1992 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1993fi
Damien Miller34132e52000-01-14 15:45:46 +11001994
Damien Miller61e50f12000-05-08 20:49:37 +10001995AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1996 AC_TRY_COMPILE(
1997 [
Damien Miller7b22d652000-06-18 14:07:04 +10001998#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001999#include <netinet/in.h>
2000 ],
2001 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2002 [ ac_cv_have_struct_in6_addr="yes" ],
2003 [ ac_cv_have_struct_in6_addr="no" ]
2004 )
2005])
2006if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2007 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2008fi
Damien Miller34132e52000-01-14 15:45:46 +11002009
Damien Miller61e50f12000-05-08 20:49:37 +10002010AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2011 AC_TRY_COMPILE(
2012 [
Damien Miller81171112000-04-23 11:14:01 +10002013#include <sys/types.h>
2014#include <sys/socket.h>
2015#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002016 ],
2017 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2018 [ ac_cv_have_struct_addrinfo="yes" ],
2019 [ ac_cv_have_struct_addrinfo="no" ]
2020 )
2021])
2022if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2023 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2024fi
2025
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002026AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2027 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002028 [ #include <sys/time.h> ],
2029 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002030 [ ac_cv_have_struct_timeval="yes" ],
2031 [ ac_cv_have_struct_timeval="no" ]
2032 )
2033])
2034if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2035 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2036 have_struct_timeval=1
2037fi
2038
Tim Rice4e4dc562003-03-18 10:21:40 -08002039AC_CHECK_TYPES(struct timespec)
2040
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002041# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002042if test "x$ac_cv_have_int64_t" = "xno" && \
2043 test "x$ac_cv_sizeof_long_int" != "x8" && \
2044 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002045 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2046 echo "an alternative compiler (I.E., GCC) before continuing."
2047 echo ""
2048 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002049else
2050dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002051 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002052 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002053#include <stdio.h>
2054#include <string.h>
2055#ifdef HAVE_SNPRINTF
2056main()
2057{
2058 char buf[50];
2059 char expected_out[50];
2060 int mazsize = 50 ;
2061#if (SIZEOF_LONG_INT == 8)
2062 long int num = 0x7fffffffffffffff;
2063#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002064 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002065#endif
2066 strcpy(expected_out, "9223372036854775807");
2067 snprintf(buf, mazsize, "%lld", num);
2068 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002069 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002070 exit(0);
2071}
2072#else
2073main() { exit(0); }
2074#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002075 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002076 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002077 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002078fi
2079
Damien Miller78315eb2000-09-29 23:01:36 +11002080dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002081OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2082OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2083OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2084OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2085OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002086OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002087OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2088OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002089OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002090OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2091OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2092OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2093OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002094OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2095OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2096OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2097OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002098
2099AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002100
Damien Miller61e50f12000-05-08 20:49:37 +10002101AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2102 ac_cv_have_ss_family_in_struct_ss, [
2103 AC_TRY_COMPILE(
2104 [
Damien Miller81171112000-04-23 11:14:01 +10002105#include <sys/types.h>
2106#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002107 ],
2108 [ struct sockaddr_storage s; s.ss_family = 1; ],
2109 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2110 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2111 )
2112])
2113if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2114 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2115fi
2116
Damien Miller61e50f12000-05-08 20:49:37 +10002117AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2118 ac_cv_have___ss_family_in_struct_ss, [
2119 AC_TRY_COMPILE(
2120 [
Damien Miller81171112000-04-23 11:14:01 +10002121#include <sys/types.h>
2122#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002123 ],
2124 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2125 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2126 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2127 )
2128])
2129if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2130 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2131fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002132
Damien Millerad833b32000-08-23 10:46:23 +10002133AC_CACHE_CHECK([for pw_class field in struct passwd],
2134 ac_cv_have_pw_class_in_struct_passwd, [
2135 AC_TRY_COMPILE(
2136 [
Damien Millerad833b32000-08-23 10:46:23 +10002137#include <pwd.h>
2138 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002139 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002140 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2141 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2142 )
2143])
2144if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2145 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2146fi
2147
Kevin Steves82456952001-06-22 21:14:18 +00002148AC_CACHE_CHECK([for pw_expire field in struct passwd],
2149 ac_cv_have_pw_expire_in_struct_passwd, [
2150 AC_TRY_COMPILE(
2151 [
2152#include <pwd.h>
2153 ],
2154 [ struct passwd p; p.pw_expire = 0; ],
2155 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2156 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2157 )
2158])
2159if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2160 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2161fi
2162
2163AC_CACHE_CHECK([for pw_change field in struct passwd],
2164 ac_cv_have_pw_change_in_struct_passwd, [
2165 AC_TRY_COMPILE(
2166 [
2167#include <pwd.h>
2168 ],
2169 [ struct passwd p; p.pw_change = 0; ],
2170 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2171 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2172 )
2173])
2174if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2175 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2176fi
Damien Miller61e50f12000-05-08 20:49:37 +10002177
Tim Rice28bbb0c2002-05-27 17:37:32 -07002178dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002179AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2180 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002181 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002182 [
Tim Riceae49fe62002-04-12 10:26:21 -07002183#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002184#include <sys/socket.h>
2185#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002186int main() {
2187#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002188#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002189exit(1);
2190#endif
2191struct msghdr m;
2192m.msg_accrights = 0;
2193exit(0);
2194}
Kevin Steves939c9db2002-03-22 17:23:25 +00002195 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002196 [ ac_cv_have_accrights_in_msghdr="yes" ],
2197 [ ac_cv_have_accrights_in_msghdr="no" ]
2198 )
2199])
2200if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2201 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2202fi
2203
Kevin Stevesa44e0352002-04-07 16:18:03 +00002204AC_CACHE_CHECK([for msg_control field in struct msghdr],
2205 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002206 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002207 [
Tim Riceae49fe62002-04-12 10:26:21 -07002208#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002209#include <sys/socket.h>
2210#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002211int main() {
2212#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002213#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002214exit(1);
2215#endif
2216struct msghdr m;
2217m.msg_control = 0;
2218exit(0);
2219}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002220 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002221 [ ac_cv_have_control_in_msghdr="yes" ],
2222 [ ac_cv_have_control_in_msghdr="no" ]
2223 )
2224])
2225if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2226 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2227fi
2228
Damien Miller61e50f12000-05-08 20:49:37 +10002229AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002230 AC_TRY_LINK([],
2231 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002232 [ ac_cv_libc_defines___progname="yes" ],
2233 [ ac_cv_libc_defines___progname="no" ]
2234 )
2235])
2236if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2237 AC_DEFINE(HAVE___PROGNAME)
2238fi
2239
Kevin Steves4846f4a2002-03-22 18:19:53 +00002240AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2241 AC_TRY_LINK([
2242#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002243],
2244 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002245 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2246 [ ac_cv_cc_implements___FUNCTION__="no" ]
2247 )
2248])
2249if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2250 AC_DEFINE(HAVE___FUNCTION__)
2251fi
2252
2253AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2254 AC_TRY_LINK([
2255#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002256],
2257 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002258 [ ac_cv_cc_implements___func__="yes" ],
2259 [ ac_cv_cc_implements___func__="no" ]
2260 )
2261])
2262if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2263 AC_DEFINE(HAVE___func__)
2264fi
2265
Damien Miller4f8e6692001-07-14 13:22:53 +10002266AC_CACHE_CHECK([whether getopt has optreset support],
2267 ac_cv_have_getopt_optreset, [
2268 AC_TRY_LINK(
2269 [
2270#include <getopt.h>
2271 ],
2272 [ extern int optreset; optreset = 0; ],
2273 [ ac_cv_have_getopt_optreset="yes" ],
2274 [ ac_cv_have_getopt_optreset="no" ]
2275 )
2276])
2277if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2278 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2279fi
Damien Millera22ba012000-03-02 23:09:20 +11002280
Damien Millerecbb26d2000-07-15 14:59:14 +10002281AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002282 AC_TRY_LINK([],
2283 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002284 [ ac_cv_libc_defines_sys_errlist="yes" ],
2285 [ ac_cv_libc_defines_sys_errlist="no" ]
2286 )
2287])
2288if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2289 AC_DEFINE(HAVE_SYS_ERRLIST)
2290fi
2291
2292
Damien Miller11fa2cc2000-08-16 10:35:58 +10002293AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002294 AC_TRY_LINK([],
2295 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002296 [ ac_cv_libc_defines_sys_nerr="yes" ],
2297 [ ac_cv_libc_defines_sys_nerr="no" ]
2298 )
2299])
2300if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2301 AC_DEFINE(HAVE_SYS_NERR)
2302fi
2303
Damien Millera8e06ce2003-11-21 23:48:55 +11002304SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002305# Check whether user wants sectok support
2306AC_ARG_WITH(sectok,
2307 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002308 [
2309 if test "x$withval" != "xno" ; then
2310 if test "x$withval" != "xyes" ; then
2311 CPPFLAGS="$CPPFLAGS -I${withval}"
2312 LDFLAGS="$LDFLAGS -L${withval}"
2313 if test ! -z "$need_dash_r" ; then
2314 LDFLAGS="$LDFLAGS -R${withval}"
2315 fi
2316 if test ! -z "$blibpath" ; then
2317 blibpath="$blibpath:${withval}"
2318 fi
2319 fi
2320 AC_CHECK_HEADERS(sectok.h)
2321 if test "$ac_cv_header_sectok_h" != yes; then
2322 AC_MSG_ERROR(Can't find sectok.h)
2323 fi
2324 AC_CHECK_LIB(sectok, sectok_open)
2325 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2326 AC_MSG_ERROR(Can't find libsectok)
2327 fi
2328 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002329 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002330 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002331 fi
2332 ]
2333)
2334
2335# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002336OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002337AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002338 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2339 [
2340 if test "x$withval" != "xno" ; then
2341 if test "x$withval" != "xyes" ; then
2342 OPENSC_CONFIG=$withval/bin/opensc-config
2343 else
2344 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2345 fi
2346 if test "$OPENSC_CONFIG" != "no"; then
2347 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2348 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2349 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2350 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2351 AC_DEFINE(SMARTCARD)
2352 AC_DEFINE(USE_OPENSC)
2353 SCARD_MSG="yes, using OpenSC"
2354 fi
2355 fi
2356 ]
2357)
Damien Miller85de5802001-09-18 14:01:11 +10002358
Darren Tucker5f88d342003-10-15 16:57:57 +10002359# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002360AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002361 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002362 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002363 # Needed by our getrrsetbyname()
2364 AC_SEARCH_LIBS(res_query, resolv)
2365 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002366 AC_MSG_CHECKING(if res_query will link)
2367 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2368 [AC_MSG_RESULT(no)
2369 saved_LIBS="$LIBS"
2370 LIBS="$LIBS -lresolv"
2371 AC_MSG_CHECKING(for res_query in -lresolv)
2372 AC_LINK_IFELSE([
2373#include <resolv.h>
2374int main()
2375{
2376 res_query (0, 0, 0, 0, 0);
2377 return 0;
2378}
2379 ],
2380 [LIBS="$LIBS -lresolv"
2381 AC_MSG_RESULT(yes)],
2382 [LIBS="$saved_LIBS"
2383 AC_MSG_RESULT(no)])
2384 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002385 AC_CHECK_FUNCS(_getshort _getlong)
2386 AC_CHECK_MEMBER(HEADER.ad,
2387 [AC_DEFINE(HAVE_HEADER_AD)],,
2388 [#include <arpa/nameser.h>])
2389 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002390
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002391# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002392KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002393AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002394 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002395 [ if test "x$withval" != "xno" ; then
2396 if test "x$withval" = "xyes" ; then
2397 KRB5ROOT="/usr/local"
2398 else
2399 KRB5ROOT=${withval}
2400 fi
2401
2402 AC_DEFINE(KRB5)
2403 KRB5_MSG="yes"
2404
2405 AC_MSG_CHECKING(for krb5-config)
2406 if test -x $KRB5ROOT/bin/krb5-config ; then
2407 KRB5CONF=$KRB5ROOT/bin/krb5-config
2408 AC_MSG_RESULT($KRB5CONF)
2409
2410 AC_MSG_CHECKING(for gssapi support)
2411 if $KRB5CONF | grep gssapi >/dev/null ; then
2412 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002413 AC_DEFINE(GSSAPI)
2414 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002415 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002416 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002417 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002418 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002419 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2420 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002421 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002422 AC_MSG_CHECKING(whether we are using Heimdal)
2423 AC_TRY_COMPILE([ #include <krb5.h> ],
2424 [ char *tmp = heimdal_version; ],
2425 [ AC_MSG_RESULT(yes)
2426 AC_DEFINE(HEIMDAL) ],
2427 AC_MSG_RESULT(no)
2428 )
2429 else
2430 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002431 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002432 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002433 AC_MSG_CHECKING(whether we are using Heimdal)
2434 AC_TRY_COMPILE([ #include <krb5.h> ],
2435 [ char *tmp = heimdal_version; ],
2436 [ AC_MSG_RESULT(yes)
2437 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002438 K5LIBS="-lkrb5 -ldes"
2439 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002440 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002441 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002442 ],
2443 [ AC_MSG_RESULT(no)
2444 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2445 ]
2446 )
Damien Miller200d0a72003-06-30 19:21:36 +10002447 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002448
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002449 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2450 [ AC_DEFINE(GSSAPI)
2451 K5LIBS="-lgssapi $K5LIBS" ],
2452 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2453 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002454 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002455 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2456 $K5LIBS)
2457 ],
2458 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002459
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002460 AC_CHECK_HEADER(gssapi.h, ,
2461 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002462 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002463 AC_CHECK_HEADERS(gssapi.h, ,
2464 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002465 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002466 ]
2467 )
2468
2469 oldCPP="$CPPFLAGS"
2470 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2471 AC_CHECK_HEADER(gssapi_krb5.h, ,
2472 [ CPPFLAGS="$oldCPP" ])
2473
Damien Millera8e06ce2003-11-21 23:48:55 +11002474 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002475 if test ! -z "$need_dash_r" ; then
2476 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2477 fi
2478 if test ! -z "$blibpath" ; then
2479 blibpath="$blibpath:${KRB5ROOT}/lib"
2480 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002481 fi
2482
2483 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2484 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2485 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2486
2487 LIBS="$LIBS $K5LIBS"
2488 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002489 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002490 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002491)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002492
Damien Millera22ba012000-03-02 23:09:20 +11002493# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002494
Damien Millerf58c6722002-05-13 13:15:42 +10002495PRIVSEP_PATH=/var/empty
2496AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002497 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002498 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002499 if test -n "$withval" && test "x$withval" != "xno" && \
2500 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002501 PRIVSEP_PATH=$withval
2502 fi
2503 ]
2504)
2505AC_SUBST(PRIVSEP_PATH)
2506
Damien Millera22ba012000-03-02 23:09:20 +11002507AC_ARG_WITH(xauth,
2508 [ --with-xauth=PATH Specify path to xauth program ],
2509 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002510 if test -n "$withval" && test "x$withval" != "xno" && \
2511 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002512 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002513 fi
2514 ],
2515 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002516 TestPath="$PATH"
2517 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2518 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2519 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2520 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2521 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002522 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002523 xauth_path="/usr/openwin/bin/xauth"
2524 fi
2525 ]
2526)
2527
Damien Miller7d901272003-01-13 16:55:22 +11002528STRIP_OPT=-s
2529AC_ARG_ENABLE(strip,
2530 [ --disable-strip Disable calling strip(1) on install],
2531 [
2532 if test "x$enableval" = "xno" ; then
2533 STRIP_OPT=
2534 fi
2535 ]
2536)
2537AC_SUBST(STRIP_OPT)
2538
Damien Millera19cf472000-11-29 13:28:50 +11002539if test -z "$xauth_path" ; then
2540 XAUTH_PATH="undefined"
2541 AC_SUBST(XAUTH_PATH)
2542else
Damien Millera22ba012000-03-02 23:09:20 +11002543 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002544 XAUTH_PATH=$xauth_path
2545 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002546fi
Damien Millera22ba012000-03-02 23:09:20 +11002547
2548# Check for mail directory (last resort if we cannot get it from headers)
2549if test ! -z "$MAIL" ; then
2550 maildir=`dirname $MAIL`
2551 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2552fi
2553
Darren Tucker623d92f2004-09-12 22:36:15 +10002554if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002555 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2556 disable_ptmx_check=yes
2557fi
Damien Millera22ba012000-03-02 23:09:20 +11002558if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002559 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002560 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002561 [
2562 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2563 have_dev_ptmx=1
2564 ]
2565 )
2566 fi
Damien Millera22ba012000-03-02 23:09:20 +11002567fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002568
Darren Tucker623d92f2004-09-12 22:36:15 +10002569if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002570 AC_CHECK_FILE("/dev/ptc",
2571 [
2572 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2573 have_dev_ptc=1
2574 ]
2575 )
2576else
2577 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2578fi
Damien Miller204ad072000-03-02 23:56:12 +11002579
Damien Millera22ba012000-03-02 23:09:20 +11002580# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002581AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002582 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002583 [
Damien Miller897741e2001-04-16 10:41:46 +10002584 case "$withval" in
2585 man|cat|doc)
2586 MANTYPE=$withval
2587 ;;
2588 *)
2589 AC_MSG_ERROR(invalid man type: $withval)
2590 ;;
2591 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002592 ]
2593)
Ben Lindstrombc709922001-04-18 18:04:21 +00002594if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002595 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2596 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002597 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2598 MANTYPE=doc
2599 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2600 MANTYPE=man
2601 else
2602 MANTYPE=cat
2603 fi
2604fi
Damien Miller670a4b82000-01-22 13:53:11 +11002605AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002606if test "$MANTYPE" = "doc"; then
2607 mansubdir=man;
2608else
2609 mansubdir=$MANTYPE;
2610fi
2611AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002612
Damien Millera22ba012000-03-02 23:09:20 +11002613# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002614MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002615AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002616 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002617 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002618 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002619 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002620 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002621 fi
2622 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002623)
2624
Damien Millera22ba012000-03-02 23:09:20 +11002625# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002626AC_ARG_WITH(shadow,
2627 [ --without-shadow Disable shadow password support],
2628 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002629 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002630 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002631 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002632 fi
2633 ]
2634)
2635
Damien Miller1f335fb2000-06-26 11:31:33 +10002636if test -z "$disable_shadow" ; then
2637 AC_MSG_CHECKING([if the systems has expire shadow information])
2638 AC_TRY_COMPILE(
2639 [
2640#include <sys/types.h>
2641#include <shadow.h>
2642 struct spwd sp;
2643 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2644 [ sp_expire_available=yes ], []
2645 )
2646
2647 if test "x$sp_expire_available" = "xyes" ; then
2648 AC_MSG_RESULT(yes)
2649 AC_DEFINE(HAS_SHADOW_EXPIRE)
2650 else
2651 AC_MSG_RESULT(no)
2652 fi
2653fi
2654
Damien Millera22ba012000-03-02 23:09:20 +11002655# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002656if test ! -z "$IPADDR_IN_DISPLAY" ; then
2657 DISPLAY_HACK_MSG="yes"
2658 AC_DEFINE(IPADDR_IN_DISPLAY)
2659else
Damien Millera8e06ce2003-11-21 23:48:55 +11002660 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002661 AC_ARG_WITH(ipaddr-display,
2662 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2663 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002664 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002665 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002666 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002667 fi
2668 ]
2669 )
2670fi
Damien Miller76112de1999-12-21 11:18:08 +11002671
Darren Tuckere1a790d2003-09-16 11:52:19 +10002672# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002673AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002674 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002675 [ if test "x$enableval" = "xno"; then
2676 AC_MSG_NOTICE([/etc/default/login handling disabled])
2677 etc_default_login=no
2678 else
2679 etc_default_login=yes
2680 fi ],
2681 [ etc_default_login=yes ]
2682)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002683
Darren Tucker2f9573d2005-02-10 22:28:54 +11002684if test "x$etc_default_login" != "xno"; then
2685 AC_CHECK_FILE("/etc/default/login",
2686 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002687 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2688 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002689 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2690 elif test "x$external_path_file" = "x/etc/default/login"; then
2691 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2692 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002693fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002694
Tim Rice43a1c132002-04-17 21:19:14 -07002695dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002696if test $ac_cv_func_login_getcapbool = "yes" && \
2697 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002698 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002699fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002700
Damien Millera22ba012000-03-02 23:09:20 +11002701# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002702SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002703AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002704 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002705 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002706 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002707 AC_MSG_WARN([
2708--with-default-path=PATH has no effect on this system.
2709Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002710 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002711 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002712 AC_MSG_WARN([
2713--with-default-path=PATH will only be used if PATH is not defined in
2714$external_path_file .])
2715 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002716 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002717 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002718 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002719 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002720 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2721 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002722 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002723 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002724 AC_MSG_WARN([
2725If PATH is defined in $external_path_file, ensure the path to scp is included,
2726otherwise scp will not work.])
2727 fi
2728 AC_TRY_RUN(
2729 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002730/* find out what STDPATH is */
2731#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002732#ifdef HAVE_PATHS_H
2733# include <paths.h>
2734#endif
2735#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002736# ifdef _PATH_USERPATH /* Irix */
2737# define _PATH_STDPATH _PATH_USERPATH
2738# else
2739# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2740# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002741#endif
2742#include <sys/types.h>
2743#include <sys/stat.h>
2744#include <fcntl.h>
2745#define DATA "conftest.stdpath"
2746
2747main()
2748{
2749 FILE *fd;
2750 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002751
Tim Rice59ea0a02001-03-10 13:50:45 -08002752 fd = fopen(DATA,"w");
2753 if(fd == NULL)
2754 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002755
Tim Rice59ea0a02001-03-10 13:50:45 -08002756 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2757 exit(1);
2758
2759 exit(0);
2760}
2761 ], [ user_path=`cat conftest.stdpath` ],
2762 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2763 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2764 )
2765# make sure $bindir is in USER_PATH so scp will work
2766 t_bindir=`eval echo ${bindir}`
2767 case $t_bindir in
2768 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2769 esac
2770 case $t_bindir in
2771 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2772 esac
2773 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2774 if test $? -ne 0 ; then
2775 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2776 if test $? -ne 0 ; then
2777 user_path=$user_path:$t_bindir
2778 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2779 fi
2780 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002781 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002782)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002783if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002784 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2785 AC_SUBST(user_path)
2786fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002787
Damien Millera18bbd32002-05-13 10:48:57 +10002788# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002789AC_ARG_WITH(superuser-path,
2790 [ --with-superuser-path= Specify different path for super-user],
2791 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002792 if test -n "$withval" && test "x$withval" != "xno" && \
2793 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002794 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2795 superuser_path=$withval
2796 fi
2797 ]
2798)
2799
2800
Damien Miller61e50f12000-05-08 20:49:37 +10002801AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002802IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002803AC_ARG_WITH(4in6,
2804 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2805 [
2806 if test "x$withval" != "xno" ; then
2807 AC_MSG_RESULT(yes)
2808 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002809 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002810 else
2811 AC_MSG_RESULT(no)
2812 fi
2813 ],[
2814 if test "x$inet6_default_4in6" = "xyes"; then
2815 AC_MSG_RESULT([yes (default)])
2816 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002817 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002818 else
2819 AC_MSG_RESULT([no (default)])
2820 fi
2821 ]
2822)
2823
Damien Miller60396b02001-02-18 17:01:00 +11002824# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002825BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002826AC_ARG_WITH(bsd-auth,
2827 [ --with-bsd-auth Enable BSD auth support],
2828 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002829 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002830 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002831 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002832 fi
2833 ]
2834)
2835
Damien Millera22ba012000-03-02 23:09:20 +11002836# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002837piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002838# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002839if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002840 piddir=`eval echo ${sysconfdir}`
2841 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002842 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002843 esac
2844fi
2845
Tim Rice88f2ab52002-03-17 12:17:34 -08002846AC_ARG_WITH(pid-dir,
2847 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2848 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002849 if test -n "$withval" && test "x$withval" != "xno" && \
2850 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002851 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08002852 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002853 AC_MSG_WARN([** no $piddir directory on this system **])
2854 fi
2855 fi
2856 ]
2857)
2858
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002859AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002860AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002861
andre2ff7b5d2000-06-03 14:57:40 +00002862dnl allow user to disable some login recording features
2863AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002864 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002865 [
2866 if test "x$enableval" = "xno" ; then
2867 AC_DEFINE(DISABLE_LASTLOG)
2868 fi
2869 ]
andre2ff7b5d2000-06-03 14:57:40 +00002870)
2871AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002872 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002873 [
2874 if test "x$enableval" = "xno" ; then
2875 AC_DEFINE(DISABLE_UTMP)
2876 fi
2877 ]
andre2ff7b5d2000-06-03 14:57:40 +00002878)
2879AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002880 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002881 [
2882 if test "x$enableval" = "xno" ; then
2883 AC_DEFINE(DISABLE_UTMPX)
2884 fi
2885 ]
andre2ff7b5d2000-06-03 14:57:40 +00002886)
2887AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002888 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002889 [
2890 if test "x$enableval" = "xno" ; then
2891 AC_DEFINE(DISABLE_WTMP)
2892 fi
2893 ]
andre2ff7b5d2000-06-03 14:57:40 +00002894)
2895AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002896 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002897 [
2898 if test "x$enableval" = "xno" ; then
2899 AC_DEFINE(DISABLE_WTMPX)
2900 fi
2901 ]
andre2ff7b5d2000-06-03 14:57:40 +00002902)
2903AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002904 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002905 [
2906 if test "x$enableval" = "xno" ; then
2907 AC_DEFINE(DISABLE_LOGIN)
2908 fi
2909 ]
andre2ff7b5d2000-06-03 14:57:40 +00002910)
2911AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002912 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002913 [
2914 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002915 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002916 fi
2917 ]
andre2ff7b5d2000-06-03 14:57:40 +00002918)
2919AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002920 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002921 [
2922 if test "x$enableval" = "xno" ; then
2923 AC_DEFINE(DISABLE_PUTUTXLINE)
2924 fi
2925 ]
andre2ff7b5d2000-06-03 14:57:40 +00002926)
2927AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002928 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002929 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002930 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11002931 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08002932 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11002933 conf_lastlog_location=$withval
2934 fi
2935 ]
2936)
andre2ff7b5d2000-06-03 14:57:40 +00002937
2938dnl lastlog, [uw]tmpx? detection
2939dnl NOTE: set the paths in the platform section to avoid the
2940dnl need for command-line parameters
2941dnl lastlog and [uw]tmp are subject to a file search if all else fails
2942
2943dnl lastlog detection
2944dnl NOTE: the code itself will detect if lastlog is a directory
2945AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2946AC_TRY_COMPILE([
2947#include <sys/types.h>
2948#include <utmp.h>
2949#ifdef HAVE_LASTLOG_H
2950# include <lastlog.h>
2951#endif
Damien Miller2994e082000-06-04 15:51:47 +10002952#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002953# include <paths.h>
2954#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002955#ifdef HAVE_LOGIN_H
2956# include <login.h>
2957#endif
andre2ff7b5d2000-06-03 14:57:40 +00002958 ],
2959 [ char *lastlog = LASTLOG_FILE; ],
2960 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002961 [
2962 AC_MSG_RESULT(no)
2963 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2964 AC_TRY_COMPILE([
2965#include <sys/types.h>
2966#include <utmp.h>
2967#ifdef HAVE_LASTLOG_H
2968# include <lastlog.h>
2969#endif
2970#ifdef HAVE_PATHS_H
2971# include <paths.h>
2972#endif
2973 ],
2974 [ char *lastlog = _PATH_LASTLOG; ],
2975 [ AC_MSG_RESULT(yes) ],
2976 [
andree441aa32000-06-12 22:34:38 +00002977 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002978 system_lastlog_path=no
2979 ])
2980 ]
andre2ff7b5d2000-06-03 14:57:40 +00002981)
Damien Miller2994e082000-06-04 15:51:47 +10002982
andre2ff7b5d2000-06-03 14:57:40 +00002983if test -z "$conf_lastlog_location"; then
2984 if test x"$system_lastlog_path" = x"no" ; then
2985 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002986 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002987 conf_lastlog_location=$f
2988 fi
2989 done
2990 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002991 AC_MSG_WARN([** Cannot find lastlog **])
2992 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002993 fi
2994 fi
2995fi
2996
2997if test -n "$conf_lastlog_location"; then
2998 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08002999fi
andre2ff7b5d2000-06-03 14:57:40 +00003000
3001dnl utmp detection
3002AC_MSG_CHECKING([if your system defines UTMP_FILE])
3003AC_TRY_COMPILE([
3004#include <sys/types.h>
3005#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003006#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003007# include <paths.h>
3008#endif
3009 ],
3010 [ char *utmp = UTMP_FILE; ],
3011 [ AC_MSG_RESULT(yes) ],
3012 [ AC_MSG_RESULT(no)
3013 system_utmp_path=no ]
3014)
3015if test -z "$conf_utmp_location"; then
3016 if test x"$system_utmp_path" = x"no" ; then
3017 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3018 if test -f $f ; then
3019 conf_utmp_location=$f
3020 fi
3021 done
3022 if test -z "$conf_utmp_location"; then
3023 AC_DEFINE(DISABLE_UTMP)
3024 fi
3025 fi
3026fi
3027if test -n "$conf_utmp_location"; then
3028 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003029fi
andre2ff7b5d2000-06-03 14:57:40 +00003030
3031dnl wtmp detection
3032AC_MSG_CHECKING([if your system defines WTMP_FILE])
3033AC_TRY_COMPILE([
3034#include <sys/types.h>
3035#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003036#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003037# include <paths.h>
3038#endif
3039 ],
3040 [ char *wtmp = WTMP_FILE; ],
3041 [ AC_MSG_RESULT(yes) ],
3042 [ AC_MSG_RESULT(no)
3043 system_wtmp_path=no ]
3044)
3045if test -z "$conf_wtmp_location"; then
3046 if test x"$system_wtmp_path" = x"no" ; then
3047 for f in /usr/adm/wtmp /var/log/wtmp; do
3048 if test -f $f ; then
3049 conf_wtmp_location=$f
3050 fi
3051 done
3052 if test -z "$conf_wtmp_location"; then
3053 AC_DEFINE(DISABLE_WTMP)
3054 fi
3055 fi
3056fi
3057if test -n "$conf_wtmp_location"; then
3058 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003059fi
andre2ff7b5d2000-06-03 14:57:40 +00003060
3061
3062dnl utmpx detection - I don't know any system so perverse as to require
3063dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3064dnl there, though.
3065AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3066AC_TRY_COMPILE([
3067#include <sys/types.h>
3068#include <utmp.h>
3069#ifdef HAVE_UTMPX_H
3070#include <utmpx.h>
3071#endif
Damien Miller2994e082000-06-04 15:51:47 +10003072#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003073# include <paths.h>
3074#endif
3075 ],
3076 [ char *utmpx = UTMPX_FILE; ],
3077 [ AC_MSG_RESULT(yes) ],
3078 [ AC_MSG_RESULT(no)
3079 system_utmpx_path=no ]
3080)
3081if test -z "$conf_utmpx_location"; then
3082 if test x"$system_utmpx_path" = x"no" ; then
3083 AC_DEFINE(DISABLE_UTMPX)
3084 fi
3085else
3086 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003087fi
andre2ff7b5d2000-06-03 14:57:40 +00003088
3089dnl wtmpx detection
3090AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3091AC_TRY_COMPILE([
3092#include <sys/types.h>
3093#include <utmp.h>
3094#ifdef HAVE_UTMPX_H
3095#include <utmpx.h>
3096#endif
Damien Miller2994e082000-06-04 15:51:47 +10003097#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003098# include <paths.h>
3099#endif
3100 ],
3101 [ char *wtmpx = WTMPX_FILE; ],
3102 [ AC_MSG_RESULT(yes) ],
3103 [ AC_MSG_RESULT(no)
3104 system_wtmpx_path=no ]
3105)
3106if test -z "$conf_wtmpx_location"; then
3107 if test x"$system_wtmpx_path" = x"no" ; then
3108 AC_DEFINE(DISABLE_WTMPX)
3109 fi
3110else
3111 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003112fi
andre2ff7b5d2000-06-03 14:57:40 +00003113
Damien Miller4018c192000-04-30 09:30:44 +10003114
Damien Miller29ea30d2000-03-17 10:54:15 +11003115if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003116 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3117 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003118fi
3119
Tim Rice4cec93f2002-02-26 08:40:48 -08003120dnl remove pam and dl because they are in $LIBPAM
3121if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003122 LIBS=`echo $LIBS | sed 's/-lpam //'`
3123fi
3124if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3125 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003126fi
3127
Damien Millerbac2d8a2000-09-05 16:13:06 +11003128AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003129AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3130 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003131AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003132
Damien Miller7b22d652000-06-18 14:07:04 +10003133# Print summary of options
3134
Damien Miller7b22d652000-06-18 14:07:04 +10003135# Someone please show me a better way :)
3136A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3137B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3138C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3139D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003140E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003141F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003142G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003143H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3144I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3145J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003146
3147echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003148echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003149echo " User binaries: $B"
3150echo " System binaries: $C"
3151echo " Configuration files: $D"
3152echo " Askpass program: $E"
3153echo " Manual pages: $F"
3154echo " PID file: $G"
3155echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003156if test "x$external_path_file" = "x/etc/login.conf" ; then
3157echo " At runtime, sshd will use the path defined in $external_path_file"
3158echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003159else
Damien Millerf58c6722002-05-13 13:15:42 +10003160echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003161 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003162echo " (If PATH is set in $external_path_file it will be used instead. If"
3163echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3164 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003165fi
Damien Millera18bbd32002-05-13 10:48:57 +10003166if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003167echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003168fi
Damien Millerf58c6722002-05-13 13:15:42 +10003169echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003170echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003171echo " KerberosV support: $KRB5_MSG"
3172echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003173echo " S/KEY support: $SKEY_MSG"
3174echo " TCP Wrappers support: $TCPW_MSG"
3175echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003176echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003177echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003178echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3179echo " BSD Auth support: $BSD_AUTH_MSG"
3180echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003181if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003182echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003183fi
3184
Damien Miller7b22d652000-06-18 14:07:04 +10003185echo ""
3186
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003187echo " Host: ${host}"
3188echo " Compiler: ${CC}"
3189echo " Compiler flags: ${CFLAGS}"
3190echo "Preprocessor flags: ${CPPFLAGS}"
3191echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003192echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003193
3194echo ""
3195
Tim Rice6f1f7582004-05-30 21:38:51 -07003196if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003197 echo "SVR4 style packages are supported with \"make package\""
3198 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003199fi
3200
Damien Miller82cf0ce2000-12-20 13:34:48 +11003201if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003202 echo "PAM is enabled. You may need to install a PAM control file "
3203 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003204 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003205 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003206 echo ""
3207fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003208
Damien Miller6c21c512002-01-22 21:57:53 +11003209if test ! -z "$RAND_HELPER_CMDHASH" ; then
3210 echo "WARNING: you are using the builtin random number collection "
3211 echo "service. Please read WARNING.RNG and request that your OS "
3212 echo "vendor includes kernel-based random number collection in "
3213 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003214 echo ""
3215fi
Damien Miller60396b02001-02-18 17:01:00 +11003216
Damien Millerb4097182004-05-23 14:09:40 +10003217if test ! -z "$NO_PEERCHECK" ; then
3218 echo "WARNING: the operating system that you are using does not "
3219 echo "appear to support either the getpeereid() API nor the "
3220 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3221 echo "enforce security checks to prevent unauthorised connections to "
3222 echo "ssh-agent. Their absence increases the risk that a malicious "
3223 echo "user can connect to your agent. "
3224 echo ""
3225fi
3226
Darren Tuckerd9f88912005-02-20 21:01:48 +11003227if test "$AUDIT_MODULE" = "bsm" ; then
3228 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3229 echo "See the Solaris section in README.platform for details."
3230fi