blob: d879e7d41cee8c946f5f120e64a96c5d64b3848a [file] [log] [blame]
Darren Tucker9d2562c2005-04-05 19:22:45 +10001# $Id: configure.ac,v 1.258 2005/04/05 09:22:45 dtucker 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,
Darren Tuckere66519d2005-03-21 22:46:34 +1100126 passwdexpired, setauthdb], , , [#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],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100590 [ if test "x$withval" = "xno" ; then
591 AC_MSG_ERROR([*** zlib is required ***])
592 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700593 if test -d "$withval/lib"; then
594 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700595 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700596 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700597 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700598 fi
599 else
600 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700601 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700602 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700603 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700604 fi
605 fi
606 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700607 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700608 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700609 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100611 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700612)
613
Tim Ricefcb62202004-01-23 18:35:16 -0800614AC_CHECK_LIB(z, deflate, ,
615 [
616 saved_CPPFLAGS="$CPPFLAGS"
617 saved_LDFLAGS="$LDFLAGS"
618 save_LIBS="$LIBS"
619 dnl Check default zlib install dir
620 if test -n "${need_dash_r}"; then
621 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
622 else
623 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
624 fi
625 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
626 LIBS="$LIBS -lz"
627 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
628 [
629 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
630 ]
631 )
632 ]
633)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100634AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100635
636AC_ARG_WITH(zlib-version-check,
637 [ --without-zlib-version-check Disable zlib version check],
638 [ if test "x$withval" = "xno" ; then
639 zlib_check_nonfatal=1
640 fi
641 ]
642)
643
Darren Tucker2dcd2392004-01-23 17:13:33 +1100644AC_MSG_CHECKING(for zlib 1.1.4 or greater)
Darren Tucker623d92f2004-09-12 22:36:15 +1000645AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2dcd2392004-01-23 17:13:33 +1100646#include <zlib.h>
647int main()
648{
649 int a, b, c, v;
650 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
651 exit(1);
652 v = a*1000000 + b*1000 + c;
653 if (v >= 1001004)
654 exit(0);
655 exit(2);
656}
Darren Tucker623d92f2004-09-12 22:36:15 +1000657 ]])],
Darren Tucker2dcd2392004-01-23 17:13:33 +1100658 AC_MSG_RESULT(yes),
659 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100660 if test -z "$zlib_check_nonfatal" ; then
661 AC_MSG_ERROR([*** zlib too old - check config.log ***
662Your reported zlib version has known security problems. It's possible your
663vendor has fixed these problems without changing the version number. If you
664are sure this is the case, you can disable the check by running
665"./configure --without-zlib-version-check".
666If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
667 else
668 AC_MSG_WARN([zlib version may have security problems])
669 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000670 ],
671 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100672)
Damien Miller6f9c3372000-10-25 10:06:04 +1100673
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000674dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100675AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000676 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
677)
Damien Millera8e06ce2003-11-21 23:48:55 +1100678AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700679 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
680 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000681)
Damien Millerab18c411999-11-11 10:40:23 +1100682
Tim Ricee589a292001-11-03 11:09:32 -0800683dnl Checks for libutil functions
684AC_CHECK_HEADERS(libutil.h)
685AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
686AC_CHECK_FUNCS(logout updwtmp logwtmp)
687
Ben Lindstrom8697e082001-02-24 21:41:10 +0000688AC_FUNC_STRFTIME
689
Damien Miller3c027682001-03-14 11:39:45 +1100690# Check for ALTDIRFUNC glob() extension
691AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
692AC_EGREP_CPP(FOUNDIT,
693 [
694 #include <glob.h>
695 #ifdef GLOB_ALTDIRFUNC
696 FOUNDIT
697 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100698 ],
Damien Miller3c027682001-03-14 11:39:45 +1100699 [
700 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
701 AC_MSG_RESULT(yes)
702 ],
703 [
704 AC_MSG_RESULT(no)
705 ]
706)
Damien Millerab18c411999-11-11 10:40:23 +1100707
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000708# Check for g.gl_matchc glob() extension
709AC_MSG_CHECKING(for gl_matchc field in glob_t)
710AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100711 [
712 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000713 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100714 ],
715 [
716 AC_DEFINE(GLOB_HAS_GL_MATCHC)
717 AC_MSG_RESULT(yes)
718 ],
719 [
720 AC_MSG_RESULT(no)
721 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000722)
723
Damien Miller18bb4732001-03-28 14:35:30 +1000724AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000725AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000726 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000727#include <sys/types.h>
728#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700729int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000730 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100731 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000732 [
733 AC_MSG_RESULT(no)
734 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000735 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800736 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000737 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
738 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000739 ]
740)
741
Damien Miller36f49652004-08-15 18:40:59 +1000742AC_MSG_CHECKING([for /proc/pid/fd directory])
743if test -d "/proc/$$/fd" ; then
744 AC_DEFINE(HAVE_PROC_PID)
745 AC_MSG_RESULT(yes)
746else
747 AC_MSG_RESULT(no)
748fi
749
Damien Millerc547bf12001-02-16 10:18:12 +1100750# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100751SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100752AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100753 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100754 [
755 if test "x$withval" != "xno" ; then
756
757 if test "x$withval" != "xyes" ; then
758 CPPFLAGS="$CPPFLAGS -I${withval}/include"
759 LDFLAGS="$LDFLAGS -L${withval}/lib"
760 fi
761
762 AC_DEFINE(SKEY)
763 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100764 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800765
Tim Rice4cec93f2002-02-26 08:40:48 -0800766 AC_MSG_CHECKING([for s/key support])
767 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100768 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800769#include <stdio.h>
770#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700771int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800772 ],
773 [AC_MSG_RESULT(yes)],
774 [
775 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100776 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
777 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000778 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
779 AC_TRY_COMPILE(
780 [#include <stdio.h>
781 #include <skey.h>],
782 [(void)skeychallenge(NULL,"name","",0);],
783 [AC_MSG_RESULT(yes)
784 AC_DEFINE(SKEYCHALLENGE_4ARG)],
785 [AC_MSG_RESULT(no)]
786 )
Damien Millerc547bf12001-02-16 10:18:12 +1100787 fi
788 ]
789)
790
791# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700792TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100793AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100794 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100795 [
796 if test "x$withval" != "xno" ; then
797 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700798 saved_LDFLAGS="$LDFLAGS"
799 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800800 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800801 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700802 if test -d "${withval}/lib"; then
803 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700804 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700805 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700806 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700807 fi
808 else
809 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700810 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700811 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700812 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700813 fi
814 fi
815 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700816 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700817 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700818 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700819 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800821 LIBWRAP="-lwrap"
822 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100823 AC_MSG_CHECKING(for libwrap)
824 AC_TRY_LINK(
825 [
Damien Miller0ac45002004-04-14 20:14:26 +1000826#include <sys/types.h>
827#include <sys/socket.h>
828#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100829#include <tcpd.h>
830 int deny_severity = 0, allow_severity = 0;
831 ],
832 [hosts_access(0);],
833 [
834 AC_MSG_RESULT(yes)
835 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800836 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700837 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100838 ],
839 [
840 AC_MSG_ERROR([*** libwrap missing])
841 ]
842 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800843 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100844 fi
845 ]
846)
847
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100848# Check whether user wants libedit support
849LIBEDIT_MSG="no"
850AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100851 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100852 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100853 if test "x$withval" != "xyes"; then
854 CPPFLAGS="$CPPFLAGS -I$withval/include"
855 LDFLAGS="$LDFLAGS -L$withval/lib"
856 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100857 AC_CHECK_LIB(edit, el_init,
858 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
859 LIBEDIT="-ledit -lcurses"
860 LIBEDIT_MSG="yes"
861 AC_SUBST(LIBEDIT)
862 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100863 [ AC_MSG_ERROR(libedit not found) ],
864 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100865 )
866 fi ]
867)
868
Darren Tuckerd9f88912005-02-20 21:01:48 +1100869AUDIT_MODULE=none
870AC_ARG_WITH(audit,
871 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
872 [
873 AC_MSG_CHECKING(for supported audit module)
874 case "$withval" in
875 bsm)
876 AC_MSG_RESULT(bsm)
877 AUDIT_MODULE=bsm
878 dnl Checks for headers, libs and functions
879 AC_CHECK_HEADERS(bsm/audit.h, [],
880 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
881 AC_CHECK_LIB(bsm, getaudit, [],
882 [AC_MSG_ERROR(BSM enabled and required library not found)])
883 AC_CHECK_FUNCS(getaudit, [],
884 [AC_MSG_ERROR(BSM enabled and required function not found)])
885 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100886 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100887 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
888 ;;
889 debug)
890 AUDIT_MODULE=debug
891 AC_MSG_RESULT(debug)
892 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
893 ;;
894 *)
895 AC_MSG_ERROR([Unknown audit module $withval])
896 ;;
897 esac ]
898)
899
Damien Millerfe1f1432003-02-24 15:45:42 +1100900dnl Checks for library functions. Please keep in alphabetical order
901AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000902 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Darren Tuckerad7646a2005-02-02 10:43:59 +1100903 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
904 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
905 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100906 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000907 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100908 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000909 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100910 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000911 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000912 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100913 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100914)
Tim Rice13aae5e2001-10-21 17:53:58 -0700915
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000916# IRIX has a const char return value for gai_strerror()
917AC_CHECK_FUNCS(gai_strerror,[
918 AC_DEFINE(HAVE_GAI_STRERROR)
919 AC_TRY_COMPILE([
920#include <sys/types.h>
921#include <sys/socket.h>
922#include <netdb.h>
923
924const char *gai_strerror(int);],[
925char *str;
926
927str = gai_strerror(0);],[
928 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
929 [Define if gai_strerror() returns const char *])])])
930
Damien Millercd6853c2003-01-28 11:33:42 +1100931AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
932
Darren Tuckerf1159b52003-07-07 19:44:01 +1000933dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000934AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000935AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000936
Darren Tuckerb2427c82003-09-10 15:22:44 +1000937dnl tcsendbreak might be a macro
938AC_CHECK_DECL(tcsendbreak,
939 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100940 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000941 [#include <termios.h>]
942)
943
Darren Tucker5bb14002004-04-23 18:53:10 +1000944AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
945
Darren Tucker2a6b0292003-12-31 14:59:17 +1100946AC_CHECK_FUNCS(setresuid, [
947 dnl Some platorms have setresuid that isn't implemented, test for this
948 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000949 AC_RUN_IFELSE(
950 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100951#include <stdlib.h>
952#include <errno.h>
953int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000954 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100955 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100956 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000957 AC_MSG_RESULT(not implemented)],
958 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100959 )
960])
Darren Tuckere937be32003-12-17 18:53:26 +1100961
Darren Tucker2a6b0292003-12-31 14:59:17 +1100962AC_CHECK_FUNCS(setresgid, [
963 dnl Some platorms have setresgid that isn't implemented, test for this
964 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000965 AC_RUN_IFELSE(
966 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100967#include <stdlib.h>
968#include <errno.h>
969int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000970 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100971 [AC_MSG_RESULT(yes)],
972 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000973 AC_MSG_RESULT(not implemented)],
974 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100975 )
976])
Darren Tuckere937be32003-12-17 18:53:26 +1100977
Damien Millerad833b32000-08-23 10:46:23 +1000978dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000979AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000980dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000981AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000982AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000983dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000984AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000985AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100986
Damien Millera8e06ce2003-11-21 23:48:55 +1100987AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100988 [AC_DEFINE(HAVE_DAEMON)],
989 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
990)
991
Damien Millera8e06ce2003-11-21 23:48:55 +1100992AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100993 [AC_DEFINE(HAVE_GETPAGESIZE)],
994 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
995)
996
Damien Millercb170cb2000-07-01 16:52:55 +1000997# Check for broken snprintf
998if test "x$ac_cv_func_snprintf" = "xyes" ; then
999 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001000 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001001 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001002#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001003int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001004 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001005 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001006 [
1007 AC_MSG_RESULT(no)
1008 AC_DEFINE(BROKEN_SNPRINTF)
1009 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001010 ],
1011 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001012 )
1013fi
1014
Damien Millerb4097182004-05-23 14:09:40 +10001015# Check for missing getpeereid (or equiv) support
1016NO_PEERCHECK=""
1017if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1018 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1019 AC_TRY_COMPILE(
1020 [#include <sys/types.h>
1021 #include <sys/socket.h>],
1022 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001023 [ AC_MSG_RESULT(yes)
1024 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1025 ],
Damien Millerb4097182004-05-23 14:09:40 +10001026 [AC_MSG_RESULT(no)
1027 NO_PEERCHECK=1]
1028 )
1029fi
1030
Damien Millere8328192003-01-07 15:18:32 +11001031dnl see whether mkstemp() requires XXXXXX
1032if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1033AC_MSG_CHECKING([for (overly) strict mkstemp])
1034AC_TRY_RUN(
1035 [
1036#include <stdlib.h>
1037main() { char template[]="conftest.mkstemp-test";
1038if (mkstemp(template) == -1)
1039 exit(1);
1040unlink(template); exit(0);
1041}
1042 ],
1043 [
1044 AC_MSG_RESULT(no)
1045 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001046 [
Damien Millere8328192003-01-07 15:18:32 +11001047 AC_MSG_RESULT(yes)
1048 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1049 ],
1050 [
1051 AC_MSG_RESULT(yes)
1052 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001053 ]
Damien Millere8328192003-01-07 15:18:32 +11001054)
1055fi
1056
Darren Tucker70a3d552003-08-21 17:58:29 +10001057dnl make sure that openpty does not reacquire controlling terminal
1058if test ! -z "$check_for_openpty_ctty_bug"; then
1059 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1060 AC_TRY_RUN(
1061 [
1062#include <stdio.h>
1063#include <sys/fcntl.h>
1064#include <sys/types.h>
1065#include <sys/wait.h>
1066
1067int
1068main()
1069{
1070 pid_t pid;
1071 int fd, ptyfd, ttyfd, status;
1072
1073 pid = fork();
1074 if (pid < 0) { /* failed */
1075 exit(1);
1076 } else if (pid > 0) { /* parent */
1077 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001078 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001079 exit(WEXITSTATUS(status));
1080 else
1081 exit(2);
1082 } else { /* child */
1083 close(0); close(1); close(2);
1084 setsid();
1085 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1086 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1087 if (fd >= 0)
1088 exit(3); /* Acquired ctty: broken */
1089 else
1090 exit(0); /* Did not acquire ctty: OK */
1091 }
1092}
1093 ],
1094 [
1095 AC_MSG_RESULT(yes)
1096 ],
1097 [
1098 AC_MSG_RESULT(no)
1099 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1100 ]
1101 )
1102fi
1103
Tim Rice8bb561b2005-03-17 16:23:19 -08001104if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1105 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001106 AC_MSG_CHECKING(if getaddrinfo seems to work)
1107 AC_TRY_RUN(
1108 [
1109#include <stdio.h>
1110#include <sys/socket.h>
1111#include <netdb.h>
1112#include <errno.h>
1113#include <netinet/in.h>
1114
1115#define TEST_PORT "2222"
1116
1117int
1118main(void)
1119{
1120 int err, sock;
1121 struct addrinfo *gai_ai, *ai, hints;
1122 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1123
1124 memset(&hints, 0, sizeof(hints));
1125 hints.ai_family = PF_UNSPEC;
1126 hints.ai_socktype = SOCK_STREAM;
1127 hints.ai_flags = AI_PASSIVE;
1128
1129 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1130 if (err != 0) {
1131 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1132 exit(1);
1133 }
1134
1135 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1136 if (ai->ai_family != AF_INET6)
1137 continue;
1138
1139 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1140 sizeof(ntop), strport, sizeof(strport),
1141 NI_NUMERICHOST|NI_NUMERICSERV);
1142
1143 if (err != 0) {
1144 if (err == EAI_SYSTEM)
1145 perror("getnameinfo EAI_SYSTEM");
1146 else
1147 fprintf(stderr, "getnameinfo failed: %s\n",
1148 gai_strerror(err));
1149 exit(2);
1150 }
1151
1152 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1153 if (sock < 0)
1154 perror("socket");
1155 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1156 if (errno == EBADF)
1157 exit(3);
1158 }
1159 }
1160 exit(0);
1161}
1162 ],
1163 [
1164 AC_MSG_RESULT(yes)
1165 ],
1166 [
1167 AC_MSG_RESULT(no)
1168 AC_DEFINE(BROKEN_GETADDRINFO)
1169 ]
1170 )
1171fi
1172
Tim Rice8bb561b2005-03-17 16:23:19 -08001173if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1174 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001175 AC_MSG_CHECKING(if getaddrinfo seems to work)
1176 AC_TRY_RUN(
1177 [
1178#include <stdio.h>
1179#include <sys/socket.h>
1180#include <netdb.h>
1181#include <errno.h>
1182#include <netinet/in.h>
1183
1184#define TEST_PORT "2222"
1185
1186int
1187main(void)
1188{
1189 int err, sock;
1190 struct addrinfo *gai_ai, *ai, hints;
1191 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1192
1193 memset(&hints, 0, sizeof(hints));
1194 hints.ai_family = PF_UNSPEC;
1195 hints.ai_socktype = SOCK_STREAM;
1196 hints.ai_flags = AI_PASSIVE;
1197
1198 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1199 if (err != 0) {
1200 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1201 exit(1);
1202 }
1203
1204 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1205 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1206 continue;
1207
1208 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1209 sizeof(ntop), strport, sizeof(strport),
1210 NI_NUMERICHOST|NI_NUMERICSERV);
1211
1212 if (ai->ai_family == AF_INET && err != 0) {
1213 perror("getnameinfo");
1214 exit(2);
1215 }
1216 }
1217 exit(0);
1218}
1219 ],
1220 [
1221 AC_MSG_RESULT(yes)
1222 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1223[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1224 ],
1225 [
1226 AC_MSG_RESULT(no)
1227 AC_DEFINE(BROKEN_GETADDRINFO)
1228 ]
1229 )
1230fi
1231
Darren Tuckera56f1912004-11-02 20:30:54 +11001232if test "x$check_for_conflicting_getspnam" = "x1"; then
1233 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1234 AC_COMPILE_IFELSE(
1235 [
1236#include <shadow.h>
1237int main(void) {exit(0);}
1238 ],
1239 [
1240 AC_MSG_RESULT(no)
1241 ],
1242 [
1243 AC_MSG_RESULT(yes)
1244 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1245 [Conflicting defs for getspnam])
1246 ]
1247 )
1248fi
1249
Damien Miller606f8802000-09-16 15:39:56 +11001250AC_FUNC_GETPGRP
1251
Damien Millera64b57a2001-01-17 10:44:13 +11001252# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001253PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001254AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001255 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001256 [
Damien Millera64b57a2001-01-17 10:44:13 +11001257 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001258 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1259 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001260 AC_MSG_ERROR([PAM headers not found])
1261 fi
1262
1263 AC_CHECK_LIB(dl, dlopen, , )
1264 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1265 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001266 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001267
Damien Millera64b57a2001-01-17 10:44:13 +11001268 PAM_MSG="yes"
1269
1270 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001271 if test $ac_cv_lib_dl_dlopen = yes; then
1272 LIBPAM="-lpam -ldl"
1273 else
1274 LIBPAM="-lpam"
1275 fi
1276 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001277 fi
1278 ]
1279)
Damien Millera22ba012000-03-02 23:09:20 +11001280
Damien Millera64b57a2001-01-17 10:44:13 +11001281# Check for older PAM
1282if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001283 # Check PAM strerror arguments (old PAM)
1284 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1285 AC_TRY_COMPILE(
1286 [
Damien Miller81171112000-04-23 11:14:01 +10001287#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001288#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001289#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001290#elif defined (HAVE_PAM_PAM_APPL_H)
1291#include <pam/pam_appl.h>
1292#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001293 ],
1294 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001295 [AC_MSG_RESULT(no)],
1296 [
1297 AC_DEFINE(HAVE_OLD_PAM)
1298 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001299 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001300 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001301 )
Damien Millera22ba012000-03-02 23:09:20 +11001302fi
1303
Tim Riceaef73712002-05-11 13:17:42 -07001304# Search for OpenSSL
1305saved_CPPFLAGS="$CPPFLAGS"
1306saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001307AC_ARG_WITH(ssl-dir,
1308 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1309 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001310 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001311 case "$withval" in
1312 # Relative paths
1313 ./*|../*) withval="`pwd`/$withval"
1314 esac
Tim Riceaef73712002-05-11 13:17:42 -07001315 if test -d "$withval/lib"; then
1316 if test -n "${need_dash_r}"; then
1317 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1318 else
1319 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1320 fi
1321 else
1322 if test -n "${need_dash_r}"; then
1323 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1324 else
1325 LDFLAGS="-L${withval} ${LDFLAGS}"
1326 fi
1327 fi
1328 if test -d "$withval/include"; then
1329 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1330 else
1331 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1332 fi
Damien Millera22ba012000-03-02 23:09:20 +11001333 fi
1334 ]
1335)
Tim Rice3d5352e2004-02-12 09:27:21 -08001336LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001337AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001338 [
Tim Riceaef73712002-05-11 13:17:42 -07001339 dnl Check default openssl install dir
1340 if test -n "${need_dash_r}"; then
1341 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001342 else
Tim Riceaef73712002-05-11 13:17:42 -07001343 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001344 fi
Tim Riceaef73712002-05-11 13:17:42 -07001345 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1346 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1347 [
1348 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1349 ]
1350 )
1351 ]
1352)
1353
Tim Riced730b782002-08-13 18:52:10 -07001354# Determine OpenSSL header version
1355AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001356AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001357 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001358#include <stdio.h>
1359#include <string.h>
1360#include <openssl/opensslv.h>
1361#define DATA "conftest.sslincver"
1362int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001363 FILE *fd;
1364 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001365
Damien Millera8e06ce2003-11-21 23:48:55 +11001366 fd = fopen(DATA,"w");
1367 if(fd == NULL)
1368 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001369
1370 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1371 exit(1);
1372
1373 exit(0);
1374}
Darren Tucker623d92f2004-09-12 22:36:15 +10001375 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001376 [
1377 ssl_header_ver=`cat conftest.sslincver`
1378 AC_MSG_RESULT($ssl_header_ver)
1379 ],
1380 [
1381 AC_MSG_RESULT(not found)
1382 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001383 ],
1384 [
1385 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001386 ]
1387)
1388
1389# Determine OpenSSL library version
1390AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001391AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001392 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001393#include <stdio.h>
1394#include <string.h>
1395#include <openssl/opensslv.h>
1396#include <openssl/crypto.h>
1397#define DATA "conftest.ssllibver"
1398int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001399 FILE *fd;
1400 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001401
Damien Millera8e06ce2003-11-21 23:48:55 +11001402 fd = fopen(DATA,"w");
1403 if(fd == NULL)
1404 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001405
1406 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1407 exit(1);
1408
1409 exit(0);
1410}
Darren Tucker623d92f2004-09-12 22:36:15 +10001411 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001412 [
1413 ssl_library_ver=`cat conftest.ssllibver`
1414 AC_MSG_RESULT($ssl_library_ver)
1415 ],
1416 [
1417 AC_MSG_RESULT(not found)
1418 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001419 ],
1420 [
1421 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001422 ]
1423)
Damien Millera22ba012000-03-02 23:09:20 +11001424
Damien Millerec932372002-01-22 22:16:03 +11001425# Sanity check OpenSSL headers
1426AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001427AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001428 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001429#include <string.h>
1430#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001431int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001432 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001433 [
1434 AC_MSG_RESULT(yes)
1435 ],
1436 [
1437 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001438 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1439Check config.log for details.
1440Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001441 ],
1442 [
1443 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001444 ]
1445)
1446
Tim Rice3d5352e2004-02-12 09:27:21 -08001447# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1448# because the system crypt() is more featureful.
1449if test "x$check_for_libcrypt_before" = "x1"; then
1450 AC_CHECK_LIB(crypt, crypt)
1451fi
1452
Damien Millera8e06ce2003-11-21 23:48:55 +11001453# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001454# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001455if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001456 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001457fi
1458
Damien Miller6c21c512002-01-22 21:57:53 +11001459
1460### Configure cryptographic random number support
1461
1462# Check wheter OpenSSL seeds itself
1463AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001464AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001465 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001466#include <string.h>
1467#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001468int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001469 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001470 [
1471 OPENSSL_SEEDS_ITSELF=yes
1472 AC_MSG_RESULT(yes)
1473 ],
1474 [
1475 AC_MSG_RESULT(no)
1476 # Default to use of the rand helper if OpenSSL doesn't
1477 # seed itself
1478 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001479 ],
1480 [
1481 AC_MSG_WARN([cross compiling: assuming yes])
1482 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001483 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001484 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001485 ]
1486)
1487
1488
1489# Do we want to force the use of the rand helper?
1490AC_ARG_WITH(rand-helper,
1491 [ --with-rand-helper Use subprocess to gather strong randomness ],
1492 [
1493 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001494 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001495 # the previous test showed it to be unseeded.
1496 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1497 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1498 OPENSSL_SEEDS_ITSELF=yes
1499 USE_RAND_HELPER=""
1500 fi
1501 else
1502 USE_RAND_HELPER=yes
1503 fi
1504 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001505)
Damien Miller6c21c512002-01-22 21:57:53 +11001506
1507# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001508if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001509 # OpenSSL only
1510 AC_DEFINE(OPENSSL_PRNG_ONLY)
1511 RAND_MSG="OpenSSL internal ONLY"
1512 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001513elif test ! -z "$USE_RAND_HELPER" ; then
1514 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001515 RAND_MSG="ssh-rand-helper"
1516 INSTALL_SSH_RAND_HELPER="yes"
1517fi
1518AC_SUBST(INSTALL_SSH_RAND_HELPER)
1519
1520### Configuration of ssh-rand-helper
1521
1522# PRNGD TCP socket
1523AC_ARG_WITH(prngd-port,
1524 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1525 [
Damien Millere996d722002-01-23 11:20:59 +11001526 case "$withval" in
1527 no)
1528 withval=""
1529 ;;
1530 [[0-9]]*)
1531 ;;
1532 *)
1533 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1534 ;;
1535 esac
1536 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001537 PRNGD_PORT="$withval"
1538 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1539 fi
1540 ]
1541)
1542
1543# PRNGD Unix domain socket
1544AC_ARG_WITH(prngd-socket,
1545 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1546 [
Damien Millere996d722002-01-23 11:20:59 +11001547 case "$withval" in
1548 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001549 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001550 ;;
1551 no)
1552 withval=""
1553 ;;
1554 /*)
1555 ;;
1556 *)
1557 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1558 ;;
1559 esac
1560
1561 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001562 if test ! -z "$PRNGD_PORT" ; then
1563 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1564 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001565 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001566 AC_MSG_WARN(Entropy socket is not readable)
1567 fi
1568 PRNGD_SOCKET="$withval"
1569 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1570 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001571 ],
1572 [
1573 # Check for existing socket only if we don't have a random device already
1574 if test "$USE_RAND_HELPER" = yes ; then
1575 AC_MSG_CHECKING(for PRNGD/EGD socket)
1576 # Insert other locations here
1577 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1578 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1579 PRNGD_SOCKET="$sock"
1580 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1581 break;
1582 fi
1583 done
1584 if test ! -z "$PRNGD_SOCKET" ; then
1585 AC_MSG_RESULT($PRNGD_SOCKET)
1586 else
1587 AC_MSG_RESULT(not found)
1588 fi
1589 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001590 ]
1591)
1592
1593# Change default command timeout for hashing entropy source
1594entropy_timeout=200
1595AC_ARG_WITH(entropy-timeout,
1596 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1597 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001598 if test -n "$withval" && test "x$withval" != "xno" && \
1599 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001600 entropy_timeout=$withval
1601 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001602 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001603)
Damien Miller6c21c512002-01-22 21:57:53 +11001604AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1605
Damien Millerd3f6ad22002-06-25 10:24:47 +10001606SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001607AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001608 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001609 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001610 if test -n "$withval" && test "x$withval" != "xno" && \
1611 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001612 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001613 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001614 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001615)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001616AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1617AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001618
Tim Rice88f2ab52002-03-17 12:17:34 -08001619# We do this little dance with the search path to insure
1620# that programs that we select for use by installed programs
1621# (which may be run by the super-user) come from trusted
1622# locations before they come from the user's private area.
1623# This should help avoid accidentally configuring some
1624# random version of a program in someone's personal bin.
1625
1626OPATH=$PATH
1627PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001628test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001629test -d /sbin && PATH=$PATH:/sbin
1630test -d /usr/sbin && PATH=$PATH:/usr/sbin
1631PATH=$PATH:/etc:$OPATH
1632
Damien Millera8e06ce2003-11-21 23:48:55 +11001633# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001634OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1635OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1636OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1637OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1638OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1639OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1640OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1641OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1642OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1643OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1644OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1645OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1646OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1647OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1648OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1649OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001650# restore PATH
1651PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001652
1653# Where does ssh-rand-helper get its randomness from?
1654INSTALL_SSH_PRNG_CMDS=""
1655if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1656 if test ! -z "$PRNGD_PORT" ; then
1657 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1658 elif test ! -z "$PRNGD_SOCKET" ; then
1659 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1660 else
1661 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1662 RAND_HELPER_CMDHASH=yes
1663 INSTALL_SSH_PRNG_CMDS="yes"
1664 fi
1665fi
1666AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1667
1668
Ben Lindstromb5628642000-10-18 00:02:25 +00001669# Cheap hack to ensure NEWS-OS libraries are arranged right.
1670if test ! -z "$SONY" ; then
1671 LIBS="$LIBS -liberty";
1672fi
1673
Damien Millera22ba012000-03-02 23:09:20 +11001674# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001675AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001676AC_CHECK_SIZEOF(short int, 2)
1677AC_CHECK_SIZEOF(int, 4)
1678AC_CHECK_SIZEOF(long int, 4)
1679AC_CHECK_SIZEOF(long long int, 8)
1680
Damien Millerfa2bb692002-04-23 23:22:25 +10001681# Sanity check long long for some platforms (AIX)
1682if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1683 ac_cv_sizeof_long_long_int=0
1684fi
1685
Damien Millera22ba012000-03-02 23:09:20 +11001686# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001687AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1688 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001689 [ #include <sys/types.h> ],
1690 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001691 [ ac_cv_have_u_int="yes" ],
1692 [ ac_cv_have_u_int="no" ]
1693 )
1694])
1695if test "x$ac_cv_have_u_int" = "xyes" ; then
1696 AC_DEFINE(HAVE_U_INT)
1697 have_u_int=1
1698fi
1699
Damien Miller61e50f12000-05-08 20:49:37 +10001700AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1701 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001702 [ #include <sys/types.h> ],
1703 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001704 [ ac_cv_have_intxx_t="yes" ],
1705 [ ac_cv_have_intxx_t="no" ]
1706 )
1707])
1708if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1709 AC_DEFINE(HAVE_INTXX_T)
1710 have_intxx_t=1
1711fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001712
1713if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001714 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001715then
1716 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1717 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001718 [ #include <stdint.h> ],
1719 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001720 [
1721 AC_DEFINE(HAVE_INTXX_T)
1722 AC_MSG_RESULT(yes)
1723 ],
1724 [ AC_MSG_RESULT(no) ]
1725 )
1726fi
1727
Damien Miller578783e2000-09-23 14:12:24 +11001728AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1729 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001730 [
1731#include <sys/types.h>
1732#ifdef HAVE_STDINT_H
1733# include <stdint.h>
1734#endif
1735#include <sys/socket.h>
1736#ifdef HAVE_SYS_BITYPES_H
1737# include <sys/bitypes.h>
1738#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001739 ],
1740 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001741 [ ac_cv_have_int64_t="yes" ],
1742 [ ac_cv_have_int64_t="no" ]
1743 )
1744])
1745if test "x$ac_cv_have_int64_t" = "xyes" ; then
1746 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001747fi
1748
Damien Miller61e50f12000-05-08 20:49:37 +10001749AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1750 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001751 [ #include <sys/types.h> ],
1752 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001753 [ ac_cv_have_u_intxx_t="yes" ],
1754 [ ac_cv_have_u_intxx_t="no" ]
1755 )
1756])
1757if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1758 AC_DEFINE(HAVE_U_INTXX_T)
1759 have_u_intxx_t=1
1760fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001761
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001762if test -z "$have_u_intxx_t" ; then
1763 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1764 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001765 [ #include <sys/socket.h> ],
1766 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001767 [
1768 AC_DEFINE(HAVE_U_INTXX_T)
1769 AC_MSG_RESULT(yes)
1770 ],
1771 [ AC_MSG_RESULT(no) ]
1772 )
1773fi
1774
Damien Miller578783e2000-09-23 14:12:24 +11001775AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1776 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001777 [ #include <sys/types.h> ],
1778 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001779 [ ac_cv_have_u_int64_t="yes" ],
1780 [ ac_cv_have_u_int64_t="no" ]
1781 )
1782])
1783if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1784 AC_DEFINE(HAVE_U_INT64_T)
1785 have_u_int64_t=1
1786fi
1787
Tim Rice4cec93f2002-02-26 08:40:48 -08001788if test -z "$have_u_int64_t" ; then
1789 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1790 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001791 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001792 [ u_int64_t a; a = 1],
1793 [
1794 AC_DEFINE(HAVE_U_INT64_T)
1795 AC_MSG_RESULT(yes)
1796 ],
1797 [ AC_MSG_RESULT(no) ]
1798 )
1799fi
1800
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001801if test -z "$have_u_intxx_t" ; then
1802 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1803 AC_TRY_COMPILE(
1804 [
1805#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001806 ],
1807 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001808 [ ac_cv_have_uintxx_t="yes" ],
1809 [ ac_cv_have_uintxx_t="no" ]
1810 )
1811 ])
1812 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1813 AC_DEFINE(HAVE_UINTXX_T)
1814 fi
1815fi
1816
1817if test -z "$have_uintxx_t" ; then
1818 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1819 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001820 [ #include <stdint.h> ],
1821 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001822 [
1823 AC_DEFINE(HAVE_UINTXX_T)
1824 AC_MSG_RESULT(yes)
1825 ],
1826 [ AC_MSG_RESULT(no) ]
1827 )
1828fi
1829
Damien Milleredb82922000-06-20 13:25:52 +10001830if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001831 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001832then
1833 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1834 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001835 [
1836#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001837 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001838 [
Damien Miller70494d12000-04-03 15:57:06 +10001839 int8_t a; int16_t b; int32_t c;
1840 u_int8_t e; u_int16_t f; u_int32_t g;
1841 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001842 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001843 [
1844 AC_DEFINE(HAVE_U_INTXX_T)
1845 AC_DEFINE(HAVE_INTXX_T)
1846 AC_MSG_RESULT(yes)
1847 ],
1848 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001849 )
Damien Millerb29ea912000-01-15 14:12:03 +11001850fi
1851
Damien Miller58be7382001-09-15 21:31:54 +10001852
1853AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1854 AC_TRY_COMPILE(
1855 [
1856#include <sys/types.h>
1857 ],
1858 [ u_char foo; foo = 125; ],
1859 [ ac_cv_have_u_char="yes" ],
1860 [ ac_cv_have_u_char="no" ]
1861 )
1862])
1863if test "x$ac_cv_have_u_char" = "xyes" ; then
1864 AC_DEFINE(HAVE_U_CHAR)
1865fi
1866
Tim Rice13aae5e2001-10-21 17:53:58 -07001867TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001868
Tim Rice200a5c02002-02-26 22:12:34 -08001869AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001870
Damien Miller848b9932005-02-24 12:12:34 +11001871AC_CHECK_TYPES(in_addr_t,,,
1872[#include <sys/types.h>
1873#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001874
Damien Miller61e50f12000-05-08 20:49:37 +10001875AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1876 AC_TRY_COMPILE(
1877 [
1878#include <sys/types.h>
1879 ],
1880 [ size_t foo; foo = 1235; ],
1881 [ ac_cv_have_size_t="yes" ],
1882 [ ac_cv_have_size_t="no" ]
1883 )
1884])
1885if test "x$ac_cv_have_size_t" = "xyes" ; then
1886 AC_DEFINE(HAVE_SIZE_T)
1887fi
Damien Miller95058511999-12-29 10:36:45 +11001888
Damien Miller615f9392000-05-17 22:53:33 +10001889AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1890 AC_TRY_COMPILE(
1891 [
1892#include <sys/types.h>
1893 ],
1894 [ ssize_t foo; foo = 1235; ],
1895 [ ac_cv_have_ssize_t="yes" ],
1896 [ ac_cv_have_ssize_t="no" ]
1897 )
1898])
1899if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1900 AC_DEFINE(HAVE_SSIZE_T)
1901fi
1902
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001903AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1904 AC_TRY_COMPILE(
1905 [
1906#include <time.h>
1907 ],
1908 [ clock_t foo; foo = 1235; ],
1909 [ ac_cv_have_clock_t="yes" ],
1910 [ ac_cv_have_clock_t="no" ]
1911 )
1912])
1913if test "x$ac_cv_have_clock_t" = "xyes" ; then
1914 AC_DEFINE(HAVE_CLOCK_T)
1915fi
1916
Damien Millerb54b40e2000-06-23 08:23:34 +10001917AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1918 AC_TRY_COMPILE(
1919 [
1920#include <sys/types.h>
1921#include <sys/socket.h>
1922 ],
1923 [ sa_family_t foo; foo = 1235; ],
1924 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001925 [ AC_TRY_COMPILE(
1926 [
1927#include <sys/types.h>
1928#include <sys/socket.h>
1929#include <netinet/in.h>
1930 ],
1931 [ sa_family_t foo; foo = 1235; ],
1932 [ ac_cv_have_sa_family_t="yes" ],
1933
Damien Millerb54b40e2000-06-23 08:23:34 +10001934 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001935 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001936 )
1937])
1938if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1939 AC_DEFINE(HAVE_SA_FAMILY_T)
1940fi
1941
Damien Miller0f91b4e2000-06-18 15:43:25 +10001942AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1943 AC_TRY_COMPILE(
1944 [
1945#include <sys/types.h>
1946 ],
1947 [ pid_t foo; foo = 1235; ],
1948 [ ac_cv_have_pid_t="yes" ],
1949 [ ac_cv_have_pid_t="no" ]
1950 )
1951])
1952if test "x$ac_cv_have_pid_t" = "xyes" ; then
1953 AC_DEFINE(HAVE_PID_T)
1954fi
1955
1956AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1957 AC_TRY_COMPILE(
1958 [
1959#include <sys/types.h>
1960 ],
1961 [ mode_t foo; foo = 1235; ],
1962 [ ac_cv_have_mode_t="yes" ],
1963 [ ac_cv_have_mode_t="no" ]
1964 )
1965])
1966if test "x$ac_cv_have_mode_t" = "xyes" ; then
1967 AC_DEFINE(HAVE_MODE_T)
1968fi
1969
Damien Miller61e50f12000-05-08 20:49:37 +10001970
1971AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1972 AC_TRY_COMPILE(
1973 [
Damien Miller81171112000-04-23 11:14:01 +10001974#include <sys/types.h>
1975#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001976 ],
1977 [ struct sockaddr_storage s; ],
1978 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1979 [ ac_cv_have_struct_sockaddr_storage="no" ]
1980 )
1981])
1982if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1983 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1984fi
Damien Miller34132e52000-01-14 15:45:46 +11001985
Damien Miller61e50f12000-05-08 20:49:37 +10001986AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1987 AC_TRY_COMPILE(
1988 [
Damien Miller7b22d652000-06-18 14:07:04 +10001989#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001990#include <netinet/in.h>
1991 ],
1992 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1993 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1994 [ ac_cv_have_struct_sockaddr_in6="no" ]
1995 )
1996])
1997if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1998 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1999fi
Damien Miller34132e52000-01-14 15:45:46 +11002000
Damien Miller61e50f12000-05-08 20:49:37 +10002001AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2002 AC_TRY_COMPILE(
2003 [
Damien Miller7b22d652000-06-18 14:07:04 +10002004#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002005#include <netinet/in.h>
2006 ],
2007 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2008 [ ac_cv_have_struct_in6_addr="yes" ],
2009 [ ac_cv_have_struct_in6_addr="no" ]
2010 )
2011])
2012if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2013 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2014fi
Damien Miller34132e52000-01-14 15:45:46 +11002015
Damien Miller61e50f12000-05-08 20:49:37 +10002016AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2017 AC_TRY_COMPILE(
2018 [
Damien Miller81171112000-04-23 11:14:01 +10002019#include <sys/types.h>
2020#include <sys/socket.h>
2021#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002022 ],
2023 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2024 [ ac_cv_have_struct_addrinfo="yes" ],
2025 [ ac_cv_have_struct_addrinfo="no" ]
2026 )
2027])
2028if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2029 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2030fi
2031
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002032AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2033 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002034 [ #include <sys/time.h> ],
2035 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002036 [ ac_cv_have_struct_timeval="yes" ],
2037 [ ac_cv_have_struct_timeval="no" ]
2038 )
2039])
2040if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2041 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2042 have_struct_timeval=1
2043fi
2044
Tim Rice4e4dc562003-03-18 10:21:40 -08002045AC_CHECK_TYPES(struct timespec)
2046
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002047# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002048if test "x$ac_cv_have_int64_t" = "xno" && \
2049 test "x$ac_cv_sizeof_long_int" != "x8" && \
2050 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002051 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2052 echo "an alternative compiler (I.E., GCC) before continuing."
2053 echo ""
2054 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002055else
2056dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002057 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002058 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002059#include <stdio.h>
2060#include <string.h>
2061#ifdef HAVE_SNPRINTF
2062main()
2063{
2064 char buf[50];
2065 char expected_out[50];
2066 int mazsize = 50 ;
2067#if (SIZEOF_LONG_INT == 8)
2068 long int num = 0x7fffffffffffffff;
2069#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002070 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002071#endif
2072 strcpy(expected_out, "9223372036854775807");
2073 snprintf(buf, mazsize, "%lld", num);
2074 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002075 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002076 exit(0);
2077}
2078#else
2079main() { exit(0); }
2080#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002081 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002082 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002083 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002084fi
2085
Damien Miller78315eb2000-09-29 23:01:36 +11002086dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002087OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2088OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2089OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2090OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2091OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002092OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002093OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2094OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002095OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002096OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2097OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2098OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2099OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002100OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2101OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2102OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2103OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002104
2105AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002106
Damien Miller61e50f12000-05-08 20:49:37 +10002107AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2108 ac_cv_have_ss_family_in_struct_ss, [
2109 AC_TRY_COMPILE(
2110 [
Damien Miller81171112000-04-23 11:14:01 +10002111#include <sys/types.h>
2112#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002113 ],
2114 [ struct sockaddr_storage s; s.ss_family = 1; ],
2115 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2116 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2117 )
2118])
2119if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2120 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2121fi
2122
Damien Miller61e50f12000-05-08 20:49:37 +10002123AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2124 ac_cv_have___ss_family_in_struct_ss, [
2125 AC_TRY_COMPILE(
2126 [
Damien Miller81171112000-04-23 11:14:01 +10002127#include <sys/types.h>
2128#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002129 ],
2130 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2131 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2132 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2133 )
2134])
2135if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2136 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2137fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002138
Damien Millerad833b32000-08-23 10:46:23 +10002139AC_CACHE_CHECK([for pw_class field in struct passwd],
2140 ac_cv_have_pw_class_in_struct_passwd, [
2141 AC_TRY_COMPILE(
2142 [
Damien Millerad833b32000-08-23 10:46:23 +10002143#include <pwd.h>
2144 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002145 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002146 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2147 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2148 )
2149])
2150if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2151 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2152fi
2153
Kevin Steves82456952001-06-22 21:14:18 +00002154AC_CACHE_CHECK([for pw_expire field in struct passwd],
2155 ac_cv_have_pw_expire_in_struct_passwd, [
2156 AC_TRY_COMPILE(
2157 [
2158#include <pwd.h>
2159 ],
2160 [ struct passwd p; p.pw_expire = 0; ],
2161 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2162 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2163 )
2164])
2165if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2166 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2167fi
2168
2169AC_CACHE_CHECK([for pw_change field in struct passwd],
2170 ac_cv_have_pw_change_in_struct_passwd, [
2171 AC_TRY_COMPILE(
2172 [
2173#include <pwd.h>
2174 ],
2175 [ struct passwd p; p.pw_change = 0; ],
2176 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2177 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2178 )
2179])
2180if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2181 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2182fi
Damien Miller61e50f12000-05-08 20:49:37 +10002183
Tim Rice28bbb0c2002-05-27 17:37:32 -07002184dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002185AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2186 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002187 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002188 [
Tim Riceae49fe62002-04-12 10:26:21 -07002189#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002190#include <sys/socket.h>
2191#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002192int main() {
2193#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002194#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002195exit(1);
2196#endif
2197struct msghdr m;
2198m.msg_accrights = 0;
2199exit(0);
2200}
Kevin Steves939c9db2002-03-22 17:23:25 +00002201 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002202 [ ac_cv_have_accrights_in_msghdr="yes" ],
2203 [ ac_cv_have_accrights_in_msghdr="no" ]
2204 )
2205])
2206if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2207 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2208fi
2209
Kevin Stevesa44e0352002-04-07 16:18:03 +00002210AC_CACHE_CHECK([for msg_control field in struct msghdr],
2211 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002212 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002213 [
Tim Riceae49fe62002-04-12 10:26:21 -07002214#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002215#include <sys/socket.h>
2216#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002217int main() {
2218#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002219#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002220exit(1);
2221#endif
2222struct msghdr m;
2223m.msg_control = 0;
2224exit(0);
2225}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002226 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002227 [ ac_cv_have_control_in_msghdr="yes" ],
2228 [ ac_cv_have_control_in_msghdr="no" ]
2229 )
2230])
2231if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2232 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2233fi
2234
Damien Miller61e50f12000-05-08 20:49:37 +10002235AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002236 AC_TRY_LINK([],
2237 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002238 [ ac_cv_libc_defines___progname="yes" ],
2239 [ ac_cv_libc_defines___progname="no" ]
2240 )
2241])
2242if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2243 AC_DEFINE(HAVE___PROGNAME)
2244fi
2245
Kevin Steves4846f4a2002-03-22 18:19:53 +00002246AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2247 AC_TRY_LINK([
2248#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002249],
2250 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002251 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2252 [ ac_cv_cc_implements___FUNCTION__="no" ]
2253 )
2254])
2255if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2256 AC_DEFINE(HAVE___FUNCTION__)
2257fi
2258
2259AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2260 AC_TRY_LINK([
2261#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002262],
2263 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002264 [ ac_cv_cc_implements___func__="yes" ],
2265 [ ac_cv_cc_implements___func__="no" ]
2266 )
2267])
2268if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2269 AC_DEFINE(HAVE___func__)
2270fi
2271
Damien Miller4f8e6692001-07-14 13:22:53 +10002272AC_CACHE_CHECK([whether getopt has optreset support],
2273 ac_cv_have_getopt_optreset, [
2274 AC_TRY_LINK(
2275 [
2276#include <getopt.h>
2277 ],
2278 [ extern int optreset; optreset = 0; ],
2279 [ ac_cv_have_getopt_optreset="yes" ],
2280 [ ac_cv_have_getopt_optreset="no" ]
2281 )
2282])
2283if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2284 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2285fi
Damien Millera22ba012000-03-02 23:09:20 +11002286
Damien Millerecbb26d2000-07-15 14:59:14 +10002287AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002288 AC_TRY_LINK([],
2289 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002290 [ ac_cv_libc_defines_sys_errlist="yes" ],
2291 [ ac_cv_libc_defines_sys_errlist="no" ]
2292 )
2293])
2294if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2295 AC_DEFINE(HAVE_SYS_ERRLIST)
2296fi
2297
2298
Damien Miller11fa2cc2000-08-16 10:35:58 +10002299AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002300 AC_TRY_LINK([],
2301 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002302 [ ac_cv_libc_defines_sys_nerr="yes" ],
2303 [ ac_cv_libc_defines_sys_nerr="no" ]
2304 )
2305])
2306if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2307 AC_DEFINE(HAVE_SYS_NERR)
2308fi
2309
Damien Millera8e06ce2003-11-21 23:48:55 +11002310SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002311# Check whether user wants sectok support
2312AC_ARG_WITH(sectok,
2313 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002314 [
2315 if test "x$withval" != "xno" ; then
2316 if test "x$withval" != "xyes" ; then
2317 CPPFLAGS="$CPPFLAGS -I${withval}"
2318 LDFLAGS="$LDFLAGS -L${withval}"
2319 if test ! -z "$need_dash_r" ; then
2320 LDFLAGS="$LDFLAGS -R${withval}"
2321 fi
2322 if test ! -z "$blibpath" ; then
2323 blibpath="$blibpath:${withval}"
2324 fi
2325 fi
2326 AC_CHECK_HEADERS(sectok.h)
2327 if test "$ac_cv_header_sectok_h" != yes; then
2328 AC_MSG_ERROR(Can't find sectok.h)
2329 fi
2330 AC_CHECK_LIB(sectok, sectok_open)
2331 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2332 AC_MSG_ERROR(Can't find libsectok)
2333 fi
2334 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002335 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002336 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002337 fi
2338 ]
2339)
2340
2341# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002342OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002343AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002344 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2345 [
2346 if test "x$withval" != "xno" ; then
2347 if test "x$withval" != "xyes" ; then
2348 OPENSC_CONFIG=$withval/bin/opensc-config
2349 else
2350 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2351 fi
2352 if test "$OPENSC_CONFIG" != "no"; then
2353 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2354 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2355 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2356 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2357 AC_DEFINE(SMARTCARD)
2358 AC_DEFINE(USE_OPENSC)
2359 SCARD_MSG="yes, using OpenSC"
2360 fi
2361 fi
2362 ]
2363)
Damien Miller85de5802001-09-18 14:01:11 +10002364
Darren Tucker5f88d342003-10-15 16:57:57 +10002365# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002366AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002367 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002368 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002369 # Needed by our getrrsetbyname()
2370 AC_SEARCH_LIBS(res_query, resolv)
2371 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002372 AC_MSG_CHECKING(if res_query will link)
2373 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2374 [AC_MSG_RESULT(no)
2375 saved_LIBS="$LIBS"
2376 LIBS="$LIBS -lresolv"
2377 AC_MSG_CHECKING(for res_query in -lresolv)
2378 AC_LINK_IFELSE([
2379#include <resolv.h>
2380int main()
2381{
2382 res_query (0, 0, 0, 0, 0);
2383 return 0;
2384}
2385 ],
2386 [LIBS="$LIBS -lresolv"
2387 AC_MSG_RESULT(yes)],
2388 [LIBS="$saved_LIBS"
2389 AC_MSG_RESULT(no)])
2390 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002391 AC_CHECK_FUNCS(_getshort _getlong)
2392 AC_CHECK_MEMBER(HEADER.ad,
2393 [AC_DEFINE(HAVE_HEADER_AD)],,
2394 [#include <arpa/nameser.h>])
2395 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002396
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002397# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002398KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002399AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002400 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002401 [ if test "x$withval" != "xno" ; then
2402 if test "x$withval" = "xyes" ; then
2403 KRB5ROOT="/usr/local"
2404 else
2405 KRB5ROOT=${withval}
2406 fi
2407
2408 AC_DEFINE(KRB5)
2409 KRB5_MSG="yes"
2410
2411 AC_MSG_CHECKING(for krb5-config)
2412 if test -x $KRB5ROOT/bin/krb5-config ; then
2413 KRB5CONF=$KRB5ROOT/bin/krb5-config
2414 AC_MSG_RESULT($KRB5CONF)
2415
2416 AC_MSG_CHECKING(for gssapi support)
2417 if $KRB5CONF | grep gssapi >/dev/null ; then
2418 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002419 AC_DEFINE(GSSAPI)
2420 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002421 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002422 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002423 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002424 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002425 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2426 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002427 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002428 AC_MSG_CHECKING(whether we are using Heimdal)
2429 AC_TRY_COMPILE([ #include <krb5.h> ],
2430 [ char *tmp = heimdal_version; ],
2431 [ AC_MSG_RESULT(yes)
2432 AC_DEFINE(HEIMDAL) ],
2433 AC_MSG_RESULT(no)
2434 )
2435 else
2436 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002437 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002438 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002439 AC_MSG_CHECKING(whether we are using Heimdal)
2440 AC_TRY_COMPILE([ #include <krb5.h> ],
2441 [ char *tmp = heimdal_version; ],
2442 [ AC_MSG_RESULT(yes)
2443 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002444 K5LIBS="-lkrb5 -ldes"
2445 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002446 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002447 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002448 ],
2449 [ AC_MSG_RESULT(no)
2450 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2451 ]
2452 )
Damien Miller200d0a72003-06-30 19:21:36 +10002453 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002454
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002455 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2456 [ AC_DEFINE(GSSAPI)
2457 K5LIBS="-lgssapi $K5LIBS" ],
2458 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2459 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002460 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002461 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2462 $K5LIBS)
2463 ],
2464 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002465
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002466 AC_CHECK_HEADER(gssapi.h, ,
2467 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002468 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002469 AC_CHECK_HEADERS(gssapi.h, ,
2470 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002471 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002472 ]
2473 )
2474
2475 oldCPP="$CPPFLAGS"
2476 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2477 AC_CHECK_HEADER(gssapi_krb5.h, ,
2478 [ CPPFLAGS="$oldCPP" ])
2479
Damien Millera8e06ce2003-11-21 23:48:55 +11002480 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002481 if test ! -z "$need_dash_r" ; then
2482 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2483 fi
2484 if test ! -z "$blibpath" ; then
2485 blibpath="$blibpath:${KRB5ROOT}/lib"
2486 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002487 fi
2488
2489 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2490 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2491 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2492
2493 LIBS="$LIBS $K5LIBS"
2494 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002495 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002496 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002497)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002498
Damien Millera22ba012000-03-02 23:09:20 +11002499# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002500
Damien Millerf58c6722002-05-13 13:15:42 +10002501PRIVSEP_PATH=/var/empty
2502AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002503 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002504 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002505 if test -n "$withval" && test "x$withval" != "xno" && \
2506 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002507 PRIVSEP_PATH=$withval
2508 fi
2509 ]
2510)
2511AC_SUBST(PRIVSEP_PATH)
2512
Damien Millera22ba012000-03-02 23:09:20 +11002513AC_ARG_WITH(xauth,
2514 [ --with-xauth=PATH Specify path to xauth program ],
2515 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002516 if test -n "$withval" && test "x$withval" != "xno" && \
2517 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002518 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002519 fi
2520 ],
2521 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002522 TestPath="$PATH"
2523 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2524 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2525 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2526 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2527 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002528 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002529 xauth_path="/usr/openwin/bin/xauth"
2530 fi
2531 ]
2532)
2533
Damien Miller7d901272003-01-13 16:55:22 +11002534STRIP_OPT=-s
2535AC_ARG_ENABLE(strip,
2536 [ --disable-strip Disable calling strip(1) on install],
2537 [
2538 if test "x$enableval" = "xno" ; then
2539 STRIP_OPT=
2540 fi
2541 ]
2542)
2543AC_SUBST(STRIP_OPT)
2544
Damien Millera19cf472000-11-29 13:28:50 +11002545if test -z "$xauth_path" ; then
2546 XAUTH_PATH="undefined"
2547 AC_SUBST(XAUTH_PATH)
2548else
Damien Millera22ba012000-03-02 23:09:20 +11002549 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002550 XAUTH_PATH=$xauth_path
2551 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002552fi
Damien Millera22ba012000-03-02 23:09:20 +11002553
2554# Check for mail directory (last resort if we cannot get it from headers)
2555if test ! -z "$MAIL" ; then
2556 maildir=`dirname $MAIL`
2557 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2558fi
2559
Darren Tucker623d92f2004-09-12 22:36:15 +10002560if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002561 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2562 disable_ptmx_check=yes
2563fi
Damien Millera22ba012000-03-02 23:09:20 +11002564if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002565 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002566 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002567 [
2568 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2569 have_dev_ptmx=1
2570 ]
2571 )
2572 fi
Damien Millera22ba012000-03-02 23:09:20 +11002573fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002574
Darren Tucker623d92f2004-09-12 22:36:15 +10002575if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002576 AC_CHECK_FILE("/dev/ptc",
2577 [
2578 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2579 have_dev_ptc=1
2580 ]
2581 )
2582else
2583 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2584fi
Damien Miller204ad072000-03-02 23:56:12 +11002585
Damien Millera22ba012000-03-02 23:09:20 +11002586# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002587AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002588 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002589 [
Damien Miller897741e2001-04-16 10:41:46 +10002590 case "$withval" in
2591 man|cat|doc)
2592 MANTYPE=$withval
2593 ;;
2594 *)
2595 AC_MSG_ERROR(invalid man type: $withval)
2596 ;;
2597 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002598 ]
2599)
Ben Lindstrombc709922001-04-18 18:04:21 +00002600if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002601 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2602 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002603 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2604 MANTYPE=doc
2605 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2606 MANTYPE=man
2607 else
2608 MANTYPE=cat
2609 fi
2610fi
Damien Miller670a4b82000-01-22 13:53:11 +11002611AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002612if test "$MANTYPE" = "doc"; then
2613 mansubdir=man;
2614else
2615 mansubdir=$MANTYPE;
2616fi
2617AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002618
Damien Millera22ba012000-03-02 23:09:20 +11002619# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002620MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002621AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002622 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002623 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002624 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002625 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002626 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002627 fi
2628 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002629)
2630
Damien Millera22ba012000-03-02 23:09:20 +11002631# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002632AC_ARG_WITH(shadow,
2633 [ --without-shadow Disable shadow password support],
2634 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002635 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002636 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002637 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002638 fi
2639 ]
2640)
2641
Damien Miller1f335fb2000-06-26 11:31:33 +10002642if test -z "$disable_shadow" ; then
2643 AC_MSG_CHECKING([if the systems has expire shadow information])
2644 AC_TRY_COMPILE(
2645 [
2646#include <sys/types.h>
2647#include <shadow.h>
2648 struct spwd sp;
2649 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2650 [ sp_expire_available=yes ], []
2651 )
2652
2653 if test "x$sp_expire_available" = "xyes" ; then
2654 AC_MSG_RESULT(yes)
2655 AC_DEFINE(HAS_SHADOW_EXPIRE)
2656 else
2657 AC_MSG_RESULT(no)
2658 fi
2659fi
2660
Damien Millera22ba012000-03-02 23:09:20 +11002661# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002662if test ! -z "$IPADDR_IN_DISPLAY" ; then
2663 DISPLAY_HACK_MSG="yes"
2664 AC_DEFINE(IPADDR_IN_DISPLAY)
2665else
Damien Millera8e06ce2003-11-21 23:48:55 +11002666 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002667 AC_ARG_WITH(ipaddr-display,
2668 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2669 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002670 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002671 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002672 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002673 fi
2674 ]
2675 )
2676fi
Damien Miller76112de1999-12-21 11:18:08 +11002677
Darren Tuckere1a790d2003-09-16 11:52:19 +10002678# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002679AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002680 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002681 [ if test "x$enableval" = "xno"; then
2682 AC_MSG_NOTICE([/etc/default/login handling disabled])
2683 etc_default_login=no
2684 else
2685 etc_default_login=yes
2686 fi ],
2687 [ etc_default_login=yes ]
2688)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002689
Darren Tucker2f9573d2005-02-10 22:28:54 +11002690if test "x$etc_default_login" != "xno"; then
2691 AC_CHECK_FILE("/etc/default/login",
2692 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002693 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2694 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002695 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2696 elif test "x$external_path_file" = "x/etc/default/login"; then
2697 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2698 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002699fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002700
Tim Rice43a1c132002-04-17 21:19:14 -07002701dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002702if test $ac_cv_func_login_getcapbool = "yes" && \
2703 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002704 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002705fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002706
Damien Millera22ba012000-03-02 23:09:20 +11002707# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002708SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002709AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002710 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002711 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002712 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002713 AC_MSG_WARN([
2714--with-default-path=PATH has no effect on this system.
2715Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002716 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002717 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002718 AC_MSG_WARN([
2719--with-default-path=PATH will only be used if PATH is not defined in
2720$external_path_file .])
2721 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002722 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002723 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002724 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002725 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002726 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2727 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002728 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002729 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002730 AC_MSG_WARN([
2731If PATH is defined in $external_path_file, ensure the path to scp is included,
2732otherwise scp will not work.])
2733 fi
2734 AC_TRY_RUN(
2735 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002736/* find out what STDPATH is */
2737#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002738#ifdef HAVE_PATHS_H
2739# include <paths.h>
2740#endif
2741#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002742# ifdef _PATH_USERPATH /* Irix */
2743# define _PATH_STDPATH _PATH_USERPATH
2744# else
2745# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2746# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002747#endif
2748#include <sys/types.h>
2749#include <sys/stat.h>
2750#include <fcntl.h>
2751#define DATA "conftest.stdpath"
2752
2753main()
2754{
2755 FILE *fd;
2756 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002757
Tim Rice59ea0a02001-03-10 13:50:45 -08002758 fd = fopen(DATA,"w");
2759 if(fd == NULL)
2760 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002761
Tim Rice59ea0a02001-03-10 13:50:45 -08002762 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2763 exit(1);
2764
2765 exit(0);
2766}
2767 ], [ user_path=`cat conftest.stdpath` ],
2768 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2769 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2770 )
2771# make sure $bindir is in USER_PATH so scp will work
2772 t_bindir=`eval echo ${bindir}`
2773 case $t_bindir in
2774 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2775 esac
2776 case $t_bindir in
2777 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2778 esac
2779 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2780 if test $? -ne 0 ; then
2781 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2782 if test $? -ne 0 ; then
2783 user_path=$user_path:$t_bindir
2784 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2785 fi
2786 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002787 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002788)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002789if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002790 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2791 AC_SUBST(user_path)
2792fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002793
Damien Millera18bbd32002-05-13 10:48:57 +10002794# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002795AC_ARG_WITH(superuser-path,
2796 [ --with-superuser-path= Specify different path for super-user],
2797 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002798 if test -n "$withval" && test "x$withval" != "xno" && \
2799 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002800 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2801 superuser_path=$withval
2802 fi
2803 ]
2804)
2805
2806
Damien Miller61e50f12000-05-08 20:49:37 +10002807AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002808IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002809AC_ARG_WITH(4in6,
2810 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2811 [
2812 if test "x$withval" != "xno" ; then
2813 AC_MSG_RESULT(yes)
2814 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002815 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002816 else
2817 AC_MSG_RESULT(no)
2818 fi
2819 ],[
2820 if test "x$inet6_default_4in6" = "xyes"; then
2821 AC_MSG_RESULT([yes (default)])
2822 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002823 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002824 else
2825 AC_MSG_RESULT([no (default)])
2826 fi
2827 ]
2828)
2829
Damien Miller60396b02001-02-18 17:01:00 +11002830# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002831BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002832AC_ARG_WITH(bsd-auth,
2833 [ --with-bsd-auth Enable BSD auth support],
2834 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002835 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002836 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002837 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002838 fi
2839 ]
2840)
2841
Damien Millera22ba012000-03-02 23:09:20 +11002842# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002843piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002844# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002845if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002846 piddir=`eval echo ${sysconfdir}`
2847 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002848 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002849 esac
2850fi
2851
Tim Rice88f2ab52002-03-17 12:17:34 -08002852AC_ARG_WITH(pid-dir,
2853 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2854 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002855 if test -n "$withval" && test "x$withval" != "xno" && \
2856 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002857 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08002858 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002859 AC_MSG_WARN([** no $piddir directory on this system **])
2860 fi
2861 fi
2862 ]
2863)
2864
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002865AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002866AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002867
andre2ff7b5d2000-06-03 14:57:40 +00002868dnl allow user to disable some login recording features
2869AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002870 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002871 [
2872 if test "x$enableval" = "xno" ; then
2873 AC_DEFINE(DISABLE_LASTLOG)
2874 fi
2875 ]
andre2ff7b5d2000-06-03 14:57:40 +00002876)
2877AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002878 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002879 [
2880 if test "x$enableval" = "xno" ; then
2881 AC_DEFINE(DISABLE_UTMP)
2882 fi
2883 ]
andre2ff7b5d2000-06-03 14:57:40 +00002884)
2885AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002886 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002887 [
2888 if test "x$enableval" = "xno" ; then
2889 AC_DEFINE(DISABLE_UTMPX)
2890 fi
2891 ]
andre2ff7b5d2000-06-03 14:57:40 +00002892)
2893AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002894 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002895 [
2896 if test "x$enableval" = "xno" ; then
2897 AC_DEFINE(DISABLE_WTMP)
2898 fi
2899 ]
andre2ff7b5d2000-06-03 14:57:40 +00002900)
2901AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002902 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002903 [
2904 if test "x$enableval" = "xno" ; then
2905 AC_DEFINE(DISABLE_WTMPX)
2906 fi
2907 ]
andre2ff7b5d2000-06-03 14:57:40 +00002908)
2909AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002910 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002911 [
2912 if test "x$enableval" = "xno" ; then
2913 AC_DEFINE(DISABLE_LOGIN)
2914 fi
2915 ]
andre2ff7b5d2000-06-03 14:57:40 +00002916)
2917AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002918 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002919 [
2920 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002921 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002922 fi
2923 ]
andre2ff7b5d2000-06-03 14:57:40 +00002924)
2925AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002926 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002927 [
2928 if test "x$enableval" = "xno" ; then
2929 AC_DEFINE(DISABLE_PUTUTXLINE)
2930 fi
2931 ]
andre2ff7b5d2000-06-03 14:57:40 +00002932)
2933AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002934 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002935 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002936 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11002937 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08002938 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11002939 conf_lastlog_location=$withval
2940 fi
2941 ]
2942)
andre2ff7b5d2000-06-03 14:57:40 +00002943
2944dnl lastlog, [uw]tmpx? detection
2945dnl NOTE: set the paths in the platform section to avoid the
2946dnl need for command-line parameters
2947dnl lastlog and [uw]tmp are subject to a file search if all else fails
2948
2949dnl lastlog detection
2950dnl NOTE: the code itself will detect if lastlog is a directory
2951AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2952AC_TRY_COMPILE([
2953#include <sys/types.h>
2954#include <utmp.h>
2955#ifdef HAVE_LASTLOG_H
2956# include <lastlog.h>
2957#endif
Damien Miller2994e082000-06-04 15:51:47 +10002958#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002959# include <paths.h>
2960#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002961#ifdef HAVE_LOGIN_H
2962# include <login.h>
2963#endif
andre2ff7b5d2000-06-03 14:57:40 +00002964 ],
2965 [ char *lastlog = LASTLOG_FILE; ],
2966 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002967 [
2968 AC_MSG_RESULT(no)
2969 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2970 AC_TRY_COMPILE([
2971#include <sys/types.h>
2972#include <utmp.h>
2973#ifdef HAVE_LASTLOG_H
2974# include <lastlog.h>
2975#endif
2976#ifdef HAVE_PATHS_H
2977# include <paths.h>
2978#endif
2979 ],
2980 [ char *lastlog = _PATH_LASTLOG; ],
2981 [ AC_MSG_RESULT(yes) ],
2982 [
andree441aa32000-06-12 22:34:38 +00002983 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002984 system_lastlog_path=no
2985 ])
2986 ]
andre2ff7b5d2000-06-03 14:57:40 +00002987)
Damien Miller2994e082000-06-04 15:51:47 +10002988
andre2ff7b5d2000-06-03 14:57:40 +00002989if test -z "$conf_lastlog_location"; then
2990 if test x"$system_lastlog_path" = x"no" ; then
2991 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002992 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002993 conf_lastlog_location=$f
2994 fi
2995 done
2996 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002997 AC_MSG_WARN([** Cannot find lastlog **])
2998 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002999 fi
3000 fi
3001fi
3002
3003if test -n "$conf_lastlog_location"; then
3004 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003005fi
andre2ff7b5d2000-06-03 14:57:40 +00003006
3007dnl utmp detection
3008AC_MSG_CHECKING([if your system defines UTMP_FILE])
3009AC_TRY_COMPILE([
3010#include <sys/types.h>
3011#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003012#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003013# include <paths.h>
3014#endif
3015 ],
3016 [ char *utmp = UTMP_FILE; ],
3017 [ AC_MSG_RESULT(yes) ],
3018 [ AC_MSG_RESULT(no)
3019 system_utmp_path=no ]
3020)
3021if test -z "$conf_utmp_location"; then
3022 if test x"$system_utmp_path" = x"no" ; then
3023 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3024 if test -f $f ; then
3025 conf_utmp_location=$f
3026 fi
3027 done
3028 if test -z "$conf_utmp_location"; then
3029 AC_DEFINE(DISABLE_UTMP)
3030 fi
3031 fi
3032fi
3033if test -n "$conf_utmp_location"; then
3034 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003035fi
andre2ff7b5d2000-06-03 14:57:40 +00003036
3037dnl wtmp detection
3038AC_MSG_CHECKING([if your system defines WTMP_FILE])
3039AC_TRY_COMPILE([
3040#include <sys/types.h>
3041#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003042#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003043# include <paths.h>
3044#endif
3045 ],
3046 [ char *wtmp = WTMP_FILE; ],
3047 [ AC_MSG_RESULT(yes) ],
3048 [ AC_MSG_RESULT(no)
3049 system_wtmp_path=no ]
3050)
3051if test -z "$conf_wtmp_location"; then
3052 if test x"$system_wtmp_path" = x"no" ; then
3053 for f in /usr/adm/wtmp /var/log/wtmp; do
3054 if test -f $f ; then
3055 conf_wtmp_location=$f
3056 fi
3057 done
3058 if test -z "$conf_wtmp_location"; then
3059 AC_DEFINE(DISABLE_WTMP)
3060 fi
3061 fi
3062fi
3063if test -n "$conf_wtmp_location"; then
3064 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003065fi
andre2ff7b5d2000-06-03 14:57:40 +00003066
3067
3068dnl utmpx detection - I don't know any system so perverse as to require
3069dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3070dnl there, though.
3071AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3072AC_TRY_COMPILE([
3073#include <sys/types.h>
3074#include <utmp.h>
3075#ifdef HAVE_UTMPX_H
3076#include <utmpx.h>
3077#endif
Damien Miller2994e082000-06-04 15:51:47 +10003078#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003079# include <paths.h>
3080#endif
3081 ],
3082 [ char *utmpx = UTMPX_FILE; ],
3083 [ AC_MSG_RESULT(yes) ],
3084 [ AC_MSG_RESULT(no)
3085 system_utmpx_path=no ]
3086)
3087if test -z "$conf_utmpx_location"; then
3088 if test x"$system_utmpx_path" = x"no" ; then
3089 AC_DEFINE(DISABLE_UTMPX)
3090 fi
3091else
3092 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003093fi
andre2ff7b5d2000-06-03 14:57:40 +00003094
3095dnl wtmpx detection
3096AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3097AC_TRY_COMPILE([
3098#include <sys/types.h>
3099#include <utmp.h>
3100#ifdef HAVE_UTMPX_H
3101#include <utmpx.h>
3102#endif
Damien Miller2994e082000-06-04 15:51:47 +10003103#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003104# include <paths.h>
3105#endif
3106 ],
3107 [ char *wtmpx = WTMPX_FILE; ],
3108 [ AC_MSG_RESULT(yes) ],
3109 [ AC_MSG_RESULT(no)
3110 system_wtmpx_path=no ]
3111)
3112if test -z "$conf_wtmpx_location"; then
3113 if test x"$system_wtmpx_path" = x"no" ; then
3114 AC_DEFINE(DISABLE_WTMPX)
3115 fi
3116else
3117 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003118fi
andre2ff7b5d2000-06-03 14:57:40 +00003119
Damien Miller4018c192000-04-30 09:30:44 +10003120
Damien Miller29ea30d2000-03-17 10:54:15 +11003121if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003122 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3123 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003124fi
3125
Tim Rice4cec93f2002-02-26 08:40:48 -08003126dnl remove pam and dl because they are in $LIBPAM
3127if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003128 LIBS=`echo $LIBS | sed 's/-lpam //'`
3129fi
3130if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3131 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003132fi
3133
Damien Millerbac2d8a2000-09-05 16:13:06 +11003134AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003135AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3136 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003137AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003138
Damien Miller7b22d652000-06-18 14:07:04 +10003139# Print summary of options
3140
Damien Miller7b22d652000-06-18 14:07:04 +10003141# Someone please show me a better way :)
3142A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3143B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3144C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3145D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003146E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003147F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003148G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003149H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3150I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3151J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003152
3153echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003154echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003155echo " User binaries: $B"
3156echo " System binaries: $C"
3157echo " Configuration files: $D"
3158echo " Askpass program: $E"
3159echo " Manual pages: $F"
3160echo " PID file: $G"
3161echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003162if test "x$external_path_file" = "x/etc/login.conf" ; then
3163echo " At runtime, sshd will use the path defined in $external_path_file"
3164echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003165else
Damien Millerf58c6722002-05-13 13:15:42 +10003166echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003167 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003168echo " (If PATH is set in $external_path_file it will be used instead. If"
3169echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3170 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003171fi
Damien Millera18bbd32002-05-13 10:48:57 +10003172if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003173echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003174fi
Damien Millerf58c6722002-05-13 13:15:42 +10003175echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003176echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003177echo " KerberosV support: $KRB5_MSG"
3178echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003179echo " S/KEY support: $SKEY_MSG"
3180echo " TCP Wrappers support: $TCPW_MSG"
3181echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003182echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003183echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003184echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3185echo " BSD Auth support: $BSD_AUTH_MSG"
3186echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003187if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003188echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003189fi
3190
Damien Miller7b22d652000-06-18 14:07:04 +10003191echo ""
3192
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003193echo " Host: ${host}"
3194echo " Compiler: ${CC}"
3195echo " Compiler flags: ${CFLAGS}"
3196echo "Preprocessor flags: ${CPPFLAGS}"
3197echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003198echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003199
3200echo ""
3201
Tim Rice6f1f7582004-05-30 21:38:51 -07003202if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003203 echo "SVR4 style packages are supported with \"make package\""
3204 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003205fi
3206
Damien Miller82cf0ce2000-12-20 13:34:48 +11003207if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003208 echo "PAM is enabled. You may need to install a PAM control file "
3209 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003210 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003211 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003212 echo ""
3213fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003214
Damien Miller6c21c512002-01-22 21:57:53 +11003215if test ! -z "$RAND_HELPER_CMDHASH" ; then
3216 echo "WARNING: you are using the builtin random number collection "
3217 echo "service. Please read WARNING.RNG and request that your OS "
3218 echo "vendor includes kernel-based random number collection in "
3219 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003220 echo ""
3221fi
Damien Miller60396b02001-02-18 17:01:00 +11003222
Damien Millerb4097182004-05-23 14:09:40 +10003223if test ! -z "$NO_PEERCHECK" ; then
3224 echo "WARNING: the operating system that you are using does not "
3225 echo "appear to support either the getpeereid() API nor the "
3226 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3227 echo "enforce security checks to prevent unauthorised connections to "
3228 echo "ssh-agent. Their absence increases the risk that a malicious "
3229 echo "user can connect to your agent. "
3230 echo ""
3231fi
3232
Darren Tuckerd9f88912005-02-20 21:01:48 +11003233if test "$AUDIT_MODULE" = "bsm" ; then
3234 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3235 echo "See the Solaris section in README.platform for details."
3236fi