blob: 61132acd09b0221eaa7b69bc281c5b924aad1e41 [file] [log] [blame]
Tim Rice4dbacff2005-06-01 20:09:28 -07001# $Id: configure.ac,v 1.271 2005/06/02 03:09:28 tim 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])
Tim Rice4dbacff2005-06-01 20:09:28 -0700374 case "$host" in
375 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
376 TEST_SHELL=/u95/bin/sh
377 ;;
378 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100379 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100380*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100381 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800382# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100383*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800384 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100385 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800386# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100387*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800388 if test -z "$GCC"; then
389 CFLAGS="$CFLAGS -belf"
390 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100391 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000392 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100393 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000394 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000395 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700396 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700397 AC_DEFINE(SETEUID_BREAKS_SETUID)
398 AC_DEFINE(BROKEN_SETREUID)
399 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700400 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700401 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100402 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100403 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700404 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700405 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000406 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000407*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100408 AC_DEFINE(NO_SSH_LASTLOG)
409 AC_DEFINE(SETEUID_BREAKS_SETUID)
410 AC_DEFINE(BROKEN_SETREUID)
411 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000412 AC_DEFINE(USE_PIPES)
413 AC_DEFINE(DISABLE_FD_PASSING)
414 LDFLAGS="$LDFLAGS"
415 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
416 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000417 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000418*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100419 AC_DEFINE(SETEUID_BREAKS_SETUID)
420 AC_DEFINE(BROKEN_SETREUID)
421 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000422 AC_DEFINE(WITH_ABBREV_NO_TTY)
423 AC_DEFINE(USE_PIPES)
424 AC_DEFINE(DISABLE_FD_PASSING)
425 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100426 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000427 MANTYPE=cat
428 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000429*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100430 AC_DEFINE(SETEUID_BREAKS_SETUID)
431 AC_DEFINE(BROKEN_SETREUID)
432 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000433 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700434 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700435 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000436 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
437 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
438 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700439 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000440*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000441 AC_MSG_CHECKING(for Digital Unix SIA)
442 no_osfsia=""
443 AC_ARG_WITH(osfsia,
444 [ --with-osfsia Enable Digital Unix SIA],
445 [
446 if test "x$withval" = "xno" ; then
447 AC_MSG_RESULT(disabled)
448 no_osfsia=1
449 fi
450 ],
451 )
452 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000453 if test -f /etc/sia/matrix.conf; then
454 AC_MSG_RESULT(yes)
455 AC_DEFINE(HAVE_OSF_SIA)
456 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000457 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000458 LIBS="$LIBS -lsecurity -ldb -lm -laud"
459 else
460 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100461 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000462 fi
463 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000464 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700465 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000466 AC_DEFINE(BROKEN_SETREUID)
467 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000468 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000469
470*-*-nto-qnx)
471 AC_DEFINE(USE_PIPES)
472 AC_DEFINE(NO_X11_UNIX_SOCKETS)
473 AC_DEFINE(MISSING_NFDBITS)
474 AC_DEFINE(MISSING_HOWMANY)
475 AC_DEFINE(MISSING_FD_MASK)
476 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000477
478*-*-ultrix*)
479 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
480 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
481 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
482 AC_CHECK_HEADERS(sys/syslog.h)
Damien Miller76112de1999-12-21 11:18:08 +1100483esac
484
Damien Millere37bfc12000-06-05 09:37:43 +1000485# Allow user to specify flags
486AC_ARG_WITH(cflags,
487 [ --with-cflags Specify additional flags to pass to compiler],
488 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800489 if test -n "$withval" && test "x$withval" != "xno" && \
490 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000491 CFLAGS="$CFLAGS $withval"
492 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800493 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000494)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000495AC_ARG_WITH(cppflags,
496 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
497 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800498 if test -n "$withval" && test "x$withval" != "xno" && \
499 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000500 CPPFLAGS="$CPPFLAGS $withval"
501 fi
502 ]
503)
Damien Millere37bfc12000-06-05 09:37:43 +1000504AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000505 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000506 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800507 if test -n "$withval" && test "x$withval" != "xno" && \
508 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000509 LDFLAGS="$LDFLAGS $withval"
510 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800511 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000512)
513AC_ARG_WITH(libs,
514 [ --with-libs Specify additional libraries to link with],
515 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800516 if test -n "$withval" && test "x$withval" != "xno" && \
517 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000518 LIBS="$LIBS $withval"
519 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800520 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000521)
522
Darren Tucker6eb93042003-06-29 21:30:41 +1000523AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000524AC_RUN_IFELSE(
525 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000526#include <stdio.h>
527int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000528 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000529 [ AC_MSG_RESULT(yes) ],
530 [
531 AC_MSG_RESULT(no)
532 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000533 ],
534 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000535)
536
Darren Tucker0c9653f2005-05-28 15:58:14 +1000537dnl Checks for header files.
538AC_CHECK_HEADERS( \
539 bstring.h \
540 crypt.h \
541 dirent.h \
542 endian.h \
543 features.h \
544 floatingpoint.h \
545 getopt.h \
546 glob.h \
547 ia.h \
548 lastlog.h \
549 limits.h \
550 login.h \
551 login_cap.h \
552 maillock.h \
553 ndir.h \
554 netdb.h \
555 netgroup.h \
556 netinet/in_systm.h \
557 pam/pam_appl.h \
558 paths.h \
559 pty.h \
560 readpassphrase.h \
561 rpc/types.h \
562 security/pam_appl.h \
563 shadow.h \
564 stddef.h \
565 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000566 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000567 strings.h \
568 sys/audit.h \
569 sys/bitypes.h \
570 sys/bsdtty.h \
571 sys/cdefs.h \
572 sys/dir.h \
573 sys/mman.h \
574 sys/ndir.h \
575 sys/prctl.h \
576 sys/pstat.h \
577 sys/select.h \
578 sys/stat.h \
579 sys/stream.h \
580 sys/stropts.h \
581 sys/strtio.h \
582 sys/sysmacros.h \
583 sys/time.h \
584 sys/timers.h \
585 sys/un.h \
586 time.h \
587 tmpdir.h \
588 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000589 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000590 usersec.h \
591 util.h \
592 utime.h \
593 utmp.h \
594 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000595 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000596)
Tim Rice4cec93f2002-02-26 08:40:48 -0800597
Darren Tucker48d99d32004-08-29 17:04:50 +1000598# sys/ptms.h requires sys/stream.h to be included first on Solaris
599AC_CHECK_HEADERS(sys/ptms.h, [], [], [
600#ifdef HAVE_SYS_STREAM_H
601# include <sys/stream.h>
602#endif
603])
604
Damien Millera22ba012000-03-02 23:09:20 +1100605# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700606AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
607AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000608
Tim Rice1e1ef642003-09-11 22:19:31 -0700609dnl IRIX and Solaris 2.5.1 have dirname() in libgen
610AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
611 AC_CHECK_LIB(gen, dirname,[
612 AC_CACHE_CHECK([for broken dirname],
613 ac_cv_have_broken_dirname, [
614 save_LIBS="$LIBS"
615 LIBS="$LIBS -lgen"
616 AC_TRY_RUN(
617 [
618#include <libgen.h>
619#include <string.h>
620
621int main(int argc, char **argv) {
622 char *s, buf[32];
623
624 strncpy(buf,"/etc", 32);
625 s = dirname(buf);
626 if (!s || strncmp(s, "/", 32) != 0) {
627 exit(1);
628 } else {
629 exit(0);
630 }
631}
632 ],
633 [ ac_cv_have_broken_dirname="no" ],
634 [ ac_cv_have_broken_dirname="yes" ]
635 )
636 LIBS="$save_LIBS"
637 ])
638 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
639 LIBS="$LIBS -lgen"
640 AC_DEFINE(HAVE_DIRNAME)
641 AC_CHECK_HEADERS(libgen.h)
642 fi
643 ])
644])
645
646AC_CHECK_FUNC(getspnam, ,
647 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
648AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
649
Tim Rice13aae5e2001-10-21 17:53:58 -0700650dnl zlib is required
651AC_ARG_WITH(zlib,
652 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100653 [ if test "x$withval" = "xno" ; then
654 AC_MSG_ERROR([*** zlib is required ***])
655 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700656 if test -d "$withval/lib"; then
657 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700658 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700659 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700660 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700661 fi
662 else
663 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700664 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700665 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700666 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700667 fi
668 fi
669 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700670 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700671 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700672 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700673 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100674 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700675)
676
Tim Ricefcb62202004-01-23 18:35:16 -0800677AC_CHECK_LIB(z, deflate, ,
678 [
679 saved_CPPFLAGS="$CPPFLAGS"
680 saved_LDFLAGS="$LDFLAGS"
681 save_LIBS="$LIBS"
682 dnl Check default zlib install dir
683 if test -n "${need_dash_r}"; then
684 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
685 else
686 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
687 fi
688 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
689 LIBS="$LIBS -lz"
690 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
691 [
692 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
693 ]
694 )
695 ]
696)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100697AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100698
699AC_ARG_WITH(zlib-version-check,
700 [ --without-zlib-version-check Disable zlib version check],
701 [ if test "x$withval" = "xno" ; then
702 zlib_check_nonfatal=1
703 fi
704 ]
705)
706
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000707AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000708AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000709#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100710#include <zlib.h>
711int main()
712{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000713 int a=0, b=0, c=0, d=0, n, v;
714 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
715 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100716 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000717 v = a*1000000 + b*10000 + c*100 + d;
718 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
719
720 /* 1.1.4 is OK */
721 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100722 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000723
724 /* 1.2.1.2 and up are OK */
725 if (v >= 1020102)
726 exit(0);
727
Darren Tucker2dcd2392004-01-23 17:13:33 +1100728 exit(2);
729}
Darren Tucker623d92f2004-09-12 22:36:15 +1000730 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000731 AC_MSG_RESULT(no),
732 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100733 if test -z "$zlib_check_nonfatal" ; then
734 AC_MSG_ERROR([*** zlib too old - check config.log ***
735Your reported zlib version has known security problems. It's possible your
736vendor has fixed these problems without changing the version number. If you
737are sure this is the case, you can disable the check by running
738"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000739If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
740See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100741 else
742 AC_MSG_WARN([zlib version may have security problems])
743 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000744 ],
745 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100746)
Damien Miller6f9c3372000-10-25 10:06:04 +1100747
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000748dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100749AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000750 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
751)
Damien Millera8e06ce2003-11-21 23:48:55 +1100752AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700753 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
754 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000755)
Damien Millerab18c411999-11-11 10:40:23 +1100756
Tim Ricee589a292001-11-03 11:09:32 -0800757dnl Checks for libutil functions
758AC_CHECK_HEADERS(libutil.h)
759AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
760AC_CHECK_FUNCS(logout updwtmp logwtmp)
761
Ben Lindstrom8697e082001-02-24 21:41:10 +0000762AC_FUNC_STRFTIME
763
Damien Miller3c027682001-03-14 11:39:45 +1100764# Check for ALTDIRFUNC glob() extension
765AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
766AC_EGREP_CPP(FOUNDIT,
767 [
768 #include <glob.h>
769 #ifdef GLOB_ALTDIRFUNC
770 FOUNDIT
771 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100772 ],
Damien Miller3c027682001-03-14 11:39:45 +1100773 [
774 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
775 AC_MSG_RESULT(yes)
776 ],
777 [
778 AC_MSG_RESULT(no)
779 ]
780)
Damien Millerab18c411999-11-11 10:40:23 +1100781
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000782# Check for g.gl_matchc glob() extension
783AC_MSG_CHECKING(for gl_matchc field in glob_t)
784AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100785 [
786 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000787 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100788 ],
789 [
790 AC_DEFINE(GLOB_HAS_GL_MATCHC)
791 AC_MSG_RESULT(yes)
792 ],
793 [
794 AC_MSG_RESULT(no)
795 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000796)
797
Damien Miller18bb4732001-03-28 14:35:30 +1000798AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000799AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000800 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000801#include <sys/types.h>
802#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700803int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000804 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100805 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000806 [
807 AC_MSG_RESULT(no)
808 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000809 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800810 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000811 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
812 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000813 ]
814)
815
Damien Miller36f49652004-08-15 18:40:59 +1000816AC_MSG_CHECKING([for /proc/pid/fd directory])
817if test -d "/proc/$$/fd" ; then
818 AC_DEFINE(HAVE_PROC_PID)
819 AC_MSG_RESULT(yes)
820else
821 AC_MSG_RESULT(no)
822fi
823
Damien Millerc547bf12001-02-16 10:18:12 +1100824# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100825SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100826AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100827 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100828 [
829 if test "x$withval" != "xno" ; then
830
831 if test "x$withval" != "xyes" ; then
832 CPPFLAGS="$CPPFLAGS -I${withval}/include"
833 LDFLAGS="$LDFLAGS -L${withval}/lib"
834 fi
835
836 AC_DEFINE(SKEY)
837 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100838 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800839
Tim Rice4cec93f2002-02-26 08:40:48 -0800840 AC_MSG_CHECKING([for s/key support])
841 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100842 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800843#include <stdio.h>
844#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700845int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800846 ],
847 [AC_MSG_RESULT(yes)],
848 [
849 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100850 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
851 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000852 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
853 AC_TRY_COMPILE(
854 [#include <stdio.h>
855 #include <skey.h>],
856 [(void)skeychallenge(NULL,"name","",0);],
857 [AC_MSG_RESULT(yes)
858 AC_DEFINE(SKEYCHALLENGE_4ARG)],
859 [AC_MSG_RESULT(no)]
860 )
Damien Millerc547bf12001-02-16 10:18:12 +1100861 fi
862 ]
863)
864
865# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700866TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100867AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100868 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100869 [
870 if test "x$withval" != "xno" ; then
871 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700872 saved_LDFLAGS="$LDFLAGS"
873 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800874 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800875 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700876 if test -d "${withval}/lib"; then
877 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700878 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700879 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700880 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700881 fi
882 else
883 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700884 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700885 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700886 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700887 fi
888 fi
889 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700890 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700891 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700892 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700893 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700894 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800895 LIBWRAP="-lwrap"
896 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100897 AC_MSG_CHECKING(for libwrap)
898 AC_TRY_LINK(
899 [
Damien Miller0ac45002004-04-14 20:14:26 +1000900#include <sys/types.h>
901#include <sys/socket.h>
902#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100903#include <tcpd.h>
904 int deny_severity = 0, allow_severity = 0;
905 ],
906 [hosts_access(0);],
907 [
908 AC_MSG_RESULT(yes)
909 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800910 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700911 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100912 ],
913 [
914 AC_MSG_ERROR([*** libwrap missing])
915 ]
916 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800917 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100918 fi
919 ]
920)
921
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100922# Check whether user wants libedit support
923LIBEDIT_MSG="no"
924AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100925 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100926 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100927 if test "x$withval" != "xyes"; then
928 CPPFLAGS="$CPPFLAGS -I$withval/include"
929 LDFLAGS="$LDFLAGS -L$withval/lib"
930 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100931 AC_CHECK_LIB(edit, el_init,
932 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
933 LIBEDIT="-ledit -lcurses"
934 LIBEDIT_MSG="yes"
935 AC_SUBST(LIBEDIT)
936 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100937 [ AC_MSG_ERROR(libedit not found) ],
938 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100939 )
940 fi ]
941)
942
Darren Tuckerd9f88912005-02-20 21:01:48 +1100943AUDIT_MODULE=none
944AC_ARG_WITH(audit,
945 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
946 [
947 AC_MSG_CHECKING(for supported audit module)
948 case "$withval" in
949 bsm)
950 AC_MSG_RESULT(bsm)
951 AUDIT_MODULE=bsm
952 dnl Checks for headers, libs and functions
953 AC_CHECK_HEADERS(bsm/audit.h, [],
954 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
955 AC_CHECK_LIB(bsm, getaudit, [],
956 [AC_MSG_ERROR(BSM enabled and required library not found)])
957 AC_CHECK_FUNCS(getaudit, [],
958 [AC_MSG_ERROR(BSM enabled and required function not found)])
959 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100960 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100961 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
962 ;;
963 debug)
964 AUDIT_MODULE=debug
965 AC_MSG_RESULT(debug)
966 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
967 ;;
968 *)
969 AC_MSG_ERROR([Unknown audit module $withval])
970 ;;
971 esac ]
972)
973
Damien Millerfe1f1432003-02-24 15:45:42 +1100974dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +1000975AC_CHECK_FUNCS( \
976 arc4random \
977 b64_ntop \
978 __b64_ntop \
979 b64_pton \
980 __b64_pton \
981 bcopy \
982 bindresvport_sa \
983 clock \
984 closefrom \
985 dirfd \
986 fchdir \
987 fchmod \
988 fchown \
989 freeaddrinfo \
990 futimes \
991 getaddrinfo \
992 getcwd \
993 getgrouplist \
994 getnameinfo \
995 getopt \
996 getpeereid \
997 _getpty \
998 getrlimit \
999 getttyent \
1000 glob \
1001 inet_aton \
1002 inet_ntoa \
1003 inet_ntop \
1004 innetgr \
1005 login_getcapbool \
1006 md5_crypt \
1007 memmove \
1008 mkdtemp \
1009 mmap \
1010 ngetaddrinfo \
1011 nsleep \
1012 ogetaddrinfo \
1013 openlog_r \
1014 openpty \
1015 prctl \
1016 pstat \
1017 readpassphrase \
1018 realpath \
1019 recvmsg \
1020 rresvport_af \
1021 sendmsg \
1022 setdtablesize \
1023 setegid \
1024 setenv \
1025 seteuid \
1026 setgroups \
1027 setlogin \
1028 setpcred \
1029 setproctitle \
1030 setregid \
1031 setreuid \
1032 setrlimit \
1033 setsid \
1034 setvbuf \
1035 sigaction \
1036 sigvec \
1037 snprintf \
1038 socketpair \
1039 strdup \
1040 strerror \
1041 strlcat \
1042 strlcpy \
1043 strmode \
1044 strnvis \
1045 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001046 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001047 strtoul \
1048 sysconf \
1049 tcgetpgrp \
1050 truncate \
1051 unsetenv \
1052 updwtmpx \
1053 utimes \
1054 vhangup \
1055 vsnprintf \
1056 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001057)
Tim Rice13aae5e2001-10-21 17:53:58 -07001058
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001059# IRIX has a const char return value for gai_strerror()
1060AC_CHECK_FUNCS(gai_strerror,[
1061 AC_DEFINE(HAVE_GAI_STRERROR)
1062 AC_TRY_COMPILE([
1063#include <sys/types.h>
1064#include <sys/socket.h>
1065#include <netdb.h>
1066
1067const char *gai_strerror(int);],[
1068char *str;
1069
1070str = gai_strerror(0);],[
1071 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1072 [Define if gai_strerror() returns const char *])])])
1073
Damien Millercd6853c2003-01-28 11:33:42 +11001074AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1075
Darren Tuckerf1159b52003-07-07 19:44:01 +10001076dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001077AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001078AC_CHECK_DECL(strsep,
1079 [AC_CHECK_FUNCS(strsep)],
1080 [],
1081 [
1082#ifdef HAVE_STRING_H
1083# include <string.h>
1084#endif
1085 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001086
Darren Tuckerb2427c82003-09-10 15:22:44 +10001087dnl tcsendbreak might be a macro
1088AC_CHECK_DECL(tcsendbreak,
1089 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001090 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001091 [#include <termios.h>]
1092)
1093
Darren Tucker5bb14002004-04-23 18:53:10 +10001094AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1095
Darren Tucker2a6b0292003-12-31 14:59:17 +11001096AC_CHECK_FUNCS(setresuid, [
1097 dnl Some platorms have setresuid that isn't implemented, test for this
1098 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001099 AC_RUN_IFELSE(
1100 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001101#include <stdlib.h>
1102#include <errno.h>
1103int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001104 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001105 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001106 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001107 AC_MSG_RESULT(not implemented)],
1108 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001109 )
1110])
Darren Tuckere937be32003-12-17 18:53:26 +11001111
Darren Tucker2a6b0292003-12-31 14:59:17 +11001112AC_CHECK_FUNCS(setresgid, [
1113 dnl Some platorms have setresgid that isn't implemented, test for this
1114 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001115 AC_RUN_IFELSE(
1116 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001117#include <stdlib.h>
1118#include <errno.h>
1119int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001120 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001121 [AC_MSG_RESULT(yes)],
1122 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001123 AC_MSG_RESULT(not implemented)],
1124 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001125 )
1126])
Darren Tuckere937be32003-12-17 18:53:26 +11001127
Damien Millerad833b32000-08-23 10:46:23 +10001128dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001129AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001130dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001131AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001132AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001133dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001134AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001135AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001136
Damien Millera8e06ce2003-11-21 23:48:55 +11001137AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001138 [AC_DEFINE(HAVE_DAEMON)],
1139 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1140)
1141
Damien Millera8e06ce2003-11-21 23:48:55 +11001142AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001143 [AC_DEFINE(HAVE_GETPAGESIZE)],
1144 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1145)
1146
Damien Millercb170cb2000-07-01 16:52:55 +10001147# Check for broken snprintf
1148if test "x$ac_cv_func_snprintf" = "xyes" ; then
1149 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001150 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001151 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001152#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001153int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001154 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001155 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001156 [
1157 AC_MSG_RESULT(no)
1158 AC_DEFINE(BROKEN_SNPRINTF)
1159 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001160 ],
1161 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001162 )
1163fi
1164
Damien Millerb4097182004-05-23 14:09:40 +10001165# Check for missing getpeereid (or equiv) support
1166NO_PEERCHECK=""
1167if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1168 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1169 AC_TRY_COMPILE(
1170 [#include <sys/types.h>
1171 #include <sys/socket.h>],
1172 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001173 [ AC_MSG_RESULT(yes)
1174 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1175 ],
Damien Millerb4097182004-05-23 14:09:40 +10001176 [AC_MSG_RESULT(no)
1177 NO_PEERCHECK=1]
1178 )
1179fi
1180
Damien Millere8328192003-01-07 15:18:32 +11001181dnl see whether mkstemp() requires XXXXXX
1182if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1183AC_MSG_CHECKING([for (overly) strict mkstemp])
1184AC_TRY_RUN(
1185 [
1186#include <stdlib.h>
1187main() { char template[]="conftest.mkstemp-test";
1188if (mkstemp(template) == -1)
1189 exit(1);
1190unlink(template); exit(0);
1191}
1192 ],
1193 [
1194 AC_MSG_RESULT(no)
1195 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001196 [
Damien Millere8328192003-01-07 15:18:32 +11001197 AC_MSG_RESULT(yes)
1198 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1199 ],
1200 [
1201 AC_MSG_RESULT(yes)
1202 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001203 ]
Damien Millere8328192003-01-07 15:18:32 +11001204)
1205fi
1206
Darren Tucker70a3d552003-08-21 17:58:29 +10001207dnl make sure that openpty does not reacquire controlling terminal
1208if test ! -z "$check_for_openpty_ctty_bug"; then
1209 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1210 AC_TRY_RUN(
1211 [
1212#include <stdio.h>
1213#include <sys/fcntl.h>
1214#include <sys/types.h>
1215#include <sys/wait.h>
1216
1217int
1218main()
1219{
1220 pid_t pid;
1221 int fd, ptyfd, ttyfd, status;
1222
1223 pid = fork();
1224 if (pid < 0) { /* failed */
1225 exit(1);
1226 } else if (pid > 0) { /* parent */
1227 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001228 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001229 exit(WEXITSTATUS(status));
1230 else
1231 exit(2);
1232 } else { /* child */
1233 close(0); close(1); close(2);
1234 setsid();
1235 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1236 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1237 if (fd >= 0)
1238 exit(3); /* Acquired ctty: broken */
1239 else
1240 exit(0); /* Did not acquire ctty: OK */
1241 }
1242}
1243 ],
1244 [
1245 AC_MSG_RESULT(yes)
1246 ],
1247 [
1248 AC_MSG_RESULT(no)
1249 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1250 ]
1251 )
1252fi
1253
Tim Rice8bb561b2005-03-17 16:23:19 -08001254if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1255 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001256 AC_MSG_CHECKING(if getaddrinfo seems to work)
1257 AC_TRY_RUN(
1258 [
1259#include <stdio.h>
1260#include <sys/socket.h>
1261#include <netdb.h>
1262#include <errno.h>
1263#include <netinet/in.h>
1264
1265#define TEST_PORT "2222"
1266
1267int
1268main(void)
1269{
1270 int err, sock;
1271 struct addrinfo *gai_ai, *ai, hints;
1272 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1273
1274 memset(&hints, 0, sizeof(hints));
1275 hints.ai_family = PF_UNSPEC;
1276 hints.ai_socktype = SOCK_STREAM;
1277 hints.ai_flags = AI_PASSIVE;
1278
1279 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1280 if (err != 0) {
1281 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1282 exit(1);
1283 }
1284
1285 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1286 if (ai->ai_family != AF_INET6)
1287 continue;
1288
1289 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1290 sizeof(ntop), strport, sizeof(strport),
1291 NI_NUMERICHOST|NI_NUMERICSERV);
1292
1293 if (err != 0) {
1294 if (err == EAI_SYSTEM)
1295 perror("getnameinfo EAI_SYSTEM");
1296 else
1297 fprintf(stderr, "getnameinfo failed: %s\n",
1298 gai_strerror(err));
1299 exit(2);
1300 }
1301
1302 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1303 if (sock < 0)
1304 perror("socket");
1305 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1306 if (errno == EBADF)
1307 exit(3);
1308 }
1309 }
1310 exit(0);
1311}
1312 ],
1313 [
1314 AC_MSG_RESULT(yes)
1315 ],
1316 [
1317 AC_MSG_RESULT(no)
1318 AC_DEFINE(BROKEN_GETADDRINFO)
1319 ]
1320 )
1321fi
1322
Tim Rice8bb561b2005-03-17 16:23:19 -08001323if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1324 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001325 AC_MSG_CHECKING(if getaddrinfo seems to work)
1326 AC_TRY_RUN(
1327 [
1328#include <stdio.h>
1329#include <sys/socket.h>
1330#include <netdb.h>
1331#include <errno.h>
1332#include <netinet/in.h>
1333
1334#define TEST_PORT "2222"
1335
1336int
1337main(void)
1338{
1339 int err, sock;
1340 struct addrinfo *gai_ai, *ai, hints;
1341 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1342
1343 memset(&hints, 0, sizeof(hints));
1344 hints.ai_family = PF_UNSPEC;
1345 hints.ai_socktype = SOCK_STREAM;
1346 hints.ai_flags = AI_PASSIVE;
1347
1348 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1349 if (err != 0) {
1350 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1351 exit(1);
1352 }
1353
1354 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1355 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1356 continue;
1357
1358 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1359 sizeof(ntop), strport, sizeof(strport),
1360 NI_NUMERICHOST|NI_NUMERICSERV);
1361
1362 if (ai->ai_family == AF_INET && err != 0) {
1363 perror("getnameinfo");
1364 exit(2);
1365 }
1366 }
1367 exit(0);
1368}
1369 ],
1370 [
1371 AC_MSG_RESULT(yes)
1372 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1373[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1374 ],
1375 [
1376 AC_MSG_RESULT(no)
1377 AC_DEFINE(BROKEN_GETADDRINFO)
1378 ]
1379 )
1380fi
1381
Darren Tuckera56f1912004-11-02 20:30:54 +11001382if test "x$check_for_conflicting_getspnam" = "x1"; then
1383 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1384 AC_COMPILE_IFELSE(
1385 [
1386#include <shadow.h>
1387int main(void) {exit(0);}
1388 ],
1389 [
1390 AC_MSG_RESULT(no)
1391 ],
1392 [
1393 AC_MSG_RESULT(yes)
1394 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1395 [Conflicting defs for getspnam])
1396 ]
1397 )
1398fi
1399
Damien Miller606f8802000-09-16 15:39:56 +11001400AC_FUNC_GETPGRP
1401
Damien Millera64b57a2001-01-17 10:44:13 +11001402# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001403PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001404AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001405 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001406 [
Damien Millera64b57a2001-01-17 10:44:13 +11001407 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001408 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1409 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001410 AC_MSG_ERROR([PAM headers not found])
1411 fi
1412
1413 AC_CHECK_LIB(dl, dlopen, , )
1414 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1415 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001416 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001417
Damien Millera64b57a2001-01-17 10:44:13 +11001418 PAM_MSG="yes"
1419
1420 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001421 if test $ac_cv_lib_dl_dlopen = yes; then
1422 LIBPAM="-lpam -ldl"
1423 else
1424 LIBPAM="-lpam"
1425 fi
1426 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001427 fi
1428 ]
1429)
Damien Millera22ba012000-03-02 23:09:20 +11001430
Damien Millera64b57a2001-01-17 10:44:13 +11001431# Check for older PAM
1432if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001433 # Check PAM strerror arguments (old PAM)
1434 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1435 AC_TRY_COMPILE(
1436 [
Damien Miller81171112000-04-23 11:14:01 +10001437#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001438#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001439#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001440#elif defined (HAVE_PAM_PAM_APPL_H)
1441#include <pam/pam_appl.h>
1442#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001443 ],
1444 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001445 [AC_MSG_RESULT(no)],
1446 [
1447 AC_DEFINE(HAVE_OLD_PAM)
1448 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001449 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001450 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001451 )
Damien Millera22ba012000-03-02 23:09:20 +11001452fi
1453
Tim Riceaef73712002-05-11 13:17:42 -07001454# Search for OpenSSL
1455saved_CPPFLAGS="$CPPFLAGS"
1456saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001457AC_ARG_WITH(ssl-dir,
1458 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1459 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001460 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001461 case "$withval" in
1462 # Relative paths
1463 ./*|../*) withval="`pwd`/$withval"
1464 esac
Tim Riceaef73712002-05-11 13:17:42 -07001465 if test -d "$withval/lib"; then
1466 if test -n "${need_dash_r}"; then
1467 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1468 else
1469 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1470 fi
1471 else
1472 if test -n "${need_dash_r}"; then
1473 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1474 else
1475 LDFLAGS="-L${withval} ${LDFLAGS}"
1476 fi
1477 fi
1478 if test -d "$withval/include"; then
1479 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1480 else
1481 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1482 fi
Damien Millera22ba012000-03-02 23:09:20 +11001483 fi
1484 ]
1485)
Tim Rice3d5352e2004-02-12 09:27:21 -08001486LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001487AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001488 [
Tim Riceaef73712002-05-11 13:17:42 -07001489 dnl Check default openssl install dir
1490 if test -n "${need_dash_r}"; then
1491 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001492 else
Tim Riceaef73712002-05-11 13:17:42 -07001493 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001494 fi
Tim Riceaef73712002-05-11 13:17:42 -07001495 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1496 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1497 [
1498 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1499 ]
1500 )
1501 ]
1502)
1503
Tim Riced730b782002-08-13 18:52:10 -07001504# Determine OpenSSL header version
1505AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001506AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001507 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001508#include <stdio.h>
1509#include <string.h>
1510#include <openssl/opensslv.h>
1511#define DATA "conftest.sslincver"
1512int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001513 FILE *fd;
1514 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001515
Damien Millera8e06ce2003-11-21 23:48:55 +11001516 fd = fopen(DATA,"w");
1517 if(fd == NULL)
1518 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001519
1520 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1521 exit(1);
1522
1523 exit(0);
1524}
Darren Tucker623d92f2004-09-12 22:36:15 +10001525 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001526 [
1527 ssl_header_ver=`cat conftest.sslincver`
1528 AC_MSG_RESULT($ssl_header_ver)
1529 ],
1530 [
1531 AC_MSG_RESULT(not found)
1532 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001533 ],
1534 [
1535 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001536 ]
1537)
1538
1539# Determine OpenSSL library version
1540AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001541AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001542 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001543#include <stdio.h>
1544#include <string.h>
1545#include <openssl/opensslv.h>
1546#include <openssl/crypto.h>
1547#define DATA "conftest.ssllibver"
1548int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001549 FILE *fd;
1550 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001551
Damien Millera8e06ce2003-11-21 23:48:55 +11001552 fd = fopen(DATA,"w");
1553 if(fd == NULL)
1554 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001555
1556 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1557 exit(1);
1558
1559 exit(0);
1560}
Darren Tucker623d92f2004-09-12 22:36:15 +10001561 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001562 [
1563 ssl_library_ver=`cat conftest.ssllibver`
1564 AC_MSG_RESULT($ssl_library_ver)
1565 ],
1566 [
1567 AC_MSG_RESULT(not found)
1568 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001569 ],
1570 [
1571 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001572 ]
1573)
Damien Millera22ba012000-03-02 23:09:20 +11001574
Damien Millerec932372002-01-22 22:16:03 +11001575# Sanity check OpenSSL headers
1576AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001577AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001578 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001579#include <string.h>
1580#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001581int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001582 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001583 [
1584 AC_MSG_RESULT(yes)
1585 ],
1586 [
1587 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001588 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1589Check config.log for details.
1590Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001591 ],
1592 [
1593 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001594 ]
1595)
1596
Tim Rice3d5352e2004-02-12 09:27:21 -08001597# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1598# because the system crypt() is more featureful.
1599if test "x$check_for_libcrypt_before" = "x1"; then
1600 AC_CHECK_LIB(crypt, crypt)
1601fi
1602
Damien Millera8e06ce2003-11-21 23:48:55 +11001603# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001604# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001605if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001606 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001607fi
1608
Damien Miller6c21c512002-01-22 21:57:53 +11001609
1610### Configure cryptographic random number support
1611
1612# Check wheter OpenSSL seeds itself
1613AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001614AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001615 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001616#include <string.h>
1617#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001618int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001619 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001620 [
1621 OPENSSL_SEEDS_ITSELF=yes
1622 AC_MSG_RESULT(yes)
1623 ],
1624 [
1625 AC_MSG_RESULT(no)
1626 # Default to use of the rand helper if OpenSSL doesn't
1627 # seed itself
1628 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001629 ],
1630 [
1631 AC_MSG_WARN([cross compiling: assuming yes])
1632 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001633 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001634 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001635 ]
1636)
1637
1638
1639# Do we want to force the use of the rand helper?
1640AC_ARG_WITH(rand-helper,
1641 [ --with-rand-helper Use subprocess to gather strong randomness ],
1642 [
1643 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001644 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001645 # the previous test showed it to be unseeded.
1646 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1647 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1648 OPENSSL_SEEDS_ITSELF=yes
1649 USE_RAND_HELPER=""
1650 fi
1651 else
1652 USE_RAND_HELPER=yes
1653 fi
1654 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001655)
Damien Miller6c21c512002-01-22 21:57:53 +11001656
1657# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001658if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001659 # OpenSSL only
1660 AC_DEFINE(OPENSSL_PRNG_ONLY)
1661 RAND_MSG="OpenSSL internal ONLY"
1662 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001663elif test ! -z "$USE_RAND_HELPER" ; then
1664 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001665 RAND_MSG="ssh-rand-helper"
1666 INSTALL_SSH_RAND_HELPER="yes"
1667fi
1668AC_SUBST(INSTALL_SSH_RAND_HELPER)
1669
1670### Configuration of ssh-rand-helper
1671
1672# PRNGD TCP socket
1673AC_ARG_WITH(prngd-port,
1674 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1675 [
Damien Millere996d722002-01-23 11:20:59 +11001676 case "$withval" in
1677 no)
1678 withval=""
1679 ;;
1680 [[0-9]]*)
1681 ;;
1682 *)
1683 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1684 ;;
1685 esac
1686 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001687 PRNGD_PORT="$withval"
1688 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1689 fi
1690 ]
1691)
1692
1693# PRNGD Unix domain socket
1694AC_ARG_WITH(prngd-socket,
1695 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1696 [
Damien Millere996d722002-01-23 11:20:59 +11001697 case "$withval" in
1698 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001699 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001700 ;;
1701 no)
1702 withval=""
1703 ;;
1704 /*)
1705 ;;
1706 *)
1707 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1708 ;;
1709 esac
1710
1711 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001712 if test ! -z "$PRNGD_PORT" ; then
1713 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1714 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001715 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001716 AC_MSG_WARN(Entropy socket is not readable)
1717 fi
1718 PRNGD_SOCKET="$withval"
1719 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1720 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001721 ],
1722 [
1723 # Check for existing socket only if we don't have a random device already
1724 if test "$USE_RAND_HELPER" = yes ; then
1725 AC_MSG_CHECKING(for PRNGD/EGD socket)
1726 # Insert other locations here
1727 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1728 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1729 PRNGD_SOCKET="$sock"
1730 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1731 break;
1732 fi
1733 done
1734 if test ! -z "$PRNGD_SOCKET" ; then
1735 AC_MSG_RESULT($PRNGD_SOCKET)
1736 else
1737 AC_MSG_RESULT(not found)
1738 fi
1739 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001740 ]
1741)
1742
1743# Change default command timeout for hashing entropy source
1744entropy_timeout=200
1745AC_ARG_WITH(entropy-timeout,
1746 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1747 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001748 if test -n "$withval" && test "x$withval" != "xno" && \
1749 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001750 entropy_timeout=$withval
1751 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001752 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001753)
Damien Miller6c21c512002-01-22 21:57:53 +11001754AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1755
Damien Millerd3f6ad22002-06-25 10:24:47 +10001756SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001757AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001758 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001759 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001760 if test -n "$withval" && test "x$withval" != "xno" && \
1761 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001762 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001763 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001764 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001765)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001766AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1767AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001768
Tim Rice88f2ab52002-03-17 12:17:34 -08001769# We do this little dance with the search path to insure
1770# that programs that we select for use by installed programs
1771# (which may be run by the super-user) come from trusted
1772# locations before they come from the user's private area.
1773# This should help avoid accidentally configuring some
1774# random version of a program in someone's personal bin.
1775
1776OPATH=$PATH
1777PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001778test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001779test -d /sbin && PATH=$PATH:/sbin
1780test -d /usr/sbin && PATH=$PATH:/usr/sbin
1781PATH=$PATH:/etc:$OPATH
1782
Damien Millera8e06ce2003-11-21 23:48:55 +11001783# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001784OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1785OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1786OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1787OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1788OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1789OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1790OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1791OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1792OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1793OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1794OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1795OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1796OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1797OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1798OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1799OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001800# restore PATH
1801PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001802
1803# Where does ssh-rand-helper get its randomness from?
1804INSTALL_SSH_PRNG_CMDS=""
1805if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1806 if test ! -z "$PRNGD_PORT" ; then
1807 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1808 elif test ! -z "$PRNGD_SOCKET" ; then
1809 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1810 else
1811 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1812 RAND_HELPER_CMDHASH=yes
1813 INSTALL_SSH_PRNG_CMDS="yes"
1814 fi
1815fi
1816AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1817
1818
Ben Lindstromb5628642000-10-18 00:02:25 +00001819# Cheap hack to ensure NEWS-OS libraries are arranged right.
1820if test ! -z "$SONY" ; then
1821 LIBS="$LIBS -liberty";
1822fi
1823
Damien Millera22ba012000-03-02 23:09:20 +11001824# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001825AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001826AC_CHECK_SIZEOF(short int, 2)
1827AC_CHECK_SIZEOF(int, 4)
1828AC_CHECK_SIZEOF(long int, 4)
1829AC_CHECK_SIZEOF(long long int, 8)
1830
Damien Millerfa2bb692002-04-23 23:22:25 +10001831# Sanity check long long for some platforms (AIX)
1832if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1833 ac_cv_sizeof_long_long_int=0
1834fi
1835
Damien Millera22ba012000-03-02 23:09:20 +11001836# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001837AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1838 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001839 [ #include <sys/types.h> ],
1840 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001841 [ ac_cv_have_u_int="yes" ],
1842 [ ac_cv_have_u_int="no" ]
1843 )
1844])
1845if test "x$ac_cv_have_u_int" = "xyes" ; then
1846 AC_DEFINE(HAVE_U_INT)
1847 have_u_int=1
1848fi
1849
Damien Miller61e50f12000-05-08 20:49:37 +10001850AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1851 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001852 [ #include <sys/types.h> ],
1853 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001854 [ ac_cv_have_intxx_t="yes" ],
1855 [ ac_cv_have_intxx_t="no" ]
1856 )
1857])
1858if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1859 AC_DEFINE(HAVE_INTXX_T)
1860 have_intxx_t=1
1861fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001862
1863if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001864 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001865then
1866 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1867 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001868 [ #include <stdint.h> ],
1869 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001870 [
1871 AC_DEFINE(HAVE_INTXX_T)
1872 AC_MSG_RESULT(yes)
1873 ],
1874 [ AC_MSG_RESULT(no) ]
1875 )
1876fi
1877
Damien Miller578783e2000-09-23 14:12:24 +11001878AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1879 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001880 [
1881#include <sys/types.h>
1882#ifdef HAVE_STDINT_H
1883# include <stdint.h>
1884#endif
1885#include <sys/socket.h>
1886#ifdef HAVE_SYS_BITYPES_H
1887# include <sys/bitypes.h>
1888#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001889 ],
1890 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001891 [ ac_cv_have_int64_t="yes" ],
1892 [ ac_cv_have_int64_t="no" ]
1893 )
1894])
1895if test "x$ac_cv_have_int64_t" = "xyes" ; then
1896 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001897fi
1898
Damien Miller61e50f12000-05-08 20:49:37 +10001899AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1900 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001901 [ #include <sys/types.h> ],
1902 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001903 [ ac_cv_have_u_intxx_t="yes" ],
1904 [ ac_cv_have_u_intxx_t="no" ]
1905 )
1906])
1907if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1908 AC_DEFINE(HAVE_U_INTXX_T)
1909 have_u_intxx_t=1
1910fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001911
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001912if test -z "$have_u_intxx_t" ; then
1913 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1914 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001915 [ #include <sys/socket.h> ],
1916 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001917 [
1918 AC_DEFINE(HAVE_U_INTXX_T)
1919 AC_MSG_RESULT(yes)
1920 ],
1921 [ AC_MSG_RESULT(no) ]
1922 )
1923fi
1924
Damien Miller578783e2000-09-23 14:12:24 +11001925AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1926 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001927 [ #include <sys/types.h> ],
1928 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001929 [ ac_cv_have_u_int64_t="yes" ],
1930 [ ac_cv_have_u_int64_t="no" ]
1931 )
1932])
1933if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1934 AC_DEFINE(HAVE_U_INT64_T)
1935 have_u_int64_t=1
1936fi
1937
Tim Rice4cec93f2002-02-26 08:40:48 -08001938if test -z "$have_u_int64_t" ; then
1939 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1940 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001941 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001942 [ u_int64_t a; a = 1],
1943 [
1944 AC_DEFINE(HAVE_U_INT64_T)
1945 AC_MSG_RESULT(yes)
1946 ],
1947 [ AC_MSG_RESULT(no) ]
1948 )
1949fi
1950
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001951if test -z "$have_u_intxx_t" ; then
1952 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1953 AC_TRY_COMPILE(
1954 [
1955#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001956 ],
1957 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001958 [ ac_cv_have_uintxx_t="yes" ],
1959 [ ac_cv_have_uintxx_t="no" ]
1960 )
1961 ])
1962 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1963 AC_DEFINE(HAVE_UINTXX_T)
1964 fi
1965fi
1966
1967if test -z "$have_uintxx_t" ; then
1968 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1969 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001970 [ #include <stdint.h> ],
1971 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001972 [
1973 AC_DEFINE(HAVE_UINTXX_T)
1974 AC_MSG_RESULT(yes)
1975 ],
1976 [ AC_MSG_RESULT(no) ]
1977 )
1978fi
1979
Damien Milleredb82922000-06-20 13:25:52 +10001980if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001981 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001982then
1983 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1984 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001985 [
1986#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001987 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001988 [
Damien Miller70494d12000-04-03 15:57:06 +10001989 int8_t a; int16_t b; int32_t c;
1990 u_int8_t e; u_int16_t f; u_int32_t g;
1991 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001992 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001993 [
1994 AC_DEFINE(HAVE_U_INTXX_T)
1995 AC_DEFINE(HAVE_INTXX_T)
1996 AC_MSG_RESULT(yes)
1997 ],
1998 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001999 )
Damien Millerb29ea912000-01-15 14:12:03 +11002000fi
2001
Damien Miller58be7382001-09-15 21:31:54 +10002002
2003AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2004 AC_TRY_COMPILE(
2005 [
2006#include <sys/types.h>
2007 ],
2008 [ u_char foo; foo = 125; ],
2009 [ ac_cv_have_u_char="yes" ],
2010 [ ac_cv_have_u_char="no" ]
2011 )
2012])
2013if test "x$ac_cv_have_u_char" = "xyes" ; then
2014 AC_DEFINE(HAVE_U_CHAR)
2015fi
2016
Tim Rice13aae5e2001-10-21 17:53:58 -07002017TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002018
Tim Rice200a5c02002-02-26 22:12:34 -08002019AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002020
Damien Miller848b9932005-02-24 12:12:34 +11002021AC_CHECK_TYPES(in_addr_t,,,
2022[#include <sys/types.h>
2023#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002024
Damien Miller61e50f12000-05-08 20:49:37 +10002025AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2026 AC_TRY_COMPILE(
2027 [
2028#include <sys/types.h>
2029 ],
2030 [ size_t foo; foo = 1235; ],
2031 [ ac_cv_have_size_t="yes" ],
2032 [ ac_cv_have_size_t="no" ]
2033 )
2034])
2035if test "x$ac_cv_have_size_t" = "xyes" ; then
2036 AC_DEFINE(HAVE_SIZE_T)
2037fi
Damien Miller95058511999-12-29 10:36:45 +11002038
Damien Miller615f9392000-05-17 22:53:33 +10002039AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2040 AC_TRY_COMPILE(
2041 [
2042#include <sys/types.h>
2043 ],
2044 [ ssize_t foo; foo = 1235; ],
2045 [ ac_cv_have_ssize_t="yes" ],
2046 [ ac_cv_have_ssize_t="no" ]
2047 )
2048])
2049if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2050 AC_DEFINE(HAVE_SSIZE_T)
2051fi
2052
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002053AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2054 AC_TRY_COMPILE(
2055 [
2056#include <time.h>
2057 ],
2058 [ clock_t foo; foo = 1235; ],
2059 [ ac_cv_have_clock_t="yes" ],
2060 [ ac_cv_have_clock_t="no" ]
2061 )
2062])
2063if test "x$ac_cv_have_clock_t" = "xyes" ; then
2064 AC_DEFINE(HAVE_CLOCK_T)
2065fi
2066
Damien Millerb54b40e2000-06-23 08:23:34 +10002067AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2068 AC_TRY_COMPILE(
2069 [
2070#include <sys/types.h>
2071#include <sys/socket.h>
2072 ],
2073 [ sa_family_t foo; foo = 1235; ],
2074 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002075 [ AC_TRY_COMPILE(
2076 [
2077#include <sys/types.h>
2078#include <sys/socket.h>
2079#include <netinet/in.h>
2080 ],
2081 [ sa_family_t foo; foo = 1235; ],
2082 [ ac_cv_have_sa_family_t="yes" ],
2083
Damien Millerb54b40e2000-06-23 08:23:34 +10002084 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002085 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002086 )
2087])
2088if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2089 AC_DEFINE(HAVE_SA_FAMILY_T)
2090fi
2091
Damien Miller0f91b4e2000-06-18 15:43:25 +10002092AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2093 AC_TRY_COMPILE(
2094 [
2095#include <sys/types.h>
2096 ],
2097 [ pid_t foo; foo = 1235; ],
2098 [ ac_cv_have_pid_t="yes" ],
2099 [ ac_cv_have_pid_t="no" ]
2100 )
2101])
2102if test "x$ac_cv_have_pid_t" = "xyes" ; then
2103 AC_DEFINE(HAVE_PID_T)
2104fi
2105
2106AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2107 AC_TRY_COMPILE(
2108 [
2109#include <sys/types.h>
2110 ],
2111 [ mode_t foo; foo = 1235; ],
2112 [ ac_cv_have_mode_t="yes" ],
2113 [ ac_cv_have_mode_t="no" ]
2114 )
2115])
2116if test "x$ac_cv_have_mode_t" = "xyes" ; then
2117 AC_DEFINE(HAVE_MODE_T)
2118fi
2119
Damien Miller61e50f12000-05-08 20:49:37 +10002120
2121AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2122 AC_TRY_COMPILE(
2123 [
Damien Miller81171112000-04-23 11:14:01 +10002124#include <sys/types.h>
2125#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002126 ],
2127 [ struct sockaddr_storage s; ],
2128 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2129 [ ac_cv_have_struct_sockaddr_storage="no" ]
2130 )
2131])
2132if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2133 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2134fi
Damien Miller34132e52000-01-14 15:45:46 +11002135
Damien Miller61e50f12000-05-08 20:49:37 +10002136AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2137 AC_TRY_COMPILE(
2138 [
Damien Miller7b22d652000-06-18 14:07:04 +10002139#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002140#include <netinet/in.h>
2141 ],
2142 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2143 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2144 [ ac_cv_have_struct_sockaddr_in6="no" ]
2145 )
2146])
2147if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2148 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2149fi
Damien Miller34132e52000-01-14 15:45:46 +11002150
Damien Miller61e50f12000-05-08 20:49:37 +10002151AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2152 AC_TRY_COMPILE(
2153 [
Damien Miller7b22d652000-06-18 14:07:04 +10002154#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002155#include <netinet/in.h>
2156 ],
2157 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2158 [ ac_cv_have_struct_in6_addr="yes" ],
2159 [ ac_cv_have_struct_in6_addr="no" ]
2160 )
2161])
2162if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2163 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2164fi
Damien Miller34132e52000-01-14 15:45:46 +11002165
Damien Miller61e50f12000-05-08 20:49:37 +10002166AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2167 AC_TRY_COMPILE(
2168 [
Damien Miller81171112000-04-23 11:14:01 +10002169#include <sys/types.h>
2170#include <sys/socket.h>
2171#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002172 ],
2173 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2174 [ ac_cv_have_struct_addrinfo="yes" ],
2175 [ ac_cv_have_struct_addrinfo="no" ]
2176 )
2177])
2178if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2179 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2180fi
2181
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002182AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2183 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002184 [ #include <sys/time.h> ],
2185 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002186 [ ac_cv_have_struct_timeval="yes" ],
2187 [ ac_cv_have_struct_timeval="no" ]
2188 )
2189])
2190if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2191 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2192 have_struct_timeval=1
2193fi
2194
Tim Rice4e4dc562003-03-18 10:21:40 -08002195AC_CHECK_TYPES(struct timespec)
2196
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002197# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002198if test "x$ac_cv_have_int64_t" = "xno" && \
2199 test "x$ac_cv_sizeof_long_int" != "x8" && \
2200 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002201 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2202 echo "an alternative compiler (I.E., GCC) before continuing."
2203 echo ""
2204 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002205else
2206dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002207 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002208 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002209#include <stdio.h>
2210#include <string.h>
2211#ifdef HAVE_SNPRINTF
2212main()
2213{
2214 char buf[50];
2215 char expected_out[50];
2216 int mazsize = 50 ;
2217#if (SIZEOF_LONG_INT == 8)
2218 long int num = 0x7fffffffffffffff;
2219#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002220 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002221#endif
2222 strcpy(expected_out, "9223372036854775807");
2223 snprintf(buf, mazsize, "%lld", num);
2224 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002225 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002226 exit(0);
2227}
2228#else
2229main() { exit(0); }
2230#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002231 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002232 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002233 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002234fi
2235
Damien Miller78315eb2000-09-29 23:01:36 +11002236dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002237OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2238OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2239OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2240OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2241OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002242OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002243OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2244OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002245OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002246OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2247OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2248OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2249OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002250OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2251OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2252OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2253OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002254
2255AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002256
Damien Miller61e50f12000-05-08 20:49:37 +10002257AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2258 ac_cv_have_ss_family_in_struct_ss, [
2259 AC_TRY_COMPILE(
2260 [
Damien Miller81171112000-04-23 11:14:01 +10002261#include <sys/types.h>
2262#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002263 ],
2264 [ struct sockaddr_storage s; s.ss_family = 1; ],
2265 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2266 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2267 )
2268])
2269if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2270 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2271fi
2272
Damien Miller61e50f12000-05-08 20:49:37 +10002273AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2274 ac_cv_have___ss_family_in_struct_ss, [
2275 AC_TRY_COMPILE(
2276 [
Damien Miller81171112000-04-23 11:14:01 +10002277#include <sys/types.h>
2278#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002279 ],
2280 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2281 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2282 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2283 )
2284])
2285if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2286 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2287fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002288
Damien Millerad833b32000-08-23 10:46:23 +10002289AC_CACHE_CHECK([for pw_class field in struct passwd],
2290 ac_cv_have_pw_class_in_struct_passwd, [
2291 AC_TRY_COMPILE(
2292 [
Damien Millerad833b32000-08-23 10:46:23 +10002293#include <pwd.h>
2294 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002295 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002296 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2297 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2298 )
2299])
2300if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2301 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2302fi
2303
Kevin Steves82456952001-06-22 21:14:18 +00002304AC_CACHE_CHECK([for pw_expire field in struct passwd],
2305 ac_cv_have_pw_expire_in_struct_passwd, [
2306 AC_TRY_COMPILE(
2307 [
2308#include <pwd.h>
2309 ],
2310 [ struct passwd p; p.pw_expire = 0; ],
2311 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2312 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2313 )
2314])
2315if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2316 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2317fi
2318
2319AC_CACHE_CHECK([for pw_change field in struct passwd],
2320 ac_cv_have_pw_change_in_struct_passwd, [
2321 AC_TRY_COMPILE(
2322 [
2323#include <pwd.h>
2324 ],
2325 [ struct passwd p; p.pw_change = 0; ],
2326 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2327 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2328 )
2329])
2330if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2331 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2332fi
Damien Miller61e50f12000-05-08 20:49:37 +10002333
Tim Rice28bbb0c2002-05-27 17:37:32 -07002334dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002335AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2336 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002337 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002338 [
Tim Riceae49fe62002-04-12 10:26:21 -07002339#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002340#include <sys/socket.h>
2341#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002342int main() {
2343#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002344#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002345exit(1);
2346#endif
2347struct msghdr m;
2348m.msg_accrights = 0;
2349exit(0);
2350}
Kevin Steves939c9db2002-03-22 17:23:25 +00002351 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002352 [ ac_cv_have_accrights_in_msghdr="yes" ],
2353 [ ac_cv_have_accrights_in_msghdr="no" ]
2354 )
2355])
2356if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2357 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2358fi
2359
Kevin Stevesa44e0352002-04-07 16:18:03 +00002360AC_CACHE_CHECK([for msg_control field in struct msghdr],
2361 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002362 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002363 [
Tim Riceae49fe62002-04-12 10:26:21 -07002364#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002365#include <sys/socket.h>
2366#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002367int main() {
2368#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002369#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002370exit(1);
2371#endif
2372struct msghdr m;
2373m.msg_control = 0;
2374exit(0);
2375}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002376 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002377 [ ac_cv_have_control_in_msghdr="yes" ],
2378 [ ac_cv_have_control_in_msghdr="no" ]
2379 )
2380])
2381if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2382 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2383fi
2384
Damien Miller61e50f12000-05-08 20:49:37 +10002385AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002386 AC_TRY_LINK([],
2387 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002388 [ ac_cv_libc_defines___progname="yes" ],
2389 [ ac_cv_libc_defines___progname="no" ]
2390 )
2391])
2392if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2393 AC_DEFINE(HAVE___PROGNAME)
2394fi
2395
Kevin Steves4846f4a2002-03-22 18:19:53 +00002396AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2397 AC_TRY_LINK([
2398#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002399],
2400 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002401 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2402 [ ac_cv_cc_implements___FUNCTION__="no" ]
2403 )
2404])
2405if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2406 AC_DEFINE(HAVE___FUNCTION__)
2407fi
2408
2409AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2410 AC_TRY_LINK([
2411#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002412],
2413 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002414 [ ac_cv_cc_implements___func__="yes" ],
2415 [ ac_cv_cc_implements___func__="no" ]
2416 )
2417])
2418if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2419 AC_DEFINE(HAVE___func__)
2420fi
2421
Damien Miller4f8e6692001-07-14 13:22:53 +10002422AC_CACHE_CHECK([whether getopt has optreset support],
2423 ac_cv_have_getopt_optreset, [
2424 AC_TRY_LINK(
2425 [
2426#include <getopt.h>
2427 ],
2428 [ extern int optreset; optreset = 0; ],
2429 [ ac_cv_have_getopt_optreset="yes" ],
2430 [ ac_cv_have_getopt_optreset="no" ]
2431 )
2432])
2433if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2434 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2435fi
Damien Millera22ba012000-03-02 23:09:20 +11002436
Damien Millerecbb26d2000-07-15 14:59:14 +10002437AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002438 AC_TRY_LINK([],
2439 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002440 [ ac_cv_libc_defines_sys_errlist="yes" ],
2441 [ ac_cv_libc_defines_sys_errlist="no" ]
2442 )
2443])
2444if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2445 AC_DEFINE(HAVE_SYS_ERRLIST)
2446fi
2447
2448
Damien Miller11fa2cc2000-08-16 10:35:58 +10002449AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002450 AC_TRY_LINK([],
2451 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002452 [ ac_cv_libc_defines_sys_nerr="yes" ],
2453 [ ac_cv_libc_defines_sys_nerr="no" ]
2454 )
2455])
2456if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2457 AC_DEFINE(HAVE_SYS_NERR)
2458fi
2459
Damien Millera8e06ce2003-11-21 23:48:55 +11002460SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002461# Check whether user wants sectok support
2462AC_ARG_WITH(sectok,
2463 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002464 [
2465 if test "x$withval" != "xno" ; then
2466 if test "x$withval" != "xyes" ; then
2467 CPPFLAGS="$CPPFLAGS -I${withval}"
2468 LDFLAGS="$LDFLAGS -L${withval}"
2469 if test ! -z "$need_dash_r" ; then
2470 LDFLAGS="$LDFLAGS -R${withval}"
2471 fi
2472 if test ! -z "$blibpath" ; then
2473 blibpath="$blibpath:${withval}"
2474 fi
2475 fi
2476 AC_CHECK_HEADERS(sectok.h)
2477 if test "$ac_cv_header_sectok_h" != yes; then
2478 AC_MSG_ERROR(Can't find sectok.h)
2479 fi
2480 AC_CHECK_LIB(sectok, sectok_open)
2481 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2482 AC_MSG_ERROR(Can't find libsectok)
2483 fi
2484 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002485 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002486 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002487 fi
2488 ]
2489)
2490
2491# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002492OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002493AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002494 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2495 [
2496 if test "x$withval" != "xno" ; then
2497 if test "x$withval" != "xyes" ; then
2498 OPENSC_CONFIG=$withval/bin/opensc-config
2499 else
2500 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2501 fi
2502 if test "$OPENSC_CONFIG" != "no"; then
2503 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2504 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2505 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2506 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2507 AC_DEFINE(SMARTCARD)
2508 AC_DEFINE(USE_OPENSC)
2509 SCARD_MSG="yes, using OpenSC"
2510 fi
2511 fi
2512 ]
2513)
Damien Miller85de5802001-09-18 14:01:11 +10002514
Darren Tucker5f88d342003-10-15 16:57:57 +10002515# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002516AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002517 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002518 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002519 # Needed by our getrrsetbyname()
2520 AC_SEARCH_LIBS(res_query, resolv)
2521 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002522 AC_MSG_CHECKING(if res_query will link)
2523 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2524 [AC_MSG_RESULT(no)
2525 saved_LIBS="$LIBS"
2526 LIBS="$LIBS -lresolv"
2527 AC_MSG_CHECKING(for res_query in -lresolv)
2528 AC_LINK_IFELSE([
2529#include <resolv.h>
2530int main()
2531{
2532 res_query (0, 0, 0, 0, 0);
2533 return 0;
2534}
2535 ],
2536 [LIBS="$LIBS -lresolv"
2537 AC_MSG_RESULT(yes)],
2538 [LIBS="$saved_LIBS"
2539 AC_MSG_RESULT(no)])
2540 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002541 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002542 AC_CHECK_DECLS([_getshort, _getlong], , ,
2543 [#include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002544 AC_CHECK_MEMBER(HEADER.ad,
2545 [AC_DEFINE(HAVE_HEADER_AD)],,
2546 [#include <arpa/nameser.h>])
2547 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002548
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002549# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002550KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002551AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002552 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002553 [ if test "x$withval" != "xno" ; then
2554 if test "x$withval" = "xyes" ; then
2555 KRB5ROOT="/usr/local"
2556 else
2557 KRB5ROOT=${withval}
2558 fi
2559
2560 AC_DEFINE(KRB5)
2561 KRB5_MSG="yes"
2562
2563 AC_MSG_CHECKING(for krb5-config)
2564 if test -x $KRB5ROOT/bin/krb5-config ; then
2565 KRB5CONF=$KRB5ROOT/bin/krb5-config
2566 AC_MSG_RESULT($KRB5CONF)
2567
2568 AC_MSG_CHECKING(for gssapi support)
2569 if $KRB5CONF | grep gssapi >/dev/null ; then
2570 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002571 AC_DEFINE(GSSAPI)
2572 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002573 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002574 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002575 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002576 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002577 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2578 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002579 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002580 AC_MSG_CHECKING(whether we are using Heimdal)
2581 AC_TRY_COMPILE([ #include <krb5.h> ],
2582 [ char *tmp = heimdal_version; ],
2583 [ AC_MSG_RESULT(yes)
2584 AC_DEFINE(HEIMDAL) ],
2585 AC_MSG_RESULT(no)
2586 )
2587 else
2588 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002589 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002590 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002591 AC_MSG_CHECKING(whether we are using Heimdal)
2592 AC_TRY_COMPILE([ #include <krb5.h> ],
2593 [ char *tmp = heimdal_version; ],
2594 [ AC_MSG_RESULT(yes)
2595 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002596 K5LIBS="-lkrb5 -ldes"
2597 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002598 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002599 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002600 ],
2601 [ AC_MSG_RESULT(no)
2602 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2603 ]
2604 )
Damien Miller200d0a72003-06-30 19:21:36 +10002605 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002606
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002607 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2608 [ AC_DEFINE(GSSAPI)
2609 K5LIBS="-lgssapi $K5LIBS" ],
2610 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2611 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002612 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002613 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2614 $K5LIBS)
2615 ],
2616 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002617
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002618 AC_CHECK_HEADER(gssapi.h, ,
2619 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002620 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002621 AC_CHECK_HEADERS(gssapi.h, ,
2622 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002623 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002624 ]
2625 )
2626
2627 oldCPP="$CPPFLAGS"
2628 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2629 AC_CHECK_HEADER(gssapi_krb5.h, ,
2630 [ CPPFLAGS="$oldCPP" ])
2631
Damien Millera8e06ce2003-11-21 23:48:55 +11002632 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002633 if test ! -z "$need_dash_r" ; then
2634 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2635 fi
2636 if test ! -z "$blibpath" ; then
2637 blibpath="$blibpath:${KRB5ROOT}/lib"
2638 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002639 fi
2640
2641 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2642 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2643 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2644
2645 LIBS="$LIBS $K5LIBS"
2646 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002647 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002648 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002649)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002650
Damien Millera22ba012000-03-02 23:09:20 +11002651# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002652
Damien Millerf58c6722002-05-13 13:15:42 +10002653PRIVSEP_PATH=/var/empty
2654AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002655 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002656 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002657 if test -n "$withval" && test "x$withval" != "xno" && \
2658 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002659 PRIVSEP_PATH=$withval
2660 fi
2661 ]
2662)
2663AC_SUBST(PRIVSEP_PATH)
2664
Damien Millera22ba012000-03-02 23:09:20 +11002665AC_ARG_WITH(xauth,
2666 [ --with-xauth=PATH Specify path to xauth program ],
2667 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002668 if test -n "$withval" && test "x$withval" != "xno" && \
2669 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002670 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002671 fi
2672 ],
2673 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002674 TestPath="$PATH"
2675 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2676 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2677 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2678 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2679 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002680 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002681 xauth_path="/usr/openwin/bin/xauth"
2682 fi
2683 ]
2684)
2685
Damien Miller7d901272003-01-13 16:55:22 +11002686STRIP_OPT=-s
2687AC_ARG_ENABLE(strip,
2688 [ --disable-strip Disable calling strip(1) on install],
2689 [
2690 if test "x$enableval" = "xno" ; then
2691 STRIP_OPT=
2692 fi
2693 ]
2694)
2695AC_SUBST(STRIP_OPT)
2696
Damien Millera19cf472000-11-29 13:28:50 +11002697if test -z "$xauth_path" ; then
2698 XAUTH_PATH="undefined"
2699 AC_SUBST(XAUTH_PATH)
2700else
Damien Millera22ba012000-03-02 23:09:20 +11002701 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002702 XAUTH_PATH=$xauth_path
2703 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002704fi
Damien Millera22ba012000-03-02 23:09:20 +11002705
2706# Check for mail directory (last resort if we cannot get it from headers)
2707if test ! -z "$MAIL" ; then
2708 maildir=`dirname $MAIL`
2709 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2710fi
2711
Darren Tucker623d92f2004-09-12 22:36:15 +10002712if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002713 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2714 disable_ptmx_check=yes
2715fi
Damien Millera22ba012000-03-02 23:09:20 +11002716if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002717 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002718 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002719 [
2720 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2721 have_dev_ptmx=1
2722 ]
2723 )
2724 fi
Damien Millera22ba012000-03-02 23:09:20 +11002725fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002726
Darren Tucker623d92f2004-09-12 22:36:15 +10002727if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002728 AC_CHECK_FILE("/dev/ptc",
2729 [
2730 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2731 have_dev_ptc=1
2732 ]
2733 )
2734else
2735 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2736fi
Damien Miller204ad072000-03-02 23:56:12 +11002737
Damien Millera22ba012000-03-02 23:09:20 +11002738# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002739AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002740 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002741 [
Damien Miller897741e2001-04-16 10:41:46 +10002742 case "$withval" in
2743 man|cat|doc)
2744 MANTYPE=$withval
2745 ;;
2746 *)
2747 AC_MSG_ERROR(invalid man type: $withval)
2748 ;;
2749 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002750 ]
2751)
Ben Lindstrombc709922001-04-18 18:04:21 +00002752if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002753 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2754 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002755 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2756 MANTYPE=doc
2757 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2758 MANTYPE=man
2759 else
2760 MANTYPE=cat
2761 fi
2762fi
Damien Miller670a4b82000-01-22 13:53:11 +11002763AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002764if test "$MANTYPE" = "doc"; then
2765 mansubdir=man;
2766else
2767 mansubdir=$MANTYPE;
2768fi
2769AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002770
Damien Millera22ba012000-03-02 23:09:20 +11002771# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002772MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002773AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002774 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002775 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002776 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002777 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002778 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002779 fi
2780 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002781)
2782
Damien Millera22ba012000-03-02 23:09:20 +11002783# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002784AC_ARG_WITH(shadow,
2785 [ --without-shadow Disable shadow password support],
2786 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002787 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002788 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002789 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002790 fi
2791 ]
2792)
2793
Damien Miller1f335fb2000-06-26 11:31:33 +10002794if test -z "$disable_shadow" ; then
2795 AC_MSG_CHECKING([if the systems has expire shadow information])
2796 AC_TRY_COMPILE(
2797 [
2798#include <sys/types.h>
2799#include <shadow.h>
2800 struct spwd sp;
2801 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2802 [ sp_expire_available=yes ], []
2803 )
2804
2805 if test "x$sp_expire_available" = "xyes" ; then
2806 AC_MSG_RESULT(yes)
2807 AC_DEFINE(HAS_SHADOW_EXPIRE)
2808 else
2809 AC_MSG_RESULT(no)
2810 fi
2811fi
2812
Damien Millera22ba012000-03-02 23:09:20 +11002813# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002814if test ! -z "$IPADDR_IN_DISPLAY" ; then
2815 DISPLAY_HACK_MSG="yes"
2816 AC_DEFINE(IPADDR_IN_DISPLAY)
2817else
Damien Millera8e06ce2003-11-21 23:48:55 +11002818 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002819 AC_ARG_WITH(ipaddr-display,
2820 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2821 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002822 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002823 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002824 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002825 fi
2826 ]
2827 )
2828fi
Damien Miller76112de1999-12-21 11:18:08 +11002829
Darren Tuckere1a790d2003-09-16 11:52:19 +10002830# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002831AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002832 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002833 [ if test "x$enableval" = "xno"; then
2834 AC_MSG_NOTICE([/etc/default/login handling disabled])
2835 etc_default_login=no
2836 else
2837 etc_default_login=yes
2838 fi ],
2839 [ etc_default_login=yes ]
2840)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002841
Darren Tucker2f9573d2005-02-10 22:28:54 +11002842if test "x$etc_default_login" != "xno"; then
2843 AC_CHECK_FILE("/etc/default/login",
2844 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002845 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2846 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002847 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2848 elif test "x$external_path_file" = "x/etc/default/login"; then
2849 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2850 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002851fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002852
Tim Rice43a1c132002-04-17 21:19:14 -07002853dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002854if test $ac_cv_func_login_getcapbool = "yes" && \
2855 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002856 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002857fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002858
Damien Millera22ba012000-03-02 23:09:20 +11002859# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002860SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002861AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002862 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002863 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002864 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002865 AC_MSG_WARN([
2866--with-default-path=PATH has no effect on this system.
2867Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002868 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002869 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002870 AC_MSG_WARN([
2871--with-default-path=PATH will only be used if PATH is not defined in
2872$external_path_file .])
2873 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002874 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002875 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002876 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002877 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002878 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2879 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002880 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002881 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002882 AC_MSG_WARN([
2883If PATH is defined in $external_path_file, ensure the path to scp is included,
2884otherwise scp will not work.])
2885 fi
2886 AC_TRY_RUN(
2887 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002888/* find out what STDPATH is */
2889#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002890#ifdef HAVE_PATHS_H
2891# include <paths.h>
2892#endif
2893#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002894# ifdef _PATH_USERPATH /* Irix */
2895# define _PATH_STDPATH _PATH_USERPATH
2896# else
2897# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2898# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002899#endif
2900#include <sys/types.h>
2901#include <sys/stat.h>
2902#include <fcntl.h>
2903#define DATA "conftest.stdpath"
2904
2905main()
2906{
2907 FILE *fd;
2908 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002909
Tim Rice59ea0a02001-03-10 13:50:45 -08002910 fd = fopen(DATA,"w");
2911 if(fd == NULL)
2912 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002913
Tim Rice59ea0a02001-03-10 13:50:45 -08002914 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2915 exit(1);
2916
2917 exit(0);
2918}
2919 ], [ user_path=`cat conftest.stdpath` ],
2920 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2921 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2922 )
2923# make sure $bindir is in USER_PATH so scp will work
2924 t_bindir=`eval echo ${bindir}`
2925 case $t_bindir in
2926 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2927 esac
2928 case $t_bindir in
2929 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2930 esac
2931 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2932 if test $? -ne 0 ; then
2933 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2934 if test $? -ne 0 ; then
2935 user_path=$user_path:$t_bindir
2936 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2937 fi
2938 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002939 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002940)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002941if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002942 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2943 AC_SUBST(user_path)
2944fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002945
Damien Millera18bbd32002-05-13 10:48:57 +10002946# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002947AC_ARG_WITH(superuser-path,
2948 [ --with-superuser-path= Specify different path for super-user],
2949 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002950 if test -n "$withval" && test "x$withval" != "xno" && \
2951 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002952 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2953 superuser_path=$withval
2954 fi
2955 ]
2956)
2957
2958
Damien Miller61e50f12000-05-08 20:49:37 +10002959AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002960IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002961AC_ARG_WITH(4in6,
2962 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2963 [
2964 if test "x$withval" != "xno" ; then
2965 AC_MSG_RESULT(yes)
2966 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002967 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002968 else
2969 AC_MSG_RESULT(no)
2970 fi
2971 ],[
2972 if test "x$inet6_default_4in6" = "xyes"; then
2973 AC_MSG_RESULT([yes (default)])
2974 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002975 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002976 else
2977 AC_MSG_RESULT([no (default)])
2978 fi
2979 ]
2980)
2981
Damien Miller60396b02001-02-18 17:01:00 +11002982# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002983BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002984AC_ARG_WITH(bsd-auth,
2985 [ --with-bsd-auth Enable BSD auth support],
2986 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002987 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002988 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002989 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002990 fi
2991 ]
2992)
2993
Damien Millera22ba012000-03-02 23:09:20 +11002994# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002995piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002996# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08002997if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11002998 piddir=`eval echo ${sysconfdir}`
2999 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003000 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003001 esac
3002fi
3003
Tim Rice88f2ab52002-03-17 12:17:34 -08003004AC_ARG_WITH(pid-dir,
3005 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3006 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003007 if test -n "$withval" && test "x$withval" != "xno" && \
3008 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003009 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003010 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003011 AC_MSG_WARN([** no $piddir directory on this system **])
3012 fi
3013 fi
3014 ]
3015)
3016
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003017AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003018AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003019
andre2ff7b5d2000-06-03 14:57:40 +00003020dnl allow user to disable some login recording features
3021AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003022 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003023 [
3024 if test "x$enableval" = "xno" ; then
3025 AC_DEFINE(DISABLE_LASTLOG)
3026 fi
3027 ]
andre2ff7b5d2000-06-03 14:57:40 +00003028)
3029AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003030 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003031 [
3032 if test "x$enableval" = "xno" ; then
3033 AC_DEFINE(DISABLE_UTMP)
3034 fi
3035 ]
andre2ff7b5d2000-06-03 14:57:40 +00003036)
3037AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003038 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003039 [
3040 if test "x$enableval" = "xno" ; then
3041 AC_DEFINE(DISABLE_UTMPX)
3042 fi
3043 ]
andre2ff7b5d2000-06-03 14:57:40 +00003044)
3045AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003046 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003047 [
3048 if test "x$enableval" = "xno" ; then
3049 AC_DEFINE(DISABLE_WTMP)
3050 fi
3051 ]
andre2ff7b5d2000-06-03 14:57:40 +00003052)
3053AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003054 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003055 [
3056 if test "x$enableval" = "xno" ; then
3057 AC_DEFINE(DISABLE_WTMPX)
3058 fi
3059 ]
andre2ff7b5d2000-06-03 14:57:40 +00003060)
3061AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003062 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003063 [
3064 if test "x$enableval" = "xno" ; then
3065 AC_DEFINE(DISABLE_LOGIN)
3066 fi
3067 ]
andre2ff7b5d2000-06-03 14:57:40 +00003068)
3069AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003070 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003071 [
3072 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003073 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003074 fi
3075 ]
andre2ff7b5d2000-06-03 14:57:40 +00003076)
3077AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003078 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003079 [
3080 if test "x$enableval" = "xno" ; then
3081 AC_DEFINE(DISABLE_PUTUTXLINE)
3082 fi
3083 ]
andre2ff7b5d2000-06-03 14:57:40 +00003084)
3085AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003086 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003087 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003088 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003089 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003090 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003091 conf_lastlog_location=$withval
3092 fi
3093 ]
3094)
andre2ff7b5d2000-06-03 14:57:40 +00003095
3096dnl lastlog, [uw]tmpx? detection
3097dnl NOTE: set the paths in the platform section to avoid the
3098dnl need for command-line parameters
3099dnl lastlog and [uw]tmp are subject to a file search if all else fails
3100
3101dnl lastlog detection
3102dnl NOTE: the code itself will detect if lastlog is a directory
3103AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3104AC_TRY_COMPILE([
3105#include <sys/types.h>
3106#include <utmp.h>
3107#ifdef HAVE_LASTLOG_H
3108# include <lastlog.h>
3109#endif
Damien Miller2994e082000-06-04 15:51:47 +10003110#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003111# include <paths.h>
3112#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003113#ifdef HAVE_LOGIN_H
3114# include <login.h>
3115#endif
andre2ff7b5d2000-06-03 14:57:40 +00003116 ],
3117 [ char *lastlog = LASTLOG_FILE; ],
3118 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003119 [
3120 AC_MSG_RESULT(no)
3121 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3122 AC_TRY_COMPILE([
3123#include <sys/types.h>
3124#include <utmp.h>
3125#ifdef HAVE_LASTLOG_H
3126# include <lastlog.h>
3127#endif
3128#ifdef HAVE_PATHS_H
3129# include <paths.h>
3130#endif
3131 ],
3132 [ char *lastlog = _PATH_LASTLOG; ],
3133 [ AC_MSG_RESULT(yes) ],
3134 [
andree441aa32000-06-12 22:34:38 +00003135 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003136 system_lastlog_path=no
3137 ])
3138 ]
andre2ff7b5d2000-06-03 14:57:40 +00003139)
Damien Miller2994e082000-06-04 15:51:47 +10003140
andre2ff7b5d2000-06-03 14:57:40 +00003141if test -z "$conf_lastlog_location"; then
3142 if test x"$system_lastlog_path" = x"no" ; then
3143 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003144 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003145 conf_lastlog_location=$f
3146 fi
3147 done
3148 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003149 AC_MSG_WARN([** Cannot find lastlog **])
3150 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003151 fi
3152 fi
3153fi
3154
3155if test -n "$conf_lastlog_location"; then
3156 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003157fi
andre2ff7b5d2000-06-03 14:57:40 +00003158
3159dnl utmp detection
3160AC_MSG_CHECKING([if your system defines UTMP_FILE])
3161AC_TRY_COMPILE([
3162#include <sys/types.h>
3163#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003164#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003165# include <paths.h>
3166#endif
3167 ],
3168 [ char *utmp = UTMP_FILE; ],
3169 [ AC_MSG_RESULT(yes) ],
3170 [ AC_MSG_RESULT(no)
3171 system_utmp_path=no ]
3172)
3173if test -z "$conf_utmp_location"; then
3174 if test x"$system_utmp_path" = x"no" ; then
3175 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3176 if test -f $f ; then
3177 conf_utmp_location=$f
3178 fi
3179 done
3180 if test -z "$conf_utmp_location"; then
3181 AC_DEFINE(DISABLE_UTMP)
3182 fi
3183 fi
3184fi
3185if test -n "$conf_utmp_location"; then
3186 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003187fi
andre2ff7b5d2000-06-03 14:57:40 +00003188
3189dnl wtmp detection
3190AC_MSG_CHECKING([if your system defines WTMP_FILE])
3191AC_TRY_COMPILE([
3192#include <sys/types.h>
3193#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003194#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003195# include <paths.h>
3196#endif
3197 ],
3198 [ char *wtmp = WTMP_FILE; ],
3199 [ AC_MSG_RESULT(yes) ],
3200 [ AC_MSG_RESULT(no)
3201 system_wtmp_path=no ]
3202)
3203if test -z "$conf_wtmp_location"; then
3204 if test x"$system_wtmp_path" = x"no" ; then
3205 for f in /usr/adm/wtmp /var/log/wtmp; do
3206 if test -f $f ; then
3207 conf_wtmp_location=$f
3208 fi
3209 done
3210 if test -z "$conf_wtmp_location"; then
3211 AC_DEFINE(DISABLE_WTMP)
3212 fi
3213 fi
3214fi
3215if test -n "$conf_wtmp_location"; then
3216 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003217fi
andre2ff7b5d2000-06-03 14:57:40 +00003218
3219
3220dnl utmpx detection - I don't know any system so perverse as to require
3221dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3222dnl there, though.
3223AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3224AC_TRY_COMPILE([
3225#include <sys/types.h>
3226#include <utmp.h>
3227#ifdef HAVE_UTMPX_H
3228#include <utmpx.h>
3229#endif
Damien Miller2994e082000-06-04 15:51:47 +10003230#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003231# include <paths.h>
3232#endif
3233 ],
3234 [ char *utmpx = UTMPX_FILE; ],
3235 [ AC_MSG_RESULT(yes) ],
3236 [ AC_MSG_RESULT(no)
3237 system_utmpx_path=no ]
3238)
3239if test -z "$conf_utmpx_location"; then
3240 if test x"$system_utmpx_path" = x"no" ; then
3241 AC_DEFINE(DISABLE_UTMPX)
3242 fi
3243else
3244 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003245fi
andre2ff7b5d2000-06-03 14:57:40 +00003246
3247dnl wtmpx detection
3248AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3249AC_TRY_COMPILE([
3250#include <sys/types.h>
3251#include <utmp.h>
3252#ifdef HAVE_UTMPX_H
3253#include <utmpx.h>
3254#endif
Damien Miller2994e082000-06-04 15:51:47 +10003255#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003256# include <paths.h>
3257#endif
3258 ],
3259 [ char *wtmpx = WTMPX_FILE; ],
3260 [ AC_MSG_RESULT(yes) ],
3261 [ AC_MSG_RESULT(no)
3262 system_wtmpx_path=no ]
3263)
3264if test -z "$conf_wtmpx_location"; then
3265 if test x"$system_wtmpx_path" = x"no" ; then
3266 AC_DEFINE(DISABLE_WTMPX)
3267 fi
3268else
3269 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003270fi
andre2ff7b5d2000-06-03 14:57:40 +00003271
Damien Miller4018c192000-04-30 09:30:44 +10003272
Damien Miller29ea30d2000-03-17 10:54:15 +11003273if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003274 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3275 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003276fi
3277
Tim Rice4cec93f2002-02-26 08:40:48 -08003278dnl remove pam and dl because they are in $LIBPAM
3279if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003280 LIBS=`echo $LIBS | sed 's/-lpam //'`
3281fi
3282if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3283 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003284fi
3285
Damien Millerbac2d8a2000-09-05 16:13:06 +11003286AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003287AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3288 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003289AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003290
Damien Miller7b22d652000-06-18 14:07:04 +10003291# Print summary of options
3292
Damien Miller7b22d652000-06-18 14:07:04 +10003293# Someone please show me a better way :)
3294A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3295B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3296C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3297D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003298E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003299F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003300G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003301H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3302I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3303J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003304
3305echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003306echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003307echo " User binaries: $B"
3308echo " System binaries: $C"
3309echo " Configuration files: $D"
3310echo " Askpass program: $E"
3311echo " Manual pages: $F"
3312echo " PID file: $G"
3313echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003314if test "x$external_path_file" = "x/etc/login.conf" ; then
3315echo " At runtime, sshd will use the path defined in $external_path_file"
3316echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003317else
Damien Millerf58c6722002-05-13 13:15:42 +10003318echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003319 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003320echo " (If PATH is set in $external_path_file it will be used instead. If"
3321echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3322 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003323fi
Damien Millera18bbd32002-05-13 10:48:57 +10003324if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003325echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003326fi
Damien Millerf58c6722002-05-13 13:15:42 +10003327echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003328echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003329echo " KerberosV support: $KRB5_MSG"
3330echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003331echo " S/KEY support: $SKEY_MSG"
3332echo " TCP Wrappers support: $TCPW_MSG"
3333echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003334echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003335echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003336echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3337echo " BSD Auth support: $BSD_AUTH_MSG"
3338echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003339if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003340echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003341fi
3342
Damien Miller7b22d652000-06-18 14:07:04 +10003343echo ""
3344
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003345echo " Host: ${host}"
3346echo " Compiler: ${CC}"
3347echo " Compiler flags: ${CFLAGS}"
3348echo "Preprocessor flags: ${CPPFLAGS}"
3349echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003350echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003351
3352echo ""
3353
Tim Rice6f1f7582004-05-30 21:38:51 -07003354if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003355 echo "SVR4 style packages are supported with \"make package\""
3356 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003357fi
3358
Damien Miller82cf0ce2000-12-20 13:34:48 +11003359if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003360 echo "PAM is enabled. You may need to install a PAM control file "
3361 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003362 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003363 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003364 echo ""
3365fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003366
Damien Miller6c21c512002-01-22 21:57:53 +11003367if test ! -z "$RAND_HELPER_CMDHASH" ; then
3368 echo "WARNING: you are using the builtin random number collection "
3369 echo "service. Please read WARNING.RNG and request that your OS "
3370 echo "vendor includes kernel-based random number collection in "
3371 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003372 echo ""
3373fi
Damien Miller60396b02001-02-18 17:01:00 +11003374
Damien Millerb4097182004-05-23 14:09:40 +10003375if test ! -z "$NO_PEERCHECK" ; then
3376 echo "WARNING: the operating system that you are using does not "
3377 echo "appear to support either the getpeereid() API nor the "
3378 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3379 echo "enforce security checks to prevent unauthorised connections to "
3380 echo "ssh-agent. Their absence increases the risk that a malicious "
3381 echo "user can connect to your agent. "
3382 echo ""
3383fi
3384
Darren Tuckerd9f88912005-02-20 21:01:48 +11003385if test "$AUDIT_MODULE" = "bsm" ; then
3386 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3387 echo "See the Solaris section in README.platform for details."
3388fi