blob: 2885a69fb6060df117dc49d3f8b6236e3ffbe85c [file] [log] [blame]
Darren Tucker5bfe1682005-11-12 18:42:36 +11001# $Id: configure.ac,v 1.307 2005/11/12 07:42:37 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110088 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070089 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
Darren Tuckerb0288092005-11-10 14:46:48 +110093 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +110094 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
95 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100097
Darren Tucker67b37032005-06-03 17:58:31 +100098 if test -z "$have_llong_max"; then
99 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
100 unset ac_cv_have_decl_LLONG_MAX
101 saved_CFLAGS="$CFLAGS"
102 CFLAGS="$CFLAGS -std=gnu99"
103 AC_CHECK_DECL(LLONG_MAX,
104 [have_llong_max=1],
105 [CFLAGS="$saved_CFLAGS"],
106 [#include <limits.h>]
107 )
108 fi
Damien Miller166bd442000-03-16 10:48:25 +1100109fi
110
Tim Rice88368a32003-12-08 12:35:59 -0800111AC_ARG_WITH(rpath,
112 [ --without-rpath Disable auto-added -R linker paths],
113 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800114 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800115 need_dash_r=""
116 fi
117 if test "x$withval" = "xyes" ; then
118 need_dash_r=1
119 fi
120 ]
121)
122
Damien Millera22ba012000-03-02 23:09:20 +1100123# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100124case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100125*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100126 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000127 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800128 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100129 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000130 saved_LDFLAGS="$LDFLAGS"
131 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
132 if (test -z "$blibflags"); then
133 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
134 AC_TRY_LINK([], [], [blibflags=$tryflags])
135 fi
136 done
137 if (test -z "$blibflags"); then
138 AC_MSG_RESULT(not found)
139 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
140 else
141 AC_MSG_RESULT($blibflags)
142 fi
143 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000144 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700145 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
146 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700147 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000148 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700149 LIBS="$LIBS -ls"
150 ])
151 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100152 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100153 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100154 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000155 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100156 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000157 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
158 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000159 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000160 [(void)loginfailed("user","host","tty",0);],
161 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700162 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
163 [Define if your AIX loginfailed() function
164 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000165 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000166 )],
167 [],
168 [#include <usersec.h>]
169 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000170 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100171 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700172 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
173 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
174 [Define if your platform breaks doing a seteuid before a setuid])
175 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
176 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000177 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700178 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
179 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
180 [Some systems need a utmpx entry for /bin/login to work])
181 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
182 [Define to a Set Process Title type if your system is
183 supported by bsd-setproctitle.c])
Damien Miller75b1d102000-01-07 14:01:41 +1100184 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100185*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100186 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800187 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700188 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
189 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
190 AC_DEFINE(DISABLE_SHADOW, 1,
191 [Define if you want to disable shadow passwords])
192 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
193 [Define if your system choked on IP TOS setting])
194 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
195 [Define if X11 doesn't support AF_UNIX sockets on that system])
196 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
197 [Define if the concept of ports only accessible to
198 superusers isn't known])
199 AC_DEFINE(DISABLE_FD_PASSING, 1,
200 [Define if your platform needs to skip post auth
201 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100202 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000203*-*-dgux*)
204 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100205 AC_DEFINE(SETEUID_BREAKS_SETUID)
206 AC_DEFINE(BROKEN_SETREUID)
207 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000208 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000209*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000210 AC_MSG_CHECKING(if we have working getaddrinfo)
211 AC_TRY_RUN([#include <mach-o/dyld.h>
212main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
213 exit(0);
214 else
215 exit(1);
216}], [AC_MSG_RESULT(working)],
217 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700218 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700219 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000220 AC_DEFINE(SETEUID_BREAKS_SETUID)
221 AC_DEFINE(BROKEN_SETREUID)
222 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700223 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
224 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000225 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000226*-*-hpux*)
227 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000228 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100229 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000230 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700231 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
232 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000233 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700234 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
235 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000236 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000237 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700238 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000239 AC_CHECK_LIB(xnet, t_error, ,
240 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
241
242 # next, we define all of the options specific to major releases
243 case "$host" in
244 *-*-hpux10*)
245 if test -z "$GCC"; then
246 CFLAGS="$CFLAGS -Ae"
247 fi
248 ;;
249 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700250 AC_DEFINE(PAM_SUN_CODEBASE, 1,
251 [Define if you are using Solaris-derived PAM which
252 passes pam_messages to the conversation function
253 with an extra level of indirection])
254 AC_DEFINE(DISABLE_UTMP, 1,
255 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000256 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
257 check_for_hpux_broken_getaddrinfo=1
258 check_for_conflicting_getspnam=1
259 ;;
260 esac
261
262 # lastly, we define options specific to minor releases
263 case "$host" in
264 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700265 AC_DEFINE(HAVE_SECUREWARE, 1,
266 [Define if you have SecureWare-based
267 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000268 disable_ptmx_check=yes
269 LIBS="$LIBS -lsecpw"
270 ;;
271 esac
Damien Miller1bead332000-04-30 00:47:29 +1000272 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100273*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100274 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700275 AC_DEFINE(BROKEN_INET_NTOA, 1,
276 [Define if you system's inet_ntoa is busted
277 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000278 AC_DEFINE(SETEUID_BREAKS_SETUID)
279 AC_DEFINE(BROKEN_SETREUID)
280 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700281 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
282 [Define if you shouldn't strip 'tty' from your
283 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000284 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100285 ;;
286*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100287 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700288 AC_DEFINE(WITH_IRIX_ARRAY, 1,
289 [Define if you have/want arrays
290 (cluster-wide session managment, not C arrays)])
291 AC_DEFINE(WITH_IRIX_PROJECT, 1,
292 [Define if you want IRIX project management])
293 AC_DEFINE(WITH_IRIX_AUDIT, 1,
294 [Define if you want IRIX audit trails])
295 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
296 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000297 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000298 AC_DEFINE(SETEUID_BREAKS_SETUID)
299 AC_DEFINE(BROKEN_SETREUID)
300 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700301 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000302 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000303 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100304 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100305*-*-linux*)
306 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100307 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000308 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700309 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
310 AC_DEFINE(PAM_TTY_KLUDGE, 1,
311 [Work around problematic Linux PAM modules handling of PAM_TTY])
312 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
313 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000314 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700315 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
316 [Define to whatever link() returns for "not supported"
317 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100318 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700319 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100320 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000321 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000322 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700323 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
324 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000325 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000326 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100327 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000328mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700329 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000330 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000331 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100332*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000333 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800334 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800335 need_dash_r=1
336 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100337 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100338*-*-freebsd*)
339 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000340 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100341 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000342*-*-bsdi*)
343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
346 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000347*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000348 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100349 conf_utmp_location=/etc/utmp
350 conf_wtmp_location=/usr/adm/wtmp
351 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700352 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000353 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000354 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700355 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000356 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000357*-*-openbsd*)
358 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000359 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Darren Tucker4a422572005-07-14 17:22:11 +1000360 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100361*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800362 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800363 need_dash_r=1
364 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100365 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000366 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700367 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
368 [Some versions of /bin/login need the TERM supplied
369 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000370 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700371 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
372 [Define if pam_chauthtok wants real uid set
373 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000374 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000375 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700376 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
377 [Define if sshd somehow reacquires a controlling TTY
378 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000379 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000380 # hardwire lastlog location (can't detect it on some versions)
381 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000382 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
383 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
384 if test "$sol2ver" -ge 8; then
385 AC_MSG_RESULT(yes)
386 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700387 AC_DEFINE(DISABLE_WTMP, 1,
388 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000389 else
390 AC_MSG_RESULT(no)
391 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100392 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000393*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000394 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000395 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100396 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000397 conf_utmp_location=/etc/utmp
398 conf_wtmp_location=/var/adm/wtmp
399 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000400 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000401 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000402*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700403 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000404 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000405 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000406 AC_DEFINE(SETEUID_BREAKS_SETUID)
407 AC_DEFINE(BROKEN_SETREUID)
408 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000409 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000410*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700411 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000412 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100413 # -lresolv needs to be at then end of LIBS or DNS lookups break
414 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100415 IPADDR_IN_DISPLAY=yes
416 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000417 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000418 AC_DEFINE(SETEUID_BREAKS_SETUID)
419 AC_DEFINE(BROKEN_SETREUID)
420 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000421 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000422 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700423 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
424 # Attention: always take care to bind libsocket and libnsl before libc,
425 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000426 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800427# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100428*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100429 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700430 AC_DEFINE(SETEUID_BREAKS_SETUID)
431 AC_DEFINE(BROKEN_SETREUID)
432 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700433 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100434 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800435# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100436*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700437 check_for_libcrypt_later=1
438 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100439 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700440 AC_DEFINE(SETEUID_BREAKS_SETUID)
441 AC_DEFINE(BROKEN_SETREUID)
442 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700443 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700444 case "$host" in
445 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
446 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700447 AC_DEFINE(BROKEN_LIBIAF, 1,
448 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700449 ;;
450 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100451 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100452*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100453 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800454# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100455*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800456 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100457 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800458# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100459*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800460 if test -z "$GCC"; then
461 CFLAGS="$CFLAGS -belf"
462 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100463 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000464 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100465 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000466 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000467 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700468 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700469 AC_DEFINE(SETEUID_BREAKS_SETUID)
470 AC_DEFINE(BROKEN_SETREUID)
471 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700472 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700473 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700474 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100475 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700476 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700477 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000478 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000479*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700480 AC_DEFINE(NO_SSH_LASTLOG, 1,
481 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100482 AC_DEFINE(SETEUID_BREAKS_SETUID)
483 AC_DEFINE(BROKEN_SETREUID)
484 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000485 AC_DEFINE(USE_PIPES)
486 AC_DEFINE(DISABLE_FD_PASSING)
487 LDFLAGS="$LDFLAGS"
488 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
489 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000490 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000491*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100492 AC_DEFINE(SETEUID_BREAKS_SETUID)
493 AC_DEFINE(BROKEN_SETREUID)
494 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000495 AC_DEFINE(WITH_ABBREV_NO_TTY)
496 AC_DEFINE(USE_PIPES)
497 AC_DEFINE(DISABLE_FD_PASSING)
498 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100499 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000500 MANTYPE=cat
501 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000502*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100503 AC_DEFINE(SETEUID_BREAKS_SETUID)
504 AC_DEFINE(BROKEN_SETREUID)
505 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000506 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700507 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700508 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000509 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
510 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
511 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700512 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000513*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000514 AC_MSG_CHECKING(for Digital Unix SIA)
515 no_osfsia=""
516 AC_ARG_WITH(osfsia,
517 [ --with-osfsia Enable Digital Unix SIA],
518 [
519 if test "x$withval" = "xno" ; then
520 AC_MSG_RESULT(disabled)
521 no_osfsia=1
522 fi
523 ],
524 )
525 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000526 if test -f /etc/sia/matrix.conf; then
527 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700528 AC_DEFINE(HAVE_OSF_SIA, 1,
529 [Define if you have Digital Unix Security
530 Integration Architecture])
531 AC_DEFINE(DISABLE_LOGIN, 1,
532 [Define if you don't want to use your
533 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000534 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000535 LIBS="$LIBS -lsecurity -ldb -lm -laud"
536 else
537 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700538 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
539 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000540 fi
541 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000542 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700543 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000544 AC_DEFINE(BROKEN_SETREUID)
545 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000546 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000547
548*-*-nto-qnx)
549 AC_DEFINE(USE_PIPES)
550 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700551 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
552 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
553 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000554 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000555
556*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700557 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
558 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
559 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700560 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
561 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000562
563*-*-lynxos)
564 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700565 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000566 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
567 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100568esac
569
Damien Millere37bfc12000-06-05 09:37:43 +1000570# Allow user to specify flags
571AC_ARG_WITH(cflags,
572 [ --with-cflags Specify additional flags to pass to compiler],
573 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800574 if test -n "$withval" && test "x$withval" != "xno" && \
575 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000576 CFLAGS="$CFLAGS $withval"
577 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800578 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000579)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000580AC_ARG_WITH(cppflags,
581 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
582 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800583 if test -n "$withval" && test "x$withval" != "xno" && \
584 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000585 CPPFLAGS="$CPPFLAGS $withval"
586 fi
587 ]
588)
Damien Millere37bfc12000-06-05 09:37:43 +1000589AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000590 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000591 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800592 if test -n "$withval" && test "x$withval" != "xno" && \
593 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000594 LDFLAGS="$LDFLAGS $withval"
595 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800596 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000597)
598AC_ARG_WITH(libs,
599 [ --with-libs Specify additional libraries to link with],
600 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800601 if test -n "$withval" && test "x$withval" != "xno" && \
602 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000603 LIBS="$LIBS $withval"
604 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800605 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000606)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000607AC_ARG_WITH(Werror,
608 [ --with-Werror Build main code with -Werror],
609 [
610 if test -n "$withval" && test "x$withval" != "xno"; then
611 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000612 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000613 werror_flags="$withval"
614 fi
615 fi
616 ]
617)
Damien Millere37bfc12000-06-05 09:37:43 +1000618
Darren Tucker6eb93042003-06-29 21:30:41 +1000619AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000620AC_RUN_IFELSE(
621 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000622#include <stdio.h>
623int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000624 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000625 [ AC_MSG_RESULT(yes) ],
626 [
627 AC_MSG_RESULT(no)
628 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000629 ],
630 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000631)
632
Darren Tucker0c9653f2005-05-28 15:58:14 +1000633dnl Checks for header files.
634AC_CHECK_HEADERS( \
635 bstring.h \
636 crypt.h \
637 dirent.h \
638 endian.h \
639 features.h \
640 floatingpoint.h \
641 getopt.h \
642 glob.h \
643 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700644 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000645 lastlog.h \
646 limits.h \
647 login.h \
648 login_cap.h \
649 maillock.h \
650 ndir.h \
651 netdb.h \
652 netgroup.h \
653 netinet/in_systm.h \
654 pam/pam_appl.h \
655 paths.h \
656 pty.h \
657 readpassphrase.h \
658 rpc/types.h \
659 security/pam_appl.h \
660 shadow.h \
661 stddef.h \
662 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000663 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000664 strings.h \
665 sys/audit.h \
666 sys/bitypes.h \
667 sys/bsdtty.h \
668 sys/cdefs.h \
669 sys/dir.h \
670 sys/mman.h \
671 sys/ndir.h \
672 sys/prctl.h \
673 sys/pstat.h \
674 sys/select.h \
675 sys/stat.h \
676 sys/stream.h \
677 sys/stropts.h \
678 sys/strtio.h \
679 sys/sysmacros.h \
680 sys/time.h \
681 sys/timers.h \
682 sys/un.h \
683 time.h \
684 tmpdir.h \
685 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000686 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000687 usersec.h \
688 util.h \
689 utime.h \
690 utmp.h \
691 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000692 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000693)
Tim Rice4cec93f2002-02-26 08:40:48 -0800694
Darren Tucker48d99d32004-08-29 17:04:50 +1000695# sys/ptms.h requires sys/stream.h to be included first on Solaris
696AC_CHECK_HEADERS(sys/ptms.h, [], [], [
697#ifdef HAVE_SYS_STREAM_H
698# include <sys/stream.h>
699#endif
700])
701
Damien Millera22ba012000-03-02 23:09:20 +1100702# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700703AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
704AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000705
Tim Rice1e1ef642003-09-11 22:19:31 -0700706dnl IRIX and Solaris 2.5.1 have dirname() in libgen
707AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
708 AC_CHECK_LIB(gen, dirname,[
709 AC_CACHE_CHECK([for broken dirname],
710 ac_cv_have_broken_dirname, [
711 save_LIBS="$LIBS"
712 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000713 AC_RUN_IFELSE(
714 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700715#include <libgen.h>
716#include <string.h>
717
718int main(int argc, char **argv) {
719 char *s, buf[32];
720
721 strncpy(buf,"/etc", 32);
722 s = dirname(buf);
723 if (!s || strncmp(s, "/", 32) != 0) {
724 exit(1);
725 } else {
726 exit(0);
727 }
728}
Darren Tucker314d89e2005-10-17 23:29:23 +1000729 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700730 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000731 [ ac_cv_have_broken_dirname="yes" ],
732 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700733 )
734 LIBS="$save_LIBS"
735 ])
736 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
737 LIBS="$LIBS -lgen"
738 AC_DEFINE(HAVE_DIRNAME)
739 AC_CHECK_HEADERS(libgen.h)
740 fi
741 ])
742])
743
744AC_CHECK_FUNC(getspnam, ,
745 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700746AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
747 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700748
Tim Rice13aae5e2001-10-21 17:53:58 -0700749dnl zlib is required
750AC_ARG_WITH(zlib,
751 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100752 [ if test "x$withval" = "xno" ; then
753 AC_MSG_ERROR([*** zlib is required ***])
754 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700755 if test -d "$withval/lib"; then
756 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700757 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700758 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700759 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700760 fi
761 else
762 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700763 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700764 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700765 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700766 fi
767 fi
768 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700769 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700770 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700771 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700772 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100773 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700774)
775
Tim Ricefcb62202004-01-23 18:35:16 -0800776AC_CHECK_LIB(z, deflate, ,
777 [
778 saved_CPPFLAGS="$CPPFLAGS"
779 saved_LDFLAGS="$LDFLAGS"
780 save_LIBS="$LIBS"
781 dnl Check default zlib install dir
782 if test -n "${need_dash_r}"; then
783 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
784 else
785 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
786 fi
787 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
788 LIBS="$LIBS -lz"
789 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
790 [
791 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
792 ]
793 )
794 ]
795)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100796AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100797
798AC_ARG_WITH(zlib-version-check,
799 [ --without-zlib-version-check Disable zlib version check],
800 [ if test "x$withval" = "xno" ; then
801 zlib_check_nonfatal=1
802 fi
803 ]
804)
805
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000806AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000807AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000808#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100809#include <zlib.h>
810int main()
811{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000812 int a=0, b=0, c=0, d=0, n, v;
813 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
814 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100815 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000816 v = a*1000000 + b*10000 + c*100 + d;
817 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
818
819 /* 1.1.4 is OK */
820 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100821 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000822
Darren Tucker41097ed2005-07-25 15:24:21 +1000823 /* 1.2.3 and up are OK */
824 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000825 exit(0);
826
Darren Tucker2dcd2392004-01-23 17:13:33 +1100827 exit(2);
828}
Darren Tucker623d92f2004-09-12 22:36:15 +1000829 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000830 AC_MSG_RESULT(no),
831 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100832 if test -z "$zlib_check_nonfatal" ; then
833 AC_MSG_ERROR([*** zlib too old - check config.log ***
834Your reported zlib version has known security problems. It's possible your
835vendor has fixed these problems without changing the version number. If you
836are sure this is the case, you can disable the check by running
837"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000838If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000839See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100840 else
841 AC_MSG_WARN([zlib version may have security problems])
842 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000843 ],
844 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100845)
Damien Miller6f9c3372000-10-25 10:06:04 +1100846
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000847dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100848AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000849 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
850)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100851AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700852 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
853 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000854)
Damien Millerab18c411999-11-11 10:40:23 +1100855
Tim Ricee589a292001-11-03 11:09:32 -0800856dnl Checks for libutil functions
857AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700858AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
859 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800860AC_CHECK_FUNCS(logout updwtmp logwtmp)
861
Ben Lindstrom8697e082001-02-24 21:41:10 +0000862AC_FUNC_STRFTIME
863
Damien Miller3c027682001-03-14 11:39:45 +1100864# Check for ALTDIRFUNC glob() extension
865AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
866AC_EGREP_CPP(FOUNDIT,
867 [
868 #include <glob.h>
869 #ifdef GLOB_ALTDIRFUNC
870 FOUNDIT
871 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100872 ],
Damien Miller3c027682001-03-14 11:39:45 +1100873 [
Tim Rice7df8d392005-09-19 09:33:39 -0700874 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
875 [Define if your system glob() function has
876 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100877 AC_MSG_RESULT(yes)
878 ],
879 [
880 AC_MSG_RESULT(no)
881 ]
882)
Damien Millerab18c411999-11-11 10:40:23 +1100883
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000884# Check for g.gl_matchc glob() extension
885AC_MSG_CHECKING(for gl_matchc field in glob_t)
886AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100887 [
888 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000889 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100890 ],
891 [
Tim Rice7df8d392005-09-19 09:33:39 -0700892 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
893 [Define if your system glob() function has
894 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100895 AC_MSG_RESULT(yes)
896 ],
897 [
898 AC_MSG_RESULT(no)
899 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000900)
901
Damien Miller18bb4732001-03-28 14:35:30 +1000902AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000903AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000904 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000905#include <sys/types.h>
906#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700907int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000908 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100909 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000910 [
911 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700912 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
913 [Define in your struct dirent expects you to
914 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000915 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800916 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000917 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
918 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000919 ]
920)
921
Damien Miller36f49652004-08-15 18:40:59 +1000922AC_MSG_CHECKING([for /proc/pid/fd directory])
923if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700924 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000925 AC_MSG_RESULT(yes)
926else
927 AC_MSG_RESULT(no)
928fi
929
Damien Millerc547bf12001-02-16 10:18:12 +1100930# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100931SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100932AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100933 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100934 [
935 if test "x$withval" != "xno" ; then
936
937 if test "x$withval" != "xyes" ; then
938 CPPFLAGS="$CPPFLAGS -I${withval}/include"
939 LDFLAGS="$LDFLAGS -L${withval}/lib"
940 fi
941
Tim Rice7df8d392005-09-19 09:33:39 -0700942 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100943 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100944 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800945
Tim Rice4cec93f2002-02-26 08:40:48 -0800946 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000947 AC_LINK_IFELSE(
948 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800949#include <stdio.h>
950#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700951int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000952 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800953 [AC_MSG_RESULT(yes)],
954 [
955 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100956 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
957 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000958 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
959 AC_TRY_COMPILE(
960 [#include <stdio.h>
961 #include <skey.h>],
962 [(void)skeychallenge(NULL,"name","",0);],
963 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700964 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
965 [Define if your skeychallenge()
966 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000967 [AC_MSG_RESULT(no)]
968 )
Damien Millerc547bf12001-02-16 10:18:12 +1100969 fi
970 ]
971)
972
973# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700974TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100975AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100976 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100977 [
978 if test "x$withval" != "xno" ; then
979 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700980 saved_LDFLAGS="$LDFLAGS"
981 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800982 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800983 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700984 if test -d "${withval}/lib"; then
985 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700986 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700987 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700988 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700989 fi
990 else
991 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700992 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700993 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700994 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700995 fi
996 fi
997 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700998 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700999 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001000 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001001 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001002 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001003 LIBWRAP="-lwrap"
1004 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001005 AC_MSG_CHECKING(for libwrap)
1006 AC_TRY_LINK(
1007 [
Damien Miller0ac45002004-04-14 20:14:26 +10001008#include <sys/types.h>
1009#include <sys/socket.h>
1010#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001011#include <tcpd.h>
1012 int deny_severity = 0, allow_severity = 0;
1013 ],
1014 [hosts_access(0);],
1015 [
1016 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001017 AC_DEFINE(LIBWRAP, 1,
1018 [Define if you want
1019 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001020 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001021 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001022 ],
1023 [
1024 AC_MSG_ERROR([*** libwrap missing])
1025 ]
1026 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001027 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001028 fi
1029 ]
1030)
1031
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001032# Check whether user wants libedit support
1033LIBEDIT_MSG="no"
1034AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001035 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001036 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001037 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001038 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1039 if test -n "${need_dash_r}"; then
1040 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1041 else
1042 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1043 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001044 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001045 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001046 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001047 LIBEDIT="-ledit -lcurses"
1048 LIBEDIT_MSG="yes"
1049 AC_SUBST(LIBEDIT)
1050 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001051 [ AC_MSG_ERROR(libedit not found) ],
1052 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001053 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001054 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001055 AC_COMPILE_IFELSE(
1056 [AC_LANG_SOURCE([[
1057#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001058int main(void)
1059{
1060 int i = H_SETSIZE;
1061 el_init("", NULL, NULL, NULL);
1062 exit(0);
1063}
Tim Ricec1819c82005-08-15 17:48:40 -07001064 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001065 [ AC_MSG_RESULT(yes) ],
1066 [ AC_MSG_RESULT(no)
1067 AC_MSG_ERROR(libedit version is not compatible) ]
1068 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001069 fi ]
1070)
1071
Darren Tuckerd9f88912005-02-20 21:01:48 +11001072AUDIT_MODULE=none
1073AC_ARG_WITH(audit,
1074 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1075 [
1076 AC_MSG_CHECKING(for supported audit module)
1077 case "$withval" in
1078 bsm)
1079 AC_MSG_RESULT(bsm)
1080 AUDIT_MODULE=bsm
1081 dnl Checks for headers, libs and functions
1082 AC_CHECK_HEADERS(bsm/audit.h, [],
1083 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1084 AC_CHECK_LIB(bsm, getaudit, [],
1085 [AC_MSG_ERROR(BSM enabled and required library not found)])
1086 AC_CHECK_FUNCS(getaudit, [],
1087 [AC_MSG_ERROR(BSM enabled and required function not found)])
1088 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001089 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001090 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001091 ;;
1092 debug)
1093 AUDIT_MODULE=debug
1094 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001095 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001096 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001097 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001098 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001099 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001100 *)
1101 AC_MSG_ERROR([Unknown audit module $withval])
1102 ;;
1103 esac ]
1104)
1105
Damien Millerfe1f1432003-02-24 15:45:42 +11001106dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001107AC_CHECK_FUNCS( \
1108 arc4random \
1109 b64_ntop \
1110 __b64_ntop \
1111 b64_pton \
1112 __b64_pton \
1113 bcopy \
1114 bindresvport_sa \
1115 clock \
1116 closefrom \
1117 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001118 fchmod \
1119 fchown \
1120 freeaddrinfo \
1121 futimes \
1122 getaddrinfo \
1123 getcwd \
1124 getgrouplist \
1125 getnameinfo \
1126 getopt \
1127 getpeereid \
1128 _getpty \
1129 getrlimit \
1130 getttyent \
1131 glob \
1132 inet_aton \
1133 inet_ntoa \
1134 inet_ntop \
1135 innetgr \
1136 login_getcapbool \
1137 md5_crypt \
1138 memmove \
1139 mkdtemp \
1140 mmap \
1141 ngetaddrinfo \
1142 nsleep \
1143 ogetaddrinfo \
1144 openlog_r \
1145 openpty \
1146 prctl \
1147 pstat \
1148 readpassphrase \
1149 realpath \
1150 recvmsg \
1151 rresvport_af \
1152 sendmsg \
1153 setdtablesize \
1154 setegid \
1155 setenv \
1156 seteuid \
1157 setgroups \
1158 setlogin \
1159 setpcred \
1160 setproctitle \
1161 setregid \
1162 setreuid \
1163 setrlimit \
1164 setsid \
1165 setvbuf \
1166 sigaction \
1167 sigvec \
1168 snprintf \
1169 socketpair \
1170 strdup \
1171 strerror \
1172 strlcat \
1173 strlcpy \
1174 strmode \
1175 strnvis \
1176 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001177 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001178 strtoul \
1179 sysconf \
1180 tcgetpgrp \
1181 truncate \
1182 unsetenv \
1183 updwtmpx \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001184 vhangup \
1185 vsnprintf \
1186 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001187)
Tim Rice13aae5e2001-10-21 17:53:58 -07001188
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001189# IRIX has a const char return value for gai_strerror()
1190AC_CHECK_FUNCS(gai_strerror,[
1191 AC_DEFINE(HAVE_GAI_STRERROR)
1192 AC_TRY_COMPILE([
1193#include <sys/types.h>
1194#include <sys/socket.h>
1195#include <netdb.h>
1196
1197const char *gai_strerror(int);],[
1198char *str;
1199
1200str = gai_strerror(0);],[
1201 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1202 [Define if gai_strerror() returns const char *])])])
1203
Tim Rice7df8d392005-09-19 09:33:39 -07001204AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1205 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001206
Darren Tuckerf1159b52003-07-07 19:44:01 +10001207dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001208AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001209AC_CHECK_DECL(strsep,
1210 [AC_CHECK_FUNCS(strsep)],
1211 [],
1212 [
1213#ifdef HAVE_STRING_H
1214# include <string.h>
1215#endif
1216 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001217
Darren Tuckerb2427c82003-09-10 15:22:44 +10001218dnl tcsendbreak might be a macro
1219AC_CHECK_DECL(tcsendbreak,
1220 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001221 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001222 [#include <termios.h>]
1223)
1224
Darren Tucker5bb14002004-04-23 18:53:10 +10001225AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1226
Darren Tucker2a6b0292003-12-31 14:59:17 +11001227AC_CHECK_FUNCS(setresuid, [
1228 dnl Some platorms have setresuid that isn't implemented, test for this
1229 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001230 AC_RUN_IFELSE(
1231 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001232#include <stdlib.h>
1233#include <errno.h>
1234int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001235 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001236 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001237 [AC_DEFINE(BROKEN_SETRESUID, 1,
1238 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001239 AC_MSG_RESULT(not implemented)],
1240 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001241 )
1242])
Darren Tuckere937be32003-12-17 18:53:26 +11001243
Darren Tucker2a6b0292003-12-31 14:59:17 +11001244AC_CHECK_FUNCS(setresgid, [
1245 dnl Some platorms have setresgid that isn't implemented, test for this
1246 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001247 AC_RUN_IFELSE(
1248 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001249#include <stdlib.h>
1250#include <errno.h>
1251int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001252 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001253 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001254 [AC_DEFINE(BROKEN_SETRESGID, 1,
1255 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001256 AC_MSG_RESULT(not implemented)],
1257 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001258 )
1259])
Darren Tuckere937be32003-12-17 18:53:26 +11001260
Damien Millerad833b32000-08-23 10:46:23 +10001261dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001262AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001263dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001264AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001265AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001266dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001267AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001268AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001269
Damien Millera8e06ce2003-11-21 23:48:55 +11001270AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001271 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1272 [AC_CHECK_LIB(bsd, daemon,
1273 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001274)
1275
Damien Millera8e06ce2003-11-21 23:48:55 +11001276AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001277 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1278 [Define if your libraries define getpagesize()])],
1279 [AC_CHECK_LIB(ucb, getpagesize,
1280 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001281)
1282
Damien Millercb170cb2000-07-01 16:52:55 +10001283# Check for broken snprintf
1284if test "x$ac_cv_func_snprintf" = "xyes" ; then
1285 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001286 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001287 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001288#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001289int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001290 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001291 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001292 [
1293 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001294 AC_DEFINE(BROKEN_SNPRINTF, 1,
1295 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001296 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001297 ],
1298 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001299 )
1300fi
1301
Damien Millerb4097182004-05-23 14:09:40 +10001302# Check for missing getpeereid (or equiv) support
1303NO_PEERCHECK=""
1304if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1305 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1306 AC_TRY_COMPILE(
1307 [#include <sys/types.h>
1308 #include <sys/socket.h>],
1309 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001310 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001311 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001312 ],
Damien Millerb4097182004-05-23 14:09:40 +10001313 [AC_MSG_RESULT(no)
1314 NO_PEERCHECK=1]
1315 )
1316fi
1317
Damien Millere8328192003-01-07 15:18:32 +11001318dnl see whether mkstemp() requires XXXXXX
1319if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1320AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001321AC_RUN_IFELSE(
1322 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001323#include <stdlib.h>
1324main() { char template[]="conftest.mkstemp-test";
1325if (mkstemp(template) == -1)
1326 exit(1);
1327unlink(template); exit(0);
1328}
Darren Tucker314d89e2005-10-17 23:29:23 +10001329 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001330 [
1331 AC_MSG_RESULT(no)
1332 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001333 [
Damien Millere8328192003-01-07 15:18:32 +11001334 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001335 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001336 ],
1337 [
1338 AC_MSG_RESULT(yes)
1339 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001340 ]
Damien Millere8328192003-01-07 15:18:32 +11001341)
1342fi
1343
Darren Tucker70a3d552003-08-21 17:58:29 +10001344dnl make sure that openpty does not reacquire controlling terminal
1345if test ! -z "$check_for_openpty_ctty_bug"; then
1346 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001347 AC_RUN_IFELSE(
1348 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001349#include <stdio.h>
1350#include <sys/fcntl.h>
1351#include <sys/types.h>
1352#include <sys/wait.h>
1353
1354int
1355main()
1356{
1357 pid_t pid;
1358 int fd, ptyfd, ttyfd, status;
1359
1360 pid = fork();
1361 if (pid < 0) { /* failed */
1362 exit(1);
1363 } else if (pid > 0) { /* parent */
1364 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001365 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001366 exit(WEXITSTATUS(status));
1367 else
1368 exit(2);
1369 } else { /* child */
1370 close(0); close(1); close(2);
1371 setsid();
1372 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1373 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1374 if (fd >= 0)
1375 exit(3); /* Acquired ctty: broken */
1376 else
1377 exit(0); /* Did not acquire ctty: OK */
1378 }
1379}
Darren Tucker314d89e2005-10-17 23:29:23 +10001380 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001381 [
1382 AC_MSG_RESULT(yes)
1383 ],
1384 [
1385 AC_MSG_RESULT(no)
1386 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001387 ],
1388 [
1389 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001390 ]
1391 )
1392fi
1393
Tim Rice8bb561b2005-03-17 16:23:19 -08001394if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1395 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001396 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001397 AC_RUN_IFELSE(
1398 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001399#include <stdio.h>
1400#include <sys/socket.h>
1401#include <netdb.h>
1402#include <errno.h>
1403#include <netinet/in.h>
1404
1405#define TEST_PORT "2222"
1406
1407int
1408main(void)
1409{
1410 int err, sock;
1411 struct addrinfo *gai_ai, *ai, hints;
1412 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1413
1414 memset(&hints, 0, sizeof(hints));
1415 hints.ai_family = PF_UNSPEC;
1416 hints.ai_socktype = SOCK_STREAM;
1417 hints.ai_flags = AI_PASSIVE;
1418
1419 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1420 if (err != 0) {
1421 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1422 exit(1);
1423 }
1424
1425 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1426 if (ai->ai_family != AF_INET6)
1427 continue;
1428
1429 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1430 sizeof(ntop), strport, sizeof(strport),
1431 NI_NUMERICHOST|NI_NUMERICSERV);
1432
1433 if (err != 0) {
1434 if (err == EAI_SYSTEM)
1435 perror("getnameinfo EAI_SYSTEM");
1436 else
1437 fprintf(stderr, "getnameinfo failed: %s\n",
1438 gai_strerror(err));
1439 exit(2);
1440 }
1441
1442 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1443 if (sock < 0)
1444 perror("socket");
1445 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1446 if (errno == EBADF)
1447 exit(3);
1448 }
1449 }
1450 exit(0);
1451}
Darren Tucker314d89e2005-10-17 23:29:23 +10001452 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001453 [
1454 AC_MSG_RESULT(yes)
1455 ],
1456 [
1457 AC_MSG_RESULT(no)
1458 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001459 ],
1460 [
1461 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001462 ]
1463 )
1464fi
1465
Tim Rice8bb561b2005-03-17 16:23:19 -08001466if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1467 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001468 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001469 AC_RUN_IFELSE(
1470 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001471#include <stdio.h>
1472#include <sys/socket.h>
1473#include <netdb.h>
1474#include <errno.h>
1475#include <netinet/in.h>
1476
1477#define TEST_PORT "2222"
1478
1479int
1480main(void)
1481{
1482 int err, sock;
1483 struct addrinfo *gai_ai, *ai, hints;
1484 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1485
1486 memset(&hints, 0, sizeof(hints));
1487 hints.ai_family = PF_UNSPEC;
1488 hints.ai_socktype = SOCK_STREAM;
1489 hints.ai_flags = AI_PASSIVE;
1490
1491 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1492 if (err != 0) {
1493 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1494 exit(1);
1495 }
1496
1497 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1498 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1499 continue;
1500
1501 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1502 sizeof(ntop), strport, sizeof(strport),
1503 NI_NUMERICHOST|NI_NUMERICSERV);
1504
1505 if (ai->ai_family == AF_INET && err != 0) {
1506 perror("getnameinfo");
1507 exit(2);
1508 }
1509 }
1510 exit(0);
1511}
Darren Tucker314d89e2005-10-17 23:29:23 +10001512 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001513 [
1514 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001515 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1516 [Define if you have a getaddrinfo that fails
1517 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001518 ],
1519 [
1520 AC_MSG_RESULT(no)
1521 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001522 ],
1523 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001524 ]
1525 )
1526fi
1527
Darren Tuckera56f1912004-11-02 20:30:54 +11001528if test "x$check_for_conflicting_getspnam" = "x1"; then
1529 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1530 AC_COMPILE_IFELSE(
1531 [
1532#include <shadow.h>
1533int main(void) {exit(0);}
1534 ],
1535 [
1536 AC_MSG_RESULT(no)
1537 ],
1538 [
1539 AC_MSG_RESULT(yes)
1540 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1541 [Conflicting defs for getspnam])
1542 ]
1543 )
1544fi
1545
Damien Miller606f8802000-09-16 15:39:56 +11001546AC_FUNC_GETPGRP
1547
Damien Millera64b57a2001-01-17 10:44:13 +11001548# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001549PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001550AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001551 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001552 [
Damien Millera64b57a2001-01-17 10:44:13 +11001553 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001554 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1555 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001556 AC_MSG_ERROR([PAM headers not found])
1557 fi
1558
1559 AC_CHECK_LIB(dl, dlopen, , )
1560 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1561 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001562 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001563
Damien Millera64b57a2001-01-17 10:44:13 +11001564 PAM_MSG="yes"
1565
Tim Rice7df8d392005-09-19 09:33:39 -07001566 AC_DEFINE(USE_PAM, 1,
1567 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001568 if test $ac_cv_lib_dl_dlopen = yes; then
1569 LIBPAM="-lpam -ldl"
1570 else
1571 LIBPAM="-lpam"
1572 fi
1573 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001574 fi
1575 ]
1576)
Damien Millera22ba012000-03-02 23:09:20 +11001577
Damien Millera64b57a2001-01-17 10:44:13 +11001578# Check for older PAM
1579if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001580 # Check PAM strerror arguments (old PAM)
1581 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1582 AC_TRY_COMPILE(
1583 [
Damien Miller81171112000-04-23 11:14:01 +10001584#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001585#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001586#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001587#elif defined (HAVE_PAM_PAM_APPL_H)
1588#include <pam/pam_appl.h>
1589#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001590 ],
1591 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001592 [AC_MSG_RESULT(no)],
1593 [
Tim Rice7df8d392005-09-19 09:33:39 -07001594 AC_DEFINE(HAVE_OLD_PAM, 1,
1595 [Define if you have an old version of PAM
1596 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001597 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001598 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001599 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001600 )
Damien Millera22ba012000-03-02 23:09:20 +11001601fi
1602
Tim Riceaef73712002-05-11 13:17:42 -07001603# Search for OpenSSL
1604saved_CPPFLAGS="$CPPFLAGS"
1605saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001606AC_ARG_WITH(ssl-dir,
1607 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1608 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001609 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001610 case "$withval" in
1611 # Relative paths
1612 ./*|../*) withval="`pwd`/$withval"
1613 esac
Tim Riceaef73712002-05-11 13:17:42 -07001614 if test -d "$withval/lib"; then
1615 if test -n "${need_dash_r}"; then
1616 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1617 else
1618 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1619 fi
1620 else
1621 if test -n "${need_dash_r}"; then
1622 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1623 else
1624 LDFLAGS="-L${withval} ${LDFLAGS}"
1625 fi
1626 fi
1627 if test -d "$withval/include"; then
1628 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1629 else
1630 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1631 fi
Damien Millera22ba012000-03-02 23:09:20 +11001632 fi
1633 ]
1634)
Tim Rice3d5352e2004-02-12 09:27:21 -08001635LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001636AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1637 [Define if your ssl headers are included
1638 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001639 [
Tim Riceaef73712002-05-11 13:17:42 -07001640 dnl Check default openssl install dir
1641 if test -n "${need_dash_r}"; then
1642 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001643 else
Tim Riceaef73712002-05-11 13:17:42 -07001644 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001645 fi
Tim Riceaef73712002-05-11 13:17:42 -07001646 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1647 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1648 [
1649 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1650 ]
1651 )
1652 ]
1653)
1654
Tim Riced730b782002-08-13 18:52:10 -07001655# Determine OpenSSL header version
1656AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001657AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001658 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001659#include <stdio.h>
1660#include <string.h>
1661#include <openssl/opensslv.h>
1662#define DATA "conftest.sslincver"
1663int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001664 FILE *fd;
1665 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001666
Damien Millera8e06ce2003-11-21 23:48:55 +11001667 fd = fopen(DATA,"w");
1668 if(fd == NULL)
1669 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001670
1671 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1672 exit(1);
1673
1674 exit(0);
1675}
Darren Tucker623d92f2004-09-12 22:36:15 +10001676 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001677 [
1678 ssl_header_ver=`cat conftest.sslincver`
1679 AC_MSG_RESULT($ssl_header_ver)
1680 ],
1681 [
1682 AC_MSG_RESULT(not found)
1683 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001684 ],
1685 [
1686 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001687 ]
1688)
1689
1690# Determine OpenSSL library version
1691AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001692AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001693 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001694#include <stdio.h>
1695#include <string.h>
1696#include <openssl/opensslv.h>
1697#include <openssl/crypto.h>
1698#define DATA "conftest.ssllibver"
1699int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001700 FILE *fd;
1701 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001702
Damien Millera8e06ce2003-11-21 23:48:55 +11001703 fd = fopen(DATA,"w");
1704 if(fd == NULL)
1705 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001706
1707 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1708 exit(1);
1709
1710 exit(0);
1711}
Darren Tucker623d92f2004-09-12 22:36:15 +10001712 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001713 [
1714 ssl_library_ver=`cat conftest.ssllibver`
1715 AC_MSG_RESULT($ssl_library_ver)
1716 ],
1717 [
1718 AC_MSG_RESULT(not found)
1719 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001720 ],
1721 [
1722 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001723 ]
1724)
Damien Millera22ba012000-03-02 23:09:20 +11001725
Damien Millerec932372002-01-22 22:16:03 +11001726# Sanity check OpenSSL headers
1727AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001728AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001729 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001730#include <string.h>
1731#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001732int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001733 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001734 [
1735 AC_MSG_RESULT(yes)
1736 ],
1737 [
1738 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001739 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1740Check config.log for details.
1741Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001742 ],
1743 [
1744 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001745 ]
1746)
1747
Tim Rice3d5352e2004-02-12 09:27:21 -08001748# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1749# because the system crypt() is more featureful.
1750if test "x$check_for_libcrypt_before" = "x1"; then
1751 AC_CHECK_LIB(crypt, crypt)
1752fi
1753
Damien Millera8e06ce2003-11-21 23:48:55 +11001754# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001755# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001756if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001757 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001758fi
1759
Tim Rice2291c002005-08-26 13:15:19 -07001760AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001761
1762### Configure cryptographic random number support
1763
1764# Check wheter OpenSSL seeds itself
1765AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001766AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001767 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001768#include <string.h>
1769#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001770int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001771 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001772 [
1773 OPENSSL_SEEDS_ITSELF=yes
1774 AC_MSG_RESULT(yes)
1775 ],
1776 [
1777 AC_MSG_RESULT(no)
1778 # Default to use of the rand helper if OpenSSL doesn't
1779 # seed itself
1780 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001781 ],
1782 [
1783 AC_MSG_WARN([cross compiling: assuming yes])
1784 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001785 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001786 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001787 ]
1788)
1789
1790
1791# Do we want to force the use of the rand helper?
1792AC_ARG_WITH(rand-helper,
1793 [ --with-rand-helper Use subprocess to gather strong randomness ],
1794 [
1795 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001796 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001797 # the previous test showed it to be unseeded.
1798 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1799 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1800 OPENSSL_SEEDS_ITSELF=yes
1801 USE_RAND_HELPER=""
1802 fi
1803 else
1804 USE_RAND_HELPER=yes
1805 fi
1806 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001807)
Damien Miller6c21c512002-01-22 21:57:53 +11001808
1809# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001810if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001811 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001812 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1813 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001814 RAND_MSG="OpenSSL internal ONLY"
1815 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001816elif test ! -z "$USE_RAND_HELPER" ; then
1817 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001818 RAND_MSG="ssh-rand-helper"
1819 INSTALL_SSH_RAND_HELPER="yes"
1820fi
1821AC_SUBST(INSTALL_SSH_RAND_HELPER)
1822
1823### Configuration of ssh-rand-helper
1824
1825# PRNGD TCP socket
1826AC_ARG_WITH(prngd-port,
1827 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1828 [
Damien Millere996d722002-01-23 11:20:59 +11001829 case "$withval" in
1830 no)
1831 withval=""
1832 ;;
1833 [[0-9]]*)
1834 ;;
1835 *)
1836 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1837 ;;
1838 esac
1839 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001840 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001841 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1842 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001843 fi
1844 ]
1845)
1846
1847# PRNGD Unix domain socket
1848AC_ARG_WITH(prngd-socket,
1849 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1850 [
Damien Millere996d722002-01-23 11:20:59 +11001851 case "$withval" in
1852 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001853 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001854 ;;
1855 no)
1856 withval=""
1857 ;;
1858 /*)
1859 ;;
1860 *)
1861 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1862 ;;
1863 esac
1864
1865 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001866 if test ! -z "$PRNGD_PORT" ; then
1867 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1868 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001869 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001870 AC_MSG_WARN(Entropy socket is not readable)
1871 fi
1872 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001873 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1874 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001875 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001876 ],
1877 [
1878 # Check for existing socket only if we don't have a random device already
1879 if test "$USE_RAND_HELPER" = yes ; then
1880 AC_MSG_CHECKING(for PRNGD/EGD socket)
1881 # Insert other locations here
1882 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1883 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1884 PRNGD_SOCKET="$sock"
1885 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1886 break;
1887 fi
1888 done
1889 if test ! -z "$PRNGD_SOCKET" ; then
1890 AC_MSG_RESULT($PRNGD_SOCKET)
1891 else
1892 AC_MSG_RESULT(not found)
1893 fi
1894 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001895 ]
1896)
1897
1898# Change default command timeout for hashing entropy source
1899entropy_timeout=200
1900AC_ARG_WITH(entropy-timeout,
1901 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1902 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001903 if test -n "$withval" && test "x$withval" != "xno" && \
1904 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001905 entropy_timeout=$withval
1906 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001907 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001908)
Tim Rice7df8d392005-09-19 09:33:39 -07001909AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1910 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001911
Damien Millerd3f6ad22002-06-25 10:24:47 +10001912SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001913AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001914 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001915 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001916 if test -n "$withval" && test "x$withval" != "xno" && \
1917 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001918 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001919 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001920 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001921)
Tim Rice7df8d392005-09-19 09:33:39 -07001922AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1923 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001924AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001925
Tim Rice88f2ab52002-03-17 12:17:34 -08001926# We do this little dance with the search path to insure
1927# that programs that we select for use by installed programs
1928# (which may be run by the super-user) come from trusted
1929# locations before they come from the user's private area.
1930# This should help avoid accidentally configuring some
1931# random version of a program in someone's personal bin.
1932
1933OPATH=$PATH
1934PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001935test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001936test -d /sbin && PATH=$PATH:/sbin
1937test -d /usr/sbin && PATH=$PATH:/usr/sbin
1938PATH=$PATH:/etc:$OPATH
1939
Damien Millera8e06ce2003-11-21 23:48:55 +11001940# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001941OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1942OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1943OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1944OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1945OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1946OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1947OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1948OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1949OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1950OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1951OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1952OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1953OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1954OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1955OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1956OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001957# restore PATH
1958PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001959
1960# Where does ssh-rand-helper get its randomness from?
1961INSTALL_SSH_PRNG_CMDS=""
1962if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1963 if test ! -z "$PRNGD_PORT" ; then
1964 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1965 elif test ! -z "$PRNGD_SOCKET" ; then
1966 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1967 else
1968 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1969 RAND_HELPER_CMDHASH=yes
1970 INSTALL_SSH_PRNG_CMDS="yes"
1971 fi
1972fi
1973AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1974
1975
Ben Lindstromb5628642000-10-18 00:02:25 +00001976# Cheap hack to ensure NEWS-OS libraries are arranged right.
1977if test ! -z "$SONY" ; then
1978 LIBS="$LIBS -liberty";
1979fi
1980
Damien Millera22ba012000-03-02 23:09:20 +11001981# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001982AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001983AC_CHECK_SIZEOF(short int, 2)
1984AC_CHECK_SIZEOF(int, 4)
1985AC_CHECK_SIZEOF(long int, 4)
1986AC_CHECK_SIZEOF(long long int, 8)
1987
Damien Millerfa2bb692002-04-23 23:22:25 +10001988# Sanity check long long for some platforms (AIX)
1989if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1990 ac_cv_sizeof_long_long_int=0
1991fi
1992
Darren Tucker537f1ed2005-10-25 18:38:33 +10001993# compute LLONG_MIN and LLONG_MAX if we don't know them.
1994if test -z "$have_llong_max"; then
1995 AC_MSG_CHECKING([for max value of long long])
1996 AC_RUN_IFELSE(
1997 [AC_LANG_SOURCE([[
1998#include <stdio.h>
1999/* Why is this so damn hard? */
2000#ifdef __GNUC__
2001# undef __GNUC__
2002#endif
2003#define __USE_ISOC99
2004#include <limits.h>
2005#define DATA "conftest.llminmax"
2006int main(void) {
2007 FILE *f;
2008 long long i, llmin, llmax = 0;
2009
2010 if((f = fopen(DATA,"w")) == NULL)
2011 exit(1);
2012
2013#if defined(LLONG_MIN) && defined(LLONG_MAX)
2014 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2015 llmin = LLONG_MIN;
2016 llmax = LLONG_MAX;
2017#else
2018 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2019 /* This will work on one's complement and two's complement */
2020 for (i = 1; i > llmax; i <<= 1, i++)
2021 llmax = i;
2022 llmin = llmax + 1LL; /* wrap */
2023#endif
2024
2025 /* Sanity check */
2026 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2027 || llmax - 1 > llmax) {
2028 fprintf(f, "unknown unknown\n");
2029 exit(2);
2030 }
2031
2032 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2033 exit(3);
2034
2035 exit(0);
2036}
2037 ]])],
2038 [
2039 llong_min=`$AWK '{print $1}' conftest.llminmax`
2040 llong_max=`$AWK '{print $2}' conftest.llminmax`
2041
2042 # snprintf on some Tru64s doesn't understand "%lld"
2043 case "$host" in
2044 alpha-dec-osf*)
2045 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2046 test "x$llong_max" = "xld"; then
2047 llong_min="-9223372036854775808"
2048 llong_max="9223372036854775807"
2049 fi
2050 ;;
2051 esac
2052
2053 AC_MSG_RESULT($llong_max)
2054 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2055 [max value of long long calculated by configure])
2056 AC_MSG_CHECKING([for min value of long long])
2057 AC_MSG_RESULT($llong_min)
2058 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2059 [min value of long long calculated by configure])
2060 ],
2061 [
2062 AC_MSG_RESULT(not found)
2063 ],
2064 [
2065 AC_MSG_WARN([cross compiling: not checking])
2066 ]
2067 )
2068fi
2069
2070
Damien Millera22ba012000-03-02 23:09:20 +11002071# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002072AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2073 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002074 [ #include <sys/types.h> ],
2075 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002076 [ ac_cv_have_u_int="yes" ],
2077 [ ac_cv_have_u_int="no" ]
2078 )
2079])
2080if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002081 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002082 have_u_int=1
2083fi
2084
Damien Miller61e50f12000-05-08 20:49:37 +10002085AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2086 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002087 [ #include <sys/types.h> ],
2088 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002089 [ ac_cv_have_intxx_t="yes" ],
2090 [ ac_cv_have_intxx_t="no" ]
2091 )
2092])
2093if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002094 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002095 have_intxx_t=1
2096fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002097
2098if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002099 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002100then
2101 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2102 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002103 [ #include <stdint.h> ],
2104 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002105 [
2106 AC_DEFINE(HAVE_INTXX_T)
2107 AC_MSG_RESULT(yes)
2108 ],
2109 [ AC_MSG_RESULT(no) ]
2110 )
2111fi
2112
Damien Miller578783e2000-09-23 14:12:24 +11002113AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2114 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002115 [
2116#include <sys/types.h>
2117#ifdef HAVE_STDINT_H
2118# include <stdint.h>
2119#endif
2120#include <sys/socket.h>
2121#ifdef HAVE_SYS_BITYPES_H
2122# include <sys/bitypes.h>
2123#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002124 ],
2125 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002126 [ ac_cv_have_int64_t="yes" ],
2127 [ ac_cv_have_int64_t="no" ]
2128 )
2129])
2130if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002131 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002132fi
2133
Damien Miller61e50f12000-05-08 20:49:37 +10002134AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2135 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002136 [ #include <sys/types.h> ],
2137 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002138 [ ac_cv_have_u_intxx_t="yes" ],
2139 [ ac_cv_have_u_intxx_t="no" ]
2140 )
2141])
2142if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002143 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002144 have_u_intxx_t=1
2145fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002146
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002147if test -z "$have_u_intxx_t" ; then
2148 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2149 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002150 [ #include <sys/socket.h> ],
2151 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002152 [
2153 AC_DEFINE(HAVE_U_INTXX_T)
2154 AC_MSG_RESULT(yes)
2155 ],
2156 [ AC_MSG_RESULT(no) ]
2157 )
2158fi
2159
Damien Miller578783e2000-09-23 14:12:24 +11002160AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2161 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002162 [ #include <sys/types.h> ],
2163 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002164 [ ac_cv_have_u_int64_t="yes" ],
2165 [ ac_cv_have_u_int64_t="no" ]
2166 )
2167])
2168if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002169 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002170 have_u_int64_t=1
2171fi
2172
Tim Rice4cec93f2002-02-26 08:40:48 -08002173if test -z "$have_u_int64_t" ; then
2174 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2175 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002177 [ u_int64_t a; a = 1],
2178 [
2179 AC_DEFINE(HAVE_U_INT64_T)
2180 AC_MSG_RESULT(yes)
2181 ],
2182 [ AC_MSG_RESULT(no) ]
2183 )
2184fi
2185
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002186if test -z "$have_u_intxx_t" ; then
2187 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2188 AC_TRY_COMPILE(
2189 [
2190#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002191 ],
2192 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002193 [ ac_cv_have_uintxx_t="yes" ],
2194 [ ac_cv_have_uintxx_t="no" ]
2195 )
2196 ])
2197 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002198 AC_DEFINE(HAVE_UINTXX_T, 1,
2199 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002200 fi
2201fi
2202
2203if test -z "$have_uintxx_t" ; then
2204 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2205 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002206 [ #include <stdint.h> ],
2207 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002208 [
2209 AC_DEFINE(HAVE_UINTXX_T)
2210 AC_MSG_RESULT(yes)
2211 ],
2212 [ AC_MSG_RESULT(no) ]
2213 )
2214fi
2215
Damien Milleredb82922000-06-20 13:25:52 +10002216if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002217 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002218then
2219 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2220 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002221 [
2222#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002223 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002224 [
Damien Miller70494d12000-04-03 15:57:06 +10002225 int8_t a; int16_t b; int32_t c;
2226 u_int8_t e; u_int16_t f; u_int32_t g;
2227 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002228 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002229 [
2230 AC_DEFINE(HAVE_U_INTXX_T)
2231 AC_DEFINE(HAVE_INTXX_T)
2232 AC_MSG_RESULT(yes)
2233 ],
2234 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002235 )
Damien Millerb29ea912000-01-15 14:12:03 +11002236fi
2237
Damien Miller58be7382001-09-15 21:31:54 +10002238
2239AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2240 AC_TRY_COMPILE(
2241 [
2242#include <sys/types.h>
2243 ],
2244 [ u_char foo; foo = 125; ],
2245 [ ac_cv_have_u_char="yes" ],
2246 [ ac_cv_have_u_char="no" ]
2247 )
2248])
2249if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002250 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002251fi
2252
Tim Rice13aae5e2001-10-21 17:53:58 -07002253TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002254
Tim Rice200a5c02002-02-26 22:12:34 -08002255AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002256
Damien Miller848b9932005-02-24 12:12:34 +11002257AC_CHECK_TYPES(in_addr_t,,,
2258[#include <sys/types.h>
2259#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002260
Damien Miller61e50f12000-05-08 20:49:37 +10002261AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2262 AC_TRY_COMPILE(
2263 [
2264#include <sys/types.h>
2265 ],
2266 [ size_t foo; foo = 1235; ],
2267 [ ac_cv_have_size_t="yes" ],
2268 [ ac_cv_have_size_t="no" ]
2269 )
2270])
2271if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002272 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002273fi
Damien Miller95058511999-12-29 10:36:45 +11002274
Damien Miller615f9392000-05-17 22:53:33 +10002275AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2276 AC_TRY_COMPILE(
2277 [
2278#include <sys/types.h>
2279 ],
2280 [ ssize_t foo; foo = 1235; ],
2281 [ ac_cv_have_ssize_t="yes" ],
2282 [ ac_cv_have_ssize_t="no" ]
2283 )
2284])
2285if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002286 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002287fi
2288
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002289AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2290 AC_TRY_COMPILE(
2291 [
2292#include <time.h>
2293 ],
2294 [ clock_t foo; foo = 1235; ],
2295 [ ac_cv_have_clock_t="yes" ],
2296 [ ac_cv_have_clock_t="no" ]
2297 )
2298])
2299if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002300 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002301fi
2302
Damien Millerb54b40e2000-06-23 08:23:34 +10002303AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2304 AC_TRY_COMPILE(
2305 [
2306#include <sys/types.h>
2307#include <sys/socket.h>
2308 ],
2309 [ sa_family_t foo; foo = 1235; ],
2310 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002311 [ AC_TRY_COMPILE(
2312 [
2313#include <sys/types.h>
2314#include <sys/socket.h>
2315#include <netinet/in.h>
2316 ],
2317 [ sa_family_t foo; foo = 1235; ],
2318 [ ac_cv_have_sa_family_t="yes" ],
2319
Damien Millerb54b40e2000-06-23 08:23:34 +10002320 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002321 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002322 )
2323])
2324if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002325 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2326 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002327fi
2328
Damien Miller0f91b4e2000-06-18 15:43:25 +10002329AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2330 AC_TRY_COMPILE(
2331 [
2332#include <sys/types.h>
2333 ],
2334 [ pid_t foo; foo = 1235; ],
2335 [ ac_cv_have_pid_t="yes" ],
2336 [ ac_cv_have_pid_t="no" ]
2337 )
2338])
2339if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002340 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002341fi
2342
2343AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2344 AC_TRY_COMPILE(
2345 [
2346#include <sys/types.h>
2347 ],
2348 [ mode_t foo; foo = 1235; ],
2349 [ ac_cv_have_mode_t="yes" ],
2350 [ ac_cv_have_mode_t="no" ]
2351 )
2352])
2353if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002354 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002355fi
2356
Damien Miller61e50f12000-05-08 20:49:37 +10002357
2358AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2359 AC_TRY_COMPILE(
2360 [
Damien Miller81171112000-04-23 11:14:01 +10002361#include <sys/types.h>
2362#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002363 ],
2364 [ struct sockaddr_storage s; ],
2365 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2366 [ ac_cv_have_struct_sockaddr_storage="no" ]
2367 )
2368])
2369if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002370 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2371 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002372fi
Damien Miller34132e52000-01-14 15:45:46 +11002373
Damien Miller61e50f12000-05-08 20:49:37 +10002374AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2375 AC_TRY_COMPILE(
2376 [
Damien Miller7b22d652000-06-18 14:07:04 +10002377#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002378#include <netinet/in.h>
2379 ],
2380 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2381 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2382 [ ac_cv_have_struct_sockaddr_in6="no" ]
2383 )
2384])
2385if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002386 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2387 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002388fi
Damien Miller34132e52000-01-14 15:45:46 +11002389
Damien Miller61e50f12000-05-08 20:49:37 +10002390AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2391 AC_TRY_COMPILE(
2392 [
Damien Miller7b22d652000-06-18 14:07:04 +10002393#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002394#include <netinet/in.h>
2395 ],
2396 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2397 [ ac_cv_have_struct_in6_addr="yes" ],
2398 [ ac_cv_have_struct_in6_addr="no" ]
2399 )
2400])
2401if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002402 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2403 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002404fi
Damien Miller34132e52000-01-14 15:45:46 +11002405
Damien Miller61e50f12000-05-08 20:49:37 +10002406AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2407 AC_TRY_COMPILE(
2408 [
Damien Miller81171112000-04-23 11:14:01 +10002409#include <sys/types.h>
2410#include <sys/socket.h>
2411#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002412 ],
2413 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2414 [ ac_cv_have_struct_addrinfo="yes" ],
2415 [ ac_cv_have_struct_addrinfo="no" ]
2416 )
2417])
2418if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002419 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2420 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002421fi
2422
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002423AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2424 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002425 [ #include <sys/time.h> ],
2426 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002427 [ ac_cv_have_struct_timeval="yes" ],
2428 [ ac_cv_have_struct_timeval="no" ]
2429 )
2430])
2431if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002432 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002433 have_struct_timeval=1
2434fi
2435
Tim Rice4e4dc562003-03-18 10:21:40 -08002436AC_CHECK_TYPES(struct timespec)
2437
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002438# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002439if test "x$ac_cv_have_int64_t" = "xno" && \
2440 test "x$ac_cv_sizeof_long_int" != "x8" && \
2441 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002442 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2443 echo "an alternative compiler (I.E., GCC) before continuing."
2444 echo ""
2445 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002446else
2447dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002448 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002449 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002450#include <stdio.h>
2451#include <string.h>
2452#ifdef HAVE_SNPRINTF
2453main()
2454{
2455 char buf[50];
2456 char expected_out[50];
2457 int mazsize = 50 ;
2458#if (SIZEOF_LONG_INT == 8)
2459 long int num = 0x7fffffffffffffff;
2460#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002461 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002462#endif
2463 strcpy(expected_out, "9223372036854775807");
2464 snprintf(buf, mazsize, "%lld", num);
2465 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002466 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002467 exit(0);
2468}
2469#else
2470main() { exit(0); }
2471#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002472 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002473 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002474 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002475fi
2476
Damien Miller78315eb2000-09-29 23:01:36 +11002477dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002478OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2479OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2480OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2481OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2482OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002483OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002484OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2485OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002486OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002487OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2488OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2489OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2490OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002491OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2492OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2493OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2494OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002495
2496AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002497
Damien Miller61e50f12000-05-08 20:49:37 +10002498AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2499 ac_cv_have_ss_family_in_struct_ss, [
2500 AC_TRY_COMPILE(
2501 [
Damien Miller81171112000-04-23 11:14:01 +10002502#include <sys/types.h>
2503#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002504 ],
2505 [ struct sockaddr_storage s; s.ss_family = 1; ],
2506 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2507 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2508 )
2509])
2510if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002511 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002512fi
2513
Damien Miller61e50f12000-05-08 20:49:37 +10002514AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2515 ac_cv_have___ss_family_in_struct_ss, [
2516 AC_TRY_COMPILE(
2517 [
Damien Miller81171112000-04-23 11:14:01 +10002518#include <sys/types.h>
2519#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002520 ],
2521 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2522 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2523 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2524 )
2525])
2526if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002527 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2528 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002529fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002530
Damien Millerad833b32000-08-23 10:46:23 +10002531AC_CACHE_CHECK([for pw_class field in struct passwd],
2532 ac_cv_have_pw_class_in_struct_passwd, [
2533 AC_TRY_COMPILE(
2534 [
Damien Millerad833b32000-08-23 10:46:23 +10002535#include <pwd.h>
2536 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002537 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002538 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2539 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2540 )
2541])
2542if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002543 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2544 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002545fi
2546
Kevin Steves82456952001-06-22 21:14:18 +00002547AC_CACHE_CHECK([for pw_expire field in struct passwd],
2548 ac_cv_have_pw_expire_in_struct_passwd, [
2549 AC_TRY_COMPILE(
2550 [
2551#include <pwd.h>
2552 ],
2553 [ struct passwd p; p.pw_expire = 0; ],
2554 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2555 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2556 )
2557])
2558if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002559 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2560 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002561fi
2562
2563AC_CACHE_CHECK([for pw_change field in struct passwd],
2564 ac_cv_have_pw_change_in_struct_passwd, [
2565 AC_TRY_COMPILE(
2566 [
2567#include <pwd.h>
2568 ],
2569 [ struct passwd p; p.pw_change = 0; ],
2570 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2571 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2572 )
2573])
2574if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002575 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2576 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002577fi
Damien Miller61e50f12000-05-08 20:49:37 +10002578
Tim Rice28bbb0c2002-05-27 17:37:32 -07002579dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002580AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2581 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002582 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002583 [
Tim Riceae49fe62002-04-12 10:26:21 -07002584#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002585#include <sys/socket.h>
2586#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002587int main() {
2588#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002589#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002590exit(1);
2591#endif
2592struct msghdr m;
2593m.msg_accrights = 0;
2594exit(0);
2595}
Kevin Steves939c9db2002-03-22 17:23:25 +00002596 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002597 [ ac_cv_have_accrights_in_msghdr="yes" ],
2598 [ ac_cv_have_accrights_in_msghdr="no" ]
2599 )
2600])
2601if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002602 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2603 [Define if your system uses access rights style
2604 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002605fi
2606
Kevin Stevesa44e0352002-04-07 16:18:03 +00002607AC_CACHE_CHECK([for msg_control field in struct msghdr],
2608 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002609 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002610 [
Tim Riceae49fe62002-04-12 10:26:21 -07002611#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002612#include <sys/socket.h>
2613#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002614int main() {
2615#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002616#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002617exit(1);
2618#endif
2619struct msghdr m;
2620m.msg_control = 0;
2621exit(0);
2622}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002623 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002624 [ ac_cv_have_control_in_msghdr="yes" ],
2625 [ ac_cv_have_control_in_msghdr="no" ]
2626 )
2627])
2628if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002629 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2630 [Define if your system uses ancillary data style
2631 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002632fi
2633
Damien Miller61e50f12000-05-08 20:49:37 +10002634AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002635 AC_TRY_LINK([],
2636 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002637 [ ac_cv_libc_defines___progname="yes" ],
2638 [ ac_cv_libc_defines___progname="no" ]
2639 )
2640])
2641if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002642 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002643fi
2644
Kevin Steves4846f4a2002-03-22 18:19:53 +00002645AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2646 AC_TRY_LINK([
2647#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002648],
2649 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002650 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2651 [ ac_cv_cc_implements___FUNCTION__="no" ]
2652 )
2653])
2654if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002655 AC_DEFINE(HAVE___FUNCTION__, 1,
2656 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002657fi
2658
2659AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2660 AC_TRY_LINK([
2661#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002662],
2663 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002664 [ ac_cv_cc_implements___func__="yes" ],
2665 [ ac_cv_cc_implements___func__="no" ]
2666 )
2667])
2668if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002669 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002670fi
2671
Damien Miller4f8e6692001-07-14 13:22:53 +10002672AC_CACHE_CHECK([whether getopt has optreset support],
2673 ac_cv_have_getopt_optreset, [
2674 AC_TRY_LINK(
2675 [
2676#include <getopt.h>
2677 ],
2678 [ extern int optreset; optreset = 0; ],
2679 [ ac_cv_have_getopt_optreset="yes" ],
2680 [ ac_cv_have_getopt_optreset="no" ]
2681 )
2682])
2683if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002684 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2685 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002686fi
Damien Millera22ba012000-03-02 23:09:20 +11002687
Damien Millerecbb26d2000-07-15 14:59:14 +10002688AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002689 AC_TRY_LINK([],
2690 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002691 [ ac_cv_libc_defines_sys_errlist="yes" ],
2692 [ ac_cv_libc_defines_sys_errlist="no" ]
2693 )
2694])
2695if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002696 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2697 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002698fi
2699
2700
Damien Miller11fa2cc2000-08-16 10:35:58 +10002701AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002702 AC_TRY_LINK([],
2703 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002704 [ ac_cv_libc_defines_sys_nerr="yes" ],
2705 [ ac_cv_libc_defines_sys_nerr="no" ]
2706 )
2707])
2708if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002709 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002710fi
2711
Damien Millera8e06ce2003-11-21 23:48:55 +11002712SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002713# Check whether user wants sectok support
2714AC_ARG_WITH(sectok,
2715 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002716 [
2717 if test "x$withval" != "xno" ; then
2718 if test "x$withval" != "xyes" ; then
2719 CPPFLAGS="$CPPFLAGS -I${withval}"
2720 LDFLAGS="$LDFLAGS -L${withval}"
2721 if test ! -z "$need_dash_r" ; then
2722 LDFLAGS="$LDFLAGS -R${withval}"
2723 fi
2724 if test ! -z "$blibpath" ; then
2725 blibpath="$blibpath:${withval}"
2726 fi
2727 fi
2728 AC_CHECK_HEADERS(sectok.h)
2729 if test "$ac_cv_header_sectok_h" != yes; then
2730 AC_MSG_ERROR(Can't find sectok.h)
2731 fi
2732 AC_CHECK_LIB(sectok, sectok_open)
2733 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2734 AC_MSG_ERROR(Can't find libsectok)
2735 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002736 AC_DEFINE(SMARTCARD, 1,
2737 [Define if you want smartcard support])
2738 AC_DEFINE(USE_SECTOK, 1,
2739 [Define if you want smartcard support
2740 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002741 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002742 fi
2743 ]
2744)
2745
2746# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002747OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002748AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002749 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002750 [
2751 if test "x$withval" != "xno" ; then
2752 if test "x$withval" != "xyes" ; then
2753 OPENSC_CONFIG=$withval/bin/opensc-config
2754 else
2755 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2756 fi
2757 if test "$OPENSC_CONFIG" != "no"; then
2758 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2759 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2760 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2761 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2762 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002763 AC_DEFINE(USE_OPENSC, 1,
2764 [Define if you want smartcard support
2765 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002766 SCARD_MSG="yes, using OpenSC"
2767 fi
2768 fi
2769 ]
2770)
Damien Miller85de5802001-09-18 14:01:11 +10002771
Darren Tucker5f88d342003-10-15 16:57:57 +10002772# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002773AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002774 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2775 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002776 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002777 # Needed by our getrrsetbyname()
2778 AC_SEARCH_LIBS(res_query, resolv)
2779 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002780 AC_MSG_CHECKING(if res_query will link)
2781 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2782 [AC_MSG_RESULT(no)
2783 saved_LIBS="$LIBS"
2784 LIBS="$LIBS -lresolv"
2785 AC_MSG_CHECKING(for res_query in -lresolv)
2786 AC_LINK_IFELSE([
2787#include <resolv.h>
2788int main()
2789{
2790 res_query (0, 0, 0, 0, 0);
2791 return 0;
2792}
2793 ],
2794 [LIBS="$LIBS -lresolv"
2795 AC_MSG_RESULT(yes)],
2796 [LIBS="$saved_LIBS"
2797 AC_MSG_RESULT(no)])
2798 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002799 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002800 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002801 [#include <sys/types.h>
2802 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002803 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002804 [AC_DEFINE(HAVE_HEADER_AD, 1,
2805 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002806 [#include <arpa/nameser.h>])
2807 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002808
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002809# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002810KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002811AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002812 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002813 [ if test "x$withval" != "xno" ; then
2814 if test "x$withval" = "xyes" ; then
2815 KRB5ROOT="/usr/local"
2816 else
2817 KRB5ROOT=${withval}
2818 fi
2819
Tim Rice7df8d392005-09-19 09:33:39 -07002820 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002821 KRB5_MSG="yes"
2822
2823 AC_MSG_CHECKING(for krb5-config)
2824 if test -x $KRB5ROOT/bin/krb5-config ; then
2825 KRB5CONF=$KRB5ROOT/bin/krb5-config
2826 AC_MSG_RESULT($KRB5CONF)
2827
2828 AC_MSG_CHECKING(for gssapi support)
2829 if $KRB5CONF | grep gssapi >/dev/null ; then
2830 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002831 AC_DEFINE(GSSAPI, 1,
2832 [Define this if you want GSSAPI
2833 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002834 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002835 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002836 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002837 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002838 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002839 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2840 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002841 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002842 AC_MSG_CHECKING(whether we are using Heimdal)
2843 AC_TRY_COMPILE([ #include <krb5.h> ],
2844 [ char *tmp = heimdal_version; ],
2845 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002846 AC_DEFINE(HEIMDAL, 1,
2847 [Define this if you are using the
2848 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002849 AC_MSG_RESULT(no)
2850 )
2851 else
2852 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002853 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002854 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002855 AC_MSG_CHECKING(whether we are using Heimdal)
2856 AC_TRY_COMPILE([ #include <krb5.h> ],
2857 [ char *tmp = heimdal_version; ],
2858 [ AC_MSG_RESULT(yes)
2859 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002860 K5LIBS="-lkrb5 -ldes"
2861 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002862 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002863 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002864 ],
2865 [ AC_MSG_RESULT(no)
2866 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2867 ]
2868 )
Damien Miller200d0a72003-06-30 19:21:36 +10002869 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002870
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002871 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2872 [ AC_DEFINE(GSSAPI)
2873 K5LIBS="-lgssapi $K5LIBS" ],
2874 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2875 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002876 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002877 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2878 $K5LIBS)
2879 ],
2880 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002881
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002882 AC_CHECK_HEADER(gssapi.h, ,
2883 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002884 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002885 AC_CHECK_HEADERS(gssapi.h, ,
2886 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002887 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002888 ]
2889 )
2890
2891 oldCPP="$CPPFLAGS"
2892 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2893 AC_CHECK_HEADER(gssapi_krb5.h, ,
2894 [ CPPFLAGS="$oldCPP" ])
2895
Damien Millera8e06ce2003-11-21 23:48:55 +11002896 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002897 if test ! -z "$need_dash_r" ; then
2898 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2899 fi
2900 if test ! -z "$blibpath" ; then
2901 blibpath="$blibpath:${KRB5ROOT}/lib"
2902 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002903
2904 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2905 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2906 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2907
2908 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002909 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2910 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002911 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002912 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002913)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002914
Damien Millera22ba012000-03-02 23:09:20 +11002915# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002916
Damien Millerf58c6722002-05-13 13:15:42 +10002917PRIVSEP_PATH=/var/empty
2918AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002919 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002920 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002921 if test -n "$withval" && test "x$withval" != "xno" && \
2922 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002923 PRIVSEP_PATH=$withval
2924 fi
2925 ]
2926)
2927AC_SUBST(PRIVSEP_PATH)
2928
Damien Millera22ba012000-03-02 23:09:20 +11002929AC_ARG_WITH(xauth,
2930 [ --with-xauth=PATH Specify path to xauth program ],
2931 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002932 if test -n "$withval" && test "x$withval" != "xno" && \
2933 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002934 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002935 fi
2936 ],
2937 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002938 TestPath="$PATH"
2939 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2940 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2941 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2942 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2943 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002944 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002945 xauth_path="/usr/openwin/bin/xauth"
2946 fi
2947 ]
2948)
2949
Damien Miller7d901272003-01-13 16:55:22 +11002950STRIP_OPT=-s
2951AC_ARG_ENABLE(strip,
2952 [ --disable-strip Disable calling strip(1) on install],
2953 [
2954 if test "x$enableval" = "xno" ; then
2955 STRIP_OPT=
2956 fi
2957 ]
2958)
2959AC_SUBST(STRIP_OPT)
2960
Damien Millera19cf472000-11-29 13:28:50 +11002961if test -z "$xauth_path" ; then
2962 XAUTH_PATH="undefined"
2963 AC_SUBST(XAUTH_PATH)
2964else
Tim Rice7df8d392005-09-19 09:33:39 -07002965 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2966 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11002967 XAUTH_PATH=$xauth_path
2968 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002969fi
Damien Millera22ba012000-03-02 23:09:20 +11002970
2971# Check for mail directory (last resort if we cannot get it from headers)
2972if test ! -z "$MAIL" ; then
2973 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07002974 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2975 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11002976fi
2977
Darren Tucker623d92f2004-09-12 22:36:15 +10002978if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002979 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2980 disable_ptmx_check=yes
2981fi
Damien Millera22ba012000-03-02 23:09:20 +11002982if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002983 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002984 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002985 [
Tim Rice7df8d392005-09-19 09:33:39 -07002986 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2987 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002988 have_dev_ptmx=1
2989 ]
2990 )
2991 fi
Damien Millera22ba012000-03-02 23:09:20 +11002992fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002993
Darren Tucker623d92f2004-09-12 22:36:15 +10002994if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002995 AC_CHECK_FILE("/dev/ptc",
2996 [
Tim Rice7df8d392005-09-19 09:33:39 -07002997 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2998 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002999 have_dev_ptc=1
3000 ]
3001 )
3002else
3003 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3004fi
Damien Miller204ad072000-03-02 23:56:12 +11003005
Damien Millera22ba012000-03-02 23:09:20 +11003006# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003007AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003008 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003009 [
Damien Miller897741e2001-04-16 10:41:46 +10003010 case "$withval" in
3011 man|cat|doc)
3012 MANTYPE=$withval
3013 ;;
3014 *)
3015 AC_MSG_ERROR(invalid man type: $withval)
3016 ;;
3017 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003018 ]
3019)
Ben Lindstrombc709922001-04-18 18:04:21 +00003020if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003021 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3022 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003023 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3024 MANTYPE=doc
3025 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3026 MANTYPE=man
3027 else
3028 MANTYPE=cat
3029 fi
3030fi
Damien Miller670a4b82000-01-22 13:53:11 +11003031AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003032if test "$MANTYPE" = "doc"; then
3033 mansubdir=man;
3034else
3035 mansubdir=$MANTYPE;
3036fi
3037AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003038
Damien Millera22ba012000-03-02 23:09:20 +11003039# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003040MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003041AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003042 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003043 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003044 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003045 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3046 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003047 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003048 fi
3049 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003050)
3051
Damien Millera22ba012000-03-02 23:09:20 +11003052# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003053AC_ARG_WITH(shadow,
3054 [ --without-shadow Disable shadow password support],
3055 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003056 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003057 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003058 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003059 fi
3060 ]
3061)
3062
Damien Miller1f335fb2000-06-26 11:31:33 +10003063if test -z "$disable_shadow" ; then
3064 AC_MSG_CHECKING([if the systems has expire shadow information])
3065 AC_TRY_COMPILE(
3066 [
3067#include <sys/types.h>
3068#include <shadow.h>
3069 struct spwd sp;
3070 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3071 [ sp_expire_available=yes ], []
3072 )
3073
3074 if test "x$sp_expire_available" = "xyes" ; then
3075 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003076 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3077 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003078 else
3079 AC_MSG_RESULT(no)
3080 fi
3081fi
3082
Damien Millera22ba012000-03-02 23:09:20 +11003083# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003084if test ! -z "$IPADDR_IN_DISPLAY" ; then
3085 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003086 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3087 [Define if you need to use IP address
3088 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003089else
Damien Millera8e06ce2003-11-21 23:48:55 +11003090 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003091 AC_ARG_WITH(ipaddr-display,
3092 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3093 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003094 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003095 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003096 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003097 fi
3098 ]
3099 )
3100fi
Damien Miller76112de1999-12-21 11:18:08 +11003101
Darren Tuckere1a790d2003-09-16 11:52:19 +10003102# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003103AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003104 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003105 [ if test "x$enableval" = "xno"; then
3106 AC_MSG_NOTICE([/etc/default/login handling disabled])
3107 etc_default_login=no
3108 else
3109 etc_default_login=yes
3110 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003111 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3112 then
3113 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3114 etc_default_login=no
3115 else
3116 etc_default_login=yes
3117 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003118)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003119
Darren Tucker2f9573d2005-02-10 22:28:54 +11003120if test "x$etc_default_login" != "xno"; then
3121 AC_CHECK_FILE("/etc/default/login",
3122 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003123 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003124 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3125 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003126 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003127fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003128
Tim Rice43a1c132002-04-17 21:19:14 -07003129dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003130if test $ac_cv_func_login_getcapbool = "yes" && \
3131 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003132 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003133fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003134
Damien Millera22ba012000-03-02 23:09:20 +11003135# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003136SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003137AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003138 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003139 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003140 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003141 AC_MSG_WARN([
3142--with-default-path=PATH has no effect on this system.
3143Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003144 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003145 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003146 AC_MSG_WARN([
3147--with-default-path=PATH will only be used if PATH is not defined in
3148$external_path_file .])
3149 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003150 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003151 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003152 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003153 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003154 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3155 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003156 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003157 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003158 AC_MSG_WARN([
3159If PATH is defined in $external_path_file, ensure the path to scp is included,
3160otherwise scp will not work.])
3161 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003162 AC_RUN_IFELSE(
3163 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003164/* find out what STDPATH is */
3165#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003166#ifdef HAVE_PATHS_H
3167# include <paths.h>
3168#endif
3169#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003170# ifdef _PATH_USERPATH /* Irix */
3171# define _PATH_STDPATH _PATH_USERPATH
3172# else
3173# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3174# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003175#endif
3176#include <sys/types.h>
3177#include <sys/stat.h>
3178#include <fcntl.h>
3179#define DATA "conftest.stdpath"
3180
3181main()
3182{
3183 FILE *fd;
3184 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003185
Tim Rice59ea0a02001-03-10 13:50:45 -08003186 fd = fopen(DATA,"w");
3187 if(fd == NULL)
3188 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003189
Tim Rice59ea0a02001-03-10 13:50:45 -08003190 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3191 exit(1);
3192
3193 exit(0);
3194}
Darren Tucker314d89e2005-10-17 23:29:23 +10003195 ]])],
3196 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003197 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3198 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3199 )
3200# make sure $bindir is in USER_PATH so scp will work
3201 t_bindir=`eval echo ${bindir}`
3202 case $t_bindir in
3203 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3204 esac
3205 case $t_bindir in
3206 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3207 esac
3208 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3209 if test $? -ne 0 ; then
3210 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3211 if test $? -ne 0 ; then
3212 user_path=$user_path:$t_bindir
3213 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3214 fi
3215 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003216 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003217)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003218if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003219 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003220 AC_SUBST(user_path)
3221fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003222
Damien Millera18bbd32002-05-13 10:48:57 +10003223# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003224AC_ARG_WITH(superuser-path,
3225 [ --with-superuser-path= Specify different path for super-user],
3226 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003227 if test -n "$withval" && test "x$withval" != "xno" && \
3228 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003229 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3230 [Define if you want a different $PATH
3231 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003232 superuser_path=$withval
3233 fi
3234 ]
3235)
3236
3237
Damien Miller61e50f12000-05-08 20:49:37 +10003238AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003239IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003240AC_ARG_WITH(4in6,
3241 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3242 [
3243 if test "x$withval" != "xno" ; then
3244 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003245 AC_DEFINE(IPV4_IN_IPV6, 1,
3246 [Detect IPv4 in IPv6 mapped addresses
3247 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003248 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003249 else
3250 AC_MSG_RESULT(no)
3251 fi
3252 ],[
3253 if test "x$inet6_default_4in6" = "xyes"; then
3254 AC_MSG_RESULT([yes (default)])
3255 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003256 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003257 else
3258 AC_MSG_RESULT([no (default)])
3259 fi
3260 ]
3261)
3262
Damien Miller60396b02001-02-18 17:01:00 +11003263# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003264BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003265AC_ARG_WITH(bsd-auth,
3266 [ --with-bsd-auth Enable BSD auth support],
3267 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003268 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003269 AC_DEFINE(BSD_AUTH, 1,
3270 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003271 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003272 fi
3273 ]
3274)
3275
Damien Millera22ba012000-03-02 23:09:20 +11003276# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003277piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003278# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003279if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003280 piddir=`eval echo ${sysconfdir}`
3281 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003282 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003283 esac
3284fi
3285
Tim Rice88f2ab52002-03-17 12:17:34 -08003286AC_ARG_WITH(pid-dir,
3287 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3288 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003289 if test -n "$withval" && test "x$withval" != "xno" && \
3290 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003291 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003292 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003293 AC_MSG_WARN([** no $piddir directory on this system **])
3294 fi
3295 fi
3296 ]
3297)
3298
Tim Rice7df8d392005-09-19 09:33:39 -07003299AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003300AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003301
andre2ff7b5d2000-06-03 14:57:40 +00003302dnl allow user to disable some login recording features
3303AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003304 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003305 [
3306 if test "x$enableval" = "xno" ; then
3307 AC_DEFINE(DISABLE_LASTLOG)
3308 fi
3309 ]
andre2ff7b5d2000-06-03 14:57:40 +00003310)
3311AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003312 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003313 [
3314 if test "x$enableval" = "xno" ; then
3315 AC_DEFINE(DISABLE_UTMP)
3316 fi
3317 ]
andre2ff7b5d2000-06-03 14:57:40 +00003318)
3319AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003320 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003321 [
3322 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003323 AC_DEFINE(DISABLE_UTMPX, 1,
3324 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003325 fi
3326 ]
andre2ff7b5d2000-06-03 14:57:40 +00003327)
3328AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003329 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003330 [
3331 if test "x$enableval" = "xno" ; then
3332 AC_DEFINE(DISABLE_WTMP)
3333 fi
3334 ]
andre2ff7b5d2000-06-03 14:57:40 +00003335)
3336AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003337 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003338 [
3339 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003340 AC_DEFINE(DISABLE_WTMPX, 1,
3341 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003342 fi
3343 ]
andre2ff7b5d2000-06-03 14:57:40 +00003344)
3345AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003346 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003347 [
3348 if test "x$enableval" = "xno" ; then
3349 AC_DEFINE(DISABLE_LOGIN)
3350 fi
3351 ]
andre2ff7b5d2000-06-03 14:57:40 +00003352)
3353AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003354 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003355 [
3356 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003357 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3358 [Define if you don't want to use pututline()
3359 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003360 fi
3361 ]
andre2ff7b5d2000-06-03 14:57:40 +00003362)
3363AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003364 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003365 [
3366 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003367 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3368 [Define if you don't want to use pututxline()
3369 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003370 fi
3371 ]
andre2ff7b5d2000-06-03 14:57:40 +00003372)
3373AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003374 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003375 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003376 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003377 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003378 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003379 conf_lastlog_location=$withval
3380 fi
3381 ]
3382)
andre2ff7b5d2000-06-03 14:57:40 +00003383
3384dnl lastlog, [uw]tmpx? detection
3385dnl NOTE: set the paths in the platform section to avoid the
3386dnl need for command-line parameters
3387dnl lastlog and [uw]tmp are subject to a file search if all else fails
3388
3389dnl lastlog detection
3390dnl NOTE: the code itself will detect if lastlog is a directory
3391AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3392AC_TRY_COMPILE([
3393#include <sys/types.h>
3394#include <utmp.h>
3395#ifdef HAVE_LASTLOG_H
3396# include <lastlog.h>
3397#endif
Damien Miller2994e082000-06-04 15:51:47 +10003398#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003399# include <paths.h>
3400#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003401#ifdef HAVE_LOGIN_H
3402# include <login.h>
3403#endif
andre2ff7b5d2000-06-03 14:57:40 +00003404 ],
3405 [ char *lastlog = LASTLOG_FILE; ],
3406 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003407 [
3408 AC_MSG_RESULT(no)
3409 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3410 AC_TRY_COMPILE([
3411#include <sys/types.h>
3412#include <utmp.h>
3413#ifdef HAVE_LASTLOG_H
3414# include <lastlog.h>
3415#endif
3416#ifdef HAVE_PATHS_H
3417# include <paths.h>
3418#endif
3419 ],
3420 [ char *lastlog = _PATH_LASTLOG; ],
3421 [ AC_MSG_RESULT(yes) ],
3422 [
andree441aa32000-06-12 22:34:38 +00003423 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003424 system_lastlog_path=no
3425 ])
3426 ]
andre2ff7b5d2000-06-03 14:57:40 +00003427)
Damien Miller2994e082000-06-04 15:51:47 +10003428
andre2ff7b5d2000-06-03 14:57:40 +00003429if test -z "$conf_lastlog_location"; then
3430 if test x"$system_lastlog_path" = x"no" ; then
3431 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003432 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003433 conf_lastlog_location=$f
3434 fi
3435 done
3436 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003437 AC_MSG_WARN([** Cannot find lastlog **])
3438 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003439 fi
3440 fi
3441fi
3442
3443if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003444 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3445 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003446fi
andre2ff7b5d2000-06-03 14:57:40 +00003447
3448dnl utmp detection
3449AC_MSG_CHECKING([if your system defines UTMP_FILE])
3450AC_TRY_COMPILE([
3451#include <sys/types.h>
3452#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003453#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003454# include <paths.h>
3455#endif
3456 ],
3457 [ char *utmp = UTMP_FILE; ],
3458 [ AC_MSG_RESULT(yes) ],
3459 [ AC_MSG_RESULT(no)
3460 system_utmp_path=no ]
3461)
3462if test -z "$conf_utmp_location"; then
3463 if test x"$system_utmp_path" = x"no" ; then
3464 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3465 if test -f $f ; then
3466 conf_utmp_location=$f
3467 fi
3468 done
3469 if test -z "$conf_utmp_location"; then
3470 AC_DEFINE(DISABLE_UTMP)
3471 fi
3472 fi
3473fi
3474if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003475 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3476 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003477fi
andre2ff7b5d2000-06-03 14:57:40 +00003478
3479dnl wtmp detection
3480AC_MSG_CHECKING([if your system defines WTMP_FILE])
3481AC_TRY_COMPILE([
3482#include <sys/types.h>
3483#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003484#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003485# include <paths.h>
3486#endif
3487 ],
3488 [ char *wtmp = WTMP_FILE; ],
3489 [ AC_MSG_RESULT(yes) ],
3490 [ AC_MSG_RESULT(no)
3491 system_wtmp_path=no ]
3492)
3493if test -z "$conf_wtmp_location"; then
3494 if test x"$system_wtmp_path" = x"no" ; then
3495 for f in /usr/adm/wtmp /var/log/wtmp; do
3496 if test -f $f ; then
3497 conf_wtmp_location=$f
3498 fi
3499 done
3500 if test -z "$conf_wtmp_location"; then
3501 AC_DEFINE(DISABLE_WTMP)
3502 fi
3503 fi
3504fi
3505if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003506 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3507 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003508fi
andre2ff7b5d2000-06-03 14:57:40 +00003509
3510
3511dnl utmpx detection - I don't know any system so perverse as to require
3512dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3513dnl there, though.
3514AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3515AC_TRY_COMPILE([
3516#include <sys/types.h>
3517#include <utmp.h>
3518#ifdef HAVE_UTMPX_H
3519#include <utmpx.h>
3520#endif
Damien Miller2994e082000-06-04 15:51:47 +10003521#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003522# include <paths.h>
3523#endif
3524 ],
3525 [ char *utmpx = UTMPX_FILE; ],
3526 [ AC_MSG_RESULT(yes) ],
3527 [ AC_MSG_RESULT(no)
3528 system_utmpx_path=no ]
3529)
3530if test -z "$conf_utmpx_location"; then
3531 if test x"$system_utmpx_path" = x"no" ; then
3532 AC_DEFINE(DISABLE_UTMPX)
3533 fi
3534else
Tim Rice7df8d392005-09-19 09:33:39 -07003535 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3536 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003537fi
andre2ff7b5d2000-06-03 14:57:40 +00003538
3539dnl wtmpx detection
3540AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3541AC_TRY_COMPILE([
3542#include <sys/types.h>
3543#include <utmp.h>
3544#ifdef HAVE_UTMPX_H
3545#include <utmpx.h>
3546#endif
Damien Miller2994e082000-06-04 15:51:47 +10003547#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003548# include <paths.h>
3549#endif
3550 ],
3551 [ char *wtmpx = WTMPX_FILE; ],
3552 [ AC_MSG_RESULT(yes) ],
3553 [ AC_MSG_RESULT(no)
3554 system_wtmpx_path=no ]
3555)
3556if test -z "$conf_wtmpx_location"; then
3557 if test x"$system_wtmpx_path" = x"no" ; then
3558 AC_DEFINE(DISABLE_WTMPX)
3559 fi
3560else
Tim Rice7df8d392005-09-19 09:33:39 -07003561 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3562 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003563fi
andre2ff7b5d2000-06-03 14:57:40 +00003564
Damien Miller4018c192000-04-30 09:30:44 +10003565
Damien Miller29ea30d2000-03-17 10:54:15 +11003566if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003567 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3568 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003569fi
3570
Tim Rice4cec93f2002-02-26 08:40:48 -08003571dnl remove pam and dl because they are in $LIBPAM
3572if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003573 LIBS=`echo $LIBS | sed 's/-lpam //'`
3574fi
3575if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3576 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003577fi
3578
Darren Tucker7da23cb2005-08-03 00:20:15 +10003579dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3580dnl Add now.
3581CFLAGS="$CFLAGS $werror_flags"
3582
Damien Millerbac2d8a2000-09-05 16:13:06 +11003583AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003584AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3585 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003586AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003587
Damien Miller7b22d652000-06-18 14:07:04 +10003588# Print summary of options
3589
Damien Miller7b22d652000-06-18 14:07:04 +10003590# Someone please show me a better way :)
3591A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3592B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3593C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3594D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003595E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003596F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003597G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003598H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3599I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3600J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003601
3602echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003603echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003604echo " User binaries: $B"
3605echo " System binaries: $C"
3606echo " Configuration files: $D"
3607echo " Askpass program: $E"
3608echo " Manual pages: $F"
3609echo " PID file: $G"
3610echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003611if test "x$external_path_file" = "x/etc/login.conf" ; then
3612echo " At runtime, sshd will use the path defined in $external_path_file"
3613echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003614else
Damien Millerf58c6722002-05-13 13:15:42 +10003615echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003616 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003617echo " (If PATH is set in $external_path_file it will be used instead. If"
3618echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3619 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003620fi
Damien Millera18bbd32002-05-13 10:48:57 +10003621if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003622echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003623fi
Damien Millerf58c6722002-05-13 13:15:42 +10003624echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003625echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003626echo " KerberosV support: $KRB5_MSG"
3627echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003628echo " S/KEY support: $SKEY_MSG"
3629echo " TCP Wrappers support: $TCPW_MSG"
3630echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003631echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003632echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003633echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3634echo " BSD Auth support: $BSD_AUTH_MSG"
3635echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003636if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003637echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003638fi
3639
Damien Miller7b22d652000-06-18 14:07:04 +10003640echo ""
3641
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003642echo " Host: ${host}"
3643echo " Compiler: ${CC}"
3644echo " Compiler flags: ${CFLAGS}"
3645echo "Preprocessor flags: ${CPPFLAGS}"
3646echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003647echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003648
3649echo ""
3650
Tim Rice6f1f7582004-05-30 21:38:51 -07003651if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003652 echo "SVR4 style packages are supported with \"make package\""
3653 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003654fi
3655
Damien Miller82cf0ce2000-12-20 13:34:48 +11003656if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003657 echo "PAM is enabled. You may need to install a PAM control file "
3658 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003659 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003660 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003661 echo ""
3662fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003663
Damien Miller6c21c512002-01-22 21:57:53 +11003664if test ! -z "$RAND_HELPER_CMDHASH" ; then
3665 echo "WARNING: you are using the builtin random number collection "
3666 echo "service. Please read WARNING.RNG and request that your OS "
3667 echo "vendor includes kernel-based random number collection in "
3668 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003669 echo ""
3670fi
Damien Miller60396b02001-02-18 17:01:00 +11003671
Damien Millerb4097182004-05-23 14:09:40 +10003672if test ! -z "$NO_PEERCHECK" ; then
3673 echo "WARNING: the operating system that you are using does not "
3674 echo "appear to support either the getpeereid() API nor the "
3675 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3676 echo "enforce security checks to prevent unauthorised connections to "
3677 echo "ssh-agent. Their absence increases the risk that a malicious "
3678 echo "user can connect to your agent. "
3679 echo ""
3680fi
3681
Darren Tuckerd9f88912005-02-20 21:01:48 +11003682if test "$AUDIT_MODULE" = "bsm" ; then
3683 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3684 echo "See the Solaris section in README.platform for details."
3685fi