blob: 20c8f15872c0f90d857b072e65b94e8c31ea04c2 [file] [log] [blame]
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001# $Id: configure.ac,v 1.260 2005/04/24 07:52:23 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)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700364 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100365 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800366# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100367*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100368 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700369 AC_DEFINE(SETEUID_BREAKS_SETUID)
370 AC_DEFINE(BROKEN_SETREUID)
371 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700372 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100373 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100374*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100375 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800376# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100377*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800378 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100379 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800380# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100381*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800382 if test -z "$GCC"; then
383 CFLAGS="$CFLAGS -belf"
384 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100385 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000386 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100387 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000388 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000389 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700390 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700391 AC_DEFINE(SETEUID_BREAKS_SETUID)
392 AC_DEFINE(BROKEN_SETREUID)
393 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700394 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700395 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100396 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100397 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700398 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700399 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000400 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000401*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100402 AC_DEFINE(NO_SSH_LASTLOG)
403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000406 AC_DEFINE(USE_PIPES)
407 AC_DEFINE(DISABLE_FD_PASSING)
408 LDFLAGS="$LDFLAGS"
409 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
410 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000411 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000412*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100413 AC_DEFINE(SETEUID_BREAKS_SETUID)
414 AC_DEFINE(BROKEN_SETREUID)
415 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000416 AC_DEFINE(WITH_ABBREV_NO_TTY)
417 AC_DEFINE(USE_PIPES)
418 AC_DEFINE(DISABLE_FD_PASSING)
419 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100420 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000421 MANTYPE=cat
422 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000423*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000427 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700428 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700429 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000430 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
431 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
432 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700433 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000434*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000435 AC_MSG_CHECKING(for Digital Unix SIA)
436 no_osfsia=""
437 AC_ARG_WITH(osfsia,
438 [ --with-osfsia Enable Digital Unix SIA],
439 [
440 if test "x$withval" = "xno" ; then
441 AC_MSG_RESULT(disabled)
442 no_osfsia=1
443 fi
444 ],
445 )
446 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000447 if test -f /etc/sia/matrix.conf; then
448 AC_MSG_RESULT(yes)
449 AC_DEFINE(HAVE_OSF_SIA)
450 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000451 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000452 LIBS="$LIBS -lsecurity -ldb -lm -laud"
453 else
454 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100455 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000456 fi
457 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000458 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700459 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000460 AC_DEFINE(BROKEN_SETREUID)
461 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000462 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000463
464*-*-nto-qnx)
465 AC_DEFINE(USE_PIPES)
466 AC_DEFINE(NO_X11_UNIX_SOCKETS)
467 AC_DEFINE(MISSING_NFDBITS)
468 AC_DEFINE(MISSING_HOWMANY)
469 AC_DEFINE(MISSING_FD_MASK)
470 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100471esac
472
Damien Millere37bfc12000-06-05 09:37:43 +1000473# Allow user to specify flags
474AC_ARG_WITH(cflags,
475 [ --with-cflags Specify additional flags to pass to compiler],
476 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800477 if test -n "$withval" && test "x$withval" != "xno" && \
478 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000479 CFLAGS="$CFLAGS $withval"
480 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800481 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000482)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000483AC_ARG_WITH(cppflags,
484 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
485 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800486 if test -n "$withval" && test "x$withval" != "xno" && \
487 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000488 CPPFLAGS="$CPPFLAGS $withval"
489 fi
490 ]
491)
Damien Millere37bfc12000-06-05 09:37:43 +1000492AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000493 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000494 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800495 if test -n "$withval" && test "x$withval" != "xno" && \
496 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000497 LDFLAGS="$LDFLAGS $withval"
498 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800499 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000500)
501AC_ARG_WITH(libs,
502 [ --with-libs Specify additional libraries to link with],
503 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800504 if test -n "$withval" && test "x$withval" != "xno" && \
505 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000506 LIBS="$LIBS $withval"
507 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800508 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000509)
510
Darren Tucker6eb93042003-06-29 21:30:41 +1000511AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000512AC_RUN_IFELSE(
513 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000514#include <stdio.h>
515int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000516 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000517 [ AC_MSG_RESULT(yes) ],
518 [
519 AC_MSG_RESULT(no)
520 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000521 ],
522 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000523)
524
Tim Rice4cec93f2002-02-26 08:40:48 -0800525# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000526AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
527 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
528 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100529 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000530 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000531 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
532 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000533 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000534 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
535 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 -0800536
Darren Tucker48d99d32004-08-29 17:04:50 +1000537# sys/ptms.h requires sys/stream.h to be included first on Solaris
538AC_CHECK_HEADERS(sys/ptms.h, [], [], [
539#ifdef HAVE_SYS_STREAM_H
540# include <sys/stream.h>
541#endif
542])
543
Damien Millera22ba012000-03-02 23:09:20 +1100544# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700545AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
546AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000547
Tim Rice1e1ef642003-09-11 22:19:31 -0700548dnl IRIX and Solaris 2.5.1 have dirname() in libgen
549AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
550 AC_CHECK_LIB(gen, dirname,[
551 AC_CACHE_CHECK([for broken dirname],
552 ac_cv_have_broken_dirname, [
553 save_LIBS="$LIBS"
554 LIBS="$LIBS -lgen"
555 AC_TRY_RUN(
556 [
557#include <libgen.h>
558#include <string.h>
559
560int main(int argc, char **argv) {
561 char *s, buf[32];
562
563 strncpy(buf,"/etc", 32);
564 s = dirname(buf);
565 if (!s || strncmp(s, "/", 32) != 0) {
566 exit(1);
567 } else {
568 exit(0);
569 }
570}
571 ],
572 [ ac_cv_have_broken_dirname="no" ],
573 [ ac_cv_have_broken_dirname="yes" ]
574 )
575 LIBS="$save_LIBS"
576 ])
577 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
578 LIBS="$LIBS -lgen"
579 AC_DEFINE(HAVE_DIRNAME)
580 AC_CHECK_HEADERS(libgen.h)
581 fi
582 ])
583])
584
585AC_CHECK_FUNC(getspnam, ,
586 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
587AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
588
Tim Rice13aae5e2001-10-21 17:53:58 -0700589dnl zlib is required
590AC_ARG_WITH(zlib,
591 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100592 [ if test "x$withval" = "xno" ; then
593 AC_MSG_ERROR([*** zlib is required ***])
594 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700595 if test -d "$withval/lib"; then
596 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700597 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700598 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700599 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700600 fi
601 else
602 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700603 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700604 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700605 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700606 fi
607 fi
608 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700609 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700611 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700612 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100613 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700614)
615
Tim Ricefcb62202004-01-23 18:35:16 -0800616AC_CHECK_LIB(z, deflate, ,
617 [
618 saved_CPPFLAGS="$CPPFLAGS"
619 saved_LDFLAGS="$LDFLAGS"
620 save_LIBS="$LIBS"
621 dnl Check default zlib install dir
622 if test -n "${need_dash_r}"; then
623 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
624 else
625 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
626 fi
627 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
628 LIBS="$LIBS -lz"
629 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
630 [
631 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
632 ]
633 )
634 ]
635)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100636AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100637
638AC_ARG_WITH(zlib-version-check,
639 [ --without-zlib-version-check Disable zlib version check],
640 [ if test "x$withval" = "xno" ; then
641 zlib_check_nonfatal=1
642 fi
643 ]
644)
645
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000646AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000647AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000648#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100649#include <zlib.h>
650int main()
651{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000652 int a=0, b=0, c=0, d=0, n, v;
653 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
654 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100655 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000656 v = a*1000000 + b*10000 + c*100 + d;
657 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
658
659 /* 1.1.4 is OK */
660 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100661 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000662
663 /* 1.2.1.2 and up are OK */
664 if (v >= 1020102)
665 exit(0);
666
Darren Tucker2dcd2392004-01-23 17:13:33 +1100667 exit(2);
668}
Darren Tucker623d92f2004-09-12 22:36:15 +1000669 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000670 AC_MSG_RESULT(no),
671 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100672 if test -z "$zlib_check_nonfatal" ; then
673 AC_MSG_ERROR([*** zlib too old - check config.log ***
674Your reported zlib version has known security problems. It's possible your
675vendor has fixed these problems without changing the version number. If you
676are sure this is the case, you can disable the check by running
677"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000678If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
679See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100680 else
681 AC_MSG_WARN([zlib version may have security problems])
682 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000683 ],
684 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100685)
Damien Miller6f9c3372000-10-25 10:06:04 +1100686
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000687dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100688AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000689 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
690)
Damien Millera8e06ce2003-11-21 23:48:55 +1100691AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700692 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
693 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000694)
Damien Millerab18c411999-11-11 10:40:23 +1100695
Tim Ricee589a292001-11-03 11:09:32 -0800696dnl Checks for libutil functions
697AC_CHECK_HEADERS(libutil.h)
698AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
699AC_CHECK_FUNCS(logout updwtmp logwtmp)
700
Ben Lindstrom8697e082001-02-24 21:41:10 +0000701AC_FUNC_STRFTIME
702
Damien Miller3c027682001-03-14 11:39:45 +1100703# Check for ALTDIRFUNC glob() extension
704AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
705AC_EGREP_CPP(FOUNDIT,
706 [
707 #include <glob.h>
708 #ifdef GLOB_ALTDIRFUNC
709 FOUNDIT
710 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100711 ],
Damien Miller3c027682001-03-14 11:39:45 +1100712 [
713 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
714 AC_MSG_RESULT(yes)
715 ],
716 [
717 AC_MSG_RESULT(no)
718 ]
719)
Damien Millerab18c411999-11-11 10:40:23 +1100720
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000721# Check for g.gl_matchc glob() extension
722AC_MSG_CHECKING(for gl_matchc field in glob_t)
723AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100724 [
725 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000726 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100727 ],
728 [
729 AC_DEFINE(GLOB_HAS_GL_MATCHC)
730 AC_MSG_RESULT(yes)
731 ],
732 [
733 AC_MSG_RESULT(no)
734 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000735)
736
Damien Miller18bb4732001-03-28 14:35:30 +1000737AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000738AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000739 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000740#include <sys/types.h>
741#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700742int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000743 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100744 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000745 [
746 AC_MSG_RESULT(no)
747 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000748 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800749 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000750 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
751 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000752 ]
753)
754
Damien Miller36f49652004-08-15 18:40:59 +1000755AC_MSG_CHECKING([for /proc/pid/fd directory])
756if test -d "/proc/$$/fd" ; then
757 AC_DEFINE(HAVE_PROC_PID)
758 AC_MSG_RESULT(yes)
759else
760 AC_MSG_RESULT(no)
761fi
762
Damien Millerc547bf12001-02-16 10:18:12 +1100763# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100764SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100765AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100766 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100767 [
768 if test "x$withval" != "xno" ; then
769
770 if test "x$withval" != "xyes" ; then
771 CPPFLAGS="$CPPFLAGS -I${withval}/include"
772 LDFLAGS="$LDFLAGS -L${withval}/lib"
773 fi
774
775 AC_DEFINE(SKEY)
776 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100777 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800778
Tim Rice4cec93f2002-02-26 08:40:48 -0800779 AC_MSG_CHECKING([for s/key support])
780 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100781 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800782#include <stdio.h>
783#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700784int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800785 ],
786 [AC_MSG_RESULT(yes)],
787 [
788 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100789 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
790 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000791 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
792 AC_TRY_COMPILE(
793 [#include <stdio.h>
794 #include <skey.h>],
795 [(void)skeychallenge(NULL,"name","",0);],
796 [AC_MSG_RESULT(yes)
797 AC_DEFINE(SKEYCHALLENGE_4ARG)],
798 [AC_MSG_RESULT(no)]
799 )
Damien Millerc547bf12001-02-16 10:18:12 +1100800 fi
801 ]
802)
803
804# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700805TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100806AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100807 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100808 [
809 if test "x$withval" != "xno" ; then
810 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700811 saved_LDFLAGS="$LDFLAGS"
812 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800813 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800814 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700815 if test -d "${withval}/lib"; then
816 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
821 else
822 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700823 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700824 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700825 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 fi
827 fi
828 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700829 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700830 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700831 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700832 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700833 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800834 LIBWRAP="-lwrap"
835 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100836 AC_MSG_CHECKING(for libwrap)
837 AC_TRY_LINK(
838 [
Damien Miller0ac45002004-04-14 20:14:26 +1000839#include <sys/types.h>
840#include <sys/socket.h>
841#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100842#include <tcpd.h>
843 int deny_severity = 0, allow_severity = 0;
844 ],
845 [hosts_access(0);],
846 [
847 AC_MSG_RESULT(yes)
848 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800849 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700850 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100851 ],
852 [
853 AC_MSG_ERROR([*** libwrap missing])
854 ]
855 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800856 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100857 fi
858 ]
859)
860
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100861# Check whether user wants libedit support
862LIBEDIT_MSG="no"
863AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100864 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100865 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100866 if test "x$withval" != "xyes"; then
867 CPPFLAGS="$CPPFLAGS -I$withval/include"
868 LDFLAGS="$LDFLAGS -L$withval/lib"
869 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100870 AC_CHECK_LIB(edit, el_init,
871 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
872 LIBEDIT="-ledit -lcurses"
873 LIBEDIT_MSG="yes"
874 AC_SUBST(LIBEDIT)
875 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100876 [ AC_MSG_ERROR(libedit not found) ],
877 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100878 )
879 fi ]
880)
881
Darren Tuckerd9f88912005-02-20 21:01:48 +1100882AUDIT_MODULE=none
883AC_ARG_WITH(audit,
884 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
885 [
886 AC_MSG_CHECKING(for supported audit module)
887 case "$withval" in
888 bsm)
889 AC_MSG_RESULT(bsm)
890 AUDIT_MODULE=bsm
891 dnl Checks for headers, libs and functions
892 AC_CHECK_HEADERS(bsm/audit.h, [],
893 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
894 AC_CHECK_LIB(bsm, getaudit, [],
895 [AC_MSG_ERROR(BSM enabled and required library not found)])
896 AC_CHECK_FUNCS(getaudit, [],
897 [AC_MSG_ERROR(BSM enabled and required function not found)])
898 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100899 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100900 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
901 ;;
902 debug)
903 AUDIT_MODULE=debug
904 AC_MSG_RESULT(debug)
905 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
906 ;;
907 *)
908 AC_MSG_ERROR([Unknown audit module $withval])
909 ;;
910 esac ]
911)
912
Damien Millerfe1f1432003-02-24 15:45:42 +1100913dnl Checks for library functions. Please keep in alphabetical order
914AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000915 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Darren Tuckerad7646a2005-02-02 10:43:59 +1100916 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
917 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
918 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100919 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000920 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100921 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000922 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100923 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000924 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000925 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100926 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100927)
Tim Rice13aae5e2001-10-21 17:53:58 -0700928
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000929# IRIX has a const char return value for gai_strerror()
930AC_CHECK_FUNCS(gai_strerror,[
931 AC_DEFINE(HAVE_GAI_STRERROR)
932 AC_TRY_COMPILE([
933#include <sys/types.h>
934#include <sys/socket.h>
935#include <netdb.h>
936
937const char *gai_strerror(int);],[
938char *str;
939
940str = gai_strerror(0);],[
941 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
942 [Define if gai_strerror() returns const char *])])])
943
Damien Millercd6853c2003-01-28 11:33:42 +1100944AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
945
Darren Tuckerf1159b52003-07-07 19:44:01 +1000946dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000947AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000948AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000949
Darren Tuckerb2427c82003-09-10 15:22:44 +1000950dnl tcsendbreak might be a macro
951AC_CHECK_DECL(tcsendbreak,
952 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100953 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000954 [#include <termios.h>]
955)
956
Darren Tucker5bb14002004-04-23 18:53:10 +1000957AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
958
Darren Tucker2a6b0292003-12-31 14:59:17 +1100959AC_CHECK_FUNCS(setresuid, [
960 dnl Some platorms have setresuid that isn't implemented, test for this
961 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000962 AC_RUN_IFELSE(
963 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100964#include <stdlib.h>
965#include <errno.h>
966int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000967 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100968 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100969 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000970 AC_MSG_RESULT(not implemented)],
971 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100972 )
973])
Darren Tuckere937be32003-12-17 18:53:26 +1100974
Darren Tucker2a6b0292003-12-31 14:59:17 +1100975AC_CHECK_FUNCS(setresgid, [
976 dnl Some platorms have setresgid that isn't implemented, test for this
977 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000978 AC_RUN_IFELSE(
979 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100980#include <stdlib.h>
981#include <errno.h>
982int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000983 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100984 [AC_MSG_RESULT(yes)],
985 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000986 AC_MSG_RESULT(not implemented)],
987 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100988 )
989])
Darren Tuckere937be32003-12-17 18:53:26 +1100990
Damien Millerad833b32000-08-23 10:46:23 +1000991dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000992AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000993dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000994AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000995AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000996dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000997AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000998AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100999
Damien Millera8e06ce2003-11-21 23:48:55 +11001000AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001001 [AC_DEFINE(HAVE_DAEMON)],
1002 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1003)
1004
Damien Millera8e06ce2003-11-21 23:48:55 +11001005AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001006 [AC_DEFINE(HAVE_GETPAGESIZE)],
1007 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1008)
1009
Damien Millercb170cb2000-07-01 16:52:55 +10001010# Check for broken snprintf
1011if test "x$ac_cv_func_snprintf" = "xyes" ; then
1012 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001013 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001014 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001015#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001016int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001017 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001018 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001019 [
1020 AC_MSG_RESULT(no)
1021 AC_DEFINE(BROKEN_SNPRINTF)
1022 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001023 ],
1024 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001025 )
1026fi
1027
Damien Millerb4097182004-05-23 14:09:40 +10001028# Check for missing getpeereid (or equiv) support
1029NO_PEERCHECK=""
1030if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1031 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1032 AC_TRY_COMPILE(
1033 [#include <sys/types.h>
1034 #include <sys/socket.h>],
1035 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001036 [ AC_MSG_RESULT(yes)
1037 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1038 ],
Damien Millerb4097182004-05-23 14:09:40 +10001039 [AC_MSG_RESULT(no)
1040 NO_PEERCHECK=1]
1041 )
1042fi
1043
Damien Millere8328192003-01-07 15:18:32 +11001044dnl see whether mkstemp() requires XXXXXX
1045if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1046AC_MSG_CHECKING([for (overly) strict mkstemp])
1047AC_TRY_RUN(
1048 [
1049#include <stdlib.h>
1050main() { char template[]="conftest.mkstemp-test";
1051if (mkstemp(template) == -1)
1052 exit(1);
1053unlink(template); exit(0);
1054}
1055 ],
1056 [
1057 AC_MSG_RESULT(no)
1058 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001059 [
Damien Millere8328192003-01-07 15:18:32 +11001060 AC_MSG_RESULT(yes)
1061 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1062 ],
1063 [
1064 AC_MSG_RESULT(yes)
1065 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001066 ]
Damien Millere8328192003-01-07 15:18:32 +11001067)
1068fi
1069
Darren Tucker70a3d552003-08-21 17:58:29 +10001070dnl make sure that openpty does not reacquire controlling terminal
1071if test ! -z "$check_for_openpty_ctty_bug"; then
1072 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1073 AC_TRY_RUN(
1074 [
1075#include <stdio.h>
1076#include <sys/fcntl.h>
1077#include <sys/types.h>
1078#include <sys/wait.h>
1079
1080int
1081main()
1082{
1083 pid_t pid;
1084 int fd, ptyfd, ttyfd, status;
1085
1086 pid = fork();
1087 if (pid < 0) { /* failed */
1088 exit(1);
1089 } else if (pid > 0) { /* parent */
1090 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001091 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001092 exit(WEXITSTATUS(status));
1093 else
1094 exit(2);
1095 } else { /* child */
1096 close(0); close(1); close(2);
1097 setsid();
1098 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1099 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1100 if (fd >= 0)
1101 exit(3); /* Acquired ctty: broken */
1102 else
1103 exit(0); /* Did not acquire ctty: OK */
1104 }
1105}
1106 ],
1107 [
1108 AC_MSG_RESULT(yes)
1109 ],
1110 [
1111 AC_MSG_RESULT(no)
1112 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1113 ]
1114 )
1115fi
1116
Tim Rice8bb561b2005-03-17 16:23:19 -08001117if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1118 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001119 AC_MSG_CHECKING(if getaddrinfo seems to work)
1120 AC_TRY_RUN(
1121 [
1122#include <stdio.h>
1123#include <sys/socket.h>
1124#include <netdb.h>
1125#include <errno.h>
1126#include <netinet/in.h>
1127
1128#define TEST_PORT "2222"
1129
1130int
1131main(void)
1132{
1133 int err, sock;
1134 struct addrinfo *gai_ai, *ai, hints;
1135 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1136
1137 memset(&hints, 0, sizeof(hints));
1138 hints.ai_family = PF_UNSPEC;
1139 hints.ai_socktype = SOCK_STREAM;
1140 hints.ai_flags = AI_PASSIVE;
1141
1142 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1143 if (err != 0) {
1144 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1145 exit(1);
1146 }
1147
1148 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1149 if (ai->ai_family != AF_INET6)
1150 continue;
1151
1152 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1153 sizeof(ntop), strport, sizeof(strport),
1154 NI_NUMERICHOST|NI_NUMERICSERV);
1155
1156 if (err != 0) {
1157 if (err == EAI_SYSTEM)
1158 perror("getnameinfo EAI_SYSTEM");
1159 else
1160 fprintf(stderr, "getnameinfo failed: %s\n",
1161 gai_strerror(err));
1162 exit(2);
1163 }
1164
1165 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1166 if (sock < 0)
1167 perror("socket");
1168 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1169 if (errno == EBADF)
1170 exit(3);
1171 }
1172 }
1173 exit(0);
1174}
1175 ],
1176 [
1177 AC_MSG_RESULT(yes)
1178 ],
1179 [
1180 AC_MSG_RESULT(no)
1181 AC_DEFINE(BROKEN_GETADDRINFO)
1182 ]
1183 )
1184fi
1185
Tim Rice8bb561b2005-03-17 16:23:19 -08001186if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1187 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001188 AC_MSG_CHECKING(if getaddrinfo seems to work)
1189 AC_TRY_RUN(
1190 [
1191#include <stdio.h>
1192#include <sys/socket.h>
1193#include <netdb.h>
1194#include <errno.h>
1195#include <netinet/in.h>
1196
1197#define TEST_PORT "2222"
1198
1199int
1200main(void)
1201{
1202 int err, sock;
1203 struct addrinfo *gai_ai, *ai, hints;
1204 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1205
1206 memset(&hints, 0, sizeof(hints));
1207 hints.ai_family = PF_UNSPEC;
1208 hints.ai_socktype = SOCK_STREAM;
1209 hints.ai_flags = AI_PASSIVE;
1210
1211 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1212 if (err != 0) {
1213 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1214 exit(1);
1215 }
1216
1217 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1218 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1219 continue;
1220
1221 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1222 sizeof(ntop), strport, sizeof(strport),
1223 NI_NUMERICHOST|NI_NUMERICSERV);
1224
1225 if (ai->ai_family == AF_INET && err != 0) {
1226 perror("getnameinfo");
1227 exit(2);
1228 }
1229 }
1230 exit(0);
1231}
1232 ],
1233 [
1234 AC_MSG_RESULT(yes)
1235 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1236[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1237 ],
1238 [
1239 AC_MSG_RESULT(no)
1240 AC_DEFINE(BROKEN_GETADDRINFO)
1241 ]
1242 )
1243fi
1244
Darren Tuckera56f1912004-11-02 20:30:54 +11001245if test "x$check_for_conflicting_getspnam" = "x1"; then
1246 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1247 AC_COMPILE_IFELSE(
1248 [
1249#include <shadow.h>
1250int main(void) {exit(0);}
1251 ],
1252 [
1253 AC_MSG_RESULT(no)
1254 ],
1255 [
1256 AC_MSG_RESULT(yes)
1257 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1258 [Conflicting defs for getspnam])
1259 ]
1260 )
1261fi
1262
Damien Miller606f8802000-09-16 15:39:56 +11001263AC_FUNC_GETPGRP
1264
Damien Millera64b57a2001-01-17 10:44:13 +11001265# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001266PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001267AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001268 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001269 [
Damien Millera64b57a2001-01-17 10:44:13 +11001270 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001271 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1272 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001273 AC_MSG_ERROR([PAM headers not found])
1274 fi
1275
1276 AC_CHECK_LIB(dl, dlopen, , )
1277 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1278 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001279 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001280
Damien Millera64b57a2001-01-17 10:44:13 +11001281 PAM_MSG="yes"
1282
1283 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001284 if test $ac_cv_lib_dl_dlopen = yes; then
1285 LIBPAM="-lpam -ldl"
1286 else
1287 LIBPAM="-lpam"
1288 fi
1289 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001290 fi
1291 ]
1292)
Damien Millera22ba012000-03-02 23:09:20 +11001293
Damien Millera64b57a2001-01-17 10:44:13 +11001294# Check for older PAM
1295if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001296 # Check PAM strerror arguments (old PAM)
1297 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1298 AC_TRY_COMPILE(
1299 [
Damien Miller81171112000-04-23 11:14:01 +10001300#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001301#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001302#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001303#elif defined (HAVE_PAM_PAM_APPL_H)
1304#include <pam/pam_appl.h>
1305#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001306 ],
1307 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001308 [AC_MSG_RESULT(no)],
1309 [
1310 AC_DEFINE(HAVE_OLD_PAM)
1311 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001312 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001313 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001314 )
Damien Millera22ba012000-03-02 23:09:20 +11001315fi
1316
Tim Riceaef73712002-05-11 13:17:42 -07001317# Search for OpenSSL
1318saved_CPPFLAGS="$CPPFLAGS"
1319saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001320AC_ARG_WITH(ssl-dir,
1321 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1322 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001323 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001324 case "$withval" in
1325 # Relative paths
1326 ./*|../*) withval="`pwd`/$withval"
1327 esac
Tim Riceaef73712002-05-11 13:17:42 -07001328 if test -d "$withval/lib"; then
1329 if test -n "${need_dash_r}"; then
1330 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1331 else
1332 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1333 fi
1334 else
1335 if test -n "${need_dash_r}"; then
1336 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1337 else
1338 LDFLAGS="-L${withval} ${LDFLAGS}"
1339 fi
1340 fi
1341 if test -d "$withval/include"; then
1342 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1343 else
1344 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1345 fi
Damien Millera22ba012000-03-02 23:09:20 +11001346 fi
1347 ]
1348)
Tim Rice3d5352e2004-02-12 09:27:21 -08001349LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001350AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001351 [
Tim Riceaef73712002-05-11 13:17:42 -07001352 dnl Check default openssl install dir
1353 if test -n "${need_dash_r}"; then
1354 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001355 else
Tim Riceaef73712002-05-11 13:17:42 -07001356 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001357 fi
Tim Riceaef73712002-05-11 13:17:42 -07001358 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1359 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1360 [
1361 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1362 ]
1363 )
1364 ]
1365)
1366
Tim Riced730b782002-08-13 18:52:10 -07001367# Determine OpenSSL header version
1368AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001369AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001370 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001371#include <stdio.h>
1372#include <string.h>
1373#include <openssl/opensslv.h>
1374#define DATA "conftest.sslincver"
1375int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001376 FILE *fd;
1377 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001378
Damien Millera8e06ce2003-11-21 23:48:55 +11001379 fd = fopen(DATA,"w");
1380 if(fd == NULL)
1381 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001382
1383 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1384 exit(1);
1385
1386 exit(0);
1387}
Darren Tucker623d92f2004-09-12 22:36:15 +10001388 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001389 [
1390 ssl_header_ver=`cat conftest.sslincver`
1391 AC_MSG_RESULT($ssl_header_ver)
1392 ],
1393 [
1394 AC_MSG_RESULT(not found)
1395 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001396 ],
1397 [
1398 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001399 ]
1400)
1401
1402# Determine OpenSSL library version
1403AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001404AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001405 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001406#include <stdio.h>
1407#include <string.h>
1408#include <openssl/opensslv.h>
1409#include <openssl/crypto.h>
1410#define DATA "conftest.ssllibver"
1411int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001412 FILE *fd;
1413 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001414
Damien Millera8e06ce2003-11-21 23:48:55 +11001415 fd = fopen(DATA,"w");
1416 if(fd == NULL)
1417 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001418
1419 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1420 exit(1);
1421
1422 exit(0);
1423}
Darren Tucker623d92f2004-09-12 22:36:15 +10001424 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001425 [
1426 ssl_library_ver=`cat conftest.ssllibver`
1427 AC_MSG_RESULT($ssl_library_ver)
1428 ],
1429 [
1430 AC_MSG_RESULT(not found)
1431 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001432 ],
1433 [
1434 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001435 ]
1436)
Damien Millera22ba012000-03-02 23:09:20 +11001437
Damien Millerec932372002-01-22 22:16:03 +11001438# Sanity check OpenSSL headers
1439AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001440AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001441 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001442#include <string.h>
1443#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001444int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001445 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001446 [
1447 AC_MSG_RESULT(yes)
1448 ],
1449 [
1450 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001451 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1452Check config.log for details.
1453Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001454 ],
1455 [
1456 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001457 ]
1458)
1459
Tim Rice3d5352e2004-02-12 09:27:21 -08001460# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1461# because the system crypt() is more featureful.
1462if test "x$check_for_libcrypt_before" = "x1"; then
1463 AC_CHECK_LIB(crypt, crypt)
1464fi
1465
Damien Millera8e06ce2003-11-21 23:48:55 +11001466# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001467# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001468if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001469 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001470fi
1471
Damien Miller6c21c512002-01-22 21:57:53 +11001472
1473### Configure cryptographic random number support
1474
1475# Check wheter OpenSSL seeds itself
1476AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001477AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001478 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001479#include <string.h>
1480#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001481int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001482 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001483 [
1484 OPENSSL_SEEDS_ITSELF=yes
1485 AC_MSG_RESULT(yes)
1486 ],
1487 [
1488 AC_MSG_RESULT(no)
1489 # Default to use of the rand helper if OpenSSL doesn't
1490 # seed itself
1491 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001492 ],
1493 [
1494 AC_MSG_WARN([cross compiling: assuming yes])
1495 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001496 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001497 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001498 ]
1499)
1500
1501
1502# Do we want to force the use of the rand helper?
1503AC_ARG_WITH(rand-helper,
1504 [ --with-rand-helper Use subprocess to gather strong randomness ],
1505 [
1506 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001507 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001508 # the previous test showed it to be unseeded.
1509 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1510 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1511 OPENSSL_SEEDS_ITSELF=yes
1512 USE_RAND_HELPER=""
1513 fi
1514 else
1515 USE_RAND_HELPER=yes
1516 fi
1517 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001518)
Damien Miller6c21c512002-01-22 21:57:53 +11001519
1520# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001521if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001522 # OpenSSL only
1523 AC_DEFINE(OPENSSL_PRNG_ONLY)
1524 RAND_MSG="OpenSSL internal ONLY"
1525 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001526elif test ! -z "$USE_RAND_HELPER" ; then
1527 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001528 RAND_MSG="ssh-rand-helper"
1529 INSTALL_SSH_RAND_HELPER="yes"
1530fi
1531AC_SUBST(INSTALL_SSH_RAND_HELPER)
1532
1533### Configuration of ssh-rand-helper
1534
1535# PRNGD TCP socket
1536AC_ARG_WITH(prngd-port,
1537 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1538 [
Damien Millere996d722002-01-23 11:20:59 +11001539 case "$withval" in
1540 no)
1541 withval=""
1542 ;;
1543 [[0-9]]*)
1544 ;;
1545 *)
1546 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1547 ;;
1548 esac
1549 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001550 PRNGD_PORT="$withval"
1551 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1552 fi
1553 ]
1554)
1555
1556# PRNGD Unix domain socket
1557AC_ARG_WITH(prngd-socket,
1558 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1559 [
Damien Millere996d722002-01-23 11:20:59 +11001560 case "$withval" in
1561 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001562 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001563 ;;
1564 no)
1565 withval=""
1566 ;;
1567 /*)
1568 ;;
1569 *)
1570 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1571 ;;
1572 esac
1573
1574 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001575 if test ! -z "$PRNGD_PORT" ; then
1576 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1577 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001578 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001579 AC_MSG_WARN(Entropy socket is not readable)
1580 fi
1581 PRNGD_SOCKET="$withval"
1582 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1583 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001584 ],
1585 [
1586 # Check for existing socket only if we don't have a random device already
1587 if test "$USE_RAND_HELPER" = yes ; then
1588 AC_MSG_CHECKING(for PRNGD/EGD socket)
1589 # Insert other locations here
1590 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1591 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1592 PRNGD_SOCKET="$sock"
1593 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1594 break;
1595 fi
1596 done
1597 if test ! -z "$PRNGD_SOCKET" ; then
1598 AC_MSG_RESULT($PRNGD_SOCKET)
1599 else
1600 AC_MSG_RESULT(not found)
1601 fi
1602 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001603 ]
1604)
1605
1606# Change default command timeout for hashing entropy source
1607entropy_timeout=200
1608AC_ARG_WITH(entropy-timeout,
1609 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1610 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001611 if test -n "$withval" && test "x$withval" != "xno" && \
1612 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001613 entropy_timeout=$withval
1614 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001615 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001616)
Damien Miller6c21c512002-01-22 21:57:53 +11001617AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1618
Damien Millerd3f6ad22002-06-25 10:24:47 +10001619SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001620AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001621 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001622 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001623 if test -n "$withval" && test "x$withval" != "xno" && \
1624 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001625 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001626 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001627 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001628)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001629AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1630AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001631
Tim Rice88f2ab52002-03-17 12:17:34 -08001632# We do this little dance with the search path to insure
1633# that programs that we select for use by installed programs
1634# (which may be run by the super-user) come from trusted
1635# locations before they come from the user's private area.
1636# This should help avoid accidentally configuring some
1637# random version of a program in someone's personal bin.
1638
1639OPATH=$PATH
1640PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001641test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001642test -d /sbin && PATH=$PATH:/sbin
1643test -d /usr/sbin && PATH=$PATH:/usr/sbin
1644PATH=$PATH:/etc:$OPATH
1645
Damien Millera8e06ce2003-11-21 23:48:55 +11001646# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001647OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1648OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1649OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1650OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1651OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1652OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1653OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1654OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1655OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1656OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1657OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1658OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1659OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1660OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1661OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1662OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001663# restore PATH
1664PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001665
1666# Where does ssh-rand-helper get its randomness from?
1667INSTALL_SSH_PRNG_CMDS=""
1668if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1669 if test ! -z "$PRNGD_PORT" ; then
1670 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1671 elif test ! -z "$PRNGD_SOCKET" ; then
1672 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1673 else
1674 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1675 RAND_HELPER_CMDHASH=yes
1676 INSTALL_SSH_PRNG_CMDS="yes"
1677 fi
1678fi
1679AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1680
1681
Ben Lindstromb5628642000-10-18 00:02:25 +00001682# Cheap hack to ensure NEWS-OS libraries are arranged right.
1683if test ! -z "$SONY" ; then
1684 LIBS="$LIBS -liberty";
1685fi
1686
Damien Millera22ba012000-03-02 23:09:20 +11001687# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001688AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001689AC_CHECK_SIZEOF(short int, 2)
1690AC_CHECK_SIZEOF(int, 4)
1691AC_CHECK_SIZEOF(long int, 4)
1692AC_CHECK_SIZEOF(long long int, 8)
1693
Damien Millerfa2bb692002-04-23 23:22:25 +10001694# Sanity check long long for some platforms (AIX)
1695if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1696 ac_cv_sizeof_long_long_int=0
1697fi
1698
Damien Millera22ba012000-03-02 23:09:20 +11001699# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001700AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1701 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001702 [ #include <sys/types.h> ],
1703 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001704 [ ac_cv_have_u_int="yes" ],
1705 [ ac_cv_have_u_int="no" ]
1706 )
1707])
1708if test "x$ac_cv_have_u_int" = "xyes" ; then
1709 AC_DEFINE(HAVE_U_INT)
1710 have_u_int=1
1711fi
1712
Damien Miller61e50f12000-05-08 20:49:37 +10001713AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1714 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001715 [ #include <sys/types.h> ],
1716 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001717 [ ac_cv_have_intxx_t="yes" ],
1718 [ ac_cv_have_intxx_t="no" ]
1719 )
1720])
1721if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1722 AC_DEFINE(HAVE_INTXX_T)
1723 have_intxx_t=1
1724fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001725
1726if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001727 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001728then
1729 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1730 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001731 [ #include <stdint.h> ],
1732 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001733 [
1734 AC_DEFINE(HAVE_INTXX_T)
1735 AC_MSG_RESULT(yes)
1736 ],
1737 [ AC_MSG_RESULT(no) ]
1738 )
1739fi
1740
Damien Miller578783e2000-09-23 14:12:24 +11001741AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1742 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001743 [
1744#include <sys/types.h>
1745#ifdef HAVE_STDINT_H
1746# include <stdint.h>
1747#endif
1748#include <sys/socket.h>
1749#ifdef HAVE_SYS_BITYPES_H
1750# include <sys/bitypes.h>
1751#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001752 ],
1753 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001754 [ ac_cv_have_int64_t="yes" ],
1755 [ ac_cv_have_int64_t="no" ]
1756 )
1757])
1758if test "x$ac_cv_have_int64_t" = "xyes" ; then
1759 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001760fi
1761
Damien Miller61e50f12000-05-08 20:49:37 +10001762AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1763 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001764 [ #include <sys/types.h> ],
1765 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001766 [ ac_cv_have_u_intxx_t="yes" ],
1767 [ ac_cv_have_u_intxx_t="no" ]
1768 )
1769])
1770if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1771 AC_DEFINE(HAVE_U_INTXX_T)
1772 have_u_intxx_t=1
1773fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001774
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001775if test -z "$have_u_intxx_t" ; then
1776 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1777 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001778 [ #include <sys/socket.h> ],
1779 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001780 [
1781 AC_DEFINE(HAVE_U_INTXX_T)
1782 AC_MSG_RESULT(yes)
1783 ],
1784 [ AC_MSG_RESULT(no) ]
1785 )
1786fi
1787
Damien Miller578783e2000-09-23 14:12:24 +11001788AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1789 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001790 [ #include <sys/types.h> ],
1791 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001792 [ ac_cv_have_u_int64_t="yes" ],
1793 [ ac_cv_have_u_int64_t="no" ]
1794 )
1795])
1796if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1797 AC_DEFINE(HAVE_U_INT64_T)
1798 have_u_int64_t=1
1799fi
1800
Tim Rice4cec93f2002-02-26 08:40:48 -08001801if test -z "$have_u_int64_t" ; then
1802 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1803 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001804 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001805 [ u_int64_t a; a = 1],
1806 [
1807 AC_DEFINE(HAVE_U_INT64_T)
1808 AC_MSG_RESULT(yes)
1809 ],
1810 [ AC_MSG_RESULT(no) ]
1811 )
1812fi
1813
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001814if test -z "$have_u_intxx_t" ; then
1815 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1816 AC_TRY_COMPILE(
1817 [
1818#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001819 ],
1820 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001821 [ ac_cv_have_uintxx_t="yes" ],
1822 [ ac_cv_have_uintxx_t="no" ]
1823 )
1824 ])
1825 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1826 AC_DEFINE(HAVE_UINTXX_T)
1827 fi
1828fi
1829
1830if test -z "$have_uintxx_t" ; then
1831 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1832 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001833 [ #include <stdint.h> ],
1834 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001835 [
1836 AC_DEFINE(HAVE_UINTXX_T)
1837 AC_MSG_RESULT(yes)
1838 ],
1839 [ AC_MSG_RESULT(no) ]
1840 )
1841fi
1842
Damien Milleredb82922000-06-20 13:25:52 +10001843if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001844 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001845then
1846 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1847 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001848 [
1849#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001850 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001851 [
Damien Miller70494d12000-04-03 15:57:06 +10001852 int8_t a; int16_t b; int32_t c;
1853 u_int8_t e; u_int16_t f; u_int32_t g;
1854 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001855 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001856 [
1857 AC_DEFINE(HAVE_U_INTXX_T)
1858 AC_DEFINE(HAVE_INTXX_T)
1859 AC_MSG_RESULT(yes)
1860 ],
1861 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001862 )
Damien Millerb29ea912000-01-15 14:12:03 +11001863fi
1864
Damien Miller58be7382001-09-15 21:31:54 +10001865
1866AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1867 AC_TRY_COMPILE(
1868 [
1869#include <sys/types.h>
1870 ],
1871 [ u_char foo; foo = 125; ],
1872 [ ac_cv_have_u_char="yes" ],
1873 [ ac_cv_have_u_char="no" ]
1874 )
1875])
1876if test "x$ac_cv_have_u_char" = "xyes" ; then
1877 AC_DEFINE(HAVE_U_CHAR)
1878fi
1879
Tim Rice13aae5e2001-10-21 17:53:58 -07001880TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001881
Tim Rice200a5c02002-02-26 22:12:34 -08001882AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001883
Damien Miller848b9932005-02-24 12:12:34 +11001884AC_CHECK_TYPES(in_addr_t,,,
1885[#include <sys/types.h>
1886#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001887
Damien Miller61e50f12000-05-08 20:49:37 +10001888AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1889 AC_TRY_COMPILE(
1890 [
1891#include <sys/types.h>
1892 ],
1893 [ size_t foo; foo = 1235; ],
1894 [ ac_cv_have_size_t="yes" ],
1895 [ ac_cv_have_size_t="no" ]
1896 )
1897])
1898if test "x$ac_cv_have_size_t" = "xyes" ; then
1899 AC_DEFINE(HAVE_SIZE_T)
1900fi
Damien Miller95058511999-12-29 10:36:45 +11001901
Damien Miller615f9392000-05-17 22:53:33 +10001902AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1903 AC_TRY_COMPILE(
1904 [
1905#include <sys/types.h>
1906 ],
1907 [ ssize_t foo; foo = 1235; ],
1908 [ ac_cv_have_ssize_t="yes" ],
1909 [ ac_cv_have_ssize_t="no" ]
1910 )
1911])
1912if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1913 AC_DEFINE(HAVE_SSIZE_T)
1914fi
1915
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001916AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1917 AC_TRY_COMPILE(
1918 [
1919#include <time.h>
1920 ],
1921 [ clock_t foo; foo = 1235; ],
1922 [ ac_cv_have_clock_t="yes" ],
1923 [ ac_cv_have_clock_t="no" ]
1924 )
1925])
1926if test "x$ac_cv_have_clock_t" = "xyes" ; then
1927 AC_DEFINE(HAVE_CLOCK_T)
1928fi
1929
Damien Millerb54b40e2000-06-23 08:23:34 +10001930AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1931 AC_TRY_COMPILE(
1932 [
1933#include <sys/types.h>
1934#include <sys/socket.h>
1935 ],
1936 [ sa_family_t foo; foo = 1235; ],
1937 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001938 [ AC_TRY_COMPILE(
1939 [
1940#include <sys/types.h>
1941#include <sys/socket.h>
1942#include <netinet/in.h>
1943 ],
1944 [ sa_family_t foo; foo = 1235; ],
1945 [ ac_cv_have_sa_family_t="yes" ],
1946
Damien Millerb54b40e2000-06-23 08:23:34 +10001947 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001948 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001949 )
1950])
1951if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1952 AC_DEFINE(HAVE_SA_FAMILY_T)
1953fi
1954
Damien Miller0f91b4e2000-06-18 15:43:25 +10001955AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1956 AC_TRY_COMPILE(
1957 [
1958#include <sys/types.h>
1959 ],
1960 [ pid_t foo; foo = 1235; ],
1961 [ ac_cv_have_pid_t="yes" ],
1962 [ ac_cv_have_pid_t="no" ]
1963 )
1964])
1965if test "x$ac_cv_have_pid_t" = "xyes" ; then
1966 AC_DEFINE(HAVE_PID_T)
1967fi
1968
1969AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1970 AC_TRY_COMPILE(
1971 [
1972#include <sys/types.h>
1973 ],
1974 [ mode_t foo; foo = 1235; ],
1975 [ ac_cv_have_mode_t="yes" ],
1976 [ ac_cv_have_mode_t="no" ]
1977 )
1978])
1979if test "x$ac_cv_have_mode_t" = "xyes" ; then
1980 AC_DEFINE(HAVE_MODE_T)
1981fi
1982
Damien Miller61e50f12000-05-08 20:49:37 +10001983
1984AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1985 AC_TRY_COMPILE(
1986 [
Damien Miller81171112000-04-23 11:14:01 +10001987#include <sys/types.h>
1988#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001989 ],
1990 [ struct sockaddr_storage s; ],
1991 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1992 [ ac_cv_have_struct_sockaddr_storage="no" ]
1993 )
1994])
1995if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1996 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1997fi
Damien Miller34132e52000-01-14 15:45:46 +11001998
Damien Miller61e50f12000-05-08 20:49:37 +10001999AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2000 AC_TRY_COMPILE(
2001 [
Damien Miller7b22d652000-06-18 14:07:04 +10002002#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002003#include <netinet/in.h>
2004 ],
2005 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2006 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2007 [ ac_cv_have_struct_sockaddr_in6="no" ]
2008 )
2009])
2010if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2011 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2012fi
Damien Miller34132e52000-01-14 15:45:46 +11002013
Damien Miller61e50f12000-05-08 20:49:37 +10002014AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2015 AC_TRY_COMPILE(
2016 [
Damien Miller7b22d652000-06-18 14:07:04 +10002017#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002018#include <netinet/in.h>
2019 ],
2020 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2021 [ ac_cv_have_struct_in6_addr="yes" ],
2022 [ ac_cv_have_struct_in6_addr="no" ]
2023 )
2024])
2025if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2026 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2027fi
Damien Miller34132e52000-01-14 15:45:46 +11002028
Damien Miller61e50f12000-05-08 20:49:37 +10002029AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2030 AC_TRY_COMPILE(
2031 [
Damien Miller81171112000-04-23 11:14:01 +10002032#include <sys/types.h>
2033#include <sys/socket.h>
2034#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002035 ],
2036 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2037 [ ac_cv_have_struct_addrinfo="yes" ],
2038 [ ac_cv_have_struct_addrinfo="no" ]
2039 )
2040])
2041if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2042 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2043fi
2044
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002045AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2046 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002047 [ #include <sys/time.h> ],
2048 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002049 [ ac_cv_have_struct_timeval="yes" ],
2050 [ ac_cv_have_struct_timeval="no" ]
2051 )
2052])
2053if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2054 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2055 have_struct_timeval=1
2056fi
2057
Tim Rice4e4dc562003-03-18 10:21:40 -08002058AC_CHECK_TYPES(struct timespec)
2059
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002060# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002061if test "x$ac_cv_have_int64_t" = "xno" && \
2062 test "x$ac_cv_sizeof_long_int" != "x8" && \
2063 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002064 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2065 echo "an alternative compiler (I.E., GCC) before continuing."
2066 echo ""
2067 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002068else
2069dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002070 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002071 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002072#include <stdio.h>
2073#include <string.h>
2074#ifdef HAVE_SNPRINTF
2075main()
2076{
2077 char buf[50];
2078 char expected_out[50];
2079 int mazsize = 50 ;
2080#if (SIZEOF_LONG_INT == 8)
2081 long int num = 0x7fffffffffffffff;
2082#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002083 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002084#endif
2085 strcpy(expected_out, "9223372036854775807");
2086 snprintf(buf, mazsize, "%lld", num);
2087 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002088 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002089 exit(0);
2090}
2091#else
2092main() { exit(0); }
2093#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002094 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002095 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002096 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002097fi
2098
Damien Miller78315eb2000-09-29 23:01:36 +11002099dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002100OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2101OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2102OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2103OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2104OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002105OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002106OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2107OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002108OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002109OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2110OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2111OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2112OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002113OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2114OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2115OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2116OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002117
2118AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002119
Damien Miller61e50f12000-05-08 20:49:37 +10002120AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2121 ac_cv_have_ss_family_in_struct_ss, [
2122 AC_TRY_COMPILE(
2123 [
Damien Miller81171112000-04-23 11:14:01 +10002124#include <sys/types.h>
2125#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002126 ],
2127 [ struct sockaddr_storage s; s.ss_family = 1; ],
2128 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2129 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2130 )
2131])
2132if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2133 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2134fi
2135
Damien Miller61e50f12000-05-08 20:49:37 +10002136AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2137 ac_cv_have___ss_family_in_struct_ss, [
2138 AC_TRY_COMPILE(
2139 [
Damien Miller81171112000-04-23 11:14:01 +10002140#include <sys/types.h>
2141#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002142 ],
2143 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2144 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2145 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2146 )
2147])
2148if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2149 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2150fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002151
Damien Millerad833b32000-08-23 10:46:23 +10002152AC_CACHE_CHECK([for pw_class field in struct passwd],
2153 ac_cv_have_pw_class_in_struct_passwd, [
2154 AC_TRY_COMPILE(
2155 [
Damien Millerad833b32000-08-23 10:46:23 +10002156#include <pwd.h>
2157 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002158 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002159 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2160 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2161 )
2162])
2163if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2164 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2165fi
2166
Kevin Steves82456952001-06-22 21:14:18 +00002167AC_CACHE_CHECK([for pw_expire field in struct passwd],
2168 ac_cv_have_pw_expire_in_struct_passwd, [
2169 AC_TRY_COMPILE(
2170 [
2171#include <pwd.h>
2172 ],
2173 [ struct passwd p; p.pw_expire = 0; ],
2174 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2175 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2176 )
2177])
2178if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2179 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2180fi
2181
2182AC_CACHE_CHECK([for pw_change field in struct passwd],
2183 ac_cv_have_pw_change_in_struct_passwd, [
2184 AC_TRY_COMPILE(
2185 [
2186#include <pwd.h>
2187 ],
2188 [ struct passwd p; p.pw_change = 0; ],
2189 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2190 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2191 )
2192])
2193if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2194 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2195fi
Damien Miller61e50f12000-05-08 20:49:37 +10002196
Tim Rice28bbb0c2002-05-27 17:37:32 -07002197dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002198AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2199 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002200 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002201 [
Tim Riceae49fe62002-04-12 10:26:21 -07002202#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002203#include <sys/socket.h>
2204#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002205int main() {
2206#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002207#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002208exit(1);
2209#endif
2210struct msghdr m;
2211m.msg_accrights = 0;
2212exit(0);
2213}
Kevin Steves939c9db2002-03-22 17:23:25 +00002214 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002215 [ ac_cv_have_accrights_in_msghdr="yes" ],
2216 [ ac_cv_have_accrights_in_msghdr="no" ]
2217 )
2218])
2219if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2220 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2221fi
2222
Kevin Stevesa44e0352002-04-07 16:18:03 +00002223AC_CACHE_CHECK([for msg_control field in struct msghdr],
2224 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002225 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002226 [
Tim Riceae49fe62002-04-12 10:26:21 -07002227#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002228#include <sys/socket.h>
2229#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002230int main() {
2231#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002232#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002233exit(1);
2234#endif
2235struct msghdr m;
2236m.msg_control = 0;
2237exit(0);
2238}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002239 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002240 [ ac_cv_have_control_in_msghdr="yes" ],
2241 [ ac_cv_have_control_in_msghdr="no" ]
2242 )
2243])
2244if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2245 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2246fi
2247
Damien Miller61e50f12000-05-08 20:49:37 +10002248AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002249 AC_TRY_LINK([],
2250 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002251 [ ac_cv_libc_defines___progname="yes" ],
2252 [ ac_cv_libc_defines___progname="no" ]
2253 )
2254])
2255if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2256 AC_DEFINE(HAVE___PROGNAME)
2257fi
2258
Kevin Steves4846f4a2002-03-22 18:19:53 +00002259AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2260 AC_TRY_LINK([
2261#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002262],
2263 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002264 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2265 [ ac_cv_cc_implements___FUNCTION__="no" ]
2266 )
2267])
2268if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2269 AC_DEFINE(HAVE___FUNCTION__)
2270fi
2271
2272AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2273 AC_TRY_LINK([
2274#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002275],
2276 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002277 [ ac_cv_cc_implements___func__="yes" ],
2278 [ ac_cv_cc_implements___func__="no" ]
2279 )
2280])
2281if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2282 AC_DEFINE(HAVE___func__)
2283fi
2284
Damien Miller4f8e6692001-07-14 13:22:53 +10002285AC_CACHE_CHECK([whether getopt has optreset support],
2286 ac_cv_have_getopt_optreset, [
2287 AC_TRY_LINK(
2288 [
2289#include <getopt.h>
2290 ],
2291 [ extern int optreset; optreset = 0; ],
2292 [ ac_cv_have_getopt_optreset="yes" ],
2293 [ ac_cv_have_getopt_optreset="no" ]
2294 )
2295])
2296if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2297 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2298fi
Damien Millera22ba012000-03-02 23:09:20 +11002299
Damien Millerecbb26d2000-07-15 14:59:14 +10002300AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002301 AC_TRY_LINK([],
2302 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002303 [ ac_cv_libc_defines_sys_errlist="yes" ],
2304 [ ac_cv_libc_defines_sys_errlist="no" ]
2305 )
2306])
2307if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2308 AC_DEFINE(HAVE_SYS_ERRLIST)
2309fi
2310
2311
Damien Miller11fa2cc2000-08-16 10:35:58 +10002312AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002313 AC_TRY_LINK([],
2314 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002315 [ ac_cv_libc_defines_sys_nerr="yes" ],
2316 [ ac_cv_libc_defines_sys_nerr="no" ]
2317 )
2318])
2319if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2320 AC_DEFINE(HAVE_SYS_NERR)
2321fi
2322
Damien Millera8e06ce2003-11-21 23:48:55 +11002323SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002324# Check whether user wants sectok support
2325AC_ARG_WITH(sectok,
2326 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002327 [
2328 if test "x$withval" != "xno" ; then
2329 if test "x$withval" != "xyes" ; then
2330 CPPFLAGS="$CPPFLAGS -I${withval}"
2331 LDFLAGS="$LDFLAGS -L${withval}"
2332 if test ! -z "$need_dash_r" ; then
2333 LDFLAGS="$LDFLAGS -R${withval}"
2334 fi
2335 if test ! -z "$blibpath" ; then
2336 blibpath="$blibpath:${withval}"
2337 fi
2338 fi
2339 AC_CHECK_HEADERS(sectok.h)
2340 if test "$ac_cv_header_sectok_h" != yes; then
2341 AC_MSG_ERROR(Can't find sectok.h)
2342 fi
2343 AC_CHECK_LIB(sectok, sectok_open)
2344 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2345 AC_MSG_ERROR(Can't find libsectok)
2346 fi
2347 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002348 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002349 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002350 fi
2351 ]
2352)
2353
2354# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002355OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002356AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002357 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2358 [
2359 if test "x$withval" != "xno" ; then
2360 if test "x$withval" != "xyes" ; then
2361 OPENSC_CONFIG=$withval/bin/opensc-config
2362 else
2363 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2364 fi
2365 if test "$OPENSC_CONFIG" != "no"; then
2366 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2367 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2368 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2369 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2370 AC_DEFINE(SMARTCARD)
2371 AC_DEFINE(USE_OPENSC)
2372 SCARD_MSG="yes, using OpenSC"
2373 fi
2374 fi
2375 ]
2376)
Damien Miller85de5802001-09-18 14:01:11 +10002377
Darren Tucker5f88d342003-10-15 16:57:57 +10002378# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002379AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002380 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002381 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002382 # Needed by our getrrsetbyname()
2383 AC_SEARCH_LIBS(res_query, resolv)
2384 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002385 AC_MSG_CHECKING(if res_query will link)
2386 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2387 [AC_MSG_RESULT(no)
2388 saved_LIBS="$LIBS"
2389 LIBS="$LIBS -lresolv"
2390 AC_MSG_CHECKING(for res_query in -lresolv)
2391 AC_LINK_IFELSE([
2392#include <resolv.h>
2393int main()
2394{
2395 res_query (0, 0, 0, 0, 0);
2396 return 0;
2397}
2398 ],
2399 [LIBS="$LIBS -lresolv"
2400 AC_MSG_RESULT(yes)],
2401 [LIBS="$saved_LIBS"
2402 AC_MSG_RESULT(no)])
2403 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002404 AC_CHECK_FUNCS(_getshort _getlong)
2405 AC_CHECK_MEMBER(HEADER.ad,
2406 [AC_DEFINE(HAVE_HEADER_AD)],,
2407 [#include <arpa/nameser.h>])
2408 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002409
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002410# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002411KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002412AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002413 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002414 [ if test "x$withval" != "xno" ; then
2415 if test "x$withval" = "xyes" ; then
2416 KRB5ROOT="/usr/local"
2417 else
2418 KRB5ROOT=${withval}
2419 fi
2420
2421 AC_DEFINE(KRB5)
2422 KRB5_MSG="yes"
2423
2424 AC_MSG_CHECKING(for krb5-config)
2425 if test -x $KRB5ROOT/bin/krb5-config ; then
2426 KRB5CONF=$KRB5ROOT/bin/krb5-config
2427 AC_MSG_RESULT($KRB5CONF)
2428
2429 AC_MSG_CHECKING(for gssapi support)
2430 if $KRB5CONF | grep gssapi >/dev/null ; then
2431 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002432 AC_DEFINE(GSSAPI)
2433 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002434 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002435 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002436 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002437 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002438 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2439 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002440 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002441 AC_MSG_CHECKING(whether we are using Heimdal)
2442 AC_TRY_COMPILE([ #include <krb5.h> ],
2443 [ char *tmp = heimdal_version; ],
2444 [ AC_MSG_RESULT(yes)
2445 AC_DEFINE(HEIMDAL) ],
2446 AC_MSG_RESULT(no)
2447 )
2448 else
2449 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002450 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002451 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002452 AC_MSG_CHECKING(whether we are using Heimdal)
2453 AC_TRY_COMPILE([ #include <krb5.h> ],
2454 [ char *tmp = heimdal_version; ],
2455 [ AC_MSG_RESULT(yes)
2456 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002457 K5LIBS="-lkrb5 -ldes"
2458 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002459 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002460 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002461 ],
2462 [ AC_MSG_RESULT(no)
2463 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2464 ]
2465 )
Damien Miller200d0a72003-06-30 19:21:36 +10002466 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002467
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002468 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2469 [ AC_DEFINE(GSSAPI)
2470 K5LIBS="-lgssapi $K5LIBS" ],
2471 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2472 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002473 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002474 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2475 $K5LIBS)
2476 ],
2477 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002478
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002479 AC_CHECK_HEADER(gssapi.h, ,
2480 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002481 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002482 AC_CHECK_HEADERS(gssapi.h, ,
2483 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002484 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002485 ]
2486 )
2487
2488 oldCPP="$CPPFLAGS"
2489 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2490 AC_CHECK_HEADER(gssapi_krb5.h, ,
2491 [ CPPFLAGS="$oldCPP" ])
2492
Damien Millera8e06ce2003-11-21 23:48:55 +11002493 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002494 if test ! -z "$need_dash_r" ; then
2495 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2496 fi
2497 if test ! -z "$blibpath" ; then
2498 blibpath="$blibpath:${KRB5ROOT}/lib"
2499 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002500 fi
2501
2502 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2503 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2504 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2505
2506 LIBS="$LIBS $K5LIBS"
2507 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002508 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002509 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002510)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002511
Damien Millera22ba012000-03-02 23:09:20 +11002512# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002513
Damien Millerf58c6722002-05-13 13:15:42 +10002514PRIVSEP_PATH=/var/empty
2515AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002516 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002517 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002518 if test -n "$withval" && test "x$withval" != "xno" && \
2519 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002520 PRIVSEP_PATH=$withval
2521 fi
2522 ]
2523)
2524AC_SUBST(PRIVSEP_PATH)
2525
Damien Millera22ba012000-03-02 23:09:20 +11002526AC_ARG_WITH(xauth,
2527 [ --with-xauth=PATH Specify path to xauth program ],
2528 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002529 if test -n "$withval" && test "x$withval" != "xno" && \
2530 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002531 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002532 fi
2533 ],
2534 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002535 TestPath="$PATH"
2536 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2537 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2538 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2539 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2540 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002541 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002542 xauth_path="/usr/openwin/bin/xauth"
2543 fi
2544 ]
2545)
2546
Damien Miller7d901272003-01-13 16:55:22 +11002547STRIP_OPT=-s
2548AC_ARG_ENABLE(strip,
2549 [ --disable-strip Disable calling strip(1) on install],
2550 [
2551 if test "x$enableval" = "xno" ; then
2552 STRIP_OPT=
2553 fi
2554 ]
2555)
2556AC_SUBST(STRIP_OPT)
2557
Damien Millera19cf472000-11-29 13:28:50 +11002558if test -z "$xauth_path" ; then
2559 XAUTH_PATH="undefined"
2560 AC_SUBST(XAUTH_PATH)
2561else
Damien Millera22ba012000-03-02 23:09:20 +11002562 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002563 XAUTH_PATH=$xauth_path
2564 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002565fi
Damien Millera22ba012000-03-02 23:09:20 +11002566
2567# Check for mail directory (last resort if we cannot get it from headers)
2568if test ! -z "$MAIL" ; then
2569 maildir=`dirname $MAIL`
2570 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2571fi
2572
Darren Tucker623d92f2004-09-12 22:36:15 +10002573if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002574 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2575 disable_ptmx_check=yes
2576fi
Damien Millera22ba012000-03-02 23:09:20 +11002577if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002578 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002579 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002580 [
2581 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2582 have_dev_ptmx=1
2583 ]
2584 )
2585 fi
Damien Millera22ba012000-03-02 23:09:20 +11002586fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002587
Darren Tucker623d92f2004-09-12 22:36:15 +10002588if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002589 AC_CHECK_FILE("/dev/ptc",
2590 [
2591 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2592 have_dev_ptc=1
2593 ]
2594 )
2595else
2596 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2597fi
Damien Miller204ad072000-03-02 23:56:12 +11002598
Damien Millera22ba012000-03-02 23:09:20 +11002599# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002600AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002601 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002602 [
Damien Miller897741e2001-04-16 10:41:46 +10002603 case "$withval" in
2604 man|cat|doc)
2605 MANTYPE=$withval
2606 ;;
2607 *)
2608 AC_MSG_ERROR(invalid man type: $withval)
2609 ;;
2610 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002611 ]
2612)
Ben Lindstrombc709922001-04-18 18:04:21 +00002613if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002614 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2615 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002616 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2617 MANTYPE=doc
2618 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2619 MANTYPE=man
2620 else
2621 MANTYPE=cat
2622 fi
2623fi
Damien Miller670a4b82000-01-22 13:53:11 +11002624AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002625if test "$MANTYPE" = "doc"; then
2626 mansubdir=man;
2627else
2628 mansubdir=$MANTYPE;
2629fi
2630AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002631
Damien Millera22ba012000-03-02 23:09:20 +11002632# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002633MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002634AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002635 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002636 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002637 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002638 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002639 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002640 fi
2641 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002642)
2643
Damien Millera22ba012000-03-02 23:09:20 +11002644# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002645AC_ARG_WITH(shadow,
2646 [ --without-shadow Disable shadow password support],
2647 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002648 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002649 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002650 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002651 fi
2652 ]
2653)
2654
Damien Miller1f335fb2000-06-26 11:31:33 +10002655if test -z "$disable_shadow" ; then
2656 AC_MSG_CHECKING([if the systems has expire shadow information])
2657 AC_TRY_COMPILE(
2658 [
2659#include <sys/types.h>
2660#include <shadow.h>
2661 struct spwd sp;
2662 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2663 [ sp_expire_available=yes ], []
2664 )
2665
2666 if test "x$sp_expire_available" = "xyes" ; then
2667 AC_MSG_RESULT(yes)
2668 AC_DEFINE(HAS_SHADOW_EXPIRE)
2669 else
2670 AC_MSG_RESULT(no)
2671 fi
2672fi
2673
Damien Millera22ba012000-03-02 23:09:20 +11002674# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002675if test ! -z "$IPADDR_IN_DISPLAY" ; then
2676 DISPLAY_HACK_MSG="yes"
2677 AC_DEFINE(IPADDR_IN_DISPLAY)
2678else
Damien Millera8e06ce2003-11-21 23:48:55 +11002679 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002680 AC_ARG_WITH(ipaddr-display,
2681 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2682 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002683 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002684 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002685 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002686 fi
2687 ]
2688 )
2689fi
Damien Miller76112de1999-12-21 11:18:08 +11002690
Darren Tuckere1a790d2003-09-16 11:52:19 +10002691# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002692AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002693 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002694 [ if test "x$enableval" = "xno"; then
2695 AC_MSG_NOTICE([/etc/default/login handling disabled])
2696 etc_default_login=no
2697 else
2698 etc_default_login=yes
2699 fi ],
2700 [ etc_default_login=yes ]
2701)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002702
Darren Tucker2f9573d2005-02-10 22:28:54 +11002703if test "x$etc_default_login" != "xno"; then
2704 AC_CHECK_FILE("/etc/default/login",
2705 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002706 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2707 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002708 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2709 elif test "x$external_path_file" = "x/etc/default/login"; then
2710 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2711 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002712fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002713
Tim Rice43a1c132002-04-17 21:19:14 -07002714dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002715if test $ac_cv_func_login_getcapbool = "yes" && \
2716 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002717 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002718fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002719
Damien Millera22ba012000-03-02 23:09:20 +11002720# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002721SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002722AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002723 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002724 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002725 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002726 AC_MSG_WARN([
2727--with-default-path=PATH has no effect on this system.
2728Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002729 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002730 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002731 AC_MSG_WARN([
2732--with-default-path=PATH will only be used if PATH is not defined in
2733$external_path_file .])
2734 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002735 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002736 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002737 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002738 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002739 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2740 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002741 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002742 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002743 AC_MSG_WARN([
2744If PATH is defined in $external_path_file, ensure the path to scp is included,
2745otherwise scp will not work.])
2746 fi
2747 AC_TRY_RUN(
2748 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002749/* find out what STDPATH is */
2750#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002751#ifdef HAVE_PATHS_H
2752# include <paths.h>
2753#endif
2754#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002755# ifdef _PATH_USERPATH /* Irix */
2756# define _PATH_STDPATH _PATH_USERPATH
2757# else
2758# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2759# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002760#endif
2761#include <sys/types.h>
2762#include <sys/stat.h>
2763#include <fcntl.h>
2764#define DATA "conftest.stdpath"
2765
2766main()
2767{
2768 FILE *fd;
2769 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002770
Tim Rice59ea0a02001-03-10 13:50:45 -08002771 fd = fopen(DATA,"w");
2772 if(fd == NULL)
2773 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002774
Tim Rice59ea0a02001-03-10 13:50:45 -08002775 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2776 exit(1);
2777
2778 exit(0);
2779}
2780 ], [ user_path=`cat conftest.stdpath` ],
2781 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2782 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2783 )
2784# make sure $bindir is in USER_PATH so scp will work
2785 t_bindir=`eval echo ${bindir}`
2786 case $t_bindir in
2787 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2788 esac
2789 case $t_bindir in
2790 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2791 esac
2792 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2793 if test $? -ne 0 ; then
2794 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2795 if test $? -ne 0 ; then
2796 user_path=$user_path:$t_bindir
2797 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2798 fi
2799 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002800 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002801)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002802if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002803 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2804 AC_SUBST(user_path)
2805fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002806
Damien Millera18bbd32002-05-13 10:48:57 +10002807# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002808AC_ARG_WITH(superuser-path,
2809 [ --with-superuser-path= Specify different path for super-user],
2810 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002811 if test -n "$withval" && test "x$withval" != "xno" && \
2812 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002813 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2814 superuser_path=$withval
2815 fi
2816 ]
2817)
2818
2819
Damien Miller61e50f12000-05-08 20:49:37 +10002820AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002821IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002822AC_ARG_WITH(4in6,
2823 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2824 [
2825 if test "x$withval" != "xno" ; then
2826 AC_MSG_RESULT(yes)
2827 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002828 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002829 else
2830 AC_MSG_RESULT(no)
2831 fi
2832 ],[
2833 if test "x$inet6_default_4in6" = "xyes"; then
2834 AC_MSG_RESULT([yes (default)])
2835 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002836 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002837 else
2838 AC_MSG_RESULT([no (default)])
2839 fi
2840 ]
2841)
2842
Damien Miller60396b02001-02-18 17:01:00 +11002843# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002844BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002845AC_ARG_WITH(bsd-auth,
2846 [ --with-bsd-auth Enable BSD auth support],
2847 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002848 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002849 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002850 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002851 fi
2852 ]
2853)
2854
Damien Millera22ba012000-03-02 23:09:20 +11002855# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002856piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002857# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002858if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002859 piddir=`eval echo ${sysconfdir}`
2860 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002861 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002862 esac
2863fi
2864
Tim Rice88f2ab52002-03-17 12:17:34 -08002865AC_ARG_WITH(pid-dir,
2866 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2867 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002868 if test -n "$withval" && test "x$withval" != "xno" && \
2869 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002870 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08002871 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002872 AC_MSG_WARN([** no $piddir directory on this system **])
2873 fi
2874 fi
2875 ]
2876)
2877
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002878AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002879AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002880
andre2ff7b5d2000-06-03 14:57:40 +00002881dnl allow user to disable some login recording features
2882AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002883 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002884 [
2885 if test "x$enableval" = "xno" ; then
2886 AC_DEFINE(DISABLE_LASTLOG)
2887 fi
2888 ]
andre2ff7b5d2000-06-03 14:57:40 +00002889)
2890AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002891 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002892 [
2893 if test "x$enableval" = "xno" ; then
2894 AC_DEFINE(DISABLE_UTMP)
2895 fi
2896 ]
andre2ff7b5d2000-06-03 14:57:40 +00002897)
2898AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002899 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002900 [
2901 if test "x$enableval" = "xno" ; then
2902 AC_DEFINE(DISABLE_UTMPX)
2903 fi
2904 ]
andre2ff7b5d2000-06-03 14:57:40 +00002905)
2906AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002907 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002908 [
2909 if test "x$enableval" = "xno" ; then
2910 AC_DEFINE(DISABLE_WTMP)
2911 fi
2912 ]
andre2ff7b5d2000-06-03 14:57:40 +00002913)
2914AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002915 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002916 [
2917 if test "x$enableval" = "xno" ; then
2918 AC_DEFINE(DISABLE_WTMPX)
2919 fi
2920 ]
andre2ff7b5d2000-06-03 14:57:40 +00002921)
2922AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002923 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002924 [
2925 if test "x$enableval" = "xno" ; then
2926 AC_DEFINE(DISABLE_LOGIN)
2927 fi
2928 ]
andre2ff7b5d2000-06-03 14:57:40 +00002929)
2930AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002931 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002932 [
2933 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002934 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002935 fi
2936 ]
andre2ff7b5d2000-06-03 14:57:40 +00002937)
2938AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002939 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002940 [
2941 if test "x$enableval" = "xno" ; then
2942 AC_DEFINE(DISABLE_PUTUTXLINE)
2943 fi
2944 ]
andre2ff7b5d2000-06-03 14:57:40 +00002945)
2946AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002947 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002948 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002949 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11002950 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08002951 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11002952 conf_lastlog_location=$withval
2953 fi
2954 ]
2955)
andre2ff7b5d2000-06-03 14:57:40 +00002956
2957dnl lastlog, [uw]tmpx? detection
2958dnl NOTE: set the paths in the platform section to avoid the
2959dnl need for command-line parameters
2960dnl lastlog and [uw]tmp are subject to a file search if all else fails
2961
2962dnl lastlog detection
2963dnl NOTE: the code itself will detect if lastlog is a directory
2964AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2965AC_TRY_COMPILE([
2966#include <sys/types.h>
2967#include <utmp.h>
2968#ifdef HAVE_LASTLOG_H
2969# include <lastlog.h>
2970#endif
Damien Miller2994e082000-06-04 15:51:47 +10002971#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002972# include <paths.h>
2973#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002974#ifdef HAVE_LOGIN_H
2975# include <login.h>
2976#endif
andre2ff7b5d2000-06-03 14:57:40 +00002977 ],
2978 [ char *lastlog = LASTLOG_FILE; ],
2979 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002980 [
2981 AC_MSG_RESULT(no)
2982 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2983 AC_TRY_COMPILE([
2984#include <sys/types.h>
2985#include <utmp.h>
2986#ifdef HAVE_LASTLOG_H
2987# include <lastlog.h>
2988#endif
2989#ifdef HAVE_PATHS_H
2990# include <paths.h>
2991#endif
2992 ],
2993 [ char *lastlog = _PATH_LASTLOG; ],
2994 [ AC_MSG_RESULT(yes) ],
2995 [
andree441aa32000-06-12 22:34:38 +00002996 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002997 system_lastlog_path=no
2998 ])
2999 ]
andre2ff7b5d2000-06-03 14:57:40 +00003000)
Damien Miller2994e082000-06-04 15:51:47 +10003001
andre2ff7b5d2000-06-03 14:57:40 +00003002if test -z "$conf_lastlog_location"; then
3003 if test x"$system_lastlog_path" = x"no" ; then
3004 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003005 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003006 conf_lastlog_location=$f
3007 fi
3008 done
3009 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003010 AC_MSG_WARN([** Cannot find lastlog **])
3011 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003012 fi
3013 fi
3014fi
3015
3016if test -n "$conf_lastlog_location"; then
3017 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003018fi
andre2ff7b5d2000-06-03 14:57:40 +00003019
3020dnl utmp detection
3021AC_MSG_CHECKING([if your system defines UTMP_FILE])
3022AC_TRY_COMPILE([
3023#include <sys/types.h>
3024#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003025#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003026# include <paths.h>
3027#endif
3028 ],
3029 [ char *utmp = UTMP_FILE; ],
3030 [ AC_MSG_RESULT(yes) ],
3031 [ AC_MSG_RESULT(no)
3032 system_utmp_path=no ]
3033)
3034if test -z "$conf_utmp_location"; then
3035 if test x"$system_utmp_path" = x"no" ; then
3036 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3037 if test -f $f ; then
3038 conf_utmp_location=$f
3039 fi
3040 done
3041 if test -z "$conf_utmp_location"; then
3042 AC_DEFINE(DISABLE_UTMP)
3043 fi
3044 fi
3045fi
3046if test -n "$conf_utmp_location"; then
3047 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003048fi
andre2ff7b5d2000-06-03 14:57:40 +00003049
3050dnl wtmp detection
3051AC_MSG_CHECKING([if your system defines WTMP_FILE])
3052AC_TRY_COMPILE([
3053#include <sys/types.h>
3054#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003055#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003056# include <paths.h>
3057#endif
3058 ],
3059 [ char *wtmp = WTMP_FILE; ],
3060 [ AC_MSG_RESULT(yes) ],
3061 [ AC_MSG_RESULT(no)
3062 system_wtmp_path=no ]
3063)
3064if test -z "$conf_wtmp_location"; then
3065 if test x"$system_wtmp_path" = x"no" ; then
3066 for f in /usr/adm/wtmp /var/log/wtmp; do
3067 if test -f $f ; then
3068 conf_wtmp_location=$f
3069 fi
3070 done
3071 if test -z "$conf_wtmp_location"; then
3072 AC_DEFINE(DISABLE_WTMP)
3073 fi
3074 fi
3075fi
3076if test -n "$conf_wtmp_location"; then
3077 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003078fi
andre2ff7b5d2000-06-03 14:57:40 +00003079
3080
3081dnl utmpx detection - I don't know any system so perverse as to require
3082dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3083dnl there, though.
3084AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3085AC_TRY_COMPILE([
3086#include <sys/types.h>
3087#include <utmp.h>
3088#ifdef HAVE_UTMPX_H
3089#include <utmpx.h>
3090#endif
Damien Miller2994e082000-06-04 15:51:47 +10003091#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003092# include <paths.h>
3093#endif
3094 ],
3095 [ char *utmpx = UTMPX_FILE; ],
3096 [ AC_MSG_RESULT(yes) ],
3097 [ AC_MSG_RESULT(no)
3098 system_utmpx_path=no ]
3099)
3100if test -z "$conf_utmpx_location"; then
3101 if test x"$system_utmpx_path" = x"no" ; then
3102 AC_DEFINE(DISABLE_UTMPX)
3103 fi
3104else
3105 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003106fi
andre2ff7b5d2000-06-03 14:57:40 +00003107
3108dnl wtmpx detection
3109AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3110AC_TRY_COMPILE([
3111#include <sys/types.h>
3112#include <utmp.h>
3113#ifdef HAVE_UTMPX_H
3114#include <utmpx.h>
3115#endif
Damien Miller2994e082000-06-04 15:51:47 +10003116#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003117# include <paths.h>
3118#endif
3119 ],
3120 [ char *wtmpx = WTMPX_FILE; ],
3121 [ AC_MSG_RESULT(yes) ],
3122 [ AC_MSG_RESULT(no)
3123 system_wtmpx_path=no ]
3124)
3125if test -z "$conf_wtmpx_location"; then
3126 if test x"$system_wtmpx_path" = x"no" ; then
3127 AC_DEFINE(DISABLE_WTMPX)
3128 fi
3129else
3130 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003131fi
andre2ff7b5d2000-06-03 14:57:40 +00003132
Damien Miller4018c192000-04-30 09:30:44 +10003133
Damien Miller29ea30d2000-03-17 10:54:15 +11003134if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003135 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3136 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003137fi
3138
Tim Rice4cec93f2002-02-26 08:40:48 -08003139dnl remove pam and dl because they are in $LIBPAM
3140if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003141 LIBS=`echo $LIBS | sed 's/-lpam //'`
3142fi
3143if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3144 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003145fi
3146
Damien Millerbac2d8a2000-09-05 16:13:06 +11003147AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003148AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3149 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003150AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003151
Damien Miller7b22d652000-06-18 14:07:04 +10003152# Print summary of options
3153
Damien Miller7b22d652000-06-18 14:07:04 +10003154# Someone please show me a better way :)
3155A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3156B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3157C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3158D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003159E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003160F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003161G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003162H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3163I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3164J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003165
3166echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003167echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003168echo " User binaries: $B"
3169echo " System binaries: $C"
3170echo " Configuration files: $D"
3171echo " Askpass program: $E"
3172echo " Manual pages: $F"
3173echo " PID file: $G"
3174echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003175if test "x$external_path_file" = "x/etc/login.conf" ; then
3176echo " At runtime, sshd will use the path defined in $external_path_file"
3177echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003178else
Damien Millerf58c6722002-05-13 13:15:42 +10003179echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003180 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003181echo " (If PATH is set in $external_path_file it will be used instead. If"
3182echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3183 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003184fi
Damien Millera18bbd32002-05-13 10:48:57 +10003185if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003186echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003187fi
Damien Millerf58c6722002-05-13 13:15:42 +10003188echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003189echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003190echo " KerberosV support: $KRB5_MSG"
3191echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003192echo " S/KEY support: $SKEY_MSG"
3193echo " TCP Wrappers support: $TCPW_MSG"
3194echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003195echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003196echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003197echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3198echo " BSD Auth support: $BSD_AUTH_MSG"
3199echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003200if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003201echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003202fi
3203
Damien Miller7b22d652000-06-18 14:07:04 +10003204echo ""
3205
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003206echo " Host: ${host}"
3207echo " Compiler: ${CC}"
3208echo " Compiler flags: ${CFLAGS}"
3209echo "Preprocessor flags: ${CPPFLAGS}"
3210echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003211echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003212
3213echo ""
3214
Tim Rice6f1f7582004-05-30 21:38:51 -07003215if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003216 echo "SVR4 style packages are supported with \"make package\""
3217 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003218fi
3219
Damien Miller82cf0ce2000-12-20 13:34:48 +11003220if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003221 echo "PAM is enabled. You may need to install a PAM control file "
3222 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003223 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003224 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003225 echo ""
3226fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003227
Damien Miller6c21c512002-01-22 21:57:53 +11003228if test ! -z "$RAND_HELPER_CMDHASH" ; then
3229 echo "WARNING: you are using the builtin random number collection "
3230 echo "service. Please read WARNING.RNG and request that your OS "
3231 echo "vendor includes kernel-based random number collection in "
3232 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003233 echo ""
3234fi
Damien Miller60396b02001-02-18 17:01:00 +11003235
Damien Millerb4097182004-05-23 14:09:40 +10003236if test ! -z "$NO_PEERCHECK" ; then
3237 echo "WARNING: the operating system that you are using does not "
3238 echo "appear to support either the getpeereid() API nor the "
3239 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3240 echo "enforce security checks to prevent unauthorised connections to "
3241 echo "ssh-agent. Their absence increases the risk that a malicious "
3242 echo "user can connect to your agent. "
3243 echo ""
3244fi
3245
Darren Tuckerd9f88912005-02-20 21:01:48 +11003246if test "$AUDIT_MODULE" = "bsm" ; then
3247 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3248 echo "See the Solaris section in README.platform for details."
3249fi