blob: 00fc858ef32509bd784a8ff024e614a858a111ef [file] [log] [blame]
Darren Tucker6a45f3d2005-06-03 19:33:10 +10001# $Id: configure.ac,v 1.274 2005/06/03 09:33:10 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
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
Darren Tucker67b37032005-06-03 17:58:31 +100080
81AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
82
Damien Millera8e06ce2003-11-21 23:48:55 +110083if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100084 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Millerde3cb0a2005-05-26 20:48:25 +100085
Darren Tucker67b37032005-06-03 17:58:31 +100086 if test -z "$have_llong_max"; then
87 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
88 unset ac_cv_have_decl_LLONG_MAX
89 saved_CFLAGS="$CFLAGS"
90 CFLAGS="$CFLAGS -std=gnu99"
91 AC_CHECK_DECL(LLONG_MAX,
92 [have_llong_max=1],
93 [CFLAGS="$saved_CFLAGS"],
94 [#include <limits.h>]
95 )
96 fi
Damien Miller166bd442000-03-16 10:48:25 +110097fi
98
Tim Rice88368a32003-12-08 12:35:59 -080099AC_ARG_WITH(rpath,
100 [ --without-rpath Disable auto-added -R linker paths],
101 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800102 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800103 need_dash_r=""
104 fi
105 if test "x$withval" = "xyes" ; then
106 need_dash_r=1
107 fi
108 ]
109)
110
Damien Millera22ba012000-03-02 23:09:20 +1100111# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100112case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100113*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100114 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000115 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800116 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100117 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000118 saved_LDFLAGS="$LDFLAGS"
119 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
120 if (test -z "$blibflags"); then
121 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
122 AC_TRY_LINK([], [], [blibflags=$tryflags])
123 fi
124 done
125 if (test -z "$blibflags"); then
126 AC_MSG_RESULT(not found)
127 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
128 else
129 AC_MSG_RESULT($blibflags)
130 fi
131 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000132 dnl Check for authenticate. Might be in libs.a on older AIXes
133 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700134 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000135 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700136 LIBS="$LIBS -ls"
137 ])
138 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100139 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100140 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100141 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000142 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100143 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000144 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
145 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000146 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000147 [(void)loginfailed("user","host","tty",0);],
148 [AC_MSG_RESULT(yes)
149 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000150 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000151 )],
152 [],
153 [#include <usersec.h>]
154 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000155 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100156 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000157 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000158 AC_DEFINE(SETEUID_BREAKS_SETUID)
159 AC_DEFINE(BROKEN_SETREUID)
160 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000161 dnl AIX handles lastlog as part of its login message
162 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000163 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000164 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100165 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100166*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100167 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800168 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100169 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000170 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100171 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100172 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000173 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000174 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700175 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100176 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000177*-*-dgux*)
178 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100179 AC_DEFINE(SETEUID_BREAKS_SETUID)
180 AC_DEFINE(BROKEN_SETREUID)
181 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000182 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000183*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000184 AC_MSG_CHECKING(if we have working getaddrinfo)
185 AC_TRY_RUN([#include <mach-o/dyld.h>
186main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
187 exit(0);
188 else
189 exit(1);
190}], [AC_MSG_RESULT(working)],
191 [AC_MSG_RESULT(buggy)
192 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700193 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000194 AC_DEFINE(SETEUID_BREAKS_SETUID)
195 AC_DEFINE(BROKEN_SETREUID)
196 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100197 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000198 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000199*-*-hpux*)
200 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000201 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100202 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000203 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000204 AC_DEFINE(LOGIN_NO_ENDOPT)
205 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000206 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000207 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700208 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000209 AC_CHECK_LIB(xnet, t_error, ,
210 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
211
212 # next, we define all of the options specific to major releases
213 case "$host" in
214 *-*-hpux10*)
215 if test -z "$GCC"; then
216 CFLAGS="$CFLAGS -Ae"
217 fi
218 ;;
219 *-*-hpux11*)
220 AC_DEFINE(PAM_SUN_CODEBASE)
221 AC_DEFINE(DISABLE_UTMP)
222 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
223 check_for_hpux_broken_getaddrinfo=1
224 check_for_conflicting_getspnam=1
225 ;;
226 esac
227
228 # lastly, we define options specific to minor releases
229 case "$host" in
230 *-*-hpux10.26)
231 AC_DEFINE(HAVE_SECUREWARE)
232 disable_ptmx_check=yes
233 LIBS="$LIBS -lsecpw"
234 ;;
235 esac
Damien Miller1bead332000-04-30 00:47:29 +1000236 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100237*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100238 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000239 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000240 AC_DEFINE(SETEUID_BREAKS_SETUID)
241 AC_DEFINE(BROKEN_SETREUID)
242 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000243 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000244 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100245 ;;
246*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100247 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000248 AC_DEFINE(WITH_IRIX_ARRAY)
249 AC_DEFINE(WITH_IRIX_PROJECT)
250 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000251 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000252 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000253 AC_DEFINE(SETEUID_BREAKS_SETUID)
254 AC_DEFINE(BROKEN_SETREUID)
255 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000256 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000257 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000258 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100259 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100260*-*-linux*)
261 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100262 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000263 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100264 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000265 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000266 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000267 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000268 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100269 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
270 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100271 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000272 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000273 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000274 AC_DEFINE(BROKEN_CMSG_TYPE)
275 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000276 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100277 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000278mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000279 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000280 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000281 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100282*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000283 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800284 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800285 need_dash_r=1
286 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100287 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100288*-*-freebsd*)
289 check_for_libcrypt_later=1
290 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000291*-*-bsdi*)
292 AC_DEFINE(SETEUID_BREAKS_SETUID)
293 AC_DEFINE(BROKEN_SETREUID)
294 AC_DEFINE(BROKEN_SETREGID)
295 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000296*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000297 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100298 conf_utmp_location=/etc/utmp
299 conf_wtmp_location=/usr/adm/wtmp
300 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000301 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000302 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000303 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100304 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000305 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100306*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800307 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800308 need_dash_r=1
309 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100310 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000311 AC_DEFINE(LOGIN_NEEDS_UTMPX)
312 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000313 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000314 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000315 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000316 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
317 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000318 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000319 # hardwire lastlog location (can't detect it on some versions)
320 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000321 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
322 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
323 if test "$sol2ver" -ge 8; then
324 AC_MSG_RESULT(yes)
325 AC_DEFINE(DISABLE_UTMP)
326 AC_DEFINE(DISABLE_WTMP)
327 else
328 AC_MSG_RESULT(no)
329 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100330 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000331*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000332 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000333 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100334 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000335 conf_utmp_location=/etc/utmp
336 conf_wtmp_location=/var/adm/wtmp
337 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000338 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000339 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000340*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700341 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000342 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000343 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000344 AC_DEFINE(SETEUID_BREAKS_SETUID)
345 AC_DEFINE(BROKEN_SETREUID)
346 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000347 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000348*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700349 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000350 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100351 # -lresolv needs to be at then end of LIBS or DNS lookups break
352 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100353 IPADDR_IN_DISPLAY=yes
354 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000355 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000356 AC_DEFINE(SETEUID_BREAKS_SETUID)
357 AC_DEFINE(BROKEN_SETREUID)
358 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000359 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000360 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700361 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
362 # Attention: always take care to bind libsocket and libnsl before libc,
363 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000364 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800365# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100366*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100367 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700368 AC_DEFINE(SETEUID_BREAKS_SETUID)
369 AC_DEFINE(BROKEN_SETREUID)
370 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700371 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100372 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800373# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100374*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100375 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700376 AC_DEFINE(SETEUID_BREAKS_SETUID)
377 AC_DEFINE(BROKEN_SETREUID)
378 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700379 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700380 case "$host" in
381 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
382 TEST_SHELL=/u95/bin/sh
383 ;;
384 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100385 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100386*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100387 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800388# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100389*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800390 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100391 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800392# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100393*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800394 if test -z "$GCC"; then
395 CFLAGS="$CFLAGS -belf"
396 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100397 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000398 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100399 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000400 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000401 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700402 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700406 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700407 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100408 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100409 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700410 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700411 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000412 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000413*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100414 AC_DEFINE(NO_SSH_LASTLOG)
415 AC_DEFINE(SETEUID_BREAKS_SETUID)
416 AC_DEFINE(BROKEN_SETREUID)
417 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000418 AC_DEFINE(USE_PIPES)
419 AC_DEFINE(DISABLE_FD_PASSING)
420 LDFLAGS="$LDFLAGS"
421 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
422 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000423 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000424*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100425 AC_DEFINE(SETEUID_BREAKS_SETUID)
426 AC_DEFINE(BROKEN_SETREUID)
427 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000428 AC_DEFINE(WITH_ABBREV_NO_TTY)
429 AC_DEFINE(USE_PIPES)
430 AC_DEFINE(DISABLE_FD_PASSING)
431 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100432 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000433 MANTYPE=cat
434 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000435*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100436 AC_DEFINE(SETEUID_BREAKS_SETUID)
437 AC_DEFINE(BROKEN_SETREUID)
438 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000439 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700440 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700441 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000442 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
443 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
444 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700445 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000446*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000447 AC_MSG_CHECKING(for Digital Unix SIA)
448 no_osfsia=""
449 AC_ARG_WITH(osfsia,
450 [ --with-osfsia Enable Digital Unix SIA],
451 [
452 if test "x$withval" = "xno" ; then
453 AC_MSG_RESULT(disabled)
454 no_osfsia=1
455 fi
456 ],
457 )
458 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000459 if test -f /etc/sia/matrix.conf; then
460 AC_MSG_RESULT(yes)
461 AC_DEFINE(HAVE_OSF_SIA)
462 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000463 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000464 LIBS="$LIBS -lsecurity -ldb -lm -laud"
465 else
466 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100467 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000468 fi
469 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000470 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700471 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000472 AC_DEFINE(BROKEN_SETREUID)
473 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000474 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000475
476*-*-nto-qnx)
477 AC_DEFINE(USE_PIPES)
478 AC_DEFINE(NO_X11_UNIX_SOCKETS)
479 AC_DEFINE(MISSING_NFDBITS)
480 AC_DEFINE(MISSING_HOWMANY)
481 AC_DEFINE(MISSING_FD_MASK)
482 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000483
484*-*-ultrix*)
485 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
486 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
487 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700488 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
489 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100490esac
491
Damien Millere37bfc12000-06-05 09:37:43 +1000492# Allow user to specify flags
493AC_ARG_WITH(cflags,
494 [ --with-cflags Specify additional flags to pass to compiler],
495 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800496 if test -n "$withval" && test "x$withval" != "xno" && \
497 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000498 CFLAGS="$CFLAGS $withval"
499 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800500 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000501)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000502AC_ARG_WITH(cppflags,
503 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
504 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800505 if test -n "$withval" && test "x$withval" != "xno" && \
506 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000507 CPPFLAGS="$CPPFLAGS $withval"
508 fi
509 ]
510)
Damien Millere37bfc12000-06-05 09:37:43 +1000511AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000512 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000513 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800514 if test -n "$withval" && test "x$withval" != "xno" && \
515 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000516 LDFLAGS="$LDFLAGS $withval"
517 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800518 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000519)
520AC_ARG_WITH(libs,
521 [ --with-libs Specify additional libraries to link with],
522 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800523 if test -n "$withval" && test "x$withval" != "xno" && \
524 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000525 LIBS="$LIBS $withval"
526 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800527 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000528)
529
Darren Tucker6eb93042003-06-29 21:30:41 +1000530AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000531AC_RUN_IFELSE(
532 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000533#include <stdio.h>
534int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000535 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000536 [ AC_MSG_RESULT(yes) ],
537 [
538 AC_MSG_RESULT(no)
539 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000540 ],
541 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000542)
543
Darren Tucker0c9653f2005-05-28 15:58:14 +1000544dnl Checks for header files.
545AC_CHECK_HEADERS( \
546 bstring.h \
547 crypt.h \
548 dirent.h \
549 endian.h \
550 features.h \
551 floatingpoint.h \
552 getopt.h \
553 glob.h \
554 ia.h \
555 lastlog.h \
556 limits.h \
557 login.h \
558 login_cap.h \
559 maillock.h \
560 ndir.h \
561 netdb.h \
562 netgroup.h \
563 netinet/in_systm.h \
564 pam/pam_appl.h \
565 paths.h \
566 pty.h \
567 readpassphrase.h \
568 rpc/types.h \
569 security/pam_appl.h \
570 shadow.h \
571 stddef.h \
572 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000573 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000574 strings.h \
575 sys/audit.h \
576 sys/bitypes.h \
577 sys/bsdtty.h \
578 sys/cdefs.h \
579 sys/dir.h \
580 sys/mman.h \
581 sys/ndir.h \
582 sys/prctl.h \
583 sys/pstat.h \
584 sys/select.h \
585 sys/stat.h \
586 sys/stream.h \
587 sys/stropts.h \
588 sys/strtio.h \
589 sys/sysmacros.h \
590 sys/time.h \
591 sys/timers.h \
592 sys/un.h \
593 time.h \
594 tmpdir.h \
595 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000596 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000597 usersec.h \
598 util.h \
599 utime.h \
600 utmp.h \
601 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000602 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000603)
Tim Rice4cec93f2002-02-26 08:40:48 -0800604
Darren Tucker48d99d32004-08-29 17:04:50 +1000605# sys/ptms.h requires sys/stream.h to be included first on Solaris
606AC_CHECK_HEADERS(sys/ptms.h, [], [], [
607#ifdef HAVE_SYS_STREAM_H
608# include <sys/stream.h>
609#endif
610])
611
Damien Millera22ba012000-03-02 23:09:20 +1100612# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700613AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
614AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000615
Tim Rice1e1ef642003-09-11 22:19:31 -0700616dnl IRIX and Solaris 2.5.1 have dirname() in libgen
617AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
618 AC_CHECK_LIB(gen, dirname,[
619 AC_CACHE_CHECK([for broken dirname],
620 ac_cv_have_broken_dirname, [
621 save_LIBS="$LIBS"
622 LIBS="$LIBS -lgen"
623 AC_TRY_RUN(
624 [
625#include <libgen.h>
626#include <string.h>
627
628int main(int argc, char **argv) {
629 char *s, buf[32];
630
631 strncpy(buf,"/etc", 32);
632 s = dirname(buf);
633 if (!s || strncmp(s, "/", 32) != 0) {
634 exit(1);
635 } else {
636 exit(0);
637 }
638}
639 ],
640 [ ac_cv_have_broken_dirname="no" ],
641 [ ac_cv_have_broken_dirname="yes" ]
642 )
643 LIBS="$save_LIBS"
644 ])
645 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
646 LIBS="$LIBS -lgen"
647 AC_DEFINE(HAVE_DIRNAME)
648 AC_CHECK_HEADERS(libgen.h)
649 fi
650 ])
651])
652
653AC_CHECK_FUNC(getspnam, ,
654 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
655AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
656
Tim Rice13aae5e2001-10-21 17:53:58 -0700657dnl zlib is required
658AC_ARG_WITH(zlib,
659 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100660 [ if test "x$withval" = "xno" ; then
661 AC_MSG_ERROR([*** zlib is required ***])
662 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700663 if test -d "$withval/lib"; then
664 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700665 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700666 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700667 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700668 fi
669 else
670 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700671 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700672 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700673 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700674 fi
675 fi
676 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700677 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700678 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700679 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700680 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100681 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700682)
683
Tim Ricefcb62202004-01-23 18:35:16 -0800684AC_CHECK_LIB(z, deflate, ,
685 [
686 saved_CPPFLAGS="$CPPFLAGS"
687 saved_LDFLAGS="$LDFLAGS"
688 save_LIBS="$LIBS"
689 dnl Check default zlib install dir
690 if test -n "${need_dash_r}"; then
691 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
692 else
693 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
694 fi
695 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
696 LIBS="$LIBS -lz"
697 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
698 [
699 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
700 ]
701 )
702 ]
703)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100704AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100705
706AC_ARG_WITH(zlib-version-check,
707 [ --without-zlib-version-check Disable zlib version check],
708 [ if test "x$withval" = "xno" ; then
709 zlib_check_nonfatal=1
710 fi
711 ]
712)
713
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000714AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000715AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000716#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100717#include <zlib.h>
718int main()
719{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000720 int a=0, b=0, c=0, d=0, n, v;
721 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
722 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100723 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000724 v = a*1000000 + b*10000 + c*100 + d;
725 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
726
727 /* 1.1.4 is OK */
728 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100729 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000730
731 /* 1.2.1.2 and up are OK */
732 if (v >= 1020102)
733 exit(0);
734
Darren Tucker2dcd2392004-01-23 17:13:33 +1100735 exit(2);
736}
Darren Tucker623d92f2004-09-12 22:36:15 +1000737 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000738 AC_MSG_RESULT(no),
739 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100740 if test -z "$zlib_check_nonfatal" ; then
741 AC_MSG_ERROR([*** zlib too old - check config.log ***
742Your reported zlib version has known security problems. It's possible your
743vendor has fixed these problems without changing the version number. If you
744are sure this is the case, you can disable the check by running
745"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000746If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
747See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100748 else
749 AC_MSG_WARN([zlib version may have security problems])
750 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000751 ],
752 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100753)
Damien Miller6f9c3372000-10-25 10:06:04 +1100754
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000755dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100756AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000757 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
758)
Damien Millera8e06ce2003-11-21 23:48:55 +1100759AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700760 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
761 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000762)
Damien Millerab18c411999-11-11 10:40:23 +1100763
Tim Ricee589a292001-11-03 11:09:32 -0800764dnl Checks for libutil functions
765AC_CHECK_HEADERS(libutil.h)
766AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
767AC_CHECK_FUNCS(logout updwtmp logwtmp)
768
Ben Lindstrom8697e082001-02-24 21:41:10 +0000769AC_FUNC_STRFTIME
770
Damien Miller3c027682001-03-14 11:39:45 +1100771# Check for ALTDIRFUNC glob() extension
772AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
773AC_EGREP_CPP(FOUNDIT,
774 [
775 #include <glob.h>
776 #ifdef GLOB_ALTDIRFUNC
777 FOUNDIT
778 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100779 ],
Damien Miller3c027682001-03-14 11:39:45 +1100780 [
781 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
782 AC_MSG_RESULT(yes)
783 ],
784 [
785 AC_MSG_RESULT(no)
786 ]
787)
Damien Millerab18c411999-11-11 10:40:23 +1100788
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000789# Check for g.gl_matchc glob() extension
790AC_MSG_CHECKING(for gl_matchc field in glob_t)
791AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100792 [
793 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000794 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100795 ],
796 [
797 AC_DEFINE(GLOB_HAS_GL_MATCHC)
798 AC_MSG_RESULT(yes)
799 ],
800 [
801 AC_MSG_RESULT(no)
802 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000803)
804
Damien Miller18bb4732001-03-28 14:35:30 +1000805AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000806AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000807 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000808#include <sys/types.h>
809#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700810int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000811 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100812 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000813 [
814 AC_MSG_RESULT(no)
815 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000816 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800817 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000818 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
819 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000820 ]
821)
822
Damien Miller36f49652004-08-15 18:40:59 +1000823AC_MSG_CHECKING([for /proc/pid/fd directory])
824if test -d "/proc/$$/fd" ; then
825 AC_DEFINE(HAVE_PROC_PID)
826 AC_MSG_RESULT(yes)
827else
828 AC_MSG_RESULT(no)
829fi
830
Damien Millerc547bf12001-02-16 10:18:12 +1100831# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100832SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100833AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100834 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100835 [
836 if test "x$withval" != "xno" ; then
837
838 if test "x$withval" != "xyes" ; then
839 CPPFLAGS="$CPPFLAGS -I${withval}/include"
840 LDFLAGS="$LDFLAGS -L${withval}/lib"
841 fi
842
843 AC_DEFINE(SKEY)
844 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100845 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800846
Tim Rice4cec93f2002-02-26 08:40:48 -0800847 AC_MSG_CHECKING([for s/key support])
848 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100849 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800850#include <stdio.h>
851#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700852int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800853 ],
854 [AC_MSG_RESULT(yes)],
855 [
856 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100857 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
858 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000859 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
860 AC_TRY_COMPILE(
861 [#include <stdio.h>
862 #include <skey.h>],
863 [(void)skeychallenge(NULL,"name","",0);],
864 [AC_MSG_RESULT(yes)
865 AC_DEFINE(SKEYCHALLENGE_4ARG)],
866 [AC_MSG_RESULT(no)]
867 )
Damien Millerc547bf12001-02-16 10:18:12 +1100868 fi
869 ]
870)
871
872# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700873TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100874AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100875 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100876 [
877 if test "x$withval" != "xno" ; then
878 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700879 saved_LDFLAGS="$LDFLAGS"
880 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800881 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800882 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700883 if test -d "${withval}/lib"; then
884 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700885 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700886 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700887 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700888 fi
889 else
890 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700891 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700892 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700893 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700894 fi
895 fi
896 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700897 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700898 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700899 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700900 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700901 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800902 LIBWRAP="-lwrap"
903 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100904 AC_MSG_CHECKING(for libwrap)
905 AC_TRY_LINK(
906 [
Damien Miller0ac45002004-04-14 20:14:26 +1000907#include <sys/types.h>
908#include <sys/socket.h>
909#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100910#include <tcpd.h>
911 int deny_severity = 0, allow_severity = 0;
912 ],
913 [hosts_access(0);],
914 [
915 AC_MSG_RESULT(yes)
916 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800917 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700918 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100919 ],
920 [
921 AC_MSG_ERROR([*** libwrap missing])
922 ]
923 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800924 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100925 fi
926 ]
927)
928
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100929# Check whether user wants libedit support
930LIBEDIT_MSG="no"
931AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100932 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100933 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100934 if test "x$withval" != "xyes"; then
935 CPPFLAGS="$CPPFLAGS -I$withval/include"
936 LDFLAGS="$LDFLAGS -L$withval/lib"
937 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100938 AC_CHECK_LIB(edit, el_init,
939 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
940 LIBEDIT="-ledit -lcurses"
941 LIBEDIT_MSG="yes"
942 AC_SUBST(LIBEDIT)
943 ],
Darren Tucker1df61452005-03-21 09:58:07 +1100944 [ AC_MSG_ERROR(libedit not found) ],
945 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100946 )
947 fi ]
948)
949
Darren Tuckerd9f88912005-02-20 21:01:48 +1100950AUDIT_MODULE=none
951AC_ARG_WITH(audit,
952 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
953 [
954 AC_MSG_CHECKING(for supported audit module)
955 case "$withval" in
956 bsm)
957 AC_MSG_RESULT(bsm)
958 AUDIT_MODULE=bsm
959 dnl Checks for headers, libs and functions
960 AC_CHECK_HEADERS(bsm/audit.h, [],
961 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
962 AC_CHECK_LIB(bsm, getaudit, [],
963 [AC_MSG_ERROR(BSM enabled and required library not found)])
964 AC_CHECK_FUNCS(getaudit, [],
965 [AC_MSG_ERROR(BSM enabled and required function not found)])
966 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +1100967 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +1100968 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
969 ;;
970 debug)
971 AUDIT_MODULE=debug
972 AC_MSG_RESULT(debug)
973 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
974 ;;
975 *)
976 AC_MSG_ERROR([Unknown audit module $withval])
977 ;;
978 esac ]
979)
980
Damien Millerfe1f1432003-02-24 15:45:42 +1100981dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +1000982AC_CHECK_FUNCS( \
983 arc4random \
984 b64_ntop \
985 __b64_ntop \
986 b64_pton \
987 __b64_pton \
988 bcopy \
989 bindresvport_sa \
990 clock \
991 closefrom \
992 dirfd \
993 fchdir \
994 fchmod \
995 fchown \
996 freeaddrinfo \
997 futimes \
998 getaddrinfo \
999 getcwd \
1000 getgrouplist \
1001 getnameinfo \
1002 getopt \
1003 getpeereid \
1004 _getpty \
1005 getrlimit \
1006 getttyent \
1007 glob \
1008 inet_aton \
1009 inet_ntoa \
1010 inet_ntop \
1011 innetgr \
1012 login_getcapbool \
1013 md5_crypt \
1014 memmove \
1015 mkdtemp \
1016 mmap \
1017 ngetaddrinfo \
1018 nsleep \
1019 ogetaddrinfo \
1020 openlog_r \
1021 openpty \
1022 prctl \
1023 pstat \
1024 readpassphrase \
1025 realpath \
1026 recvmsg \
1027 rresvport_af \
1028 sendmsg \
1029 setdtablesize \
1030 setegid \
1031 setenv \
1032 seteuid \
1033 setgroups \
1034 setlogin \
1035 setpcred \
1036 setproctitle \
1037 setregid \
1038 setreuid \
1039 setrlimit \
1040 setsid \
1041 setvbuf \
1042 sigaction \
1043 sigvec \
1044 snprintf \
1045 socketpair \
1046 strdup \
1047 strerror \
1048 strlcat \
1049 strlcpy \
1050 strmode \
1051 strnvis \
1052 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001053 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001054 strtoul \
1055 sysconf \
1056 tcgetpgrp \
1057 truncate \
1058 unsetenv \
1059 updwtmpx \
1060 utimes \
1061 vhangup \
1062 vsnprintf \
1063 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001064)
Tim Rice13aae5e2001-10-21 17:53:58 -07001065
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001066# IRIX has a const char return value for gai_strerror()
1067AC_CHECK_FUNCS(gai_strerror,[
1068 AC_DEFINE(HAVE_GAI_STRERROR)
1069 AC_TRY_COMPILE([
1070#include <sys/types.h>
1071#include <sys/socket.h>
1072#include <netdb.h>
1073
1074const char *gai_strerror(int);],[
1075char *str;
1076
1077str = gai_strerror(0);],[
1078 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1079 [Define if gai_strerror() returns const char *])])])
1080
Damien Millercd6853c2003-01-28 11:33:42 +11001081AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1082
Darren Tuckerf1159b52003-07-07 19:44:01 +10001083dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001084AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001085AC_CHECK_DECL(strsep,
1086 [AC_CHECK_FUNCS(strsep)],
1087 [],
1088 [
1089#ifdef HAVE_STRING_H
1090# include <string.h>
1091#endif
1092 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001093
Darren Tuckerb2427c82003-09-10 15:22:44 +10001094dnl tcsendbreak might be a macro
1095AC_CHECK_DECL(tcsendbreak,
1096 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001097 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001098 [#include <termios.h>]
1099)
1100
Darren Tucker5bb14002004-04-23 18:53:10 +10001101AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1102
Darren Tucker2a6b0292003-12-31 14:59:17 +11001103AC_CHECK_FUNCS(setresuid, [
1104 dnl Some platorms have setresuid that isn't implemented, test for this
1105 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001106 AC_RUN_IFELSE(
1107 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001108#include <stdlib.h>
1109#include <errno.h>
1110int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001111 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001112 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001113 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001114 AC_MSG_RESULT(not implemented)],
1115 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001116 )
1117])
Darren Tuckere937be32003-12-17 18:53:26 +11001118
Darren Tucker2a6b0292003-12-31 14:59:17 +11001119AC_CHECK_FUNCS(setresgid, [
1120 dnl Some platorms have setresgid that isn't implemented, test for this
1121 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001122 AC_RUN_IFELSE(
1123 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001124#include <stdlib.h>
1125#include <errno.h>
1126int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001127 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001128 [AC_MSG_RESULT(yes)],
1129 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001130 AC_MSG_RESULT(not implemented)],
1131 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001132 )
1133])
Darren Tuckere937be32003-12-17 18:53:26 +11001134
Damien Millerad833b32000-08-23 10:46:23 +10001135dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001136AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001137dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001138AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001139AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001140dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001141AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001142AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001143
Damien Millera8e06ce2003-11-21 23:48:55 +11001144AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001145 [AC_DEFINE(HAVE_DAEMON)],
1146 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1147)
1148
Damien Millera8e06ce2003-11-21 23:48:55 +11001149AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001150 [AC_DEFINE(HAVE_GETPAGESIZE)],
1151 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1152)
1153
Damien Millercb170cb2000-07-01 16:52:55 +10001154# Check for broken snprintf
1155if test "x$ac_cv_func_snprintf" = "xyes" ; then
1156 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001157 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001158 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001159#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001160int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001161 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001162 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001163 [
1164 AC_MSG_RESULT(no)
1165 AC_DEFINE(BROKEN_SNPRINTF)
1166 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001167 ],
1168 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001169 )
1170fi
1171
Damien Millerb4097182004-05-23 14:09:40 +10001172# Check for missing getpeereid (or equiv) support
1173NO_PEERCHECK=""
1174if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1175 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1176 AC_TRY_COMPILE(
1177 [#include <sys/types.h>
1178 #include <sys/socket.h>],
1179 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001180 [ AC_MSG_RESULT(yes)
1181 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1182 ],
Damien Millerb4097182004-05-23 14:09:40 +10001183 [AC_MSG_RESULT(no)
1184 NO_PEERCHECK=1]
1185 )
1186fi
1187
Damien Millere8328192003-01-07 15:18:32 +11001188dnl see whether mkstemp() requires XXXXXX
1189if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1190AC_MSG_CHECKING([for (overly) strict mkstemp])
1191AC_TRY_RUN(
1192 [
1193#include <stdlib.h>
1194main() { char template[]="conftest.mkstemp-test";
1195if (mkstemp(template) == -1)
1196 exit(1);
1197unlink(template); exit(0);
1198}
1199 ],
1200 [
1201 AC_MSG_RESULT(no)
1202 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001203 [
Damien Millere8328192003-01-07 15:18:32 +11001204 AC_MSG_RESULT(yes)
1205 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1206 ],
1207 [
1208 AC_MSG_RESULT(yes)
1209 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001210 ]
Damien Millere8328192003-01-07 15:18:32 +11001211)
1212fi
1213
Darren Tucker70a3d552003-08-21 17:58:29 +10001214dnl make sure that openpty does not reacquire controlling terminal
1215if test ! -z "$check_for_openpty_ctty_bug"; then
1216 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1217 AC_TRY_RUN(
1218 [
1219#include <stdio.h>
1220#include <sys/fcntl.h>
1221#include <sys/types.h>
1222#include <sys/wait.h>
1223
1224int
1225main()
1226{
1227 pid_t pid;
1228 int fd, ptyfd, ttyfd, status;
1229
1230 pid = fork();
1231 if (pid < 0) { /* failed */
1232 exit(1);
1233 } else if (pid > 0) { /* parent */
1234 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001235 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001236 exit(WEXITSTATUS(status));
1237 else
1238 exit(2);
1239 } else { /* child */
1240 close(0); close(1); close(2);
1241 setsid();
1242 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1243 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1244 if (fd >= 0)
1245 exit(3); /* Acquired ctty: broken */
1246 else
1247 exit(0); /* Did not acquire ctty: OK */
1248 }
1249}
1250 ],
1251 [
1252 AC_MSG_RESULT(yes)
1253 ],
1254 [
1255 AC_MSG_RESULT(no)
1256 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1257 ]
1258 )
1259fi
1260
Tim Rice8bb561b2005-03-17 16:23:19 -08001261if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1262 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001263 AC_MSG_CHECKING(if getaddrinfo seems to work)
1264 AC_TRY_RUN(
1265 [
1266#include <stdio.h>
1267#include <sys/socket.h>
1268#include <netdb.h>
1269#include <errno.h>
1270#include <netinet/in.h>
1271
1272#define TEST_PORT "2222"
1273
1274int
1275main(void)
1276{
1277 int err, sock;
1278 struct addrinfo *gai_ai, *ai, hints;
1279 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1280
1281 memset(&hints, 0, sizeof(hints));
1282 hints.ai_family = PF_UNSPEC;
1283 hints.ai_socktype = SOCK_STREAM;
1284 hints.ai_flags = AI_PASSIVE;
1285
1286 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1287 if (err != 0) {
1288 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1289 exit(1);
1290 }
1291
1292 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1293 if (ai->ai_family != AF_INET6)
1294 continue;
1295
1296 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1297 sizeof(ntop), strport, sizeof(strport),
1298 NI_NUMERICHOST|NI_NUMERICSERV);
1299
1300 if (err != 0) {
1301 if (err == EAI_SYSTEM)
1302 perror("getnameinfo EAI_SYSTEM");
1303 else
1304 fprintf(stderr, "getnameinfo failed: %s\n",
1305 gai_strerror(err));
1306 exit(2);
1307 }
1308
1309 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1310 if (sock < 0)
1311 perror("socket");
1312 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1313 if (errno == EBADF)
1314 exit(3);
1315 }
1316 }
1317 exit(0);
1318}
1319 ],
1320 [
1321 AC_MSG_RESULT(yes)
1322 ],
1323 [
1324 AC_MSG_RESULT(no)
1325 AC_DEFINE(BROKEN_GETADDRINFO)
1326 ]
1327 )
1328fi
1329
Tim Rice8bb561b2005-03-17 16:23:19 -08001330if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1331 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001332 AC_MSG_CHECKING(if getaddrinfo seems to work)
1333 AC_TRY_RUN(
1334 [
1335#include <stdio.h>
1336#include <sys/socket.h>
1337#include <netdb.h>
1338#include <errno.h>
1339#include <netinet/in.h>
1340
1341#define TEST_PORT "2222"
1342
1343int
1344main(void)
1345{
1346 int err, sock;
1347 struct addrinfo *gai_ai, *ai, hints;
1348 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1349
1350 memset(&hints, 0, sizeof(hints));
1351 hints.ai_family = PF_UNSPEC;
1352 hints.ai_socktype = SOCK_STREAM;
1353 hints.ai_flags = AI_PASSIVE;
1354
1355 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1356 if (err != 0) {
1357 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1358 exit(1);
1359 }
1360
1361 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1362 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1363 continue;
1364
1365 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1366 sizeof(ntop), strport, sizeof(strport),
1367 NI_NUMERICHOST|NI_NUMERICSERV);
1368
1369 if (ai->ai_family == AF_INET && err != 0) {
1370 perror("getnameinfo");
1371 exit(2);
1372 }
1373 }
1374 exit(0);
1375}
1376 ],
1377 [
1378 AC_MSG_RESULT(yes)
1379 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1380[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1381 ],
1382 [
1383 AC_MSG_RESULT(no)
1384 AC_DEFINE(BROKEN_GETADDRINFO)
1385 ]
1386 )
1387fi
1388
Darren Tuckera56f1912004-11-02 20:30:54 +11001389if test "x$check_for_conflicting_getspnam" = "x1"; then
1390 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1391 AC_COMPILE_IFELSE(
1392 [
1393#include <shadow.h>
1394int main(void) {exit(0);}
1395 ],
1396 [
1397 AC_MSG_RESULT(no)
1398 ],
1399 [
1400 AC_MSG_RESULT(yes)
1401 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1402 [Conflicting defs for getspnam])
1403 ]
1404 )
1405fi
1406
Damien Miller606f8802000-09-16 15:39:56 +11001407AC_FUNC_GETPGRP
1408
Damien Millera64b57a2001-01-17 10:44:13 +11001409# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001410PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001411AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001412 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001413 [
Damien Millera64b57a2001-01-17 10:44:13 +11001414 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001415 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1416 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001417 AC_MSG_ERROR([PAM headers not found])
1418 fi
1419
1420 AC_CHECK_LIB(dl, dlopen, , )
1421 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1422 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001423 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001424
Damien Millera64b57a2001-01-17 10:44:13 +11001425 PAM_MSG="yes"
1426
1427 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001428 if test $ac_cv_lib_dl_dlopen = yes; then
1429 LIBPAM="-lpam -ldl"
1430 else
1431 LIBPAM="-lpam"
1432 fi
1433 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001434 fi
1435 ]
1436)
Damien Millera22ba012000-03-02 23:09:20 +11001437
Damien Millera64b57a2001-01-17 10:44:13 +11001438# Check for older PAM
1439if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001440 # Check PAM strerror arguments (old PAM)
1441 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1442 AC_TRY_COMPILE(
1443 [
Damien Miller81171112000-04-23 11:14:01 +10001444#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001445#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001446#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001447#elif defined (HAVE_PAM_PAM_APPL_H)
1448#include <pam/pam_appl.h>
1449#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001450 ],
1451 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001452 [AC_MSG_RESULT(no)],
1453 [
1454 AC_DEFINE(HAVE_OLD_PAM)
1455 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001456 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001457 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001458 )
Damien Millera22ba012000-03-02 23:09:20 +11001459fi
1460
Tim Riceaef73712002-05-11 13:17:42 -07001461# Search for OpenSSL
1462saved_CPPFLAGS="$CPPFLAGS"
1463saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001464AC_ARG_WITH(ssl-dir,
1465 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1466 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001467 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001468 case "$withval" in
1469 # Relative paths
1470 ./*|../*) withval="`pwd`/$withval"
1471 esac
Tim Riceaef73712002-05-11 13:17:42 -07001472 if test -d "$withval/lib"; then
1473 if test -n "${need_dash_r}"; then
1474 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1475 else
1476 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1477 fi
1478 else
1479 if test -n "${need_dash_r}"; then
1480 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1481 else
1482 LDFLAGS="-L${withval} ${LDFLAGS}"
1483 fi
1484 fi
1485 if test -d "$withval/include"; then
1486 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1487 else
1488 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1489 fi
Damien Millera22ba012000-03-02 23:09:20 +11001490 fi
1491 ]
1492)
Tim Rice3d5352e2004-02-12 09:27:21 -08001493LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001494AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001495 [
Tim Riceaef73712002-05-11 13:17:42 -07001496 dnl Check default openssl install dir
1497 if test -n "${need_dash_r}"; then
1498 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001499 else
Tim Riceaef73712002-05-11 13:17:42 -07001500 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001501 fi
Tim Riceaef73712002-05-11 13:17:42 -07001502 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1503 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1504 [
1505 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1506 ]
1507 )
1508 ]
1509)
1510
Tim Riced730b782002-08-13 18:52:10 -07001511# Determine OpenSSL header version
1512AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001513AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001514 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001515#include <stdio.h>
1516#include <string.h>
1517#include <openssl/opensslv.h>
1518#define DATA "conftest.sslincver"
1519int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001520 FILE *fd;
1521 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001522
Damien Millera8e06ce2003-11-21 23:48:55 +11001523 fd = fopen(DATA,"w");
1524 if(fd == NULL)
1525 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001526
1527 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1528 exit(1);
1529
1530 exit(0);
1531}
Darren Tucker623d92f2004-09-12 22:36:15 +10001532 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001533 [
1534 ssl_header_ver=`cat conftest.sslincver`
1535 AC_MSG_RESULT($ssl_header_ver)
1536 ],
1537 [
1538 AC_MSG_RESULT(not found)
1539 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001540 ],
1541 [
1542 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001543 ]
1544)
1545
1546# Determine OpenSSL library version
1547AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001548AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001549 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001550#include <stdio.h>
1551#include <string.h>
1552#include <openssl/opensslv.h>
1553#include <openssl/crypto.h>
1554#define DATA "conftest.ssllibver"
1555int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001556 FILE *fd;
1557 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001558
Damien Millera8e06ce2003-11-21 23:48:55 +11001559 fd = fopen(DATA,"w");
1560 if(fd == NULL)
1561 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001562
1563 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1564 exit(1);
1565
1566 exit(0);
1567}
Darren Tucker623d92f2004-09-12 22:36:15 +10001568 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001569 [
1570 ssl_library_ver=`cat conftest.ssllibver`
1571 AC_MSG_RESULT($ssl_library_ver)
1572 ],
1573 [
1574 AC_MSG_RESULT(not found)
1575 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001576 ],
1577 [
1578 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001579 ]
1580)
Damien Millera22ba012000-03-02 23:09:20 +11001581
Damien Millerec932372002-01-22 22:16:03 +11001582# Sanity check OpenSSL headers
1583AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001584AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001585 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001586#include <string.h>
1587#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001588int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001589 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001590 [
1591 AC_MSG_RESULT(yes)
1592 ],
1593 [
1594 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001595 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1596Check config.log for details.
1597Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001598 ],
1599 [
1600 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001601 ]
1602)
1603
Tim Rice3d5352e2004-02-12 09:27:21 -08001604# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1605# because the system crypt() is more featureful.
1606if test "x$check_for_libcrypt_before" = "x1"; then
1607 AC_CHECK_LIB(crypt, crypt)
1608fi
1609
Damien Millera8e06ce2003-11-21 23:48:55 +11001610# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001611# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001612if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001613 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001614fi
1615
Damien Miller6c21c512002-01-22 21:57:53 +11001616
1617### Configure cryptographic random number support
1618
1619# Check wheter OpenSSL seeds itself
1620AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001621AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001622 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001623#include <string.h>
1624#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001625int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001626 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001627 [
1628 OPENSSL_SEEDS_ITSELF=yes
1629 AC_MSG_RESULT(yes)
1630 ],
1631 [
1632 AC_MSG_RESULT(no)
1633 # Default to use of the rand helper if OpenSSL doesn't
1634 # seed itself
1635 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001636 ],
1637 [
1638 AC_MSG_WARN([cross compiling: assuming yes])
1639 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001640 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001641 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001642 ]
1643)
1644
1645
1646# Do we want to force the use of the rand helper?
1647AC_ARG_WITH(rand-helper,
1648 [ --with-rand-helper Use subprocess to gather strong randomness ],
1649 [
1650 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001651 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001652 # the previous test showed it to be unseeded.
1653 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1654 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1655 OPENSSL_SEEDS_ITSELF=yes
1656 USE_RAND_HELPER=""
1657 fi
1658 else
1659 USE_RAND_HELPER=yes
1660 fi
1661 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001662)
Damien Miller6c21c512002-01-22 21:57:53 +11001663
1664# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001665if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001666 # OpenSSL only
1667 AC_DEFINE(OPENSSL_PRNG_ONLY)
1668 RAND_MSG="OpenSSL internal ONLY"
1669 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001670elif test ! -z "$USE_RAND_HELPER" ; then
1671 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001672 RAND_MSG="ssh-rand-helper"
1673 INSTALL_SSH_RAND_HELPER="yes"
1674fi
1675AC_SUBST(INSTALL_SSH_RAND_HELPER)
1676
1677### Configuration of ssh-rand-helper
1678
1679# PRNGD TCP socket
1680AC_ARG_WITH(prngd-port,
1681 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1682 [
Damien Millere996d722002-01-23 11:20:59 +11001683 case "$withval" in
1684 no)
1685 withval=""
1686 ;;
1687 [[0-9]]*)
1688 ;;
1689 *)
1690 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1691 ;;
1692 esac
1693 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001694 PRNGD_PORT="$withval"
1695 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1696 fi
1697 ]
1698)
1699
1700# PRNGD Unix domain socket
1701AC_ARG_WITH(prngd-socket,
1702 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1703 [
Damien Millere996d722002-01-23 11:20:59 +11001704 case "$withval" in
1705 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001706 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001707 ;;
1708 no)
1709 withval=""
1710 ;;
1711 /*)
1712 ;;
1713 *)
1714 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1715 ;;
1716 esac
1717
1718 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001719 if test ! -z "$PRNGD_PORT" ; then
1720 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1721 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001722 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001723 AC_MSG_WARN(Entropy socket is not readable)
1724 fi
1725 PRNGD_SOCKET="$withval"
1726 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1727 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001728 ],
1729 [
1730 # Check for existing socket only if we don't have a random device already
1731 if test "$USE_RAND_HELPER" = yes ; then
1732 AC_MSG_CHECKING(for PRNGD/EGD socket)
1733 # Insert other locations here
1734 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1735 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1736 PRNGD_SOCKET="$sock"
1737 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1738 break;
1739 fi
1740 done
1741 if test ! -z "$PRNGD_SOCKET" ; then
1742 AC_MSG_RESULT($PRNGD_SOCKET)
1743 else
1744 AC_MSG_RESULT(not found)
1745 fi
1746 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001747 ]
1748)
1749
1750# Change default command timeout for hashing entropy source
1751entropy_timeout=200
1752AC_ARG_WITH(entropy-timeout,
1753 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1754 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001755 if test -n "$withval" && test "x$withval" != "xno" && \
1756 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001757 entropy_timeout=$withval
1758 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001759 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001760)
Damien Miller6c21c512002-01-22 21:57:53 +11001761AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1762
Damien Millerd3f6ad22002-06-25 10:24:47 +10001763SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001764AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001765 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001766 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001767 if test -n "$withval" && test "x$withval" != "xno" && \
1768 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001769 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001770 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001771 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001772)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001773AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1774AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001775
Tim Rice88f2ab52002-03-17 12:17:34 -08001776# We do this little dance with the search path to insure
1777# that programs that we select for use by installed programs
1778# (which may be run by the super-user) come from trusted
1779# locations before they come from the user's private area.
1780# This should help avoid accidentally configuring some
1781# random version of a program in someone's personal bin.
1782
1783OPATH=$PATH
1784PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001785test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001786test -d /sbin && PATH=$PATH:/sbin
1787test -d /usr/sbin && PATH=$PATH:/usr/sbin
1788PATH=$PATH:/etc:$OPATH
1789
Damien Millera8e06ce2003-11-21 23:48:55 +11001790# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001791OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1792OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1793OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1794OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1795OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1796OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1797OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1798OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1799OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1800OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1801OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1802OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1803OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1804OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1805OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1806OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001807# restore PATH
1808PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001809
1810# Where does ssh-rand-helper get its randomness from?
1811INSTALL_SSH_PRNG_CMDS=""
1812if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1813 if test ! -z "$PRNGD_PORT" ; then
1814 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1815 elif test ! -z "$PRNGD_SOCKET" ; then
1816 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1817 else
1818 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1819 RAND_HELPER_CMDHASH=yes
1820 INSTALL_SSH_PRNG_CMDS="yes"
1821 fi
1822fi
1823AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1824
1825
Ben Lindstromb5628642000-10-18 00:02:25 +00001826# Cheap hack to ensure NEWS-OS libraries are arranged right.
1827if test ! -z "$SONY" ; then
1828 LIBS="$LIBS -liberty";
1829fi
1830
Damien Millera22ba012000-03-02 23:09:20 +11001831# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001832AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001833AC_CHECK_SIZEOF(short int, 2)
1834AC_CHECK_SIZEOF(int, 4)
1835AC_CHECK_SIZEOF(long int, 4)
1836AC_CHECK_SIZEOF(long long int, 8)
1837
Damien Millerfa2bb692002-04-23 23:22:25 +10001838# Sanity check long long for some platforms (AIX)
1839if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1840 ac_cv_sizeof_long_long_int=0
1841fi
1842
Damien Millera22ba012000-03-02 23:09:20 +11001843# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001844AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1845 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001846 [ #include <sys/types.h> ],
1847 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001848 [ ac_cv_have_u_int="yes" ],
1849 [ ac_cv_have_u_int="no" ]
1850 )
1851])
1852if test "x$ac_cv_have_u_int" = "xyes" ; then
1853 AC_DEFINE(HAVE_U_INT)
1854 have_u_int=1
1855fi
1856
Damien Miller61e50f12000-05-08 20:49:37 +10001857AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1858 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001859 [ #include <sys/types.h> ],
1860 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001861 [ ac_cv_have_intxx_t="yes" ],
1862 [ ac_cv_have_intxx_t="no" ]
1863 )
1864])
1865if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1866 AC_DEFINE(HAVE_INTXX_T)
1867 have_intxx_t=1
1868fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001869
1870if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001871 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001872then
1873 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1874 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001875 [ #include <stdint.h> ],
1876 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001877 [
1878 AC_DEFINE(HAVE_INTXX_T)
1879 AC_MSG_RESULT(yes)
1880 ],
1881 [ AC_MSG_RESULT(no) ]
1882 )
1883fi
1884
Damien Miller578783e2000-09-23 14:12:24 +11001885AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1886 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001887 [
1888#include <sys/types.h>
1889#ifdef HAVE_STDINT_H
1890# include <stdint.h>
1891#endif
1892#include <sys/socket.h>
1893#ifdef HAVE_SYS_BITYPES_H
1894# include <sys/bitypes.h>
1895#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001896 ],
1897 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001898 [ ac_cv_have_int64_t="yes" ],
1899 [ ac_cv_have_int64_t="no" ]
1900 )
1901])
1902if test "x$ac_cv_have_int64_t" = "xyes" ; then
1903 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001904fi
1905
Damien Miller61e50f12000-05-08 20:49:37 +10001906AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1907 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001908 [ #include <sys/types.h> ],
1909 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001910 [ ac_cv_have_u_intxx_t="yes" ],
1911 [ ac_cv_have_u_intxx_t="no" ]
1912 )
1913])
1914if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1915 AC_DEFINE(HAVE_U_INTXX_T)
1916 have_u_intxx_t=1
1917fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001918
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001919if test -z "$have_u_intxx_t" ; then
1920 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1921 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001922 [ #include <sys/socket.h> ],
1923 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001924 [
1925 AC_DEFINE(HAVE_U_INTXX_T)
1926 AC_MSG_RESULT(yes)
1927 ],
1928 [ AC_MSG_RESULT(no) ]
1929 )
1930fi
1931
Damien Miller578783e2000-09-23 14:12:24 +11001932AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1933 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001934 [ #include <sys/types.h> ],
1935 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001936 [ ac_cv_have_u_int64_t="yes" ],
1937 [ ac_cv_have_u_int64_t="no" ]
1938 )
1939])
1940if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1941 AC_DEFINE(HAVE_U_INT64_T)
1942 have_u_int64_t=1
1943fi
1944
Tim Rice4cec93f2002-02-26 08:40:48 -08001945if test -z "$have_u_int64_t" ; then
1946 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1947 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001948 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001949 [ u_int64_t a; a = 1],
1950 [
1951 AC_DEFINE(HAVE_U_INT64_T)
1952 AC_MSG_RESULT(yes)
1953 ],
1954 [ AC_MSG_RESULT(no) ]
1955 )
1956fi
1957
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001958if test -z "$have_u_intxx_t" ; then
1959 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1960 AC_TRY_COMPILE(
1961 [
1962#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001963 ],
1964 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001965 [ ac_cv_have_uintxx_t="yes" ],
1966 [ ac_cv_have_uintxx_t="no" ]
1967 )
1968 ])
1969 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1970 AC_DEFINE(HAVE_UINTXX_T)
1971 fi
1972fi
1973
1974if test -z "$have_uintxx_t" ; then
1975 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1976 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001977 [ #include <stdint.h> ],
1978 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001979 [
1980 AC_DEFINE(HAVE_UINTXX_T)
1981 AC_MSG_RESULT(yes)
1982 ],
1983 [ AC_MSG_RESULT(no) ]
1984 )
1985fi
1986
Damien Milleredb82922000-06-20 13:25:52 +10001987if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001988 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001989then
1990 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1991 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001992 [
1993#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001994 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001995 [
Damien Miller70494d12000-04-03 15:57:06 +10001996 int8_t a; int16_t b; int32_t c;
1997 u_int8_t e; u_int16_t f; u_int32_t g;
1998 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001999 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002000 [
2001 AC_DEFINE(HAVE_U_INTXX_T)
2002 AC_DEFINE(HAVE_INTXX_T)
2003 AC_MSG_RESULT(yes)
2004 ],
2005 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002006 )
Damien Millerb29ea912000-01-15 14:12:03 +11002007fi
2008
Damien Miller58be7382001-09-15 21:31:54 +10002009
2010AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2011 AC_TRY_COMPILE(
2012 [
2013#include <sys/types.h>
2014 ],
2015 [ u_char foo; foo = 125; ],
2016 [ ac_cv_have_u_char="yes" ],
2017 [ ac_cv_have_u_char="no" ]
2018 )
2019])
2020if test "x$ac_cv_have_u_char" = "xyes" ; then
2021 AC_DEFINE(HAVE_U_CHAR)
2022fi
2023
Tim Rice13aae5e2001-10-21 17:53:58 -07002024TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002025
Tim Rice200a5c02002-02-26 22:12:34 -08002026AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002027
Damien Miller848b9932005-02-24 12:12:34 +11002028AC_CHECK_TYPES(in_addr_t,,,
2029[#include <sys/types.h>
2030#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002031
Damien Miller61e50f12000-05-08 20:49:37 +10002032AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2033 AC_TRY_COMPILE(
2034 [
2035#include <sys/types.h>
2036 ],
2037 [ size_t foo; foo = 1235; ],
2038 [ ac_cv_have_size_t="yes" ],
2039 [ ac_cv_have_size_t="no" ]
2040 )
2041])
2042if test "x$ac_cv_have_size_t" = "xyes" ; then
2043 AC_DEFINE(HAVE_SIZE_T)
2044fi
Damien Miller95058511999-12-29 10:36:45 +11002045
Damien Miller615f9392000-05-17 22:53:33 +10002046AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2047 AC_TRY_COMPILE(
2048 [
2049#include <sys/types.h>
2050 ],
2051 [ ssize_t foo; foo = 1235; ],
2052 [ ac_cv_have_ssize_t="yes" ],
2053 [ ac_cv_have_ssize_t="no" ]
2054 )
2055])
2056if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2057 AC_DEFINE(HAVE_SSIZE_T)
2058fi
2059
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002060AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2061 AC_TRY_COMPILE(
2062 [
2063#include <time.h>
2064 ],
2065 [ clock_t foo; foo = 1235; ],
2066 [ ac_cv_have_clock_t="yes" ],
2067 [ ac_cv_have_clock_t="no" ]
2068 )
2069])
2070if test "x$ac_cv_have_clock_t" = "xyes" ; then
2071 AC_DEFINE(HAVE_CLOCK_T)
2072fi
2073
Damien Millerb54b40e2000-06-23 08:23:34 +10002074AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2075 AC_TRY_COMPILE(
2076 [
2077#include <sys/types.h>
2078#include <sys/socket.h>
2079 ],
2080 [ sa_family_t foo; foo = 1235; ],
2081 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002082 [ AC_TRY_COMPILE(
2083 [
2084#include <sys/types.h>
2085#include <sys/socket.h>
2086#include <netinet/in.h>
2087 ],
2088 [ sa_family_t foo; foo = 1235; ],
2089 [ ac_cv_have_sa_family_t="yes" ],
2090
Damien Millerb54b40e2000-06-23 08:23:34 +10002091 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002092 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002093 )
2094])
2095if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2096 AC_DEFINE(HAVE_SA_FAMILY_T)
2097fi
2098
Damien Miller0f91b4e2000-06-18 15:43:25 +10002099AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2100 AC_TRY_COMPILE(
2101 [
2102#include <sys/types.h>
2103 ],
2104 [ pid_t foo; foo = 1235; ],
2105 [ ac_cv_have_pid_t="yes" ],
2106 [ ac_cv_have_pid_t="no" ]
2107 )
2108])
2109if test "x$ac_cv_have_pid_t" = "xyes" ; then
2110 AC_DEFINE(HAVE_PID_T)
2111fi
2112
2113AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2114 AC_TRY_COMPILE(
2115 [
2116#include <sys/types.h>
2117 ],
2118 [ mode_t foo; foo = 1235; ],
2119 [ ac_cv_have_mode_t="yes" ],
2120 [ ac_cv_have_mode_t="no" ]
2121 )
2122])
2123if test "x$ac_cv_have_mode_t" = "xyes" ; then
2124 AC_DEFINE(HAVE_MODE_T)
2125fi
2126
Damien Miller61e50f12000-05-08 20:49:37 +10002127
2128AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2129 AC_TRY_COMPILE(
2130 [
Damien Miller81171112000-04-23 11:14:01 +10002131#include <sys/types.h>
2132#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002133 ],
2134 [ struct sockaddr_storage s; ],
2135 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2136 [ ac_cv_have_struct_sockaddr_storage="no" ]
2137 )
2138])
2139if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2140 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2141fi
Damien Miller34132e52000-01-14 15:45:46 +11002142
Damien Miller61e50f12000-05-08 20:49:37 +10002143AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2144 AC_TRY_COMPILE(
2145 [
Damien Miller7b22d652000-06-18 14:07:04 +10002146#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002147#include <netinet/in.h>
2148 ],
2149 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2150 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2151 [ ac_cv_have_struct_sockaddr_in6="no" ]
2152 )
2153])
2154if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2155 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2156fi
Damien Miller34132e52000-01-14 15:45:46 +11002157
Damien Miller61e50f12000-05-08 20:49:37 +10002158AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2159 AC_TRY_COMPILE(
2160 [
Damien Miller7b22d652000-06-18 14:07:04 +10002161#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002162#include <netinet/in.h>
2163 ],
2164 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2165 [ ac_cv_have_struct_in6_addr="yes" ],
2166 [ ac_cv_have_struct_in6_addr="no" ]
2167 )
2168])
2169if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2170 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2171fi
Damien Miller34132e52000-01-14 15:45:46 +11002172
Damien Miller61e50f12000-05-08 20:49:37 +10002173AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2174 AC_TRY_COMPILE(
2175 [
Damien Miller81171112000-04-23 11:14:01 +10002176#include <sys/types.h>
2177#include <sys/socket.h>
2178#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002179 ],
2180 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2181 [ ac_cv_have_struct_addrinfo="yes" ],
2182 [ ac_cv_have_struct_addrinfo="no" ]
2183 )
2184])
2185if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2186 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2187fi
2188
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002189AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2190 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002191 [ #include <sys/time.h> ],
2192 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002193 [ ac_cv_have_struct_timeval="yes" ],
2194 [ ac_cv_have_struct_timeval="no" ]
2195 )
2196])
2197if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2198 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2199 have_struct_timeval=1
2200fi
2201
Tim Rice4e4dc562003-03-18 10:21:40 -08002202AC_CHECK_TYPES(struct timespec)
2203
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002204# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002205if test "x$ac_cv_have_int64_t" = "xno" && \
2206 test "x$ac_cv_sizeof_long_int" != "x8" && \
2207 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002208 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2209 echo "an alternative compiler (I.E., GCC) before continuing."
2210 echo ""
2211 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002212else
2213dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002214 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002215 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002216#include <stdio.h>
2217#include <string.h>
2218#ifdef HAVE_SNPRINTF
2219main()
2220{
2221 char buf[50];
2222 char expected_out[50];
2223 int mazsize = 50 ;
2224#if (SIZEOF_LONG_INT == 8)
2225 long int num = 0x7fffffffffffffff;
2226#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002227 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002228#endif
2229 strcpy(expected_out, "9223372036854775807");
2230 snprintf(buf, mazsize, "%lld", num);
2231 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002232 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002233 exit(0);
2234}
2235#else
2236main() { exit(0); }
2237#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002238 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002239 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002240 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002241fi
2242
Damien Miller78315eb2000-09-29 23:01:36 +11002243dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002244OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2245OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2246OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2247OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2248OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002249OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002250OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2251OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002252OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002253OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2254OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2255OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2256OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002257OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2258OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2259OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2260OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002261
2262AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002263
Damien Miller61e50f12000-05-08 20:49:37 +10002264AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2265 ac_cv_have_ss_family_in_struct_ss, [
2266 AC_TRY_COMPILE(
2267 [
Damien Miller81171112000-04-23 11:14:01 +10002268#include <sys/types.h>
2269#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002270 ],
2271 [ struct sockaddr_storage s; s.ss_family = 1; ],
2272 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2273 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2274 )
2275])
2276if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2277 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2278fi
2279
Damien Miller61e50f12000-05-08 20:49:37 +10002280AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2281 ac_cv_have___ss_family_in_struct_ss, [
2282 AC_TRY_COMPILE(
2283 [
Damien Miller81171112000-04-23 11:14:01 +10002284#include <sys/types.h>
2285#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002286 ],
2287 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2288 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2289 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2290 )
2291])
2292if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2293 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2294fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002295
Damien Millerad833b32000-08-23 10:46:23 +10002296AC_CACHE_CHECK([for pw_class field in struct passwd],
2297 ac_cv_have_pw_class_in_struct_passwd, [
2298 AC_TRY_COMPILE(
2299 [
Damien Millerad833b32000-08-23 10:46:23 +10002300#include <pwd.h>
2301 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002302 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002303 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2304 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2305 )
2306])
2307if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2308 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2309fi
2310
Kevin Steves82456952001-06-22 21:14:18 +00002311AC_CACHE_CHECK([for pw_expire field in struct passwd],
2312 ac_cv_have_pw_expire_in_struct_passwd, [
2313 AC_TRY_COMPILE(
2314 [
2315#include <pwd.h>
2316 ],
2317 [ struct passwd p; p.pw_expire = 0; ],
2318 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2319 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2320 )
2321])
2322if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2323 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2324fi
2325
2326AC_CACHE_CHECK([for pw_change field in struct passwd],
2327 ac_cv_have_pw_change_in_struct_passwd, [
2328 AC_TRY_COMPILE(
2329 [
2330#include <pwd.h>
2331 ],
2332 [ struct passwd p; p.pw_change = 0; ],
2333 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2334 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2335 )
2336])
2337if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2338 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2339fi
Damien Miller61e50f12000-05-08 20:49:37 +10002340
Tim Rice28bbb0c2002-05-27 17:37:32 -07002341dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002342AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2343 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002344 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002345 [
Tim Riceae49fe62002-04-12 10:26:21 -07002346#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002347#include <sys/socket.h>
2348#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002349int main() {
2350#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002351#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002352exit(1);
2353#endif
2354struct msghdr m;
2355m.msg_accrights = 0;
2356exit(0);
2357}
Kevin Steves939c9db2002-03-22 17:23:25 +00002358 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002359 [ ac_cv_have_accrights_in_msghdr="yes" ],
2360 [ ac_cv_have_accrights_in_msghdr="no" ]
2361 )
2362])
2363if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2364 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2365fi
2366
Kevin Stevesa44e0352002-04-07 16:18:03 +00002367AC_CACHE_CHECK([for msg_control field in struct msghdr],
2368 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002369 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002370 [
Tim Riceae49fe62002-04-12 10:26:21 -07002371#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002372#include <sys/socket.h>
2373#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002374int main() {
2375#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002376#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002377exit(1);
2378#endif
2379struct msghdr m;
2380m.msg_control = 0;
2381exit(0);
2382}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002383 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002384 [ ac_cv_have_control_in_msghdr="yes" ],
2385 [ ac_cv_have_control_in_msghdr="no" ]
2386 )
2387])
2388if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2389 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2390fi
2391
Damien Miller61e50f12000-05-08 20:49:37 +10002392AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002393 AC_TRY_LINK([],
2394 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002395 [ ac_cv_libc_defines___progname="yes" ],
2396 [ ac_cv_libc_defines___progname="no" ]
2397 )
2398])
2399if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2400 AC_DEFINE(HAVE___PROGNAME)
2401fi
2402
Kevin Steves4846f4a2002-03-22 18:19:53 +00002403AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2404 AC_TRY_LINK([
2405#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002406],
2407 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002408 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2409 [ ac_cv_cc_implements___FUNCTION__="no" ]
2410 )
2411])
2412if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2413 AC_DEFINE(HAVE___FUNCTION__)
2414fi
2415
2416AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2417 AC_TRY_LINK([
2418#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002419],
2420 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002421 [ ac_cv_cc_implements___func__="yes" ],
2422 [ ac_cv_cc_implements___func__="no" ]
2423 )
2424])
2425if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2426 AC_DEFINE(HAVE___func__)
2427fi
2428
Damien Miller4f8e6692001-07-14 13:22:53 +10002429AC_CACHE_CHECK([whether getopt has optreset support],
2430 ac_cv_have_getopt_optreset, [
2431 AC_TRY_LINK(
2432 [
2433#include <getopt.h>
2434 ],
2435 [ extern int optreset; optreset = 0; ],
2436 [ ac_cv_have_getopt_optreset="yes" ],
2437 [ ac_cv_have_getopt_optreset="no" ]
2438 )
2439])
2440if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2441 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2442fi
Damien Millera22ba012000-03-02 23:09:20 +11002443
Damien Millerecbb26d2000-07-15 14:59:14 +10002444AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002445 AC_TRY_LINK([],
2446 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002447 [ ac_cv_libc_defines_sys_errlist="yes" ],
2448 [ ac_cv_libc_defines_sys_errlist="no" ]
2449 )
2450])
2451if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2452 AC_DEFINE(HAVE_SYS_ERRLIST)
2453fi
2454
2455
Damien Miller11fa2cc2000-08-16 10:35:58 +10002456AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002457 AC_TRY_LINK([],
2458 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002459 [ ac_cv_libc_defines_sys_nerr="yes" ],
2460 [ ac_cv_libc_defines_sys_nerr="no" ]
2461 )
2462])
2463if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2464 AC_DEFINE(HAVE_SYS_NERR)
2465fi
2466
Damien Millera8e06ce2003-11-21 23:48:55 +11002467SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002468# Check whether user wants sectok support
2469AC_ARG_WITH(sectok,
2470 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002471 [
2472 if test "x$withval" != "xno" ; then
2473 if test "x$withval" != "xyes" ; then
2474 CPPFLAGS="$CPPFLAGS -I${withval}"
2475 LDFLAGS="$LDFLAGS -L${withval}"
2476 if test ! -z "$need_dash_r" ; then
2477 LDFLAGS="$LDFLAGS -R${withval}"
2478 fi
2479 if test ! -z "$blibpath" ; then
2480 blibpath="$blibpath:${withval}"
2481 fi
2482 fi
2483 AC_CHECK_HEADERS(sectok.h)
2484 if test "$ac_cv_header_sectok_h" != yes; then
2485 AC_MSG_ERROR(Can't find sectok.h)
2486 fi
2487 AC_CHECK_LIB(sectok, sectok_open)
2488 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2489 AC_MSG_ERROR(Can't find libsectok)
2490 fi
2491 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002492 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002493 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002494 fi
2495 ]
2496)
2497
2498# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002499OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002500AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002501 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2502 [
2503 if test "x$withval" != "xno" ; then
2504 if test "x$withval" != "xyes" ; then
2505 OPENSC_CONFIG=$withval/bin/opensc-config
2506 else
2507 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2508 fi
2509 if test "$OPENSC_CONFIG" != "no"; then
2510 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2511 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2512 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2513 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2514 AC_DEFINE(SMARTCARD)
2515 AC_DEFINE(USE_OPENSC)
2516 SCARD_MSG="yes, using OpenSC"
2517 fi
2518 fi
2519 ]
2520)
Damien Miller85de5802001-09-18 14:01:11 +10002521
Darren Tucker5f88d342003-10-15 16:57:57 +10002522# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002523AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002524 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002525 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002526 # Needed by our getrrsetbyname()
2527 AC_SEARCH_LIBS(res_query, resolv)
2528 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002529 AC_MSG_CHECKING(if res_query will link)
2530 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2531 [AC_MSG_RESULT(no)
2532 saved_LIBS="$LIBS"
2533 LIBS="$LIBS -lresolv"
2534 AC_MSG_CHECKING(for res_query in -lresolv)
2535 AC_LINK_IFELSE([
2536#include <resolv.h>
2537int main()
2538{
2539 res_query (0, 0, 0, 0, 0);
2540 return 0;
2541}
2542 ],
2543 [LIBS="$LIBS -lresolv"
2544 AC_MSG_RESULT(yes)],
2545 [LIBS="$saved_LIBS"
2546 AC_MSG_RESULT(no)])
2547 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002548 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002549 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002550 [#include <sys/types.h>
2551 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002552 AC_CHECK_MEMBER(HEADER.ad,
2553 [AC_DEFINE(HAVE_HEADER_AD)],,
2554 [#include <arpa/nameser.h>])
2555 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002556
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002557# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002558KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002559AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002560 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002561 [ if test "x$withval" != "xno" ; then
2562 if test "x$withval" = "xyes" ; then
2563 KRB5ROOT="/usr/local"
2564 else
2565 KRB5ROOT=${withval}
2566 fi
2567
2568 AC_DEFINE(KRB5)
2569 KRB5_MSG="yes"
2570
2571 AC_MSG_CHECKING(for krb5-config)
2572 if test -x $KRB5ROOT/bin/krb5-config ; then
2573 KRB5CONF=$KRB5ROOT/bin/krb5-config
2574 AC_MSG_RESULT($KRB5CONF)
2575
2576 AC_MSG_CHECKING(for gssapi support)
2577 if $KRB5CONF | grep gssapi >/dev/null ; then
2578 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002579 AC_DEFINE(GSSAPI)
2580 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002581 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002582 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002583 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002584 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002585 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2586 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002587 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002588 AC_MSG_CHECKING(whether we are using Heimdal)
2589 AC_TRY_COMPILE([ #include <krb5.h> ],
2590 [ char *tmp = heimdal_version; ],
2591 [ AC_MSG_RESULT(yes)
2592 AC_DEFINE(HEIMDAL) ],
2593 AC_MSG_RESULT(no)
2594 )
2595 else
2596 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002597 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002598 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002599 AC_MSG_CHECKING(whether we are using Heimdal)
2600 AC_TRY_COMPILE([ #include <krb5.h> ],
2601 [ char *tmp = heimdal_version; ],
2602 [ AC_MSG_RESULT(yes)
2603 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002604 K5LIBS="-lkrb5 -ldes"
2605 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002606 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002607 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002608 ],
2609 [ AC_MSG_RESULT(no)
2610 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2611 ]
2612 )
Damien Miller200d0a72003-06-30 19:21:36 +10002613 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002614
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002615 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2616 [ AC_DEFINE(GSSAPI)
2617 K5LIBS="-lgssapi $K5LIBS" ],
2618 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2619 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002620 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002621 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2622 $K5LIBS)
2623 ],
2624 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002625
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002626 AC_CHECK_HEADER(gssapi.h, ,
2627 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002628 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002629 AC_CHECK_HEADERS(gssapi.h, ,
2630 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002631 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002632 ]
2633 )
2634
2635 oldCPP="$CPPFLAGS"
2636 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2637 AC_CHECK_HEADER(gssapi_krb5.h, ,
2638 [ CPPFLAGS="$oldCPP" ])
2639
Damien Millera8e06ce2003-11-21 23:48:55 +11002640 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002641 if test ! -z "$need_dash_r" ; then
2642 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2643 fi
2644 if test ! -z "$blibpath" ; then
2645 blibpath="$blibpath:${KRB5ROOT}/lib"
2646 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002647 fi
2648
2649 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2650 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2651 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2652
2653 LIBS="$LIBS $K5LIBS"
2654 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002655 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002656 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002657)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002658
Damien Millera22ba012000-03-02 23:09:20 +11002659# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002660
Damien Millerf58c6722002-05-13 13:15:42 +10002661PRIVSEP_PATH=/var/empty
2662AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002663 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002664 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002665 if test -n "$withval" && test "x$withval" != "xno" && \
2666 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002667 PRIVSEP_PATH=$withval
2668 fi
2669 ]
2670)
2671AC_SUBST(PRIVSEP_PATH)
2672
Damien Millera22ba012000-03-02 23:09:20 +11002673AC_ARG_WITH(xauth,
2674 [ --with-xauth=PATH Specify path to xauth program ],
2675 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002676 if test -n "$withval" && test "x$withval" != "xno" && \
2677 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002678 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002679 fi
2680 ],
2681 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002682 TestPath="$PATH"
2683 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2684 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2685 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2686 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2687 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002688 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002689 xauth_path="/usr/openwin/bin/xauth"
2690 fi
2691 ]
2692)
2693
Damien Miller7d901272003-01-13 16:55:22 +11002694STRIP_OPT=-s
2695AC_ARG_ENABLE(strip,
2696 [ --disable-strip Disable calling strip(1) on install],
2697 [
2698 if test "x$enableval" = "xno" ; then
2699 STRIP_OPT=
2700 fi
2701 ]
2702)
2703AC_SUBST(STRIP_OPT)
2704
Damien Millera19cf472000-11-29 13:28:50 +11002705if test -z "$xauth_path" ; then
2706 XAUTH_PATH="undefined"
2707 AC_SUBST(XAUTH_PATH)
2708else
Damien Millera22ba012000-03-02 23:09:20 +11002709 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002710 XAUTH_PATH=$xauth_path
2711 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002712fi
Damien Millera22ba012000-03-02 23:09:20 +11002713
2714# Check for mail directory (last resort if we cannot get it from headers)
2715if test ! -z "$MAIL" ; then
2716 maildir=`dirname $MAIL`
2717 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2718fi
2719
Darren Tucker623d92f2004-09-12 22:36:15 +10002720if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002721 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2722 disable_ptmx_check=yes
2723fi
Damien Millera22ba012000-03-02 23:09:20 +11002724if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002725 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002726 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002727 [
2728 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2729 have_dev_ptmx=1
2730 ]
2731 )
2732 fi
Damien Millera22ba012000-03-02 23:09:20 +11002733fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002734
Darren Tucker623d92f2004-09-12 22:36:15 +10002735if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002736 AC_CHECK_FILE("/dev/ptc",
2737 [
2738 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2739 have_dev_ptc=1
2740 ]
2741 )
2742else
2743 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2744fi
Damien Miller204ad072000-03-02 23:56:12 +11002745
Damien Millera22ba012000-03-02 23:09:20 +11002746# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002747AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002748 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002749 [
Damien Miller897741e2001-04-16 10:41:46 +10002750 case "$withval" in
2751 man|cat|doc)
2752 MANTYPE=$withval
2753 ;;
2754 *)
2755 AC_MSG_ERROR(invalid man type: $withval)
2756 ;;
2757 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002758 ]
2759)
Ben Lindstrombc709922001-04-18 18:04:21 +00002760if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002761 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2762 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002763 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2764 MANTYPE=doc
2765 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2766 MANTYPE=man
2767 else
2768 MANTYPE=cat
2769 fi
2770fi
Damien Miller670a4b82000-01-22 13:53:11 +11002771AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002772if test "$MANTYPE" = "doc"; then
2773 mansubdir=man;
2774else
2775 mansubdir=$MANTYPE;
2776fi
2777AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002778
Damien Millera22ba012000-03-02 23:09:20 +11002779# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002780MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002781AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002782 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002783 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002784 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002785 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002786 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002787 fi
2788 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002789)
2790
Damien Millera22ba012000-03-02 23:09:20 +11002791# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002792AC_ARG_WITH(shadow,
2793 [ --without-shadow Disable shadow password support],
2794 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002795 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002796 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002797 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002798 fi
2799 ]
2800)
2801
Damien Miller1f335fb2000-06-26 11:31:33 +10002802if test -z "$disable_shadow" ; then
2803 AC_MSG_CHECKING([if the systems has expire shadow information])
2804 AC_TRY_COMPILE(
2805 [
2806#include <sys/types.h>
2807#include <shadow.h>
2808 struct spwd sp;
2809 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2810 [ sp_expire_available=yes ], []
2811 )
2812
2813 if test "x$sp_expire_available" = "xyes" ; then
2814 AC_MSG_RESULT(yes)
2815 AC_DEFINE(HAS_SHADOW_EXPIRE)
2816 else
2817 AC_MSG_RESULT(no)
2818 fi
2819fi
2820
Damien Millera22ba012000-03-02 23:09:20 +11002821# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002822if test ! -z "$IPADDR_IN_DISPLAY" ; then
2823 DISPLAY_HACK_MSG="yes"
2824 AC_DEFINE(IPADDR_IN_DISPLAY)
2825else
Damien Millera8e06ce2003-11-21 23:48:55 +11002826 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002827 AC_ARG_WITH(ipaddr-display,
2828 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2829 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002830 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002831 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002832 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002833 fi
2834 ]
2835 )
2836fi
Damien Miller76112de1999-12-21 11:18:08 +11002837
Darren Tuckere1a790d2003-09-16 11:52:19 +10002838# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002839AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002840 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002841 [ if test "x$enableval" = "xno"; then
2842 AC_MSG_NOTICE([/etc/default/login handling disabled])
2843 etc_default_login=no
2844 else
2845 etc_default_login=yes
2846 fi ],
2847 [ etc_default_login=yes ]
2848)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002849
Darren Tucker2f9573d2005-02-10 22:28:54 +11002850if test "x$etc_default_login" != "xno"; then
2851 AC_CHECK_FILE("/etc/default/login",
2852 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002853 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2854 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002855 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2856 elif test "x$external_path_file" = "x/etc/default/login"; then
2857 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2858 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002859fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002860
Tim Rice43a1c132002-04-17 21:19:14 -07002861dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002862if test $ac_cv_func_login_getcapbool = "yes" && \
2863 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002864 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002865fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002866
Damien Millera22ba012000-03-02 23:09:20 +11002867# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002868SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002869AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002870 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002871 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002872 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002873 AC_MSG_WARN([
2874--with-default-path=PATH has no effect on this system.
2875Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002876 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002877 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002878 AC_MSG_WARN([
2879--with-default-path=PATH will only be used if PATH is not defined in
2880$external_path_file .])
2881 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002882 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002883 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002884 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002885 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002886 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2887 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002888 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002889 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002890 AC_MSG_WARN([
2891If PATH is defined in $external_path_file, ensure the path to scp is included,
2892otherwise scp will not work.])
2893 fi
2894 AC_TRY_RUN(
2895 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002896/* find out what STDPATH is */
2897#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002898#ifdef HAVE_PATHS_H
2899# include <paths.h>
2900#endif
2901#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002902# ifdef _PATH_USERPATH /* Irix */
2903# define _PATH_STDPATH _PATH_USERPATH
2904# else
2905# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2906# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002907#endif
2908#include <sys/types.h>
2909#include <sys/stat.h>
2910#include <fcntl.h>
2911#define DATA "conftest.stdpath"
2912
2913main()
2914{
2915 FILE *fd;
2916 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002917
Tim Rice59ea0a02001-03-10 13:50:45 -08002918 fd = fopen(DATA,"w");
2919 if(fd == NULL)
2920 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002921
Tim Rice59ea0a02001-03-10 13:50:45 -08002922 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2923 exit(1);
2924
2925 exit(0);
2926}
2927 ], [ user_path=`cat conftest.stdpath` ],
2928 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2929 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2930 )
2931# make sure $bindir is in USER_PATH so scp will work
2932 t_bindir=`eval echo ${bindir}`
2933 case $t_bindir in
2934 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2935 esac
2936 case $t_bindir in
2937 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2938 esac
2939 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2940 if test $? -ne 0 ; then
2941 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2942 if test $? -ne 0 ; then
2943 user_path=$user_path:$t_bindir
2944 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2945 fi
2946 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002947 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002948)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002949if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002950 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2951 AC_SUBST(user_path)
2952fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002953
Damien Millera18bbd32002-05-13 10:48:57 +10002954# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002955AC_ARG_WITH(superuser-path,
2956 [ --with-superuser-path= Specify different path for super-user],
2957 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002958 if test -n "$withval" && test "x$withval" != "xno" && \
2959 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10002960 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2961 superuser_path=$withval
2962 fi
2963 ]
2964)
2965
2966
Damien Miller61e50f12000-05-08 20:49:37 +10002967AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002968IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002969AC_ARG_WITH(4in6,
2970 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2971 [
2972 if test "x$withval" != "xno" ; then
2973 AC_MSG_RESULT(yes)
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)
2978 fi
2979 ],[
2980 if test "x$inet6_default_4in6" = "xyes"; then
2981 AC_MSG_RESULT([yes (default)])
2982 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002983 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002984 else
2985 AC_MSG_RESULT([no (default)])
2986 fi
2987 ]
2988)
2989
Damien Miller60396b02001-02-18 17:01:00 +11002990# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002991BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002992AC_ARG_WITH(bsd-auth,
2993 [ --with-bsd-auth Enable BSD auth support],
2994 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002995 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11002996 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002997 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002998 fi
2999 ]
3000)
3001
Damien Millera22ba012000-03-02 23:09:20 +11003002# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003003piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003004# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003005if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003006 piddir=`eval echo ${sysconfdir}`
3007 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003008 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003009 esac
3010fi
3011
Tim Rice88f2ab52002-03-17 12:17:34 -08003012AC_ARG_WITH(pid-dir,
3013 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3014 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003015 if test -n "$withval" && test "x$withval" != "xno" && \
3016 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003017 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003018 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003019 AC_MSG_WARN([** no $piddir directory on this system **])
3020 fi
3021 fi
3022 ]
3023)
3024
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003025AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003026AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003027
andre2ff7b5d2000-06-03 14:57:40 +00003028dnl allow user to disable some login recording features
3029AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003030 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003031 [
3032 if test "x$enableval" = "xno" ; then
3033 AC_DEFINE(DISABLE_LASTLOG)
3034 fi
3035 ]
andre2ff7b5d2000-06-03 14:57:40 +00003036)
3037AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003038 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003039 [
3040 if test "x$enableval" = "xno" ; then
3041 AC_DEFINE(DISABLE_UTMP)
3042 fi
3043 ]
andre2ff7b5d2000-06-03 14:57:40 +00003044)
3045AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003046 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003047 [
3048 if test "x$enableval" = "xno" ; then
3049 AC_DEFINE(DISABLE_UTMPX)
3050 fi
3051 ]
andre2ff7b5d2000-06-03 14:57:40 +00003052)
3053AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003054 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003055 [
3056 if test "x$enableval" = "xno" ; then
3057 AC_DEFINE(DISABLE_WTMP)
3058 fi
3059 ]
andre2ff7b5d2000-06-03 14:57:40 +00003060)
3061AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003062 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003063 [
3064 if test "x$enableval" = "xno" ; then
3065 AC_DEFINE(DISABLE_WTMPX)
3066 fi
3067 ]
andre2ff7b5d2000-06-03 14:57:40 +00003068)
3069AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003070 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003071 [
3072 if test "x$enableval" = "xno" ; then
3073 AC_DEFINE(DISABLE_LOGIN)
3074 fi
3075 ]
andre2ff7b5d2000-06-03 14:57:40 +00003076)
3077AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003078 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003079 [
3080 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003081 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003082 fi
3083 ]
andre2ff7b5d2000-06-03 14:57:40 +00003084)
3085AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003086 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003087 [
3088 if test "x$enableval" = "xno" ; then
3089 AC_DEFINE(DISABLE_PUTUTXLINE)
3090 fi
3091 ]
andre2ff7b5d2000-06-03 14:57:40 +00003092)
3093AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003094 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003095 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003096 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003097 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003098 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003099 conf_lastlog_location=$withval
3100 fi
3101 ]
3102)
andre2ff7b5d2000-06-03 14:57:40 +00003103
3104dnl lastlog, [uw]tmpx? detection
3105dnl NOTE: set the paths in the platform section to avoid the
3106dnl need for command-line parameters
3107dnl lastlog and [uw]tmp are subject to a file search if all else fails
3108
3109dnl lastlog detection
3110dnl NOTE: the code itself will detect if lastlog is a directory
3111AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3112AC_TRY_COMPILE([
3113#include <sys/types.h>
3114#include <utmp.h>
3115#ifdef HAVE_LASTLOG_H
3116# include <lastlog.h>
3117#endif
Damien Miller2994e082000-06-04 15:51:47 +10003118#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003119# include <paths.h>
3120#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003121#ifdef HAVE_LOGIN_H
3122# include <login.h>
3123#endif
andre2ff7b5d2000-06-03 14:57:40 +00003124 ],
3125 [ char *lastlog = LASTLOG_FILE; ],
3126 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003127 [
3128 AC_MSG_RESULT(no)
3129 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3130 AC_TRY_COMPILE([
3131#include <sys/types.h>
3132#include <utmp.h>
3133#ifdef HAVE_LASTLOG_H
3134# include <lastlog.h>
3135#endif
3136#ifdef HAVE_PATHS_H
3137# include <paths.h>
3138#endif
3139 ],
3140 [ char *lastlog = _PATH_LASTLOG; ],
3141 [ AC_MSG_RESULT(yes) ],
3142 [
andree441aa32000-06-12 22:34:38 +00003143 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003144 system_lastlog_path=no
3145 ])
3146 ]
andre2ff7b5d2000-06-03 14:57:40 +00003147)
Damien Miller2994e082000-06-04 15:51:47 +10003148
andre2ff7b5d2000-06-03 14:57:40 +00003149if test -z "$conf_lastlog_location"; then
3150 if test x"$system_lastlog_path" = x"no" ; then
3151 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003152 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003153 conf_lastlog_location=$f
3154 fi
3155 done
3156 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003157 AC_MSG_WARN([** Cannot find lastlog **])
3158 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003159 fi
3160 fi
3161fi
3162
3163if test -n "$conf_lastlog_location"; then
3164 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003165fi
andre2ff7b5d2000-06-03 14:57:40 +00003166
3167dnl utmp detection
3168AC_MSG_CHECKING([if your system defines UTMP_FILE])
3169AC_TRY_COMPILE([
3170#include <sys/types.h>
3171#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003172#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003173# include <paths.h>
3174#endif
3175 ],
3176 [ char *utmp = UTMP_FILE; ],
3177 [ AC_MSG_RESULT(yes) ],
3178 [ AC_MSG_RESULT(no)
3179 system_utmp_path=no ]
3180)
3181if test -z "$conf_utmp_location"; then
3182 if test x"$system_utmp_path" = x"no" ; then
3183 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3184 if test -f $f ; then
3185 conf_utmp_location=$f
3186 fi
3187 done
3188 if test -z "$conf_utmp_location"; then
3189 AC_DEFINE(DISABLE_UTMP)
3190 fi
3191 fi
3192fi
3193if test -n "$conf_utmp_location"; then
3194 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003195fi
andre2ff7b5d2000-06-03 14:57:40 +00003196
3197dnl wtmp detection
3198AC_MSG_CHECKING([if your system defines WTMP_FILE])
3199AC_TRY_COMPILE([
3200#include <sys/types.h>
3201#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003202#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003203# include <paths.h>
3204#endif
3205 ],
3206 [ char *wtmp = WTMP_FILE; ],
3207 [ AC_MSG_RESULT(yes) ],
3208 [ AC_MSG_RESULT(no)
3209 system_wtmp_path=no ]
3210)
3211if test -z "$conf_wtmp_location"; then
3212 if test x"$system_wtmp_path" = x"no" ; then
3213 for f in /usr/adm/wtmp /var/log/wtmp; do
3214 if test -f $f ; then
3215 conf_wtmp_location=$f
3216 fi
3217 done
3218 if test -z "$conf_wtmp_location"; then
3219 AC_DEFINE(DISABLE_WTMP)
3220 fi
3221 fi
3222fi
3223if test -n "$conf_wtmp_location"; then
3224 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003225fi
andre2ff7b5d2000-06-03 14:57:40 +00003226
3227
3228dnl utmpx detection - I don't know any system so perverse as to require
3229dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3230dnl there, though.
3231AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3232AC_TRY_COMPILE([
3233#include <sys/types.h>
3234#include <utmp.h>
3235#ifdef HAVE_UTMPX_H
3236#include <utmpx.h>
3237#endif
Damien Miller2994e082000-06-04 15:51:47 +10003238#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003239# include <paths.h>
3240#endif
3241 ],
3242 [ char *utmpx = UTMPX_FILE; ],
3243 [ AC_MSG_RESULT(yes) ],
3244 [ AC_MSG_RESULT(no)
3245 system_utmpx_path=no ]
3246)
3247if test -z "$conf_utmpx_location"; then
3248 if test x"$system_utmpx_path" = x"no" ; then
3249 AC_DEFINE(DISABLE_UTMPX)
3250 fi
3251else
3252 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003253fi
andre2ff7b5d2000-06-03 14:57:40 +00003254
3255dnl wtmpx detection
3256AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3257AC_TRY_COMPILE([
3258#include <sys/types.h>
3259#include <utmp.h>
3260#ifdef HAVE_UTMPX_H
3261#include <utmpx.h>
3262#endif
Damien Miller2994e082000-06-04 15:51:47 +10003263#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003264# include <paths.h>
3265#endif
3266 ],
3267 [ char *wtmpx = WTMPX_FILE; ],
3268 [ AC_MSG_RESULT(yes) ],
3269 [ AC_MSG_RESULT(no)
3270 system_wtmpx_path=no ]
3271)
3272if test -z "$conf_wtmpx_location"; then
3273 if test x"$system_wtmpx_path" = x"no" ; then
3274 AC_DEFINE(DISABLE_WTMPX)
3275 fi
3276else
3277 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003278fi
andre2ff7b5d2000-06-03 14:57:40 +00003279
Damien Miller4018c192000-04-30 09:30:44 +10003280
Damien Miller29ea30d2000-03-17 10:54:15 +11003281if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003282 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3283 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003284fi
3285
Tim Rice4cec93f2002-02-26 08:40:48 -08003286dnl remove pam and dl because they are in $LIBPAM
3287if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003288 LIBS=`echo $LIBS | sed 's/-lpam //'`
3289fi
3290if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3291 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003292fi
3293
Damien Millerbac2d8a2000-09-05 16:13:06 +11003294AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003295AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3296 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003297AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003298
Damien Miller7b22d652000-06-18 14:07:04 +10003299# Print summary of options
3300
Damien Miller7b22d652000-06-18 14:07:04 +10003301# Someone please show me a better way :)
3302A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3303B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3304C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3305D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003306E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003307F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003308G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003309H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3310I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3311J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003312
3313echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003314echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003315echo " User binaries: $B"
3316echo " System binaries: $C"
3317echo " Configuration files: $D"
3318echo " Askpass program: $E"
3319echo " Manual pages: $F"
3320echo " PID file: $G"
3321echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003322if test "x$external_path_file" = "x/etc/login.conf" ; then
3323echo " At runtime, sshd will use the path defined in $external_path_file"
3324echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003325else
Damien Millerf58c6722002-05-13 13:15:42 +10003326echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003327 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003328echo " (If PATH is set in $external_path_file it will be used instead. If"
3329echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3330 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003331fi
Damien Millera18bbd32002-05-13 10:48:57 +10003332if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003333echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003334fi
Damien Millerf58c6722002-05-13 13:15:42 +10003335echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003336echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003337echo " KerberosV support: $KRB5_MSG"
3338echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003339echo " S/KEY support: $SKEY_MSG"
3340echo " TCP Wrappers support: $TCPW_MSG"
3341echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003342echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003343echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003344echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3345echo " BSD Auth support: $BSD_AUTH_MSG"
3346echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003347if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003348echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003349fi
3350
Damien Miller7b22d652000-06-18 14:07:04 +10003351echo ""
3352
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003353echo " Host: ${host}"
3354echo " Compiler: ${CC}"
3355echo " Compiler flags: ${CFLAGS}"
3356echo "Preprocessor flags: ${CPPFLAGS}"
3357echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003358echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003359
3360echo ""
3361
Tim Rice6f1f7582004-05-30 21:38:51 -07003362if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003363 echo "SVR4 style packages are supported with \"make package\""
3364 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003365fi
3366
Damien Miller82cf0ce2000-12-20 13:34:48 +11003367if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003368 echo "PAM is enabled. You may need to install a PAM control file "
3369 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003370 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003371 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003372 echo ""
3373fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003374
Damien Miller6c21c512002-01-22 21:57:53 +11003375if test ! -z "$RAND_HELPER_CMDHASH" ; then
3376 echo "WARNING: you are using the builtin random number collection "
3377 echo "service. Please read WARNING.RNG and request that your OS "
3378 echo "vendor includes kernel-based random number collection in "
3379 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003380 echo ""
3381fi
Damien Miller60396b02001-02-18 17:01:00 +11003382
Damien Millerb4097182004-05-23 14:09:40 +10003383if test ! -z "$NO_PEERCHECK" ; then
3384 echo "WARNING: the operating system that you are using does not "
3385 echo "appear to support either the getpeereid() API nor the "
3386 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3387 echo "enforce security checks to prevent unauthorised connections to "
3388 echo "ssh-agent. Their absence increases the risk that a malicious "
3389 echo "user can connect to your agent. "
3390 echo ""
3391fi
3392
Darren Tuckerd9f88912005-02-20 21:01:48 +11003393if test "$AUDIT_MODULE" = "bsm" ; then
3394 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3395 echo "See the Solaris section in README.platform for details."
3396fi