blob: a936d2bfd32146d8fb83754e95f0f90364ef6e84 [file] [log] [blame]
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001# $Id: configure.ac,v 1.263 2005/05/27 11:13:41 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 Millerde3cb0a2005-05-26 20:48:25 +100082
83 # Check for -std=gnu99 support (needed for LLONG_MIN/MAX on Linux)
84 saved_CFLAGS="$CFLAGS"
85 CFLAGS="$CFLAGS -std=gnu99"
86 AC_MSG_CHECKING(whether cc accepts -std=gnu99 option)
87 AC_TRY_COMPILE([], [return(0);], [AC_MSG_RESULT(yes)],
88 [AC_MSG_RESULT(no)
89 CFLAGS="$saved_CFLAGS"],
90 )
Damien Miller166bd442000-03-16 10:48:25 +110091fi
92
Tim Rice88368a32003-12-08 12:35:59 -080093AC_ARG_WITH(rpath,
94 [ --without-rpath Disable auto-added -R linker paths],
95 [
Tim Riceeae17cc2005-03-17 16:52:20 -080096 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -080097 need_dash_r=""
98 fi
99 if test "x$withval" = "xyes" ; then
100 need_dash_r=1
101 fi
102 ]
103)
104
Damien Millera22ba012000-03-02 23:09:20 +1100105# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100106case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100107*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100108 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000109 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800110 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100111 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000112 saved_LDFLAGS="$LDFLAGS"
113 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
114 if (test -z "$blibflags"); then
115 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
116 AC_TRY_LINK([], [], [blibflags=$tryflags])
117 fi
118 done
119 if (test -z "$blibflags"); then
120 AC_MSG_RESULT(not found)
121 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
122 else
123 AC_MSG_RESULT($blibflags)
124 fi
125 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000126 dnl Check for authenticate. Might be in libs.a on older AIXes
127 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700128 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700130 LIBS="$LIBS -ls"
131 ])
132 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100133 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100134 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100135 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000136 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100137 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000138 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
139 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000140 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000141 [(void)loginfailed("user","host","tty",0);],
142 [AC_MSG_RESULT(yes)
143 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000144 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000145 )],
146 [],
147 [#include <usersec.h>]
148 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000149 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100150 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000151 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000152 AC_DEFINE(SETEUID_BREAKS_SETUID)
153 AC_DEFINE(BROKEN_SETREUID)
154 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000155 dnl AIX handles lastlog as part of its login message
156 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000158 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100159 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100160*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100161 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800162 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100163 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000164 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100165 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100166 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000167 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000168 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700169 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100170 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000171*-*-dgux*)
172 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100173 AC_DEFINE(SETEUID_BREAKS_SETUID)
174 AC_DEFINE(BROKEN_SETREUID)
175 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000176 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000177*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000178 AC_MSG_CHECKING(if we have working getaddrinfo)
179 AC_TRY_RUN([#include <mach-o/dyld.h>
180main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
181 exit(0);
182 else
183 exit(1);
184}], [AC_MSG_RESULT(working)],
185 [AC_MSG_RESULT(buggy)
186 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700187 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000188 AC_DEFINE(SETEUID_BREAKS_SETUID)
189 AC_DEFINE(BROKEN_SETREUID)
190 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100191 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000192 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000193*-*-hpux10.26)
194 if test -z "$GCC"; then
195 CFLAGS="$CFLAGS -Ae"
196 fi
197 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
198 IPADDR_IN_DISPLAY=yes
199 AC_DEFINE(HAVE_SECUREWARE)
200 AC_DEFINE(USE_PIPES)
201 AC_DEFINE(LOGIN_NO_ENDOPT)
202 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000203 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000204 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700205 LIBS="$LIBS -lsec -lsecpw"
206 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000207 disable_ptmx_check=yes
208 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100209*-*-hpux10*)
210 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000211 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100212 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100214 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000215 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000216 AC_DEFINE(LOGIN_NO_ENDOPT)
217 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000218 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000219 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700220 LIBS="$LIBS -lsec"
221 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100222 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000223*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000224 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100225 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100226 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100227 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000228 AC_DEFINE(LOGIN_NO_ENDOPT)
229 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100230 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000231 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000232 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker2fba9932005-02-02 23:30:24 +1100233 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Darren Tucker4398cf52004-04-06 21:39:02 +1000234 check_for_hpux_broken_getaddrinfo=1
Darren Tuckera56f1912004-11-02 20:30:54 +1100235 check_for_conflicting_getspnam=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700236 LIBS="$LIBS -lsec"
237 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000238 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100239*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100240 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000241 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000242 AC_DEFINE(SETEUID_BREAKS_SETUID)
243 AC_DEFINE(BROKEN_SETREUID)
244 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000245 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000246 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100247 ;;
248*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100249 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000250 AC_DEFINE(WITH_IRIX_ARRAY)
251 AC_DEFINE(WITH_IRIX_PROJECT)
252 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000253 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000254 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000255 AC_DEFINE(SETEUID_BREAKS_SETUID)
256 AC_DEFINE(BROKEN_SETREUID)
257 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000258 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000259 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000260 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100261 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100262*-*-linux*)
263 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100264 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000265 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100266 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000267 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000268 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000269 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000270 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100271 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
272 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100273 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000274 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000275 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000276 AC_DEFINE(BROKEN_CMSG_TYPE)
277 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000278 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100279 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000280mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000281 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000282 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000283 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100284*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000285 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800286 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800287 need_dash_r=1
288 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100289 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100290*-*-freebsd*)
291 check_for_libcrypt_later=1
292 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000293*-*-bsdi*)
294 AC_DEFINE(SETEUID_BREAKS_SETUID)
295 AC_DEFINE(BROKEN_SETREUID)
296 AC_DEFINE(BROKEN_SETREGID)
297 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000298*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000299 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100300 conf_utmp_location=/etc/utmp
301 conf_wtmp_location=/usr/adm/wtmp
302 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000303 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000304 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000305 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100306 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000307 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100308*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800309 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800310 need_dash_r=1
311 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100312 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000313 AC_DEFINE(LOGIN_NEEDS_UTMPX)
314 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000315 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000316 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000317 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000318 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
319 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000320 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000321 # hardwire lastlog location (can't detect it on some versions)
322 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000323 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
324 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
325 if test "$sol2ver" -ge 8; then
326 AC_MSG_RESULT(yes)
327 AC_DEFINE(DISABLE_UTMP)
328 AC_DEFINE(DISABLE_WTMP)
329 else
330 AC_MSG_RESULT(no)
331 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100332 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000333*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000334 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000335 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100336 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000337 conf_utmp_location=/etc/utmp
338 conf_wtmp_location=/var/adm/wtmp
339 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000340 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000341 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000342*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700343 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000344 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000345 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000346 AC_DEFINE(SETEUID_BREAKS_SETUID)
347 AC_DEFINE(BROKEN_SETREUID)
348 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000349 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000350*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700351 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000352 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100353 # -lresolv needs to be at then end of LIBS or DNS lookups break
354 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100355 IPADDR_IN_DISPLAY=yes
356 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000357 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000358 AC_DEFINE(SETEUID_BREAKS_SETUID)
359 AC_DEFINE(BROKEN_SETREUID)
360 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000361 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000362 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700363 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
364 # Attention: always take care to bind libsocket and libnsl before libc,
365 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000366 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800367# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100368*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100369 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700370 AC_DEFINE(SETEUID_BREAKS_SETUID)
371 AC_DEFINE(BROKEN_SETREUID)
372 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700373 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100374 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800375# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100376*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100377 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700378 AC_DEFINE(SETEUID_BREAKS_SETUID)
379 AC_DEFINE(BROKEN_SETREUID)
380 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700381 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100382 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100383*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100384 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800385# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100386*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800387 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100388 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800389# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100390*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800391 if test -z "$GCC"; then
392 CFLAGS="$CFLAGS -belf"
393 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100394 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000395 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100396 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000397 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000398 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700399 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700400 AC_DEFINE(SETEUID_BREAKS_SETUID)
401 AC_DEFINE(BROKEN_SETREUID)
402 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700403 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700404 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100405 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100406 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700407 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700408 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000409 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000410*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100411 AC_DEFINE(NO_SSH_LASTLOG)
412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000415 AC_DEFINE(USE_PIPES)
416 AC_DEFINE(DISABLE_FD_PASSING)
417 LDFLAGS="$LDFLAGS"
418 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
419 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000420 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000421*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100422 AC_DEFINE(SETEUID_BREAKS_SETUID)
423 AC_DEFINE(BROKEN_SETREUID)
424 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000425 AC_DEFINE(WITH_ABBREV_NO_TTY)
426 AC_DEFINE(USE_PIPES)
427 AC_DEFINE(DISABLE_FD_PASSING)
428 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100429 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000430 MANTYPE=cat
431 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000432*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000436 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700437 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700438 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000439 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
440 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
441 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700442 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000443*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000444 AC_MSG_CHECKING(for Digital Unix SIA)
445 no_osfsia=""
446 AC_ARG_WITH(osfsia,
447 [ --with-osfsia Enable Digital Unix SIA],
448 [
449 if test "x$withval" = "xno" ; then
450 AC_MSG_RESULT(disabled)
451 no_osfsia=1
452 fi
453 ],
454 )
455 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000456 if test -f /etc/sia/matrix.conf; then
457 AC_MSG_RESULT(yes)
458 AC_DEFINE(HAVE_OSF_SIA)
459 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000460 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000461 LIBS="$LIBS -lsecurity -ldb -lm -laud"
462 else
463 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100464 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000465 fi
466 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000467 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700468 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000471 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000472
473*-*-nto-qnx)
474 AC_DEFINE(USE_PIPES)
475 AC_DEFINE(NO_X11_UNIX_SOCKETS)
476 AC_DEFINE(MISSING_NFDBITS)
477 AC_DEFINE(MISSING_HOWMANY)
478 AC_DEFINE(MISSING_FD_MASK)
479 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000480
481*-*-ultrix*)
482 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
483 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
484 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
485 AC_CHECK_HEADERS(sys/syslog.h)
Damien Miller76112de1999-12-21 11:18:08 +1100486esac
487
Damien Millere37bfc12000-06-05 09:37:43 +1000488# Allow user to specify flags
489AC_ARG_WITH(cflags,
490 [ --with-cflags Specify additional flags to pass to compiler],
491 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800492 if test -n "$withval" && test "x$withval" != "xno" && \
493 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000494 CFLAGS="$CFLAGS $withval"
495 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800496 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000497)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000498AC_ARG_WITH(cppflags,
499 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
500 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800501 if test -n "$withval" && test "x$withval" != "xno" && \
502 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000503 CPPFLAGS="$CPPFLAGS $withval"
504 fi
505 ]
506)
Damien Millere37bfc12000-06-05 09:37:43 +1000507AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000508 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000509 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800510 if test -n "$withval" && test "x$withval" != "xno" && \
511 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000512 LDFLAGS="$LDFLAGS $withval"
513 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800514 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000515)
516AC_ARG_WITH(libs,
517 [ --with-libs Specify additional libraries to link with],
518 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800519 if test -n "$withval" && test "x$withval" != "xno" && \
520 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000521 LIBS="$LIBS $withval"
522 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800523 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000524)
525
Darren Tucker6eb93042003-06-29 21:30:41 +1000526AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000527AC_RUN_IFELSE(
528 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000529#include <stdio.h>
530int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000531 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000532 [ AC_MSG_RESULT(yes) ],
533 [
534 AC_MSG_RESULT(no)
535 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000536 ],
537 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000538)
539
Tim Rice4cec93f2002-02-26 08:40:48 -0800540# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000541AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
542 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
543 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100544 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000545 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000546 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
547 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000548 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000549 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
550 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 -0800551
Darren Tucker48d99d32004-08-29 17:04:50 +1000552# sys/ptms.h requires sys/stream.h to be included first on Solaris
553AC_CHECK_HEADERS(sys/ptms.h, [], [], [
554#ifdef HAVE_SYS_STREAM_H
555# include <sys/stream.h>
556#endif
557])
558
Damien Millera22ba012000-03-02 23:09:20 +1100559# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700560AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
561AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000562
Tim Rice1e1ef642003-09-11 22:19:31 -0700563dnl IRIX and Solaris 2.5.1 have dirname() in libgen
564AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
565 AC_CHECK_LIB(gen, dirname,[
566 AC_CACHE_CHECK([for broken dirname],
567 ac_cv_have_broken_dirname, [
568 save_LIBS="$LIBS"
569 LIBS="$LIBS -lgen"
570 AC_TRY_RUN(
571 [
572#include <libgen.h>
573#include <string.h>
574
575int main(int argc, char **argv) {
576 char *s, buf[32];
577
578 strncpy(buf,"/etc", 32);
579 s = dirname(buf);
580 if (!s || strncmp(s, "/", 32) != 0) {
581 exit(1);
582 } else {
583 exit(0);
584 }
585}
586 ],
587 [ ac_cv_have_broken_dirname="no" ],
588 [ ac_cv_have_broken_dirname="yes" ]
589 )
590 LIBS="$save_LIBS"
591 ])
592 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
593 LIBS="$LIBS -lgen"
594 AC_DEFINE(HAVE_DIRNAME)
595 AC_CHECK_HEADERS(libgen.h)
596 fi
597 ])
598])
599
600AC_CHECK_FUNC(getspnam, ,
601 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
602AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
603
Tim Rice13aae5e2001-10-21 17:53:58 -0700604dnl zlib is required
605AC_ARG_WITH(zlib,
606 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100607 [ if test "x$withval" = "xno" ; then
608 AC_MSG_ERROR([*** zlib is required ***])
609 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 if test -d "$withval/lib"; then
611 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700612 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700613 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700614 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700615 fi
616 else
617 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700618 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700619 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700620 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700621 fi
622 fi
623 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700624 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700625 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700626 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700627 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100628 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700629)
630
Tim Ricefcb62202004-01-23 18:35:16 -0800631AC_CHECK_LIB(z, deflate, ,
632 [
633 saved_CPPFLAGS="$CPPFLAGS"
634 saved_LDFLAGS="$LDFLAGS"
635 save_LIBS="$LIBS"
636 dnl Check default zlib install dir
637 if test -n "${need_dash_r}"; then
638 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
639 else
640 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
641 fi
642 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
643 LIBS="$LIBS -lz"
644 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
645 [
646 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
647 ]
648 )
649 ]
650)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100651AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100652
653AC_ARG_WITH(zlib-version-check,
654 [ --without-zlib-version-check Disable zlib version check],
655 [ if test "x$withval" = "xno" ; then
656 zlib_check_nonfatal=1
657 fi
658 ]
659)
660
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000661AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000662AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000663#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100664#include <zlib.h>
665int main()
666{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000667 int a=0, b=0, c=0, d=0, n, v;
668 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
669 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100670 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000671 v = a*1000000 + b*10000 + c*100 + d;
672 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
673
674 /* 1.1.4 is OK */
675 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100676 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000677
678 /* 1.2.1.2 and up are OK */
679 if (v >= 1020102)
680 exit(0);
681
Darren Tucker2dcd2392004-01-23 17:13:33 +1100682 exit(2);
683}
Darren Tucker623d92f2004-09-12 22:36:15 +1000684 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000685 AC_MSG_RESULT(no),
686 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100687 if test -z "$zlib_check_nonfatal" ; then
688 AC_MSG_ERROR([*** zlib too old - check config.log ***
689Your reported zlib version has known security problems. It's possible your
690vendor has fixed these problems without changing the version number. If you
691are sure this is the case, you can disable the check by running
692"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000693If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
694See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100695 else
696 AC_MSG_WARN([zlib version may have security problems])
697 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000698 ],
699 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100700)
Damien Miller6f9c3372000-10-25 10:06:04 +1100701
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000702dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100703AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000704 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
705)
Damien Millera8e06ce2003-11-21 23:48:55 +1100706AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700707 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
708 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000709)
Damien Millerab18c411999-11-11 10:40:23 +1100710
Tim Ricee589a292001-11-03 11:09:32 -0800711dnl Checks for libutil functions
712AC_CHECK_HEADERS(libutil.h)
713AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
714AC_CHECK_FUNCS(logout updwtmp logwtmp)
715
Ben Lindstrom8697e082001-02-24 21:41:10 +0000716AC_FUNC_STRFTIME
717
Damien Miller3c027682001-03-14 11:39:45 +1100718# Check for ALTDIRFUNC glob() extension
719AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
720AC_EGREP_CPP(FOUNDIT,
721 [
722 #include <glob.h>
723 #ifdef GLOB_ALTDIRFUNC
724 FOUNDIT
725 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100726 ],
Damien Miller3c027682001-03-14 11:39:45 +1100727 [
728 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
729 AC_MSG_RESULT(yes)
730 ],
731 [
732 AC_MSG_RESULT(no)
733 ]
734)
Damien Millerab18c411999-11-11 10:40:23 +1100735
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000736# Check for g.gl_matchc glob() extension
737AC_MSG_CHECKING(for gl_matchc field in glob_t)
738AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100739 [
740 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000741 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100742 ],
743 [
744 AC_DEFINE(GLOB_HAS_GL_MATCHC)
745 AC_MSG_RESULT(yes)
746 ],
747 [
748 AC_MSG_RESULT(no)
749 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000750)
751
Damien Miller18bb4732001-03-28 14:35:30 +1000752AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000753AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000754 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000755#include <sys/types.h>
756#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700757int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000758 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100759 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000760 [
761 AC_MSG_RESULT(no)
762 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000763 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800764 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000765 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
766 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000767 ]
768)
769
Damien Miller36f49652004-08-15 18:40:59 +1000770AC_MSG_CHECKING([for /proc/pid/fd directory])
771if test -d "/proc/$$/fd" ; then
772 AC_DEFINE(HAVE_PROC_PID)
773 AC_MSG_RESULT(yes)
774else
775 AC_MSG_RESULT(no)
776fi
777
Damien Millerc547bf12001-02-16 10:18:12 +1100778# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100779SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100780AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100781 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100782 [
783 if test "x$withval" != "xno" ; then
784
785 if test "x$withval" != "xyes" ; then
786 CPPFLAGS="$CPPFLAGS -I${withval}/include"
787 LDFLAGS="$LDFLAGS -L${withval}/lib"
788 fi
789
790 AC_DEFINE(SKEY)
791 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100792 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800793
Tim Rice4cec93f2002-02-26 08:40:48 -0800794 AC_MSG_CHECKING([for s/key support])
795 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100796 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800797#include <stdio.h>
798#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700799int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800800 ],
801 [AC_MSG_RESULT(yes)],
802 [
803 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100804 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
805 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000806 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
807 AC_TRY_COMPILE(
808 [#include <stdio.h>
809 #include <skey.h>],
810 [(void)skeychallenge(NULL,"name","",0);],
811 [AC_MSG_RESULT(yes)
812 AC_DEFINE(SKEYCHALLENGE_4ARG)],
813 [AC_MSG_RESULT(no)]
814 )
Damien Millerc547bf12001-02-16 10:18:12 +1100815 fi
816 ]
817)
818
819# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700820TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100821AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100822 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100823 [
824 if test "x$withval" != "xno" ; then
825 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 saved_LDFLAGS="$LDFLAGS"
827 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800828 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800829 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700830 if test -d "${withval}/lib"; then
831 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700832 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700833 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700834 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700835 fi
836 else
837 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700838 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700839 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700840 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700841 fi
842 fi
843 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700844 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700845 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700846 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700847 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700848 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800849 LIBWRAP="-lwrap"
850 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100851 AC_MSG_CHECKING(for libwrap)
852 AC_TRY_LINK(
853 [
Damien Miller0ac45002004-04-14 20:14:26 +1000854#include <sys/types.h>
855#include <sys/socket.h>
856#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100857#include <tcpd.h>
858 int deny_severity = 0, allow_severity = 0;
859 ],
860 [hosts_access(0);],
861 [
862 AC_MSG_RESULT(yes)
863 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800864 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700865 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100866 ],
867 [
868 AC_MSG_ERROR([*** libwrap missing])
869 ]
870 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800871 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100872 fi
873 ]
874)
875
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100876# Check whether user wants libedit support
877LIBEDIT_MSG="no"
878AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100879 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100880 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100881 if test "x$withval" != "xyes"; then
882 CPPFLAGS="$CPPFLAGS -I$withval/include"
883 LDFLAGS="$LDFLAGS -L$withval/lib"
884 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100885 AC_CHECK_LIB(edit, el_init,
886 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
887 LIBEDIT="-ledit -lcurses"
888 LIBEDIT_MSG="yes"
889 AC_SUBST(LIBEDIT)
890 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100891 [ AC_MSG_ERROR(libedit not found) ],
892 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100893 )
894 fi ]
895)
896
Darren Tuckerd9f88912005-02-20 21:01:48 +1100897AUDIT_MODULE=none
898AC_ARG_WITH(audit,
899 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
900 [
901 AC_MSG_CHECKING(for supported audit module)
902 case "$withval" in
903 bsm)
904 AC_MSG_RESULT(bsm)
905 AUDIT_MODULE=bsm
906 dnl Checks for headers, libs and functions
907 AC_CHECK_HEADERS(bsm/audit.h, [],
908 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
909 AC_CHECK_LIB(bsm, getaudit, [],
910 [AC_MSG_ERROR(BSM enabled and required library not found)])
911 AC_CHECK_FUNCS(getaudit, [],
912 [AC_MSG_ERROR(BSM enabled and required function not found)])
913 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100914 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100915 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
916 ;;
917 debug)
918 AUDIT_MODULE=debug
919 AC_MSG_RESULT(debug)
920 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
921 ;;
922 *)
923 AC_MSG_ERROR([Unknown audit module $withval])
924 ;;
925 esac ]
926)
927
Damien Millerfe1f1432003-02-24 15:45:42 +1100928dnl Checks for library functions. Please keep in alphabetical order
929AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000930 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Darren Tuckerad7646a2005-02-02 10:43:59 +1100931 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
932 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
933 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100934 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000935 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100936 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000937 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000938 setproctitle setregid setreuid setrlimit setsid setvbuf \
939 sigaction sigvec snprintf socketpair strdup strerror \
Damien Millerde3cb0a2005-05-26 20:48:25 +1000940 strlcat strlcpy strmode strnvis strtonum strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100941 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100942)
Tim Rice13aae5e2001-10-21 17:53:58 -0700943
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000944# IRIX has a const char return value for gai_strerror()
945AC_CHECK_FUNCS(gai_strerror,[
946 AC_DEFINE(HAVE_GAI_STRERROR)
947 AC_TRY_COMPILE([
948#include <sys/types.h>
949#include <sys/socket.h>
950#include <netdb.h>
951
952const char *gai_strerror(int);],[
953char *str;
954
955str = gai_strerror(0);],[
956 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
957 [Define if gai_strerror() returns const char *])])])
958
Damien Millercd6853c2003-01-28 11:33:42 +1100959AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
960
Darren Tuckerf1159b52003-07-07 19:44:01 +1000961dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000962AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000963AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000964
Darren Tuckerb2427c82003-09-10 15:22:44 +1000965dnl tcsendbreak might be a macro
966AC_CHECK_DECL(tcsendbreak,
967 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100968 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000969 [#include <termios.h>]
970)
971
Darren Tucker5bb14002004-04-23 18:53:10 +1000972AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
973
Darren Tucker2a6b0292003-12-31 14:59:17 +1100974AC_CHECK_FUNCS(setresuid, [
975 dnl Some platorms have setresuid that isn't implemented, test for this
976 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000977 AC_RUN_IFELSE(
978 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100979#include <stdlib.h>
980#include <errno.h>
981int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000982 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100983 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100984 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000985 AC_MSG_RESULT(not implemented)],
986 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100987 )
988])
Darren Tuckere937be32003-12-17 18:53:26 +1100989
Darren Tucker2a6b0292003-12-31 14:59:17 +1100990AC_CHECK_FUNCS(setresgid, [
991 dnl Some platorms have setresgid that isn't implemented, test for this
992 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000993 AC_RUN_IFELSE(
994 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100995#include <stdlib.h>
996#include <errno.h>
997int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000998 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100999 [AC_MSG_RESULT(yes)],
1000 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001001 AC_MSG_RESULT(not implemented)],
1002 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001003 )
1004])
Darren Tuckere937be32003-12-17 18:53:26 +11001005
Damien Millerad833b32000-08-23 10:46:23 +10001006dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001007AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001008dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001009AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001010AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001011dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001012AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001013AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001014
Damien Millera8e06ce2003-11-21 23:48:55 +11001015AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001016 [AC_DEFINE(HAVE_DAEMON)],
1017 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1018)
1019
Damien Millera8e06ce2003-11-21 23:48:55 +11001020AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001021 [AC_DEFINE(HAVE_GETPAGESIZE)],
1022 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1023)
1024
Damien Millercb170cb2000-07-01 16:52:55 +10001025# Check for broken snprintf
1026if test "x$ac_cv_func_snprintf" = "xyes" ; then
1027 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001028 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001029 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001030#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001031int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001032 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001033 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001034 [
1035 AC_MSG_RESULT(no)
1036 AC_DEFINE(BROKEN_SNPRINTF)
1037 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001038 ],
1039 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001040 )
1041fi
1042
Damien Millerb4097182004-05-23 14:09:40 +10001043# Check for missing getpeereid (or equiv) support
1044NO_PEERCHECK=""
1045if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1046 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1047 AC_TRY_COMPILE(
1048 [#include <sys/types.h>
1049 #include <sys/socket.h>],
1050 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001051 [ AC_MSG_RESULT(yes)
1052 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1053 ],
Damien Millerb4097182004-05-23 14:09:40 +10001054 [AC_MSG_RESULT(no)
1055 NO_PEERCHECK=1]
1056 )
1057fi
1058
Damien Millere8328192003-01-07 15:18:32 +11001059dnl see whether mkstemp() requires XXXXXX
1060if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1061AC_MSG_CHECKING([for (overly) strict mkstemp])
1062AC_TRY_RUN(
1063 [
1064#include <stdlib.h>
1065main() { char template[]="conftest.mkstemp-test";
1066if (mkstemp(template) == -1)
1067 exit(1);
1068unlink(template); exit(0);
1069}
1070 ],
1071 [
1072 AC_MSG_RESULT(no)
1073 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001074 [
Damien Millere8328192003-01-07 15:18:32 +11001075 AC_MSG_RESULT(yes)
1076 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1077 ],
1078 [
1079 AC_MSG_RESULT(yes)
1080 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001081 ]
Damien Millere8328192003-01-07 15:18:32 +11001082)
1083fi
1084
Darren Tucker70a3d552003-08-21 17:58:29 +10001085dnl make sure that openpty does not reacquire controlling terminal
1086if test ! -z "$check_for_openpty_ctty_bug"; then
1087 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1088 AC_TRY_RUN(
1089 [
1090#include <stdio.h>
1091#include <sys/fcntl.h>
1092#include <sys/types.h>
1093#include <sys/wait.h>
1094
1095int
1096main()
1097{
1098 pid_t pid;
1099 int fd, ptyfd, ttyfd, status;
1100
1101 pid = fork();
1102 if (pid < 0) { /* failed */
1103 exit(1);
1104 } else if (pid > 0) { /* parent */
1105 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001106 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001107 exit(WEXITSTATUS(status));
1108 else
1109 exit(2);
1110 } else { /* child */
1111 close(0); close(1); close(2);
1112 setsid();
1113 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1114 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1115 if (fd >= 0)
1116 exit(3); /* Acquired ctty: broken */
1117 else
1118 exit(0); /* Did not acquire ctty: OK */
1119 }
1120}
1121 ],
1122 [
1123 AC_MSG_RESULT(yes)
1124 ],
1125 [
1126 AC_MSG_RESULT(no)
1127 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1128 ]
1129 )
1130fi
1131
Tim Rice8bb561b2005-03-17 16:23:19 -08001132if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1133 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001134 AC_MSG_CHECKING(if getaddrinfo seems to work)
1135 AC_TRY_RUN(
1136 [
1137#include <stdio.h>
1138#include <sys/socket.h>
1139#include <netdb.h>
1140#include <errno.h>
1141#include <netinet/in.h>
1142
1143#define TEST_PORT "2222"
1144
1145int
1146main(void)
1147{
1148 int err, sock;
1149 struct addrinfo *gai_ai, *ai, hints;
1150 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1151
1152 memset(&hints, 0, sizeof(hints));
1153 hints.ai_family = PF_UNSPEC;
1154 hints.ai_socktype = SOCK_STREAM;
1155 hints.ai_flags = AI_PASSIVE;
1156
1157 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1158 if (err != 0) {
1159 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1160 exit(1);
1161 }
1162
1163 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1164 if (ai->ai_family != AF_INET6)
1165 continue;
1166
1167 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1168 sizeof(ntop), strport, sizeof(strport),
1169 NI_NUMERICHOST|NI_NUMERICSERV);
1170
1171 if (err != 0) {
1172 if (err == EAI_SYSTEM)
1173 perror("getnameinfo EAI_SYSTEM");
1174 else
1175 fprintf(stderr, "getnameinfo failed: %s\n",
1176 gai_strerror(err));
1177 exit(2);
1178 }
1179
1180 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1181 if (sock < 0)
1182 perror("socket");
1183 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1184 if (errno == EBADF)
1185 exit(3);
1186 }
1187 }
1188 exit(0);
1189}
1190 ],
1191 [
1192 AC_MSG_RESULT(yes)
1193 ],
1194 [
1195 AC_MSG_RESULT(no)
1196 AC_DEFINE(BROKEN_GETADDRINFO)
1197 ]
1198 )
1199fi
1200
Tim Rice8bb561b2005-03-17 16:23:19 -08001201if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1202 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001203 AC_MSG_CHECKING(if getaddrinfo seems to work)
1204 AC_TRY_RUN(
1205 [
1206#include <stdio.h>
1207#include <sys/socket.h>
1208#include <netdb.h>
1209#include <errno.h>
1210#include <netinet/in.h>
1211
1212#define TEST_PORT "2222"
1213
1214int
1215main(void)
1216{
1217 int err, sock;
1218 struct addrinfo *gai_ai, *ai, hints;
1219 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1220
1221 memset(&hints, 0, sizeof(hints));
1222 hints.ai_family = PF_UNSPEC;
1223 hints.ai_socktype = SOCK_STREAM;
1224 hints.ai_flags = AI_PASSIVE;
1225
1226 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1227 if (err != 0) {
1228 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1229 exit(1);
1230 }
1231
1232 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1233 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1234 continue;
1235
1236 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1237 sizeof(ntop), strport, sizeof(strport),
1238 NI_NUMERICHOST|NI_NUMERICSERV);
1239
1240 if (ai->ai_family == AF_INET && err != 0) {
1241 perror("getnameinfo");
1242 exit(2);
1243 }
1244 }
1245 exit(0);
1246}
1247 ],
1248 [
1249 AC_MSG_RESULT(yes)
1250 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1251[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1252 ],
1253 [
1254 AC_MSG_RESULT(no)
1255 AC_DEFINE(BROKEN_GETADDRINFO)
1256 ]
1257 )
1258fi
1259
Darren Tuckera56f1912004-11-02 20:30:54 +11001260if test "x$check_for_conflicting_getspnam" = "x1"; then
1261 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1262 AC_COMPILE_IFELSE(
1263 [
1264#include <shadow.h>
1265int main(void) {exit(0);}
1266 ],
1267 [
1268 AC_MSG_RESULT(no)
1269 ],
1270 [
1271 AC_MSG_RESULT(yes)
1272 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1273 [Conflicting defs for getspnam])
1274 ]
1275 )
1276fi
1277
Damien Miller606f8802000-09-16 15:39:56 +11001278AC_FUNC_GETPGRP
1279
Damien Millera64b57a2001-01-17 10:44:13 +11001280# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001281PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001282AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001283 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001284 [
Damien Millera64b57a2001-01-17 10:44:13 +11001285 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001286 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1287 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001288 AC_MSG_ERROR([PAM headers not found])
1289 fi
1290
1291 AC_CHECK_LIB(dl, dlopen, , )
1292 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1293 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001294 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001295
Damien Millera64b57a2001-01-17 10:44:13 +11001296 PAM_MSG="yes"
1297
1298 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001299 if test $ac_cv_lib_dl_dlopen = yes; then
1300 LIBPAM="-lpam -ldl"
1301 else
1302 LIBPAM="-lpam"
1303 fi
1304 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001305 fi
1306 ]
1307)
Damien Millera22ba012000-03-02 23:09:20 +11001308
Damien Millera64b57a2001-01-17 10:44:13 +11001309# Check for older PAM
1310if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001311 # Check PAM strerror arguments (old PAM)
1312 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1313 AC_TRY_COMPILE(
1314 [
Damien Miller81171112000-04-23 11:14:01 +10001315#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001316#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001317#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001318#elif defined (HAVE_PAM_PAM_APPL_H)
1319#include <pam/pam_appl.h>
1320#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001321 ],
1322 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001323 [AC_MSG_RESULT(no)],
1324 [
1325 AC_DEFINE(HAVE_OLD_PAM)
1326 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001327 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001328 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001329 )
Damien Millera22ba012000-03-02 23:09:20 +11001330fi
1331
Tim Riceaef73712002-05-11 13:17:42 -07001332# Search for OpenSSL
1333saved_CPPFLAGS="$CPPFLAGS"
1334saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001335AC_ARG_WITH(ssl-dir,
1336 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1337 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001338 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001339 case "$withval" in
1340 # Relative paths
1341 ./*|../*) withval="`pwd`/$withval"
1342 esac
Tim Riceaef73712002-05-11 13:17:42 -07001343 if test -d "$withval/lib"; then
1344 if test -n "${need_dash_r}"; then
1345 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1346 else
1347 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1348 fi
1349 else
1350 if test -n "${need_dash_r}"; then
1351 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1352 else
1353 LDFLAGS="-L${withval} ${LDFLAGS}"
1354 fi
1355 fi
1356 if test -d "$withval/include"; then
1357 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1358 else
1359 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1360 fi
Damien Millera22ba012000-03-02 23:09:20 +11001361 fi
1362 ]
1363)
Tim Rice3d5352e2004-02-12 09:27:21 -08001364LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001365AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001366 [
Tim Riceaef73712002-05-11 13:17:42 -07001367 dnl Check default openssl install dir
1368 if test -n "${need_dash_r}"; then
1369 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001370 else
Tim Riceaef73712002-05-11 13:17:42 -07001371 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001372 fi
Tim Riceaef73712002-05-11 13:17:42 -07001373 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1374 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1375 [
1376 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1377 ]
1378 )
1379 ]
1380)
1381
Tim Riced730b782002-08-13 18:52:10 -07001382# Determine OpenSSL header version
1383AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001384AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001385 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001386#include <stdio.h>
1387#include <string.h>
1388#include <openssl/opensslv.h>
1389#define DATA "conftest.sslincver"
1390int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001391 FILE *fd;
1392 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001393
Damien Millera8e06ce2003-11-21 23:48:55 +11001394 fd = fopen(DATA,"w");
1395 if(fd == NULL)
1396 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001397
1398 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1399 exit(1);
1400
1401 exit(0);
1402}
Darren Tucker623d92f2004-09-12 22:36:15 +10001403 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001404 [
1405 ssl_header_ver=`cat conftest.sslincver`
1406 AC_MSG_RESULT($ssl_header_ver)
1407 ],
1408 [
1409 AC_MSG_RESULT(not found)
1410 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001411 ],
1412 [
1413 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001414 ]
1415)
1416
1417# Determine OpenSSL library version
1418AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001419AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001420 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001421#include <stdio.h>
1422#include <string.h>
1423#include <openssl/opensslv.h>
1424#include <openssl/crypto.h>
1425#define DATA "conftest.ssllibver"
1426int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001427 FILE *fd;
1428 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001429
Damien Millera8e06ce2003-11-21 23:48:55 +11001430 fd = fopen(DATA,"w");
1431 if(fd == NULL)
1432 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001433
1434 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1435 exit(1);
1436
1437 exit(0);
1438}
Darren Tucker623d92f2004-09-12 22:36:15 +10001439 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001440 [
1441 ssl_library_ver=`cat conftest.ssllibver`
1442 AC_MSG_RESULT($ssl_library_ver)
1443 ],
1444 [
1445 AC_MSG_RESULT(not found)
1446 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001447 ],
1448 [
1449 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001450 ]
1451)
Damien Millera22ba012000-03-02 23:09:20 +11001452
Damien Millerec932372002-01-22 22:16:03 +11001453# Sanity check OpenSSL headers
1454AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001455AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001456 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001457#include <string.h>
1458#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001459int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001460 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001461 [
1462 AC_MSG_RESULT(yes)
1463 ],
1464 [
1465 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001466 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1467Check config.log for details.
1468Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001469 ],
1470 [
1471 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001472 ]
1473)
1474
Tim Rice3d5352e2004-02-12 09:27:21 -08001475# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1476# because the system crypt() is more featureful.
1477if test "x$check_for_libcrypt_before" = "x1"; then
1478 AC_CHECK_LIB(crypt, crypt)
1479fi
1480
Damien Millera8e06ce2003-11-21 23:48:55 +11001481# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001482# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001483if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001484 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001485fi
1486
Damien Miller6c21c512002-01-22 21:57:53 +11001487
1488### Configure cryptographic random number support
1489
1490# Check wheter OpenSSL seeds itself
1491AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001492AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001493 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001494#include <string.h>
1495#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001496int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001497 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001498 [
1499 OPENSSL_SEEDS_ITSELF=yes
1500 AC_MSG_RESULT(yes)
1501 ],
1502 [
1503 AC_MSG_RESULT(no)
1504 # Default to use of the rand helper if OpenSSL doesn't
1505 # seed itself
1506 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001507 ],
1508 [
1509 AC_MSG_WARN([cross compiling: assuming yes])
1510 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001511 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001512 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001513 ]
1514)
1515
1516
1517# Do we want to force the use of the rand helper?
1518AC_ARG_WITH(rand-helper,
1519 [ --with-rand-helper Use subprocess to gather strong randomness ],
1520 [
1521 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001522 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001523 # the previous test showed it to be unseeded.
1524 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1525 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1526 OPENSSL_SEEDS_ITSELF=yes
1527 USE_RAND_HELPER=""
1528 fi
1529 else
1530 USE_RAND_HELPER=yes
1531 fi
1532 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001533)
Damien Miller6c21c512002-01-22 21:57:53 +11001534
1535# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001536if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001537 # OpenSSL only
1538 AC_DEFINE(OPENSSL_PRNG_ONLY)
1539 RAND_MSG="OpenSSL internal ONLY"
1540 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001541elif test ! -z "$USE_RAND_HELPER" ; then
1542 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001543 RAND_MSG="ssh-rand-helper"
1544 INSTALL_SSH_RAND_HELPER="yes"
1545fi
1546AC_SUBST(INSTALL_SSH_RAND_HELPER)
1547
1548### Configuration of ssh-rand-helper
1549
1550# PRNGD TCP socket
1551AC_ARG_WITH(prngd-port,
1552 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1553 [
Damien Millere996d722002-01-23 11:20:59 +11001554 case "$withval" in
1555 no)
1556 withval=""
1557 ;;
1558 [[0-9]]*)
1559 ;;
1560 *)
1561 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1562 ;;
1563 esac
1564 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001565 PRNGD_PORT="$withval"
1566 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1567 fi
1568 ]
1569)
1570
1571# PRNGD Unix domain socket
1572AC_ARG_WITH(prngd-socket,
1573 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1574 [
Damien Millere996d722002-01-23 11:20:59 +11001575 case "$withval" in
1576 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001577 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001578 ;;
1579 no)
1580 withval=""
1581 ;;
1582 /*)
1583 ;;
1584 *)
1585 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1586 ;;
1587 esac
1588
1589 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001590 if test ! -z "$PRNGD_PORT" ; then
1591 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1592 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001593 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001594 AC_MSG_WARN(Entropy socket is not readable)
1595 fi
1596 PRNGD_SOCKET="$withval"
1597 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1598 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001599 ],
1600 [
1601 # Check for existing socket only if we don't have a random device already
1602 if test "$USE_RAND_HELPER" = yes ; then
1603 AC_MSG_CHECKING(for PRNGD/EGD socket)
1604 # Insert other locations here
1605 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1606 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1607 PRNGD_SOCKET="$sock"
1608 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1609 break;
1610 fi
1611 done
1612 if test ! -z "$PRNGD_SOCKET" ; then
1613 AC_MSG_RESULT($PRNGD_SOCKET)
1614 else
1615 AC_MSG_RESULT(not found)
1616 fi
1617 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001618 ]
1619)
1620
1621# Change default command timeout for hashing entropy source
1622entropy_timeout=200
1623AC_ARG_WITH(entropy-timeout,
1624 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1625 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001626 if test -n "$withval" && test "x$withval" != "xno" && \
1627 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001628 entropy_timeout=$withval
1629 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001630 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001631)
Damien Miller6c21c512002-01-22 21:57:53 +11001632AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1633
Damien Millerd3f6ad22002-06-25 10:24:47 +10001634SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001635AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001636 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001637 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001638 if test -n "$withval" && test "x$withval" != "xno" && \
1639 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001640 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001641 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001642 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001643)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001644AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1645AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001646
Tim Rice88f2ab52002-03-17 12:17:34 -08001647# We do this little dance with the search path to insure
1648# that programs that we select for use by installed programs
1649# (which may be run by the super-user) come from trusted
1650# locations before they come from the user's private area.
1651# This should help avoid accidentally configuring some
1652# random version of a program in someone's personal bin.
1653
1654OPATH=$PATH
1655PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001656test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001657test -d /sbin && PATH=$PATH:/sbin
1658test -d /usr/sbin && PATH=$PATH:/usr/sbin
1659PATH=$PATH:/etc:$OPATH
1660
Damien Millera8e06ce2003-11-21 23:48:55 +11001661# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001662OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1663OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1664OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1665OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1666OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1667OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1668OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1669OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1670OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1671OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1672OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1673OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1674OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1675OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1676OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1677OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001678# restore PATH
1679PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001680
1681# Where does ssh-rand-helper get its randomness from?
1682INSTALL_SSH_PRNG_CMDS=""
1683if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1684 if test ! -z "$PRNGD_PORT" ; then
1685 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1686 elif test ! -z "$PRNGD_SOCKET" ; then
1687 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1688 else
1689 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1690 RAND_HELPER_CMDHASH=yes
1691 INSTALL_SSH_PRNG_CMDS="yes"
1692 fi
1693fi
1694AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1695
1696
Ben Lindstromb5628642000-10-18 00:02:25 +00001697# Cheap hack to ensure NEWS-OS libraries are arranged right.
1698if test ! -z "$SONY" ; then
1699 LIBS="$LIBS -liberty";
1700fi
1701
Damien Millera22ba012000-03-02 23:09:20 +11001702# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001703AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001704AC_CHECK_SIZEOF(short int, 2)
1705AC_CHECK_SIZEOF(int, 4)
1706AC_CHECK_SIZEOF(long int, 4)
1707AC_CHECK_SIZEOF(long long int, 8)
1708
Damien Millerfa2bb692002-04-23 23:22:25 +10001709# Sanity check long long for some platforms (AIX)
1710if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1711 ac_cv_sizeof_long_long_int=0
1712fi
1713
Damien Millera22ba012000-03-02 23:09:20 +11001714# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001715AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1716 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001717 [ #include <sys/types.h> ],
1718 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001719 [ ac_cv_have_u_int="yes" ],
1720 [ ac_cv_have_u_int="no" ]
1721 )
1722])
1723if test "x$ac_cv_have_u_int" = "xyes" ; then
1724 AC_DEFINE(HAVE_U_INT)
1725 have_u_int=1
1726fi
1727
Damien Miller61e50f12000-05-08 20:49:37 +10001728AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1729 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001730 [ #include <sys/types.h> ],
1731 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001732 [ ac_cv_have_intxx_t="yes" ],
1733 [ ac_cv_have_intxx_t="no" ]
1734 )
1735])
1736if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1737 AC_DEFINE(HAVE_INTXX_T)
1738 have_intxx_t=1
1739fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001740
1741if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001742 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001743then
1744 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1745 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001746 [ #include <stdint.h> ],
1747 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001748 [
1749 AC_DEFINE(HAVE_INTXX_T)
1750 AC_MSG_RESULT(yes)
1751 ],
1752 [ AC_MSG_RESULT(no) ]
1753 )
1754fi
1755
Damien Miller578783e2000-09-23 14:12:24 +11001756AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1757 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001758 [
1759#include <sys/types.h>
1760#ifdef HAVE_STDINT_H
1761# include <stdint.h>
1762#endif
1763#include <sys/socket.h>
1764#ifdef HAVE_SYS_BITYPES_H
1765# include <sys/bitypes.h>
1766#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001767 ],
1768 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001769 [ ac_cv_have_int64_t="yes" ],
1770 [ ac_cv_have_int64_t="no" ]
1771 )
1772])
1773if test "x$ac_cv_have_int64_t" = "xyes" ; then
1774 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001775fi
1776
Damien Miller61e50f12000-05-08 20:49:37 +10001777AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1778 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001779 [ #include <sys/types.h> ],
1780 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001781 [ ac_cv_have_u_intxx_t="yes" ],
1782 [ ac_cv_have_u_intxx_t="no" ]
1783 )
1784])
1785if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1786 AC_DEFINE(HAVE_U_INTXX_T)
1787 have_u_intxx_t=1
1788fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001789
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001790if test -z "$have_u_intxx_t" ; then
1791 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1792 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001793 [ #include <sys/socket.h> ],
1794 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001795 [
1796 AC_DEFINE(HAVE_U_INTXX_T)
1797 AC_MSG_RESULT(yes)
1798 ],
1799 [ AC_MSG_RESULT(no) ]
1800 )
1801fi
1802
Damien Miller578783e2000-09-23 14:12:24 +11001803AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1804 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001805 [ #include <sys/types.h> ],
1806 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001807 [ ac_cv_have_u_int64_t="yes" ],
1808 [ ac_cv_have_u_int64_t="no" ]
1809 )
1810])
1811if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1812 AC_DEFINE(HAVE_U_INT64_T)
1813 have_u_int64_t=1
1814fi
1815
Tim Rice4cec93f2002-02-26 08:40:48 -08001816if test -z "$have_u_int64_t" ; then
1817 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1818 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001819 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001820 [ u_int64_t a; a = 1],
1821 [
1822 AC_DEFINE(HAVE_U_INT64_T)
1823 AC_MSG_RESULT(yes)
1824 ],
1825 [ AC_MSG_RESULT(no) ]
1826 )
1827fi
1828
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001829if test -z "$have_u_intxx_t" ; then
1830 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1831 AC_TRY_COMPILE(
1832 [
1833#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001834 ],
1835 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001836 [ ac_cv_have_uintxx_t="yes" ],
1837 [ ac_cv_have_uintxx_t="no" ]
1838 )
1839 ])
1840 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1841 AC_DEFINE(HAVE_UINTXX_T)
1842 fi
1843fi
1844
1845if test -z "$have_uintxx_t" ; then
1846 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1847 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001848 [ #include <stdint.h> ],
1849 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001850 [
1851 AC_DEFINE(HAVE_UINTXX_T)
1852 AC_MSG_RESULT(yes)
1853 ],
1854 [ AC_MSG_RESULT(no) ]
1855 )
1856fi
1857
Damien Milleredb82922000-06-20 13:25:52 +10001858if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001859 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001860then
1861 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1862 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001863 [
1864#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001865 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001866 [
Damien Miller70494d12000-04-03 15:57:06 +10001867 int8_t a; int16_t b; int32_t c;
1868 u_int8_t e; u_int16_t f; u_int32_t g;
1869 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001870 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001871 [
1872 AC_DEFINE(HAVE_U_INTXX_T)
1873 AC_DEFINE(HAVE_INTXX_T)
1874 AC_MSG_RESULT(yes)
1875 ],
1876 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001877 )
Damien Millerb29ea912000-01-15 14:12:03 +11001878fi
1879
Damien Miller58be7382001-09-15 21:31:54 +10001880
1881AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1882 AC_TRY_COMPILE(
1883 [
1884#include <sys/types.h>
1885 ],
1886 [ u_char foo; foo = 125; ],
1887 [ ac_cv_have_u_char="yes" ],
1888 [ ac_cv_have_u_char="no" ]
1889 )
1890])
1891if test "x$ac_cv_have_u_char" = "xyes" ; then
1892 AC_DEFINE(HAVE_U_CHAR)
1893fi
1894
Tim Rice13aae5e2001-10-21 17:53:58 -07001895TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001896
Tim Rice200a5c02002-02-26 22:12:34 -08001897AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001898
Damien Miller848b9932005-02-24 12:12:34 +11001899AC_CHECK_TYPES(in_addr_t,,,
1900[#include <sys/types.h>
1901#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001902
Damien Miller61e50f12000-05-08 20:49:37 +10001903AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1904 AC_TRY_COMPILE(
1905 [
1906#include <sys/types.h>
1907 ],
1908 [ size_t foo; foo = 1235; ],
1909 [ ac_cv_have_size_t="yes" ],
1910 [ ac_cv_have_size_t="no" ]
1911 )
1912])
1913if test "x$ac_cv_have_size_t" = "xyes" ; then
1914 AC_DEFINE(HAVE_SIZE_T)
1915fi
Damien Miller95058511999-12-29 10:36:45 +11001916
Damien Miller615f9392000-05-17 22:53:33 +10001917AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1918 AC_TRY_COMPILE(
1919 [
1920#include <sys/types.h>
1921 ],
1922 [ ssize_t foo; foo = 1235; ],
1923 [ ac_cv_have_ssize_t="yes" ],
1924 [ ac_cv_have_ssize_t="no" ]
1925 )
1926])
1927if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1928 AC_DEFINE(HAVE_SSIZE_T)
1929fi
1930
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001931AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1932 AC_TRY_COMPILE(
1933 [
1934#include <time.h>
1935 ],
1936 [ clock_t foo; foo = 1235; ],
1937 [ ac_cv_have_clock_t="yes" ],
1938 [ ac_cv_have_clock_t="no" ]
1939 )
1940])
1941if test "x$ac_cv_have_clock_t" = "xyes" ; then
1942 AC_DEFINE(HAVE_CLOCK_T)
1943fi
1944
Damien Millerb54b40e2000-06-23 08:23:34 +10001945AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1946 AC_TRY_COMPILE(
1947 [
1948#include <sys/types.h>
1949#include <sys/socket.h>
1950 ],
1951 [ sa_family_t foo; foo = 1235; ],
1952 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001953 [ AC_TRY_COMPILE(
1954 [
1955#include <sys/types.h>
1956#include <sys/socket.h>
1957#include <netinet/in.h>
1958 ],
1959 [ sa_family_t foo; foo = 1235; ],
1960 [ ac_cv_have_sa_family_t="yes" ],
1961
Damien Millerb54b40e2000-06-23 08:23:34 +10001962 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001963 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001964 )
1965])
1966if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1967 AC_DEFINE(HAVE_SA_FAMILY_T)
1968fi
1969
Damien Miller0f91b4e2000-06-18 15:43:25 +10001970AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1971 AC_TRY_COMPILE(
1972 [
1973#include <sys/types.h>
1974 ],
1975 [ pid_t foo; foo = 1235; ],
1976 [ ac_cv_have_pid_t="yes" ],
1977 [ ac_cv_have_pid_t="no" ]
1978 )
1979])
1980if test "x$ac_cv_have_pid_t" = "xyes" ; then
1981 AC_DEFINE(HAVE_PID_T)
1982fi
1983
1984AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1985 AC_TRY_COMPILE(
1986 [
1987#include <sys/types.h>
1988 ],
1989 [ mode_t foo; foo = 1235; ],
1990 [ ac_cv_have_mode_t="yes" ],
1991 [ ac_cv_have_mode_t="no" ]
1992 )
1993])
1994if test "x$ac_cv_have_mode_t" = "xyes" ; then
1995 AC_DEFINE(HAVE_MODE_T)
1996fi
1997
Damien Miller61e50f12000-05-08 20:49:37 +10001998
1999AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2000 AC_TRY_COMPILE(
2001 [
Damien Miller81171112000-04-23 11:14:01 +10002002#include <sys/types.h>
2003#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002004 ],
2005 [ struct sockaddr_storage s; ],
2006 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2007 [ ac_cv_have_struct_sockaddr_storage="no" ]
2008 )
2009])
2010if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2011 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2012fi
Damien Miller34132e52000-01-14 15:45:46 +11002013
Damien Miller61e50f12000-05-08 20:49:37 +10002014AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
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 sockaddr_in6 s; s.sin6_family = 0; ],
2021 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2022 [ ac_cv_have_struct_sockaddr_in6="no" ]
2023 )
2024])
2025if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2026 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2027fi
Damien Miller34132e52000-01-14 15:45:46 +11002028
Damien Miller61e50f12000-05-08 20:49:37 +10002029AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2030 AC_TRY_COMPILE(
2031 [
Damien Miller7b22d652000-06-18 14:07:04 +10002032#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002033#include <netinet/in.h>
2034 ],
2035 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2036 [ ac_cv_have_struct_in6_addr="yes" ],
2037 [ ac_cv_have_struct_in6_addr="no" ]
2038 )
2039])
2040if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2041 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2042fi
Damien Miller34132e52000-01-14 15:45:46 +11002043
Damien Miller61e50f12000-05-08 20:49:37 +10002044AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2045 AC_TRY_COMPILE(
2046 [
Damien Miller81171112000-04-23 11:14:01 +10002047#include <sys/types.h>
2048#include <sys/socket.h>
2049#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002050 ],
2051 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2052 [ ac_cv_have_struct_addrinfo="yes" ],
2053 [ ac_cv_have_struct_addrinfo="no" ]
2054 )
2055])
2056if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2057 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2058fi
2059
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002060AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2061 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002062 [ #include <sys/time.h> ],
2063 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002064 [ ac_cv_have_struct_timeval="yes" ],
2065 [ ac_cv_have_struct_timeval="no" ]
2066 )
2067])
2068if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2069 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2070 have_struct_timeval=1
2071fi
2072
Tim Rice4e4dc562003-03-18 10:21:40 -08002073AC_CHECK_TYPES(struct timespec)
2074
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002075# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002076if test "x$ac_cv_have_int64_t" = "xno" && \
2077 test "x$ac_cv_sizeof_long_int" != "x8" && \
2078 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002079 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2080 echo "an alternative compiler (I.E., GCC) before continuing."
2081 echo ""
2082 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002083else
2084dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002085 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002086 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002087#include <stdio.h>
2088#include <string.h>
2089#ifdef HAVE_SNPRINTF
2090main()
2091{
2092 char buf[50];
2093 char expected_out[50];
2094 int mazsize = 50 ;
2095#if (SIZEOF_LONG_INT == 8)
2096 long int num = 0x7fffffffffffffff;
2097#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002098 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002099#endif
2100 strcpy(expected_out, "9223372036854775807");
2101 snprintf(buf, mazsize, "%lld", num);
2102 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002103 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002104 exit(0);
2105}
2106#else
2107main() { exit(0); }
2108#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002109 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002110 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002111 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002112fi
2113
Damien Miller78315eb2000-09-29 23:01:36 +11002114dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002115OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2116OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2117OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2118OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2119OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002120OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002121OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2122OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002123OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002124OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2125OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2126OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2127OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002128OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2129OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2130OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2131OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002132
2133AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002134
Damien Miller61e50f12000-05-08 20:49:37 +10002135AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2136 ac_cv_have_ss_family_in_struct_ss, [
2137 AC_TRY_COMPILE(
2138 [
Damien Miller81171112000-04-23 11:14:01 +10002139#include <sys/types.h>
2140#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002141 ],
2142 [ struct sockaddr_storage s; s.ss_family = 1; ],
2143 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2144 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2145 )
2146])
2147if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2148 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2149fi
2150
Damien Miller61e50f12000-05-08 20:49:37 +10002151AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2152 ac_cv_have___ss_family_in_struct_ss, [
2153 AC_TRY_COMPILE(
2154 [
Damien Miller81171112000-04-23 11:14:01 +10002155#include <sys/types.h>
2156#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002157 ],
2158 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2159 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2160 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2161 )
2162])
2163if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2164 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2165fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002166
Damien Millerad833b32000-08-23 10:46:23 +10002167AC_CACHE_CHECK([for pw_class field in struct passwd],
2168 ac_cv_have_pw_class_in_struct_passwd, [
2169 AC_TRY_COMPILE(
2170 [
Damien Millerad833b32000-08-23 10:46:23 +10002171#include <pwd.h>
2172 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002173 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002174 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2175 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2176 )
2177])
2178if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2179 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2180fi
2181
Kevin Steves82456952001-06-22 21:14:18 +00002182AC_CACHE_CHECK([for pw_expire field in struct passwd],
2183 ac_cv_have_pw_expire_in_struct_passwd, [
2184 AC_TRY_COMPILE(
2185 [
2186#include <pwd.h>
2187 ],
2188 [ struct passwd p; p.pw_expire = 0; ],
2189 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2190 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2191 )
2192])
2193if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2194 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2195fi
2196
2197AC_CACHE_CHECK([for pw_change field in struct passwd],
2198 ac_cv_have_pw_change_in_struct_passwd, [
2199 AC_TRY_COMPILE(
2200 [
2201#include <pwd.h>
2202 ],
2203 [ struct passwd p; p.pw_change = 0; ],
2204 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2205 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2206 )
2207])
2208if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2209 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2210fi
Damien Miller61e50f12000-05-08 20:49:37 +10002211
Tim Rice28bbb0c2002-05-27 17:37:32 -07002212dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002213AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2214 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002215 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002216 [
Tim Riceae49fe62002-04-12 10:26:21 -07002217#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002218#include <sys/socket.h>
2219#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002220int main() {
2221#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002222#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002223exit(1);
2224#endif
2225struct msghdr m;
2226m.msg_accrights = 0;
2227exit(0);
2228}
Kevin Steves939c9db2002-03-22 17:23:25 +00002229 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002230 [ ac_cv_have_accrights_in_msghdr="yes" ],
2231 [ ac_cv_have_accrights_in_msghdr="no" ]
2232 )
2233])
2234if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2235 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2236fi
2237
Kevin Stevesa44e0352002-04-07 16:18:03 +00002238AC_CACHE_CHECK([for msg_control field in struct msghdr],
2239 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002240 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002241 [
Tim Riceae49fe62002-04-12 10:26:21 -07002242#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002243#include <sys/socket.h>
2244#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002245int main() {
2246#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002247#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002248exit(1);
2249#endif
2250struct msghdr m;
2251m.msg_control = 0;
2252exit(0);
2253}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002254 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002255 [ ac_cv_have_control_in_msghdr="yes" ],
2256 [ ac_cv_have_control_in_msghdr="no" ]
2257 )
2258])
2259if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2260 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2261fi
2262
Damien Miller61e50f12000-05-08 20:49:37 +10002263AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002264 AC_TRY_LINK([],
2265 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002266 [ ac_cv_libc_defines___progname="yes" ],
2267 [ ac_cv_libc_defines___progname="no" ]
2268 )
2269])
2270if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2271 AC_DEFINE(HAVE___PROGNAME)
2272fi
2273
Kevin Steves4846f4a2002-03-22 18:19:53 +00002274AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2275 AC_TRY_LINK([
2276#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002277],
2278 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002279 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2280 [ ac_cv_cc_implements___FUNCTION__="no" ]
2281 )
2282])
2283if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2284 AC_DEFINE(HAVE___FUNCTION__)
2285fi
2286
2287AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2288 AC_TRY_LINK([
2289#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002290],
2291 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002292 [ ac_cv_cc_implements___func__="yes" ],
2293 [ ac_cv_cc_implements___func__="no" ]
2294 )
2295])
2296if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2297 AC_DEFINE(HAVE___func__)
2298fi
2299
Damien Miller4f8e6692001-07-14 13:22:53 +10002300AC_CACHE_CHECK([whether getopt has optreset support],
2301 ac_cv_have_getopt_optreset, [
2302 AC_TRY_LINK(
2303 [
2304#include <getopt.h>
2305 ],
2306 [ extern int optreset; optreset = 0; ],
2307 [ ac_cv_have_getopt_optreset="yes" ],
2308 [ ac_cv_have_getopt_optreset="no" ]
2309 )
2310])
2311if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2312 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2313fi
Damien Millera22ba012000-03-02 23:09:20 +11002314
Damien Millerecbb26d2000-07-15 14:59:14 +10002315AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002316 AC_TRY_LINK([],
2317 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002318 [ ac_cv_libc_defines_sys_errlist="yes" ],
2319 [ ac_cv_libc_defines_sys_errlist="no" ]
2320 )
2321])
2322if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2323 AC_DEFINE(HAVE_SYS_ERRLIST)
2324fi
2325
2326
Damien Miller11fa2cc2000-08-16 10:35:58 +10002327AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002328 AC_TRY_LINK([],
2329 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002330 [ ac_cv_libc_defines_sys_nerr="yes" ],
2331 [ ac_cv_libc_defines_sys_nerr="no" ]
2332 )
2333])
2334if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2335 AC_DEFINE(HAVE_SYS_NERR)
2336fi
2337
Damien Millera8e06ce2003-11-21 23:48:55 +11002338SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002339# Check whether user wants sectok support
2340AC_ARG_WITH(sectok,
2341 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002342 [
2343 if test "x$withval" != "xno" ; then
2344 if test "x$withval" != "xyes" ; then
2345 CPPFLAGS="$CPPFLAGS -I${withval}"
2346 LDFLAGS="$LDFLAGS -L${withval}"
2347 if test ! -z "$need_dash_r" ; then
2348 LDFLAGS="$LDFLAGS -R${withval}"
2349 fi
2350 if test ! -z "$blibpath" ; then
2351 blibpath="$blibpath:${withval}"
2352 fi
2353 fi
2354 AC_CHECK_HEADERS(sectok.h)
2355 if test "$ac_cv_header_sectok_h" != yes; then
2356 AC_MSG_ERROR(Can't find sectok.h)
2357 fi
2358 AC_CHECK_LIB(sectok, sectok_open)
2359 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2360 AC_MSG_ERROR(Can't find libsectok)
2361 fi
2362 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002363 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002364 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002365 fi
2366 ]
2367)
2368
2369# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002370OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002371AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002372 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2373 [
2374 if test "x$withval" != "xno" ; then
2375 if test "x$withval" != "xyes" ; then
2376 OPENSC_CONFIG=$withval/bin/opensc-config
2377 else
2378 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2379 fi
2380 if test "$OPENSC_CONFIG" != "no"; then
2381 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2382 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2383 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2384 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2385 AC_DEFINE(SMARTCARD)
2386 AC_DEFINE(USE_OPENSC)
2387 SCARD_MSG="yes, using OpenSC"
2388 fi
2389 fi
2390 ]
2391)
Damien Miller85de5802001-09-18 14:01:11 +10002392
Darren Tucker5f88d342003-10-15 16:57:57 +10002393# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002394AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002395 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002396 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002397 # Needed by our getrrsetbyname()
2398 AC_SEARCH_LIBS(res_query, resolv)
2399 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002400 AC_MSG_CHECKING(if res_query will link)
2401 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2402 [AC_MSG_RESULT(no)
2403 saved_LIBS="$LIBS"
2404 LIBS="$LIBS -lresolv"
2405 AC_MSG_CHECKING(for res_query in -lresolv)
2406 AC_LINK_IFELSE([
2407#include <resolv.h>
2408int main()
2409{
2410 res_query (0, 0, 0, 0, 0);
2411 return 0;
2412}
2413 ],
2414 [LIBS="$LIBS -lresolv"
2415 AC_MSG_RESULT(yes)],
2416 [LIBS="$saved_LIBS"
2417 AC_MSG_RESULT(no)])
2418 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002419 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tucker84ce9b42005-05-26 20:12:15 +10002420 AC_CHECK_DECLS([_getshort, _getlong])
Darren Tucker5f88d342003-10-15 16:57:57 +10002421 AC_CHECK_MEMBER(HEADER.ad,
2422 [AC_DEFINE(HAVE_HEADER_AD)],,
2423 [#include <arpa/nameser.h>])
2424 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002425
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002426# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002427KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002428AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002429 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002430 [ if test "x$withval" != "xno" ; then
2431 if test "x$withval" = "xyes" ; then
2432 KRB5ROOT="/usr/local"
2433 else
2434 KRB5ROOT=${withval}
2435 fi
2436
2437 AC_DEFINE(KRB5)
2438 KRB5_MSG="yes"
2439
2440 AC_MSG_CHECKING(for krb5-config)
2441 if test -x $KRB5ROOT/bin/krb5-config ; then
2442 KRB5CONF=$KRB5ROOT/bin/krb5-config
2443 AC_MSG_RESULT($KRB5CONF)
2444
2445 AC_MSG_CHECKING(for gssapi support)
2446 if $KRB5CONF | grep gssapi >/dev/null ; then
2447 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002448 AC_DEFINE(GSSAPI)
2449 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002450 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002451 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002452 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002453 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002454 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2455 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002456 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002457 AC_MSG_CHECKING(whether we are using Heimdal)
2458 AC_TRY_COMPILE([ #include <krb5.h> ],
2459 [ char *tmp = heimdal_version; ],
2460 [ AC_MSG_RESULT(yes)
2461 AC_DEFINE(HEIMDAL) ],
2462 AC_MSG_RESULT(no)
2463 )
2464 else
2465 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002466 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002467 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002468 AC_MSG_CHECKING(whether we are using Heimdal)
2469 AC_TRY_COMPILE([ #include <krb5.h> ],
2470 [ char *tmp = heimdal_version; ],
2471 [ AC_MSG_RESULT(yes)
2472 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002473 K5LIBS="-lkrb5 -ldes"
2474 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002475 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002476 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002477 ],
2478 [ AC_MSG_RESULT(no)
2479 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2480 ]
2481 )
Damien Miller200d0a72003-06-30 19:21:36 +10002482 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002483
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002484 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2485 [ AC_DEFINE(GSSAPI)
2486 K5LIBS="-lgssapi $K5LIBS" ],
2487 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2488 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002489 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002490 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2491 $K5LIBS)
2492 ],
2493 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002494
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002495 AC_CHECK_HEADER(gssapi.h, ,
2496 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002497 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002498 AC_CHECK_HEADERS(gssapi.h, ,
2499 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002500 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002501 ]
2502 )
2503
2504 oldCPP="$CPPFLAGS"
2505 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2506 AC_CHECK_HEADER(gssapi_krb5.h, ,
2507 [ CPPFLAGS="$oldCPP" ])
2508
Damien Millera8e06ce2003-11-21 23:48:55 +11002509 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002510 if test ! -z "$need_dash_r" ; then
2511 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2512 fi
2513 if test ! -z "$blibpath" ; then
2514 blibpath="$blibpath:${KRB5ROOT}/lib"
2515 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002516 fi
2517
2518 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2519 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2520 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2521
2522 LIBS="$LIBS $K5LIBS"
2523 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002524 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002525 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002526)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002527
Damien Millera22ba012000-03-02 23:09:20 +11002528# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002529
Damien Millerf58c6722002-05-13 13:15:42 +10002530PRIVSEP_PATH=/var/empty
2531AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002532 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002533 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002534 if test -n "$withval" && test "x$withval" != "xno" && \
2535 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002536 PRIVSEP_PATH=$withval
2537 fi
2538 ]
2539)
2540AC_SUBST(PRIVSEP_PATH)
2541
Damien Millera22ba012000-03-02 23:09:20 +11002542AC_ARG_WITH(xauth,
2543 [ --with-xauth=PATH Specify path to xauth program ],
2544 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002545 if test -n "$withval" && test "x$withval" != "xno" && \
2546 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002547 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002548 fi
2549 ],
2550 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002551 TestPath="$PATH"
2552 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2553 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2554 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2555 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2556 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002557 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002558 xauth_path="/usr/openwin/bin/xauth"
2559 fi
2560 ]
2561)
2562
Damien Miller7d901272003-01-13 16:55:22 +11002563STRIP_OPT=-s
2564AC_ARG_ENABLE(strip,
2565 [ --disable-strip Disable calling strip(1) on install],
2566 [
2567 if test "x$enableval" = "xno" ; then
2568 STRIP_OPT=
2569 fi
2570 ]
2571)
2572AC_SUBST(STRIP_OPT)
2573
Damien Millera19cf472000-11-29 13:28:50 +11002574if test -z "$xauth_path" ; then
2575 XAUTH_PATH="undefined"
2576 AC_SUBST(XAUTH_PATH)
2577else
Damien Millera22ba012000-03-02 23:09:20 +11002578 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002579 XAUTH_PATH=$xauth_path
2580 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002581fi
Damien Millera22ba012000-03-02 23:09:20 +11002582
2583# Check for mail directory (last resort if we cannot get it from headers)
2584if test ! -z "$MAIL" ; then
2585 maildir=`dirname $MAIL`
2586 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2587fi
2588
Darren Tucker623d92f2004-09-12 22:36:15 +10002589if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002590 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2591 disable_ptmx_check=yes
2592fi
Damien Millera22ba012000-03-02 23:09:20 +11002593if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002594 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002595 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002596 [
2597 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2598 have_dev_ptmx=1
2599 ]
2600 )
2601 fi
Damien Millera22ba012000-03-02 23:09:20 +11002602fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002603
Darren Tucker623d92f2004-09-12 22:36:15 +10002604if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002605 AC_CHECK_FILE("/dev/ptc",
2606 [
2607 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2608 have_dev_ptc=1
2609 ]
2610 )
2611else
2612 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2613fi
Damien Miller204ad072000-03-02 23:56:12 +11002614
Damien Millera22ba012000-03-02 23:09:20 +11002615# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002616AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002617 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002618 [
Damien Miller897741e2001-04-16 10:41:46 +10002619 case "$withval" in
2620 man|cat|doc)
2621 MANTYPE=$withval
2622 ;;
2623 *)
2624 AC_MSG_ERROR(invalid man type: $withval)
2625 ;;
2626 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002627 ]
2628)
Ben Lindstrombc709922001-04-18 18:04:21 +00002629if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002630 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2631 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002632 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2633 MANTYPE=doc
2634 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2635 MANTYPE=man
2636 else
2637 MANTYPE=cat
2638 fi
2639fi
Damien Miller670a4b82000-01-22 13:53:11 +11002640AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002641if test "$MANTYPE" = "doc"; then
2642 mansubdir=man;
2643else
2644 mansubdir=$MANTYPE;
2645fi
2646AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002647
Damien Millera22ba012000-03-02 23:09:20 +11002648# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002649MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002650AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002651 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002652 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002653 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002654 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002655 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002656 fi
2657 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002658)
2659
Damien Millera22ba012000-03-02 23:09:20 +11002660# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002661AC_ARG_WITH(shadow,
2662 [ --without-shadow Disable shadow password support],
2663 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002664 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002665 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002666 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002667 fi
2668 ]
2669)
2670
Damien Miller1f335fb2000-06-26 11:31:33 +10002671if test -z "$disable_shadow" ; then
2672 AC_MSG_CHECKING([if the systems has expire shadow information])
2673 AC_TRY_COMPILE(
2674 [
2675#include <sys/types.h>
2676#include <shadow.h>
2677 struct spwd sp;
2678 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2679 [ sp_expire_available=yes ], []
2680 )
2681
2682 if test "x$sp_expire_available" = "xyes" ; then
2683 AC_MSG_RESULT(yes)
2684 AC_DEFINE(HAS_SHADOW_EXPIRE)
2685 else
2686 AC_MSG_RESULT(no)
2687 fi
2688fi
2689
Damien Millera22ba012000-03-02 23:09:20 +11002690# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002691if test ! -z "$IPADDR_IN_DISPLAY" ; then
2692 DISPLAY_HACK_MSG="yes"
2693 AC_DEFINE(IPADDR_IN_DISPLAY)
2694else
Damien Millera8e06ce2003-11-21 23:48:55 +11002695 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002696 AC_ARG_WITH(ipaddr-display,
2697 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2698 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002699 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002700 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002701 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002702 fi
2703 ]
2704 )
2705fi
Damien Miller76112de1999-12-21 11:18:08 +11002706
Darren Tuckere1a790d2003-09-16 11:52:19 +10002707# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002708AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002709 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002710 [ if test "x$enableval" = "xno"; then
2711 AC_MSG_NOTICE([/etc/default/login handling disabled])
2712 etc_default_login=no
2713 else
2714 etc_default_login=yes
2715 fi ],
2716 [ etc_default_login=yes ]
2717)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002718
Darren Tucker2f9573d2005-02-10 22:28:54 +11002719if test "x$etc_default_login" != "xno"; then
2720 AC_CHECK_FILE("/etc/default/login",
2721 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002722 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2723 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002724 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2725 elif test "x$external_path_file" = "x/etc/default/login"; then
2726 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2727 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002728fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002729
Tim Rice43a1c132002-04-17 21:19:14 -07002730dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002731if test $ac_cv_func_login_getcapbool = "yes" && \
2732 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002733 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002734fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002735
Damien Millera22ba012000-03-02 23:09:20 +11002736# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002737SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002738AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002739 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002740 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002741 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002742 AC_MSG_WARN([
2743--with-default-path=PATH has no effect on this system.
2744Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002745 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002746 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002747 AC_MSG_WARN([
2748--with-default-path=PATH will only be used if PATH is not defined in
2749$external_path_file .])
2750 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002751 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002752 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002753 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002754 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002755 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2756 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002757 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002758 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002759 AC_MSG_WARN([
2760If PATH is defined in $external_path_file, ensure the path to scp is included,
2761otherwise scp will not work.])
2762 fi
2763 AC_TRY_RUN(
2764 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002765/* find out what STDPATH is */
2766#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002767#ifdef HAVE_PATHS_H
2768# include <paths.h>
2769#endif
2770#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002771# ifdef _PATH_USERPATH /* Irix */
2772# define _PATH_STDPATH _PATH_USERPATH
2773# else
2774# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2775# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002776#endif
2777#include <sys/types.h>
2778#include <sys/stat.h>
2779#include <fcntl.h>
2780#define DATA "conftest.stdpath"
2781
2782main()
2783{
2784 FILE *fd;
2785 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002786
Tim Rice59ea0a02001-03-10 13:50:45 -08002787 fd = fopen(DATA,"w");
2788 if(fd == NULL)
2789 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002790
Tim Rice59ea0a02001-03-10 13:50:45 -08002791 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2792 exit(1);
2793
2794 exit(0);
2795}
2796 ], [ user_path=`cat conftest.stdpath` ],
2797 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2798 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2799 )
2800# make sure $bindir is in USER_PATH so scp will work
2801 t_bindir=`eval echo ${bindir}`
2802 case $t_bindir in
2803 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2804 esac
2805 case $t_bindir in
2806 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2807 esac
2808 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2809 if test $? -ne 0 ; then
2810 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2811 if test $? -ne 0 ; then
2812 user_path=$user_path:$t_bindir
2813 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2814 fi
2815 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002816 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002817)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002818if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002819 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2820 AC_SUBST(user_path)
2821fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002822
Damien Millera18bbd32002-05-13 10:48:57 +10002823# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002824AC_ARG_WITH(superuser-path,
2825 [ --with-superuser-path= Specify different path for super-user],
2826 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002827 if test -n "$withval" && test "x$withval" != "xno" && \
2828 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002829 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2830 superuser_path=$withval
2831 fi
2832 ]
2833)
2834
2835
Damien Miller61e50f12000-05-08 20:49:37 +10002836AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002837IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002838AC_ARG_WITH(4in6,
2839 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2840 [
2841 if test "x$withval" != "xno" ; then
2842 AC_MSG_RESULT(yes)
2843 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002844 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002845 else
2846 AC_MSG_RESULT(no)
2847 fi
2848 ],[
2849 if test "x$inet6_default_4in6" = "xyes"; then
2850 AC_MSG_RESULT([yes (default)])
2851 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002852 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002853 else
2854 AC_MSG_RESULT([no (default)])
2855 fi
2856 ]
2857)
2858
Damien Miller60396b02001-02-18 17:01:00 +11002859# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002860BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002861AC_ARG_WITH(bsd-auth,
2862 [ --with-bsd-auth Enable BSD auth support],
2863 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002864 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002865 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002866 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002867 fi
2868 ]
2869)
2870
Damien Millera22ba012000-03-02 23:09:20 +11002871# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002872piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002873# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002874if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002875 piddir=`eval echo ${sysconfdir}`
2876 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002877 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002878 esac
2879fi
2880
Tim Rice88f2ab52002-03-17 12:17:34 -08002881AC_ARG_WITH(pid-dir,
2882 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2883 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002884 if test -n "$withval" && test "x$withval" != "xno" && \
2885 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002886 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08002887 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08002888 AC_MSG_WARN([** no $piddir directory on this system **])
2889 fi
2890 fi
2891 ]
2892)
2893
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002894AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002895AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002896
andre2ff7b5d2000-06-03 14:57:40 +00002897dnl allow user to disable some login recording features
2898AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002899 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002900 [
2901 if test "x$enableval" = "xno" ; then
2902 AC_DEFINE(DISABLE_LASTLOG)
2903 fi
2904 ]
andre2ff7b5d2000-06-03 14:57:40 +00002905)
2906AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002907 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002908 [
2909 if test "x$enableval" = "xno" ; then
2910 AC_DEFINE(DISABLE_UTMP)
2911 fi
2912 ]
andre2ff7b5d2000-06-03 14:57:40 +00002913)
2914AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002915 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002916 [
2917 if test "x$enableval" = "xno" ; then
2918 AC_DEFINE(DISABLE_UTMPX)
2919 fi
2920 ]
andre2ff7b5d2000-06-03 14:57:40 +00002921)
2922AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002923 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002924 [
2925 if test "x$enableval" = "xno" ; then
2926 AC_DEFINE(DISABLE_WTMP)
2927 fi
2928 ]
andre2ff7b5d2000-06-03 14:57:40 +00002929)
2930AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002931 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002932 [
2933 if test "x$enableval" = "xno" ; then
2934 AC_DEFINE(DISABLE_WTMPX)
2935 fi
2936 ]
andre2ff7b5d2000-06-03 14:57:40 +00002937)
2938AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002939 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002940 [
2941 if test "x$enableval" = "xno" ; then
2942 AC_DEFINE(DISABLE_LOGIN)
2943 fi
2944 ]
andre2ff7b5d2000-06-03 14:57:40 +00002945)
2946AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002947 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002948 [
2949 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002950 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002951 fi
2952 ]
andre2ff7b5d2000-06-03 14:57:40 +00002953)
2954AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002955 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002956 [
2957 if test "x$enableval" = "xno" ; then
2958 AC_DEFINE(DISABLE_PUTUTXLINE)
2959 fi
2960 ]
andre2ff7b5d2000-06-03 14:57:40 +00002961)
2962AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002963 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002964 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002965 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11002966 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08002967 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11002968 conf_lastlog_location=$withval
2969 fi
2970 ]
2971)
andre2ff7b5d2000-06-03 14:57:40 +00002972
2973dnl lastlog, [uw]tmpx? detection
2974dnl NOTE: set the paths in the platform section to avoid the
2975dnl need for command-line parameters
2976dnl lastlog and [uw]tmp are subject to a file search if all else fails
2977
2978dnl lastlog detection
2979dnl NOTE: the code itself will detect if lastlog is a directory
2980AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2981AC_TRY_COMPILE([
2982#include <sys/types.h>
2983#include <utmp.h>
2984#ifdef HAVE_LASTLOG_H
2985# include <lastlog.h>
2986#endif
Damien Miller2994e082000-06-04 15:51:47 +10002987#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002988# include <paths.h>
2989#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002990#ifdef HAVE_LOGIN_H
2991# include <login.h>
2992#endif
andre2ff7b5d2000-06-03 14:57:40 +00002993 ],
2994 [ char *lastlog = LASTLOG_FILE; ],
2995 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002996 [
2997 AC_MSG_RESULT(no)
2998 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2999 AC_TRY_COMPILE([
3000#include <sys/types.h>
3001#include <utmp.h>
3002#ifdef HAVE_LASTLOG_H
3003# include <lastlog.h>
3004#endif
3005#ifdef HAVE_PATHS_H
3006# include <paths.h>
3007#endif
3008 ],
3009 [ char *lastlog = _PATH_LASTLOG; ],
3010 [ AC_MSG_RESULT(yes) ],
3011 [
andree441aa32000-06-12 22:34:38 +00003012 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003013 system_lastlog_path=no
3014 ])
3015 ]
andre2ff7b5d2000-06-03 14:57:40 +00003016)
Damien Miller2994e082000-06-04 15:51:47 +10003017
andre2ff7b5d2000-06-03 14:57:40 +00003018if test -z "$conf_lastlog_location"; then
3019 if test x"$system_lastlog_path" = x"no" ; then
3020 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003021 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003022 conf_lastlog_location=$f
3023 fi
3024 done
3025 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003026 AC_MSG_WARN([** Cannot find lastlog **])
3027 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003028 fi
3029 fi
3030fi
3031
3032if test -n "$conf_lastlog_location"; then
3033 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003034fi
andre2ff7b5d2000-06-03 14:57:40 +00003035
3036dnl utmp detection
3037AC_MSG_CHECKING([if your system defines UTMP_FILE])
3038AC_TRY_COMPILE([
3039#include <sys/types.h>
3040#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003041#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003042# include <paths.h>
3043#endif
3044 ],
3045 [ char *utmp = UTMP_FILE; ],
3046 [ AC_MSG_RESULT(yes) ],
3047 [ AC_MSG_RESULT(no)
3048 system_utmp_path=no ]
3049)
3050if test -z "$conf_utmp_location"; then
3051 if test x"$system_utmp_path" = x"no" ; then
3052 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3053 if test -f $f ; then
3054 conf_utmp_location=$f
3055 fi
3056 done
3057 if test -z "$conf_utmp_location"; then
3058 AC_DEFINE(DISABLE_UTMP)
3059 fi
3060 fi
3061fi
3062if test -n "$conf_utmp_location"; then
3063 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003064fi
andre2ff7b5d2000-06-03 14:57:40 +00003065
3066dnl wtmp detection
3067AC_MSG_CHECKING([if your system defines WTMP_FILE])
3068AC_TRY_COMPILE([
3069#include <sys/types.h>
3070#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003071#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003072# include <paths.h>
3073#endif
3074 ],
3075 [ char *wtmp = WTMP_FILE; ],
3076 [ AC_MSG_RESULT(yes) ],
3077 [ AC_MSG_RESULT(no)
3078 system_wtmp_path=no ]
3079)
3080if test -z "$conf_wtmp_location"; then
3081 if test x"$system_wtmp_path" = x"no" ; then
3082 for f in /usr/adm/wtmp /var/log/wtmp; do
3083 if test -f $f ; then
3084 conf_wtmp_location=$f
3085 fi
3086 done
3087 if test -z "$conf_wtmp_location"; then
3088 AC_DEFINE(DISABLE_WTMP)
3089 fi
3090 fi
3091fi
3092if test -n "$conf_wtmp_location"; then
3093 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003094fi
andre2ff7b5d2000-06-03 14:57:40 +00003095
3096
3097dnl utmpx detection - I don't know any system so perverse as to require
3098dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3099dnl there, though.
3100AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3101AC_TRY_COMPILE([
3102#include <sys/types.h>
3103#include <utmp.h>
3104#ifdef HAVE_UTMPX_H
3105#include <utmpx.h>
3106#endif
Damien Miller2994e082000-06-04 15:51:47 +10003107#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003108# include <paths.h>
3109#endif
3110 ],
3111 [ char *utmpx = UTMPX_FILE; ],
3112 [ AC_MSG_RESULT(yes) ],
3113 [ AC_MSG_RESULT(no)
3114 system_utmpx_path=no ]
3115)
3116if test -z "$conf_utmpx_location"; then
3117 if test x"$system_utmpx_path" = x"no" ; then
3118 AC_DEFINE(DISABLE_UTMPX)
3119 fi
3120else
3121 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003122fi
andre2ff7b5d2000-06-03 14:57:40 +00003123
3124dnl wtmpx detection
3125AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3126AC_TRY_COMPILE([
3127#include <sys/types.h>
3128#include <utmp.h>
3129#ifdef HAVE_UTMPX_H
3130#include <utmpx.h>
3131#endif
Damien Miller2994e082000-06-04 15:51:47 +10003132#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003133# include <paths.h>
3134#endif
3135 ],
3136 [ char *wtmpx = WTMPX_FILE; ],
3137 [ AC_MSG_RESULT(yes) ],
3138 [ AC_MSG_RESULT(no)
3139 system_wtmpx_path=no ]
3140)
3141if test -z "$conf_wtmpx_location"; then
3142 if test x"$system_wtmpx_path" = x"no" ; then
3143 AC_DEFINE(DISABLE_WTMPX)
3144 fi
3145else
3146 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003147fi
andre2ff7b5d2000-06-03 14:57:40 +00003148
Damien Miller4018c192000-04-30 09:30:44 +10003149
Damien Miller29ea30d2000-03-17 10:54:15 +11003150if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003151 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3152 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003153fi
3154
Tim Rice4cec93f2002-02-26 08:40:48 -08003155dnl remove pam and dl because they are in $LIBPAM
3156if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003157 LIBS=`echo $LIBS | sed 's/-lpam //'`
3158fi
3159if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3160 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003161fi
3162
Damien Millerbac2d8a2000-09-05 16:13:06 +11003163AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003164AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3165 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003166AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003167
Damien Miller7b22d652000-06-18 14:07:04 +10003168# Print summary of options
3169
Damien Miller7b22d652000-06-18 14:07:04 +10003170# Someone please show me a better way :)
3171A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3172B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3173C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3174D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003175E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003176F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003177G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003178H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3179I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3180J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003181
3182echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003183echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003184echo " User binaries: $B"
3185echo " System binaries: $C"
3186echo " Configuration files: $D"
3187echo " Askpass program: $E"
3188echo " Manual pages: $F"
3189echo " PID file: $G"
3190echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003191if test "x$external_path_file" = "x/etc/login.conf" ; then
3192echo " At runtime, sshd will use the path defined in $external_path_file"
3193echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003194else
Damien Millerf58c6722002-05-13 13:15:42 +10003195echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003196 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003197echo " (If PATH is set in $external_path_file it will be used instead. If"
3198echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3199 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003200fi
Damien Millera18bbd32002-05-13 10:48:57 +10003201if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003202echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003203fi
Damien Millerf58c6722002-05-13 13:15:42 +10003204echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003205echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003206echo " KerberosV support: $KRB5_MSG"
3207echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003208echo " S/KEY support: $SKEY_MSG"
3209echo " TCP Wrappers support: $TCPW_MSG"
3210echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003211echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003212echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003213echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3214echo " BSD Auth support: $BSD_AUTH_MSG"
3215echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003216if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003217echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003218fi
3219
Damien Miller7b22d652000-06-18 14:07:04 +10003220echo ""
3221
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003222echo " Host: ${host}"
3223echo " Compiler: ${CC}"
3224echo " Compiler flags: ${CFLAGS}"
3225echo "Preprocessor flags: ${CPPFLAGS}"
3226echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003227echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003228
3229echo ""
3230
Tim Rice6f1f7582004-05-30 21:38:51 -07003231if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003232 echo "SVR4 style packages are supported with \"make package\""
3233 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003234fi
3235
Damien Miller82cf0ce2000-12-20 13:34:48 +11003236if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003237 echo "PAM is enabled. You may need to install a PAM control file "
3238 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003239 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003240 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003241 echo ""
3242fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003243
Damien Miller6c21c512002-01-22 21:57:53 +11003244if test ! -z "$RAND_HELPER_CMDHASH" ; then
3245 echo "WARNING: you are using the builtin random number collection "
3246 echo "service. Please read WARNING.RNG and request that your OS "
3247 echo "vendor includes kernel-based random number collection in "
3248 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003249 echo ""
3250fi
Damien Miller60396b02001-02-18 17:01:00 +11003251
Damien Millerb4097182004-05-23 14:09:40 +10003252if test ! -z "$NO_PEERCHECK" ; then
3253 echo "WARNING: the operating system that you are using does not "
3254 echo "appear to support either the getpeereid() API nor the "
3255 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3256 echo "enforce security checks to prevent unauthorised connections to "
3257 echo "ssh-agent. Their absence increases the risk that a malicious "
3258 echo "user can connect to your agent. "
3259 echo ""
3260fi
3261
Darren Tuckerd9f88912005-02-20 21:01:48 +11003262if test "$AUDIT_MODULE" = "bsm" ; then
3263 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3264 echo "See the Solaris section in README.platform for details."
3265fi