blob: 849112829f1baf22afa917036239923265e567f7 [file] [log] [blame]
Tim Ricec1819c82005-08-15 17:48:40 -07001# $Id: configure.ac,v 1.286 2005/08/16 00:48:41 tim Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080078
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100080
81AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
82
Damien Millera8e06ce2003-11-21 23:48:55 +110083if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100084 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Damien Miller52c8afe2005-06-19 10:19:43 +100085 CFLAGS="$CFLAGS -Wsign-compare"
Damien Millerde3cb0a2005-05-26 20:48:25 +100086
Darren Tucker67b37032005-06-03 17:58:31 +100087 if test -z "$have_llong_max"; then
88 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
89 unset ac_cv_have_decl_LLONG_MAX
90 saved_CFLAGS="$CFLAGS"
91 CFLAGS="$CFLAGS -std=gnu99"
92 AC_CHECK_DECL(LLONG_MAX,
93 [have_llong_max=1],
94 [CFLAGS="$saved_CFLAGS"],
95 [#include <limits.h>]
96 )
97 fi
Damien Miller166bd442000-03-16 10:48:25 +110098fi
99
Darren Tucker431f0222005-06-07 17:53:40 +1000100if test -z "$have_llong_max"; then
101 AC_MSG_CHECKING([for max value of long long])
102 AC_RUN_IFELSE(
103 [AC_LANG_SOURCE([[
104#include <stdio.h>
105/* Why is this so damn hard? */
106#ifdef __GNUC__
107# undef __GNUC__
108#endif
109#define __USE_ISOC99
110#include <limits.h>
111#define DATA "conftest.llminmax"
112int main(void) {
113 FILE *f;
114 long long i, llmin, llmax = 0;
115
116 if((f = fopen(DATA,"w")) == NULL)
117 exit(1);
118
119#if defined(LLONG_MIN) && defined(LLONG_MAX)
120 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
121 llmin = LLONG_MIN;
122 llmax = LLONG_MAX;
123#else
124 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
125 /* This will work on one's complement and two's complement */
126 for (i = 1; i > llmax; i <<= 1, i++)
127 llmax = i;
128 llmin = llmax + 1LL; /* wrap */
129#endif
130
131 /* Sanity check */
132 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
133 || llmax - 1 > llmax) {
134 fprintf(f, "unknown unknown\n");
135 exit(2);
136 }
137
138 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
139 exit(3);
140
141 exit(0);
142}
143 ]])],
144 [
145 llong_min=`$AWK '{print $1}' conftest.llminmax`
146 llong_max=`$AWK '{print $2}' conftest.llminmax`
147 AC_MSG_RESULT($llong_max)
148 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
149 [max value of long long calculated by configure])
150 AC_MSG_CHECKING([for min value of long long])
151 AC_MSG_RESULT($llong_min)
152 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
153 [min value of long long calculated by configure])
154 ],
155 [
156 AC_MSG_RESULT(not found)
157 ],
158 [
159 AC_MSG_WARN([cross compiling: not checking])
160 ]
161 )
162fi
163
Tim Rice88368a32003-12-08 12:35:59 -0800164AC_ARG_WITH(rpath,
165 [ --without-rpath Disable auto-added -R linker paths],
166 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800167 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800168 need_dash_r=""
169 fi
170 if test "x$withval" = "xyes" ; then
171 need_dash_r=1
172 fi
173 ]
174)
175
Damien Millera22ba012000-03-02 23:09:20 +1100176# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100177case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100178*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100179 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000180 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800181 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100182 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000183 saved_LDFLAGS="$LDFLAGS"
184 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
185 if (test -z "$blibflags"); then
186 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
187 AC_TRY_LINK([], [], [blibflags=$tryflags])
188 fi
189 done
190 if (test -z "$blibflags"); then
191 AC_MSG_RESULT(not found)
192 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
193 else
194 AC_MSG_RESULT($blibflags)
195 fi
196 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000197 dnl Check for authenticate. Might be in libs.a on older AIXes
198 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700199 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000200 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700201 LIBS="$LIBS -ls"
202 ])
203 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100204 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100205 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100206 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000207 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100208 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000209 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
210 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000211 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000212 [(void)loginfailed("user","host","tty",0);],
213 [AC_MSG_RESULT(yes)
214 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000215 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000216 )],
217 [],
218 [#include <usersec.h>]
219 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000220 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100221 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000222 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000223 AC_DEFINE(SETEUID_BREAKS_SETUID)
224 AC_DEFINE(BROKEN_SETREUID)
225 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000226 dnl AIX handles lastlog as part of its login message
227 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000228 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000229 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100230 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100231*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100232 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800233 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100234 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000235 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100236 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100237 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000238 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000239 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700240 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100241 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000242*-*-dgux*)
243 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100244 AC_DEFINE(SETEUID_BREAKS_SETUID)
245 AC_DEFINE(BROKEN_SETREUID)
246 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000247 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000248*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000249 AC_MSG_CHECKING(if we have working getaddrinfo)
250 AC_TRY_RUN([#include <mach-o/dyld.h>
251main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
252 exit(0);
253 else
254 exit(1);
255}], [AC_MSG_RESULT(working)],
256 [AC_MSG_RESULT(buggy)
257 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700258 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000259 AC_DEFINE(SETEUID_BREAKS_SETUID)
260 AC_DEFINE(BROKEN_SETREUID)
261 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100262 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000263 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000264*-*-hpux*)
265 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000266 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100267 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000268 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000269 AC_DEFINE(LOGIN_NO_ENDOPT)
270 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000271 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000272 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700273 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000274 AC_CHECK_LIB(xnet, t_error, ,
275 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
276
277 # next, we define all of the options specific to major releases
278 case "$host" in
279 *-*-hpux10*)
280 if test -z "$GCC"; then
281 CFLAGS="$CFLAGS -Ae"
282 fi
283 ;;
284 *-*-hpux11*)
285 AC_DEFINE(PAM_SUN_CODEBASE)
286 AC_DEFINE(DISABLE_UTMP)
287 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
288 check_for_hpux_broken_getaddrinfo=1
289 check_for_conflicting_getspnam=1
290 ;;
291 esac
292
293 # lastly, we define options specific to minor releases
294 case "$host" in
295 *-*-hpux10.26)
296 AC_DEFINE(HAVE_SECUREWARE)
297 disable_ptmx_check=yes
298 LIBS="$LIBS -lsecpw"
299 ;;
300 esac
Damien Miller1bead332000-04-30 00:47:29 +1000301 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100302*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100303 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000304 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000305 AC_DEFINE(SETEUID_BREAKS_SETUID)
306 AC_DEFINE(BROKEN_SETREUID)
307 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000308 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000309 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100310 ;;
311*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100312 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000313 AC_DEFINE(WITH_IRIX_ARRAY)
314 AC_DEFINE(WITH_IRIX_PROJECT)
315 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000316 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000317 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000318 AC_DEFINE(SETEUID_BREAKS_SETUID)
319 AC_DEFINE(BROKEN_SETREUID)
320 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000321 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000322 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000323 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100324 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100325*-*-linux*)
326 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100327 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000328 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100329 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000330 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000331 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000332 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000333 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100334 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
335 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100336 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000337 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000338 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000339 AC_DEFINE(BROKEN_CMSG_TYPE)
340 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000341 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100342 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000343mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000344 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000345 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000346 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100347*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000348 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800349 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800350 need_dash_r=1
351 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100352 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100353*-*-freebsd*)
354 check_for_libcrypt_later=1
355 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000356*-*-bsdi*)
357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
360 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000361*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000362 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100363 conf_utmp_location=/etc/utmp
364 conf_wtmp_location=/usr/adm/wtmp
365 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000366 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000367 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000368 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100369 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000370 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000371*-*-openbsd*)
372 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
373 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100374*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800375 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800376 need_dash_r=1
377 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100378 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000379 AC_DEFINE(LOGIN_NEEDS_UTMPX)
380 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000381 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000382 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000383 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000384 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
385 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000386 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000387 # hardwire lastlog location (can't detect it on some versions)
388 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000389 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
390 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
391 if test "$sol2ver" -ge 8; then
392 AC_MSG_RESULT(yes)
393 AC_DEFINE(DISABLE_UTMP)
394 AC_DEFINE(DISABLE_WTMP)
395 else
396 AC_MSG_RESULT(no)
397 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100398 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000399*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000400 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000401 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100402 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000403 conf_utmp_location=/etc/utmp
404 conf_wtmp_location=/var/adm/wtmp
405 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000406 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000407 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000408*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700409 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000410 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000411 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000415 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000416*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700417 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000418 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100419 # -lresolv needs to be at then end of LIBS or DNS lookups break
420 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100421 IPADDR_IN_DISPLAY=yes
422 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000423 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000427 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000428 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700429 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
430 # Attention: always take care to bind libsocket and libnsl before libc,
431 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000432 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800433# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100434*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100435 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700436 AC_DEFINE(SETEUID_BREAKS_SETUID)
437 AC_DEFINE(BROKEN_SETREUID)
438 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700439 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100440 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800441# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100442*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100443 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700444 AC_DEFINE(SETEUID_BREAKS_SETUID)
445 AC_DEFINE(BROKEN_SETREUID)
446 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700447 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700448 case "$host" in
449 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
450 TEST_SHELL=/u95/bin/sh
451 ;;
452 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100453 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100454*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100455 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800456# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100457*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800458 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100459 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800460# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100461*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800462 if test -z "$GCC"; then
463 CFLAGS="$CFLAGS -belf"
464 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100465 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000466 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100467 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000468 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000469 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700470 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700471 AC_DEFINE(SETEUID_BREAKS_SETUID)
472 AC_DEFINE(BROKEN_SETREUID)
473 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700474 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700475 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100476 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100477 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700478 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700479 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000480 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000481*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100482 AC_DEFINE(NO_SSH_LASTLOG)
483 AC_DEFINE(SETEUID_BREAKS_SETUID)
484 AC_DEFINE(BROKEN_SETREUID)
485 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000486 AC_DEFINE(USE_PIPES)
487 AC_DEFINE(DISABLE_FD_PASSING)
488 LDFLAGS="$LDFLAGS"
489 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
490 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000491 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000492*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100493 AC_DEFINE(SETEUID_BREAKS_SETUID)
494 AC_DEFINE(BROKEN_SETREUID)
495 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000496 AC_DEFINE(WITH_ABBREV_NO_TTY)
497 AC_DEFINE(USE_PIPES)
498 AC_DEFINE(DISABLE_FD_PASSING)
499 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100500 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000501 MANTYPE=cat
502 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000503*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100504 AC_DEFINE(SETEUID_BREAKS_SETUID)
505 AC_DEFINE(BROKEN_SETREUID)
506 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000507 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700508 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700509 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000510 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
511 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
512 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700513 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000514*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000515 AC_MSG_CHECKING(for Digital Unix SIA)
516 no_osfsia=""
517 AC_ARG_WITH(osfsia,
518 [ --with-osfsia Enable Digital Unix SIA],
519 [
520 if test "x$withval" = "xno" ; then
521 AC_MSG_RESULT(disabled)
522 no_osfsia=1
523 fi
524 ],
525 )
526 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000527 if test -f /etc/sia/matrix.conf; then
528 AC_MSG_RESULT(yes)
529 AC_DEFINE(HAVE_OSF_SIA)
530 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000531 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000532 LIBS="$LIBS -lsecurity -ldb -lm -laud"
533 else
534 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100535 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000536 fi
537 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000538 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700539 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000540 AC_DEFINE(BROKEN_SETREUID)
541 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000542 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000543
544*-*-nto-qnx)
545 AC_DEFINE(USE_PIPES)
546 AC_DEFINE(NO_X11_UNIX_SOCKETS)
547 AC_DEFINE(MISSING_NFDBITS)
548 AC_DEFINE(MISSING_HOWMANY)
549 AC_DEFINE(MISSING_FD_MASK)
550 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000551
552*-*-ultrix*)
553 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
554 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
555 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700556 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
557 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100558esac
559
Damien Millere37bfc12000-06-05 09:37:43 +1000560# Allow user to specify flags
561AC_ARG_WITH(cflags,
562 [ --with-cflags Specify additional flags to pass to compiler],
563 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800564 if test -n "$withval" && test "x$withval" != "xno" && \
565 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000566 CFLAGS="$CFLAGS $withval"
567 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800568 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000569)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000570AC_ARG_WITH(cppflags,
571 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
572 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800573 if test -n "$withval" && test "x$withval" != "xno" && \
574 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000575 CPPFLAGS="$CPPFLAGS $withval"
576 fi
577 ]
578)
Damien Millere37bfc12000-06-05 09:37:43 +1000579AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000580 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000581 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800582 if test -n "$withval" && test "x$withval" != "xno" && \
583 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000584 LDFLAGS="$LDFLAGS $withval"
585 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800586 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000587)
588AC_ARG_WITH(libs,
589 [ --with-libs Specify additional libraries to link with],
590 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800591 if test -n "$withval" && test "x$withval" != "xno" && \
592 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000593 LIBS="$LIBS $withval"
594 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800595 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000596)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000597AC_ARG_WITH(Werror,
598 [ --with-Werror Build main code with -Werror],
599 [
600 if test -n "$withval" && test "x$withval" != "xno"; then
601 werror_flags="-Werror"
602 if "x${withval}" != "xyes"; then
603 werror_flags="$withval"
604 fi
605 fi
606 ]
607)
Damien Millere37bfc12000-06-05 09:37:43 +1000608
Darren Tucker6eb93042003-06-29 21:30:41 +1000609AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000610AC_RUN_IFELSE(
611 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000612#include <stdio.h>
613int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000614 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000615 [ AC_MSG_RESULT(yes) ],
616 [
617 AC_MSG_RESULT(no)
618 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000619 ],
620 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000621)
622
Darren Tucker0c9653f2005-05-28 15:58:14 +1000623dnl Checks for header files.
624AC_CHECK_HEADERS( \
625 bstring.h \
626 crypt.h \
627 dirent.h \
628 endian.h \
629 features.h \
630 floatingpoint.h \
631 getopt.h \
632 glob.h \
633 ia.h \
634 lastlog.h \
635 limits.h \
636 login.h \
637 login_cap.h \
638 maillock.h \
639 ndir.h \
640 netdb.h \
641 netgroup.h \
642 netinet/in_systm.h \
643 pam/pam_appl.h \
644 paths.h \
645 pty.h \
646 readpassphrase.h \
647 rpc/types.h \
648 security/pam_appl.h \
649 shadow.h \
650 stddef.h \
651 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000652 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000653 strings.h \
654 sys/audit.h \
655 sys/bitypes.h \
656 sys/bsdtty.h \
657 sys/cdefs.h \
658 sys/dir.h \
659 sys/mman.h \
660 sys/ndir.h \
661 sys/prctl.h \
662 sys/pstat.h \
663 sys/select.h \
664 sys/stat.h \
665 sys/stream.h \
666 sys/stropts.h \
667 sys/strtio.h \
668 sys/sysmacros.h \
669 sys/time.h \
670 sys/timers.h \
671 sys/un.h \
672 time.h \
673 tmpdir.h \
674 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000675 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000676 usersec.h \
677 util.h \
678 utime.h \
679 utmp.h \
680 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000681 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000682)
Tim Rice4cec93f2002-02-26 08:40:48 -0800683
Darren Tucker48d99d32004-08-29 17:04:50 +1000684# sys/ptms.h requires sys/stream.h to be included first on Solaris
685AC_CHECK_HEADERS(sys/ptms.h, [], [], [
686#ifdef HAVE_SYS_STREAM_H
687# include <sys/stream.h>
688#endif
689])
690
Damien Millera22ba012000-03-02 23:09:20 +1100691# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700692AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
693AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000694
Tim Rice1e1ef642003-09-11 22:19:31 -0700695dnl IRIX and Solaris 2.5.1 have dirname() in libgen
696AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
697 AC_CHECK_LIB(gen, dirname,[
698 AC_CACHE_CHECK([for broken dirname],
699 ac_cv_have_broken_dirname, [
700 save_LIBS="$LIBS"
701 LIBS="$LIBS -lgen"
702 AC_TRY_RUN(
703 [
704#include <libgen.h>
705#include <string.h>
706
707int main(int argc, char **argv) {
708 char *s, buf[32];
709
710 strncpy(buf,"/etc", 32);
711 s = dirname(buf);
712 if (!s || strncmp(s, "/", 32) != 0) {
713 exit(1);
714 } else {
715 exit(0);
716 }
717}
718 ],
719 [ ac_cv_have_broken_dirname="no" ],
720 [ ac_cv_have_broken_dirname="yes" ]
721 )
722 LIBS="$save_LIBS"
723 ])
724 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
725 LIBS="$LIBS -lgen"
726 AC_DEFINE(HAVE_DIRNAME)
727 AC_CHECK_HEADERS(libgen.h)
728 fi
729 ])
730])
731
732AC_CHECK_FUNC(getspnam, ,
733 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
734AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
735
Tim Rice13aae5e2001-10-21 17:53:58 -0700736dnl zlib is required
737AC_ARG_WITH(zlib,
738 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100739 [ if test "x$withval" = "xno" ; then
740 AC_MSG_ERROR([*** zlib is required ***])
741 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700742 if test -d "$withval/lib"; then
743 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700744 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700745 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700746 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700747 fi
748 else
749 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700750 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700751 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700752 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700753 fi
754 fi
755 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700756 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700757 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700758 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100760 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700761)
762
Tim Ricefcb62202004-01-23 18:35:16 -0800763AC_CHECK_LIB(z, deflate, ,
764 [
765 saved_CPPFLAGS="$CPPFLAGS"
766 saved_LDFLAGS="$LDFLAGS"
767 save_LIBS="$LIBS"
768 dnl Check default zlib install dir
769 if test -n "${need_dash_r}"; then
770 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
771 else
772 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
773 fi
774 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
775 LIBS="$LIBS -lz"
776 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
777 [
778 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
779 ]
780 )
781 ]
782)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100783AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100784
785AC_ARG_WITH(zlib-version-check,
786 [ --without-zlib-version-check Disable zlib version check],
787 [ if test "x$withval" = "xno" ; then
788 zlib_check_nonfatal=1
789 fi
790 ]
791)
792
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000793AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000794AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000795#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100796#include <zlib.h>
797int main()
798{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000799 int a=0, b=0, c=0, d=0, n, v;
800 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
801 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100802 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000803 v = a*1000000 + b*10000 + c*100 + d;
804 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
805
806 /* 1.1.4 is OK */
807 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100808 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000809
Darren Tucker41097ed2005-07-25 15:24:21 +1000810 /* 1.2.3 and up are OK */
811 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000812 exit(0);
813
Darren Tucker2dcd2392004-01-23 17:13:33 +1100814 exit(2);
815}
Darren Tucker623d92f2004-09-12 22:36:15 +1000816 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000817 AC_MSG_RESULT(no),
818 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100819 if test -z "$zlib_check_nonfatal" ; then
820 AC_MSG_ERROR([*** zlib too old - check config.log ***
821Your reported zlib version has known security problems. It's possible your
822vendor has fixed these problems without changing the version number. If you
823are sure this is the case, you can disable the check by running
824"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000825If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000826See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100827 else
828 AC_MSG_WARN([zlib version may have security problems])
829 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000830 ],
831 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100832)
Damien Miller6f9c3372000-10-25 10:06:04 +1100833
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000834dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100835AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000836 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
837)
Damien Millera8e06ce2003-11-21 23:48:55 +1100838AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700839 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
840 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000841)
Damien Millerab18c411999-11-11 10:40:23 +1100842
Tim Ricee589a292001-11-03 11:09:32 -0800843dnl Checks for libutil functions
844AC_CHECK_HEADERS(libutil.h)
845AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
846AC_CHECK_FUNCS(logout updwtmp logwtmp)
847
Ben Lindstrom8697e082001-02-24 21:41:10 +0000848AC_FUNC_STRFTIME
849
Damien Miller3c027682001-03-14 11:39:45 +1100850# Check for ALTDIRFUNC glob() extension
851AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
852AC_EGREP_CPP(FOUNDIT,
853 [
854 #include <glob.h>
855 #ifdef GLOB_ALTDIRFUNC
856 FOUNDIT
857 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100858 ],
Damien Miller3c027682001-03-14 11:39:45 +1100859 [
860 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
861 AC_MSG_RESULT(yes)
862 ],
863 [
864 AC_MSG_RESULT(no)
865 ]
866)
Damien Millerab18c411999-11-11 10:40:23 +1100867
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000868# Check for g.gl_matchc glob() extension
869AC_MSG_CHECKING(for gl_matchc field in glob_t)
870AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100871 [
872 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000873 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100874 ],
875 [
876 AC_DEFINE(GLOB_HAS_GL_MATCHC)
877 AC_MSG_RESULT(yes)
878 ],
879 [
880 AC_MSG_RESULT(no)
881 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000882)
883
Damien Miller18bb4732001-03-28 14:35:30 +1000884AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000885AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000886 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000887#include <sys/types.h>
888#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700889int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000890 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100891 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000892 [
893 AC_MSG_RESULT(no)
894 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000895 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800896 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000897 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
898 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000899 ]
900)
901
Damien Miller36f49652004-08-15 18:40:59 +1000902AC_MSG_CHECKING([for /proc/pid/fd directory])
903if test -d "/proc/$$/fd" ; then
904 AC_DEFINE(HAVE_PROC_PID)
905 AC_MSG_RESULT(yes)
906else
907 AC_MSG_RESULT(no)
908fi
909
Damien Millerc547bf12001-02-16 10:18:12 +1100910# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100911SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100912AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100913 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100914 [
915 if test "x$withval" != "xno" ; then
916
917 if test "x$withval" != "xyes" ; then
918 CPPFLAGS="$CPPFLAGS -I${withval}/include"
919 LDFLAGS="$LDFLAGS -L${withval}/lib"
920 fi
921
922 AC_DEFINE(SKEY)
923 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100924 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800925
Tim Rice4cec93f2002-02-26 08:40:48 -0800926 AC_MSG_CHECKING([for s/key support])
927 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100928 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800929#include <stdio.h>
930#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700931int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800932 ],
933 [AC_MSG_RESULT(yes)],
934 [
935 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100936 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
937 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000938 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
939 AC_TRY_COMPILE(
940 [#include <stdio.h>
941 #include <skey.h>],
942 [(void)skeychallenge(NULL,"name","",0);],
943 [AC_MSG_RESULT(yes)
944 AC_DEFINE(SKEYCHALLENGE_4ARG)],
945 [AC_MSG_RESULT(no)]
946 )
Damien Millerc547bf12001-02-16 10:18:12 +1100947 fi
948 ]
949)
950
951# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700952TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100953AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100954 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100955 [
956 if test "x$withval" != "xno" ; then
957 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700958 saved_LDFLAGS="$LDFLAGS"
959 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800960 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800961 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700962 if test -d "${withval}/lib"; then
963 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700964 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700965 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700966 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700967 fi
968 else
969 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700970 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700971 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700972 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700973 fi
974 fi
975 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700976 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700977 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700978 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700979 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700980 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800981 LIBWRAP="-lwrap"
982 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100983 AC_MSG_CHECKING(for libwrap)
984 AC_TRY_LINK(
985 [
Damien Miller0ac45002004-04-14 20:14:26 +1000986#include <sys/types.h>
987#include <sys/socket.h>
988#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100989#include <tcpd.h>
990 int deny_severity = 0, allow_severity = 0;
991 ],
992 [hosts_access(0);],
993 [
994 AC_MSG_RESULT(yes)
995 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800996 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700997 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100998 ],
999 [
1000 AC_MSG_ERROR([*** libwrap missing])
1001 ]
1002 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001003 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001004 fi
1005 ]
1006)
1007
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001008# Check whether user wants libedit support
1009LIBEDIT_MSG="no"
1010AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001011 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001012 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001013 if test "x$withval" != "xyes"; then
1014 CPPFLAGS="$CPPFLAGS -I$withval/include"
1015 LDFLAGS="$LDFLAGS -L$withval/lib"
1016 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001017 AC_CHECK_LIB(edit, el_init,
1018 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1019 LIBEDIT="-ledit -lcurses"
1020 LIBEDIT_MSG="yes"
1021 AC_SUBST(LIBEDIT)
1022 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001023 [ AC_MSG_ERROR(libedit not found) ],
1024 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001025 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001026 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001027 AC_COMPILE_IFELSE(
1028 [AC_LANG_SOURCE([[
1029#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001030int main(void)
1031{
1032 int i = H_SETSIZE;
1033 el_init("", NULL, NULL, NULL);
1034 exit(0);
1035}
Tim Ricec1819c82005-08-15 17:48:40 -07001036 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001037 [ AC_MSG_RESULT(yes) ],
1038 [ AC_MSG_RESULT(no)
1039 AC_MSG_ERROR(libedit version is not compatible) ]
1040 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001041 fi ]
1042)
1043
Darren Tuckerd9f88912005-02-20 21:01:48 +11001044AUDIT_MODULE=none
1045AC_ARG_WITH(audit,
1046 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1047 [
1048 AC_MSG_CHECKING(for supported audit module)
1049 case "$withval" in
1050 bsm)
1051 AC_MSG_RESULT(bsm)
1052 AUDIT_MODULE=bsm
1053 dnl Checks for headers, libs and functions
1054 AC_CHECK_HEADERS(bsm/audit.h, [],
1055 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1056 AC_CHECK_LIB(bsm, getaudit, [],
1057 [AC_MSG_ERROR(BSM enabled and required library not found)])
1058 AC_CHECK_FUNCS(getaudit, [],
1059 [AC_MSG_ERROR(BSM enabled and required function not found)])
1060 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001061 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001062 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1063 ;;
1064 debug)
1065 AUDIT_MODULE=debug
1066 AC_MSG_RESULT(debug)
1067 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1068 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001069 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001070 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001071 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001072 *)
1073 AC_MSG_ERROR([Unknown audit module $withval])
1074 ;;
1075 esac ]
1076)
1077
Damien Millerfe1f1432003-02-24 15:45:42 +11001078dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001079AC_CHECK_FUNCS( \
1080 arc4random \
1081 b64_ntop \
1082 __b64_ntop \
1083 b64_pton \
1084 __b64_pton \
1085 bcopy \
1086 bindresvport_sa \
1087 clock \
1088 closefrom \
1089 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001090 fchmod \
1091 fchown \
1092 freeaddrinfo \
1093 futimes \
1094 getaddrinfo \
1095 getcwd \
1096 getgrouplist \
1097 getnameinfo \
1098 getopt \
1099 getpeereid \
1100 _getpty \
1101 getrlimit \
1102 getttyent \
1103 glob \
1104 inet_aton \
1105 inet_ntoa \
1106 inet_ntop \
1107 innetgr \
1108 login_getcapbool \
1109 md5_crypt \
1110 memmove \
1111 mkdtemp \
1112 mmap \
1113 ngetaddrinfo \
1114 nsleep \
1115 ogetaddrinfo \
1116 openlog_r \
1117 openpty \
1118 prctl \
1119 pstat \
1120 readpassphrase \
1121 realpath \
1122 recvmsg \
1123 rresvport_af \
1124 sendmsg \
1125 setdtablesize \
1126 setegid \
1127 setenv \
1128 seteuid \
1129 setgroups \
1130 setlogin \
1131 setpcred \
1132 setproctitle \
1133 setregid \
1134 setreuid \
1135 setrlimit \
1136 setsid \
1137 setvbuf \
1138 sigaction \
1139 sigvec \
1140 snprintf \
1141 socketpair \
1142 strdup \
1143 strerror \
1144 strlcat \
1145 strlcpy \
1146 strmode \
1147 strnvis \
1148 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001149 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001150 strtoul \
1151 sysconf \
1152 tcgetpgrp \
1153 truncate \
1154 unsetenv \
1155 updwtmpx \
1156 utimes \
1157 vhangup \
1158 vsnprintf \
1159 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001160)
Tim Rice13aae5e2001-10-21 17:53:58 -07001161
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001162# IRIX has a const char return value for gai_strerror()
1163AC_CHECK_FUNCS(gai_strerror,[
1164 AC_DEFINE(HAVE_GAI_STRERROR)
1165 AC_TRY_COMPILE([
1166#include <sys/types.h>
1167#include <sys/socket.h>
1168#include <netdb.h>
1169
1170const char *gai_strerror(int);],[
1171char *str;
1172
1173str = gai_strerror(0);],[
1174 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1175 [Define if gai_strerror() returns const char *])])])
1176
Damien Millercd6853c2003-01-28 11:33:42 +11001177AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1178
Darren Tuckerf1159b52003-07-07 19:44:01 +10001179dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001180AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001181AC_CHECK_DECL(strsep,
1182 [AC_CHECK_FUNCS(strsep)],
1183 [],
1184 [
1185#ifdef HAVE_STRING_H
1186# include <string.h>
1187#endif
1188 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001189
Darren Tuckerb2427c82003-09-10 15:22:44 +10001190dnl tcsendbreak might be a macro
1191AC_CHECK_DECL(tcsendbreak,
1192 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001193 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001194 [#include <termios.h>]
1195)
1196
Darren Tucker5bb14002004-04-23 18:53:10 +10001197AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1198
Darren Tucker2a6b0292003-12-31 14:59:17 +11001199AC_CHECK_FUNCS(setresuid, [
1200 dnl Some platorms have setresuid that isn't implemented, test for this
1201 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001202 AC_RUN_IFELSE(
1203 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001204#include <stdlib.h>
1205#include <errno.h>
1206int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001207 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001208 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001209 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001210 AC_MSG_RESULT(not implemented)],
1211 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001212 )
1213])
Darren Tuckere937be32003-12-17 18:53:26 +11001214
Darren Tucker2a6b0292003-12-31 14:59:17 +11001215AC_CHECK_FUNCS(setresgid, [
1216 dnl Some platorms have setresgid that isn't implemented, test for this
1217 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001218 AC_RUN_IFELSE(
1219 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001220#include <stdlib.h>
1221#include <errno.h>
1222int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001223 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001224 [AC_MSG_RESULT(yes)],
1225 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001226 AC_MSG_RESULT(not implemented)],
1227 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001228 )
1229])
Darren Tuckere937be32003-12-17 18:53:26 +11001230
Damien Millerad833b32000-08-23 10:46:23 +10001231dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001232AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001233dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001234AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001235AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001236dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001237AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001238AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001239
Damien Millera8e06ce2003-11-21 23:48:55 +11001240AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001241 [AC_DEFINE(HAVE_DAEMON)],
1242 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1243)
1244
Damien Millera8e06ce2003-11-21 23:48:55 +11001245AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001246 [AC_DEFINE(HAVE_GETPAGESIZE)],
1247 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1248)
1249
Damien Millercb170cb2000-07-01 16:52:55 +10001250# Check for broken snprintf
1251if test "x$ac_cv_func_snprintf" = "xyes" ; then
1252 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001253 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001254 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001255#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001256int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001257 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001258 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001259 [
1260 AC_MSG_RESULT(no)
1261 AC_DEFINE(BROKEN_SNPRINTF)
1262 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001263 ],
1264 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001265 )
1266fi
1267
Damien Millerb4097182004-05-23 14:09:40 +10001268# Check for missing getpeereid (or equiv) support
1269NO_PEERCHECK=""
1270if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1271 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1272 AC_TRY_COMPILE(
1273 [#include <sys/types.h>
1274 #include <sys/socket.h>],
1275 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001276 [ AC_MSG_RESULT(yes)
1277 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1278 ],
Damien Millerb4097182004-05-23 14:09:40 +10001279 [AC_MSG_RESULT(no)
1280 NO_PEERCHECK=1]
1281 )
1282fi
1283
Damien Millere8328192003-01-07 15:18:32 +11001284dnl see whether mkstemp() requires XXXXXX
1285if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1286AC_MSG_CHECKING([for (overly) strict mkstemp])
1287AC_TRY_RUN(
1288 [
1289#include <stdlib.h>
1290main() { char template[]="conftest.mkstemp-test";
1291if (mkstemp(template) == -1)
1292 exit(1);
1293unlink(template); exit(0);
1294}
1295 ],
1296 [
1297 AC_MSG_RESULT(no)
1298 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001299 [
Damien Millere8328192003-01-07 15:18:32 +11001300 AC_MSG_RESULT(yes)
1301 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1302 ],
1303 [
1304 AC_MSG_RESULT(yes)
1305 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001306 ]
Damien Millere8328192003-01-07 15:18:32 +11001307)
1308fi
1309
Darren Tucker70a3d552003-08-21 17:58:29 +10001310dnl make sure that openpty does not reacquire controlling terminal
1311if test ! -z "$check_for_openpty_ctty_bug"; then
1312 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1313 AC_TRY_RUN(
1314 [
1315#include <stdio.h>
1316#include <sys/fcntl.h>
1317#include <sys/types.h>
1318#include <sys/wait.h>
1319
1320int
1321main()
1322{
1323 pid_t pid;
1324 int fd, ptyfd, ttyfd, status;
1325
1326 pid = fork();
1327 if (pid < 0) { /* failed */
1328 exit(1);
1329 } else if (pid > 0) { /* parent */
1330 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001331 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001332 exit(WEXITSTATUS(status));
1333 else
1334 exit(2);
1335 } else { /* child */
1336 close(0); close(1); close(2);
1337 setsid();
1338 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1339 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1340 if (fd >= 0)
1341 exit(3); /* Acquired ctty: broken */
1342 else
1343 exit(0); /* Did not acquire ctty: OK */
1344 }
1345}
1346 ],
1347 [
1348 AC_MSG_RESULT(yes)
1349 ],
1350 [
1351 AC_MSG_RESULT(no)
1352 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1353 ]
1354 )
1355fi
1356
Tim Rice8bb561b2005-03-17 16:23:19 -08001357if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1358 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001359 AC_MSG_CHECKING(if getaddrinfo seems to work)
1360 AC_TRY_RUN(
1361 [
1362#include <stdio.h>
1363#include <sys/socket.h>
1364#include <netdb.h>
1365#include <errno.h>
1366#include <netinet/in.h>
1367
1368#define TEST_PORT "2222"
1369
1370int
1371main(void)
1372{
1373 int err, sock;
1374 struct addrinfo *gai_ai, *ai, hints;
1375 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1376
1377 memset(&hints, 0, sizeof(hints));
1378 hints.ai_family = PF_UNSPEC;
1379 hints.ai_socktype = SOCK_STREAM;
1380 hints.ai_flags = AI_PASSIVE;
1381
1382 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1383 if (err != 0) {
1384 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1385 exit(1);
1386 }
1387
1388 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1389 if (ai->ai_family != AF_INET6)
1390 continue;
1391
1392 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1393 sizeof(ntop), strport, sizeof(strport),
1394 NI_NUMERICHOST|NI_NUMERICSERV);
1395
1396 if (err != 0) {
1397 if (err == EAI_SYSTEM)
1398 perror("getnameinfo EAI_SYSTEM");
1399 else
1400 fprintf(stderr, "getnameinfo failed: %s\n",
1401 gai_strerror(err));
1402 exit(2);
1403 }
1404
1405 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1406 if (sock < 0)
1407 perror("socket");
1408 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1409 if (errno == EBADF)
1410 exit(3);
1411 }
1412 }
1413 exit(0);
1414}
1415 ],
1416 [
1417 AC_MSG_RESULT(yes)
1418 ],
1419 [
1420 AC_MSG_RESULT(no)
1421 AC_DEFINE(BROKEN_GETADDRINFO)
1422 ]
1423 )
1424fi
1425
Tim Rice8bb561b2005-03-17 16:23:19 -08001426if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1427 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001428 AC_MSG_CHECKING(if getaddrinfo seems to work)
1429 AC_TRY_RUN(
1430 [
1431#include <stdio.h>
1432#include <sys/socket.h>
1433#include <netdb.h>
1434#include <errno.h>
1435#include <netinet/in.h>
1436
1437#define TEST_PORT "2222"
1438
1439int
1440main(void)
1441{
1442 int err, sock;
1443 struct addrinfo *gai_ai, *ai, hints;
1444 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1445
1446 memset(&hints, 0, sizeof(hints));
1447 hints.ai_family = PF_UNSPEC;
1448 hints.ai_socktype = SOCK_STREAM;
1449 hints.ai_flags = AI_PASSIVE;
1450
1451 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1452 if (err != 0) {
1453 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1454 exit(1);
1455 }
1456
1457 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1458 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1459 continue;
1460
1461 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1462 sizeof(ntop), strport, sizeof(strport),
1463 NI_NUMERICHOST|NI_NUMERICSERV);
1464
1465 if (ai->ai_family == AF_INET && err != 0) {
1466 perror("getnameinfo");
1467 exit(2);
1468 }
1469 }
1470 exit(0);
1471}
1472 ],
1473 [
1474 AC_MSG_RESULT(yes)
1475 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1476[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1477 ],
1478 [
1479 AC_MSG_RESULT(no)
1480 AC_DEFINE(BROKEN_GETADDRINFO)
1481 ]
1482 )
1483fi
1484
Darren Tuckera56f1912004-11-02 20:30:54 +11001485if test "x$check_for_conflicting_getspnam" = "x1"; then
1486 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1487 AC_COMPILE_IFELSE(
1488 [
1489#include <shadow.h>
1490int main(void) {exit(0);}
1491 ],
1492 [
1493 AC_MSG_RESULT(no)
1494 ],
1495 [
1496 AC_MSG_RESULT(yes)
1497 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1498 [Conflicting defs for getspnam])
1499 ]
1500 )
1501fi
1502
Damien Miller606f8802000-09-16 15:39:56 +11001503AC_FUNC_GETPGRP
1504
Damien Millera64b57a2001-01-17 10:44:13 +11001505# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001506PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001507AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001508 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001509 [
Damien Millera64b57a2001-01-17 10:44:13 +11001510 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001511 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1512 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001513 AC_MSG_ERROR([PAM headers not found])
1514 fi
1515
1516 AC_CHECK_LIB(dl, dlopen, , )
1517 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1518 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001519 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001520
Damien Millera64b57a2001-01-17 10:44:13 +11001521 PAM_MSG="yes"
1522
1523 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001524 if test $ac_cv_lib_dl_dlopen = yes; then
1525 LIBPAM="-lpam -ldl"
1526 else
1527 LIBPAM="-lpam"
1528 fi
1529 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001530 fi
1531 ]
1532)
Damien Millera22ba012000-03-02 23:09:20 +11001533
Damien Millera64b57a2001-01-17 10:44:13 +11001534# Check for older PAM
1535if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001536 # Check PAM strerror arguments (old PAM)
1537 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1538 AC_TRY_COMPILE(
1539 [
Damien Miller81171112000-04-23 11:14:01 +10001540#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001541#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001542#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001543#elif defined (HAVE_PAM_PAM_APPL_H)
1544#include <pam/pam_appl.h>
1545#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001546 ],
1547 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001548 [AC_MSG_RESULT(no)],
1549 [
1550 AC_DEFINE(HAVE_OLD_PAM)
1551 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001552 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001553 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001554 )
Damien Millera22ba012000-03-02 23:09:20 +11001555fi
1556
Tim Riceaef73712002-05-11 13:17:42 -07001557# Search for OpenSSL
1558saved_CPPFLAGS="$CPPFLAGS"
1559saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001560AC_ARG_WITH(ssl-dir,
1561 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1562 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001563 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001564 case "$withval" in
1565 # Relative paths
1566 ./*|../*) withval="`pwd`/$withval"
1567 esac
Tim Riceaef73712002-05-11 13:17:42 -07001568 if test -d "$withval/lib"; then
1569 if test -n "${need_dash_r}"; then
1570 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1571 else
1572 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1573 fi
1574 else
1575 if test -n "${need_dash_r}"; then
1576 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1577 else
1578 LDFLAGS="-L${withval} ${LDFLAGS}"
1579 fi
1580 fi
1581 if test -d "$withval/include"; then
1582 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1583 else
1584 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1585 fi
Damien Millera22ba012000-03-02 23:09:20 +11001586 fi
1587 ]
1588)
Tim Rice3d5352e2004-02-12 09:27:21 -08001589LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001590AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001591 [
Tim Riceaef73712002-05-11 13:17:42 -07001592 dnl Check default openssl install dir
1593 if test -n "${need_dash_r}"; then
1594 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001595 else
Tim Riceaef73712002-05-11 13:17:42 -07001596 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001597 fi
Tim Riceaef73712002-05-11 13:17:42 -07001598 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1599 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1600 [
1601 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1602 ]
1603 )
1604 ]
1605)
1606
Tim Riced730b782002-08-13 18:52:10 -07001607# Determine OpenSSL header version
1608AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001609AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001610 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001611#include <stdio.h>
1612#include <string.h>
1613#include <openssl/opensslv.h>
1614#define DATA "conftest.sslincver"
1615int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001616 FILE *fd;
1617 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001618
Damien Millera8e06ce2003-11-21 23:48:55 +11001619 fd = fopen(DATA,"w");
1620 if(fd == NULL)
1621 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001622
1623 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1624 exit(1);
1625
1626 exit(0);
1627}
Darren Tucker623d92f2004-09-12 22:36:15 +10001628 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001629 [
1630 ssl_header_ver=`cat conftest.sslincver`
1631 AC_MSG_RESULT($ssl_header_ver)
1632 ],
1633 [
1634 AC_MSG_RESULT(not found)
1635 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001636 ],
1637 [
1638 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001639 ]
1640)
1641
1642# Determine OpenSSL library version
1643AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001644AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001645 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001646#include <stdio.h>
1647#include <string.h>
1648#include <openssl/opensslv.h>
1649#include <openssl/crypto.h>
1650#define DATA "conftest.ssllibver"
1651int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001652 FILE *fd;
1653 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001654
Damien Millera8e06ce2003-11-21 23:48:55 +11001655 fd = fopen(DATA,"w");
1656 if(fd == NULL)
1657 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001658
1659 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1660 exit(1);
1661
1662 exit(0);
1663}
Darren Tucker623d92f2004-09-12 22:36:15 +10001664 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001665 [
1666 ssl_library_ver=`cat conftest.ssllibver`
1667 AC_MSG_RESULT($ssl_library_ver)
1668 ],
1669 [
1670 AC_MSG_RESULT(not found)
1671 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001672 ],
1673 [
1674 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001675 ]
1676)
Damien Millera22ba012000-03-02 23:09:20 +11001677
Damien Millerec932372002-01-22 22:16:03 +11001678# Sanity check OpenSSL headers
1679AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001680AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001681 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001682#include <string.h>
1683#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001684int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001685 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001686 [
1687 AC_MSG_RESULT(yes)
1688 ],
1689 [
1690 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001691 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1692Check config.log for details.
1693Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001694 ],
1695 [
1696 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001697 ]
1698)
1699
Tim Rice3d5352e2004-02-12 09:27:21 -08001700# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1701# because the system crypt() is more featureful.
1702if test "x$check_for_libcrypt_before" = "x1"; then
1703 AC_CHECK_LIB(crypt, crypt)
1704fi
1705
Damien Millera8e06ce2003-11-21 23:48:55 +11001706# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001707# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001708if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001709 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001710fi
1711
Damien Miller6c21c512002-01-22 21:57:53 +11001712
1713### Configure cryptographic random number support
1714
1715# Check wheter OpenSSL seeds itself
1716AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001717AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001718 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001719#include <string.h>
1720#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001721int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001722 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001723 [
1724 OPENSSL_SEEDS_ITSELF=yes
1725 AC_MSG_RESULT(yes)
1726 ],
1727 [
1728 AC_MSG_RESULT(no)
1729 # Default to use of the rand helper if OpenSSL doesn't
1730 # seed itself
1731 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001732 ],
1733 [
1734 AC_MSG_WARN([cross compiling: assuming yes])
1735 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001736 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001737 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001738 ]
1739)
1740
1741
1742# Do we want to force the use of the rand helper?
1743AC_ARG_WITH(rand-helper,
1744 [ --with-rand-helper Use subprocess to gather strong randomness ],
1745 [
1746 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001747 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001748 # the previous test showed it to be unseeded.
1749 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1750 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1751 OPENSSL_SEEDS_ITSELF=yes
1752 USE_RAND_HELPER=""
1753 fi
1754 else
1755 USE_RAND_HELPER=yes
1756 fi
1757 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001758)
Damien Miller6c21c512002-01-22 21:57:53 +11001759
1760# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001761if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001762 # OpenSSL only
1763 AC_DEFINE(OPENSSL_PRNG_ONLY)
1764 RAND_MSG="OpenSSL internal ONLY"
1765 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001766elif test ! -z "$USE_RAND_HELPER" ; then
1767 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001768 RAND_MSG="ssh-rand-helper"
1769 INSTALL_SSH_RAND_HELPER="yes"
1770fi
1771AC_SUBST(INSTALL_SSH_RAND_HELPER)
1772
1773### Configuration of ssh-rand-helper
1774
1775# PRNGD TCP socket
1776AC_ARG_WITH(prngd-port,
1777 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1778 [
Damien Millere996d722002-01-23 11:20:59 +11001779 case "$withval" in
1780 no)
1781 withval=""
1782 ;;
1783 [[0-9]]*)
1784 ;;
1785 *)
1786 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1787 ;;
1788 esac
1789 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001790 PRNGD_PORT="$withval"
1791 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1792 fi
1793 ]
1794)
1795
1796# PRNGD Unix domain socket
1797AC_ARG_WITH(prngd-socket,
1798 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1799 [
Damien Millere996d722002-01-23 11:20:59 +11001800 case "$withval" in
1801 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001802 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001803 ;;
1804 no)
1805 withval=""
1806 ;;
1807 /*)
1808 ;;
1809 *)
1810 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1811 ;;
1812 esac
1813
1814 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001815 if test ! -z "$PRNGD_PORT" ; then
1816 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1817 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001818 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001819 AC_MSG_WARN(Entropy socket is not readable)
1820 fi
1821 PRNGD_SOCKET="$withval"
1822 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1823 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001824 ],
1825 [
1826 # Check for existing socket only if we don't have a random device already
1827 if test "$USE_RAND_HELPER" = yes ; then
1828 AC_MSG_CHECKING(for PRNGD/EGD socket)
1829 # Insert other locations here
1830 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1831 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1832 PRNGD_SOCKET="$sock"
1833 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1834 break;
1835 fi
1836 done
1837 if test ! -z "$PRNGD_SOCKET" ; then
1838 AC_MSG_RESULT($PRNGD_SOCKET)
1839 else
1840 AC_MSG_RESULT(not found)
1841 fi
1842 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001843 ]
1844)
1845
1846# Change default command timeout for hashing entropy source
1847entropy_timeout=200
1848AC_ARG_WITH(entropy-timeout,
1849 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1850 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001851 if test -n "$withval" && test "x$withval" != "xno" && \
1852 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001853 entropy_timeout=$withval
1854 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001855 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001856)
Damien Miller6c21c512002-01-22 21:57:53 +11001857AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1858
Damien Millerd3f6ad22002-06-25 10:24:47 +10001859SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001860AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001861 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001862 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001863 if test -n "$withval" && test "x$withval" != "xno" && \
1864 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001865 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001866 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001867 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001868)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001869AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1870AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001871
Tim Rice88f2ab52002-03-17 12:17:34 -08001872# We do this little dance with the search path to insure
1873# that programs that we select for use by installed programs
1874# (which may be run by the super-user) come from trusted
1875# locations before they come from the user's private area.
1876# This should help avoid accidentally configuring some
1877# random version of a program in someone's personal bin.
1878
1879OPATH=$PATH
1880PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001881test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001882test -d /sbin && PATH=$PATH:/sbin
1883test -d /usr/sbin && PATH=$PATH:/usr/sbin
1884PATH=$PATH:/etc:$OPATH
1885
Damien Millera8e06ce2003-11-21 23:48:55 +11001886# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001887OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1888OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1889OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1890OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1891OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1892OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1893OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1894OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1895OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1896OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1897OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1898OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1899OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1900OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1901OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1902OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001903# restore PATH
1904PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001905
1906# Where does ssh-rand-helper get its randomness from?
1907INSTALL_SSH_PRNG_CMDS=""
1908if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1909 if test ! -z "$PRNGD_PORT" ; then
1910 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1911 elif test ! -z "$PRNGD_SOCKET" ; then
1912 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1913 else
1914 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1915 RAND_HELPER_CMDHASH=yes
1916 INSTALL_SSH_PRNG_CMDS="yes"
1917 fi
1918fi
1919AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1920
1921
Ben Lindstromb5628642000-10-18 00:02:25 +00001922# Cheap hack to ensure NEWS-OS libraries are arranged right.
1923if test ! -z "$SONY" ; then
1924 LIBS="$LIBS -liberty";
1925fi
1926
Damien Millera22ba012000-03-02 23:09:20 +11001927# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001928AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001929AC_CHECK_SIZEOF(short int, 2)
1930AC_CHECK_SIZEOF(int, 4)
1931AC_CHECK_SIZEOF(long int, 4)
1932AC_CHECK_SIZEOF(long long int, 8)
1933
Damien Millerfa2bb692002-04-23 23:22:25 +10001934# Sanity check long long for some platforms (AIX)
1935if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1936 ac_cv_sizeof_long_long_int=0
1937fi
1938
Damien Millera22ba012000-03-02 23:09:20 +11001939# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001940AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1941 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001942 [ #include <sys/types.h> ],
1943 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001944 [ ac_cv_have_u_int="yes" ],
1945 [ ac_cv_have_u_int="no" ]
1946 )
1947])
1948if test "x$ac_cv_have_u_int" = "xyes" ; then
1949 AC_DEFINE(HAVE_U_INT)
1950 have_u_int=1
1951fi
1952
Damien Miller61e50f12000-05-08 20:49:37 +10001953AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1954 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001955 [ #include <sys/types.h> ],
1956 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001957 [ ac_cv_have_intxx_t="yes" ],
1958 [ ac_cv_have_intxx_t="no" ]
1959 )
1960])
1961if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1962 AC_DEFINE(HAVE_INTXX_T)
1963 have_intxx_t=1
1964fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001965
1966if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001967 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001968then
1969 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1970 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001971 [ #include <stdint.h> ],
1972 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001973 [
1974 AC_DEFINE(HAVE_INTXX_T)
1975 AC_MSG_RESULT(yes)
1976 ],
1977 [ AC_MSG_RESULT(no) ]
1978 )
1979fi
1980
Damien Miller578783e2000-09-23 14:12:24 +11001981AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1982 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001983 [
1984#include <sys/types.h>
1985#ifdef HAVE_STDINT_H
1986# include <stdint.h>
1987#endif
1988#include <sys/socket.h>
1989#ifdef HAVE_SYS_BITYPES_H
1990# include <sys/bitypes.h>
1991#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001992 ],
1993 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001994 [ ac_cv_have_int64_t="yes" ],
1995 [ ac_cv_have_int64_t="no" ]
1996 )
1997])
1998if test "x$ac_cv_have_int64_t" = "xyes" ; then
1999 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08002000fi
2001
Damien Miller61e50f12000-05-08 20:49:37 +10002002AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2003 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002004 [ #include <sys/types.h> ],
2005 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002006 [ ac_cv_have_u_intxx_t="yes" ],
2007 [ ac_cv_have_u_intxx_t="no" ]
2008 )
2009])
2010if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2011 AC_DEFINE(HAVE_U_INTXX_T)
2012 have_u_intxx_t=1
2013fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002014
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002015if test -z "$have_u_intxx_t" ; then
2016 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2017 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002018 [ #include <sys/socket.h> ],
2019 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002020 [
2021 AC_DEFINE(HAVE_U_INTXX_T)
2022 AC_MSG_RESULT(yes)
2023 ],
2024 [ AC_MSG_RESULT(no) ]
2025 )
2026fi
2027
Damien Miller578783e2000-09-23 14:12:24 +11002028AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2029 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002030 [ #include <sys/types.h> ],
2031 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002032 [ ac_cv_have_u_int64_t="yes" ],
2033 [ ac_cv_have_u_int64_t="no" ]
2034 )
2035])
2036if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2037 AC_DEFINE(HAVE_U_INT64_T)
2038 have_u_int64_t=1
2039fi
2040
Tim Rice4cec93f2002-02-26 08:40:48 -08002041if test -z "$have_u_int64_t" ; then
2042 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2043 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002044 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002045 [ u_int64_t a; a = 1],
2046 [
2047 AC_DEFINE(HAVE_U_INT64_T)
2048 AC_MSG_RESULT(yes)
2049 ],
2050 [ AC_MSG_RESULT(no) ]
2051 )
2052fi
2053
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002054if test -z "$have_u_intxx_t" ; then
2055 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2056 AC_TRY_COMPILE(
2057 [
2058#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002059 ],
2060 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002061 [ ac_cv_have_uintxx_t="yes" ],
2062 [ ac_cv_have_uintxx_t="no" ]
2063 )
2064 ])
2065 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2066 AC_DEFINE(HAVE_UINTXX_T)
2067 fi
2068fi
2069
2070if test -z "$have_uintxx_t" ; then
2071 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2072 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002073 [ #include <stdint.h> ],
2074 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002075 [
2076 AC_DEFINE(HAVE_UINTXX_T)
2077 AC_MSG_RESULT(yes)
2078 ],
2079 [ AC_MSG_RESULT(no) ]
2080 )
2081fi
2082
Damien Milleredb82922000-06-20 13:25:52 +10002083if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002084 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002085then
2086 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2087 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002088 [
2089#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002090 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002091 [
Damien Miller70494d12000-04-03 15:57:06 +10002092 int8_t a; int16_t b; int32_t c;
2093 u_int8_t e; u_int16_t f; u_int32_t g;
2094 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002095 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002096 [
2097 AC_DEFINE(HAVE_U_INTXX_T)
2098 AC_DEFINE(HAVE_INTXX_T)
2099 AC_MSG_RESULT(yes)
2100 ],
2101 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002102 )
Damien Millerb29ea912000-01-15 14:12:03 +11002103fi
2104
Damien Miller58be7382001-09-15 21:31:54 +10002105
2106AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2107 AC_TRY_COMPILE(
2108 [
2109#include <sys/types.h>
2110 ],
2111 [ u_char foo; foo = 125; ],
2112 [ ac_cv_have_u_char="yes" ],
2113 [ ac_cv_have_u_char="no" ]
2114 )
2115])
2116if test "x$ac_cv_have_u_char" = "xyes" ; then
2117 AC_DEFINE(HAVE_U_CHAR)
2118fi
2119
Tim Rice13aae5e2001-10-21 17:53:58 -07002120TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002121
Tim Rice200a5c02002-02-26 22:12:34 -08002122AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002123
Damien Miller848b9932005-02-24 12:12:34 +11002124AC_CHECK_TYPES(in_addr_t,,,
2125[#include <sys/types.h>
2126#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002127
Damien Miller61e50f12000-05-08 20:49:37 +10002128AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2129 AC_TRY_COMPILE(
2130 [
2131#include <sys/types.h>
2132 ],
2133 [ size_t foo; foo = 1235; ],
2134 [ ac_cv_have_size_t="yes" ],
2135 [ ac_cv_have_size_t="no" ]
2136 )
2137])
2138if test "x$ac_cv_have_size_t" = "xyes" ; then
2139 AC_DEFINE(HAVE_SIZE_T)
2140fi
Damien Miller95058511999-12-29 10:36:45 +11002141
Damien Miller615f9392000-05-17 22:53:33 +10002142AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2143 AC_TRY_COMPILE(
2144 [
2145#include <sys/types.h>
2146 ],
2147 [ ssize_t foo; foo = 1235; ],
2148 [ ac_cv_have_ssize_t="yes" ],
2149 [ ac_cv_have_ssize_t="no" ]
2150 )
2151])
2152if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2153 AC_DEFINE(HAVE_SSIZE_T)
2154fi
2155
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002156AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2157 AC_TRY_COMPILE(
2158 [
2159#include <time.h>
2160 ],
2161 [ clock_t foo; foo = 1235; ],
2162 [ ac_cv_have_clock_t="yes" ],
2163 [ ac_cv_have_clock_t="no" ]
2164 )
2165])
2166if test "x$ac_cv_have_clock_t" = "xyes" ; then
2167 AC_DEFINE(HAVE_CLOCK_T)
2168fi
2169
Damien Millerb54b40e2000-06-23 08:23:34 +10002170AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2171 AC_TRY_COMPILE(
2172 [
2173#include <sys/types.h>
2174#include <sys/socket.h>
2175 ],
2176 [ sa_family_t foo; foo = 1235; ],
2177 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002178 [ AC_TRY_COMPILE(
2179 [
2180#include <sys/types.h>
2181#include <sys/socket.h>
2182#include <netinet/in.h>
2183 ],
2184 [ sa_family_t foo; foo = 1235; ],
2185 [ ac_cv_have_sa_family_t="yes" ],
2186
Damien Millerb54b40e2000-06-23 08:23:34 +10002187 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002188 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002189 )
2190])
2191if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2192 AC_DEFINE(HAVE_SA_FAMILY_T)
2193fi
2194
Damien Miller0f91b4e2000-06-18 15:43:25 +10002195AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2196 AC_TRY_COMPILE(
2197 [
2198#include <sys/types.h>
2199 ],
2200 [ pid_t foo; foo = 1235; ],
2201 [ ac_cv_have_pid_t="yes" ],
2202 [ ac_cv_have_pid_t="no" ]
2203 )
2204])
2205if test "x$ac_cv_have_pid_t" = "xyes" ; then
2206 AC_DEFINE(HAVE_PID_T)
2207fi
2208
2209AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2210 AC_TRY_COMPILE(
2211 [
2212#include <sys/types.h>
2213 ],
2214 [ mode_t foo; foo = 1235; ],
2215 [ ac_cv_have_mode_t="yes" ],
2216 [ ac_cv_have_mode_t="no" ]
2217 )
2218])
2219if test "x$ac_cv_have_mode_t" = "xyes" ; then
2220 AC_DEFINE(HAVE_MODE_T)
2221fi
2222
Damien Miller61e50f12000-05-08 20:49:37 +10002223
2224AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2225 AC_TRY_COMPILE(
2226 [
Damien Miller81171112000-04-23 11:14:01 +10002227#include <sys/types.h>
2228#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002229 ],
2230 [ struct sockaddr_storage s; ],
2231 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2232 [ ac_cv_have_struct_sockaddr_storage="no" ]
2233 )
2234])
2235if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2236 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2237fi
Damien Miller34132e52000-01-14 15:45:46 +11002238
Damien Miller61e50f12000-05-08 20:49:37 +10002239AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2240 AC_TRY_COMPILE(
2241 [
Damien Miller7b22d652000-06-18 14:07:04 +10002242#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002243#include <netinet/in.h>
2244 ],
2245 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2246 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2247 [ ac_cv_have_struct_sockaddr_in6="no" ]
2248 )
2249])
2250if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2251 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2252fi
Damien Miller34132e52000-01-14 15:45:46 +11002253
Damien Miller61e50f12000-05-08 20:49:37 +10002254AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2255 AC_TRY_COMPILE(
2256 [
Damien Miller7b22d652000-06-18 14:07:04 +10002257#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002258#include <netinet/in.h>
2259 ],
2260 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2261 [ ac_cv_have_struct_in6_addr="yes" ],
2262 [ ac_cv_have_struct_in6_addr="no" ]
2263 )
2264])
2265if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2266 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2267fi
Damien Miller34132e52000-01-14 15:45:46 +11002268
Damien Miller61e50f12000-05-08 20:49:37 +10002269AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2270 AC_TRY_COMPILE(
2271 [
Damien Miller81171112000-04-23 11:14:01 +10002272#include <sys/types.h>
2273#include <sys/socket.h>
2274#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002275 ],
2276 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2277 [ ac_cv_have_struct_addrinfo="yes" ],
2278 [ ac_cv_have_struct_addrinfo="no" ]
2279 )
2280])
2281if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2282 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2283fi
2284
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002285AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2286 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002287 [ #include <sys/time.h> ],
2288 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002289 [ ac_cv_have_struct_timeval="yes" ],
2290 [ ac_cv_have_struct_timeval="no" ]
2291 )
2292])
2293if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2294 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2295 have_struct_timeval=1
2296fi
2297
Tim Rice4e4dc562003-03-18 10:21:40 -08002298AC_CHECK_TYPES(struct timespec)
2299
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002300# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002301if test "x$ac_cv_have_int64_t" = "xno" && \
2302 test "x$ac_cv_sizeof_long_int" != "x8" && \
2303 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002304 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2305 echo "an alternative compiler (I.E., GCC) before continuing."
2306 echo ""
2307 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002308else
2309dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002310 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002311 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002312#include <stdio.h>
2313#include <string.h>
2314#ifdef HAVE_SNPRINTF
2315main()
2316{
2317 char buf[50];
2318 char expected_out[50];
2319 int mazsize = 50 ;
2320#if (SIZEOF_LONG_INT == 8)
2321 long int num = 0x7fffffffffffffff;
2322#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002323 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002324#endif
2325 strcpy(expected_out, "9223372036854775807");
2326 snprintf(buf, mazsize, "%lld", num);
2327 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002328 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002329 exit(0);
2330}
2331#else
2332main() { exit(0); }
2333#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002334 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002335 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002336 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002337fi
2338
Damien Miller78315eb2000-09-29 23:01:36 +11002339dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002340OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2341OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2342OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2343OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2344OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002345OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002346OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2347OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002348OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002349OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2350OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2351OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2352OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002353OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2354OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2355OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2356OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002357
2358AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002359
Damien Miller61e50f12000-05-08 20:49:37 +10002360AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2361 ac_cv_have_ss_family_in_struct_ss, [
2362 AC_TRY_COMPILE(
2363 [
Damien Miller81171112000-04-23 11:14:01 +10002364#include <sys/types.h>
2365#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002366 ],
2367 [ struct sockaddr_storage s; s.ss_family = 1; ],
2368 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2369 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2370 )
2371])
2372if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2373 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2374fi
2375
Damien Miller61e50f12000-05-08 20:49:37 +10002376AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2377 ac_cv_have___ss_family_in_struct_ss, [
2378 AC_TRY_COMPILE(
2379 [
Damien Miller81171112000-04-23 11:14:01 +10002380#include <sys/types.h>
2381#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002382 ],
2383 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2384 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2385 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2386 )
2387])
2388if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2389 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2390fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002391
Damien Millerad833b32000-08-23 10:46:23 +10002392AC_CACHE_CHECK([for pw_class field in struct passwd],
2393 ac_cv_have_pw_class_in_struct_passwd, [
2394 AC_TRY_COMPILE(
2395 [
Damien Millerad833b32000-08-23 10:46:23 +10002396#include <pwd.h>
2397 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002398 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002399 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2400 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2401 )
2402])
2403if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2404 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2405fi
2406
Kevin Steves82456952001-06-22 21:14:18 +00002407AC_CACHE_CHECK([for pw_expire field in struct passwd],
2408 ac_cv_have_pw_expire_in_struct_passwd, [
2409 AC_TRY_COMPILE(
2410 [
2411#include <pwd.h>
2412 ],
2413 [ struct passwd p; p.pw_expire = 0; ],
2414 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2415 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2416 )
2417])
2418if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2419 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2420fi
2421
2422AC_CACHE_CHECK([for pw_change field in struct passwd],
2423 ac_cv_have_pw_change_in_struct_passwd, [
2424 AC_TRY_COMPILE(
2425 [
2426#include <pwd.h>
2427 ],
2428 [ struct passwd p; p.pw_change = 0; ],
2429 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2430 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2431 )
2432])
2433if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2434 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2435fi
Damien Miller61e50f12000-05-08 20:49:37 +10002436
Tim Rice28bbb0c2002-05-27 17:37:32 -07002437dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002438AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2439 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002440 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002441 [
Tim Riceae49fe62002-04-12 10:26:21 -07002442#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002443#include <sys/socket.h>
2444#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002445int main() {
2446#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002447#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002448exit(1);
2449#endif
2450struct msghdr m;
2451m.msg_accrights = 0;
2452exit(0);
2453}
Kevin Steves939c9db2002-03-22 17:23:25 +00002454 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002455 [ ac_cv_have_accrights_in_msghdr="yes" ],
2456 [ ac_cv_have_accrights_in_msghdr="no" ]
2457 )
2458])
2459if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2460 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2461fi
2462
Kevin Stevesa44e0352002-04-07 16:18:03 +00002463AC_CACHE_CHECK([for msg_control field in struct msghdr],
2464 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002465 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002466 [
Tim Riceae49fe62002-04-12 10:26:21 -07002467#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002468#include <sys/socket.h>
2469#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002470int main() {
2471#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002472#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002473exit(1);
2474#endif
2475struct msghdr m;
2476m.msg_control = 0;
2477exit(0);
2478}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002479 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002480 [ ac_cv_have_control_in_msghdr="yes" ],
2481 [ ac_cv_have_control_in_msghdr="no" ]
2482 )
2483])
2484if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2485 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2486fi
2487
Damien Miller61e50f12000-05-08 20:49:37 +10002488AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002489 AC_TRY_LINK([],
2490 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002491 [ ac_cv_libc_defines___progname="yes" ],
2492 [ ac_cv_libc_defines___progname="no" ]
2493 )
2494])
2495if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2496 AC_DEFINE(HAVE___PROGNAME)
2497fi
2498
Kevin Steves4846f4a2002-03-22 18:19:53 +00002499AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2500 AC_TRY_LINK([
2501#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002502],
2503 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002504 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2505 [ ac_cv_cc_implements___FUNCTION__="no" ]
2506 )
2507])
2508if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2509 AC_DEFINE(HAVE___FUNCTION__)
2510fi
2511
2512AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2513 AC_TRY_LINK([
2514#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002515],
2516 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002517 [ ac_cv_cc_implements___func__="yes" ],
2518 [ ac_cv_cc_implements___func__="no" ]
2519 )
2520])
2521if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2522 AC_DEFINE(HAVE___func__)
2523fi
2524
Damien Miller4f8e6692001-07-14 13:22:53 +10002525AC_CACHE_CHECK([whether getopt has optreset support],
2526 ac_cv_have_getopt_optreset, [
2527 AC_TRY_LINK(
2528 [
2529#include <getopt.h>
2530 ],
2531 [ extern int optreset; optreset = 0; ],
2532 [ ac_cv_have_getopt_optreset="yes" ],
2533 [ ac_cv_have_getopt_optreset="no" ]
2534 )
2535])
2536if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2537 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2538fi
Damien Millera22ba012000-03-02 23:09:20 +11002539
Damien Millerecbb26d2000-07-15 14:59:14 +10002540AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002541 AC_TRY_LINK([],
2542 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002543 [ ac_cv_libc_defines_sys_errlist="yes" ],
2544 [ ac_cv_libc_defines_sys_errlist="no" ]
2545 )
2546])
2547if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2548 AC_DEFINE(HAVE_SYS_ERRLIST)
2549fi
2550
2551
Damien Miller11fa2cc2000-08-16 10:35:58 +10002552AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002553 AC_TRY_LINK([],
2554 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002555 [ ac_cv_libc_defines_sys_nerr="yes" ],
2556 [ ac_cv_libc_defines_sys_nerr="no" ]
2557 )
2558])
2559if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2560 AC_DEFINE(HAVE_SYS_NERR)
2561fi
2562
Damien Millera8e06ce2003-11-21 23:48:55 +11002563SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002564# Check whether user wants sectok support
2565AC_ARG_WITH(sectok,
2566 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002567 [
2568 if test "x$withval" != "xno" ; then
2569 if test "x$withval" != "xyes" ; then
2570 CPPFLAGS="$CPPFLAGS -I${withval}"
2571 LDFLAGS="$LDFLAGS -L${withval}"
2572 if test ! -z "$need_dash_r" ; then
2573 LDFLAGS="$LDFLAGS -R${withval}"
2574 fi
2575 if test ! -z "$blibpath" ; then
2576 blibpath="$blibpath:${withval}"
2577 fi
2578 fi
2579 AC_CHECK_HEADERS(sectok.h)
2580 if test "$ac_cv_header_sectok_h" != yes; then
2581 AC_MSG_ERROR(Can't find sectok.h)
2582 fi
2583 AC_CHECK_LIB(sectok, sectok_open)
2584 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2585 AC_MSG_ERROR(Can't find libsectok)
2586 fi
2587 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002588 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002589 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002590 fi
2591 ]
2592)
2593
2594# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002595OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002596AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002597 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2598 [
2599 if test "x$withval" != "xno" ; then
2600 if test "x$withval" != "xyes" ; then
2601 OPENSC_CONFIG=$withval/bin/opensc-config
2602 else
2603 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2604 fi
2605 if test "$OPENSC_CONFIG" != "no"; then
2606 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2607 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2608 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2609 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2610 AC_DEFINE(SMARTCARD)
2611 AC_DEFINE(USE_OPENSC)
2612 SCARD_MSG="yes, using OpenSC"
2613 fi
2614 fi
2615 ]
2616)
Damien Miller85de5802001-09-18 14:01:11 +10002617
Darren Tucker5f88d342003-10-15 16:57:57 +10002618# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002619AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002620 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002621 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002622 # Needed by our getrrsetbyname()
2623 AC_SEARCH_LIBS(res_query, resolv)
2624 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002625 AC_MSG_CHECKING(if res_query will link)
2626 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2627 [AC_MSG_RESULT(no)
2628 saved_LIBS="$LIBS"
2629 LIBS="$LIBS -lresolv"
2630 AC_MSG_CHECKING(for res_query in -lresolv)
2631 AC_LINK_IFELSE([
2632#include <resolv.h>
2633int main()
2634{
2635 res_query (0, 0, 0, 0, 0);
2636 return 0;
2637}
2638 ],
2639 [LIBS="$LIBS -lresolv"
2640 AC_MSG_RESULT(yes)],
2641 [LIBS="$saved_LIBS"
2642 AC_MSG_RESULT(no)])
2643 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002644 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002645 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002646 [#include <sys/types.h>
2647 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002648 AC_CHECK_MEMBER(HEADER.ad,
2649 [AC_DEFINE(HAVE_HEADER_AD)],,
2650 [#include <arpa/nameser.h>])
2651 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002652
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002653# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002654KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002655AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002656 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002657 [ if test "x$withval" != "xno" ; then
2658 if test "x$withval" = "xyes" ; then
2659 KRB5ROOT="/usr/local"
2660 else
2661 KRB5ROOT=${withval}
2662 fi
2663
2664 AC_DEFINE(KRB5)
2665 KRB5_MSG="yes"
2666
2667 AC_MSG_CHECKING(for krb5-config)
2668 if test -x $KRB5ROOT/bin/krb5-config ; then
2669 KRB5CONF=$KRB5ROOT/bin/krb5-config
2670 AC_MSG_RESULT($KRB5CONF)
2671
2672 AC_MSG_CHECKING(for gssapi support)
2673 if $KRB5CONF | grep gssapi >/dev/null ; then
2674 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002675 AC_DEFINE(GSSAPI)
2676 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002677 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002678 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002679 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002680 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002681 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2682 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002683 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002684 AC_MSG_CHECKING(whether we are using Heimdal)
2685 AC_TRY_COMPILE([ #include <krb5.h> ],
2686 [ char *tmp = heimdal_version; ],
2687 [ AC_MSG_RESULT(yes)
2688 AC_DEFINE(HEIMDAL) ],
2689 AC_MSG_RESULT(no)
2690 )
2691 else
2692 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002693 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002694 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002695 AC_MSG_CHECKING(whether we are using Heimdal)
2696 AC_TRY_COMPILE([ #include <krb5.h> ],
2697 [ char *tmp = heimdal_version; ],
2698 [ AC_MSG_RESULT(yes)
2699 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002700 K5LIBS="-lkrb5 -ldes"
2701 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002702 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002703 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002704 ],
2705 [ AC_MSG_RESULT(no)
2706 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2707 ]
2708 )
Damien Miller200d0a72003-06-30 19:21:36 +10002709 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002710
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002711 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2712 [ AC_DEFINE(GSSAPI)
2713 K5LIBS="-lgssapi $K5LIBS" ],
2714 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2715 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002716 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002717 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2718 $K5LIBS)
2719 ],
2720 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002721
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002722 AC_CHECK_HEADER(gssapi.h, ,
2723 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002724 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002725 AC_CHECK_HEADERS(gssapi.h, ,
2726 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002727 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002728 ]
2729 )
2730
2731 oldCPP="$CPPFLAGS"
2732 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2733 AC_CHECK_HEADER(gssapi_krb5.h, ,
2734 [ CPPFLAGS="$oldCPP" ])
2735
Damien Millera8e06ce2003-11-21 23:48:55 +11002736 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002737 if test ! -z "$need_dash_r" ; then
2738 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2739 fi
2740 if test ! -z "$blibpath" ; then
2741 blibpath="$blibpath:${KRB5ROOT}/lib"
2742 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002743 fi
2744
2745 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2746 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2747 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2748
2749 LIBS="$LIBS $K5LIBS"
2750 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2751 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002752)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002753
Damien Millera22ba012000-03-02 23:09:20 +11002754# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002755
Damien Millerf58c6722002-05-13 13:15:42 +10002756PRIVSEP_PATH=/var/empty
2757AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002758 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002759 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002760 if test -n "$withval" && test "x$withval" != "xno" && \
2761 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002762 PRIVSEP_PATH=$withval
2763 fi
2764 ]
2765)
2766AC_SUBST(PRIVSEP_PATH)
2767
Damien Millera22ba012000-03-02 23:09:20 +11002768AC_ARG_WITH(xauth,
2769 [ --with-xauth=PATH Specify path to xauth program ],
2770 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002771 if test -n "$withval" && test "x$withval" != "xno" && \
2772 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002773 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002774 fi
2775 ],
2776 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002777 TestPath="$PATH"
2778 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2779 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2780 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2781 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2782 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002783 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002784 xauth_path="/usr/openwin/bin/xauth"
2785 fi
2786 ]
2787)
2788
Damien Miller7d901272003-01-13 16:55:22 +11002789STRIP_OPT=-s
2790AC_ARG_ENABLE(strip,
2791 [ --disable-strip Disable calling strip(1) on install],
2792 [
2793 if test "x$enableval" = "xno" ; then
2794 STRIP_OPT=
2795 fi
2796 ]
2797)
2798AC_SUBST(STRIP_OPT)
2799
Damien Millera19cf472000-11-29 13:28:50 +11002800if test -z "$xauth_path" ; then
2801 XAUTH_PATH="undefined"
2802 AC_SUBST(XAUTH_PATH)
2803else
Damien Millera22ba012000-03-02 23:09:20 +11002804 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002805 XAUTH_PATH=$xauth_path
2806 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002807fi
Damien Millera22ba012000-03-02 23:09:20 +11002808
2809# Check for mail directory (last resort if we cannot get it from headers)
2810if test ! -z "$MAIL" ; then
2811 maildir=`dirname $MAIL`
2812 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2813fi
2814
Darren Tucker623d92f2004-09-12 22:36:15 +10002815if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002816 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2817 disable_ptmx_check=yes
2818fi
Damien Millera22ba012000-03-02 23:09:20 +11002819if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002820 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002821 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002822 [
2823 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2824 have_dev_ptmx=1
2825 ]
2826 )
2827 fi
Damien Millera22ba012000-03-02 23:09:20 +11002828fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002829
Darren Tucker623d92f2004-09-12 22:36:15 +10002830if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002831 AC_CHECK_FILE("/dev/ptc",
2832 [
2833 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2834 have_dev_ptc=1
2835 ]
2836 )
2837else
2838 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2839fi
Damien Miller204ad072000-03-02 23:56:12 +11002840
Damien Millera22ba012000-03-02 23:09:20 +11002841# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002842AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002843 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002844 [
Damien Miller897741e2001-04-16 10:41:46 +10002845 case "$withval" in
2846 man|cat|doc)
2847 MANTYPE=$withval
2848 ;;
2849 *)
2850 AC_MSG_ERROR(invalid man type: $withval)
2851 ;;
2852 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002853 ]
2854)
Ben Lindstrombc709922001-04-18 18:04:21 +00002855if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002856 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2857 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002858 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2859 MANTYPE=doc
2860 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2861 MANTYPE=man
2862 else
2863 MANTYPE=cat
2864 fi
2865fi
Damien Miller670a4b82000-01-22 13:53:11 +11002866AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002867if test "$MANTYPE" = "doc"; then
2868 mansubdir=man;
2869else
2870 mansubdir=$MANTYPE;
2871fi
2872AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002873
Damien Millera22ba012000-03-02 23:09:20 +11002874# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002875MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002876AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002877 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002878 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002879 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002880 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002881 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002882 fi
2883 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002884)
2885
Damien Millera22ba012000-03-02 23:09:20 +11002886# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002887AC_ARG_WITH(shadow,
2888 [ --without-shadow Disable shadow password support],
2889 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002890 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002891 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002892 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002893 fi
2894 ]
2895)
2896
Damien Miller1f335fb2000-06-26 11:31:33 +10002897if test -z "$disable_shadow" ; then
2898 AC_MSG_CHECKING([if the systems has expire shadow information])
2899 AC_TRY_COMPILE(
2900 [
2901#include <sys/types.h>
2902#include <shadow.h>
2903 struct spwd sp;
2904 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2905 [ sp_expire_available=yes ], []
2906 )
2907
2908 if test "x$sp_expire_available" = "xyes" ; then
2909 AC_MSG_RESULT(yes)
2910 AC_DEFINE(HAS_SHADOW_EXPIRE)
2911 else
2912 AC_MSG_RESULT(no)
2913 fi
2914fi
2915
Damien Millera22ba012000-03-02 23:09:20 +11002916# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002917if test ! -z "$IPADDR_IN_DISPLAY" ; then
2918 DISPLAY_HACK_MSG="yes"
2919 AC_DEFINE(IPADDR_IN_DISPLAY)
2920else
Damien Millera8e06ce2003-11-21 23:48:55 +11002921 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002922 AC_ARG_WITH(ipaddr-display,
2923 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2924 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002925 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002926 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002927 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002928 fi
2929 ]
2930 )
2931fi
Damien Miller76112de1999-12-21 11:18:08 +11002932
Darren Tuckere1a790d2003-09-16 11:52:19 +10002933# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002934AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002935 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002936 [ if test "x$enableval" = "xno"; then
2937 AC_MSG_NOTICE([/etc/default/login handling disabled])
2938 etc_default_login=no
2939 else
2940 etc_default_login=yes
2941 fi ],
2942 [ etc_default_login=yes ]
2943)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002944
Darren Tucker2f9573d2005-02-10 22:28:54 +11002945if test "x$etc_default_login" != "xno"; then
2946 AC_CHECK_FILE("/etc/default/login",
2947 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002948 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2949 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002950 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2951 elif test "x$external_path_file" = "x/etc/default/login"; then
2952 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2953 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002954fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002955
Tim Rice43a1c132002-04-17 21:19:14 -07002956dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002957if test $ac_cv_func_login_getcapbool = "yes" && \
2958 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002959 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002960fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002961
Damien Millera22ba012000-03-02 23:09:20 +11002962# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002963SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002964AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002965 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002966 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002967 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002968 AC_MSG_WARN([
2969--with-default-path=PATH has no effect on this system.
2970Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002971 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002972 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002973 AC_MSG_WARN([
2974--with-default-path=PATH will only be used if PATH is not defined in
2975$external_path_file .])
2976 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002977 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002978 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002979 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002980 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002981 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2982 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002983 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002984 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002985 AC_MSG_WARN([
2986If PATH is defined in $external_path_file, ensure the path to scp is included,
2987otherwise scp will not work.])
2988 fi
2989 AC_TRY_RUN(
2990 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002991/* find out what STDPATH is */
2992#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002993#ifdef HAVE_PATHS_H
2994# include <paths.h>
2995#endif
2996#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002997# ifdef _PATH_USERPATH /* Irix */
2998# define _PATH_STDPATH _PATH_USERPATH
2999# else
3000# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3001# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003002#endif
3003#include <sys/types.h>
3004#include <sys/stat.h>
3005#include <fcntl.h>
3006#define DATA "conftest.stdpath"
3007
3008main()
3009{
3010 FILE *fd;
3011 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003012
Tim Rice59ea0a02001-03-10 13:50:45 -08003013 fd = fopen(DATA,"w");
3014 if(fd == NULL)
3015 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003016
Tim Rice59ea0a02001-03-10 13:50:45 -08003017 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3018 exit(1);
3019
3020 exit(0);
3021}
3022 ], [ user_path=`cat conftest.stdpath` ],
3023 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3024 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3025 )
3026# make sure $bindir is in USER_PATH so scp will work
3027 t_bindir=`eval echo ${bindir}`
3028 case $t_bindir in
3029 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3030 esac
3031 case $t_bindir in
3032 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3033 esac
3034 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3035 if test $? -ne 0 ; then
3036 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3037 if test $? -ne 0 ; then
3038 user_path=$user_path:$t_bindir
3039 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3040 fi
3041 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003042 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003043)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003044if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003045 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3046 AC_SUBST(user_path)
3047fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003048
Damien Millera18bbd32002-05-13 10:48:57 +10003049# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003050AC_ARG_WITH(superuser-path,
3051 [ --with-superuser-path= Specify different path for super-user],
3052 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003053 if test -n "$withval" && test "x$withval" != "xno" && \
3054 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003055 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3056 superuser_path=$withval
3057 fi
3058 ]
3059)
3060
3061
Damien Miller61e50f12000-05-08 20:49:37 +10003062AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003063IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003064AC_ARG_WITH(4in6,
3065 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3066 [
3067 if test "x$withval" != "xno" ; then
3068 AC_MSG_RESULT(yes)
3069 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003070 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003071 else
3072 AC_MSG_RESULT(no)
3073 fi
3074 ],[
3075 if test "x$inet6_default_4in6" = "xyes"; then
3076 AC_MSG_RESULT([yes (default)])
3077 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003078 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003079 else
3080 AC_MSG_RESULT([no (default)])
3081 fi
3082 ]
3083)
3084
Damien Miller60396b02001-02-18 17:01:00 +11003085# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003086BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003087AC_ARG_WITH(bsd-auth,
3088 [ --with-bsd-auth Enable BSD auth support],
3089 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003090 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003091 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003092 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003093 fi
3094 ]
3095)
3096
Damien Millera22ba012000-03-02 23:09:20 +11003097# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003098piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003099# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003100if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003101 piddir=`eval echo ${sysconfdir}`
3102 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003103 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003104 esac
3105fi
3106
Tim Rice88f2ab52002-03-17 12:17:34 -08003107AC_ARG_WITH(pid-dir,
3108 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3109 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003110 if test -n "$withval" && test "x$withval" != "xno" && \
3111 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003112 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003113 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003114 AC_MSG_WARN([** no $piddir directory on this system **])
3115 fi
3116 fi
3117 ]
3118)
3119
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003120AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003121AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003122
andre2ff7b5d2000-06-03 14:57:40 +00003123dnl allow user to disable some login recording features
3124AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003125 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003126 [
3127 if test "x$enableval" = "xno" ; then
3128 AC_DEFINE(DISABLE_LASTLOG)
3129 fi
3130 ]
andre2ff7b5d2000-06-03 14:57:40 +00003131)
3132AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003133 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003134 [
3135 if test "x$enableval" = "xno" ; then
3136 AC_DEFINE(DISABLE_UTMP)
3137 fi
3138 ]
andre2ff7b5d2000-06-03 14:57:40 +00003139)
3140AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003141 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003142 [
3143 if test "x$enableval" = "xno" ; then
3144 AC_DEFINE(DISABLE_UTMPX)
3145 fi
3146 ]
andre2ff7b5d2000-06-03 14:57:40 +00003147)
3148AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003149 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003150 [
3151 if test "x$enableval" = "xno" ; then
3152 AC_DEFINE(DISABLE_WTMP)
3153 fi
3154 ]
andre2ff7b5d2000-06-03 14:57:40 +00003155)
3156AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003157 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003158 [
3159 if test "x$enableval" = "xno" ; then
3160 AC_DEFINE(DISABLE_WTMPX)
3161 fi
3162 ]
andre2ff7b5d2000-06-03 14:57:40 +00003163)
3164AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003165 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003166 [
3167 if test "x$enableval" = "xno" ; then
3168 AC_DEFINE(DISABLE_LOGIN)
3169 fi
3170 ]
andre2ff7b5d2000-06-03 14:57:40 +00003171)
3172AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003173 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003174 [
3175 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003176 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003177 fi
3178 ]
andre2ff7b5d2000-06-03 14:57:40 +00003179)
3180AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003181 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003182 [
3183 if test "x$enableval" = "xno" ; then
3184 AC_DEFINE(DISABLE_PUTUTXLINE)
3185 fi
3186 ]
andre2ff7b5d2000-06-03 14:57:40 +00003187)
3188AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003189 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003190 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003191 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003192 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003193 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003194 conf_lastlog_location=$withval
3195 fi
3196 ]
3197)
andre2ff7b5d2000-06-03 14:57:40 +00003198
3199dnl lastlog, [uw]tmpx? detection
3200dnl NOTE: set the paths in the platform section to avoid the
3201dnl need for command-line parameters
3202dnl lastlog and [uw]tmp are subject to a file search if all else fails
3203
3204dnl lastlog detection
3205dnl NOTE: the code itself will detect if lastlog is a directory
3206AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3207AC_TRY_COMPILE([
3208#include <sys/types.h>
3209#include <utmp.h>
3210#ifdef HAVE_LASTLOG_H
3211# include <lastlog.h>
3212#endif
Damien Miller2994e082000-06-04 15:51:47 +10003213#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003214# include <paths.h>
3215#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003216#ifdef HAVE_LOGIN_H
3217# include <login.h>
3218#endif
andre2ff7b5d2000-06-03 14:57:40 +00003219 ],
3220 [ char *lastlog = LASTLOG_FILE; ],
3221 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003222 [
3223 AC_MSG_RESULT(no)
3224 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3225 AC_TRY_COMPILE([
3226#include <sys/types.h>
3227#include <utmp.h>
3228#ifdef HAVE_LASTLOG_H
3229# include <lastlog.h>
3230#endif
3231#ifdef HAVE_PATHS_H
3232# include <paths.h>
3233#endif
3234 ],
3235 [ char *lastlog = _PATH_LASTLOG; ],
3236 [ AC_MSG_RESULT(yes) ],
3237 [
andree441aa32000-06-12 22:34:38 +00003238 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003239 system_lastlog_path=no
3240 ])
3241 ]
andre2ff7b5d2000-06-03 14:57:40 +00003242)
Damien Miller2994e082000-06-04 15:51:47 +10003243
andre2ff7b5d2000-06-03 14:57:40 +00003244if test -z "$conf_lastlog_location"; then
3245 if test x"$system_lastlog_path" = x"no" ; then
3246 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003247 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003248 conf_lastlog_location=$f
3249 fi
3250 done
3251 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003252 AC_MSG_WARN([** Cannot find lastlog **])
3253 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003254 fi
3255 fi
3256fi
3257
3258if test -n "$conf_lastlog_location"; then
3259 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003260fi
andre2ff7b5d2000-06-03 14:57:40 +00003261
3262dnl utmp detection
3263AC_MSG_CHECKING([if your system defines UTMP_FILE])
3264AC_TRY_COMPILE([
3265#include <sys/types.h>
3266#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003267#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003268# include <paths.h>
3269#endif
3270 ],
3271 [ char *utmp = UTMP_FILE; ],
3272 [ AC_MSG_RESULT(yes) ],
3273 [ AC_MSG_RESULT(no)
3274 system_utmp_path=no ]
3275)
3276if test -z "$conf_utmp_location"; then
3277 if test x"$system_utmp_path" = x"no" ; then
3278 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3279 if test -f $f ; then
3280 conf_utmp_location=$f
3281 fi
3282 done
3283 if test -z "$conf_utmp_location"; then
3284 AC_DEFINE(DISABLE_UTMP)
3285 fi
3286 fi
3287fi
3288if test -n "$conf_utmp_location"; then
3289 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003290fi
andre2ff7b5d2000-06-03 14:57:40 +00003291
3292dnl wtmp detection
3293AC_MSG_CHECKING([if your system defines WTMP_FILE])
3294AC_TRY_COMPILE([
3295#include <sys/types.h>
3296#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003297#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003298# include <paths.h>
3299#endif
3300 ],
3301 [ char *wtmp = WTMP_FILE; ],
3302 [ AC_MSG_RESULT(yes) ],
3303 [ AC_MSG_RESULT(no)
3304 system_wtmp_path=no ]
3305)
3306if test -z "$conf_wtmp_location"; then
3307 if test x"$system_wtmp_path" = x"no" ; then
3308 for f in /usr/adm/wtmp /var/log/wtmp; do
3309 if test -f $f ; then
3310 conf_wtmp_location=$f
3311 fi
3312 done
3313 if test -z "$conf_wtmp_location"; then
3314 AC_DEFINE(DISABLE_WTMP)
3315 fi
3316 fi
3317fi
3318if test -n "$conf_wtmp_location"; then
3319 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003320fi
andre2ff7b5d2000-06-03 14:57:40 +00003321
3322
3323dnl utmpx detection - I don't know any system so perverse as to require
3324dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3325dnl there, though.
3326AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3327AC_TRY_COMPILE([
3328#include <sys/types.h>
3329#include <utmp.h>
3330#ifdef HAVE_UTMPX_H
3331#include <utmpx.h>
3332#endif
Damien Miller2994e082000-06-04 15:51:47 +10003333#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003334# include <paths.h>
3335#endif
3336 ],
3337 [ char *utmpx = UTMPX_FILE; ],
3338 [ AC_MSG_RESULT(yes) ],
3339 [ AC_MSG_RESULT(no)
3340 system_utmpx_path=no ]
3341)
3342if test -z "$conf_utmpx_location"; then
3343 if test x"$system_utmpx_path" = x"no" ; then
3344 AC_DEFINE(DISABLE_UTMPX)
3345 fi
3346else
3347 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003348fi
andre2ff7b5d2000-06-03 14:57:40 +00003349
3350dnl wtmpx detection
3351AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3352AC_TRY_COMPILE([
3353#include <sys/types.h>
3354#include <utmp.h>
3355#ifdef HAVE_UTMPX_H
3356#include <utmpx.h>
3357#endif
Damien Miller2994e082000-06-04 15:51:47 +10003358#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003359# include <paths.h>
3360#endif
3361 ],
3362 [ char *wtmpx = WTMPX_FILE; ],
3363 [ AC_MSG_RESULT(yes) ],
3364 [ AC_MSG_RESULT(no)
3365 system_wtmpx_path=no ]
3366)
3367if test -z "$conf_wtmpx_location"; then
3368 if test x"$system_wtmpx_path" = x"no" ; then
3369 AC_DEFINE(DISABLE_WTMPX)
3370 fi
3371else
3372 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003373fi
andre2ff7b5d2000-06-03 14:57:40 +00003374
Damien Miller4018c192000-04-30 09:30:44 +10003375
Damien Miller29ea30d2000-03-17 10:54:15 +11003376if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003377 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3378 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003379fi
3380
Tim Rice4cec93f2002-02-26 08:40:48 -08003381dnl remove pam and dl because they are in $LIBPAM
3382if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003383 LIBS=`echo $LIBS | sed 's/-lpam //'`
3384fi
3385if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3386 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003387fi
3388
Darren Tucker7da23cb2005-08-03 00:20:15 +10003389dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3390dnl Add now.
3391CFLAGS="$CFLAGS $werror_flags"
3392
Damien Millerbac2d8a2000-09-05 16:13:06 +11003393AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003394AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3395 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003396AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003397
Damien Miller7b22d652000-06-18 14:07:04 +10003398# Print summary of options
3399
Damien Miller7b22d652000-06-18 14:07:04 +10003400# Someone please show me a better way :)
3401A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3402B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3403C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3404D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003405E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003406F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003407G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003408H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3409I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3410J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003411
3412echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003413echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003414echo " User binaries: $B"
3415echo " System binaries: $C"
3416echo " Configuration files: $D"
3417echo " Askpass program: $E"
3418echo " Manual pages: $F"
3419echo " PID file: $G"
3420echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003421if test "x$external_path_file" = "x/etc/login.conf" ; then
3422echo " At runtime, sshd will use the path defined in $external_path_file"
3423echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003424else
Damien Millerf58c6722002-05-13 13:15:42 +10003425echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003426 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003427echo " (If PATH is set in $external_path_file it will be used instead. If"
3428echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3429 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003430fi
Damien Millera18bbd32002-05-13 10:48:57 +10003431if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003432echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003433fi
Damien Millerf58c6722002-05-13 13:15:42 +10003434echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003435echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003436echo " KerberosV support: $KRB5_MSG"
3437echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003438echo " S/KEY support: $SKEY_MSG"
3439echo " TCP Wrappers support: $TCPW_MSG"
3440echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003441echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003442echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003443echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3444echo " BSD Auth support: $BSD_AUTH_MSG"
3445echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003446if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003447echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003448fi
3449
Damien Miller7b22d652000-06-18 14:07:04 +10003450echo ""
3451
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003452echo " Host: ${host}"
3453echo " Compiler: ${CC}"
3454echo " Compiler flags: ${CFLAGS}"
3455echo "Preprocessor flags: ${CPPFLAGS}"
3456echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003457echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003458
3459echo ""
3460
Tim Rice6f1f7582004-05-30 21:38:51 -07003461if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003462 echo "SVR4 style packages are supported with \"make package\""
3463 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003464fi
3465
Damien Miller82cf0ce2000-12-20 13:34:48 +11003466if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003467 echo "PAM is enabled. You may need to install a PAM control file "
3468 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003469 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003470 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003471 echo ""
3472fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003473
Damien Miller6c21c512002-01-22 21:57:53 +11003474if test ! -z "$RAND_HELPER_CMDHASH" ; then
3475 echo "WARNING: you are using the builtin random number collection "
3476 echo "service. Please read WARNING.RNG and request that your OS "
3477 echo "vendor includes kernel-based random number collection in "
3478 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003479 echo ""
3480fi
Damien Miller60396b02001-02-18 17:01:00 +11003481
Damien Millerb4097182004-05-23 14:09:40 +10003482if test ! -z "$NO_PEERCHECK" ; then
3483 echo "WARNING: the operating system that you are using does not "
3484 echo "appear to support either the getpeereid() API nor the "
3485 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3486 echo "enforce security checks to prevent unauthorised connections to "
3487 echo "ssh-agent. Their absence increases the risk that a malicious "
3488 echo "user can connect to your agent. "
3489 echo ""
3490fi
3491
Darren Tuckerd9f88912005-02-20 21:01:48 +11003492if test "$AUDIT_MODULE" = "bsm" ; then
3493 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3494 echo "See the Solaris section in README.platform for details."
3495fi