blob: af14953b653f227e009539e7b89a7525bb002967 [file] [log] [blame]
Darren Tucker0c9653f2005-05-28 15:58:14 +10001# $Id: configure.ac,v 1.264 2005/05/28 05:58:14 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
Darren Tucker0c9653f2005-05-28 15:58:14 +1000540dnl Checks for header files.
541AC_CHECK_HEADERS( \
542 bstring.h \
543 crypt.h \
544 dirent.h \
545 endian.h \
546 features.h \
547 floatingpoint.h \
548 getopt.h \
549 glob.h \
550 ia.h \
551 lastlog.h \
552 limits.h \
553 login.h \
554 login_cap.h \
555 maillock.h \
556 ndir.h \
557 netdb.h \
558 netgroup.h \
559 netinet/in_systm.h \
560 pam/pam_appl.h \
561 paths.h \
562 pty.h \
563 readpassphrase.h \
564 rpc/types.h \
565 security/pam_appl.h \
566 shadow.h \
567 stddef.h \
568 stdint.h \
569 strings.h \
570 sys/audit.h \
571 sys/bitypes.h \
572 sys/bsdtty.h \
573 sys/cdefs.h \
574 sys/dir.h \
575 sys/mman.h \
576 sys/ndir.h \
577 sys/prctl.h \
578 sys/pstat.h \
579 sys/select.h \
580 sys/stat.h \
581 sys/stream.h \
582 sys/stropts.h \
583 sys/strtio.h \
584 sys/sysmacros.h \
585 sys/time.h \
586 sys/timers.h \
587 sys/un.h \
588 time.h \
589 tmpdir.h \
590 ttyent.h \
591 usersec.h \
592 util.h \
593 utime.h \
594 utmp.h \
595 utmpx.h \
596 vis.h\
597)
Tim Rice4cec93f2002-02-26 08:40:48 -0800598
Darren Tucker48d99d32004-08-29 17:04:50 +1000599# sys/ptms.h requires sys/stream.h to be included first on Solaris
600AC_CHECK_HEADERS(sys/ptms.h, [], [], [
601#ifdef HAVE_SYS_STREAM_H
602# include <sys/stream.h>
603#endif
604])
605
Damien Millera22ba012000-03-02 23:09:20 +1100606# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700607AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
608AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000609
Tim Rice1e1ef642003-09-11 22:19:31 -0700610dnl IRIX and Solaris 2.5.1 have dirname() in libgen
611AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
612 AC_CHECK_LIB(gen, dirname,[
613 AC_CACHE_CHECK([for broken dirname],
614 ac_cv_have_broken_dirname, [
615 save_LIBS="$LIBS"
616 LIBS="$LIBS -lgen"
617 AC_TRY_RUN(
618 [
619#include <libgen.h>
620#include <string.h>
621
622int main(int argc, char **argv) {
623 char *s, buf[32];
624
625 strncpy(buf,"/etc", 32);
626 s = dirname(buf);
627 if (!s || strncmp(s, "/", 32) != 0) {
628 exit(1);
629 } else {
630 exit(0);
631 }
632}
633 ],
634 [ ac_cv_have_broken_dirname="no" ],
635 [ ac_cv_have_broken_dirname="yes" ]
636 )
637 LIBS="$save_LIBS"
638 ])
639 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
640 LIBS="$LIBS -lgen"
641 AC_DEFINE(HAVE_DIRNAME)
642 AC_CHECK_HEADERS(libgen.h)
643 fi
644 ])
645])
646
647AC_CHECK_FUNC(getspnam, ,
648 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
649AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
650
Tim Rice13aae5e2001-10-21 17:53:58 -0700651dnl zlib is required
652AC_ARG_WITH(zlib,
653 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100654 [ if test "x$withval" = "xno" ; then
655 AC_MSG_ERROR([*** zlib is required ***])
656 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700657 if test -d "$withval/lib"; then
658 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700659 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700660 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700661 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700662 fi
663 else
664 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700665 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700666 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700667 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700668 fi
669 fi
670 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700671 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700672 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700673 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700674 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100675 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700676)
677
Tim Ricefcb62202004-01-23 18:35:16 -0800678AC_CHECK_LIB(z, deflate, ,
679 [
680 saved_CPPFLAGS="$CPPFLAGS"
681 saved_LDFLAGS="$LDFLAGS"
682 save_LIBS="$LIBS"
683 dnl Check default zlib install dir
684 if test -n "${need_dash_r}"; then
685 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
686 else
687 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
688 fi
689 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
690 LIBS="$LIBS -lz"
691 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
692 [
693 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
694 ]
695 )
696 ]
697)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100698AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100699
700AC_ARG_WITH(zlib-version-check,
701 [ --without-zlib-version-check Disable zlib version check],
702 [ if test "x$withval" = "xno" ; then
703 zlib_check_nonfatal=1
704 fi
705 ]
706)
707
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000708AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000709AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000710#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100711#include <zlib.h>
712int main()
713{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000714 int a=0, b=0, c=0, d=0, n, v;
715 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
716 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100717 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000718 v = a*1000000 + b*10000 + c*100 + d;
719 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
720
721 /* 1.1.4 is OK */
722 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100723 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000724
725 /* 1.2.1.2 and up are OK */
726 if (v >= 1020102)
727 exit(0);
728
Darren Tucker2dcd2392004-01-23 17:13:33 +1100729 exit(2);
730}
Darren Tucker623d92f2004-09-12 22:36:15 +1000731 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000732 AC_MSG_RESULT(no),
733 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100734 if test -z "$zlib_check_nonfatal" ; then
735 AC_MSG_ERROR([*** zlib too old - check config.log ***
736Your reported zlib version has known security problems. It's possible your
737vendor has fixed these problems without changing the version number. If you
738are sure this is the case, you can disable the check by running
739"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000740If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
741See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100742 else
743 AC_MSG_WARN([zlib version may have security problems])
744 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000745 ],
746 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100747)
Damien Miller6f9c3372000-10-25 10:06:04 +1100748
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000749dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100750AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000751 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
752)
Damien Millera8e06ce2003-11-21 23:48:55 +1100753AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700754 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
755 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000756)
Damien Millerab18c411999-11-11 10:40:23 +1100757
Tim Ricee589a292001-11-03 11:09:32 -0800758dnl Checks for libutil functions
759AC_CHECK_HEADERS(libutil.h)
760AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
761AC_CHECK_FUNCS(logout updwtmp logwtmp)
762
Ben Lindstrom8697e082001-02-24 21:41:10 +0000763AC_FUNC_STRFTIME
764
Damien Miller3c027682001-03-14 11:39:45 +1100765# Check for ALTDIRFUNC glob() extension
766AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
767AC_EGREP_CPP(FOUNDIT,
768 [
769 #include <glob.h>
770 #ifdef GLOB_ALTDIRFUNC
771 FOUNDIT
772 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100773 ],
Damien Miller3c027682001-03-14 11:39:45 +1100774 [
775 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
776 AC_MSG_RESULT(yes)
777 ],
778 [
779 AC_MSG_RESULT(no)
780 ]
781)
Damien Millerab18c411999-11-11 10:40:23 +1100782
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000783# Check for g.gl_matchc glob() extension
784AC_MSG_CHECKING(for gl_matchc field in glob_t)
785AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100786 [
787 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000788 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100789 ],
790 [
791 AC_DEFINE(GLOB_HAS_GL_MATCHC)
792 AC_MSG_RESULT(yes)
793 ],
794 [
795 AC_MSG_RESULT(no)
796 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000797)
798
Damien Miller18bb4732001-03-28 14:35:30 +1000799AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000800AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000801 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000802#include <sys/types.h>
803#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700804int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000805 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100806 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000807 [
808 AC_MSG_RESULT(no)
809 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000810 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800811 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000812 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
813 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000814 ]
815)
816
Damien Miller36f49652004-08-15 18:40:59 +1000817AC_MSG_CHECKING([for /proc/pid/fd directory])
818if test -d "/proc/$$/fd" ; then
819 AC_DEFINE(HAVE_PROC_PID)
820 AC_MSG_RESULT(yes)
821else
822 AC_MSG_RESULT(no)
823fi
824
Damien Millerc547bf12001-02-16 10:18:12 +1100825# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100826SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100827AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100828 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100829 [
830 if test "x$withval" != "xno" ; then
831
832 if test "x$withval" != "xyes" ; then
833 CPPFLAGS="$CPPFLAGS -I${withval}/include"
834 LDFLAGS="$LDFLAGS -L${withval}/lib"
835 fi
836
837 AC_DEFINE(SKEY)
838 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100839 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800840
Tim Rice4cec93f2002-02-26 08:40:48 -0800841 AC_MSG_CHECKING([for s/key support])
842 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100843 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800844#include <stdio.h>
845#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700846int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800847 ],
848 [AC_MSG_RESULT(yes)],
849 [
850 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100851 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
852 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000853 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
854 AC_TRY_COMPILE(
855 [#include <stdio.h>
856 #include <skey.h>],
857 [(void)skeychallenge(NULL,"name","",0);],
858 [AC_MSG_RESULT(yes)
859 AC_DEFINE(SKEYCHALLENGE_4ARG)],
860 [AC_MSG_RESULT(no)]
861 )
Damien Millerc547bf12001-02-16 10:18:12 +1100862 fi
863 ]
864)
865
866# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700867TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100868AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100869 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100870 [
871 if test "x$withval" != "xno" ; then
872 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700873 saved_LDFLAGS="$LDFLAGS"
874 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800875 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800876 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700877 if test -d "${withval}/lib"; then
878 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700879 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700880 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700881 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700882 fi
883 else
884 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700885 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700886 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700887 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700888 fi
889 fi
890 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700891 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700892 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700893 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700894 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700895 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800896 LIBWRAP="-lwrap"
897 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100898 AC_MSG_CHECKING(for libwrap)
899 AC_TRY_LINK(
900 [
Damien Miller0ac45002004-04-14 20:14:26 +1000901#include <sys/types.h>
902#include <sys/socket.h>
903#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100904#include <tcpd.h>
905 int deny_severity = 0, allow_severity = 0;
906 ],
907 [hosts_access(0);],
908 [
909 AC_MSG_RESULT(yes)
910 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800911 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700912 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100913 ],
914 [
915 AC_MSG_ERROR([*** libwrap missing])
916 ]
917 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800918 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100919 fi
920 ]
921)
922
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100923# Check whether user wants libedit support
924LIBEDIT_MSG="no"
925AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100926 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100927 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100928 if test "x$withval" != "xyes"; then
929 CPPFLAGS="$CPPFLAGS -I$withval/include"
930 LDFLAGS="$LDFLAGS -L$withval/lib"
931 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100932 AC_CHECK_LIB(edit, el_init,
933 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
934 LIBEDIT="-ledit -lcurses"
935 LIBEDIT_MSG="yes"
936 AC_SUBST(LIBEDIT)
937 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100938 [ AC_MSG_ERROR(libedit not found) ],
939 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100940 )
941 fi ]
942)
943
Darren Tuckerd9f88912005-02-20 21:01:48 +1100944AUDIT_MODULE=none
945AC_ARG_WITH(audit,
946 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
947 [
948 AC_MSG_CHECKING(for supported audit module)
949 case "$withval" in
950 bsm)
951 AC_MSG_RESULT(bsm)
952 AUDIT_MODULE=bsm
953 dnl Checks for headers, libs and functions
954 AC_CHECK_HEADERS(bsm/audit.h, [],
955 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
956 AC_CHECK_LIB(bsm, getaudit, [],
957 [AC_MSG_ERROR(BSM enabled and required library not found)])
958 AC_CHECK_FUNCS(getaudit, [],
959 [AC_MSG_ERROR(BSM enabled and required function not found)])
960 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100961 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100962 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
963 ;;
964 debug)
965 AUDIT_MODULE=debug
966 AC_MSG_RESULT(debug)
967 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
968 ;;
969 *)
970 AC_MSG_ERROR([Unknown audit module $withval])
971 ;;
972 esac ]
973)
974
Damien Millerfe1f1432003-02-24 15:45:42 +1100975dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +1000976AC_CHECK_FUNCS( \
977 arc4random \
978 b64_ntop \
979 __b64_ntop \
980 b64_pton \
981 __b64_pton \
982 bcopy \
983 bindresvport_sa \
984 clock \
985 closefrom \
986 dirfd \
987 fchdir \
988 fchmod \
989 fchown \
990 freeaddrinfo \
991 futimes \
992 getaddrinfo \
993 getcwd \
994 getgrouplist \
995 getnameinfo \
996 getopt \
997 getpeereid \
998 _getpty \
999 getrlimit \
1000 getttyent \
1001 glob \
1002 inet_aton \
1003 inet_ntoa \
1004 inet_ntop \
1005 innetgr \
1006 login_getcapbool \
1007 md5_crypt \
1008 memmove \
1009 mkdtemp \
1010 mmap \
1011 ngetaddrinfo \
1012 nsleep \
1013 ogetaddrinfo \
1014 openlog_r \
1015 openpty \
1016 prctl \
1017 pstat \
1018 readpassphrase \
1019 realpath \
1020 recvmsg \
1021 rresvport_af \
1022 sendmsg \
1023 setdtablesize \
1024 setegid \
1025 setenv \
1026 seteuid \
1027 setgroups \
1028 setlogin \
1029 setpcred \
1030 setproctitle \
1031 setregid \
1032 setreuid \
1033 setrlimit \
1034 setsid \
1035 setvbuf \
1036 sigaction \
1037 sigvec \
1038 snprintf \
1039 socketpair \
1040 strdup \
1041 strerror \
1042 strlcat \
1043 strlcpy \
1044 strmode \
1045 strnvis \
1046 strtonum \
1047 strtoul \
1048 sysconf \
1049 tcgetpgrp \
1050 truncate \
1051 unsetenv \
1052 updwtmpx \
1053 utimes \
1054 vhangup \
1055 vsnprintf \
1056 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001057)
Tim Rice13aae5e2001-10-21 17:53:58 -07001058
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001059# IRIX has a const char return value for gai_strerror()
1060AC_CHECK_FUNCS(gai_strerror,[
1061 AC_DEFINE(HAVE_GAI_STRERROR)
1062 AC_TRY_COMPILE([
1063#include <sys/types.h>
1064#include <sys/socket.h>
1065#include <netdb.h>
1066
1067const char *gai_strerror(int);],[
1068char *str;
1069
1070str = gai_strerror(0);],[
1071 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1072 [Define if gai_strerror() returns const char *])])])
1073
Damien Millercd6853c2003-01-28 11:33:42 +11001074AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1075
Darren Tuckerf1159b52003-07-07 19:44:01 +10001076dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +00001077AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +10001078AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001079
Darren Tuckerb2427c82003-09-10 15:22:44 +10001080dnl tcsendbreak might be a macro
1081AC_CHECK_DECL(tcsendbreak,
1082 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001083 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001084 [#include <termios.h>]
1085)
1086
Darren Tucker5bb14002004-04-23 18:53:10 +10001087AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1088
Darren Tucker2a6b0292003-12-31 14:59:17 +11001089AC_CHECK_FUNCS(setresuid, [
1090 dnl Some platorms have setresuid that isn't implemented, test for this
1091 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001092 AC_RUN_IFELSE(
1093 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001094#include <stdlib.h>
1095#include <errno.h>
1096int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001097 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001098 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001099 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001100 AC_MSG_RESULT(not implemented)],
1101 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001102 )
1103])
Darren Tuckere937be32003-12-17 18:53:26 +11001104
Darren Tucker2a6b0292003-12-31 14:59:17 +11001105AC_CHECK_FUNCS(setresgid, [
1106 dnl Some platorms have setresgid that isn't implemented, test for this
1107 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001108 AC_RUN_IFELSE(
1109 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001110#include <stdlib.h>
1111#include <errno.h>
1112int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001113 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001114 [AC_MSG_RESULT(yes)],
1115 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001116 AC_MSG_RESULT(not implemented)],
1117 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001118 )
1119])
Darren Tuckere937be32003-12-17 18:53:26 +11001120
Damien Millerad833b32000-08-23 10:46:23 +10001121dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001122AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001123dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001124AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001125AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001126dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001127AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001128AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001129
Damien Millera8e06ce2003-11-21 23:48:55 +11001130AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001131 [AC_DEFINE(HAVE_DAEMON)],
1132 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1133)
1134
Damien Millera8e06ce2003-11-21 23:48:55 +11001135AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001136 [AC_DEFINE(HAVE_GETPAGESIZE)],
1137 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1138)
1139
Damien Millercb170cb2000-07-01 16:52:55 +10001140# Check for broken snprintf
1141if test "x$ac_cv_func_snprintf" = "xyes" ; then
1142 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001143 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001144 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001145#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001146int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001147 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001148 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001149 [
1150 AC_MSG_RESULT(no)
1151 AC_DEFINE(BROKEN_SNPRINTF)
1152 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001153 ],
1154 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001155 )
1156fi
1157
Damien Millerb4097182004-05-23 14:09:40 +10001158# Check for missing getpeereid (or equiv) support
1159NO_PEERCHECK=""
1160if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1161 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1162 AC_TRY_COMPILE(
1163 [#include <sys/types.h>
1164 #include <sys/socket.h>],
1165 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001166 [ AC_MSG_RESULT(yes)
1167 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1168 ],
Damien Millerb4097182004-05-23 14:09:40 +10001169 [AC_MSG_RESULT(no)
1170 NO_PEERCHECK=1]
1171 )
1172fi
1173
Damien Millere8328192003-01-07 15:18:32 +11001174dnl see whether mkstemp() requires XXXXXX
1175if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1176AC_MSG_CHECKING([for (overly) strict mkstemp])
1177AC_TRY_RUN(
1178 [
1179#include <stdlib.h>
1180main() { char template[]="conftest.mkstemp-test";
1181if (mkstemp(template) == -1)
1182 exit(1);
1183unlink(template); exit(0);
1184}
1185 ],
1186 [
1187 AC_MSG_RESULT(no)
1188 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001189 [
Damien Millere8328192003-01-07 15:18:32 +11001190 AC_MSG_RESULT(yes)
1191 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1192 ],
1193 [
1194 AC_MSG_RESULT(yes)
1195 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001196 ]
Damien Millere8328192003-01-07 15:18:32 +11001197)
1198fi
1199
Darren Tucker70a3d552003-08-21 17:58:29 +10001200dnl make sure that openpty does not reacquire controlling terminal
1201if test ! -z "$check_for_openpty_ctty_bug"; then
1202 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1203 AC_TRY_RUN(
1204 [
1205#include <stdio.h>
1206#include <sys/fcntl.h>
1207#include <sys/types.h>
1208#include <sys/wait.h>
1209
1210int
1211main()
1212{
1213 pid_t pid;
1214 int fd, ptyfd, ttyfd, status;
1215
1216 pid = fork();
1217 if (pid < 0) { /* failed */
1218 exit(1);
1219 } else if (pid > 0) { /* parent */
1220 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001221 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001222 exit(WEXITSTATUS(status));
1223 else
1224 exit(2);
1225 } else { /* child */
1226 close(0); close(1); close(2);
1227 setsid();
1228 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1229 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1230 if (fd >= 0)
1231 exit(3); /* Acquired ctty: broken */
1232 else
1233 exit(0); /* Did not acquire ctty: OK */
1234 }
1235}
1236 ],
1237 [
1238 AC_MSG_RESULT(yes)
1239 ],
1240 [
1241 AC_MSG_RESULT(no)
1242 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1243 ]
1244 )
1245fi
1246
Tim Rice8bb561b2005-03-17 16:23:19 -08001247if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1248 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001249 AC_MSG_CHECKING(if getaddrinfo seems to work)
1250 AC_TRY_RUN(
1251 [
1252#include <stdio.h>
1253#include <sys/socket.h>
1254#include <netdb.h>
1255#include <errno.h>
1256#include <netinet/in.h>
1257
1258#define TEST_PORT "2222"
1259
1260int
1261main(void)
1262{
1263 int err, sock;
1264 struct addrinfo *gai_ai, *ai, hints;
1265 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1266
1267 memset(&hints, 0, sizeof(hints));
1268 hints.ai_family = PF_UNSPEC;
1269 hints.ai_socktype = SOCK_STREAM;
1270 hints.ai_flags = AI_PASSIVE;
1271
1272 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1273 if (err != 0) {
1274 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1275 exit(1);
1276 }
1277
1278 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1279 if (ai->ai_family != AF_INET6)
1280 continue;
1281
1282 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1283 sizeof(ntop), strport, sizeof(strport),
1284 NI_NUMERICHOST|NI_NUMERICSERV);
1285
1286 if (err != 0) {
1287 if (err == EAI_SYSTEM)
1288 perror("getnameinfo EAI_SYSTEM");
1289 else
1290 fprintf(stderr, "getnameinfo failed: %s\n",
1291 gai_strerror(err));
1292 exit(2);
1293 }
1294
1295 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1296 if (sock < 0)
1297 perror("socket");
1298 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1299 if (errno == EBADF)
1300 exit(3);
1301 }
1302 }
1303 exit(0);
1304}
1305 ],
1306 [
1307 AC_MSG_RESULT(yes)
1308 ],
1309 [
1310 AC_MSG_RESULT(no)
1311 AC_DEFINE(BROKEN_GETADDRINFO)
1312 ]
1313 )
1314fi
1315
Tim Rice8bb561b2005-03-17 16:23:19 -08001316if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1317 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001318 AC_MSG_CHECKING(if getaddrinfo seems to work)
1319 AC_TRY_RUN(
1320 [
1321#include <stdio.h>
1322#include <sys/socket.h>
1323#include <netdb.h>
1324#include <errno.h>
1325#include <netinet/in.h>
1326
1327#define TEST_PORT "2222"
1328
1329int
1330main(void)
1331{
1332 int err, sock;
1333 struct addrinfo *gai_ai, *ai, hints;
1334 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1335
1336 memset(&hints, 0, sizeof(hints));
1337 hints.ai_family = PF_UNSPEC;
1338 hints.ai_socktype = SOCK_STREAM;
1339 hints.ai_flags = AI_PASSIVE;
1340
1341 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1342 if (err != 0) {
1343 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1344 exit(1);
1345 }
1346
1347 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1348 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1349 continue;
1350
1351 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1352 sizeof(ntop), strport, sizeof(strport),
1353 NI_NUMERICHOST|NI_NUMERICSERV);
1354
1355 if (ai->ai_family == AF_INET && err != 0) {
1356 perror("getnameinfo");
1357 exit(2);
1358 }
1359 }
1360 exit(0);
1361}
1362 ],
1363 [
1364 AC_MSG_RESULT(yes)
1365 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1366[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1367 ],
1368 [
1369 AC_MSG_RESULT(no)
1370 AC_DEFINE(BROKEN_GETADDRINFO)
1371 ]
1372 )
1373fi
1374
Darren Tuckera56f1912004-11-02 20:30:54 +11001375if test "x$check_for_conflicting_getspnam" = "x1"; then
1376 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1377 AC_COMPILE_IFELSE(
1378 [
1379#include <shadow.h>
1380int main(void) {exit(0);}
1381 ],
1382 [
1383 AC_MSG_RESULT(no)
1384 ],
1385 [
1386 AC_MSG_RESULT(yes)
1387 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1388 [Conflicting defs for getspnam])
1389 ]
1390 )
1391fi
1392
Damien Miller606f8802000-09-16 15:39:56 +11001393AC_FUNC_GETPGRP
1394
Damien Millera64b57a2001-01-17 10:44:13 +11001395# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001396PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001397AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001398 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001399 [
Damien Millera64b57a2001-01-17 10:44:13 +11001400 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001401 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1402 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001403 AC_MSG_ERROR([PAM headers not found])
1404 fi
1405
1406 AC_CHECK_LIB(dl, dlopen, , )
1407 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1408 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001409 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001410
Damien Millera64b57a2001-01-17 10:44:13 +11001411 PAM_MSG="yes"
1412
1413 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001414 if test $ac_cv_lib_dl_dlopen = yes; then
1415 LIBPAM="-lpam -ldl"
1416 else
1417 LIBPAM="-lpam"
1418 fi
1419 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001420 fi
1421 ]
1422)
Damien Millera22ba012000-03-02 23:09:20 +11001423
Damien Millera64b57a2001-01-17 10:44:13 +11001424# Check for older PAM
1425if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001426 # Check PAM strerror arguments (old PAM)
1427 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1428 AC_TRY_COMPILE(
1429 [
Damien Miller81171112000-04-23 11:14:01 +10001430#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001431#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001432#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001433#elif defined (HAVE_PAM_PAM_APPL_H)
1434#include <pam/pam_appl.h>
1435#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001436 ],
1437 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001438 [AC_MSG_RESULT(no)],
1439 [
1440 AC_DEFINE(HAVE_OLD_PAM)
1441 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001442 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001443 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001444 )
Damien Millera22ba012000-03-02 23:09:20 +11001445fi
1446
Tim Riceaef73712002-05-11 13:17:42 -07001447# Search for OpenSSL
1448saved_CPPFLAGS="$CPPFLAGS"
1449saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001450AC_ARG_WITH(ssl-dir,
1451 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1452 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001453 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001454 case "$withval" in
1455 # Relative paths
1456 ./*|../*) withval="`pwd`/$withval"
1457 esac
Tim Riceaef73712002-05-11 13:17:42 -07001458 if test -d "$withval/lib"; then
1459 if test -n "${need_dash_r}"; then
1460 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1461 else
1462 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1463 fi
1464 else
1465 if test -n "${need_dash_r}"; then
1466 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1467 else
1468 LDFLAGS="-L${withval} ${LDFLAGS}"
1469 fi
1470 fi
1471 if test -d "$withval/include"; then
1472 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1473 else
1474 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1475 fi
Damien Millera22ba012000-03-02 23:09:20 +11001476 fi
1477 ]
1478)
Tim Rice3d5352e2004-02-12 09:27:21 -08001479LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001480AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001481 [
Tim Riceaef73712002-05-11 13:17:42 -07001482 dnl Check default openssl install dir
1483 if test -n "${need_dash_r}"; then
1484 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001485 else
Tim Riceaef73712002-05-11 13:17:42 -07001486 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001487 fi
Tim Riceaef73712002-05-11 13:17:42 -07001488 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1489 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1490 [
1491 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1492 ]
1493 )
1494 ]
1495)
1496
Tim Riced730b782002-08-13 18:52:10 -07001497# Determine OpenSSL header version
1498AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001499AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001500 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001501#include <stdio.h>
1502#include <string.h>
1503#include <openssl/opensslv.h>
1504#define DATA "conftest.sslincver"
1505int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001506 FILE *fd;
1507 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001508
Damien Millera8e06ce2003-11-21 23:48:55 +11001509 fd = fopen(DATA,"w");
1510 if(fd == NULL)
1511 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001512
1513 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1514 exit(1);
1515
1516 exit(0);
1517}
Darren Tucker623d92f2004-09-12 22:36:15 +10001518 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001519 [
1520 ssl_header_ver=`cat conftest.sslincver`
1521 AC_MSG_RESULT($ssl_header_ver)
1522 ],
1523 [
1524 AC_MSG_RESULT(not found)
1525 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001526 ],
1527 [
1528 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001529 ]
1530)
1531
1532# Determine OpenSSL library version
1533AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001534AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001535 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001536#include <stdio.h>
1537#include <string.h>
1538#include <openssl/opensslv.h>
1539#include <openssl/crypto.h>
1540#define DATA "conftest.ssllibver"
1541int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001542 FILE *fd;
1543 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001544
Damien Millera8e06ce2003-11-21 23:48:55 +11001545 fd = fopen(DATA,"w");
1546 if(fd == NULL)
1547 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001548
1549 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1550 exit(1);
1551
1552 exit(0);
1553}
Darren Tucker623d92f2004-09-12 22:36:15 +10001554 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001555 [
1556 ssl_library_ver=`cat conftest.ssllibver`
1557 AC_MSG_RESULT($ssl_library_ver)
1558 ],
1559 [
1560 AC_MSG_RESULT(not found)
1561 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001562 ],
1563 [
1564 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001565 ]
1566)
Damien Millera22ba012000-03-02 23:09:20 +11001567
Damien Millerec932372002-01-22 22:16:03 +11001568# Sanity check OpenSSL headers
1569AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001570AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001571 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001572#include <string.h>
1573#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001574int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001575 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001576 [
1577 AC_MSG_RESULT(yes)
1578 ],
1579 [
1580 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001581 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1582Check config.log for details.
1583Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001584 ],
1585 [
1586 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001587 ]
1588)
1589
Tim Rice3d5352e2004-02-12 09:27:21 -08001590# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1591# because the system crypt() is more featureful.
1592if test "x$check_for_libcrypt_before" = "x1"; then
1593 AC_CHECK_LIB(crypt, crypt)
1594fi
1595
Damien Millera8e06ce2003-11-21 23:48:55 +11001596# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001597# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001598if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001599 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001600fi
1601
Damien Miller6c21c512002-01-22 21:57:53 +11001602
1603### Configure cryptographic random number support
1604
1605# Check wheter OpenSSL seeds itself
1606AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001607AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001608 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001609#include <string.h>
1610#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001611int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001612 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001613 [
1614 OPENSSL_SEEDS_ITSELF=yes
1615 AC_MSG_RESULT(yes)
1616 ],
1617 [
1618 AC_MSG_RESULT(no)
1619 # Default to use of the rand helper if OpenSSL doesn't
1620 # seed itself
1621 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001622 ],
1623 [
1624 AC_MSG_WARN([cross compiling: assuming yes])
1625 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001626 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001627 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001628 ]
1629)
1630
1631
1632# Do we want to force the use of the rand helper?
1633AC_ARG_WITH(rand-helper,
1634 [ --with-rand-helper Use subprocess to gather strong randomness ],
1635 [
1636 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001637 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001638 # the previous test showed it to be unseeded.
1639 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1640 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1641 OPENSSL_SEEDS_ITSELF=yes
1642 USE_RAND_HELPER=""
1643 fi
1644 else
1645 USE_RAND_HELPER=yes
1646 fi
1647 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001648)
Damien Miller6c21c512002-01-22 21:57:53 +11001649
1650# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001651if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001652 # OpenSSL only
1653 AC_DEFINE(OPENSSL_PRNG_ONLY)
1654 RAND_MSG="OpenSSL internal ONLY"
1655 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001656elif test ! -z "$USE_RAND_HELPER" ; then
1657 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001658 RAND_MSG="ssh-rand-helper"
1659 INSTALL_SSH_RAND_HELPER="yes"
1660fi
1661AC_SUBST(INSTALL_SSH_RAND_HELPER)
1662
1663### Configuration of ssh-rand-helper
1664
1665# PRNGD TCP socket
1666AC_ARG_WITH(prngd-port,
1667 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1668 [
Damien Millere996d722002-01-23 11:20:59 +11001669 case "$withval" in
1670 no)
1671 withval=""
1672 ;;
1673 [[0-9]]*)
1674 ;;
1675 *)
1676 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1677 ;;
1678 esac
1679 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001680 PRNGD_PORT="$withval"
1681 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1682 fi
1683 ]
1684)
1685
1686# PRNGD Unix domain socket
1687AC_ARG_WITH(prngd-socket,
1688 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1689 [
Damien Millere996d722002-01-23 11:20:59 +11001690 case "$withval" in
1691 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001692 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001693 ;;
1694 no)
1695 withval=""
1696 ;;
1697 /*)
1698 ;;
1699 *)
1700 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1701 ;;
1702 esac
1703
1704 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001705 if test ! -z "$PRNGD_PORT" ; then
1706 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1707 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001708 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001709 AC_MSG_WARN(Entropy socket is not readable)
1710 fi
1711 PRNGD_SOCKET="$withval"
1712 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1713 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001714 ],
1715 [
1716 # Check for existing socket only if we don't have a random device already
1717 if test "$USE_RAND_HELPER" = yes ; then
1718 AC_MSG_CHECKING(for PRNGD/EGD socket)
1719 # Insert other locations here
1720 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1721 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1722 PRNGD_SOCKET="$sock"
1723 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1724 break;
1725 fi
1726 done
1727 if test ! -z "$PRNGD_SOCKET" ; then
1728 AC_MSG_RESULT($PRNGD_SOCKET)
1729 else
1730 AC_MSG_RESULT(not found)
1731 fi
1732 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001733 ]
1734)
1735
1736# Change default command timeout for hashing entropy source
1737entropy_timeout=200
1738AC_ARG_WITH(entropy-timeout,
1739 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1740 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001741 if test -n "$withval" && test "x$withval" != "xno" && \
1742 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001743 entropy_timeout=$withval
1744 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001745 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001746)
Damien Miller6c21c512002-01-22 21:57:53 +11001747AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1748
Damien Millerd3f6ad22002-06-25 10:24:47 +10001749SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001750AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001751 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001752 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001753 if test -n "$withval" && test "x$withval" != "xno" && \
1754 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001755 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001756 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001757 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001758)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001759AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1760AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001761
Tim Rice88f2ab52002-03-17 12:17:34 -08001762# We do this little dance with the search path to insure
1763# that programs that we select for use by installed programs
1764# (which may be run by the super-user) come from trusted
1765# locations before they come from the user's private area.
1766# This should help avoid accidentally configuring some
1767# random version of a program in someone's personal bin.
1768
1769OPATH=$PATH
1770PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001771test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001772test -d /sbin && PATH=$PATH:/sbin
1773test -d /usr/sbin && PATH=$PATH:/usr/sbin
1774PATH=$PATH:/etc:$OPATH
1775
Damien Millera8e06ce2003-11-21 23:48:55 +11001776# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001777OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1778OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1779OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1780OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1781OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1782OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1783OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1784OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1785OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1786OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1787OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1788OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1789OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1790OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1791OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1792OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001793# restore PATH
1794PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001795
1796# Where does ssh-rand-helper get its randomness from?
1797INSTALL_SSH_PRNG_CMDS=""
1798if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1799 if test ! -z "$PRNGD_PORT" ; then
1800 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1801 elif test ! -z "$PRNGD_SOCKET" ; then
1802 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1803 else
1804 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1805 RAND_HELPER_CMDHASH=yes
1806 INSTALL_SSH_PRNG_CMDS="yes"
1807 fi
1808fi
1809AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1810
1811
Ben Lindstromb5628642000-10-18 00:02:25 +00001812# Cheap hack to ensure NEWS-OS libraries are arranged right.
1813if test ! -z "$SONY" ; then
1814 LIBS="$LIBS -liberty";
1815fi
1816
Damien Millera22ba012000-03-02 23:09:20 +11001817# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001818AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001819AC_CHECK_SIZEOF(short int, 2)
1820AC_CHECK_SIZEOF(int, 4)
1821AC_CHECK_SIZEOF(long int, 4)
1822AC_CHECK_SIZEOF(long long int, 8)
1823
Damien Millerfa2bb692002-04-23 23:22:25 +10001824# Sanity check long long for some platforms (AIX)
1825if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1826 ac_cv_sizeof_long_long_int=0
1827fi
1828
Damien Millera22ba012000-03-02 23:09:20 +11001829# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001830AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1831 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001832 [ #include <sys/types.h> ],
1833 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001834 [ ac_cv_have_u_int="yes" ],
1835 [ ac_cv_have_u_int="no" ]
1836 )
1837])
1838if test "x$ac_cv_have_u_int" = "xyes" ; then
1839 AC_DEFINE(HAVE_U_INT)
1840 have_u_int=1
1841fi
1842
Damien Miller61e50f12000-05-08 20:49:37 +10001843AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1844 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001845 [ #include <sys/types.h> ],
1846 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001847 [ ac_cv_have_intxx_t="yes" ],
1848 [ ac_cv_have_intxx_t="no" ]
1849 )
1850])
1851if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1852 AC_DEFINE(HAVE_INTXX_T)
1853 have_intxx_t=1
1854fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001855
1856if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001857 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001858then
1859 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1860 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001861 [ #include <stdint.h> ],
1862 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001863 [
1864 AC_DEFINE(HAVE_INTXX_T)
1865 AC_MSG_RESULT(yes)
1866 ],
1867 [ AC_MSG_RESULT(no) ]
1868 )
1869fi
1870
Damien Miller578783e2000-09-23 14:12:24 +11001871AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1872 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001873 [
1874#include <sys/types.h>
1875#ifdef HAVE_STDINT_H
1876# include <stdint.h>
1877#endif
1878#include <sys/socket.h>
1879#ifdef HAVE_SYS_BITYPES_H
1880# include <sys/bitypes.h>
1881#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001882 ],
1883 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001884 [ ac_cv_have_int64_t="yes" ],
1885 [ ac_cv_have_int64_t="no" ]
1886 )
1887])
1888if test "x$ac_cv_have_int64_t" = "xyes" ; then
1889 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001890fi
1891
Damien Miller61e50f12000-05-08 20:49:37 +10001892AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1893 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001894 [ #include <sys/types.h> ],
1895 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001896 [ ac_cv_have_u_intxx_t="yes" ],
1897 [ ac_cv_have_u_intxx_t="no" ]
1898 )
1899])
1900if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1901 AC_DEFINE(HAVE_U_INTXX_T)
1902 have_u_intxx_t=1
1903fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001904
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001905if test -z "$have_u_intxx_t" ; then
1906 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1907 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001908 [ #include <sys/socket.h> ],
1909 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001910 [
1911 AC_DEFINE(HAVE_U_INTXX_T)
1912 AC_MSG_RESULT(yes)
1913 ],
1914 [ AC_MSG_RESULT(no) ]
1915 )
1916fi
1917
Damien Miller578783e2000-09-23 14:12:24 +11001918AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1919 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001920 [ #include <sys/types.h> ],
1921 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001922 [ ac_cv_have_u_int64_t="yes" ],
1923 [ ac_cv_have_u_int64_t="no" ]
1924 )
1925])
1926if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1927 AC_DEFINE(HAVE_U_INT64_T)
1928 have_u_int64_t=1
1929fi
1930
Tim Rice4cec93f2002-02-26 08:40:48 -08001931if test -z "$have_u_int64_t" ; then
1932 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1933 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001934 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001935 [ u_int64_t a; a = 1],
1936 [
1937 AC_DEFINE(HAVE_U_INT64_T)
1938 AC_MSG_RESULT(yes)
1939 ],
1940 [ AC_MSG_RESULT(no) ]
1941 )
1942fi
1943
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001944if test -z "$have_u_intxx_t" ; then
1945 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1946 AC_TRY_COMPILE(
1947 [
1948#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001949 ],
1950 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001951 [ ac_cv_have_uintxx_t="yes" ],
1952 [ ac_cv_have_uintxx_t="no" ]
1953 )
1954 ])
1955 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1956 AC_DEFINE(HAVE_UINTXX_T)
1957 fi
1958fi
1959
1960if test -z "$have_uintxx_t" ; then
1961 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1962 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001963 [ #include <stdint.h> ],
1964 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001965 [
1966 AC_DEFINE(HAVE_UINTXX_T)
1967 AC_MSG_RESULT(yes)
1968 ],
1969 [ AC_MSG_RESULT(no) ]
1970 )
1971fi
1972
Damien Milleredb82922000-06-20 13:25:52 +10001973if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001974 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001975then
1976 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1977 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001978 [
1979#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001980 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001981 [
Damien Miller70494d12000-04-03 15:57:06 +10001982 int8_t a; int16_t b; int32_t c;
1983 u_int8_t e; u_int16_t f; u_int32_t g;
1984 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001985 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001986 [
1987 AC_DEFINE(HAVE_U_INTXX_T)
1988 AC_DEFINE(HAVE_INTXX_T)
1989 AC_MSG_RESULT(yes)
1990 ],
1991 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001992 )
Damien Millerb29ea912000-01-15 14:12:03 +11001993fi
1994
Damien Miller58be7382001-09-15 21:31:54 +10001995
1996AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1997 AC_TRY_COMPILE(
1998 [
1999#include <sys/types.h>
2000 ],
2001 [ u_char foo; foo = 125; ],
2002 [ ac_cv_have_u_char="yes" ],
2003 [ ac_cv_have_u_char="no" ]
2004 )
2005])
2006if test "x$ac_cv_have_u_char" = "xyes" ; then
2007 AC_DEFINE(HAVE_U_CHAR)
2008fi
2009
Tim Rice13aae5e2001-10-21 17:53:58 -07002010TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002011
Tim Rice200a5c02002-02-26 22:12:34 -08002012AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002013
Damien Miller848b9932005-02-24 12:12:34 +11002014AC_CHECK_TYPES(in_addr_t,,,
2015[#include <sys/types.h>
2016#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002017
Damien Miller61e50f12000-05-08 20:49:37 +10002018AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2019 AC_TRY_COMPILE(
2020 [
2021#include <sys/types.h>
2022 ],
2023 [ size_t foo; foo = 1235; ],
2024 [ ac_cv_have_size_t="yes" ],
2025 [ ac_cv_have_size_t="no" ]
2026 )
2027])
2028if test "x$ac_cv_have_size_t" = "xyes" ; then
2029 AC_DEFINE(HAVE_SIZE_T)
2030fi
Damien Miller95058511999-12-29 10:36:45 +11002031
Damien Miller615f9392000-05-17 22:53:33 +10002032AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2033 AC_TRY_COMPILE(
2034 [
2035#include <sys/types.h>
2036 ],
2037 [ ssize_t foo; foo = 1235; ],
2038 [ ac_cv_have_ssize_t="yes" ],
2039 [ ac_cv_have_ssize_t="no" ]
2040 )
2041])
2042if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2043 AC_DEFINE(HAVE_SSIZE_T)
2044fi
2045
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002046AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2047 AC_TRY_COMPILE(
2048 [
2049#include <time.h>
2050 ],
2051 [ clock_t foo; foo = 1235; ],
2052 [ ac_cv_have_clock_t="yes" ],
2053 [ ac_cv_have_clock_t="no" ]
2054 )
2055])
2056if test "x$ac_cv_have_clock_t" = "xyes" ; then
2057 AC_DEFINE(HAVE_CLOCK_T)
2058fi
2059
Damien Millerb54b40e2000-06-23 08:23:34 +10002060AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2061 AC_TRY_COMPILE(
2062 [
2063#include <sys/types.h>
2064#include <sys/socket.h>
2065 ],
2066 [ sa_family_t foo; foo = 1235; ],
2067 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002068 [ AC_TRY_COMPILE(
2069 [
2070#include <sys/types.h>
2071#include <sys/socket.h>
2072#include <netinet/in.h>
2073 ],
2074 [ sa_family_t foo; foo = 1235; ],
2075 [ ac_cv_have_sa_family_t="yes" ],
2076
Damien Millerb54b40e2000-06-23 08:23:34 +10002077 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002078 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002079 )
2080])
2081if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2082 AC_DEFINE(HAVE_SA_FAMILY_T)
2083fi
2084
Damien Miller0f91b4e2000-06-18 15:43:25 +10002085AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2086 AC_TRY_COMPILE(
2087 [
2088#include <sys/types.h>
2089 ],
2090 [ pid_t foo; foo = 1235; ],
2091 [ ac_cv_have_pid_t="yes" ],
2092 [ ac_cv_have_pid_t="no" ]
2093 )
2094])
2095if test "x$ac_cv_have_pid_t" = "xyes" ; then
2096 AC_DEFINE(HAVE_PID_T)
2097fi
2098
2099AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2100 AC_TRY_COMPILE(
2101 [
2102#include <sys/types.h>
2103 ],
2104 [ mode_t foo; foo = 1235; ],
2105 [ ac_cv_have_mode_t="yes" ],
2106 [ ac_cv_have_mode_t="no" ]
2107 )
2108])
2109if test "x$ac_cv_have_mode_t" = "xyes" ; then
2110 AC_DEFINE(HAVE_MODE_T)
2111fi
2112
Damien Miller61e50f12000-05-08 20:49:37 +10002113
2114AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2115 AC_TRY_COMPILE(
2116 [
Damien Miller81171112000-04-23 11:14:01 +10002117#include <sys/types.h>
2118#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002119 ],
2120 [ struct sockaddr_storage s; ],
2121 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2122 [ ac_cv_have_struct_sockaddr_storage="no" ]
2123 )
2124])
2125if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2126 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2127fi
Damien Miller34132e52000-01-14 15:45:46 +11002128
Damien Miller61e50f12000-05-08 20:49:37 +10002129AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2130 AC_TRY_COMPILE(
2131 [
Damien Miller7b22d652000-06-18 14:07:04 +10002132#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002133#include <netinet/in.h>
2134 ],
2135 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2136 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2137 [ ac_cv_have_struct_sockaddr_in6="no" ]
2138 )
2139])
2140if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2141 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2142fi
Damien Miller34132e52000-01-14 15:45:46 +11002143
Damien Miller61e50f12000-05-08 20:49:37 +10002144AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2145 AC_TRY_COMPILE(
2146 [
Damien Miller7b22d652000-06-18 14:07:04 +10002147#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002148#include <netinet/in.h>
2149 ],
2150 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2151 [ ac_cv_have_struct_in6_addr="yes" ],
2152 [ ac_cv_have_struct_in6_addr="no" ]
2153 )
2154])
2155if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2156 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2157fi
Damien Miller34132e52000-01-14 15:45:46 +11002158
Damien Miller61e50f12000-05-08 20:49:37 +10002159AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2160 AC_TRY_COMPILE(
2161 [
Damien Miller81171112000-04-23 11:14:01 +10002162#include <sys/types.h>
2163#include <sys/socket.h>
2164#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002165 ],
2166 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2167 [ ac_cv_have_struct_addrinfo="yes" ],
2168 [ ac_cv_have_struct_addrinfo="no" ]
2169 )
2170])
2171if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2172 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2173fi
2174
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002175AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2176 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002177 [ #include <sys/time.h> ],
2178 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002179 [ ac_cv_have_struct_timeval="yes" ],
2180 [ ac_cv_have_struct_timeval="no" ]
2181 )
2182])
2183if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2184 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2185 have_struct_timeval=1
2186fi
2187
Tim Rice4e4dc562003-03-18 10:21:40 -08002188AC_CHECK_TYPES(struct timespec)
2189
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002190# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002191if test "x$ac_cv_have_int64_t" = "xno" && \
2192 test "x$ac_cv_sizeof_long_int" != "x8" && \
2193 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002194 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2195 echo "an alternative compiler (I.E., GCC) before continuing."
2196 echo ""
2197 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002198else
2199dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002200 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002201 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002202#include <stdio.h>
2203#include <string.h>
2204#ifdef HAVE_SNPRINTF
2205main()
2206{
2207 char buf[50];
2208 char expected_out[50];
2209 int mazsize = 50 ;
2210#if (SIZEOF_LONG_INT == 8)
2211 long int num = 0x7fffffffffffffff;
2212#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002213 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002214#endif
2215 strcpy(expected_out, "9223372036854775807");
2216 snprintf(buf, mazsize, "%lld", num);
2217 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002218 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002219 exit(0);
2220}
2221#else
2222main() { exit(0); }
2223#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002224 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002225 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002226 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002227fi
2228
Damien Miller78315eb2000-09-29 23:01:36 +11002229dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002230OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2231OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2232OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2233OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2234OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002235OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002236OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2237OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002238OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002239OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2240OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2241OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2242OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002243OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2244OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2245OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2246OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002247
2248AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002249
Damien Miller61e50f12000-05-08 20:49:37 +10002250AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2251 ac_cv_have_ss_family_in_struct_ss, [
2252 AC_TRY_COMPILE(
2253 [
Damien Miller81171112000-04-23 11:14:01 +10002254#include <sys/types.h>
2255#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002256 ],
2257 [ struct sockaddr_storage s; s.ss_family = 1; ],
2258 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2259 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2260 )
2261])
2262if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2263 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2264fi
2265
Damien Miller61e50f12000-05-08 20:49:37 +10002266AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2267 ac_cv_have___ss_family_in_struct_ss, [
2268 AC_TRY_COMPILE(
2269 [
Damien Miller81171112000-04-23 11:14:01 +10002270#include <sys/types.h>
2271#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002272 ],
2273 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2274 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2275 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2276 )
2277])
2278if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2279 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2280fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002281
Damien Millerad833b32000-08-23 10:46:23 +10002282AC_CACHE_CHECK([for pw_class field in struct passwd],
2283 ac_cv_have_pw_class_in_struct_passwd, [
2284 AC_TRY_COMPILE(
2285 [
Damien Millerad833b32000-08-23 10:46:23 +10002286#include <pwd.h>
2287 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002288 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002289 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2290 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2291 )
2292])
2293if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2294 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2295fi
2296
Kevin Steves82456952001-06-22 21:14:18 +00002297AC_CACHE_CHECK([for pw_expire field in struct passwd],
2298 ac_cv_have_pw_expire_in_struct_passwd, [
2299 AC_TRY_COMPILE(
2300 [
2301#include <pwd.h>
2302 ],
2303 [ struct passwd p; p.pw_expire = 0; ],
2304 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2305 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2306 )
2307])
2308if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2309 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2310fi
2311
2312AC_CACHE_CHECK([for pw_change field in struct passwd],
2313 ac_cv_have_pw_change_in_struct_passwd, [
2314 AC_TRY_COMPILE(
2315 [
2316#include <pwd.h>
2317 ],
2318 [ struct passwd p; p.pw_change = 0; ],
2319 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2320 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2321 )
2322])
2323if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2324 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2325fi
Damien Miller61e50f12000-05-08 20:49:37 +10002326
Tim Rice28bbb0c2002-05-27 17:37:32 -07002327dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002328AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2329 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002330 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002331 [
Tim Riceae49fe62002-04-12 10:26:21 -07002332#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002333#include <sys/socket.h>
2334#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002335int main() {
2336#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002337#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002338exit(1);
2339#endif
2340struct msghdr m;
2341m.msg_accrights = 0;
2342exit(0);
2343}
Kevin Steves939c9db2002-03-22 17:23:25 +00002344 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002345 [ ac_cv_have_accrights_in_msghdr="yes" ],
2346 [ ac_cv_have_accrights_in_msghdr="no" ]
2347 )
2348])
2349if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2350 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2351fi
2352
Kevin Stevesa44e0352002-04-07 16:18:03 +00002353AC_CACHE_CHECK([for msg_control field in struct msghdr],
2354 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002355 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002356 [
Tim Riceae49fe62002-04-12 10:26:21 -07002357#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002358#include <sys/socket.h>
2359#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002360int main() {
2361#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002362#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002363exit(1);
2364#endif
2365struct msghdr m;
2366m.msg_control = 0;
2367exit(0);
2368}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002369 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002370 [ ac_cv_have_control_in_msghdr="yes" ],
2371 [ ac_cv_have_control_in_msghdr="no" ]
2372 )
2373])
2374if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2375 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2376fi
2377
Damien Miller61e50f12000-05-08 20:49:37 +10002378AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002379 AC_TRY_LINK([],
2380 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002381 [ ac_cv_libc_defines___progname="yes" ],
2382 [ ac_cv_libc_defines___progname="no" ]
2383 )
2384])
2385if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2386 AC_DEFINE(HAVE___PROGNAME)
2387fi
2388
Kevin Steves4846f4a2002-03-22 18:19:53 +00002389AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2390 AC_TRY_LINK([
2391#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002392],
2393 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002394 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2395 [ ac_cv_cc_implements___FUNCTION__="no" ]
2396 )
2397])
2398if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2399 AC_DEFINE(HAVE___FUNCTION__)
2400fi
2401
2402AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2403 AC_TRY_LINK([
2404#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002405],
2406 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002407 [ ac_cv_cc_implements___func__="yes" ],
2408 [ ac_cv_cc_implements___func__="no" ]
2409 )
2410])
2411if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2412 AC_DEFINE(HAVE___func__)
2413fi
2414
Damien Miller4f8e6692001-07-14 13:22:53 +10002415AC_CACHE_CHECK([whether getopt has optreset support],
2416 ac_cv_have_getopt_optreset, [
2417 AC_TRY_LINK(
2418 [
2419#include <getopt.h>
2420 ],
2421 [ extern int optreset; optreset = 0; ],
2422 [ ac_cv_have_getopt_optreset="yes" ],
2423 [ ac_cv_have_getopt_optreset="no" ]
2424 )
2425])
2426if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2427 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2428fi
Damien Millera22ba012000-03-02 23:09:20 +11002429
Damien Millerecbb26d2000-07-15 14:59:14 +10002430AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002431 AC_TRY_LINK([],
2432 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002433 [ ac_cv_libc_defines_sys_errlist="yes" ],
2434 [ ac_cv_libc_defines_sys_errlist="no" ]
2435 )
2436])
2437if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2438 AC_DEFINE(HAVE_SYS_ERRLIST)
2439fi
2440
2441
Damien Miller11fa2cc2000-08-16 10:35:58 +10002442AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002443 AC_TRY_LINK([],
2444 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002445 [ ac_cv_libc_defines_sys_nerr="yes" ],
2446 [ ac_cv_libc_defines_sys_nerr="no" ]
2447 )
2448])
2449if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2450 AC_DEFINE(HAVE_SYS_NERR)
2451fi
2452
Damien Millera8e06ce2003-11-21 23:48:55 +11002453SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002454# Check whether user wants sectok support
2455AC_ARG_WITH(sectok,
2456 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002457 [
2458 if test "x$withval" != "xno" ; then
2459 if test "x$withval" != "xyes" ; then
2460 CPPFLAGS="$CPPFLAGS -I${withval}"
2461 LDFLAGS="$LDFLAGS -L${withval}"
2462 if test ! -z "$need_dash_r" ; then
2463 LDFLAGS="$LDFLAGS -R${withval}"
2464 fi
2465 if test ! -z "$blibpath" ; then
2466 blibpath="$blibpath:${withval}"
2467 fi
2468 fi
2469 AC_CHECK_HEADERS(sectok.h)
2470 if test "$ac_cv_header_sectok_h" != yes; then
2471 AC_MSG_ERROR(Can't find sectok.h)
2472 fi
2473 AC_CHECK_LIB(sectok, sectok_open)
2474 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2475 AC_MSG_ERROR(Can't find libsectok)
2476 fi
2477 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002478 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002479 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002480 fi
2481 ]
2482)
2483
2484# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002485OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002486AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002487 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2488 [
2489 if test "x$withval" != "xno" ; then
2490 if test "x$withval" != "xyes" ; then
2491 OPENSC_CONFIG=$withval/bin/opensc-config
2492 else
2493 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2494 fi
2495 if test "$OPENSC_CONFIG" != "no"; then
2496 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2497 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2498 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2499 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2500 AC_DEFINE(SMARTCARD)
2501 AC_DEFINE(USE_OPENSC)
2502 SCARD_MSG="yes, using OpenSC"
2503 fi
2504 fi
2505 ]
2506)
Damien Miller85de5802001-09-18 14:01:11 +10002507
Darren Tucker5f88d342003-10-15 16:57:57 +10002508# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002509AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002510 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002511 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002512 # Needed by our getrrsetbyname()
2513 AC_SEARCH_LIBS(res_query, resolv)
2514 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002515 AC_MSG_CHECKING(if res_query will link)
2516 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2517 [AC_MSG_RESULT(no)
2518 saved_LIBS="$LIBS"
2519 LIBS="$LIBS -lresolv"
2520 AC_MSG_CHECKING(for res_query in -lresolv)
2521 AC_LINK_IFELSE([
2522#include <resolv.h>
2523int main()
2524{
2525 res_query (0, 0, 0, 0, 0);
2526 return 0;
2527}
2528 ],
2529 [LIBS="$LIBS -lresolv"
2530 AC_MSG_RESULT(yes)],
2531 [LIBS="$saved_LIBS"
2532 AC_MSG_RESULT(no)])
2533 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002534 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tucker84ce9b42005-05-26 20:12:15 +10002535 AC_CHECK_DECLS([_getshort, _getlong])
Darren Tucker5f88d342003-10-15 16:57:57 +10002536 AC_CHECK_MEMBER(HEADER.ad,
2537 [AC_DEFINE(HAVE_HEADER_AD)],,
2538 [#include <arpa/nameser.h>])
2539 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002540
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002541# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002542KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002543AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002544 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002545 [ if test "x$withval" != "xno" ; then
2546 if test "x$withval" = "xyes" ; then
2547 KRB5ROOT="/usr/local"
2548 else
2549 KRB5ROOT=${withval}
2550 fi
2551
2552 AC_DEFINE(KRB5)
2553 KRB5_MSG="yes"
2554
2555 AC_MSG_CHECKING(for krb5-config)
2556 if test -x $KRB5ROOT/bin/krb5-config ; then
2557 KRB5CONF=$KRB5ROOT/bin/krb5-config
2558 AC_MSG_RESULT($KRB5CONF)
2559
2560 AC_MSG_CHECKING(for gssapi support)
2561 if $KRB5CONF | grep gssapi >/dev/null ; then
2562 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002563 AC_DEFINE(GSSAPI)
2564 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002565 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002566 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002567 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002568 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002569 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2570 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002571 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002572 AC_MSG_CHECKING(whether we are using Heimdal)
2573 AC_TRY_COMPILE([ #include <krb5.h> ],
2574 [ char *tmp = heimdal_version; ],
2575 [ AC_MSG_RESULT(yes)
2576 AC_DEFINE(HEIMDAL) ],
2577 AC_MSG_RESULT(no)
2578 )
2579 else
2580 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002581 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002582 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002583 AC_MSG_CHECKING(whether we are using Heimdal)
2584 AC_TRY_COMPILE([ #include <krb5.h> ],
2585 [ char *tmp = heimdal_version; ],
2586 [ AC_MSG_RESULT(yes)
2587 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002588 K5LIBS="-lkrb5 -ldes"
2589 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002590 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002591 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002592 ],
2593 [ AC_MSG_RESULT(no)
2594 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2595 ]
2596 )
Damien Miller200d0a72003-06-30 19:21:36 +10002597 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002598
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002599 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2600 [ AC_DEFINE(GSSAPI)
2601 K5LIBS="-lgssapi $K5LIBS" ],
2602 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2603 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002604 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002605 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2606 $K5LIBS)
2607 ],
2608 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002609
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002610 AC_CHECK_HEADER(gssapi.h, ,
2611 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002612 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002613 AC_CHECK_HEADERS(gssapi.h, ,
2614 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002615 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002616 ]
2617 )
2618
2619 oldCPP="$CPPFLAGS"
2620 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2621 AC_CHECK_HEADER(gssapi_krb5.h, ,
2622 [ CPPFLAGS="$oldCPP" ])
2623
Damien Millera8e06ce2003-11-21 23:48:55 +11002624 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002625 if test ! -z "$need_dash_r" ; then
2626 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2627 fi
2628 if test ! -z "$blibpath" ; then
2629 blibpath="$blibpath:${KRB5ROOT}/lib"
2630 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002631 fi
2632
2633 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2634 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2635 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2636
2637 LIBS="$LIBS $K5LIBS"
2638 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002639 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002640 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002641)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002642
Damien Millera22ba012000-03-02 23:09:20 +11002643# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002644
Damien Millerf58c6722002-05-13 13:15:42 +10002645PRIVSEP_PATH=/var/empty
2646AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002647 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002648 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002649 if test -n "$withval" && test "x$withval" != "xno" && \
2650 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002651 PRIVSEP_PATH=$withval
2652 fi
2653 ]
2654)
2655AC_SUBST(PRIVSEP_PATH)
2656
Damien Millera22ba012000-03-02 23:09:20 +11002657AC_ARG_WITH(xauth,
2658 [ --with-xauth=PATH Specify path to xauth program ],
2659 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002660 if test -n "$withval" && test "x$withval" != "xno" && \
2661 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002662 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002663 fi
2664 ],
2665 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002666 TestPath="$PATH"
2667 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2668 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2669 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2670 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2671 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002672 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002673 xauth_path="/usr/openwin/bin/xauth"
2674 fi
2675 ]
2676)
2677
Damien Miller7d901272003-01-13 16:55:22 +11002678STRIP_OPT=-s
2679AC_ARG_ENABLE(strip,
2680 [ --disable-strip Disable calling strip(1) on install],
2681 [
2682 if test "x$enableval" = "xno" ; then
2683 STRIP_OPT=
2684 fi
2685 ]
2686)
2687AC_SUBST(STRIP_OPT)
2688
Damien Millera19cf472000-11-29 13:28:50 +11002689if test -z "$xauth_path" ; then
2690 XAUTH_PATH="undefined"
2691 AC_SUBST(XAUTH_PATH)
2692else
Damien Millera22ba012000-03-02 23:09:20 +11002693 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002694 XAUTH_PATH=$xauth_path
2695 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002696fi
Damien Millera22ba012000-03-02 23:09:20 +11002697
2698# Check for mail directory (last resort if we cannot get it from headers)
2699if test ! -z "$MAIL" ; then
2700 maildir=`dirname $MAIL`
2701 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2702fi
2703
Darren Tucker623d92f2004-09-12 22:36:15 +10002704if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002705 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2706 disable_ptmx_check=yes
2707fi
Damien Millera22ba012000-03-02 23:09:20 +11002708if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002709 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002710 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002711 [
2712 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2713 have_dev_ptmx=1
2714 ]
2715 )
2716 fi
Damien Millera22ba012000-03-02 23:09:20 +11002717fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002718
Darren Tucker623d92f2004-09-12 22:36:15 +10002719if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002720 AC_CHECK_FILE("/dev/ptc",
2721 [
2722 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2723 have_dev_ptc=1
2724 ]
2725 )
2726else
2727 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2728fi
Damien Miller204ad072000-03-02 23:56:12 +11002729
Damien Millera22ba012000-03-02 23:09:20 +11002730# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002731AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002732 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002733 [
Damien Miller897741e2001-04-16 10:41:46 +10002734 case "$withval" in
2735 man|cat|doc)
2736 MANTYPE=$withval
2737 ;;
2738 *)
2739 AC_MSG_ERROR(invalid man type: $withval)
2740 ;;
2741 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002742 ]
2743)
Ben Lindstrombc709922001-04-18 18:04:21 +00002744if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002745 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2746 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002747 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2748 MANTYPE=doc
2749 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2750 MANTYPE=man
2751 else
2752 MANTYPE=cat
2753 fi
2754fi
Damien Miller670a4b82000-01-22 13:53:11 +11002755AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002756if test "$MANTYPE" = "doc"; then
2757 mansubdir=man;
2758else
2759 mansubdir=$MANTYPE;
2760fi
2761AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002762
Damien Millera22ba012000-03-02 23:09:20 +11002763# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002764MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002765AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002766 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002767 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002768 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002769 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002770 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002771 fi
2772 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002773)
2774
Damien Millera22ba012000-03-02 23:09:20 +11002775# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002776AC_ARG_WITH(shadow,
2777 [ --without-shadow Disable shadow password support],
2778 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002779 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002780 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002781 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002782 fi
2783 ]
2784)
2785
Damien Miller1f335fb2000-06-26 11:31:33 +10002786if test -z "$disable_shadow" ; then
2787 AC_MSG_CHECKING([if the systems has expire shadow information])
2788 AC_TRY_COMPILE(
2789 [
2790#include <sys/types.h>
2791#include <shadow.h>
2792 struct spwd sp;
2793 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2794 [ sp_expire_available=yes ], []
2795 )
2796
2797 if test "x$sp_expire_available" = "xyes" ; then
2798 AC_MSG_RESULT(yes)
2799 AC_DEFINE(HAS_SHADOW_EXPIRE)
2800 else
2801 AC_MSG_RESULT(no)
2802 fi
2803fi
2804
Damien Millera22ba012000-03-02 23:09:20 +11002805# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002806if test ! -z "$IPADDR_IN_DISPLAY" ; then
2807 DISPLAY_HACK_MSG="yes"
2808 AC_DEFINE(IPADDR_IN_DISPLAY)
2809else
Damien Millera8e06ce2003-11-21 23:48:55 +11002810 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002811 AC_ARG_WITH(ipaddr-display,
2812 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2813 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002814 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002815 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002816 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002817 fi
2818 ]
2819 )
2820fi
Damien Miller76112de1999-12-21 11:18:08 +11002821
Darren Tuckere1a790d2003-09-16 11:52:19 +10002822# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002823AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002824 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002825 [ if test "x$enableval" = "xno"; then
2826 AC_MSG_NOTICE([/etc/default/login handling disabled])
2827 etc_default_login=no
2828 else
2829 etc_default_login=yes
2830 fi ],
2831 [ etc_default_login=yes ]
2832)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002833
Darren Tucker2f9573d2005-02-10 22:28:54 +11002834if test "x$etc_default_login" != "xno"; then
2835 AC_CHECK_FILE("/etc/default/login",
2836 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002837 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2838 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002839 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2840 elif test "x$external_path_file" = "x/etc/default/login"; then
2841 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2842 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002843fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002844
Tim Rice43a1c132002-04-17 21:19:14 -07002845dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002846if test $ac_cv_func_login_getcapbool = "yes" && \
2847 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002848 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002849fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002850
Damien Millera22ba012000-03-02 23:09:20 +11002851# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002852SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002853AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002854 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002855 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002856 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002857 AC_MSG_WARN([
2858--with-default-path=PATH has no effect on this system.
2859Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002860 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002861 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002862 AC_MSG_WARN([
2863--with-default-path=PATH will only be used if PATH is not defined in
2864$external_path_file .])
2865 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002866 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002867 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002868 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002869 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002870 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2871 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002872 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002873 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002874 AC_MSG_WARN([
2875If PATH is defined in $external_path_file, ensure the path to scp is included,
2876otherwise scp will not work.])
2877 fi
2878 AC_TRY_RUN(
2879 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002880/* find out what STDPATH is */
2881#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002882#ifdef HAVE_PATHS_H
2883# include <paths.h>
2884#endif
2885#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002886# ifdef _PATH_USERPATH /* Irix */
2887# define _PATH_STDPATH _PATH_USERPATH
2888# else
2889# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2890# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002891#endif
2892#include <sys/types.h>
2893#include <sys/stat.h>
2894#include <fcntl.h>
2895#define DATA "conftest.stdpath"
2896
2897main()
2898{
2899 FILE *fd;
2900 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002901
Tim Rice59ea0a02001-03-10 13:50:45 -08002902 fd = fopen(DATA,"w");
2903 if(fd == NULL)
2904 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002905
Tim Rice59ea0a02001-03-10 13:50:45 -08002906 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2907 exit(1);
2908
2909 exit(0);
2910}
2911 ], [ user_path=`cat conftest.stdpath` ],
2912 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2913 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2914 )
2915# make sure $bindir is in USER_PATH so scp will work
2916 t_bindir=`eval echo ${bindir}`
2917 case $t_bindir in
2918 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2919 esac
2920 case $t_bindir in
2921 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2922 esac
2923 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2924 if test $? -ne 0 ; then
2925 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2926 if test $? -ne 0 ; then
2927 user_path=$user_path:$t_bindir
2928 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2929 fi
2930 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002931 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002932)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002933if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002934 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2935 AC_SUBST(user_path)
2936fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002937
Damien Millera18bbd32002-05-13 10:48:57 +10002938# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002939AC_ARG_WITH(superuser-path,
2940 [ --with-superuser-path= Specify different path for super-user],
2941 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002942 if test -n "$withval" && test "x$withval" != "xno" && \
2943 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002944 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2945 superuser_path=$withval
2946 fi
2947 ]
2948)
2949
2950
Damien Miller61e50f12000-05-08 20:49:37 +10002951AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002952IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002953AC_ARG_WITH(4in6,
2954 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2955 [
2956 if test "x$withval" != "xno" ; then
2957 AC_MSG_RESULT(yes)
2958 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002959 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002960 else
2961 AC_MSG_RESULT(no)
2962 fi
2963 ],[
2964 if test "x$inet6_default_4in6" = "xyes"; then
2965 AC_MSG_RESULT([yes (default)])
2966 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002967 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002968 else
2969 AC_MSG_RESULT([no (default)])
2970 fi
2971 ]
2972)
2973
Damien Miller60396b02001-02-18 17:01:00 +11002974# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002975BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002976AC_ARG_WITH(bsd-auth,
2977 [ --with-bsd-auth Enable BSD auth support],
2978 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002979 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002980 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002981 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002982 fi
2983 ]
2984)
2985
Damien Millera22ba012000-03-02 23:09:20 +11002986# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002987piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002988# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002989if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002990 piddir=`eval echo ${sysconfdir}`
2991 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002992 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002993 esac
2994fi
2995
Tim Rice88f2ab52002-03-17 12:17:34 -08002996AC_ARG_WITH(pid-dir,
2997 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2998 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002999 if test -n "$withval" && test "x$withval" != "xno" && \
3000 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003001 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003002 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003003 AC_MSG_WARN([** no $piddir directory on this system **])
3004 fi
3005 fi
3006 ]
3007)
3008
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003009AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003010AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003011
andre2ff7b5d2000-06-03 14:57:40 +00003012dnl allow user to disable some login recording features
3013AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003014 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003015 [
3016 if test "x$enableval" = "xno" ; then
3017 AC_DEFINE(DISABLE_LASTLOG)
3018 fi
3019 ]
andre2ff7b5d2000-06-03 14:57:40 +00003020)
3021AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003022 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003023 [
3024 if test "x$enableval" = "xno" ; then
3025 AC_DEFINE(DISABLE_UTMP)
3026 fi
3027 ]
andre2ff7b5d2000-06-03 14:57:40 +00003028)
3029AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003030 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003031 [
3032 if test "x$enableval" = "xno" ; then
3033 AC_DEFINE(DISABLE_UTMPX)
3034 fi
3035 ]
andre2ff7b5d2000-06-03 14:57:40 +00003036)
3037AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003038 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003039 [
3040 if test "x$enableval" = "xno" ; then
3041 AC_DEFINE(DISABLE_WTMP)
3042 fi
3043 ]
andre2ff7b5d2000-06-03 14:57:40 +00003044)
3045AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003046 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003047 [
3048 if test "x$enableval" = "xno" ; then
3049 AC_DEFINE(DISABLE_WTMPX)
3050 fi
3051 ]
andre2ff7b5d2000-06-03 14:57:40 +00003052)
3053AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003054 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003055 [
3056 if test "x$enableval" = "xno" ; then
3057 AC_DEFINE(DISABLE_LOGIN)
3058 fi
3059 ]
andre2ff7b5d2000-06-03 14:57:40 +00003060)
3061AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003062 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003063 [
3064 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003065 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003066 fi
3067 ]
andre2ff7b5d2000-06-03 14:57:40 +00003068)
3069AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003070 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003071 [
3072 if test "x$enableval" = "xno" ; then
3073 AC_DEFINE(DISABLE_PUTUTXLINE)
3074 fi
3075 ]
andre2ff7b5d2000-06-03 14:57:40 +00003076)
3077AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003078 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003079 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003080 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003081 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003082 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003083 conf_lastlog_location=$withval
3084 fi
3085 ]
3086)
andre2ff7b5d2000-06-03 14:57:40 +00003087
3088dnl lastlog, [uw]tmpx? detection
3089dnl NOTE: set the paths in the platform section to avoid the
3090dnl need for command-line parameters
3091dnl lastlog and [uw]tmp are subject to a file search if all else fails
3092
3093dnl lastlog detection
3094dnl NOTE: the code itself will detect if lastlog is a directory
3095AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3096AC_TRY_COMPILE([
3097#include <sys/types.h>
3098#include <utmp.h>
3099#ifdef HAVE_LASTLOG_H
3100# include <lastlog.h>
3101#endif
Damien Miller2994e082000-06-04 15:51:47 +10003102#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003103# include <paths.h>
3104#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003105#ifdef HAVE_LOGIN_H
3106# include <login.h>
3107#endif
andre2ff7b5d2000-06-03 14:57:40 +00003108 ],
3109 [ char *lastlog = LASTLOG_FILE; ],
3110 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003111 [
3112 AC_MSG_RESULT(no)
3113 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3114 AC_TRY_COMPILE([
3115#include <sys/types.h>
3116#include <utmp.h>
3117#ifdef HAVE_LASTLOG_H
3118# include <lastlog.h>
3119#endif
3120#ifdef HAVE_PATHS_H
3121# include <paths.h>
3122#endif
3123 ],
3124 [ char *lastlog = _PATH_LASTLOG; ],
3125 [ AC_MSG_RESULT(yes) ],
3126 [
andree441aa32000-06-12 22:34:38 +00003127 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003128 system_lastlog_path=no
3129 ])
3130 ]
andre2ff7b5d2000-06-03 14:57:40 +00003131)
Damien Miller2994e082000-06-04 15:51:47 +10003132
andre2ff7b5d2000-06-03 14:57:40 +00003133if test -z "$conf_lastlog_location"; then
3134 if test x"$system_lastlog_path" = x"no" ; then
3135 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003136 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003137 conf_lastlog_location=$f
3138 fi
3139 done
3140 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003141 AC_MSG_WARN([** Cannot find lastlog **])
3142 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003143 fi
3144 fi
3145fi
3146
3147if test -n "$conf_lastlog_location"; then
3148 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003149fi
andre2ff7b5d2000-06-03 14:57:40 +00003150
3151dnl utmp detection
3152AC_MSG_CHECKING([if your system defines UTMP_FILE])
3153AC_TRY_COMPILE([
3154#include <sys/types.h>
3155#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003156#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003157# include <paths.h>
3158#endif
3159 ],
3160 [ char *utmp = UTMP_FILE; ],
3161 [ AC_MSG_RESULT(yes) ],
3162 [ AC_MSG_RESULT(no)
3163 system_utmp_path=no ]
3164)
3165if test -z "$conf_utmp_location"; then
3166 if test x"$system_utmp_path" = x"no" ; then
3167 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3168 if test -f $f ; then
3169 conf_utmp_location=$f
3170 fi
3171 done
3172 if test -z "$conf_utmp_location"; then
3173 AC_DEFINE(DISABLE_UTMP)
3174 fi
3175 fi
3176fi
3177if test -n "$conf_utmp_location"; then
3178 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003179fi
andre2ff7b5d2000-06-03 14:57:40 +00003180
3181dnl wtmp detection
3182AC_MSG_CHECKING([if your system defines WTMP_FILE])
3183AC_TRY_COMPILE([
3184#include <sys/types.h>
3185#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003186#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003187# include <paths.h>
3188#endif
3189 ],
3190 [ char *wtmp = WTMP_FILE; ],
3191 [ AC_MSG_RESULT(yes) ],
3192 [ AC_MSG_RESULT(no)
3193 system_wtmp_path=no ]
3194)
3195if test -z "$conf_wtmp_location"; then
3196 if test x"$system_wtmp_path" = x"no" ; then
3197 for f in /usr/adm/wtmp /var/log/wtmp; do
3198 if test -f $f ; then
3199 conf_wtmp_location=$f
3200 fi
3201 done
3202 if test -z "$conf_wtmp_location"; then
3203 AC_DEFINE(DISABLE_WTMP)
3204 fi
3205 fi
3206fi
3207if test -n "$conf_wtmp_location"; then
3208 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003209fi
andre2ff7b5d2000-06-03 14:57:40 +00003210
3211
3212dnl utmpx detection - I don't know any system so perverse as to require
3213dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3214dnl there, though.
3215AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3216AC_TRY_COMPILE([
3217#include <sys/types.h>
3218#include <utmp.h>
3219#ifdef HAVE_UTMPX_H
3220#include <utmpx.h>
3221#endif
Damien Miller2994e082000-06-04 15:51:47 +10003222#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003223# include <paths.h>
3224#endif
3225 ],
3226 [ char *utmpx = UTMPX_FILE; ],
3227 [ AC_MSG_RESULT(yes) ],
3228 [ AC_MSG_RESULT(no)
3229 system_utmpx_path=no ]
3230)
3231if test -z "$conf_utmpx_location"; then
3232 if test x"$system_utmpx_path" = x"no" ; then
3233 AC_DEFINE(DISABLE_UTMPX)
3234 fi
3235else
3236 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003237fi
andre2ff7b5d2000-06-03 14:57:40 +00003238
3239dnl wtmpx detection
3240AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3241AC_TRY_COMPILE([
3242#include <sys/types.h>
3243#include <utmp.h>
3244#ifdef HAVE_UTMPX_H
3245#include <utmpx.h>
3246#endif
Damien Miller2994e082000-06-04 15:51:47 +10003247#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003248# include <paths.h>
3249#endif
3250 ],
3251 [ char *wtmpx = WTMPX_FILE; ],
3252 [ AC_MSG_RESULT(yes) ],
3253 [ AC_MSG_RESULT(no)
3254 system_wtmpx_path=no ]
3255)
3256if test -z "$conf_wtmpx_location"; then
3257 if test x"$system_wtmpx_path" = x"no" ; then
3258 AC_DEFINE(DISABLE_WTMPX)
3259 fi
3260else
3261 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003262fi
andre2ff7b5d2000-06-03 14:57:40 +00003263
Damien Miller4018c192000-04-30 09:30:44 +10003264
Damien Miller29ea30d2000-03-17 10:54:15 +11003265if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003266 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3267 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003268fi
3269
Tim Rice4cec93f2002-02-26 08:40:48 -08003270dnl remove pam and dl because they are in $LIBPAM
3271if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003272 LIBS=`echo $LIBS | sed 's/-lpam //'`
3273fi
3274if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3275 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003276fi
3277
Damien Millerbac2d8a2000-09-05 16:13:06 +11003278AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003279AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3280 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003281AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003282
Damien Miller7b22d652000-06-18 14:07:04 +10003283# Print summary of options
3284
Damien Miller7b22d652000-06-18 14:07:04 +10003285# Someone please show me a better way :)
3286A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3287B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3288C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3289D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003290E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003291F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003292G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003293H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3294I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3295J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003296
3297echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003298echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003299echo " User binaries: $B"
3300echo " System binaries: $C"
3301echo " Configuration files: $D"
3302echo " Askpass program: $E"
3303echo " Manual pages: $F"
3304echo " PID file: $G"
3305echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003306if test "x$external_path_file" = "x/etc/login.conf" ; then
3307echo " At runtime, sshd will use the path defined in $external_path_file"
3308echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003309else
Damien Millerf58c6722002-05-13 13:15:42 +10003310echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003311 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003312echo " (If PATH is set in $external_path_file it will be used instead. If"
3313echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3314 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003315fi
Damien Millera18bbd32002-05-13 10:48:57 +10003316if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003317echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003318fi
Damien Millerf58c6722002-05-13 13:15:42 +10003319echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003320echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003321echo " KerberosV support: $KRB5_MSG"
3322echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003323echo " S/KEY support: $SKEY_MSG"
3324echo " TCP Wrappers support: $TCPW_MSG"
3325echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003326echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003327echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003328echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3329echo " BSD Auth support: $BSD_AUTH_MSG"
3330echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003331if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003332echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003333fi
3334
Damien Miller7b22d652000-06-18 14:07:04 +10003335echo ""
3336
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003337echo " Host: ${host}"
3338echo " Compiler: ${CC}"
3339echo " Compiler flags: ${CFLAGS}"
3340echo "Preprocessor flags: ${CPPFLAGS}"
3341echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003342echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003343
3344echo ""
3345
Tim Rice6f1f7582004-05-30 21:38:51 -07003346if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003347 echo "SVR4 style packages are supported with \"make package\""
3348 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003349fi
3350
Damien Miller82cf0ce2000-12-20 13:34:48 +11003351if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003352 echo "PAM is enabled. You may need to install a PAM control file "
3353 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003354 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003355 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003356 echo ""
3357fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003358
Damien Miller6c21c512002-01-22 21:57:53 +11003359if test ! -z "$RAND_HELPER_CMDHASH" ; then
3360 echo "WARNING: you are using the builtin random number collection "
3361 echo "service. Please read WARNING.RNG and request that your OS "
3362 echo "vendor includes kernel-based random number collection in "
3363 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003364 echo ""
3365fi
Damien Miller60396b02001-02-18 17:01:00 +11003366
Damien Millerb4097182004-05-23 14:09:40 +10003367if test ! -z "$NO_PEERCHECK" ; then
3368 echo "WARNING: the operating system that you are using does not "
3369 echo "appear to support either the getpeereid() API nor the "
3370 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3371 echo "enforce security checks to prevent unauthorised connections to "
3372 echo "ssh-agent. Their absence increases the risk that a malicious "
3373 echo "user can connect to your agent. "
3374 echo ""
3375fi
3376
Darren Tuckerd9f88912005-02-20 21:01:48 +11003377if test "$AUDIT_MODULE" = "bsm" ; then
3378 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3379 echo "See the Solaris section in README.platform for details."
3380fi