blob: 4b40b768a8b2d800eae48a94e30efdedf8fec7ab [file] [log] [blame]
Tim Rice0f83d292004-12-08 18:29:58 -08001# $Id: configure.ac,v 1.234 2004/12/09 02:29:59 tim Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker59f79c42004-09-30 21:17:08 +100017AC_INIT(OpenSSH, Portable)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
78
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110080if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100081 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110082fi
83
Tim Rice88368a32003-12-08 12:35:59 -080084AC_ARG_WITH(rpath,
85 [ --without-rpath Disable auto-added -R linker paths],
86 [
87 if test "x$withval" = "xno" ; then
88 need_dash_r=""
89 fi
90 if test "x$withval" = "xyes" ; then
91 need_dash_r=1
92 fi
93 ]
94)
95
Damien Millera22ba012000-03-02 23:09:20 +110096# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110097case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110098*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110099 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000100 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800101 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100102 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
108 fi
109 done
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
113 else
114 AC_MSG_RESULT($blibflags)
115 fi
116 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700119 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700121 LIBS="$LIBS -ls"
122 ])
123 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000124 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
125 AC_CHECK_DECL(loginfailed,
126 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
127 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000128 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [(void)loginfailed("user","host","tty",0);],
130 [AC_MSG_RESULT(yes)
131 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000132 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000133 )],
134 [],
135 [#include <usersec.h>]
136 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000137 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100138 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000139 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000140 AC_DEFINE(SETEUID_BREAKS_SETUID)
141 AC_DEFINE(BROKEN_SETREUID)
142 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000143 dnl AIX handles lastlog as part of its login message
144 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000146 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100147 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100148*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100149 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800150 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000152 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100153 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100154 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000155 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000156 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700157 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000158 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100159 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000160*-*-dgux*)
161 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100162 AC_DEFINE(SETEUID_BREAKS_SETUID)
163 AC_DEFINE(BROKEN_SETREUID)
164 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000165 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000166*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000167 AC_MSG_CHECKING(if we have working getaddrinfo)
168 AC_TRY_RUN([#include <mach-o/dyld.h>
169main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
170 exit(0);
171 else
172 exit(1);
173}], [AC_MSG_RESULT(working)],
174 [AC_MSG_RESULT(buggy)
175 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700176 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000177 AC_DEFINE(SETEUID_BREAKS_SETUID)
178 AC_DEFINE(BROKEN_SETREUID)
179 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100180 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000181 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000182*-*-hpux10.26)
183 if test -z "$GCC"; then
184 CFLAGS="$CFLAGS -Ae"
185 fi
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(HAVE_SECUREWARE)
189 AC_DEFINE(USE_PIPES)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000192 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000193 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700194 LIBS="$LIBS -lsec -lsecpw"
195 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000196 disable_ptmx_check=yes
197 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100198*-*-hpux10*)
199 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000200 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100201 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000202 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100203 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000204 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000205 AC_DEFINE(LOGIN_NO_ENDOPT)
206 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000207 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000208 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700209 LIBS="$LIBS -lsec"
210 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100211 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000212*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100214 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100215 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100216 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000217 AC_DEFINE(LOGIN_NO_ENDOPT)
218 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100219 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000220 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000221 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000222 check_for_hpux_broken_getaddrinfo=1
Darren Tuckera56f1912004-11-02 20:30:54 +1100223 check_for_conflicting_getspnam=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700224 LIBS="$LIBS -lsec"
225 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000226 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100227*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100228 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000229 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000230 AC_DEFINE(SETEUID_BREAKS_SETUID)
231 AC_DEFINE(BROKEN_SETREUID)
232 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000233 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000234 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100235 ;;
236*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100237 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000238 AC_DEFINE(WITH_IRIX_ARRAY)
239 AC_DEFINE(WITH_IRIX_PROJECT)
240 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000241 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000242 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000243 AC_DEFINE(SETEUID_BREAKS_SETUID)
244 AC_DEFINE(BROKEN_SETREUID)
245 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000246 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000247 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000248 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100249 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100250*-*-linux*)
251 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100252 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000253 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100254 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000255 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000256 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000257 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000258 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Damien Miller7bcb0892000-03-11 20:45:40 +1100259 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000260 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000261 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000262 AC_DEFINE(BROKEN_CMSG_TYPE)
263 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000264 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100265 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000266mips-sony-bsd|mips-sony-newsos4)
267 AC_DEFINE(HAVE_NEWS4)
268 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000269 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100270*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000271 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800272 if test "x$withval" != "xno" ; then
273 need_dash_r=1
274 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100275 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100276*-*-freebsd*)
277 check_for_libcrypt_later=1
278 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000279*-*-bsdi*)
280 AC_DEFINE(SETEUID_BREAKS_SETUID)
281 AC_DEFINE(BROKEN_SETREUID)
282 AC_DEFINE(BROKEN_SETREGID)
283 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000284*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000285 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100286 conf_utmp_location=/etc/utmp
287 conf_wtmp_location=/usr/adm/wtmp
288 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000289 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000290 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000291 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100292 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000293 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100294*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800295 if test "x$withval" != "xno" ; then
296 need_dash_r=1
297 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100298 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000299 AC_DEFINE(LOGIN_NEEDS_UTMPX)
300 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000301 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000302 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000303 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000304 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
305 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000306 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000307 # hardwire lastlog location (can't detect it on some versions)
308 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000309 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
310 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
311 if test "$sol2ver" -ge 8; then
312 AC_MSG_RESULT(yes)
313 AC_DEFINE(DISABLE_UTMP)
314 AC_DEFINE(DISABLE_WTMP)
315 else
316 AC_MSG_RESULT(no)
317 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100318 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000319*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000320 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000321 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100322 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000323 conf_utmp_location=/etc/utmp
324 conf_wtmp_location=/var/adm/wtmp
325 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000326 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000327 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000328*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700329 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000330 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000331 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000332 AC_DEFINE(SETEUID_BREAKS_SETUID)
333 AC_DEFINE(BROKEN_SETREUID)
334 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000335 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000336*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700337 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000338 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100339 IPADDR_IN_DISPLAY=yes
340 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000341 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000342 AC_DEFINE(SETEUID_BREAKS_SETUID)
343 AC_DEFINE(BROKEN_SETREUID)
344 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000345 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000346 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700347 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
348 # Attention: always take care to bind libsocket and libnsl before libc,
349 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000350 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800351# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100352*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100353 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700354 AC_DEFINE(SETEUID_BREAKS_SETUID)
355 AC_DEFINE(BROKEN_SETREUID)
356 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100357 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800358# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100359*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100360 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700361 AC_DEFINE(SETEUID_BREAKS_SETUID)
362 AC_DEFINE(BROKEN_SETREUID)
363 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100364 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100365*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100366 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800367# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100368*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800369 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800370 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100371 RANLIB=true
372 no_dev_ptmx=1
373 AC_DEFINE(BROKEN_SYS_TERMIO_H)
374 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000375 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000376 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100377 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700378 AC_DEFINE(SETEUID_BREAKS_SETUID)
379 AC_DEFINE(BROKEN_SETREUID)
380 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700381 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100382 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700383 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700384 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700385 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100386 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800387# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100388*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800389 if test -z "$GCC"; then
390 CFLAGS="$CFLAGS -belf"
391 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100392 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000393 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100394 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000395 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000396 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700397 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700398 AC_DEFINE(SETEUID_BREAKS_SETUID)
399 AC_DEFINE(BROKEN_SETREUID)
400 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700401 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700402 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Miller217f5672001-02-16 12:12:41 +1100403 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700404 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700405 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000406 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000407*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100408 AC_DEFINE(NO_SSH_LASTLOG)
409 AC_DEFINE(SETEUID_BREAKS_SETUID)
410 AC_DEFINE(BROKEN_SETREUID)
411 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000412 AC_DEFINE(USE_PIPES)
413 AC_DEFINE(DISABLE_FD_PASSING)
414 LDFLAGS="$LDFLAGS"
415 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
416 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000417 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000418*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100419 AC_DEFINE(SETEUID_BREAKS_SETUID)
420 AC_DEFINE(BROKEN_SETREUID)
421 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000422 AC_DEFINE(WITH_ABBREV_NO_TTY)
423 AC_DEFINE(USE_PIPES)
424 AC_DEFINE(DISABLE_FD_PASSING)
425 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100426 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000427 MANTYPE=cat
428 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000429*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100430 AC_DEFINE(SETEUID_BREAKS_SETUID)
431 AC_DEFINE(BROKEN_SETREUID)
432 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000433 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700434 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700435 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000436 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
437 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
438 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700439 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000440*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000441 AC_MSG_CHECKING(for Digital Unix SIA)
442 no_osfsia=""
443 AC_ARG_WITH(osfsia,
444 [ --with-osfsia Enable Digital Unix SIA],
445 [
446 if test "x$withval" = "xno" ; then
447 AC_MSG_RESULT(disabled)
448 no_osfsia=1
449 fi
450 ],
451 )
452 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000453 if test -f /etc/sia/matrix.conf; then
454 AC_MSG_RESULT(yes)
455 AC_DEFINE(HAVE_OSF_SIA)
456 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000457 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000458 LIBS="$LIBS -lsecurity -ldb -lm -laud"
459 else
460 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100461 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000462 fi
463 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000464 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700465 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000466 AC_DEFINE(BROKEN_SETREUID)
467 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000468 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000469
470*-*-nto-qnx)
471 AC_DEFINE(USE_PIPES)
472 AC_DEFINE(NO_X11_UNIX_SOCKETS)
473 AC_DEFINE(MISSING_NFDBITS)
474 AC_DEFINE(MISSING_HOWMANY)
475 AC_DEFINE(MISSING_FD_MASK)
476 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100477esac
478
Damien Millere37bfc12000-06-05 09:37:43 +1000479# Allow user to specify flags
480AC_ARG_WITH(cflags,
481 [ --with-cflags Specify additional flags to pass to compiler],
482 [
483 if test "x$withval" != "xno" ; then
484 CFLAGS="$CFLAGS $withval"
485 fi
486 ]
487)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000488AC_ARG_WITH(cppflags,
489 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
490 [
491 if test "x$withval" != "xno"; then
492 CPPFLAGS="$CPPFLAGS $withval"
493 fi
494 ]
495)
Damien Millere37bfc12000-06-05 09:37:43 +1000496AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000497 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000498 [
499 if test "x$withval" != "xno" ; then
500 LDFLAGS="$LDFLAGS $withval"
501 fi
502 ]
503)
504AC_ARG_WITH(libs,
505 [ --with-libs Specify additional libraries to link with],
506 [
507 if test "x$withval" != "xno" ; then
508 LIBS="$LIBS $withval"
509 fi
510 ]
511)
512
Darren Tucker6eb93042003-06-29 21:30:41 +1000513AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000514AC_RUN_IFELSE(
515 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000516#include <stdio.h>
517int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000518 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000519 [ AC_MSG_RESULT(yes) ],
520 [
521 AC_MSG_RESULT(no)
522 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000523 ],
524 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000525)
526
Tim Rice4cec93f2002-02-26 08:40:48 -0800527# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000528AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
529 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
530 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100531 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000532 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000533 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
534 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000535 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000536 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
537 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800538
Darren Tucker48d99d32004-08-29 17:04:50 +1000539# sys/ptms.h requires sys/stream.h to be included first on Solaris
540AC_CHECK_HEADERS(sys/ptms.h, [], [], [
541#ifdef HAVE_SYS_STREAM_H
542# include <sys/stream.h>
543#endif
544])
545
Damien Millera22ba012000-03-02 23:09:20 +1100546# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700547AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
548AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000549
Damien Millerdf288022001-02-18 13:07:07 +1100550dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700551if test "x$with_tcp_wrappers" != "xno" ; then
552 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
553 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
554 fi
555fi
Damien Millerdf288022001-02-18 13:07:07 +1100556
Tim Rice1e1ef642003-09-11 22:19:31 -0700557dnl IRIX and Solaris 2.5.1 have dirname() in libgen
558AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
559 AC_CHECK_LIB(gen, dirname,[
560 AC_CACHE_CHECK([for broken dirname],
561 ac_cv_have_broken_dirname, [
562 save_LIBS="$LIBS"
563 LIBS="$LIBS -lgen"
564 AC_TRY_RUN(
565 [
566#include <libgen.h>
567#include <string.h>
568
569int main(int argc, char **argv) {
570 char *s, buf[32];
571
572 strncpy(buf,"/etc", 32);
573 s = dirname(buf);
574 if (!s || strncmp(s, "/", 32) != 0) {
575 exit(1);
576 } else {
577 exit(0);
578 }
579}
580 ],
581 [ ac_cv_have_broken_dirname="no" ],
582 [ ac_cv_have_broken_dirname="yes" ]
583 )
584 LIBS="$save_LIBS"
585 ])
586 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
587 LIBS="$LIBS -lgen"
588 AC_DEFINE(HAVE_DIRNAME)
589 AC_CHECK_HEADERS(libgen.h)
590 fi
591 ])
592])
593
594AC_CHECK_FUNC(getspnam, ,
595 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
596AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
597
Tim Rice13aae5e2001-10-21 17:53:58 -0700598dnl zlib is required
599AC_ARG_WITH(zlib,
600 [ --with-zlib=PATH Use zlib in PATH],
601 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000602 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100603 AC_MSG_ERROR([*** zlib is required ***])
604 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700605 if test -d "$withval/lib"; then
606 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700607 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700608 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700609 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 fi
611 else
612 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700613 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700614 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700615 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 fi
617 fi
618 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700619 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700620 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700621 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700622 fi
623 ]
624)
625
Tim Ricefcb62202004-01-23 18:35:16 -0800626AC_CHECK_LIB(z, deflate, ,
627 [
628 saved_CPPFLAGS="$CPPFLAGS"
629 saved_LDFLAGS="$LDFLAGS"
630 save_LIBS="$LIBS"
631 dnl Check default zlib install dir
632 if test -n "${need_dash_r}"; then
633 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
634 else
635 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
636 fi
637 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
638 LIBS="$LIBS -lz"
639 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
640 [
641 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
642 ]
643 )
644 ]
645)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100646AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100647
648AC_ARG_WITH(zlib-version-check,
649 [ --without-zlib-version-check Disable zlib version check],
650 [ if test "x$withval" = "xno" ; then
651 zlib_check_nonfatal=1
652 fi
653 ]
654)
655
Darren Tucker2dcd2392004-01-23 17:13:33 +1100656AC_MSG_CHECKING(for zlib 1.1.4 or greater)
Darren Tucker623d92f2004-09-12 22:36:15 +1000657AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2dcd2392004-01-23 17:13:33 +1100658#include <zlib.h>
659int main()
660{
661 int a, b, c, v;
662 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
663 exit(1);
664 v = a*1000000 + b*1000 + c;
665 if (v >= 1001004)
666 exit(0);
667 exit(2);
668}
Darren Tucker623d92f2004-09-12 22:36:15 +1000669 ]])],
Darren Tucker2dcd2392004-01-23 17:13:33 +1100670 AC_MSG_RESULT(yes),
671 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100672 if test -z "$zlib_check_nonfatal" ; then
673 AC_MSG_ERROR([*** zlib too old - check config.log ***
674Your reported zlib version has known security problems. It's possible your
675vendor has fixed these problems without changing the version number. If you
676are sure this is the case, you can disable the check by running
677"./configure --without-zlib-version-check".
678If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
679 else
680 AC_MSG_WARN([zlib version may have security problems])
681 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000682 ],
683 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100684)
Damien Miller6f9c3372000-10-25 10:06:04 +1100685
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000686dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100687AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000688 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
689)
Damien Millera8e06ce2003-11-21 23:48:55 +1100690AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700691 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
692 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000693)
Damien Millerab18c411999-11-11 10:40:23 +1100694
Tim Ricee589a292001-11-03 11:09:32 -0800695dnl Checks for libutil functions
696AC_CHECK_HEADERS(libutil.h)
697AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
698AC_CHECK_FUNCS(logout updwtmp logwtmp)
699
Ben Lindstrom8697e082001-02-24 21:41:10 +0000700AC_FUNC_STRFTIME
701
Damien Miller3c027682001-03-14 11:39:45 +1100702# Check for ALTDIRFUNC glob() extension
703AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
704AC_EGREP_CPP(FOUNDIT,
705 [
706 #include <glob.h>
707 #ifdef GLOB_ALTDIRFUNC
708 FOUNDIT
709 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100710 ],
Damien Miller3c027682001-03-14 11:39:45 +1100711 [
712 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
713 AC_MSG_RESULT(yes)
714 ],
715 [
716 AC_MSG_RESULT(no)
717 ]
718)
Damien Millerab18c411999-11-11 10:40:23 +1100719
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000720# Check for g.gl_matchc glob() extension
721AC_MSG_CHECKING(for gl_matchc field in glob_t)
722AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100723 [
724 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000725 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100726 ],
727 [
728 AC_DEFINE(GLOB_HAS_GL_MATCHC)
729 AC_MSG_RESULT(yes)
730 ],
731 [
732 AC_MSG_RESULT(no)
733 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000734)
735
Damien Miller18bb4732001-03-28 14:35:30 +1000736AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000737AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000738 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000739#include <sys/types.h>
740#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700741int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000742 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100743 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000744 [
745 AC_MSG_RESULT(no)
746 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000747 ],
748 [
749 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
750 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000751 ]
752)
753
Damien Miller36f49652004-08-15 18:40:59 +1000754AC_MSG_CHECKING([for /proc/pid/fd directory])
755if test -d "/proc/$$/fd" ; then
756 AC_DEFINE(HAVE_PROC_PID)
757 AC_MSG_RESULT(yes)
758else
759 AC_MSG_RESULT(no)
760fi
761
Damien Millerc547bf12001-02-16 10:18:12 +1100762# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100763SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100764AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700765 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100766 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100767 [
768 if test "x$withval" != "xno" ; then
769
770 if test "x$withval" != "xyes" ; then
771 CPPFLAGS="$CPPFLAGS -I${withval}/include"
772 LDFLAGS="$LDFLAGS -L${withval}/lib"
773 fi
774
775 AC_DEFINE(SKEY)
776 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100777 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100778
Tim Rice4cec93f2002-02-26 08:40:48 -0800779 AC_MSG_CHECKING([for s/key support])
780 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100781 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800782#include <stdio.h>
783#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700784int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800785 ],
786 [AC_MSG_RESULT(yes)],
787 [
788 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100789 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
790 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000791 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
792 AC_TRY_COMPILE(
793 [#include <stdio.h>
794 #include <skey.h>],
795 [(void)skeychallenge(NULL,"name","",0);],
796 [AC_MSG_RESULT(yes)
797 AC_DEFINE(SKEYCHALLENGE_4ARG)],
798 [AC_MSG_RESULT(no)]
799 )
Damien Millerc547bf12001-02-16 10:18:12 +1100800 fi
801 ]
802)
803
804# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700805TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100806AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700807 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100808 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100809 [
810 if test "x$withval" != "xno" ; then
811 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700812 saved_LDFLAGS="$LDFLAGS"
813 saved_CPPFLAGS="$CPPFLAGS"
814 if test -n "${withval}" -a "${withval}" != "yes"; then
815 if test -d "${withval}/lib"; then
816 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
821 else
822 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700823 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700824 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700825 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 fi
827 fi
828 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700829 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700830 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700831 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700832 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700833 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800834 LIBWRAP="-lwrap"
835 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100836 AC_MSG_CHECKING(for libwrap)
837 AC_TRY_LINK(
838 [
Damien Miller0ac45002004-04-14 20:14:26 +1000839#include <sys/types.h>
840#include <sys/socket.h>
841#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100842#include <tcpd.h>
843 int deny_severity = 0, allow_severity = 0;
844 ],
845 [hosts_access(0);],
846 [
847 AC_MSG_RESULT(yes)
848 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800849 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700850 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100851 ],
852 [
853 AC_MSG_ERROR([*** libwrap missing])
854 ]
855 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800856 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100857 fi
858 ]
859)
860
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100861# Check whether user wants libedit support
862LIBEDIT_MSG="no"
863AC_ARG_WITH(libedit,
864 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
865 [ if test "x$withval" != "xno" ; then
866 AC_CHECK_LIB(edit, el_init,
867 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
868 LIBEDIT="-ledit -lcurses"
869 LIBEDIT_MSG="yes"
870 AC_SUBST(LIBEDIT)
871 ],
872 [], [-lcurses]
873 )
874 fi ]
875)
876
Damien Millerfe1f1432003-02-24 15:45:42 +1100877dnl Checks for library functions. Please keep in alphabetical order
878AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000879 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Damien Miller36f49652004-08-15 18:40:59 +1000880 bindresvport_sa clock closefrom dirfd fchmod fchown freeaddrinfo \
881 futimes getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000882 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100883 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000884 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100885 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000886 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100887 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000888 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000889 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100890 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100891)
Tim Rice13aae5e2001-10-21 17:53:58 -0700892
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000893# IRIX has a const char return value for gai_strerror()
894AC_CHECK_FUNCS(gai_strerror,[
895 AC_DEFINE(HAVE_GAI_STRERROR)
896 AC_TRY_COMPILE([
897#include <sys/types.h>
898#include <sys/socket.h>
899#include <netdb.h>
900
901const char *gai_strerror(int);],[
902char *str;
903
904str = gai_strerror(0);],[
905 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
906 [Define if gai_strerror() returns const char *])])])
907
Damien Millercd6853c2003-01-28 11:33:42 +1100908AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
909
Darren Tuckerf1159b52003-07-07 19:44:01 +1000910dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000911AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000912AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000913
Darren Tuckerb2427c82003-09-10 15:22:44 +1000914dnl tcsendbreak might be a macro
915AC_CHECK_DECL(tcsendbreak,
916 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100917 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000918 [#include <termios.h>]
919)
920
Darren Tucker5bb14002004-04-23 18:53:10 +1000921AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
922
Darren Tucker2a6b0292003-12-31 14:59:17 +1100923AC_CHECK_FUNCS(setresuid, [
924 dnl Some platorms have setresuid that isn't implemented, test for this
925 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000926 AC_RUN_IFELSE(
927 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100928#include <stdlib.h>
929#include <errno.h>
930int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000931 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100932 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100933 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000934 AC_MSG_RESULT(not implemented)],
935 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100936 )
937])
Darren Tuckere937be32003-12-17 18:53:26 +1100938
Darren Tucker2a6b0292003-12-31 14:59:17 +1100939AC_CHECK_FUNCS(setresgid, [
940 dnl Some platorms have setresgid that isn't implemented, test for this
941 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000942 AC_RUN_IFELSE(
943 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100944#include <stdlib.h>
945#include <errno.h>
946int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000947 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100948 [AC_MSG_RESULT(yes)],
949 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000950 AC_MSG_RESULT(not implemented)],
951 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100952 )
953])
Darren Tuckere937be32003-12-17 18:53:26 +1100954
Damien Millerad833b32000-08-23 10:46:23 +1000955dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000956AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000957dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000958AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000959AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000960dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000961AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000962AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100963
Damien Millera8e06ce2003-11-21 23:48:55 +1100964AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100965 [AC_DEFINE(HAVE_DAEMON)],
966 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
967)
968
Damien Millera8e06ce2003-11-21 23:48:55 +1100969AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100970 [AC_DEFINE(HAVE_GETPAGESIZE)],
971 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
972)
973
Damien Millercb170cb2000-07-01 16:52:55 +1000974# Check for broken snprintf
975if test "x$ac_cv_func_snprintf" = "xyes" ; then
976 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000977 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000978 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +1000979#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700980int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +1000981 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100982 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000983 [
984 AC_MSG_RESULT(no)
985 AC_DEFINE(BROKEN_SNPRINTF)
986 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000987 ],
988 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +1000989 )
990fi
991
Damien Millerb4097182004-05-23 14:09:40 +1000992# Check for missing getpeereid (or equiv) support
993NO_PEERCHECK=""
994if test "x$ac_cv_func_getpeereid" != "xyes" ; then
995 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
996 AC_TRY_COMPILE(
997 [#include <sys/types.h>
998 #include <sys/socket.h>],
999 [int i = SO_PEERCRED;],
1000 [AC_MSG_RESULT(yes)],
1001 [AC_MSG_RESULT(no)
1002 NO_PEERCHECK=1]
1003 )
1004fi
1005
Damien Millere8328192003-01-07 15:18:32 +11001006dnl see whether mkstemp() requires XXXXXX
1007if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1008AC_MSG_CHECKING([for (overly) strict mkstemp])
1009AC_TRY_RUN(
1010 [
1011#include <stdlib.h>
1012main() { char template[]="conftest.mkstemp-test";
1013if (mkstemp(template) == -1)
1014 exit(1);
1015unlink(template); exit(0);
1016}
1017 ],
1018 [
1019 AC_MSG_RESULT(no)
1020 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001021 [
Damien Millere8328192003-01-07 15:18:32 +11001022 AC_MSG_RESULT(yes)
1023 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1024 ],
1025 [
1026 AC_MSG_RESULT(yes)
1027 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001028 ]
Damien Millere8328192003-01-07 15:18:32 +11001029)
1030fi
1031
Darren Tucker70a3d552003-08-21 17:58:29 +10001032dnl make sure that openpty does not reacquire controlling terminal
1033if test ! -z "$check_for_openpty_ctty_bug"; then
1034 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1035 AC_TRY_RUN(
1036 [
1037#include <stdio.h>
1038#include <sys/fcntl.h>
1039#include <sys/types.h>
1040#include <sys/wait.h>
1041
1042int
1043main()
1044{
1045 pid_t pid;
1046 int fd, ptyfd, ttyfd, status;
1047
1048 pid = fork();
1049 if (pid < 0) { /* failed */
1050 exit(1);
1051 } else if (pid > 0) { /* parent */
1052 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001053 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001054 exit(WEXITSTATUS(status));
1055 else
1056 exit(2);
1057 } else { /* child */
1058 close(0); close(1); close(2);
1059 setsid();
1060 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1061 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1062 if (fd >= 0)
1063 exit(3); /* Acquired ctty: broken */
1064 else
1065 exit(0); /* Did not acquire ctty: OK */
1066 }
1067}
1068 ],
1069 [
1070 AC_MSG_RESULT(yes)
1071 ],
1072 [
1073 AC_MSG_RESULT(no)
1074 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1075 ]
1076 )
1077fi
1078
Darren Tucker4398cf52004-04-06 21:39:02 +10001079if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1080 AC_MSG_CHECKING(if getaddrinfo seems to work)
1081 AC_TRY_RUN(
1082 [
1083#include <stdio.h>
1084#include <sys/socket.h>
1085#include <netdb.h>
1086#include <errno.h>
1087#include <netinet/in.h>
1088
1089#define TEST_PORT "2222"
1090
1091int
1092main(void)
1093{
1094 int err, sock;
1095 struct addrinfo *gai_ai, *ai, hints;
1096 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1097
1098 memset(&hints, 0, sizeof(hints));
1099 hints.ai_family = PF_UNSPEC;
1100 hints.ai_socktype = SOCK_STREAM;
1101 hints.ai_flags = AI_PASSIVE;
1102
1103 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1104 if (err != 0) {
1105 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1106 exit(1);
1107 }
1108
1109 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1110 if (ai->ai_family != AF_INET6)
1111 continue;
1112
1113 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1114 sizeof(ntop), strport, sizeof(strport),
1115 NI_NUMERICHOST|NI_NUMERICSERV);
1116
1117 if (err != 0) {
1118 if (err == EAI_SYSTEM)
1119 perror("getnameinfo EAI_SYSTEM");
1120 else
1121 fprintf(stderr, "getnameinfo failed: %s\n",
1122 gai_strerror(err));
1123 exit(2);
1124 }
1125
1126 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1127 if (sock < 0)
1128 perror("socket");
1129 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1130 if (errno == EBADF)
1131 exit(3);
1132 }
1133 }
1134 exit(0);
1135}
1136 ],
1137 [
1138 AC_MSG_RESULT(yes)
1139 ],
1140 [
1141 AC_MSG_RESULT(no)
1142 AC_DEFINE(BROKEN_GETADDRINFO)
1143 ]
1144 )
1145fi
1146
Darren Tuckera56f1912004-11-02 20:30:54 +11001147if test "x$check_for_conflicting_getspnam" = "x1"; then
1148 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1149 AC_COMPILE_IFELSE(
1150 [
1151#include <shadow.h>
1152int main(void) {exit(0);}
1153 ],
1154 [
1155 AC_MSG_RESULT(no)
1156 ],
1157 [
1158 AC_MSG_RESULT(yes)
1159 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1160 [Conflicting defs for getspnam])
1161 ]
1162 )
1163fi
1164
Damien Miller606f8802000-09-16 15:39:56 +11001165AC_FUNC_GETPGRP
1166
Damien Millera64b57a2001-01-17 10:44:13 +11001167# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001168PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001169AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001170 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001171 [
Damien Millera64b57a2001-01-17 10:44:13 +11001172 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001173 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1174 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001175 AC_MSG_ERROR([PAM headers not found])
1176 fi
1177
1178 AC_CHECK_LIB(dl, dlopen, , )
1179 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1180 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001181 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001182
Damien Millera64b57a2001-01-17 10:44:13 +11001183 PAM_MSG="yes"
1184
1185 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001186 if test $ac_cv_lib_dl_dlopen = yes; then
1187 LIBPAM="-lpam -ldl"
1188 else
1189 LIBPAM="-lpam"
1190 fi
1191 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001192 fi
1193 ]
1194)
Damien Millera22ba012000-03-02 23:09:20 +11001195
Damien Millera64b57a2001-01-17 10:44:13 +11001196# Check for older PAM
1197if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001198 # Check PAM strerror arguments (old PAM)
1199 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1200 AC_TRY_COMPILE(
1201 [
Damien Miller81171112000-04-23 11:14:01 +10001202#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001203#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001204#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001205#elif defined (HAVE_PAM_PAM_APPL_H)
1206#include <pam/pam_appl.h>
1207#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001208 ],
1209 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001210 [AC_MSG_RESULT(no)],
1211 [
1212 AC_DEFINE(HAVE_OLD_PAM)
1213 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001214 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001215 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001216 )
Damien Millera22ba012000-03-02 23:09:20 +11001217fi
1218
Tim Riceaef73712002-05-11 13:17:42 -07001219# Search for OpenSSL
1220saved_CPPFLAGS="$CPPFLAGS"
1221saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001222AC_ARG_WITH(ssl-dir,
1223 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1224 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001225 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001226 if test -d "$withval/lib"; then
1227 if test -n "${need_dash_r}"; then
1228 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1229 else
1230 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1231 fi
1232 else
1233 if test -n "${need_dash_r}"; then
1234 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1235 else
1236 LDFLAGS="-L${withval} ${LDFLAGS}"
1237 fi
1238 fi
1239 if test -d "$withval/include"; then
1240 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1241 else
1242 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1243 fi
Damien Millera22ba012000-03-02 23:09:20 +11001244 fi
1245 ]
1246)
Tim Rice3d5352e2004-02-12 09:27:21 -08001247LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001248AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001249 [
Tim Riceaef73712002-05-11 13:17:42 -07001250 dnl Check default openssl install dir
1251 if test -n "${need_dash_r}"; then
1252 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001253 else
Tim Riceaef73712002-05-11 13:17:42 -07001254 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001255 fi
Tim Riceaef73712002-05-11 13:17:42 -07001256 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1257 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1258 [
1259 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1260 ]
1261 )
1262 ]
1263)
1264
Tim Riced730b782002-08-13 18:52:10 -07001265# Determine OpenSSL header version
1266AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001267AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001268 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001269#include <stdio.h>
1270#include <string.h>
1271#include <openssl/opensslv.h>
1272#define DATA "conftest.sslincver"
1273int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001274 FILE *fd;
1275 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001276
Damien Millera8e06ce2003-11-21 23:48:55 +11001277 fd = fopen(DATA,"w");
1278 if(fd == NULL)
1279 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001280
1281 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1282 exit(1);
1283
1284 exit(0);
1285}
Darren Tucker623d92f2004-09-12 22:36:15 +10001286 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001287 [
1288 ssl_header_ver=`cat conftest.sslincver`
1289 AC_MSG_RESULT($ssl_header_ver)
1290 ],
1291 [
1292 AC_MSG_RESULT(not found)
1293 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001294 ],
1295 [
1296 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001297 ]
1298)
1299
1300# Determine OpenSSL library version
1301AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001302AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001303 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001304#include <stdio.h>
1305#include <string.h>
1306#include <openssl/opensslv.h>
1307#include <openssl/crypto.h>
1308#define DATA "conftest.ssllibver"
1309int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001310 FILE *fd;
1311 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001312
Damien Millera8e06ce2003-11-21 23:48:55 +11001313 fd = fopen(DATA,"w");
1314 if(fd == NULL)
1315 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001316
1317 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1318 exit(1);
1319
1320 exit(0);
1321}
Darren Tucker623d92f2004-09-12 22:36:15 +10001322 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001323 [
1324 ssl_library_ver=`cat conftest.ssllibver`
1325 AC_MSG_RESULT($ssl_library_ver)
1326 ],
1327 [
1328 AC_MSG_RESULT(not found)
1329 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001330 ],
1331 [
1332 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001333 ]
1334)
Damien Millera22ba012000-03-02 23:09:20 +11001335
Damien Millerec932372002-01-22 22:16:03 +11001336# Sanity check OpenSSL headers
1337AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001338AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001339 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001340#include <string.h>
1341#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001342int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001343 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001344 [
1345 AC_MSG_RESULT(yes)
1346 ],
1347 [
1348 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001349 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1350Check config.log for details.
1351Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001352 ],
1353 [
1354 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001355 ]
1356)
1357
Tim Rice3d5352e2004-02-12 09:27:21 -08001358# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1359# because the system crypt() is more featureful.
1360if test "x$check_for_libcrypt_before" = "x1"; then
1361 AC_CHECK_LIB(crypt, crypt)
1362fi
1363
Damien Millera8e06ce2003-11-21 23:48:55 +11001364# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001365# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001366if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001367 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001368fi
1369
Damien Miller6c21c512002-01-22 21:57:53 +11001370
1371### Configure cryptographic random number support
1372
1373# Check wheter OpenSSL seeds itself
1374AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001375AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001376 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001377#include <string.h>
1378#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001379int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001380 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001381 [
1382 OPENSSL_SEEDS_ITSELF=yes
1383 AC_MSG_RESULT(yes)
1384 ],
1385 [
1386 AC_MSG_RESULT(no)
1387 # Default to use of the rand helper if OpenSSL doesn't
1388 # seed itself
1389 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001390 ],
1391 [
1392 AC_MSG_WARN([cross compiling: assuming yes])
1393 # This is safe, since all recent OpenSSL versions will
1394 # complain at runtime if not seeded correctly.
1395 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001396 ]
1397)
1398
1399
1400# Do we want to force the use of the rand helper?
1401AC_ARG_WITH(rand-helper,
1402 [ --with-rand-helper Use subprocess to gather strong randomness ],
1403 [
1404 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001405 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001406 # the previous test showed it to be unseeded.
1407 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1408 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1409 OPENSSL_SEEDS_ITSELF=yes
1410 USE_RAND_HELPER=""
1411 fi
1412 else
1413 USE_RAND_HELPER=yes
1414 fi
1415 ],
1416)
1417
1418# Which randomness source do we use?
1419if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1420 # OpenSSL only
1421 AC_DEFINE(OPENSSL_PRNG_ONLY)
1422 RAND_MSG="OpenSSL internal ONLY"
1423 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001424elif test ! -z "$USE_RAND_HELPER" ; then
1425 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001426 RAND_MSG="ssh-rand-helper"
1427 INSTALL_SSH_RAND_HELPER="yes"
1428fi
1429AC_SUBST(INSTALL_SSH_RAND_HELPER)
1430
1431### Configuration of ssh-rand-helper
1432
1433# PRNGD TCP socket
1434AC_ARG_WITH(prngd-port,
1435 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1436 [
Damien Millere996d722002-01-23 11:20:59 +11001437 case "$withval" in
1438 no)
1439 withval=""
1440 ;;
1441 [[0-9]]*)
1442 ;;
1443 *)
1444 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1445 ;;
1446 esac
1447 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001448 PRNGD_PORT="$withval"
1449 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1450 fi
1451 ]
1452)
1453
1454# PRNGD Unix domain socket
1455AC_ARG_WITH(prngd-socket,
1456 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1457 [
Damien Millere996d722002-01-23 11:20:59 +11001458 case "$withval" in
1459 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001460 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001461 ;;
1462 no)
1463 withval=""
1464 ;;
1465 /*)
1466 ;;
1467 *)
1468 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1469 ;;
1470 esac
1471
1472 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001473 if test ! -z "$PRNGD_PORT" ; then
1474 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1475 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001476 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001477 AC_MSG_WARN(Entropy socket is not readable)
1478 fi
1479 PRNGD_SOCKET="$withval"
1480 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1481 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001482 ],
1483 [
1484 # Check for existing socket only if we don't have a random device already
1485 if test "$USE_RAND_HELPER" = yes ; then
1486 AC_MSG_CHECKING(for PRNGD/EGD socket)
1487 # Insert other locations here
1488 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1489 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1490 PRNGD_SOCKET="$sock"
1491 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1492 break;
1493 fi
1494 done
1495 if test ! -z "$PRNGD_SOCKET" ; then
1496 AC_MSG_RESULT($PRNGD_SOCKET)
1497 else
1498 AC_MSG_RESULT(not found)
1499 fi
1500 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001501 ]
1502)
1503
1504# Change default command timeout for hashing entropy source
1505entropy_timeout=200
1506AC_ARG_WITH(entropy-timeout,
1507 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1508 [
1509 if test "x$withval" != "xno" ; then
1510 entropy_timeout=$withval
1511 fi
1512 ]
1513)
Damien Miller6c21c512002-01-22 21:57:53 +11001514AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1515
Damien Millerd3f6ad22002-06-25 10:24:47 +10001516SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001517AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001518 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001519 [
1520 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001521 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001522 fi
1523 ]
1524)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001525AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1526AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001527
Tim Rice88f2ab52002-03-17 12:17:34 -08001528# We do this little dance with the search path to insure
1529# that programs that we select for use by installed programs
1530# (which may be run by the super-user) come from trusted
1531# locations before they come from the user's private area.
1532# This should help avoid accidentally configuring some
1533# random version of a program in someone's personal bin.
1534
1535OPATH=$PATH
1536PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001537test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001538test -d /sbin && PATH=$PATH:/sbin
1539test -d /usr/sbin && PATH=$PATH:/usr/sbin
1540PATH=$PATH:/etc:$OPATH
1541
Damien Millera8e06ce2003-11-21 23:48:55 +11001542# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001543OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1544OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1545OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1546OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1547OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1548OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1549OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1550OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1551OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1552OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1553OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1554OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1555OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1556OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1557OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1558OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001559# restore PATH
1560PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001561
1562# Where does ssh-rand-helper get its randomness from?
1563INSTALL_SSH_PRNG_CMDS=""
1564if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1565 if test ! -z "$PRNGD_PORT" ; then
1566 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1567 elif test ! -z "$PRNGD_SOCKET" ; then
1568 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1569 else
1570 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1571 RAND_HELPER_CMDHASH=yes
1572 INSTALL_SSH_PRNG_CMDS="yes"
1573 fi
1574fi
1575AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1576
1577
Ben Lindstromb5628642000-10-18 00:02:25 +00001578# Cheap hack to ensure NEWS-OS libraries are arranged right.
1579if test ! -z "$SONY" ; then
1580 LIBS="$LIBS -liberty";
1581fi
1582
Damien Millera22ba012000-03-02 23:09:20 +11001583# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001584AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001585AC_CHECK_SIZEOF(short int, 2)
1586AC_CHECK_SIZEOF(int, 4)
1587AC_CHECK_SIZEOF(long int, 4)
1588AC_CHECK_SIZEOF(long long int, 8)
1589
Damien Millerfa2bb692002-04-23 23:22:25 +10001590# Sanity check long long for some platforms (AIX)
1591if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1592 ac_cv_sizeof_long_long_int=0
1593fi
1594
Damien Millera22ba012000-03-02 23:09:20 +11001595# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001596AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1597 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001598 [ #include <sys/types.h> ],
1599 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001600 [ ac_cv_have_u_int="yes" ],
1601 [ ac_cv_have_u_int="no" ]
1602 )
1603])
1604if test "x$ac_cv_have_u_int" = "xyes" ; then
1605 AC_DEFINE(HAVE_U_INT)
1606 have_u_int=1
1607fi
1608
Damien Miller61e50f12000-05-08 20:49:37 +10001609AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1610 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001611 [ #include <sys/types.h> ],
1612 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001613 [ ac_cv_have_intxx_t="yes" ],
1614 [ ac_cv_have_intxx_t="no" ]
1615 )
1616])
1617if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1618 AC_DEFINE(HAVE_INTXX_T)
1619 have_intxx_t=1
1620fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001621
1622if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001623 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001624then
1625 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1626 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001627 [ #include <stdint.h> ],
1628 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001629 [
1630 AC_DEFINE(HAVE_INTXX_T)
1631 AC_MSG_RESULT(yes)
1632 ],
1633 [ AC_MSG_RESULT(no) ]
1634 )
1635fi
1636
Damien Miller578783e2000-09-23 14:12:24 +11001637AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1638 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001639 [
1640#include <sys/types.h>
1641#ifdef HAVE_STDINT_H
1642# include <stdint.h>
1643#endif
1644#include <sys/socket.h>
1645#ifdef HAVE_SYS_BITYPES_H
1646# include <sys/bitypes.h>
1647#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001648 ],
1649 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001650 [ ac_cv_have_int64_t="yes" ],
1651 [ ac_cv_have_int64_t="no" ]
1652 )
1653])
1654if test "x$ac_cv_have_int64_t" = "xyes" ; then
1655 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001656fi
1657
Damien Miller61e50f12000-05-08 20:49:37 +10001658AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1659 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001660 [ #include <sys/types.h> ],
1661 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001662 [ ac_cv_have_u_intxx_t="yes" ],
1663 [ ac_cv_have_u_intxx_t="no" ]
1664 )
1665])
1666if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1667 AC_DEFINE(HAVE_U_INTXX_T)
1668 have_u_intxx_t=1
1669fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001670
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001671if test -z "$have_u_intxx_t" ; then
1672 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1673 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001674 [ #include <sys/socket.h> ],
1675 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001676 [
1677 AC_DEFINE(HAVE_U_INTXX_T)
1678 AC_MSG_RESULT(yes)
1679 ],
1680 [ AC_MSG_RESULT(no) ]
1681 )
1682fi
1683
Damien Miller578783e2000-09-23 14:12:24 +11001684AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1685 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001686 [ #include <sys/types.h> ],
1687 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001688 [ ac_cv_have_u_int64_t="yes" ],
1689 [ ac_cv_have_u_int64_t="no" ]
1690 )
1691])
1692if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1693 AC_DEFINE(HAVE_U_INT64_T)
1694 have_u_int64_t=1
1695fi
1696
Tim Rice4cec93f2002-02-26 08:40:48 -08001697if test -z "$have_u_int64_t" ; then
1698 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1699 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001700 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001701 [ u_int64_t a; a = 1],
1702 [
1703 AC_DEFINE(HAVE_U_INT64_T)
1704 AC_MSG_RESULT(yes)
1705 ],
1706 [ AC_MSG_RESULT(no) ]
1707 )
1708fi
1709
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001710if test -z "$have_u_intxx_t" ; then
1711 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1712 AC_TRY_COMPILE(
1713 [
1714#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001715 ],
1716 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001717 [ ac_cv_have_uintxx_t="yes" ],
1718 [ ac_cv_have_uintxx_t="no" ]
1719 )
1720 ])
1721 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1722 AC_DEFINE(HAVE_UINTXX_T)
1723 fi
1724fi
1725
1726if test -z "$have_uintxx_t" ; then
1727 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1728 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001729 [ #include <stdint.h> ],
1730 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001731 [
1732 AC_DEFINE(HAVE_UINTXX_T)
1733 AC_MSG_RESULT(yes)
1734 ],
1735 [ AC_MSG_RESULT(no) ]
1736 )
1737fi
1738
Damien Milleredb82922000-06-20 13:25:52 +10001739if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001740 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001741then
1742 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1743 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001744 [
1745#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001746 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001747 [
Damien Miller70494d12000-04-03 15:57:06 +10001748 int8_t a; int16_t b; int32_t c;
1749 u_int8_t e; u_int16_t f; u_int32_t g;
1750 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001751 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001752 [
1753 AC_DEFINE(HAVE_U_INTXX_T)
1754 AC_DEFINE(HAVE_INTXX_T)
1755 AC_MSG_RESULT(yes)
1756 ],
1757 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001758 )
Damien Millerb29ea912000-01-15 14:12:03 +11001759fi
1760
Damien Miller58be7382001-09-15 21:31:54 +10001761
1762AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1763 AC_TRY_COMPILE(
1764 [
1765#include <sys/types.h>
1766 ],
1767 [ u_char foo; foo = 125; ],
1768 [ ac_cv_have_u_char="yes" ],
1769 [ ac_cv_have_u_char="no" ]
1770 )
1771])
1772if test "x$ac_cv_have_u_char" = "xyes" ; then
1773 AC_DEFINE(HAVE_U_CHAR)
1774fi
1775
Tim Rice13aae5e2001-10-21 17:53:58 -07001776TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001777
Tim Rice200a5c02002-02-26 22:12:34 -08001778AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001779
Damien Miller61e50f12000-05-08 20:49:37 +10001780AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1781 AC_TRY_COMPILE(
1782 [
1783#include <sys/types.h>
1784 ],
1785 [ size_t foo; foo = 1235; ],
1786 [ ac_cv_have_size_t="yes" ],
1787 [ ac_cv_have_size_t="no" ]
1788 )
1789])
1790if test "x$ac_cv_have_size_t" = "xyes" ; then
1791 AC_DEFINE(HAVE_SIZE_T)
1792fi
Damien Miller95058511999-12-29 10:36:45 +11001793
Damien Miller615f9392000-05-17 22:53:33 +10001794AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1795 AC_TRY_COMPILE(
1796 [
1797#include <sys/types.h>
1798 ],
1799 [ ssize_t foo; foo = 1235; ],
1800 [ ac_cv_have_ssize_t="yes" ],
1801 [ ac_cv_have_ssize_t="no" ]
1802 )
1803])
1804if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1805 AC_DEFINE(HAVE_SSIZE_T)
1806fi
1807
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001808AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1809 AC_TRY_COMPILE(
1810 [
1811#include <time.h>
1812 ],
1813 [ clock_t foo; foo = 1235; ],
1814 [ ac_cv_have_clock_t="yes" ],
1815 [ ac_cv_have_clock_t="no" ]
1816 )
1817])
1818if test "x$ac_cv_have_clock_t" = "xyes" ; then
1819 AC_DEFINE(HAVE_CLOCK_T)
1820fi
1821
Damien Millerb54b40e2000-06-23 08:23:34 +10001822AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1823 AC_TRY_COMPILE(
1824 [
1825#include <sys/types.h>
1826#include <sys/socket.h>
1827 ],
1828 [ sa_family_t foo; foo = 1235; ],
1829 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001830 [ AC_TRY_COMPILE(
1831 [
1832#include <sys/types.h>
1833#include <sys/socket.h>
1834#include <netinet/in.h>
1835 ],
1836 [ sa_family_t foo; foo = 1235; ],
1837 [ ac_cv_have_sa_family_t="yes" ],
1838
Damien Millerb54b40e2000-06-23 08:23:34 +10001839 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001840 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001841 )
1842])
1843if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1844 AC_DEFINE(HAVE_SA_FAMILY_T)
1845fi
1846
Damien Miller0f91b4e2000-06-18 15:43:25 +10001847AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1848 AC_TRY_COMPILE(
1849 [
1850#include <sys/types.h>
1851 ],
1852 [ pid_t foo; foo = 1235; ],
1853 [ ac_cv_have_pid_t="yes" ],
1854 [ ac_cv_have_pid_t="no" ]
1855 )
1856])
1857if test "x$ac_cv_have_pid_t" = "xyes" ; then
1858 AC_DEFINE(HAVE_PID_T)
1859fi
1860
1861AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1862 AC_TRY_COMPILE(
1863 [
1864#include <sys/types.h>
1865 ],
1866 [ mode_t foo; foo = 1235; ],
1867 [ ac_cv_have_mode_t="yes" ],
1868 [ ac_cv_have_mode_t="no" ]
1869 )
1870])
1871if test "x$ac_cv_have_mode_t" = "xyes" ; then
1872 AC_DEFINE(HAVE_MODE_T)
1873fi
1874
Damien Miller61e50f12000-05-08 20:49:37 +10001875
1876AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1877 AC_TRY_COMPILE(
1878 [
Damien Miller81171112000-04-23 11:14:01 +10001879#include <sys/types.h>
1880#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001881 ],
1882 [ struct sockaddr_storage s; ],
1883 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1884 [ ac_cv_have_struct_sockaddr_storage="no" ]
1885 )
1886])
1887if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1888 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1889fi
Damien Miller34132e52000-01-14 15:45:46 +11001890
Damien Miller61e50f12000-05-08 20:49:37 +10001891AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1892 AC_TRY_COMPILE(
1893 [
Damien Miller7b22d652000-06-18 14:07:04 +10001894#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001895#include <netinet/in.h>
1896 ],
1897 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1898 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1899 [ ac_cv_have_struct_sockaddr_in6="no" ]
1900 )
1901])
1902if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1903 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1904fi
Damien Miller34132e52000-01-14 15:45:46 +11001905
Damien Miller61e50f12000-05-08 20:49:37 +10001906AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1907 AC_TRY_COMPILE(
1908 [
Damien Miller7b22d652000-06-18 14:07:04 +10001909#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001910#include <netinet/in.h>
1911 ],
1912 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1913 [ ac_cv_have_struct_in6_addr="yes" ],
1914 [ ac_cv_have_struct_in6_addr="no" ]
1915 )
1916])
1917if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1918 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1919fi
Damien Miller34132e52000-01-14 15:45:46 +11001920
Damien Miller61e50f12000-05-08 20:49:37 +10001921AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1922 AC_TRY_COMPILE(
1923 [
Damien Miller81171112000-04-23 11:14:01 +10001924#include <sys/types.h>
1925#include <sys/socket.h>
1926#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001927 ],
1928 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1929 [ ac_cv_have_struct_addrinfo="yes" ],
1930 [ ac_cv_have_struct_addrinfo="no" ]
1931 )
1932])
1933if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1934 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1935fi
1936
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001937AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1938 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001939 [ #include <sys/time.h> ],
1940 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001941 [ ac_cv_have_struct_timeval="yes" ],
1942 [ ac_cv_have_struct_timeval="no" ]
1943 )
1944])
1945if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1946 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1947 have_struct_timeval=1
1948fi
1949
Tim Rice4e4dc562003-03-18 10:21:40 -08001950AC_CHECK_TYPES(struct timespec)
1951
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001952# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001953if test "x$ac_cv_have_int64_t" = "xno" -a \
1954 "x$ac_cv_sizeof_long_int" != "x8" -a \
1955 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001956 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1957 echo "an alternative compiler (I.E., GCC) before continuing."
1958 echo ""
1959 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001960else
1961dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001962 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001963 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08001964#include <stdio.h>
1965#include <string.h>
1966#ifdef HAVE_SNPRINTF
1967main()
1968{
1969 char buf[50];
1970 char expected_out[50];
1971 int mazsize = 50 ;
1972#if (SIZEOF_LONG_INT == 8)
1973 long int num = 0x7fffffffffffffff;
1974#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001975 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001976#endif
1977 strcpy(expected_out, "9223372036854775807");
1978 snprintf(buf, mazsize, "%lld", num);
1979 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001980 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001981 exit(0);
1982}
1983#else
1984main() { exit(0); }
1985#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10001986 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001987 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08001988 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001989fi
1990
Damien Miller78315eb2000-09-29 23:01:36 +11001991dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001992OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1993OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1994OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1995OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1996OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001997OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001998OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1999OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002000OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002001OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2002OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2003OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2004OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002005OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2006OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2007OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2008OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002009
2010AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002011
Damien Miller61e50f12000-05-08 20:49:37 +10002012AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2013 ac_cv_have_ss_family_in_struct_ss, [
2014 AC_TRY_COMPILE(
2015 [
Damien Miller81171112000-04-23 11:14:01 +10002016#include <sys/types.h>
2017#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002018 ],
2019 [ struct sockaddr_storage s; s.ss_family = 1; ],
2020 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2021 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2022 )
2023])
2024if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2025 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2026fi
2027
Damien Miller61e50f12000-05-08 20:49:37 +10002028AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2029 ac_cv_have___ss_family_in_struct_ss, [
2030 AC_TRY_COMPILE(
2031 [
Damien Miller81171112000-04-23 11:14:01 +10002032#include <sys/types.h>
2033#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002034 ],
2035 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2036 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2037 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2038 )
2039])
2040if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2041 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2042fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002043
Damien Millerad833b32000-08-23 10:46:23 +10002044AC_CACHE_CHECK([for pw_class field in struct passwd],
2045 ac_cv_have_pw_class_in_struct_passwd, [
2046 AC_TRY_COMPILE(
2047 [
Damien Millerad833b32000-08-23 10:46:23 +10002048#include <pwd.h>
2049 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002050 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002051 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2052 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2053 )
2054])
2055if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2056 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2057fi
2058
Kevin Steves82456952001-06-22 21:14:18 +00002059AC_CACHE_CHECK([for pw_expire field in struct passwd],
2060 ac_cv_have_pw_expire_in_struct_passwd, [
2061 AC_TRY_COMPILE(
2062 [
2063#include <pwd.h>
2064 ],
2065 [ struct passwd p; p.pw_expire = 0; ],
2066 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2067 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2068 )
2069])
2070if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2071 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2072fi
2073
2074AC_CACHE_CHECK([for pw_change field in struct passwd],
2075 ac_cv_have_pw_change_in_struct_passwd, [
2076 AC_TRY_COMPILE(
2077 [
2078#include <pwd.h>
2079 ],
2080 [ struct passwd p; p.pw_change = 0; ],
2081 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2082 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2083 )
2084])
2085if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2086 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2087fi
Damien Miller61e50f12000-05-08 20:49:37 +10002088
Tim Rice28bbb0c2002-05-27 17:37:32 -07002089dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002090AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2091 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002092 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002093 [
Tim Riceae49fe62002-04-12 10:26:21 -07002094#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002095#include <sys/socket.h>
2096#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002097int main() {
2098#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002099#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002100exit(1);
2101#endif
2102struct msghdr m;
2103m.msg_accrights = 0;
2104exit(0);
2105}
Kevin Steves939c9db2002-03-22 17:23:25 +00002106 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002107 [ ac_cv_have_accrights_in_msghdr="yes" ],
2108 [ ac_cv_have_accrights_in_msghdr="no" ]
2109 )
2110])
2111if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2112 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2113fi
2114
Kevin Stevesa44e0352002-04-07 16:18:03 +00002115AC_CACHE_CHECK([for msg_control field in struct msghdr],
2116 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002117 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002118 [
Tim Riceae49fe62002-04-12 10:26:21 -07002119#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002120#include <sys/socket.h>
2121#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002122int main() {
2123#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002124#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002125exit(1);
2126#endif
2127struct msghdr m;
2128m.msg_control = 0;
2129exit(0);
2130}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002131 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002132 [ ac_cv_have_control_in_msghdr="yes" ],
2133 [ ac_cv_have_control_in_msghdr="no" ]
2134 )
2135])
2136if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2137 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2138fi
2139
Damien Miller61e50f12000-05-08 20:49:37 +10002140AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002141 AC_TRY_LINK([],
2142 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002143 [ ac_cv_libc_defines___progname="yes" ],
2144 [ ac_cv_libc_defines___progname="no" ]
2145 )
2146])
2147if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2148 AC_DEFINE(HAVE___PROGNAME)
2149fi
2150
Kevin Steves4846f4a2002-03-22 18:19:53 +00002151AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2152 AC_TRY_LINK([
2153#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002154],
2155 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002156 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2157 [ ac_cv_cc_implements___FUNCTION__="no" ]
2158 )
2159])
2160if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2161 AC_DEFINE(HAVE___FUNCTION__)
2162fi
2163
2164AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2165 AC_TRY_LINK([
2166#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002167],
2168 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002169 [ ac_cv_cc_implements___func__="yes" ],
2170 [ ac_cv_cc_implements___func__="no" ]
2171 )
2172])
2173if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2174 AC_DEFINE(HAVE___func__)
2175fi
2176
Damien Miller4f8e6692001-07-14 13:22:53 +10002177AC_CACHE_CHECK([whether getopt has optreset support],
2178 ac_cv_have_getopt_optreset, [
2179 AC_TRY_LINK(
2180 [
2181#include <getopt.h>
2182 ],
2183 [ extern int optreset; optreset = 0; ],
2184 [ ac_cv_have_getopt_optreset="yes" ],
2185 [ ac_cv_have_getopt_optreset="no" ]
2186 )
2187])
2188if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2189 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2190fi
Damien Millera22ba012000-03-02 23:09:20 +11002191
Damien Millerecbb26d2000-07-15 14:59:14 +10002192AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002193 AC_TRY_LINK([],
2194 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002195 [ ac_cv_libc_defines_sys_errlist="yes" ],
2196 [ ac_cv_libc_defines_sys_errlist="no" ]
2197 )
2198])
2199if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2200 AC_DEFINE(HAVE_SYS_ERRLIST)
2201fi
2202
2203
Damien Miller11fa2cc2000-08-16 10:35:58 +10002204AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002205 AC_TRY_LINK([],
2206 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002207 [ ac_cv_libc_defines_sys_nerr="yes" ],
2208 [ ac_cv_libc_defines_sys_nerr="no" ]
2209 )
2210])
2211if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2212 AC_DEFINE(HAVE_SYS_NERR)
2213fi
2214
Damien Millera8e06ce2003-11-21 23:48:55 +11002215SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002216# Check whether user wants sectok support
2217AC_ARG_WITH(sectok,
2218 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002219 [
2220 if test "x$withval" != "xno" ; then
2221 if test "x$withval" != "xyes" ; then
2222 CPPFLAGS="$CPPFLAGS -I${withval}"
2223 LDFLAGS="$LDFLAGS -L${withval}"
2224 if test ! -z "$need_dash_r" ; then
2225 LDFLAGS="$LDFLAGS -R${withval}"
2226 fi
2227 if test ! -z "$blibpath" ; then
2228 blibpath="$blibpath:${withval}"
2229 fi
2230 fi
2231 AC_CHECK_HEADERS(sectok.h)
2232 if test "$ac_cv_header_sectok_h" != yes; then
2233 AC_MSG_ERROR(Can't find sectok.h)
2234 fi
2235 AC_CHECK_LIB(sectok, sectok_open)
2236 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2237 AC_MSG_ERROR(Can't find libsectok)
2238 fi
2239 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002240 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002241 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002242 fi
2243 ]
2244)
2245
2246# Check whether user wants OpenSC support
2247AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002248 AC_HELP_STRING([--with-opensc=PFX],
2249 [Enable smartcard support using OpenSC]),
2250 opensc_config_prefix="$withval", opensc_config_prefix="")
2251if test x$opensc_config_prefix != x ; then
2252 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2253 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2254 if test "$OPENSC_CONFIG" != "no"; then
2255 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2256 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2257 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2258 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2259 AC_DEFINE(SMARTCARD)
2260 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002261 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002262 fi
2263fi
Damien Miller85de5802001-09-18 14:01:11 +10002264
Darren Tucker5f88d342003-10-15 16:57:57 +10002265# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002266AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002267 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002268 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002269 # Needed by our getrrsetbyname()
2270 AC_SEARCH_LIBS(res_query, resolv)
2271 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002272 AC_MSG_CHECKING(if res_query will link)
2273 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2274 [AC_MSG_RESULT(no)
2275 saved_LIBS="$LIBS"
2276 LIBS="$LIBS -lresolv"
2277 AC_MSG_CHECKING(for res_query in -lresolv)
2278 AC_LINK_IFELSE([
2279#include <resolv.h>
2280int main()
2281{
2282 res_query (0, 0, 0, 0, 0);
2283 return 0;
2284}
2285 ],
2286 [LIBS="$LIBS -lresolv"
2287 AC_MSG_RESULT(yes)],
2288 [LIBS="$saved_LIBS"
2289 AC_MSG_RESULT(no)])
2290 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002291 AC_CHECK_FUNCS(_getshort _getlong)
2292 AC_CHECK_MEMBER(HEADER.ad,
2293 [AC_DEFINE(HAVE_HEADER_AD)],,
2294 [#include <arpa/nameser.h>])
2295 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002296
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002297# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002298KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002299AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002300 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002301 [ if test "x$withval" != "xno" ; then
2302 if test "x$withval" = "xyes" ; then
2303 KRB5ROOT="/usr/local"
2304 else
2305 KRB5ROOT=${withval}
2306 fi
2307
2308 AC_DEFINE(KRB5)
2309 KRB5_MSG="yes"
2310
2311 AC_MSG_CHECKING(for krb5-config)
2312 if test -x $KRB5ROOT/bin/krb5-config ; then
2313 KRB5CONF=$KRB5ROOT/bin/krb5-config
2314 AC_MSG_RESULT($KRB5CONF)
2315
2316 AC_MSG_CHECKING(for gssapi support)
2317 if $KRB5CONF | grep gssapi >/dev/null ; then
2318 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002319 AC_DEFINE(GSSAPI)
2320 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002321 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002322 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002323 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002324 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002325 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2326 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002327 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002328 AC_MSG_CHECKING(whether we are using Heimdal)
2329 AC_TRY_COMPILE([ #include <krb5.h> ],
2330 [ char *tmp = heimdal_version; ],
2331 [ AC_MSG_RESULT(yes)
2332 AC_DEFINE(HEIMDAL) ],
2333 AC_MSG_RESULT(no)
2334 )
2335 else
2336 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002337 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002338 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002339 AC_MSG_CHECKING(whether we are using Heimdal)
2340 AC_TRY_COMPILE([ #include <krb5.h> ],
2341 [ char *tmp = heimdal_version; ],
2342 [ AC_MSG_RESULT(yes)
2343 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002344 K5LIBS="-lkrb5 -ldes"
2345 K5LIBS="$K5LIBS -lcom_err -lasn1"
2346 AC_CHECK_LIB(roken, net_write,
2347 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002348 ],
2349 [ AC_MSG_RESULT(no)
2350 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2351 ]
2352 )
Damien Miller200d0a72003-06-30 19:21:36 +10002353 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002354
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002355 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2356 [ AC_DEFINE(GSSAPI)
2357 K5LIBS="-lgssapi $K5LIBS" ],
2358 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2359 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002360 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002361 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2362 $K5LIBS)
2363 ],
2364 $K5LIBS)
2365
2366 AC_CHECK_HEADER(gssapi.h, ,
2367 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002368 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002369 AC_CHECK_HEADERS(gssapi.h, ,
2370 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002371 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002372 ]
2373 )
2374
2375 oldCPP="$CPPFLAGS"
2376 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2377 AC_CHECK_HEADER(gssapi_krb5.h, ,
2378 [ CPPFLAGS="$oldCPP" ])
2379
Damien Millera8e06ce2003-11-21 23:48:55 +11002380 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002381 if test ! -z "$need_dash_r" ; then
2382 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2383 fi
2384 if test ! -z "$blibpath" ; then
2385 blibpath="$blibpath:${KRB5ROOT}/lib"
2386 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002387 fi
2388
2389 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2390 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2391 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2392
2393 LIBS="$LIBS $K5LIBS"
2394 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002395 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002396 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002397)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002398
Damien Millera22ba012000-03-02 23:09:20 +11002399# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002400
Damien Millerf58c6722002-05-13 13:15:42 +10002401PRIVSEP_PATH=/var/empty
2402AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002403 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002404 [
2405 if test "x$withval" != "$no" ; then
2406 PRIVSEP_PATH=$withval
2407 fi
2408 ]
2409)
2410AC_SUBST(PRIVSEP_PATH)
2411
Damien Millera22ba012000-03-02 23:09:20 +11002412AC_ARG_WITH(xauth,
2413 [ --with-xauth=PATH Specify path to xauth program ],
2414 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002415 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002416 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002417 fi
2418 ],
2419 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002420 TestPath="$PATH"
2421 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2422 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2423 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2424 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2425 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002426 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002427 xauth_path="/usr/openwin/bin/xauth"
2428 fi
2429 ]
2430)
2431
Damien Miller7d901272003-01-13 16:55:22 +11002432STRIP_OPT=-s
2433AC_ARG_ENABLE(strip,
2434 [ --disable-strip Disable calling strip(1) on install],
2435 [
2436 if test "x$enableval" = "xno" ; then
2437 STRIP_OPT=
2438 fi
2439 ]
2440)
2441AC_SUBST(STRIP_OPT)
2442
Damien Millera19cf472000-11-29 13:28:50 +11002443if test -z "$xauth_path" ; then
2444 XAUTH_PATH="undefined"
2445 AC_SUBST(XAUTH_PATH)
2446else
Damien Millera22ba012000-03-02 23:09:20 +11002447 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002448 XAUTH_PATH=$xauth_path
2449 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002450fi
Damien Millera22ba012000-03-02 23:09:20 +11002451
2452# Check for mail directory (last resort if we cannot get it from headers)
2453if test ! -z "$MAIL" ; then
2454 maildir=`dirname $MAIL`
2455 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2456fi
2457
Darren Tucker623d92f2004-09-12 22:36:15 +10002458if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002459 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2460 disable_ptmx_check=yes
2461fi
Damien Millera22ba012000-03-02 23:09:20 +11002462if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002463 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002464 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002465 [
2466 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2467 have_dev_ptmx=1
2468 ]
2469 )
2470 fi
Damien Millera22ba012000-03-02 23:09:20 +11002471fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002472
Darren Tucker623d92f2004-09-12 22:36:15 +10002473if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002474 AC_CHECK_FILE("/dev/ptc",
2475 [
2476 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2477 have_dev_ptc=1
2478 ]
2479 )
2480else
2481 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2482fi
Damien Miller204ad072000-03-02 23:56:12 +11002483
Damien Millera22ba012000-03-02 23:09:20 +11002484# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002485AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002486 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002487 [
Damien Miller897741e2001-04-16 10:41:46 +10002488 case "$withval" in
2489 man|cat|doc)
2490 MANTYPE=$withval
2491 ;;
2492 *)
2493 AC_MSG_ERROR(invalid man type: $withval)
2494 ;;
2495 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002496 ]
2497)
Ben Lindstrombc709922001-04-18 18:04:21 +00002498if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002499 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2500 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002501 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2502 MANTYPE=doc
2503 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2504 MANTYPE=man
2505 else
2506 MANTYPE=cat
2507 fi
2508fi
Damien Miller670a4b82000-01-22 13:53:11 +11002509AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002510if test "$MANTYPE" = "doc"; then
2511 mansubdir=man;
2512else
2513 mansubdir=$MANTYPE;
2514fi
2515AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002516
Damien Millera22ba012000-03-02 23:09:20 +11002517# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002518MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002519AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002520 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002521 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002522 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002523 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002524 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002525 fi
2526 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002527)
2528
Damien Millera22ba012000-03-02 23:09:20 +11002529# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002530AC_ARG_WITH(shadow,
2531 [ --without-shadow Disable shadow password support],
2532 [
2533 if test "x$withval" = "xno" ; then
2534 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002535 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002536 fi
2537 ]
2538)
2539
Damien Miller1f335fb2000-06-26 11:31:33 +10002540if test -z "$disable_shadow" ; then
2541 AC_MSG_CHECKING([if the systems has expire shadow information])
2542 AC_TRY_COMPILE(
2543 [
2544#include <sys/types.h>
2545#include <shadow.h>
2546 struct spwd sp;
2547 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2548 [ sp_expire_available=yes ], []
2549 )
2550
2551 if test "x$sp_expire_available" = "xyes" ; then
2552 AC_MSG_RESULT(yes)
2553 AC_DEFINE(HAS_SHADOW_EXPIRE)
2554 else
2555 AC_MSG_RESULT(no)
2556 fi
2557fi
2558
Damien Millera22ba012000-03-02 23:09:20 +11002559# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002560if test ! -z "$IPADDR_IN_DISPLAY" ; then
2561 DISPLAY_HACK_MSG="yes"
2562 AC_DEFINE(IPADDR_IN_DISPLAY)
2563else
Damien Millera8e06ce2003-11-21 23:48:55 +11002564 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002565 AC_ARG_WITH(ipaddr-display,
2566 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2567 [
2568 if test "x$withval" != "xno" ; then
2569 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002570 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002571 fi
2572 ]
2573 )
2574fi
Damien Miller76112de1999-12-21 11:18:08 +11002575
Darren Tuckere1a790d2003-09-16 11:52:19 +10002576# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002577AC_ARG_ENABLE(etc-default-login,
2578 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
Darren Tuckera0c2b392004-09-11 23:26:37 +10002579 [ AC_CHECK_FILE("/etc/default/login",
2580 [ external_path_file=/etc/default/login ])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002581
Darren Tucker623d92f2004-09-12 22:36:15 +10002582 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2583 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002584 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2585 elif test "x$external_path_file" = "x/etc/default/login"; then
2586 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2587 fi
2588 ]
2589)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002590
Tim Rice43a1c132002-04-17 21:19:14 -07002591dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2592if test $ac_cv_func_login_getcapbool = "yes" -a \
2593 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002594 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002595fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002596
Damien Millera22ba012000-03-02 23:09:20 +11002597# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002598SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002599AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002600 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002601 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002602 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002603 AC_MSG_WARN([
2604--with-default-path=PATH has no effect on this system.
2605Edit /etc/login.conf instead.])
2606 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002607 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002608 AC_MSG_WARN([
2609--with-default-path=PATH will only be used if PATH is not defined in
2610$external_path_file .])
2611 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002612 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002613 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002614 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002615 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002616 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2617 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002618 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002619 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002620 AC_MSG_WARN([
2621If PATH is defined in $external_path_file, ensure the path to scp is included,
2622otherwise scp will not work.])
2623 fi
2624 AC_TRY_RUN(
2625 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002626/* find out what STDPATH is */
2627#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002628#ifdef HAVE_PATHS_H
2629# include <paths.h>
2630#endif
2631#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002632# ifdef _PATH_USERPATH /* Irix */
2633# define _PATH_STDPATH _PATH_USERPATH
2634# else
2635# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2636# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002637#endif
2638#include <sys/types.h>
2639#include <sys/stat.h>
2640#include <fcntl.h>
2641#define DATA "conftest.stdpath"
2642
2643main()
2644{
2645 FILE *fd;
2646 int rc;
2647
2648 fd = fopen(DATA,"w");
2649 if(fd == NULL)
2650 exit(1);
2651
2652 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2653 exit(1);
2654
2655 exit(0);
2656}
2657 ], [ user_path=`cat conftest.stdpath` ],
2658 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2659 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2660 )
2661# make sure $bindir is in USER_PATH so scp will work
2662 t_bindir=`eval echo ${bindir}`
2663 case $t_bindir in
2664 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2665 esac
2666 case $t_bindir in
2667 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2668 esac
2669 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2670 if test $? -ne 0 ; then
2671 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2672 if test $? -ne 0 ; then
2673 user_path=$user_path:$t_bindir
2674 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2675 fi
2676 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002677 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002678)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002679if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002680 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2681 AC_SUBST(user_path)
2682fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002683
Damien Millera18bbd32002-05-13 10:48:57 +10002684# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002685AC_ARG_WITH(superuser-path,
2686 [ --with-superuser-path= Specify different path for super-user],
2687 [
2688 if test "x$withval" != "xno" ; then
2689 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2690 superuser_path=$withval
2691 fi
2692 ]
2693)
2694
2695
Damien Miller61e50f12000-05-08 20:49:37 +10002696AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002697IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002698AC_ARG_WITH(4in6,
2699 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2700 [
2701 if test "x$withval" != "xno" ; then
2702 AC_MSG_RESULT(yes)
2703 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002704 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002705 else
2706 AC_MSG_RESULT(no)
2707 fi
2708 ],[
2709 if test "x$inet6_default_4in6" = "xyes"; then
2710 AC_MSG_RESULT([yes (default)])
2711 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002712 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002713 else
2714 AC_MSG_RESULT([no (default)])
2715 fi
2716 ]
2717)
2718
Damien Miller60396b02001-02-18 17:01:00 +11002719# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002720BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002721AC_ARG_WITH(bsd-auth,
2722 [ --with-bsd-auth Enable BSD auth support],
2723 [
2724 if test "x$withval" != "xno" ; then
2725 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002726 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002727 fi
2728 ]
2729)
2730
Damien Millera22ba012000-03-02 23:09:20 +11002731# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002732piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002733# make sure the directory exists
2734if test ! -d $piddir ; then
2735 piddir=`eval echo ${sysconfdir}`
2736 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002737 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002738 esac
2739fi
2740
Tim Rice88f2ab52002-03-17 12:17:34 -08002741AC_ARG_WITH(pid-dir,
2742 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2743 [
2744 if test "x$withval" != "xno" ; then
2745 piddir=$withval
2746 if test ! -d $piddir ; then
2747 AC_MSG_WARN([** no $piddir directory on this system **])
2748 fi
2749 fi
2750 ]
2751)
2752
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002753AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002754AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002755
andre2ff7b5d2000-06-03 14:57:40 +00002756dnl allow user to disable some login recording features
2757AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002758 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002759 [
2760 if test "x$enableval" = "xno" ; then
2761 AC_DEFINE(DISABLE_LASTLOG)
2762 fi
2763 ]
andre2ff7b5d2000-06-03 14:57:40 +00002764)
2765AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002766 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002767 [
2768 if test "x$enableval" = "xno" ; then
2769 AC_DEFINE(DISABLE_UTMP)
2770 fi
2771 ]
andre2ff7b5d2000-06-03 14:57:40 +00002772)
2773AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002774 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002775 [
2776 if test "x$enableval" = "xno" ; then
2777 AC_DEFINE(DISABLE_UTMPX)
2778 fi
2779 ]
andre2ff7b5d2000-06-03 14:57:40 +00002780)
2781AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002782 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002783 [
2784 if test "x$enableval" = "xno" ; then
2785 AC_DEFINE(DISABLE_WTMP)
2786 fi
2787 ]
andre2ff7b5d2000-06-03 14:57:40 +00002788)
2789AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002790 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002791 [
2792 if test "x$enableval" = "xno" ; then
2793 AC_DEFINE(DISABLE_WTMPX)
2794 fi
2795 ]
andre2ff7b5d2000-06-03 14:57:40 +00002796)
2797AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002798 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002799 [
2800 if test "x$enableval" = "xno" ; then
2801 AC_DEFINE(DISABLE_LOGIN)
2802 fi
2803 ]
andre2ff7b5d2000-06-03 14:57:40 +00002804)
2805AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002806 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002807 [
2808 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002809 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002810 fi
2811 ]
andre2ff7b5d2000-06-03 14:57:40 +00002812)
2813AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002814 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002815 [
2816 if test "x$enableval" = "xno" ; then
2817 AC_DEFINE(DISABLE_PUTUTXLINE)
2818 fi
2819 ]
andre2ff7b5d2000-06-03 14:57:40 +00002820)
2821AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002822 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002823 [
2824 if test "x$withval" = "xno" ; then
2825 AC_DEFINE(DISABLE_LASTLOG)
2826 else
2827 conf_lastlog_location=$withval
2828 fi
2829 ]
2830)
andre2ff7b5d2000-06-03 14:57:40 +00002831
2832dnl lastlog, [uw]tmpx? detection
2833dnl NOTE: set the paths in the platform section to avoid the
2834dnl need for command-line parameters
2835dnl lastlog and [uw]tmp are subject to a file search if all else fails
2836
2837dnl lastlog detection
2838dnl NOTE: the code itself will detect if lastlog is a directory
2839AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2840AC_TRY_COMPILE([
2841#include <sys/types.h>
2842#include <utmp.h>
2843#ifdef HAVE_LASTLOG_H
2844# include <lastlog.h>
2845#endif
Damien Miller2994e082000-06-04 15:51:47 +10002846#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002847# include <paths.h>
2848#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002849#ifdef HAVE_LOGIN_H
2850# include <login.h>
2851#endif
andre2ff7b5d2000-06-03 14:57:40 +00002852 ],
2853 [ char *lastlog = LASTLOG_FILE; ],
2854 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002855 [
2856 AC_MSG_RESULT(no)
2857 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2858 AC_TRY_COMPILE([
2859#include <sys/types.h>
2860#include <utmp.h>
2861#ifdef HAVE_LASTLOG_H
2862# include <lastlog.h>
2863#endif
2864#ifdef HAVE_PATHS_H
2865# include <paths.h>
2866#endif
2867 ],
2868 [ char *lastlog = _PATH_LASTLOG; ],
2869 [ AC_MSG_RESULT(yes) ],
2870 [
andree441aa32000-06-12 22:34:38 +00002871 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002872 system_lastlog_path=no
2873 ])
2874 ]
andre2ff7b5d2000-06-03 14:57:40 +00002875)
Damien Miller2994e082000-06-04 15:51:47 +10002876
andre2ff7b5d2000-06-03 14:57:40 +00002877if test -z "$conf_lastlog_location"; then
2878 if test x"$system_lastlog_path" = x"no" ; then
2879 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002880 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002881 conf_lastlog_location=$f
2882 fi
2883 done
2884 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002885 AC_MSG_WARN([** Cannot find lastlog **])
2886 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002887 fi
2888 fi
2889fi
2890
2891if test -n "$conf_lastlog_location"; then
2892 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2893fi
2894
2895dnl utmp detection
2896AC_MSG_CHECKING([if your system defines UTMP_FILE])
2897AC_TRY_COMPILE([
2898#include <sys/types.h>
2899#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002900#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002901# include <paths.h>
2902#endif
2903 ],
2904 [ char *utmp = UTMP_FILE; ],
2905 [ AC_MSG_RESULT(yes) ],
2906 [ AC_MSG_RESULT(no)
2907 system_utmp_path=no ]
2908)
2909if test -z "$conf_utmp_location"; then
2910 if test x"$system_utmp_path" = x"no" ; then
2911 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2912 if test -f $f ; then
2913 conf_utmp_location=$f
2914 fi
2915 done
2916 if test -z "$conf_utmp_location"; then
2917 AC_DEFINE(DISABLE_UTMP)
2918 fi
2919 fi
2920fi
2921if test -n "$conf_utmp_location"; then
2922 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2923fi
2924
2925dnl wtmp detection
2926AC_MSG_CHECKING([if your system defines WTMP_FILE])
2927AC_TRY_COMPILE([
2928#include <sys/types.h>
2929#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002930#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002931# include <paths.h>
2932#endif
2933 ],
2934 [ char *wtmp = WTMP_FILE; ],
2935 [ AC_MSG_RESULT(yes) ],
2936 [ AC_MSG_RESULT(no)
2937 system_wtmp_path=no ]
2938)
2939if test -z "$conf_wtmp_location"; then
2940 if test x"$system_wtmp_path" = x"no" ; then
2941 for f in /usr/adm/wtmp /var/log/wtmp; do
2942 if test -f $f ; then
2943 conf_wtmp_location=$f
2944 fi
2945 done
2946 if test -z "$conf_wtmp_location"; then
2947 AC_DEFINE(DISABLE_WTMP)
2948 fi
2949 fi
2950fi
2951if test -n "$conf_wtmp_location"; then
2952 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2953fi
2954
2955
2956dnl utmpx detection - I don't know any system so perverse as to require
2957dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2958dnl there, though.
2959AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2960AC_TRY_COMPILE([
2961#include <sys/types.h>
2962#include <utmp.h>
2963#ifdef HAVE_UTMPX_H
2964#include <utmpx.h>
2965#endif
Damien Miller2994e082000-06-04 15:51:47 +10002966#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002967# include <paths.h>
2968#endif
2969 ],
2970 [ char *utmpx = UTMPX_FILE; ],
2971 [ AC_MSG_RESULT(yes) ],
2972 [ AC_MSG_RESULT(no)
2973 system_utmpx_path=no ]
2974)
2975if test -z "$conf_utmpx_location"; then
2976 if test x"$system_utmpx_path" = x"no" ; then
2977 AC_DEFINE(DISABLE_UTMPX)
2978 fi
2979else
2980 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2981fi
2982
2983dnl wtmpx detection
2984AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2985AC_TRY_COMPILE([
2986#include <sys/types.h>
2987#include <utmp.h>
2988#ifdef HAVE_UTMPX_H
2989#include <utmpx.h>
2990#endif
Damien Miller2994e082000-06-04 15:51:47 +10002991#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002992# include <paths.h>
2993#endif
2994 ],
2995 [ char *wtmpx = WTMPX_FILE; ],
2996 [ AC_MSG_RESULT(yes) ],
2997 [ AC_MSG_RESULT(no)
2998 system_wtmpx_path=no ]
2999)
3000if test -z "$conf_wtmpx_location"; then
3001 if test x"$system_wtmpx_path" = x"no" ; then
3002 AC_DEFINE(DISABLE_WTMPX)
3003 fi
3004else
3005 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3006fi
3007
Damien Miller4018c192000-04-30 09:30:44 +10003008
Damien Miller29ea30d2000-03-17 10:54:15 +11003009if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003010 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3011 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003012fi
3013
Tim Rice4cec93f2002-02-26 08:40:48 -08003014dnl remove pam and dl because they are in $LIBPAM
3015if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003016 LIBS=`echo $LIBS | sed 's/-lpam //'`
3017fi
3018if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3019 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003020fi
3021
Damien Millerbac2d8a2000-09-05 16:13:06 +11003022AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07003023AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07003024AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003025
Damien Miller7b22d652000-06-18 14:07:04 +10003026# Print summary of options
3027
Damien Miller7b22d652000-06-18 14:07:04 +10003028# Someone please show me a better way :)
3029A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3030B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3031C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3032D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003033E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003034F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003035G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003036H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3037I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3038J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003039
3040echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003041echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003042echo " User binaries: $B"
3043echo " System binaries: $C"
3044echo " Configuration files: $D"
3045echo " Askpass program: $E"
3046echo " Manual pages: $F"
3047echo " PID file: $G"
3048echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003049if test "x$external_path_file" = "x/etc/login.conf" ; then
3050echo " At runtime, sshd will use the path defined in $external_path_file"
3051echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003052else
Damien Millerf58c6722002-05-13 13:15:42 +10003053echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003054 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003055echo " (If PATH is set in $external_path_file it will be used instead. If"
3056echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3057 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003058fi
Damien Millera18bbd32002-05-13 10:48:57 +10003059if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003060echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003061fi
Damien Millerf58c6722002-05-13 13:15:42 +10003062echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003063echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003064echo " KerberosV support: $KRB5_MSG"
3065echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003066echo " S/KEY support: $SKEY_MSG"
3067echo " TCP Wrappers support: $TCPW_MSG"
3068echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003069echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003070echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003071echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3072echo " BSD Auth support: $BSD_AUTH_MSG"
3073echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003074if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003075echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003076fi
3077
Damien Miller7b22d652000-06-18 14:07:04 +10003078echo ""
3079
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003080echo " Host: ${host}"
3081echo " Compiler: ${CC}"
3082echo " Compiler flags: ${CFLAGS}"
3083echo "Preprocessor flags: ${CPPFLAGS}"
3084echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003085echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003086
3087echo ""
3088
Tim Rice6f1f7582004-05-30 21:38:51 -07003089if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003090 echo "SVR4 style packages are supported with \"make package\""
3091 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003092fi
3093
Damien Miller82cf0ce2000-12-20 13:34:48 +11003094if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003095 echo "PAM is enabled. You may need to install a PAM control file "
3096 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003097 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003098 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003099 echo ""
3100fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003101
Damien Miller6c21c512002-01-22 21:57:53 +11003102if test ! -z "$RAND_HELPER_CMDHASH" ; then
3103 echo "WARNING: you are using the builtin random number collection "
3104 echo "service. Please read WARNING.RNG and request that your OS "
3105 echo "vendor includes kernel-based random number collection in "
3106 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003107 echo ""
3108fi
Damien Miller60396b02001-02-18 17:01:00 +11003109
Damien Millerb4097182004-05-23 14:09:40 +10003110if test ! -z "$NO_PEERCHECK" ; then
3111 echo "WARNING: the operating system that you are using does not "
3112 echo "appear to support either the getpeereid() API nor the "
3113 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3114 echo "enforce security checks to prevent unauthorised connections to "
3115 echo "ssh-agent. Their absence increases the risk that a malicious "
3116 echo "user can connect to your agent. "
3117 echo ""
3118fi
3119