blob: e94663790eee0c784f89507dca6b501b7d0e8515 [file] [log] [blame]
Darren Tucker81eb5d52005-06-01 21:39:33 +10001# $Id: configure.ac,v 1.270 2005/06/01 11:39:33 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 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000193*-*-hpux*)
194 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000195 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100196 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000197 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000198 AC_DEFINE(LOGIN_NO_ENDOPT)
199 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000200 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000201 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700202 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000203 AC_CHECK_LIB(xnet, t_error, ,
204 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
205
206 # next, we define all of the options specific to major releases
207 case "$host" in
208 *-*-hpux10*)
209 if test -z "$GCC"; then
210 CFLAGS="$CFLAGS -Ae"
211 fi
212 ;;
213 *-*-hpux11*)
214 AC_DEFINE(PAM_SUN_CODEBASE)
215 AC_DEFINE(DISABLE_UTMP)
216 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
217 check_for_hpux_broken_getaddrinfo=1
218 check_for_conflicting_getspnam=1
219 ;;
220 esac
221
222 # lastly, we define options specific to minor releases
223 case "$host" in
224 *-*-hpux10.26)
225 AC_DEFINE(HAVE_SECUREWARE)
226 disable_ptmx_check=yes
227 LIBS="$LIBS -lsecpw"
228 ;;
229 esac
Damien Miller1bead332000-04-30 00:47:29 +1000230 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100231*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100232 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000233 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000234 AC_DEFINE(SETEUID_BREAKS_SETUID)
235 AC_DEFINE(BROKEN_SETREUID)
236 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000237 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000238 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100239 ;;
240*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100241 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000242 AC_DEFINE(WITH_IRIX_ARRAY)
243 AC_DEFINE(WITH_IRIX_PROJECT)
244 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000245 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000246 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000247 AC_DEFINE(SETEUID_BREAKS_SETUID)
248 AC_DEFINE(BROKEN_SETREUID)
249 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000250 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000251 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000252 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100253 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100254*-*-linux*)
255 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100256 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000257 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100258 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000259 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000260 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000261 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000262 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100263 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
264 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100265 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000266 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000267 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000268 AC_DEFINE(BROKEN_CMSG_TYPE)
269 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000270 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100271 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000272mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000273 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000274 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000275 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100276*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000277 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800278 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800279 need_dash_r=1
280 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100281 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100282*-*-freebsd*)
283 check_for_libcrypt_later=1
284 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000285*-*-bsdi*)
286 AC_DEFINE(SETEUID_BREAKS_SETUID)
287 AC_DEFINE(BROKEN_SETREUID)
288 AC_DEFINE(BROKEN_SETREGID)
289 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000290*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000291 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100292 conf_utmp_location=/etc/utmp
293 conf_wtmp_location=/usr/adm/wtmp
294 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000295 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000296 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000297 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100298 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000299 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100300*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800301 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800302 need_dash_r=1
303 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100304 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000305 AC_DEFINE(LOGIN_NEEDS_UTMPX)
306 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000307 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000308 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000309 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000310 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
311 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000312 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000313 # hardwire lastlog location (can't detect it on some versions)
314 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000315 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
316 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
317 if test "$sol2ver" -ge 8; then
318 AC_MSG_RESULT(yes)
319 AC_DEFINE(DISABLE_UTMP)
320 AC_DEFINE(DISABLE_WTMP)
321 else
322 AC_MSG_RESULT(no)
323 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100324 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000325*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000326 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000327 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100328 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000329 conf_utmp_location=/etc/utmp
330 conf_wtmp_location=/var/adm/wtmp
331 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000332 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000333 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000334*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700335 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000336 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000337 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000338 AC_DEFINE(SETEUID_BREAKS_SETUID)
339 AC_DEFINE(BROKEN_SETREUID)
340 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000341 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000342*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700343 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000344 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100345 # -lresolv needs to be at then end of LIBS or DNS lookups break
346 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100347 IPADDR_IN_DISPLAY=yes
348 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000349 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000350 AC_DEFINE(SETEUID_BREAKS_SETUID)
351 AC_DEFINE(BROKEN_SETREUID)
352 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000353 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000354 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700355 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
356 # Attention: always take care to bind libsocket and libnsl before libc,
357 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000358 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800359# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100360*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100361 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700362 AC_DEFINE(SETEUID_BREAKS_SETUID)
363 AC_DEFINE(BROKEN_SETREUID)
364 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700365 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100366 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800367# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100368*-*-sysv5*)
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 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100375*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100376 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800377# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100378*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800379 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100380 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800381# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100382*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800383 if test -z "$GCC"; then
384 CFLAGS="$CFLAGS -belf"
385 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100386 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000387 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100388 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000389 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000390 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700391 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700392 AC_DEFINE(SETEUID_BREAKS_SETUID)
393 AC_DEFINE(BROKEN_SETREUID)
394 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700395 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700396 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100397 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100398 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700399 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700400 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000401 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000402*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100403 AC_DEFINE(NO_SSH_LASTLOG)
404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000407 AC_DEFINE(USE_PIPES)
408 AC_DEFINE(DISABLE_FD_PASSING)
409 LDFLAGS="$LDFLAGS"
410 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
411 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000412 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000413*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100414 AC_DEFINE(SETEUID_BREAKS_SETUID)
415 AC_DEFINE(BROKEN_SETREUID)
416 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000417 AC_DEFINE(WITH_ABBREV_NO_TTY)
418 AC_DEFINE(USE_PIPES)
419 AC_DEFINE(DISABLE_FD_PASSING)
420 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100421 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000422 MANTYPE=cat
423 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000424*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100425 AC_DEFINE(SETEUID_BREAKS_SETUID)
426 AC_DEFINE(BROKEN_SETREUID)
427 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000428 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700429 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700430 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000431 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
432 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
433 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700434 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000435*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000436 AC_MSG_CHECKING(for Digital Unix SIA)
437 no_osfsia=""
438 AC_ARG_WITH(osfsia,
439 [ --with-osfsia Enable Digital Unix SIA],
440 [
441 if test "x$withval" = "xno" ; then
442 AC_MSG_RESULT(disabled)
443 no_osfsia=1
444 fi
445 ],
446 )
447 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000448 if test -f /etc/sia/matrix.conf; then
449 AC_MSG_RESULT(yes)
450 AC_DEFINE(HAVE_OSF_SIA)
451 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000452 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000453 LIBS="$LIBS -lsecurity -ldb -lm -laud"
454 else
455 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100456 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000457 fi
458 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000459 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700460 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000461 AC_DEFINE(BROKEN_SETREUID)
462 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000463 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000464
465*-*-nto-qnx)
466 AC_DEFINE(USE_PIPES)
467 AC_DEFINE(NO_X11_UNIX_SOCKETS)
468 AC_DEFINE(MISSING_NFDBITS)
469 AC_DEFINE(MISSING_HOWMANY)
470 AC_DEFINE(MISSING_FD_MASK)
471 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000472
473*-*-ultrix*)
474 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
475 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
476 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
477 AC_CHECK_HEADERS(sys/syslog.h)
Damien Miller76112de1999-12-21 11:18:08 +1100478esac
479
Damien Millere37bfc12000-06-05 09:37:43 +1000480# Allow user to specify flags
481AC_ARG_WITH(cflags,
482 [ --with-cflags Specify additional flags to pass to compiler],
483 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800484 if test -n "$withval" && test "x$withval" != "xno" && \
485 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000486 CFLAGS="$CFLAGS $withval"
487 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800488 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000489)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000490AC_ARG_WITH(cppflags,
491 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
492 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800493 if test -n "$withval" && test "x$withval" != "xno" && \
494 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000495 CPPFLAGS="$CPPFLAGS $withval"
496 fi
497 ]
498)
Damien Millere37bfc12000-06-05 09:37:43 +1000499AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000500 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000501 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800502 if test -n "$withval" && test "x$withval" != "xno" && \
503 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000504 LDFLAGS="$LDFLAGS $withval"
505 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800506 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000507)
508AC_ARG_WITH(libs,
509 [ --with-libs Specify additional libraries to link with],
510 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800511 if test -n "$withval" && test "x$withval" != "xno" && \
512 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000513 LIBS="$LIBS $withval"
514 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800515 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000516)
517
Darren Tucker6eb93042003-06-29 21:30:41 +1000518AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000519AC_RUN_IFELSE(
520 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000521#include <stdio.h>
522int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000523 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000524 [ AC_MSG_RESULT(yes) ],
525 [
526 AC_MSG_RESULT(no)
527 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000528 ],
529 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000530)
531
Darren Tucker0c9653f2005-05-28 15:58:14 +1000532dnl Checks for header files.
533AC_CHECK_HEADERS( \
534 bstring.h \
535 crypt.h \
536 dirent.h \
537 endian.h \
538 features.h \
539 floatingpoint.h \
540 getopt.h \
541 glob.h \
542 ia.h \
543 lastlog.h \
544 limits.h \
545 login.h \
546 login_cap.h \
547 maillock.h \
548 ndir.h \
549 netdb.h \
550 netgroup.h \
551 netinet/in_systm.h \
552 pam/pam_appl.h \
553 paths.h \
554 pty.h \
555 readpassphrase.h \
556 rpc/types.h \
557 security/pam_appl.h \
558 shadow.h \
559 stddef.h \
560 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000561 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000562 strings.h \
563 sys/audit.h \
564 sys/bitypes.h \
565 sys/bsdtty.h \
566 sys/cdefs.h \
567 sys/dir.h \
568 sys/mman.h \
569 sys/ndir.h \
570 sys/prctl.h \
571 sys/pstat.h \
572 sys/select.h \
573 sys/stat.h \
574 sys/stream.h \
575 sys/stropts.h \
576 sys/strtio.h \
577 sys/sysmacros.h \
578 sys/time.h \
579 sys/timers.h \
580 sys/un.h \
581 time.h \
582 tmpdir.h \
583 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000584 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000585 usersec.h \
586 util.h \
587 utime.h \
588 utmp.h \
589 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000590 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000591)
Tim Rice4cec93f2002-02-26 08:40:48 -0800592
Darren Tucker48d99d32004-08-29 17:04:50 +1000593# sys/ptms.h requires sys/stream.h to be included first on Solaris
594AC_CHECK_HEADERS(sys/ptms.h, [], [], [
595#ifdef HAVE_SYS_STREAM_H
596# include <sys/stream.h>
597#endif
598])
599
Damien Millera22ba012000-03-02 23:09:20 +1100600# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700601AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
602AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000603
Tim Rice1e1ef642003-09-11 22:19:31 -0700604dnl IRIX and Solaris 2.5.1 have dirname() in libgen
605AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
606 AC_CHECK_LIB(gen, dirname,[
607 AC_CACHE_CHECK([for broken dirname],
608 ac_cv_have_broken_dirname, [
609 save_LIBS="$LIBS"
610 LIBS="$LIBS -lgen"
611 AC_TRY_RUN(
612 [
613#include <libgen.h>
614#include <string.h>
615
616int main(int argc, char **argv) {
617 char *s, buf[32];
618
619 strncpy(buf,"/etc", 32);
620 s = dirname(buf);
621 if (!s || strncmp(s, "/", 32) != 0) {
622 exit(1);
623 } else {
624 exit(0);
625 }
626}
627 ],
628 [ ac_cv_have_broken_dirname="no" ],
629 [ ac_cv_have_broken_dirname="yes" ]
630 )
631 LIBS="$save_LIBS"
632 ])
633 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
634 LIBS="$LIBS -lgen"
635 AC_DEFINE(HAVE_DIRNAME)
636 AC_CHECK_HEADERS(libgen.h)
637 fi
638 ])
639])
640
641AC_CHECK_FUNC(getspnam, ,
642 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
643AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
644
Tim Rice13aae5e2001-10-21 17:53:58 -0700645dnl zlib is required
646AC_ARG_WITH(zlib,
647 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100648 [ if test "x$withval" = "xno" ; then
649 AC_MSG_ERROR([*** zlib is required ***])
650 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700651 if test -d "$withval/lib"; then
652 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700653 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700654 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700655 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700656 fi
657 else
658 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700659 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700660 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700661 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700662 fi
663 fi
664 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700665 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700666 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700667 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700668 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100669 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700670)
671
Tim Ricefcb62202004-01-23 18:35:16 -0800672AC_CHECK_LIB(z, deflate, ,
673 [
674 saved_CPPFLAGS="$CPPFLAGS"
675 saved_LDFLAGS="$LDFLAGS"
676 save_LIBS="$LIBS"
677 dnl Check default zlib install dir
678 if test -n "${need_dash_r}"; then
679 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
680 else
681 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
682 fi
683 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
684 LIBS="$LIBS -lz"
685 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
686 [
687 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
688 ]
689 )
690 ]
691)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100692AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100693
694AC_ARG_WITH(zlib-version-check,
695 [ --without-zlib-version-check Disable zlib version check],
696 [ if test "x$withval" = "xno" ; then
697 zlib_check_nonfatal=1
698 fi
699 ]
700)
701
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000702AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000703AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000704#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100705#include <zlib.h>
706int main()
707{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000708 int a=0, b=0, c=0, d=0, n, v;
709 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
710 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100711 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000712 v = a*1000000 + b*10000 + c*100 + d;
713 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
714
715 /* 1.1.4 is OK */
716 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100717 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000718
719 /* 1.2.1.2 and up are OK */
720 if (v >= 1020102)
721 exit(0);
722
Darren Tucker2dcd2392004-01-23 17:13:33 +1100723 exit(2);
724}
Darren Tucker623d92f2004-09-12 22:36:15 +1000725 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000726 AC_MSG_RESULT(no),
727 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100728 if test -z "$zlib_check_nonfatal" ; then
729 AC_MSG_ERROR([*** zlib too old - check config.log ***
730Your reported zlib version has known security problems. It's possible your
731vendor has fixed these problems without changing the version number. If you
732are sure this is the case, you can disable the check by running
733"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000734If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
735See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100736 else
737 AC_MSG_WARN([zlib version may have security problems])
738 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000739 ],
740 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100741)
Damien Miller6f9c3372000-10-25 10:06:04 +1100742
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000743dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100744AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000745 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
746)
Damien Millera8e06ce2003-11-21 23:48:55 +1100747AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700748 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
749 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000750)
Damien Millerab18c411999-11-11 10:40:23 +1100751
Tim Ricee589a292001-11-03 11:09:32 -0800752dnl Checks for libutil functions
753AC_CHECK_HEADERS(libutil.h)
754AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
755AC_CHECK_FUNCS(logout updwtmp logwtmp)
756
Ben Lindstrom8697e082001-02-24 21:41:10 +0000757AC_FUNC_STRFTIME
758
Damien Miller3c027682001-03-14 11:39:45 +1100759# Check for ALTDIRFUNC glob() extension
760AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
761AC_EGREP_CPP(FOUNDIT,
762 [
763 #include <glob.h>
764 #ifdef GLOB_ALTDIRFUNC
765 FOUNDIT
766 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100767 ],
Damien Miller3c027682001-03-14 11:39:45 +1100768 [
769 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
770 AC_MSG_RESULT(yes)
771 ],
772 [
773 AC_MSG_RESULT(no)
774 ]
775)
Damien Millerab18c411999-11-11 10:40:23 +1100776
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000777# Check for g.gl_matchc glob() extension
778AC_MSG_CHECKING(for gl_matchc field in glob_t)
779AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100780 [
781 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000782 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100783 ],
784 [
785 AC_DEFINE(GLOB_HAS_GL_MATCHC)
786 AC_MSG_RESULT(yes)
787 ],
788 [
789 AC_MSG_RESULT(no)
790 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000791)
792
Damien Miller18bb4732001-03-28 14:35:30 +1000793AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000794AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000795 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000796#include <sys/types.h>
797#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700798int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000799 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100800 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000801 [
802 AC_MSG_RESULT(no)
803 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000804 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800805 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000806 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
807 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000808 ]
809)
810
Damien Miller36f49652004-08-15 18:40:59 +1000811AC_MSG_CHECKING([for /proc/pid/fd directory])
812if test -d "/proc/$$/fd" ; then
813 AC_DEFINE(HAVE_PROC_PID)
814 AC_MSG_RESULT(yes)
815else
816 AC_MSG_RESULT(no)
817fi
818
Damien Millerc547bf12001-02-16 10:18:12 +1100819# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100820SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100821AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100822 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100823 [
824 if test "x$withval" != "xno" ; then
825
826 if test "x$withval" != "xyes" ; then
827 CPPFLAGS="$CPPFLAGS -I${withval}/include"
828 LDFLAGS="$LDFLAGS -L${withval}/lib"
829 fi
830
831 AC_DEFINE(SKEY)
832 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100833 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800834
Tim Rice4cec93f2002-02-26 08:40:48 -0800835 AC_MSG_CHECKING([for s/key support])
836 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100837 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800838#include <stdio.h>
839#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700840int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800841 ],
842 [AC_MSG_RESULT(yes)],
843 [
844 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100845 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
846 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000847 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
848 AC_TRY_COMPILE(
849 [#include <stdio.h>
850 #include <skey.h>],
851 [(void)skeychallenge(NULL,"name","",0);],
852 [AC_MSG_RESULT(yes)
853 AC_DEFINE(SKEYCHALLENGE_4ARG)],
854 [AC_MSG_RESULT(no)]
855 )
Damien Millerc547bf12001-02-16 10:18:12 +1100856 fi
857 ]
858)
859
860# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700861TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100862AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100863 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100864 [
865 if test "x$withval" != "xno" ; then
866 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700867 saved_LDFLAGS="$LDFLAGS"
868 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800869 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800870 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700871 if test -d "${withval}/lib"; then
872 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700873 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700874 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700875 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700876 fi
877 else
878 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700879 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700880 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700881 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700882 fi
883 fi
884 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700885 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700886 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700887 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700888 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700889 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800890 LIBWRAP="-lwrap"
891 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100892 AC_MSG_CHECKING(for libwrap)
893 AC_TRY_LINK(
894 [
Damien Miller0ac45002004-04-14 20:14:26 +1000895#include <sys/types.h>
896#include <sys/socket.h>
897#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100898#include <tcpd.h>
899 int deny_severity = 0, allow_severity = 0;
900 ],
901 [hosts_access(0);],
902 [
903 AC_MSG_RESULT(yes)
904 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800905 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700906 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100907 ],
908 [
909 AC_MSG_ERROR([*** libwrap missing])
910 ]
911 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800912 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100913 fi
914 ]
915)
916
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100917# Check whether user wants libedit support
918LIBEDIT_MSG="no"
919AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100920 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100921 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100922 if test "x$withval" != "xyes"; then
923 CPPFLAGS="$CPPFLAGS -I$withval/include"
924 LDFLAGS="$LDFLAGS -L$withval/lib"
925 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100926 AC_CHECK_LIB(edit, el_init,
927 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
928 LIBEDIT="-ledit -lcurses"
929 LIBEDIT_MSG="yes"
930 AC_SUBST(LIBEDIT)
931 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100932 [ AC_MSG_ERROR(libedit not found) ],
933 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100934 )
935 fi ]
936)
937
Darren Tuckerd9f88912005-02-20 21:01:48 +1100938AUDIT_MODULE=none
939AC_ARG_WITH(audit,
940 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
941 [
942 AC_MSG_CHECKING(for supported audit module)
943 case "$withval" in
944 bsm)
945 AC_MSG_RESULT(bsm)
946 AUDIT_MODULE=bsm
947 dnl Checks for headers, libs and functions
948 AC_CHECK_HEADERS(bsm/audit.h, [],
949 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
950 AC_CHECK_LIB(bsm, getaudit, [],
951 [AC_MSG_ERROR(BSM enabled and required library not found)])
952 AC_CHECK_FUNCS(getaudit, [],
953 [AC_MSG_ERROR(BSM enabled and required function not found)])
954 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100955 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100956 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
957 ;;
958 debug)
959 AUDIT_MODULE=debug
960 AC_MSG_RESULT(debug)
961 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
962 ;;
963 *)
964 AC_MSG_ERROR([Unknown audit module $withval])
965 ;;
966 esac ]
967)
968
Damien Millerfe1f1432003-02-24 15:45:42 +1100969dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +1000970AC_CHECK_FUNCS( \
971 arc4random \
972 b64_ntop \
973 __b64_ntop \
974 b64_pton \
975 __b64_pton \
976 bcopy \
977 bindresvport_sa \
978 clock \
979 closefrom \
980 dirfd \
981 fchdir \
982 fchmod \
983 fchown \
984 freeaddrinfo \
985 futimes \
986 getaddrinfo \
987 getcwd \
988 getgrouplist \
989 getnameinfo \
990 getopt \
991 getpeereid \
992 _getpty \
993 getrlimit \
994 getttyent \
995 glob \
996 inet_aton \
997 inet_ntoa \
998 inet_ntop \
999 innetgr \
1000 login_getcapbool \
1001 md5_crypt \
1002 memmove \
1003 mkdtemp \
1004 mmap \
1005 ngetaddrinfo \
1006 nsleep \
1007 ogetaddrinfo \
1008 openlog_r \
1009 openpty \
1010 prctl \
1011 pstat \
1012 readpassphrase \
1013 realpath \
1014 recvmsg \
1015 rresvport_af \
1016 sendmsg \
1017 setdtablesize \
1018 setegid \
1019 setenv \
1020 seteuid \
1021 setgroups \
1022 setlogin \
1023 setpcred \
1024 setproctitle \
1025 setregid \
1026 setreuid \
1027 setrlimit \
1028 setsid \
1029 setvbuf \
1030 sigaction \
1031 sigvec \
1032 snprintf \
1033 socketpair \
1034 strdup \
1035 strerror \
1036 strlcat \
1037 strlcpy \
1038 strmode \
1039 strnvis \
1040 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001041 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001042 strtoul \
1043 sysconf \
1044 tcgetpgrp \
1045 truncate \
1046 unsetenv \
1047 updwtmpx \
1048 utimes \
1049 vhangup \
1050 vsnprintf \
1051 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001052)
Tim Rice13aae5e2001-10-21 17:53:58 -07001053
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001054# IRIX has a const char return value for gai_strerror()
1055AC_CHECK_FUNCS(gai_strerror,[
1056 AC_DEFINE(HAVE_GAI_STRERROR)
1057 AC_TRY_COMPILE([
1058#include <sys/types.h>
1059#include <sys/socket.h>
1060#include <netdb.h>
1061
1062const char *gai_strerror(int);],[
1063char *str;
1064
1065str = gai_strerror(0);],[
1066 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1067 [Define if gai_strerror() returns const char *])])])
1068
Damien Millercd6853c2003-01-28 11:33:42 +11001069AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1070
Darren Tuckerf1159b52003-07-07 19:44:01 +10001071dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001072AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001073AC_CHECK_DECL(strsep,
1074 [AC_CHECK_FUNCS(strsep)],
1075 [],
1076 [
1077#ifdef HAVE_STRING_H
1078# include <string.h>
1079#endif
1080 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001081
Darren Tuckerb2427c82003-09-10 15:22:44 +10001082dnl tcsendbreak might be a macro
1083AC_CHECK_DECL(tcsendbreak,
1084 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001085 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001086 [#include <termios.h>]
1087)
1088
Darren Tucker5bb14002004-04-23 18:53:10 +10001089AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1090
Darren Tucker2a6b0292003-12-31 14:59:17 +11001091AC_CHECK_FUNCS(setresuid, [
1092 dnl Some platorms have setresuid that isn't implemented, test for this
1093 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001094 AC_RUN_IFELSE(
1095 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001096#include <stdlib.h>
1097#include <errno.h>
1098int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001099 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001100 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001101 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001102 AC_MSG_RESULT(not implemented)],
1103 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001104 )
1105])
Darren Tuckere937be32003-12-17 18:53:26 +11001106
Darren Tucker2a6b0292003-12-31 14:59:17 +11001107AC_CHECK_FUNCS(setresgid, [
1108 dnl Some platorms have setresgid that isn't implemented, test for this
1109 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001110 AC_RUN_IFELSE(
1111 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001112#include <stdlib.h>
1113#include <errno.h>
1114int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001115 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001116 [AC_MSG_RESULT(yes)],
1117 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001118 AC_MSG_RESULT(not implemented)],
1119 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001120 )
1121])
Darren Tuckere937be32003-12-17 18:53:26 +11001122
Damien Millerad833b32000-08-23 10:46:23 +10001123dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001124AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001125dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001126AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001127AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001128dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001129AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001130AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001131
Damien Millera8e06ce2003-11-21 23:48:55 +11001132AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001133 [AC_DEFINE(HAVE_DAEMON)],
1134 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1135)
1136
Damien Millera8e06ce2003-11-21 23:48:55 +11001137AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001138 [AC_DEFINE(HAVE_GETPAGESIZE)],
1139 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1140)
1141
Damien Millercb170cb2000-07-01 16:52:55 +10001142# Check for broken snprintf
1143if test "x$ac_cv_func_snprintf" = "xyes" ; then
1144 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001145 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001146 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001147#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001148int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001149 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001150 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001151 [
1152 AC_MSG_RESULT(no)
1153 AC_DEFINE(BROKEN_SNPRINTF)
1154 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001155 ],
1156 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001157 )
1158fi
1159
Damien Millerb4097182004-05-23 14:09:40 +10001160# Check for missing getpeereid (or equiv) support
1161NO_PEERCHECK=""
1162if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1163 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1164 AC_TRY_COMPILE(
1165 [#include <sys/types.h>
1166 #include <sys/socket.h>],
1167 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001168 [ AC_MSG_RESULT(yes)
1169 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1170 ],
Damien Millerb4097182004-05-23 14:09:40 +10001171 [AC_MSG_RESULT(no)
1172 NO_PEERCHECK=1]
1173 )
1174fi
1175
Damien Millere8328192003-01-07 15:18:32 +11001176dnl see whether mkstemp() requires XXXXXX
1177if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1178AC_MSG_CHECKING([for (overly) strict mkstemp])
1179AC_TRY_RUN(
1180 [
1181#include <stdlib.h>
1182main() { char template[]="conftest.mkstemp-test";
1183if (mkstemp(template) == -1)
1184 exit(1);
1185unlink(template); exit(0);
1186}
1187 ],
1188 [
1189 AC_MSG_RESULT(no)
1190 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001191 [
Damien Millere8328192003-01-07 15:18:32 +11001192 AC_MSG_RESULT(yes)
1193 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1194 ],
1195 [
1196 AC_MSG_RESULT(yes)
1197 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001198 ]
Damien Millere8328192003-01-07 15:18:32 +11001199)
1200fi
1201
Darren Tucker70a3d552003-08-21 17:58:29 +10001202dnl make sure that openpty does not reacquire controlling terminal
1203if test ! -z "$check_for_openpty_ctty_bug"; then
1204 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1205 AC_TRY_RUN(
1206 [
1207#include <stdio.h>
1208#include <sys/fcntl.h>
1209#include <sys/types.h>
1210#include <sys/wait.h>
1211
1212int
1213main()
1214{
1215 pid_t pid;
1216 int fd, ptyfd, ttyfd, status;
1217
1218 pid = fork();
1219 if (pid < 0) { /* failed */
1220 exit(1);
1221 } else if (pid > 0) { /* parent */
1222 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001223 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001224 exit(WEXITSTATUS(status));
1225 else
1226 exit(2);
1227 } else { /* child */
1228 close(0); close(1); close(2);
1229 setsid();
1230 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1231 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1232 if (fd >= 0)
1233 exit(3); /* Acquired ctty: broken */
1234 else
1235 exit(0); /* Did not acquire ctty: OK */
1236 }
1237}
1238 ],
1239 [
1240 AC_MSG_RESULT(yes)
1241 ],
1242 [
1243 AC_MSG_RESULT(no)
1244 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1245 ]
1246 )
1247fi
1248
Tim Rice8bb561b2005-03-17 16:23:19 -08001249if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1250 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001251 AC_MSG_CHECKING(if getaddrinfo seems to work)
1252 AC_TRY_RUN(
1253 [
1254#include <stdio.h>
1255#include <sys/socket.h>
1256#include <netdb.h>
1257#include <errno.h>
1258#include <netinet/in.h>
1259
1260#define TEST_PORT "2222"
1261
1262int
1263main(void)
1264{
1265 int err, sock;
1266 struct addrinfo *gai_ai, *ai, hints;
1267 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1268
1269 memset(&hints, 0, sizeof(hints));
1270 hints.ai_family = PF_UNSPEC;
1271 hints.ai_socktype = SOCK_STREAM;
1272 hints.ai_flags = AI_PASSIVE;
1273
1274 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1275 if (err != 0) {
1276 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1277 exit(1);
1278 }
1279
1280 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1281 if (ai->ai_family != AF_INET6)
1282 continue;
1283
1284 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1285 sizeof(ntop), strport, sizeof(strport),
1286 NI_NUMERICHOST|NI_NUMERICSERV);
1287
1288 if (err != 0) {
1289 if (err == EAI_SYSTEM)
1290 perror("getnameinfo EAI_SYSTEM");
1291 else
1292 fprintf(stderr, "getnameinfo failed: %s\n",
1293 gai_strerror(err));
1294 exit(2);
1295 }
1296
1297 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1298 if (sock < 0)
1299 perror("socket");
1300 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1301 if (errno == EBADF)
1302 exit(3);
1303 }
1304 }
1305 exit(0);
1306}
1307 ],
1308 [
1309 AC_MSG_RESULT(yes)
1310 ],
1311 [
1312 AC_MSG_RESULT(no)
1313 AC_DEFINE(BROKEN_GETADDRINFO)
1314 ]
1315 )
1316fi
1317
Tim Rice8bb561b2005-03-17 16:23:19 -08001318if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1319 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001320 AC_MSG_CHECKING(if getaddrinfo seems to work)
1321 AC_TRY_RUN(
1322 [
1323#include <stdio.h>
1324#include <sys/socket.h>
1325#include <netdb.h>
1326#include <errno.h>
1327#include <netinet/in.h>
1328
1329#define TEST_PORT "2222"
1330
1331int
1332main(void)
1333{
1334 int err, sock;
1335 struct addrinfo *gai_ai, *ai, hints;
1336 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1337
1338 memset(&hints, 0, sizeof(hints));
1339 hints.ai_family = PF_UNSPEC;
1340 hints.ai_socktype = SOCK_STREAM;
1341 hints.ai_flags = AI_PASSIVE;
1342
1343 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1344 if (err != 0) {
1345 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1346 exit(1);
1347 }
1348
1349 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1350 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1351 continue;
1352
1353 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1354 sizeof(ntop), strport, sizeof(strport),
1355 NI_NUMERICHOST|NI_NUMERICSERV);
1356
1357 if (ai->ai_family == AF_INET && err != 0) {
1358 perror("getnameinfo");
1359 exit(2);
1360 }
1361 }
1362 exit(0);
1363}
1364 ],
1365 [
1366 AC_MSG_RESULT(yes)
1367 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1368[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1369 ],
1370 [
1371 AC_MSG_RESULT(no)
1372 AC_DEFINE(BROKEN_GETADDRINFO)
1373 ]
1374 )
1375fi
1376
Darren Tuckera56f1912004-11-02 20:30:54 +11001377if test "x$check_for_conflicting_getspnam" = "x1"; then
1378 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1379 AC_COMPILE_IFELSE(
1380 [
1381#include <shadow.h>
1382int main(void) {exit(0);}
1383 ],
1384 [
1385 AC_MSG_RESULT(no)
1386 ],
1387 [
1388 AC_MSG_RESULT(yes)
1389 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1390 [Conflicting defs for getspnam])
1391 ]
1392 )
1393fi
1394
Damien Miller606f8802000-09-16 15:39:56 +11001395AC_FUNC_GETPGRP
1396
Damien Millera64b57a2001-01-17 10:44:13 +11001397# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001398PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001399AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001400 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001401 [
Damien Millera64b57a2001-01-17 10:44:13 +11001402 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001403 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1404 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001405 AC_MSG_ERROR([PAM headers not found])
1406 fi
1407
1408 AC_CHECK_LIB(dl, dlopen, , )
1409 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1410 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001411 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001412
Damien Millera64b57a2001-01-17 10:44:13 +11001413 PAM_MSG="yes"
1414
1415 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001416 if test $ac_cv_lib_dl_dlopen = yes; then
1417 LIBPAM="-lpam -ldl"
1418 else
1419 LIBPAM="-lpam"
1420 fi
1421 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001422 fi
1423 ]
1424)
Damien Millera22ba012000-03-02 23:09:20 +11001425
Damien Millera64b57a2001-01-17 10:44:13 +11001426# Check for older PAM
1427if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001428 # Check PAM strerror arguments (old PAM)
1429 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1430 AC_TRY_COMPILE(
1431 [
Damien Miller81171112000-04-23 11:14:01 +10001432#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001433#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001434#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001435#elif defined (HAVE_PAM_PAM_APPL_H)
1436#include <pam/pam_appl.h>
1437#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001438 ],
1439 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001440 [AC_MSG_RESULT(no)],
1441 [
1442 AC_DEFINE(HAVE_OLD_PAM)
1443 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001444 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001445 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001446 )
Damien Millera22ba012000-03-02 23:09:20 +11001447fi
1448
Tim Riceaef73712002-05-11 13:17:42 -07001449# Search for OpenSSL
1450saved_CPPFLAGS="$CPPFLAGS"
1451saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001452AC_ARG_WITH(ssl-dir,
1453 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1454 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001455 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001456 case "$withval" in
1457 # Relative paths
1458 ./*|../*) withval="`pwd`/$withval"
1459 esac
Tim Riceaef73712002-05-11 13:17:42 -07001460 if test -d "$withval/lib"; then
1461 if test -n "${need_dash_r}"; then
1462 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1463 else
1464 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1465 fi
1466 else
1467 if test -n "${need_dash_r}"; then
1468 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1469 else
1470 LDFLAGS="-L${withval} ${LDFLAGS}"
1471 fi
1472 fi
1473 if test -d "$withval/include"; then
1474 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1475 else
1476 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1477 fi
Damien Millera22ba012000-03-02 23:09:20 +11001478 fi
1479 ]
1480)
Tim Rice3d5352e2004-02-12 09:27:21 -08001481LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001482AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001483 [
Tim Riceaef73712002-05-11 13:17:42 -07001484 dnl Check default openssl install dir
1485 if test -n "${need_dash_r}"; then
1486 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001487 else
Tim Riceaef73712002-05-11 13:17:42 -07001488 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001489 fi
Tim Riceaef73712002-05-11 13:17:42 -07001490 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1491 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1492 [
1493 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1494 ]
1495 )
1496 ]
1497)
1498
Tim Riced730b782002-08-13 18:52:10 -07001499# Determine OpenSSL header version
1500AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001501AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001502 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001503#include <stdio.h>
1504#include <string.h>
1505#include <openssl/opensslv.h>
1506#define DATA "conftest.sslincver"
1507int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001508 FILE *fd;
1509 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001510
Damien Millera8e06ce2003-11-21 23:48:55 +11001511 fd = fopen(DATA,"w");
1512 if(fd == NULL)
1513 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001514
1515 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1516 exit(1);
1517
1518 exit(0);
1519}
Darren Tucker623d92f2004-09-12 22:36:15 +10001520 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001521 [
1522 ssl_header_ver=`cat conftest.sslincver`
1523 AC_MSG_RESULT($ssl_header_ver)
1524 ],
1525 [
1526 AC_MSG_RESULT(not found)
1527 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001528 ],
1529 [
1530 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001531 ]
1532)
1533
1534# Determine OpenSSL library version
1535AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001536AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001537 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001538#include <stdio.h>
1539#include <string.h>
1540#include <openssl/opensslv.h>
1541#include <openssl/crypto.h>
1542#define DATA "conftest.ssllibver"
1543int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001544 FILE *fd;
1545 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001546
Damien Millera8e06ce2003-11-21 23:48:55 +11001547 fd = fopen(DATA,"w");
1548 if(fd == NULL)
1549 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001550
1551 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1552 exit(1);
1553
1554 exit(0);
1555}
Darren Tucker623d92f2004-09-12 22:36:15 +10001556 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001557 [
1558 ssl_library_ver=`cat conftest.ssllibver`
1559 AC_MSG_RESULT($ssl_library_ver)
1560 ],
1561 [
1562 AC_MSG_RESULT(not found)
1563 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001564 ],
1565 [
1566 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001567 ]
1568)
Damien Millera22ba012000-03-02 23:09:20 +11001569
Damien Millerec932372002-01-22 22:16:03 +11001570# Sanity check OpenSSL headers
1571AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001572AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001573 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001574#include <string.h>
1575#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001576int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001577 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001578 [
1579 AC_MSG_RESULT(yes)
1580 ],
1581 [
1582 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001583 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1584Check config.log for details.
1585Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001586 ],
1587 [
1588 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001589 ]
1590)
1591
Tim Rice3d5352e2004-02-12 09:27:21 -08001592# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1593# because the system crypt() is more featureful.
1594if test "x$check_for_libcrypt_before" = "x1"; then
1595 AC_CHECK_LIB(crypt, crypt)
1596fi
1597
Damien Millera8e06ce2003-11-21 23:48:55 +11001598# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001599# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001600if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001601 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001602fi
1603
Damien Miller6c21c512002-01-22 21:57:53 +11001604
1605### Configure cryptographic random number support
1606
1607# Check wheter OpenSSL seeds itself
1608AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001609AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001610 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001611#include <string.h>
1612#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001613int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001614 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001615 [
1616 OPENSSL_SEEDS_ITSELF=yes
1617 AC_MSG_RESULT(yes)
1618 ],
1619 [
1620 AC_MSG_RESULT(no)
1621 # Default to use of the rand helper if OpenSSL doesn't
1622 # seed itself
1623 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001624 ],
1625 [
1626 AC_MSG_WARN([cross compiling: assuming yes])
1627 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001628 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001629 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001630 ]
1631)
1632
1633
1634# Do we want to force the use of the rand helper?
1635AC_ARG_WITH(rand-helper,
1636 [ --with-rand-helper Use subprocess to gather strong randomness ],
1637 [
1638 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001639 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001640 # the previous test showed it to be unseeded.
1641 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1642 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1643 OPENSSL_SEEDS_ITSELF=yes
1644 USE_RAND_HELPER=""
1645 fi
1646 else
1647 USE_RAND_HELPER=yes
1648 fi
1649 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001650)
Damien Miller6c21c512002-01-22 21:57:53 +11001651
1652# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001653if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001654 # OpenSSL only
1655 AC_DEFINE(OPENSSL_PRNG_ONLY)
1656 RAND_MSG="OpenSSL internal ONLY"
1657 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001658elif test ! -z "$USE_RAND_HELPER" ; then
1659 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001660 RAND_MSG="ssh-rand-helper"
1661 INSTALL_SSH_RAND_HELPER="yes"
1662fi
1663AC_SUBST(INSTALL_SSH_RAND_HELPER)
1664
1665### Configuration of ssh-rand-helper
1666
1667# PRNGD TCP socket
1668AC_ARG_WITH(prngd-port,
1669 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1670 [
Damien Millere996d722002-01-23 11:20:59 +11001671 case "$withval" in
1672 no)
1673 withval=""
1674 ;;
1675 [[0-9]]*)
1676 ;;
1677 *)
1678 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1679 ;;
1680 esac
1681 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001682 PRNGD_PORT="$withval"
1683 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1684 fi
1685 ]
1686)
1687
1688# PRNGD Unix domain socket
1689AC_ARG_WITH(prngd-socket,
1690 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1691 [
Damien Millere996d722002-01-23 11:20:59 +11001692 case "$withval" in
1693 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001694 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001695 ;;
1696 no)
1697 withval=""
1698 ;;
1699 /*)
1700 ;;
1701 *)
1702 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1703 ;;
1704 esac
1705
1706 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001707 if test ! -z "$PRNGD_PORT" ; then
1708 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1709 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001710 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001711 AC_MSG_WARN(Entropy socket is not readable)
1712 fi
1713 PRNGD_SOCKET="$withval"
1714 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1715 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001716 ],
1717 [
1718 # Check for existing socket only if we don't have a random device already
1719 if test "$USE_RAND_HELPER" = yes ; then
1720 AC_MSG_CHECKING(for PRNGD/EGD socket)
1721 # Insert other locations here
1722 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1723 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1724 PRNGD_SOCKET="$sock"
1725 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1726 break;
1727 fi
1728 done
1729 if test ! -z "$PRNGD_SOCKET" ; then
1730 AC_MSG_RESULT($PRNGD_SOCKET)
1731 else
1732 AC_MSG_RESULT(not found)
1733 fi
1734 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001735 ]
1736)
1737
1738# Change default command timeout for hashing entropy source
1739entropy_timeout=200
1740AC_ARG_WITH(entropy-timeout,
1741 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1742 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001743 if test -n "$withval" && test "x$withval" != "xno" && \
1744 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001745 entropy_timeout=$withval
1746 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001747 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001748)
Damien Miller6c21c512002-01-22 21:57:53 +11001749AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1750
Damien Millerd3f6ad22002-06-25 10:24:47 +10001751SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001752AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001753 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001754 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001755 if test -n "$withval" && test "x$withval" != "xno" && \
1756 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001757 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001758 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001759 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001760)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001761AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1762AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001763
Tim Rice88f2ab52002-03-17 12:17:34 -08001764# We do this little dance with the search path to insure
1765# that programs that we select for use by installed programs
1766# (which may be run by the super-user) come from trusted
1767# locations before they come from the user's private area.
1768# This should help avoid accidentally configuring some
1769# random version of a program in someone's personal bin.
1770
1771OPATH=$PATH
1772PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001773test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001774test -d /sbin && PATH=$PATH:/sbin
1775test -d /usr/sbin && PATH=$PATH:/usr/sbin
1776PATH=$PATH:/etc:$OPATH
1777
Damien Millera8e06ce2003-11-21 23:48:55 +11001778# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001779OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1780OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1781OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1782OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1783OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1784OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1785OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1786OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1787OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1788OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1789OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1790OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1791OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1792OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1793OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1794OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001795# restore PATH
1796PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001797
1798# Where does ssh-rand-helper get its randomness from?
1799INSTALL_SSH_PRNG_CMDS=""
1800if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1801 if test ! -z "$PRNGD_PORT" ; then
1802 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1803 elif test ! -z "$PRNGD_SOCKET" ; then
1804 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1805 else
1806 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1807 RAND_HELPER_CMDHASH=yes
1808 INSTALL_SSH_PRNG_CMDS="yes"
1809 fi
1810fi
1811AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1812
1813
Ben Lindstromb5628642000-10-18 00:02:25 +00001814# Cheap hack to ensure NEWS-OS libraries are arranged right.
1815if test ! -z "$SONY" ; then
1816 LIBS="$LIBS -liberty";
1817fi
1818
Damien Millera22ba012000-03-02 23:09:20 +11001819# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001820AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001821AC_CHECK_SIZEOF(short int, 2)
1822AC_CHECK_SIZEOF(int, 4)
1823AC_CHECK_SIZEOF(long int, 4)
1824AC_CHECK_SIZEOF(long long int, 8)
1825
Damien Millerfa2bb692002-04-23 23:22:25 +10001826# Sanity check long long for some platforms (AIX)
1827if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1828 ac_cv_sizeof_long_long_int=0
1829fi
1830
Damien Millera22ba012000-03-02 23:09:20 +11001831# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001832AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1833 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001834 [ #include <sys/types.h> ],
1835 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001836 [ ac_cv_have_u_int="yes" ],
1837 [ ac_cv_have_u_int="no" ]
1838 )
1839])
1840if test "x$ac_cv_have_u_int" = "xyes" ; then
1841 AC_DEFINE(HAVE_U_INT)
1842 have_u_int=1
1843fi
1844
Damien Miller61e50f12000-05-08 20:49:37 +10001845AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1846 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001847 [ #include <sys/types.h> ],
1848 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001849 [ ac_cv_have_intxx_t="yes" ],
1850 [ ac_cv_have_intxx_t="no" ]
1851 )
1852])
1853if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1854 AC_DEFINE(HAVE_INTXX_T)
1855 have_intxx_t=1
1856fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001857
1858if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001859 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001860then
1861 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1862 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001863 [ #include <stdint.h> ],
1864 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001865 [
1866 AC_DEFINE(HAVE_INTXX_T)
1867 AC_MSG_RESULT(yes)
1868 ],
1869 [ AC_MSG_RESULT(no) ]
1870 )
1871fi
1872
Damien Miller578783e2000-09-23 14:12:24 +11001873AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1874 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001875 [
1876#include <sys/types.h>
1877#ifdef HAVE_STDINT_H
1878# include <stdint.h>
1879#endif
1880#include <sys/socket.h>
1881#ifdef HAVE_SYS_BITYPES_H
1882# include <sys/bitypes.h>
1883#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001884 ],
1885 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001886 [ ac_cv_have_int64_t="yes" ],
1887 [ ac_cv_have_int64_t="no" ]
1888 )
1889])
1890if test "x$ac_cv_have_int64_t" = "xyes" ; then
1891 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001892fi
1893
Damien Miller61e50f12000-05-08 20:49:37 +10001894AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1895 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001896 [ #include <sys/types.h> ],
1897 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001898 [ ac_cv_have_u_intxx_t="yes" ],
1899 [ ac_cv_have_u_intxx_t="no" ]
1900 )
1901])
1902if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1903 AC_DEFINE(HAVE_U_INTXX_T)
1904 have_u_intxx_t=1
1905fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001906
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001907if test -z "$have_u_intxx_t" ; then
1908 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1909 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001910 [ #include <sys/socket.h> ],
1911 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001912 [
1913 AC_DEFINE(HAVE_U_INTXX_T)
1914 AC_MSG_RESULT(yes)
1915 ],
1916 [ AC_MSG_RESULT(no) ]
1917 )
1918fi
1919
Damien Miller578783e2000-09-23 14:12:24 +11001920AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1921 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001922 [ #include <sys/types.h> ],
1923 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001924 [ ac_cv_have_u_int64_t="yes" ],
1925 [ ac_cv_have_u_int64_t="no" ]
1926 )
1927])
1928if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1929 AC_DEFINE(HAVE_U_INT64_T)
1930 have_u_int64_t=1
1931fi
1932
Tim Rice4cec93f2002-02-26 08:40:48 -08001933if test -z "$have_u_int64_t" ; then
1934 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1935 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001936 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001937 [ u_int64_t a; a = 1],
1938 [
1939 AC_DEFINE(HAVE_U_INT64_T)
1940 AC_MSG_RESULT(yes)
1941 ],
1942 [ AC_MSG_RESULT(no) ]
1943 )
1944fi
1945
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001946if test -z "$have_u_intxx_t" ; then
1947 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1948 AC_TRY_COMPILE(
1949 [
1950#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001951 ],
1952 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001953 [ ac_cv_have_uintxx_t="yes" ],
1954 [ ac_cv_have_uintxx_t="no" ]
1955 )
1956 ])
1957 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1958 AC_DEFINE(HAVE_UINTXX_T)
1959 fi
1960fi
1961
1962if test -z "$have_uintxx_t" ; then
1963 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1964 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001965 [ #include <stdint.h> ],
1966 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001967 [
1968 AC_DEFINE(HAVE_UINTXX_T)
1969 AC_MSG_RESULT(yes)
1970 ],
1971 [ AC_MSG_RESULT(no) ]
1972 )
1973fi
1974
Damien Milleredb82922000-06-20 13:25:52 +10001975if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001976 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001977then
1978 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1979 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001980 [
1981#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001982 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001983 [
Damien Miller70494d12000-04-03 15:57:06 +10001984 int8_t a; int16_t b; int32_t c;
1985 u_int8_t e; u_int16_t f; u_int32_t g;
1986 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001987 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001988 [
1989 AC_DEFINE(HAVE_U_INTXX_T)
1990 AC_DEFINE(HAVE_INTXX_T)
1991 AC_MSG_RESULT(yes)
1992 ],
1993 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001994 )
Damien Millerb29ea912000-01-15 14:12:03 +11001995fi
1996
Damien Miller58be7382001-09-15 21:31:54 +10001997
1998AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1999 AC_TRY_COMPILE(
2000 [
2001#include <sys/types.h>
2002 ],
2003 [ u_char foo; foo = 125; ],
2004 [ ac_cv_have_u_char="yes" ],
2005 [ ac_cv_have_u_char="no" ]
2006 )
2007])
2008if test "x$ac_cv_have_u_char" = "xyes" ; then
2009 AC_DEFINE(HAVE_U_CHAR)
2010fi
2011
Tim Rice13aae5e2001-10-21 17:53:58 -07002012TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002013
Tim Rice200a5c02002-02-26 22:12:34 -08002014AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002015
Damien Miller848b9932005-02-24 12:12:34 +11002016AC_CHECK_TYPES(in_addr_t,,,
2017[#include <sys/types.h>
2018#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002019
Damien Miller61e50f12000-05-08 20:49:37 +10002020AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2021 AC_TRY_COMPILE(
2022 [
2023#include <sys/types.h>
2024 ],
2025 [ size_t foo; foo = 1235; ],
2026 [ ac_cv_have_size_t="yes" ],
2027 [ ac_cv_have_size_t="no" ]
2028 )
2029])
2030if test "x$ac_cv_have_size_t" = "xyes" ; then
2031 AC_DEFINE(HAVE_SIZE_T)
2032fi
Damien Miller95058511999-12-29 10:36:45 +11002033
Damien Miller615f9392000-05-17 22:53:33 +10002034AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2035 AC_TRY_COMPILE(
2036 [
2037#include <sys/types.h>
2038 ],
2039 [ ssize_t foo; foo = 1235; ],
2040 [ ac_cv_have_ssize_t="yes" ],
2041 [ ac_cv_have_ssize_t="no" ]
2042 )
2043])
2044if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2045 AC_DEFINE(HAVE_SSIZE_T)
2046fi
2047
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002048AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2049 AC_TRY_COMPILE(
2050 [
2051#include <time.h>
2052 ],
2053 [ clock_t foo; foo = 1235; ],
2054 [ ac_cv_have_clock_t="yes" ],
2055 [ ac_cv_have_clock_t="no" ]
2056 )
2057])
2058if test "x$ac_cv_have_clock_t" = "xyes" ; then
2059 AC_DEFINE(HAVE_CLOCK_T)
2060fi
2061
Damien Millerb54b40e2000-06-23 08:23:34 +10002062AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2063 AC_TRY_COMPILE(
2064 [
2065#include <sys/types.h>
2066#include <sys/socket.h>
2067 ],
2068 [ sa_family_t foo; foo = 1235; ],
2069 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002070 [ AC_TRY_COMPILE(
2071 [
2072#include <sys/types.h>
2073#include <sys/socket.h>
2074#include <netinet/in.h>
2075 ],
2076 [ sa_family_t foo; foo = 1235; ],
2077 [ ac_cv_have_sa_family_t="yes" ],
2078
Damien Millerb54b40e2000-06-23 08:23:34 +10002079 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002080 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002081 )
2082])
2083if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2084 AC_DEFINE(HAVE_SA_FAMILY_T)
2085fi
2086
Damien Miller0f91b4e2000-06-18 15:43:25 +10002087AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2088 AC_TRY_COMPILE(
2089 [
2090#include <sys/types.h>
2091 ],
2092 [ pid_t foo; foo = 1235; ],
2093 [ ac_cv_have_pid_t="yes" ],
2094 [ ac_cv_have_pid_t="no" ]
2095 )
2096])
2097if test "x$ac_cv_have_pid_t" = "xyes" ; then
2098 AC_DEFINE(HAVE_PID_T)
2099fi
2100
2101AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2102 AC_TRY_COMPILE(
2103 [
2104#include <sys/types.h>
2105 ],
2106 [ mode_t foo; foo = 1235; ],
2107 [ ac_cv_have_mode_t="yes" ],
2108 [ ac_cv_have_mode_t="no" ]
2109 )
2110])
2111if test "x$ac_cv_have_mode_t" = "xyes" ; then
2112 AC_DEFINE(HAVE_MODE_T)
2113fi
2114
Damien Miller61e50f12000-05-08 20:49:37 +10002115
2116AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2117 AC_TRY_COMPILE(
2118 [
Damien Miller81171112000-04-23 11:14:01 +10002119#include <sys/types.h>
2120#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002121 ],
2122 [ struct sockaddr_storage s; ],
2123 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2124 [ ac_cv_have_struct_sockaddr_storage="no" ]
2125 )
2126])
2127if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2128 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2129fi
Damien Miller34132e52000-01-14 15:45:46 +11002130
Damien Miller61e50f12000-05-08 20:49:37 +10002131AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2132 AC_TRY_COMPILE(
2133 [
Damien Miller7b22d652000-06-18 14:07:04 +10002134#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002135#include <netinet/in.h>
2136 ],
2137 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2138 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2139 [ ac_cv_have_struct_sockaddr_in6="no" ]
2140 )
2141])
2142if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2143 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2144fi
Damien Miller34132e52000-01-14 15:45:46 +11002145
Damien Miller61e50f12000-05-08 20:49:37 +10002146AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2147 AC_TRY_COMPILE(
2148 [
Damien Miller7b22d652000-06-18 14:07:04 +10002149#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002150#include <netinet/in.h>
2151 ],
2152 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2153 [ ac_cv_have_struct_in6_addr="yes" ],
2154 [ ac_cv_have_struct_in6_addr="no" ]
2155 )
2156])
2157if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2158 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2159fi
Damien Miller34132e52000-01-14 15:45:46 +11002160
Damien Miller61e50f12000-05-08 20:49:37 +10002161AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2162 AC_TRY_COMPILE(
2163 [
Damien Miller81171112000-04-23 11:14:01 +10002164#include <sys/types.h>
2165#include <sys/socket.h>
2166#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002167 ],
2168 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2169 [ ac_cv_have_struct_addrinfo="yes" ],
2170 [ ac_cv_have_struct_addrinfo="no" ]
2171 )
2172])
2173if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2174 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2175fi
2176
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002177AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2178 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002179 [ #include <sys/time.h> ],
2180 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002181 [ ac_cv_have_struct_timeval="yes" ],
2182 [ ac_cv_have_struct_timeval="no" ]
2183 )
2184])
2185if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2186 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2187 have_struct_timeval=1
2188fi
2189
Tim Rice4e4dc562003-03-18 10:21:40 -08002190AC_CHECK_TYPES(struct timespec)
2191
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002192# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002193if test "x$ac_cv_have_int64_t" = "xno" && \
2194 test "x$ac_cv_sizeof_long_int" != "x8" && \
2195 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002196 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2197 echo "an alternative compiler (I.E., GCC) before continuing."
2198 echo ""
2199 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002200else
2201dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002202 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002203 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002204#include <stdio.h>
2205#include <string.h>
2206#ifdef HAVE_SNPRINTF
2207main()
2208{
2209 char buf[50];
2210 char expected_out[50];
2211 int mazsize = 50 ;
2212#if (SIZEOF_LONG_INT == 8)
2213 long int num = 0x7fffffffffffffff;
2214#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002215 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002216#endif
2217 strcpy(expected_out, "9223372036854775807");
2218 snprintf(buf, mazsize, "%lld", num);
2219 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002220 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002221 exit(0);
2222}
2223#else
2224main() { exit(0); }
2225#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002226 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002227 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002228 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002229fi
2230
Damien Miller78315eb2000-09-29 23:01:36 +11002231dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002232OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2233OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2234OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2235OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2236OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002237OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002238OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2239OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002240OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002241OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2242OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2243OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2244OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002245OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2246OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2247OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2248OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002249
2250AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002251
Damien Miller61e50f12000-05-08 20:49:37 +10002252AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2253 ac_cv_have_ss_family_in_struct_ss, [
2254 AC_TRY_COMPILE(
2255 [
Damien Miller81171112000-04-23 11:14:01 +10002256#include <sys/types.h>
2257#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002258 ],
2259 [ struct sockaddr_storage s; s.ss_family = 1; ],
2260 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2261 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2262 )
2263])
2264if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2265 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2266fi
2267
Damien Miller61e50f12000-05-08 20:49:37 +10002268AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2269 ac_cv_have___ss_family_in_struct_ss, [
2270 AC_TRY_COMPILE(
2271 [
Damien Miller81171112000-04-23 11:14:01 +10002272#include <sys/types.h>
2273#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002274 ],
2275 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2276 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2277 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2278 )
2279])
2280if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2281 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2282fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002283
Damien Millerad833b32000-08-23 10:46:23 +10002284AC_CACHE_CHECK([for pw_class field in struct passwd],
2285 ac_cv_have_pw_class_in_struct_passwd, [
2286 AC_TRY_COMPILE(
2287 [
Damien Millerad833b32000-08-23 10:46:23 +10002288#include <pwd.h>
2289 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002290 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002291 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2292 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2293 )
2294])
2295if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2296 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2297fi
2298
Kevin Steves82456952001-06-22 21:14:18 +00002299AC_CACHE_CHECK([for pw_expire field in struct passwd],
2300 ac_cv_have_pw_expire_in_struct_passwd, [
2301 AC_TRY_COMPILE(
2302 [
2303#include <pwd.h>
2304 ],
2305 [ struct passwd p; p.pw_expire = 0; ],
2306 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2307 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2308 )
2309])
2310if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2311 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2312fi
2313
2314AC_CACHE_CHECK([for pw_change field in struct passwd],
2315 ac_cv_have_pw_change_in_struct_passwd, [
2316 AC_TRY_COMPILE(
2317 [
2318#include <pwd.h>
2319 ],
2320 [ struct passwd p; p.pw_change = 0; ],
2321 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2322 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2323 )
2324])
2325if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2326 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2327fi
Damien Miller61e50f12000-05-08 20:49:37 +10002328
Tim Rice28bbb0c2002-05-27 17:37:32 -07002329dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002330AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2331 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002332 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002333 [
Tim Riceae49fe62002-04-12 10:26:21 -07002334#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002335#include <sys/socket.h>
2336#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002337int main() {
2338#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002339#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002340exit(1);
2341#endif
2342struct msghdr m;
2343m.msg_accrights = 0;
2344exit(0);
2345}
Kevin Steves939c9db2002-03-22 17:23:25 +00002346 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002347 [ ac_cv_have_accrights_in_msghdr="yes" ],
2348 [ ac_cv_have_accrights_in_msghdr="no" ]
2349 )
2350])
2351if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2352 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2353fi
2354
Kevin Stevesa44e0352002-04-07 16:18:03 +00002355AC_CACHE_CHECK([for msg_control field in struct msghdr],
2356 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002357 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002358 [
Tim Riceae49fe62002-04-12 10:26:21 -07002359#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002360#include <sys/socket.h>
2361#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002362int main() {
2363#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002364#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002365exit(1);
2366#endif
2367struct msghdr m;
2368m.msg_control = 0;
2369exit(0);
2370}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002371 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002372 [ ac_cv_have_control_in_msghdr="yes" ],
2373 [ ac_cv_have_control_in_msghdr="no" ]
2374 )
2375])
2376if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2377 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2378fi
2379
Damien Miller61e50f12000-05-08 20:49:37 +10002380AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002381 AC_TRY_LINK([],
2382 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002383 [ ac_cv_libc_defines___progname="yes" ],
2384 [ ac_cv_libc_defines___progname="no" ]
2385 )
2386])
2387if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2388 AC_DEFINE(HAVE___PROGNAME)
2389fi
2390
Kevin Steves4846f4a2002-03-22 18:19:53 +00002391AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2392 AC_TRY_LINK([
2393#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002394],
2395 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002396 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2397 [ ac_cv_cc_implements___FUNCTION__="no" ]
2398 )
2399])
2400if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2401 AC_DEFINE(HAVE___FUNCTION__)
2402fi
2403
2404AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2405 AC_TRY_LINK([
2406#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002407],
2408 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002409 [ ac_cv_cc_implements___func__="yes" ],
2410 [ ac_cv_cc_implements___func__="no" ]
2411 )
2412])
2413if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2414 AC_DEFINE(HAVE___func__)
2415fi
2416
Damien Miller4f8e6692001-07-14 13:22:53 +10002417AC_CACHE_CHECK([whether getopt has optreset support],
2418 ac_cv_have_getopt_optreset, [
2419 AC_TRY_LINK(
2420 [
2421#include <getopt.h>
2422 ],
2423 [ extern int optreset; optreset = 0; ],
2424 [ ac_cv_have_getopt_optreset="yes" ],
2425 [ ac_cv_have_getopt_optreset="no" ]
2426 )
2427])
2428if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2429 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2430fi
Damien Millera22ba012000-03-02 23:09:20 +11002431
Damien Millerecbb26d2000-07-15 14:59:14 +10002432AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002433 AC_TRY_LINK([],
2434 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002435 [ ac_cv_libc_defines_sys_errlist="yes" ],
2436 [ ac_cv_libc_defines_sys_errlist="no" ]
2437 )
2438])
2439if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2440 AC_DEFINE(HAVE_SYS_ERRLIST)
2441fi
2442
2443
Damien Miller11fa2cc2000-08-16 10:35:58 +10002444AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002445 AC_TRY_LINK([],
2446 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002447 [ ac_cv_libc_defines_sys_nerr="yes" ],
2448 [ ac_cv_libc_defines_sys_nerr="no" ]
2449 )
2450])
2451if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2452 AC_DEFINE(HAVE_SYS_NERR)
2453fi
2454
Damien Millera8e06ce2003-11-21 23:48:55 +11002455SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002456# Check whether user wants sectok support
2457AC_ARG_WITH(sectok,
2458 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002459 [
2460 if test "x$withval" != "xno" ; then
2461 if test "x$withval" != "xyes" ; then
2462 CPPFLAGS="$CPPFLAGS -I${withval}"
2463 LDFLAGS="$LDFLAGS -L${withval}"
2464 if test ! -z "$need_dash_r" ; then
2465 LDFLAGS="$LDFLAGS -R${withval}"
2466 fi
2467 if test ! -z "$blibpath" ; then
2468 blibpath="$blibpath:${withval}"
2469 fi
2470 fi
2471 AC_CHECK_HEADERS(sectok.h)
2472 if test "$ac_cv_header_sectok_h" != yes; then
2473 AC_MSG_ERROR(Can't find sectok.h)
2474 fi
2475 AC_CHECK_LIB(sectok, sectok_open)
2476 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2477 AC_MSG_ERROR(Can't find libsectok)
2478 fi
2479 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002480 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002481 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002482 fi
2483 ]
2484)
2485
2486# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002487OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002488AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002489 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2490 [
2491 if test "x$withval" != "xno" ; then
2492 if test "x$withval" != "xyes" ; then
2493 OPENSC_CONFIG=$withval/bin/opensc-config
2494 else
2495 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2496 fi
2497 if test "$OPENSC_CONFIG" != "no"; then
2498 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2499 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2500 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2501 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2502 AC_DEFINE(SMARTCARD)
2503 AC_DEFINE(USE_OPENSC)
2504 SCARD_MSG="yes, using OpenSC"
2505 fi
2506 fi
2507 ]
2508)
Damien Miller85de5802001-09-18 14:01:11 +10002509
Darren Tucker5f88d342003-10-15 16:57:57 +10002510# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002511AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002512 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002513 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002514 # Needed by our getrrsetbyname()
2515 AC_SEARCH_LIBS(res_query, resolv)
2516 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002517 AC_MSG_CHECKING(if res_query will link)
2518 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2519 [AC_MSG_RESULT(no)
2520 saved_LIBS="$LIBS"
2521 LIBS="$LIBS -lresolv"
2522 AC_MSG_CHECKING(for res_query in -lresolv)
2523 AC_LINK_IFELSE([
2524#include <resolv.h>
2525int main()
2526{
2527 res_query (0, 0, 0, 0, 0);
2528 return 0;
2529}
2530 ],
2531 [LIBS="$LIBS -lresolv"
2532 AC_MSG_RESULT(yes)],
2533 [LIBS="$saved_LIBS"
2534 AC_MSG_RESULT(no)])
2535 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002536 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002537 AC_CHECK_DECLS([_getshort, _getlong], , ,
2538 [#include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002539 AC_CHECK_MEMBER(HEADER.ad,
2540 [AC_DEFINE(HAVE_HEADER_AD)],,
2541 [#include <arpa/nameser.h>])
2542 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002543
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002544# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002545KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002546AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002547 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002548 [ if test "x$withval" != "xno" ; then
2549 if test "x$withval" = "xyes" ; then
2550 KRB5ROOT="/usr/local"
2551 else
2552 KRB5ROOT=${withval}
2553 fi
2554
2555 AC_DEFINE(KRB5)
2556 KRB5_MSG="yes"
2557
2558 AC_MSG_CHECKING(for krb5-config)
2559 if test -x $KRB5ROOT/bin/krb5-config ; then
2560 KRB5CONF=$KRB5ROOT/bin/krb5-config
2561 AC_MSG_RESULT($KRB5CONF)
2562
2563 AC_MSG_CHECKING(for gssapi support)
2564 if $KRB5CONF | grep gssapi >/dev/null ; then
2565 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002566 AC_DEFINE(GSSAPI)
2567 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002568 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002569 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002570 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002571 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002572 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2573 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002574 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002575 AC_MSG_CHECKING(whether we are using Heimdal)
2576 AC_TRY_COMPILE([ #include <krb5.h> ],
2577 [ char *tmp = heimdal_version; ],
2578 [ AC_MSG_RESULT(yes)
2579 AC_DEFINE(HEIMDAL) ],
2580 AC_MSG_RESULT(no)
2581 )
2582 else
2583 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002584 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002585 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002586 AC_MSG_CHECKING(whether we are using Heimdal)
2587 AC_TRY_COMPILE([ #include <krb5.h> ],
2588 [ char *tmp = heimdal_version; ],
2589 [ AC_MSG_RESULT(yes)
2590 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002591 K5LIBS="-lkrb5 -ldes"
2592 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002593 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002594 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002595 ],
2596 [ AC_MSG_RESULT(no)
2597 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2598 ]
2599 )
Damien Miller200d0a72003-06-30 19:21:36 +10002600 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002601
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002602 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2603 [ AC_DEFINE(GSSAPI)
2604 K5LIBS="-lgssapi $K5LIBS" ],
2605 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2606 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002607 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002608 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2609 $K5LIBS)
2610 ],
2611 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002612
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002613 AC_CHECK_HEADER(gssapi.h, ,
2614 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002615 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002616 AC_CHECK_HEADERS(gssapi.h, ,
2617 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002618 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002619 ]
2620 )
2621
2622 oldCPP="$CPPFLAGS"
2623 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2624 AC_CHECK_HEADER(gssapi_krb5.h, ,
2625 [ CPPFLAGS="$oldCPP" ])
2626
Damien Millera8e06ce2003-11-21 23:48:55 +11002627 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002628 if test ! -z "$need_dash_r" ; then
2629 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2630 fi
2631 if test ! -z "$blibpath" ; then
2632 blibpath="$blibpath:${KRB5ROOT}/lib"
2633 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002634 fi
2635
2636 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2637 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2638 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2639
2640 LIBS="$LIBS $K5LIBS"
2641 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002642 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002643 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002644)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002645
Damien Millera22ba012000-03-02 23:09:20 +11002646# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002647
Damien Millerf58c6722002-05-13 13:15:42 +10002648PRIVSEP_PATH=/var/empty
2649AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002650 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002651 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002652 if test -n "$withval" && test "x$withval" != "xno" && \
2653 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002654 PRIVSEP_PATH=$withval
2655 fi
2656 ]
2657)
2658AC_SUBST(PRIVSEP_PATH)
2659
Damien Millera22ba012000-03-02 23:09:20 +11002660AC_ARG_WITH(xauth,
2661 [ --with-xauth=PATH Specify path to xauth program ],
2662 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002663 if test -n "$withval" && test "x$withval" != "xno" && \
2664 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002665 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002666 fi
2667 ],
2668 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002669 TestPath="$PATH"
2670 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2671 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2672 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2673 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2674 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002675 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002676 xauth_path="/usr/openwin/bin/xauth"
2677 fi
2678 ]
2679)
2680
Damien Miller7d901272003-01-13 16:55:22 +11002681STRIP_OPT=-s
2682AC_ARG_ENABLE(strip,
2683 [ --disable-strip Disable calling strip(1) on install],
2684 [
2685 if test "x$enableval" = "xno" ; then
2686 STRIP_OPT=
2687 fi
2688 ]
2689)
2690AC_SUBST(STRIP_OPT)
2691
Damien Millera19cf472000-11-29 13:28:50 +11002692if test -z "$xauth_path" ; then
2693 XAUTH_PATH="undefined"
2694 AC_SUBST(XAUTH_PATH)
2695else
Damien Millera22ba012000-03-02 23:09:20 +11002696 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002697 XAUTH_PATH=$xauth_path
2698 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002699fi
Damien Millera22ba012000-03-02 23:09:20 +11002700
2701# Check for mail directory (last resort if we cannot get it from headers)
2702if test ! -z "$MAIL" ; then
2703 maildir=`dirname $MAIL`
2704 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2705fi
2706
Darren Tucker623d92f2004-09-12 22:36:15 +10002707if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002708 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2709 disable_ptmx_check=yes
2710fi
Damien Millera22ba012000-03-02 23:09:20 +11002711if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002712 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002713 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002714 [
2715 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2716 have_dev_ptmx=1
2717 ]
2718 )
2719 fi
Damien Millera22ba012000-03-02 23:09:20 +11002720fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002721
Darren Tucker623d92f2004-09-12 22:36:15 +10002722if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002723 AC_CHECK_FILE("/dev/ptc",
2724 [
2725 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2726 have_dev_ptc=1
2727 ]
2728 )
2729else
2730 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2731fi
Damien Miller204ad072000-03-02 23:56:12 +11002732
Damien Millera22ba012000-03-02 23:09:20 +11002733# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002734AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002735 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002736 [
Damien Miller897741e2001-04-16 10:41:46 +10002737 case "$withval" in
2738 man|cat|doc)
2739 MANTYPE=$withval
2740 ;;
2741 *)
2742 AC_MSG_ERROR(invalid man type: $withval)
2743 ;;
2744 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002745 ]
2746)
Ben Lindstrombc709922001-04-18 18:04:21 +00002747if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002748 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2749 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002750 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2751 MANTYPE=doc
2752 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2753 MANTYPE=man
2754 else
2755 MANTYPE=cat
2756 fi
2757fi
Damien Miller670a4b82000-01-22 13:53:11 +11002758AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002759if test "$MANTYPE" = "doc"; then
2760 mansubdir=man;
2761else
2762 mansubdir=$MANTYPE;
2763fi
2764AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002765
Damien Millera22ba012000-03-02 23:09:20 +11002766# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002767MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002768AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002769 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002770 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002771 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002772 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002773 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002774 fi
2775 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002776)
2777
Damien Millera22ba012000-03-02 23:09:20 +11002778# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002779AC_ARG_WITH(shadow,
2780 [ --without-shadow Disable shadow password support],
2781 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002782 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002783 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002784 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002785 fi
2786 ]
2787)
2788
Damien Miller1f335fb2000-06-26 11:31:33 +10002789if test -z "$disable_shadow" ; then
2790 AC_MSG_CHECKING([if the systems has expire shadow information])
2791 AC_TRY_COMPILE(
2792 [
2793#include <sys/types.h>
2794#include <shadow.h>
2795 struct spwd sp;
2796 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2797 [ sp_expire_available=yes ], []
2798 )
2799
2800 if test "x$sp_expire_available" = "xyes" ; then
2801 AC_MSG_RESULT(yes)
2802 AC_DEFINE(HAS_SHADOW_EXPIRE)
2803 else
2804 AC_MSG_RESULT(no)
2805 fi
2806fi
2807
Damien Millera22ba012000-03-02 23:09:20 +11002808# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002809if test ! -z "$IPADDR_IN_DISPLAY" ; then
2810 DISPLAY_HACK_MSG="yes"
2811 AC_DEFINE(IPADDR_IN_DISPLAY)
2812else
Damien Millera8e06ce2003-11-21 23:48:55 +11002813 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002814 AC_ARG_WITH(ipaddr-display,
2815 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2816 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002817 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002818 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002819 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002820 fi
2821 ]
2822 )
2823fi
Damien Miller76112de1999-12-21 11:18:08 +11002824
Darren Tuckere1a790d2003-09-16 11:52:19 +10002825# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002826AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002827 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002828 [ if test "x$enableval" = "xno"; then
2829 AC_MSG_NOTICE([/etc/default/login handling disabled])
2830 etc_default_login=no
2831 else
2832 etc_default_login=yes
2833 fi ],
2834 [ etc_default_login=yes ]
2835)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002836
Darren Tucker2f9573d2005-02-10 22:28:54 +11002837if test "x$etc_default_login" != "xno"; then
2838 AC_CHECK_FILE("/etc/default/login",
2839 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002840 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2841 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002842 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2843 elif test "x$external_path_file" = "x/etc/default/login"; then
2844 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2845 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002846fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002847
Tim Rice43a1c132002-04-17 21:19:14 -07002848dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002849if test $ac_cv_func_login_getcapbool = "yes" && \
2850 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002851 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002852fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002853
Damien Millera22ba012000-03-02 23:09:20 +11002854# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002855SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002856AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002857 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002858 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002859 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002860 AC_MSG_WARN([
2861--with-default-path=PATH has no effect on this system.
2862Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002863 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002864 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002865 AC_MSG_WARN([
2866--with-default-path=PATH will only be used if PATH is not defined in
2867$external_path_file .])
2868 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002869 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002870 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002871 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002872 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002873 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2874 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002875 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002876 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002877 AC_MSG_WARN([
2878If PATH is defined in $external_path_file, ensure the path to scp is included,
2879otherwise scp will not work.])
2880 fi
2881 AC_TRY_RUN(
2882 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002883/* find out what STDPATH is */
2884#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002885#ifdef HAVE_PATHS_H
2886# include <paths.h>
2887#endif
2888#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002889# ifdef _PATH_USERPATH /* Irix */
2890# define _PATH_STDPATH _PATH_USERPATH
2891# else
2892# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2893# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002894#endif
2895#include <sys/types.h>
2896#include <sys/stat.h>
2897#include <fcntl.h>
2898#define DATA "conftest.stdpath"
2899
2900main()
2901{
2902 FILE *fd;
2903 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002904
Tim Rice59ea0a02001-03-10 13:50:45 -08002905 fd = fopen(DATA,"w");
2906 if(fd == NULL)
2907 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002908
Tim Rice59ea0a02001-03-10 13:50:45 -08002909 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2910 exit(1);
2911
2912 exit(0);
2913}
2914 ], [ user_path=`cat conftest.stdpath` ],
2915 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2916 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2917 )
2918# make sure $bindir is in USER_PATH so scp will work
2919 t_bindir=`eval echo ${bindir}`
2920 case $t_bindir in
2921 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2922 esac
2923 case $t_bindir in
2924 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2925 esac
2926 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2927 if test $? -ne 0 ; then
2928 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2929 if test $? -ne 0 ; then
2930 user_path=$user_path:$t_bindir
2931 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2932 fi
2933 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002934 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002935)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002936if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002937 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2938 AC_SUBST(user_path)
2939fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002940
Damien Millera18bbd32002-05-13 10:48:57 +10002941# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002942AC_ARG_WITH(superuser-path,
2943 [ --with-superuser-path= Specify different path for super-user],
2944 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002945 if test -n "$withval" && test "x$withval" != "xno" && \
2946 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002947 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2948 superuser_path=$withval
2949 fi
2950 ]
2951)
2952
2953
Damien Miller61e50f12000-05-08 20:49:37 +10002954AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002955IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002956AC_ARG_WITH(4in6,
2957 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2958 [
2959 if test "x$withval" != "xno" ; then
2960 AC_MSG_RESULT(yes)
2961 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002962 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002963 else
2964 AC_MSG_RESULT(no)
2965 fi
2966 ],[
2967 if test "x$inet6_default_4in6" = "xyes"; then
2968 AC_MSG_RESULT([yes (default)])
2969 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002970 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002971 else
2972 AC_MSG_RESULT([no (default)])
2973 fi
2974 ]
2975)
2976
Damien Miller60396b02001-02-18 17:01:00 +11002977# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002978BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002979AC_ARG_WITH(bsd-auth,
2980 [ --with-bsd-auth Enable BSD auth support],
2981 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002982 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002983 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002984 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002985 fi
2986 ]
2987)
2988
Damien Millera22ba012000-03-02 23:09:20 +11002989# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002990piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002991# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002992if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002993 piddir=`eval echo ${sysconfdir}`
2994 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002995 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002996 esac
2997fi
2998
Tim Rice88f2ab52002-03-17 12:17:34 -08002999AC_ARG_WITH(pid-dir,
3000 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3001 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003002 if test -n "$withval" && test "x$withval" != "xno" && \
3003 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003004 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003005 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003006 AC_MSG_WARN([** no $piddir directory on this system **])
3007 fi
3008 fi
3009 ]
3010)
3011
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003012AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003013AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003014
andre2ff7b5d2000-06-03 14:57:40 +00003015dnl allow user to disable some login recording features
3016AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003017 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003018 [
3019 if test "x$enableval" = "xno" ; then
3020 AC_DEFINE(DISABLE_LASTLOG)
3021 fi
3022 ]
andre2ff7b5d2000-06-03 14:57:40 +00003023)
3024AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003025 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003026 [
3027 if test "x$enableval" = "xno" ; then
3028 AC_DEFINE(DISABLE_UTMP)
3029 fi
3030 ]
andre2ff7b5d2000-06-03 14:57:40 +00003031)
3032AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003033 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003034 [
3035 if test "x$enableval" = "xno" ; then
3036 AC_DEFINE(DISABLE_UTMPX)
3037 fi
3038 ]
andre2ff7b5d2000-06-03 14:57:40 +00003039)
3040AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003041 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003042 [
3043 if test "x$enableval" = "xno" ; then
3044 AC_DEFINE(DISABLE_WTMP)
3045 fi
3046 ]
andre2ff7b5d2000-06-03 14:57:40 +00003047)
3048AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003049 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003050 [
3051 if test "x$enableval" = "xno" ; then
3052 AC_DEFINE(DISABLE_WTMPX)
3053 fi
3054 ]
andre2ff7b5d2000-06-03 14:57:40 +00003055)
3056AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003057 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003058 [
3059 if test "x$enableval" = "xno" ; then
3060 AC_DEFINE(DISABLE_LOGIN)
3061 fi
3062 ]
andre2ff7b5d2000-06-03 14:57:40 +00003063)
3064AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003065 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003066 [
3067 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003068 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003069 fi
3070 ]
andre2ff7b5d2000-06-03 14:57:40 +00003071)
3072AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003073 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003074 [
3075 if test "x$enableval" = "xno" ; then
3076 AC_DEFINE(DISABLE_PUTUTXLINE)
3077 fi
3078 ]
andre2ff7b5d2000-06-03 14:57:40 +00003079)
3080AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003081 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003082 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003083 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003084 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003085 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003086 conf_lastlog_location=$withval
3087 fi
3088 ]
3089)
andre2ff7b5d2000-06-03 14:57:40 +00003090
3091dnl lastlog, [uw]tmpx? detection
3092dnl NOTE: set the paths in the platform section to avoid the
3093dnl need for command-line parameters
3094dnl lastlog and [uw]tmp are subject to a file search if all else fails
3095
3096dnl lastlog detection
3097dnl NOTE: the code itself will detect if lastlog is a directory
3098AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3099AC_TRY_COMPILE([
3100#include <sys/types.h>
3101#include <utmp.h>
3102#ifdef HAVE_LASTLOG_H
3103# include <lastlog.h>
3104#endif
Damien Miller2994e082000-06-04 15:51:47 +10003105#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003106# include <paths.h>
3107#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003108#ifdef HAVE_LOGIN_H
3109# include <login.h>
3110#endif
andre2ff7b5d2000-06-03 14:57:40 +00003111 ],
3112 [ char *lastlog = LASTLOG_FILE; ],
3113 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003114 [
3115 AC_MSG_RESULT(no)
3116 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3117 AC_TRY_COMPILE([
3118#include <sys/types.h>
3119#include <utmp.h>
3120#ifdef HAVE_LASTLOG_H
3121# include <lastlog.h>
3122#endif
3123#ifdef HAVE_PATHS_H
3124# include <paths.h>
3125#endif
3126 ],
3127 [ char *lastlog = _PATH_LASTLOG; ],
3128 [ AC_MSG_RESULT(yes) ],
3129 [
andree441aa32000-06-12 22:34:38 +00003130 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003131 system_lastlog_path=no
3132 ])
3133 ]
andre2ff7b5d2000-06-03 14:57:40 +00003134)
Damien Miller2994e082000-06-04 15:51:47 +10003135
andre2ff7b5d2000-06-03 14:57:40 +00003136if test -z "$conf_lastlog_location"; then
3137 if test x"$system_lastlog_path" = x"no" ; then
3138 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003139 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003140 conf_lastlog_location=$f
3141 fi
3142 done
3143 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003144 AC_MSG_WARN([** Cannot find lastlog **])
3145 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003146 fi
3147 fi
3148fi
3149
3150if test -n "$conf_lastlog_location"; then
3151 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003152fi
andre2ff7b5d2000-06-03 14:57:40 +00003153
3154dnl utmp detection
3155AC_MSG_CHECKING([if your system defines UTMP_FILE])
3156AC_TRY_COMPILE([
3157#include <sys/types.h>
3158#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003159#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003160# include <paths.h>
3161#endif
3162 ],
3163 [ char *utmp = UTMP_FILE; ],
3164 [ AC_MSG_RESULT(yes) ],
3165 [ AC_MSG_RESULT(no)
3166 system_utmp_path=no ]
3167)
3168if test -z "$conf_utmp_location"; then
3169 if test x"$system_utmp_path" = x"no" ; then
3170 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3171 if test -f $f ; then
3172 conf_utmp_location=$f
3173 fi
3174 done
3175 if test -z "$conf_utmp_location"; then
3176 AC_DEFINE(DISABLE_UTMP)
3177 fi
3178 fi
3179fi
3180if test -n "$conf_utmp_location"; then
3181 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003182fi
andre2ff7b5d2000-06-03 14:57:40 +00003183
3184dnl wtmp detection
3185AC_MSG_CHECKING([if your system defines WTMP_FILE])
3186AC_TRY_COMPILE([
3187#include <sys/types.h>
3188#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003189#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003190# include <paths.h>
3191#endif
3192 ],
3193 [ char *wtmp = WTMP_FILE; ],
3194 [ AC_MSG_RESULT(yes) ],
3195 [ AC_MSG_RESULT(no)
3196 system_wtmp_path=no ]
3197)
3198if test -z "$conf_wtmp_location"; then
3199 if test x"$system_wtmp_path" = x"no" ; then
3200 for f in /usr/adm/wtmp /var/log/wtmp; do
3201 if test -f $f ; then
3202 conf_wtmp_location=$f
3203 fi
3204 done
3205 if test -z "$conf_wtmp_location"; then
3206 AC_DEFINE(DISABLE_WTMP)
3207 fi
3208 fi
3209fi
3210if test -n "$conf_wtmp_location"; then
3211 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003212fi
andre2ff7b5d2000-06-03 14:57:40 +00003213
3214
3215dnl utmpx detection - I don't know any system so perverse as to require
3216dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3217dnl there, though.
3218AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3219AC_TRY_COMPILE([
3220#include <sys/types.h>
3221#include <utmp.h>
3222#ifdef HAVE_UTMPX_H
3223#include <utmpx.h>
3224#endif
Damien Miller2994e082000-06-04 15:51:47 +10003225#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003226# include <paths.h>
3227#endif
3228 ],
3229 [ char *utmpx = UTMPX_FILE; ],
3230 [ AC_MSG_RESULT(yes) ],
3231 [ AC_MSG_RESULT(no)
3232 system_utmpx_path=no ]
3233)
3234if test -z "$conf_utmpx_location"; then
3235 if test x"$system_utmpx_path" = x"no" ; then
3236 AC_DEFINE(DISABLE_UTMPX)
3237 fi
3238else
3239 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003240fi
andre2ff7b5d2000-06-03 14:57:40 +00003241
3242dnl wtmpx detection
3243AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3244AC_TRY_COMPILE([
3245#include <sys/types.h>
3246#include <utmp.h>
3247#ifdef HAVE_UTMPX_H
3248#include <utmpx.h>
3249#endif
Damien Miller2994e082000-06-04 15:51:47 +10003250#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003251# include <paths.h>
3252#endif
3253 ],
3254 [ char *wtmpx = WTMPX_FILE; ],
3255 [ AC_MSG_RESULT(yes) ],
3256 [ AC_MSG_RESULT(no)
3257 system_wtmpx_path=no ]
3258)
3259if test -z "$conf_wtmpx_location"; then
3260 if test x"$system_wtmpx_path" = x"no" ; then
3261 AC_DEFINE(DISABLE_WTMPX)
3262 fi
3263else
3264 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003265fi
andre2ff7b5d2000-06-03 14:57:40 +00003266
Damien Miller4018c192000-04-30 09:30:44 +10003267
Damien Miller29ea30d2000-03-17 10:54:15 +11003268if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003269 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3270 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003271fi
3272
Tim Rice4cec93f2002-02-26 08:40:48 -08003273dnl remove pam and dl because they are in $LIBPAM
3274if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003275 LIBS=`echo $LIBS | sed 's/-lpam //'`
3276fi
3277if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3278 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003279fi
3280
Damien Millerbac2d8a2000-09-05 16:13:06 +11003281AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003282AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3283 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003284AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003285
Damien Miller7b22d652000-06-18 14:07:04 +10003286# Print summary of options
3287
Damien Miller7b22d652000-06-18 14:07:04 +10003288# Someone please show me a better way :)
3289A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3290B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3291C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3292D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003293E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003294F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003295G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003296H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3297I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3298J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003299
3300echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003301echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003302echo " User binaries: $B"
3303echo " System binaries: $C"
3304echo " Configuration files: $D"
3305echo " Askpass program: $E"
3306echo " Manual pages: $F"
3307echo " PID file: $G"
3308echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003309if test "x$external_path_file" = "x/etc/login.conf" ; then
3310echo " At runtime, sshd will use the path defined in $external_path_file"
3311echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003312else
Damien Millerf58c6722002-05-13 13:15:42 +10003313echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003314 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003315echo " (If PATH is set in $external_path_file it will be used instead. If"
3316echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3317 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003318fi
Damien Millera18bbd32002-05-13 10:48:57 +10003319if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003320echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003321fi
Damien Millerf58c6722002-05-13 13:15:42 +10003322echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003323echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003324echo " KerberosV support: $KRB5_MSG"
3325echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003326echo " S/KEY support: $SKEY_MSG"
3327echo " TCP Wrappers support: $TCPW_MSG"
3328echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003329echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003330echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003331echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3332echo " BSD Auth support: $BSD_AUTH_MSG"
3333echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003334if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003335echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003336fi
3337
Damien Miller7b22d652000-06-18 14:07:04 +10003338echo ""
3339
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003340echo " Host: ${host}"
3341echo " Compiler: ${CC}"
3342echo " Compiler flags: ${CFLAGS}"
3343echo "Preprocessor flags: ${CPPFLAGS}"
3344echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003345echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003346
3347echo ""
3348
Tim Rice6f1f7582004-05-30 21:38:51 -07003349if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003350 echo "SVR4 style packages are supported with \"make package\""
3351 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003352fi
3353
Damien Miller82cf0ce2000-12-20 13:34:48 +11003354if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003355 echo "PAM is enabled. You may need to install a PAM control file "
3356 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003357 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003358 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003359 echo ""
3360fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003361
Damien Miller6c21c512002-01-22 21:57:53 +11003362if test ! -z "$RAND_HELPER_CMDHASH" ; then
3363 echo "WARNING: you are using the builtin random number collection "
3364 echo "service. Please read WARNING.RNG and request that your OS "
3365 echo "vendor includes kernel-based random number collection in "
3366 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003367 echo ""
3368fi
Damien Miller60396b02001-02-18 17:01:00 +11003369
Damien Millerb4097182004-05-23 14:09:40 +10003370if test ! -z "$NO_PEERCHECK" ; then
3371 echo "WARNING: the operating system that you are using does not "
3372 echo "appear to support either the getpeereid() API nor the "
3373 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3374 echo "enforce security checks to prevent unauthorised connections to "
3375 echo "ssh-agent. Their absence increases the risk that a malicious "
3376 echo "user can connect to your agent. "
3377 echo ""
3378fi
3379
Darren Tuckerd9f88912005-02-20 21:01:48 +11003380if test "$AUDIT_MODULE" = "bsm" ; then
3381 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3382 echo "See the Solaris section in README.platform for details."
3383fi