blob: df3712dcbb688554ae28c0b449e605d9031f5b21 [file] [log] [blame]
Darren Tuckerac1910f2005-07-26 12:00:42 +10001# $Id: configure.ac,v 1.280 2005/07/26 02:00:42 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080078
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100080
81AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
82
Damien Millera8e06ce2003-11-21 23:48:55 +110083if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100084 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien 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)
597
Darren Tucker6eb93042003-06-29 21:30:41 +1000598AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000599AC_RUN_IFELSE(
600 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000601#include <stdio.h>
602int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000603 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000604 [ AC_MSG_RESULT(yes) ],
605 [
606 AC_MSG_RESULT(no)
607 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000608 ],
609 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000610)
611
Darren Tucker0c9653f2005-05-28 15:58:14 +1000612dnl Checks for header files.
613AC_CHECK_HEADERS( \
614 bstring.h \
615 crypt.h \
616 dirent.h \
617 endian.h \
618 features.h \
619 floatingpoint.h \
620 getopt.h \
621 glob.h \
622 ia.h \
623 lastlog.h \
624 limits.h \
625 login.h \
626 login_cap.h \
627 maillock.h \
628 ndir.h \
629 netdb.h \
630 netgroup.h \
631 netinet/in_systm.h \
632 pam/pam_appl.h \
633 paths.h \
634 pty.h \
635 readpassphrase.h \
636 rpc/types.h \
637 security/pam_appl.h \
638 shadow.h \
639 stddef.h \
640 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000641 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000642 strings.h \
643 sys/audit.h \
644 sys/bitypes.h \
645 sys/bsdtty.h \
646 sys/cdefs.h \
647 sys/dir.h \
648 sys/mman.h \
649 sys/ndir.h \
650 sys/prctl.h \
651 sys/pstat.h \
652 sys/select.h \
653 sys/stat.h \
654 sys/stream.h \
655 sys/stropts.h \
656 sys/strtio.h \
657 sys/sysmacros.h \
658 sys/time.h \
659 sys/timers.h \
660 sys/un.h \
661 time.h \
662 tmpdir.h \
663 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000664 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000665 usersec.h \
666 util.h \
667 utime.h \
668 utmp.h \
669 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000670 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000671)
Tim Rice4cec93f2002-02-26 08:40:48 -0800672
Darren Tucker48d99d32004-08-29 17:04:50 +1000673# sys/ptms.h requires sys/stream.h to be included first on Solaris
674AC_CHECK_HEADERS(sys/ptms.h, [], [], [
675#ifdef HAVE_SYS_STREAM_H
676# include <sys/stream.h>
677#endif
678])
679
Damien Millera22ba012000-03-02 23:09:20 +1100680# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700681AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
682AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000683
Tim Rice1e1ef642003-09-11 22:19:31 -0700684dnl IRIX and Solaris 2.5.1 have dirname() in libgen
685AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
686 AC_CHECK_LIB(gen, dirname,[
687 AC_CACHE_CHECK([for broken dirname],
688 ac_cv_have_broken_dirname, [
689 save_LIBS="$LIBS"
690 LIBS="$LIBS -lgen"
691 AC_TRY_RUN(
692 [
693#include <libgen.h>
694#include <string.h>
695
696int main(int argc, char **argv) {
697 char *s, buf[32];
698
699 strncpy(buf,"/etc", 32);
700 s = dirname(buf);
701 if (!s || strncmp(s, "/", 32) != 0) {
702 exit(1);
703 } else {
704 exit(0);
705 }
706}
707 ],
708 [ ac_cv_have_broken_dirname="no" ],
709 [ ac_cv_have_broken_dirname="yes" ]
710 )
711 LIBS="$save_LIBS"
712 ])
713 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
714 LIBS="$LIBS -lgen"
715 AC_DEFINE(HAVE_DIRNAME)
716 AC_CHECK_HEADERS(libgen.h)
717 fi
718 ])
719])
720
721AC_CHECK_FUNC(getspnam, ,
722 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
723AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
724
Tim Rice13aae5e2001-10-21 17:53:58 -0700725dnl zlib is required
726AC_ARG_WITH(zlib,
727 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100728 [ if test "x$withval" = "xno" ; then
729 AC_MSG_ERROR([*** zlib is required ***])
730 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700731 if test -d "$withval/lib"; then
732 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700733 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700734 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700735 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700736 fi
737 else
738 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700739 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700740 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700741 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700742 fi
743 fi
744 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700745 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700746 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700747 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700748 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100749 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700750)
751
Tim Ricefcb62202004-01-23 18:35:16 -0800752AC_CHECK_LIB(z, deflate, ,
753 [
754 saved_CPPFLAGS="$CPPFLAGS"
755 saved_LDFLAGS="$LDFLAGS"
756 save_LIBS="$LIBS"
757 dnl Check default zlib install dir
758 if test -n "${need_dash_r}"; then
759 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
760 else
761 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
762 fi
763 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
764 LIBS="$LIBS -lz"
765 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
766 [
767 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
768 ]
769 )
770 ]
771)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100772AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100773
774AC_ARG_WITH(zlib-version-check,
775 [ --without-zlib-version-check Disable zlib version check],
776 [ if test "x$withval" = "xno" ; then
777 zlib_check_nonfatal=1
778 fi
779 ]
780)
781
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000782AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000783AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000784#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100785#include <zlib.h>
786int main()
787{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000788 int a=0, b=0, c=0, d=0, n, v;
789 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
790 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100791 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000792 v = a*1000000 + b*10000 + c*100 + d;
793 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
794
795 /* 1.1.4 is OK */
796 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100797 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000798
Darren Tucker41097ed2005-07-25 15:24:21 +1000799 /* 1.2.3 and up are OK */
800 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000801 exit(0);
802
Darren Tucker2dcd2392004-01-23 17:13:33 +1100803 exit(2);
804}
Darren Tucker623d92f2004-09-12 22:36:15 +1000805 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000806 AC_MSG_RESULT(no),
807 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100808 if test -z "$zlib_check_nonfatal" ; then
809 AC_MSG_ERROR([*** zlib too old - check config.log ***
810Your reported zlib version has known security problems. It's possible your
811vendor has fixed these problems without changing the version number. If you
812are sure this is the case, you can disable the check by running
813"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000814If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000815See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100816 else
817 AC_MSG_WARN([zlib version may have security problems])
818 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000819 ],
820 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100821)
Damien Miller6f9c3372000-10-25 10:06:04 +1100822
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000823dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100824AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000825 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
826)
Damien Millera8e06ce2003-11-21 23:48:55 +1100827AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700828 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
829 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000830)
Damien Millerab18c411999-11-11 10:40:23 +1100831
Tim Ricee589a292001-11-03 11:09:32 -0800832dnl Checks for libutil functions
833AC_CHECK_HEADERS(libutil.h)
834AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
835AC_CHECK_FUNCS(logout updwtmp logwtmp)
836
Ben Lindstrom8697e082001-02-24 21:41:10 +0000837AC_FUNC_STRFTIME
838
Damien Miller3c027682001-03-14 11:39:45 +1100839# Check for ALTDIRFUNC glob() extension
840AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
841AC_EGREP_CPP(FOUNDIT,
842 [
843 #include <glob.h>
844 #ifdef GLOB_ALTDIRFUNC
845 FOUNDIT
846 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100847 ],
Damien Miller3c027682001-03-14 11:39:45 +1100848 [
849 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
850 AC_MSG_RESULT(yes)
851 ],
852 [
853 AC_MSG_RESULT(no)
854 ]
855)
Damien Millerab18c411999-11-11 10:40:23 +1100856
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000857# Check for g.gl_matchc glob() extension
858AC_MSG_CHECKING(for gl_matchc field in glob_t)
859AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100860 [
861 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000862 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100863 ],
864 [
865 AC_DEFINE(GLOB_HAS_GL_MATCHC)
866 AC_MSG_RESULT(yes)
867 ],
868 [
869 AC_MSG_RESULT(no)
870 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000871)
872
Damien Miller18bb4732001-03-28 14:35:30 +1000873AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000874AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000875 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000876#include <sys/types.h>
877#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700878int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000879 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100880 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000881 [
882 AC_MSG_RESULT(no)
883 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000884 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800885 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000886 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
887 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000888 ]
889)
890
Damien Miller36f49652004-08-15 18:40:59 +1000891AC_MSG_CHECKING([for /proc/pid/fd directory])
892if test -d "/proc/$$/fd" ; then
893 AC_DEFINE(HAVE_PROC_PID)
894 AC_MSG_RESULT(yes)
895else
896 AC_MSG_RESULT(no)
897fi
898
Damien Millerc547bf12001-02-16 10:18:12 +1100899# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100900SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100901AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100902 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100903 [
904 if test "x$withval" != "xno" ; then
905
906 if test "x$withval" != "xyes" ; then
907 CPPFLAGS="$CPPFLAGS -I${withval}/include"
908 LDFLAGS="$LDFLAGS -L${withval}/lib"
909 fi
910
911 AC_DEFINE(SKEY)
912 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100913 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800914
Tim Rice4cec93f2002-02-26 08:40:48 -0800915 AC_MSG_CHECKING([for s/key support])
916 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100917 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800918#include <stdio.h>
919#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700920int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800921 ],
922 [AC_MSG_RESULT(yes)],
923 [
924 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100925 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
926 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000927 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
928 AC_TRY_COMPILE(
929 [#include <stdio.h>
930 #include <skey.h>],
931 [(void)skeychallenge(NULL,"name","",0);],
932 [AC_MSG_RESULT(yes)
933 AC_DEFINE(SKEYCHALLENGE_4ARG)],
934 [AC_MSG_RESULT(no)]
935 )
Damien Millerc547bf12001-02-16 10:18:12 +1100936 fi
937 ]
938)
939
940# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700941TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100942AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100943 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100944 [
945 if test "x$withval" != "xno" ; then
946 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700947 saved_LDFLAGS="$LDFLAGS"
948 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800949 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800950 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700951 if test -d "${withval}/lib"; then
952 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700953 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700954 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700955 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700956 fi
957 else
958 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700959 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700960 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700961 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700962 fi
963 fi
964 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700965 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700966 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700967 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700968 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700969 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800970 LIBWRAP="-lwrap"
971 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100972 AC_MSG_CHECKING(for libwrap)
973 AC_TRY_LINK(
974 [
Damien Miller0ac45002004-04-14 20:14:26 +1000975#include <sys/types.h>
976#include <sys/socket.h>
977#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100978#include <tcpd.h>
979 int deny_severity = 0, allow_severity = 0;
980 ],
981 [hosts_access(0);],
982 [
983 AC_MSG_RESULT(yes)
984 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800985 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700986 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100987 ],
988 [
989 AC_MSG_ERROR([*** libwrap missing])
990 ]
991 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800992 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100993 fi
994 ]
995)
996
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100997# Check whether user wants libedit support
998LIBEDIT_MSG="no"
999AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001000 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001001 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001002 if test "x$withval" != "xyes"; then
1003 CPPFLAGS="$CPPFLAGS -I$withval/include"
1004 LDFLAGS="$LDFLAGS -L$withval/lib"
1005 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001006 AC_CHECK_LIB(edit, el_init,
1007 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1008 LIBEDIT="-ledit -lcurses"
1009 LIBEDIT_MSG="yes"
1010 AC_SUBST(LIBEDIT)
1011 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001012 [ AC_MSG_ERROR(libedit not found) ],
1013 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001014 )
1015 fi ]
1016)
1017
Darren Tuckerd9f88912005-02-20 21:01:48 +11001018AUDIT_MODULE=none
1019AC_ARG_WITH(audit,
1020 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1021 [
1022 AC_MSG_CHECKING(for supported audit module)
1023 case "$withval" in
1024 bsm)
1025 AC_MSG_RESULT(bsm)
1026 AUDIT_MODULE=bsm
1027 dnl Checks for headers, libs and functions
1028 AC_CHECK_HEADERS(bsm/audit.h, [],
1029 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1030 AC_CHECK_LIB(bsm, getaudit, [],
1031 [AC_MSG_ERROR(BSM enabled and required library not found)])
1032 AC_CHECK_FUNCS(getaudit, [],
1033 [AC_MSG_ERROR(BSM enabled and required function not found)])
1034 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001035 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001036 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1037 ;;
1038 debug)
1039 AUDIT_MODULE=debug
1040 AC_MSG_RESULT(debug)
1041 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1042 ;;
1043 *)
1044 AC_MSG_ERROR([Unknown audit module $withval])
1045 ;;
1046 esac ]
1047)
1048
Damien Millerfe1f1432003-02-24 15:45:42 +11001049dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001050AC_CHECK_FUNCS( \
1051 arc4random \
1052 b64_ntop \
1053 __b64_ntop \
1054 b64_pton \
1055 __b64_pton \
1056 bcopy \
1057 bindresvport_sa \
1058 clock \
1059 closefrom \
1060 dirfd \
1061 fchdir \
1062 fchmod \
1063 fchown \
1064 freeaddrinfo \
1065 futimes \
1066 getaddrinfo \
1067 getcwd \
1068 getgrouplist \
1069 getnameinfo \
1070 getopt \
1071 getpeereid \
1072 _getpty \
1073 getrlimit \
1074 getttyent \
1075 glob \
1076 inet_aton \
1077 inet_ntoa \
1078 inet_ntop \
1079 innetgr \
1080 login_getcapbool \
1081 md5_crypt \
1082 memmove \
1083 mkdtemp \
1084 mmap \
1085 ngetaddrinfo \
1086 nsleep \
1087 ogetaddrinfo \
1088 openlog_r \
1089 openpty \
1090 prctl \
1091 pstat \
1092 readpassphrase \
1093 realpath \
1094 recvmsg \
1095 rresvport_af \
1096 sendmsg \
1097 setdtablesize \
1098 setegid \
1099 setenv \
1100 seteuid \
1101 setgroups \
1102 setlogin \
1103 setpcred \
1104 setproctitle \
1105 setregid \
1106 setreuid \
1107 setrlimit \
1108 setsid \
1109 setvbuf \
1110 sigaction \
1111 sigvec \
1112 snprintf \
1113 socketpair \
1114 strdup \
1115 strerror \
1116 strlcat \
1117 strlcpy \
1118 strmode \
1119 strnvis \
1120 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001121 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001122 strtoul \
1123 sysconf \
1124 tcgetpgrp \
1125 truncate \
1126 unsetenv \
1127 updwtmpx \
1128 utimes \
1129 vhangup \
1130 vsnprintf \
1131 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001132)
Tim Rice13aae5e2001-10-21 17:53:58 -07001133
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001134# IRIX has a const char return value for gai_strerror()
1135AC_CHECK_FUNCS(gai_strerror,[
1136 AC_DEFINE(HAVE_GAI_STRERROR)
1137 AC_TRY_COMPILE([
1138#include <sys/types.h>
1139#include <sys/socket.h>
1140#include <netdb.h>
1141
1142const char *gai_strerror(int);],[
1143char *str;
1144
1145str = gai_strerror(0);],[
1146 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1147 [Define if gai_strerror() returns const char *])])])
1148
Damien Millercd6853c2003-01-28 11:33:42 +11001149AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1150
Darren Tuckerf1159b52003-07-07 19:44:01 +10001151dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001152AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001153AC_CHECK_DECL(strsep,
1154 [AC_CHECK_FUNCS(strsep)],
1155 [],
1156 [
1157#ifdef HAVE_STRING_H
1158# include <string.h>
1159#endif
1160 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001161
Darren Tuckerb2427c82003-09-10 15:22:44 +10001162dnl tcsendbreak might be a macro
1163AC_CHECK_DECL(tcsendbreak,
1164 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001165 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001166 [#include <termios.h>]
1167)
1168
Darren Tucker5bb14002004-04-23 18:53:10 +10001169AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1170
Darren Tucker2a6b0292003-12-31 14:59:17 +11001171AC_CHECK_FUNCS(setresuid, [
1172 dnl Some platorms have setresuid that isn't implemented, test for this
1173 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001174 AC_RUN_IFELSE(
1175 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001176#include <stdlib.h>
1177#include <errno.h>
1178int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001179 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001180 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001181 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001182 AC_MSG_RESULT(not implemented)],
1183 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001184 )
1185])
Darren Tuckere937be32003-12-17 18:53:26 +11001186
Darren Tucker2a6b0292003-12-31 14:59:17 +11001187AC_CHECK_FUNCS(setresgid, [
1188 dnl Some platorms have setresgid that isn't implemented, test for this
1189 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001190 AC_RUN_IFELSE(
1191 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001192#include <stdlib.h>
1193#include <errno.h>
1194int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001195 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001196 [AC_MSG_RESULT(yes)],
1197 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001198 AC_MSG_RESULT(not implemented)],
1199 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001200 )
1201])
Darren Tuckere937be32003-12-17 18:53:26 +11001202
Damien Millerad833b32000-08-23 10:46:23 +10001203dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001204AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001205dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001206AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001207AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001208dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001209AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001210AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001211
Damien Millera8e06ce2003-11-21 23:48:55 +11001212AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001213 [AC_DEFINE(HAVE_DAEMON)],
1214 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1215)
1216
Damien Millera8e06ce2003-11-21 23:48:55 +11001217AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001218 [AC_DEFINE(HAVE_GETPAGESIZE)],
1219 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1220)
1221
Damien Millercb170cb2000-07-01 16:52:55 +10001222# Check for broken snprintf
1223if test "x$ac_cv_func_snprintf" = "xyes" ; then
1224 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001225 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001226 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001227#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001228int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001229 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001230 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001231 [
1232 AC_MSG_RESULT(no)
1233 AC_DEFINE(BROKEN_SNPRINTF)
1234 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001235 ],
1236 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001237 )
1238fi
1239
Damien Millerb4097182004-05-23 14:09:40 +10001240# Check for missing getpeereid (or equiv) support
1241NO_PEERCHECK=""
1242if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1243 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1244 AC_TRY_COMPILE(
1245 [#include <sys/types.h>
1246 #include <sys/socket.h>],
1247 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001248 [ AC_MSG_RESULT(yes)
1249 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1250 ],
Damien Millerb4097182004-05-23 14:09:40 +10001251 [AC_MSG_RESULT(no)
1252 NO_PEERCHECK=1]
1253 )
1254fi
1255
Damien Millere8328192003-01-07 15:18:32 +11001256dnl see whether mkstemp() requires XXXXXX
1257if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1258AC_MSG_CHECKING([for (overly) strict mkstemp])
1259AC_TRY_RUN(
1260 [
1261#include <stdlib.h>
1262main() { char template[]="conftest.mkstemp-test";
1263if (mkstemp(template) == -1)
1264 exit(1);
1265unlink(template); exit(0);
1266}
1267 ],
1268 [
1269 AC_MSG_RESULT(no)
1270 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001271 [
Damien Millere8328192003-01-07 15:18:32 +11001272 AC_MSG_RESULT(yes)
1273 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1274 ],
1275 [
1276 AC_MSG_RESULT(yes)
1277 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001278 ]
Damien Millere8328192003-01-07 15:18:32 +11001279)
1280fi
1281
Darren Tucker70a3d552003-08-21 17:58:29 +10001282dnl make sure that openpty does not reacquire controlling terminal
1283if test ! -z "$check_for_openpty_ctty_bug"; then
1284 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1285 AC_TRY_RUN(
1286 [
1287#include <stdio.h>
1288#include <sys/fcntl.h>
1289#include <sys/types.h>
1290#include <sys/wait.h>
1291
1292int
1293main()
1294{
1295 pid_t pid;
1296 int fd, ptyfd, ttyfd, status;
1297
1298 pid = fork();
1299 if (pid < 0) { /* failed */
1300 exit(1);
1301 } else if (pid > 0) { /* parent */
1302 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001303 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001304 exit(WEXITSTATUS(status));
1305 else
1306 exit(2);
1307 } else { /* child */
1308 close(0); close(1); close(2);
1309 setsid();
1310 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1311 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1312 if (fd >= 0)
1313 exit(3); /* Acquired ctty: broken */
1314 else
1315 exit(0); /* Did not acquire ctty: OK */
1316 }
1317}
1318 ],
1319 [
1320 AC_MSG_RESULT(yes)
1321 ],
1322 [
1323 AC_MSG_RESULT(no)
1324 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1325 ]
1326 )
1327fi
1328
Tim Rice8bb561b2005-03-17 16:23:19 -08001329if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1330 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001331 AC_MSG_CHECKING(if getaddrinfo seems to work)
1332 AC_TRY_RUN(
1333 [
1334#include <stdio.h>
1335#include <sys/socket.h>
1336#include <netdb.h>
1337#include <errno.h>
1338#include <netinet/in.h>
1339
1340#define TEST_PORT "2222"
1341
1342int
1343main(void)
1344{
1345 int err, sock;
1346 struct addrinfo *gai_ai, *ai, hints;
1347 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1348
1349 memset(&hints, 0, sizeof(hints));
1350 hints.ai_family = PF_UNSPEC;
1351 hints.ai_socktype = SOCK_STREAM;
1352 hints.ai_flags = AI_PASSIVE;
1353
1354 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1355 if (err != 0) {
1356 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1357 exit(1);
1358 }
1359
1360 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1361 if (ai->ai_family != AF_INET6)
1362 continue;
1363
1364 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1365 sizeof(ntop), strport, sizeof(strport),
1366 NI_NUMERICHOST|NI_NUMERICSERV);
1367
1368 if (err != 0) {
1369 if (err == EAI_SYSTEM)
1370 perror("getnameinfo EAI_SYSTEM");
1371 else
1372 fprintf(stderr, "getnameinfo failed: %s\n",
1373 gai_strerror(err));
1374 exit(2);
1375 }
1376
1377 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1378 if (sock < 0)
1379 perror("socket");
1380 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1381 if (errno == EBADF)
1382 exit(3);
1383 }
1384 }
1385 exit(0);
1386}
1387 ],
1388 [
1389 AC_MSG_RESULT(yes)
1390 ],
1391 [
1392 AC_MSG_RESULT(no)
1393 AC_DEFINE(BROKEN_GETADDRINFO)
1394 ]
1395 )
1396fi
1397
Tim Rice8bb561b2005-03-17 16:23:19 -08001398if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1399 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001400 AC_MSG_CHECKING(if getaddrinfo seems to work)
1401 AC_TRY_RUN(
1402 [
1403#include <stdio.h>
1404#include <sys/socket.h>
1405#include <netdb.h>
1406#include <errno.h>
1407#include <netinet/in.h>
1408
1409#define TEST_PORT "2222"
1410
1411int
1412main(void)
1413{
1414 int err, sock;
1415 struct addrinfo *gai_ai, *ai, hints;
1416 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1417
1418 memset(&hints, 0, sizeof(hints));
1419 hints.ai_family = PF_UNSPEC;
1420 hints.ai_socktype = SOCK_STREAM;
1421 hints.ai_flags = AI_PASSIVE;
1422
1423 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1424 if (err != 0) {
1425 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1426 exit(1);
1427 }
1428
1429 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1430 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1431 continue;
1432
1433 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1434 sizeof(ntop), strport, sizeof(strport),
1435 NI_NUMERICHOST|NI_NUMERICSERV);
1436
1437 if (ai->ai_family == AF_INET && err != 0) {
1438 perror("getnameinfo");
1439 exit(2);
1440 }
1441 }
1442 exit(0);
1443}
1444 ],
1445 [
1446 AC_MSG_RESULT(yes)
1447 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1448[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1449 ],
1450 [
1451 AC_MSG_RESULT(no)
1452 AC_DEFINE(BROKEN_GETADDRINFO)
1453 ]
1454 )
1455fi
1456
Darren Tuckera56f1912004-11-02 20:30:54 +11001457if test "x$check_for_conflicting_getspnam" = "x1"; then
1458 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1459 AC_COMPILE_IFELSE(
1460 [
1461#include <shadow.h>
1462int main(void) {exit(0);}
1463 ],
1464 [
1465 AC_MSG_RESULT(no)
1466 ],
1467 [
1468 AC_MSG_RESULT(yes)
1469 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1470 [Conflicting defs for getspnam])
1471 ]
1472 )
1473fi
1474
Damien Miller606f8802000-09-16 15:39:56 +11001475AC_FUNC_GETPGRP
1476
Damien Millera64b57a2001-01-17 10:44:13 +11001477# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001478PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001479AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001480 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001481 [
Damien Millera64b57a2001-01-17 10:44:13 +11001482 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001483 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1484 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001485 AC_MSG_ERROR([PAM headers not found])
1486 fi
1487
1488 AC_CHECK_LIB(dl, dlopen, , )
1489 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1490 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001491 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001492
Damien Millera64b57a2001-01-17 10:44:13 +11001493 PAM_MSG="yes"
1494
1495 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001496 if test $ac_cv_lib_dl_dlopen = yes; then
1497 LIBPAM="-lpam -ldl"
1498 else
1499 LIBPAM="-lpam"
1500 fi
1501 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001502 fi
1503 ]
1504)
Damien Millera22ba012000-03-02 23:09:20 +11001505
Damien Millera64b57a2001-01-17 10:44:13 +11001506# Check for older PAM
1507if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001508 # Check PAM strerror arguments (old PAM)
1509 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1510 AC_TRY_COMPILE(
1511 [
Damien Miller81171112000-04-23 11:14:01 +10001512#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001513#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001514#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001515#elif defined (HAVE_PAM_PAM_APPL_H)
1516#include <pam/pam_appl.h>
1517#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001518 ],
1519 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001520 [AC_MSG_RESULT(no)],
1521 [
1522 AC_DEFINE(HAVE_OLD_PAM)
1523 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001524 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001525 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001526 )
Damien Millera22ba012000-03-02 23:09:20 +11001527fi
1528
Tim Riceaef73712002-05-11 13:17:42 -07001529# Search for OpenSSL
1530saved_CPPFLAGS="$CPPFLAGS"
1531saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001532AC_ARG_WITH(ssl-dir,
1533 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1534 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001535 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001536 case "$withval" in
1537 # Relative paths
1538 ./*|../*) withval="`pwd`/$withval"
1539 esac
Tim Riceaef73712002-05-11 13:17:42 -07001540 if test -d "$withval/lib"; then
1541 if test -n "${need_dash_r}"; then
1542 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1543 else
1544 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1545 fi
1546 else
1547 if test -n "${need_dash_r}"; then
1548 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1549 else
1550 LDFLAGS="-L${withval} ${LDFLAGS}"
1551 fi
1552 fi
1553 if test -d "$withval/include"; then
1554 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1555 else
1556 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1557 fi
Damien Millera22ba012000-03-02 23:09:20 +11001558 fi
1559 ]
1560)
Tim Rice3d5352e2004-02-12 09:27:21 -08001561LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001562AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001563 [
Tim Riceaef73712002-05-11 13:17:42 -07001564 dnl Check default openssl install dir
1565 if test -n "${need_dash_r}"; then
1566 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001567 else
Tim Riceaef73712002-05-11 13:17:42 -07001568 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001569 fi
Tim Riceaef73712002-05-11 13:17:42 -07001570 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1571 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1572 [
1573 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1574 ]
1575 )
1576 ]
1577)
1578
Tim Riced730b782002-08-13 18:52:10 -07001579# Determine OpenSSL header version
1580AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001581AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001582 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001583#include <stdio.h>
1584#include <string.h>
1585#include <openssl/opensslv.h>
1586#define DATA "conftest.sslincver"
1587int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001588 FILE *fd;
1589 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001590
Damien Millera8e06ce2003-11-21 23:48:55 +11001591 fd = fopen(DATA,"w");
1592 if(fd == NULL)
1593 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001594
1595 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1596 exit(1);
1597
1598 exit(0);
1599}
Darren Tucker623d92f2004-09-12 22:36:15 +10001600 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001601 [
1602 ssl_header_ver=`cat conftest.sslincver`
1603 AC_MSG_RESULT($ssl_header_ver)
1604 ],
1605 [
1606 AC_MSG_RESULT(not found)
1607 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001608 ],
1609 [
1610 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001611 ]
1612)
1613
1614# Determine OpenSSL library version
1615AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001616AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001617 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001618#include <stdio.h>
1619#include <string.h>
1620#include <openssl/opensslv.h>
1621#include <openssl/crypto.h>
1622#define DATA "conftest.ssllibver"
1623int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001624 FILE *fd;
1625 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001626
Damien Millera8e06ce2003-11-21 23:48:55 +11001627 fd = fopen(DATA,"w");
1628 if(fd == NULL)
1629 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001630
1631 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1632 exit(1);
1633
1634 exit(0);
1635}
Darren Tucker623d92f2004-09-12 22:36:15 +10001636 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001637 [
1638 ssl_library_ver=`cat conftest.ssllibver`
1639 AC_MSG_RESULT($ssl_library_ver)
1640 ],
1641 [
1642 AC_MSG_RESULT(not found)
1643 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001644 ],
1645 [
1646 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001647 ]
1648)
Damien Millera22ba012000-03-02 23:09:20 +11001649
Damien Millerec932372002-01-22 22:16:03 +11001650# Sanity check OpenSSL headers
1651AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001652AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001653 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001654#include <string.h>
1655#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001656int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001657 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001658 [
1659 AC_MSG_RESULT(yes)
1660 ],
1661 [
1662 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001663 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1664Check config.log for details.
1665Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001666 ],
1667 [
1668 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001669 ]
1670)
1671
Tim Rice3d5352e2004-02-12 09:27:21 -08001672# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1673# because the system crypt() is more featureful.
1674if test "x$check_for_libcrypt_before" = "x1"; then
1675 AC_CHECK_LIB(crypt, crypt)
1676fi
1677
Damien Millera8e06ce2003-11-21 23:48:55 +11001678# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001679# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001680if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001681 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001682fi
1683
Damien Miller6c21c512002-01-22 21:57:53 +11001684
1685### Configure cryptographic random number support
1686
1687# Check wheter OpenSSL seeds itself
1688AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001689AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001690 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001691#include <string.h>
1692#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001693int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001694 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001695 [
1696 OPENSSL_SEEDS_ITSELF=yes
1697 AC_MSG_RESULT(yes)
1698 ],
1699 [
1700 AC_MSG_RESULT(no)
1701 # Default to use of the rand helper if OpenSSL doesn't
1702 # seed itself
1703 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001704 ],
1705 [
1706 AC_MSG_WARN([cross compiling: assuming yes])
1707 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001708 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001709 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001710 ]
1711)
1712
1713
1714# Do we want to force the use of the rand helper?
1715AC_ARG_WITH(rand-helper,
1716 [ --with-rand-helper Use subprocess to gather strong randomness ],
1717 [
1718 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001719 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001720 # the previous test showed it to be unseeded.
1721 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1722 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1723 OPENSSL_SEEDS_ITSELF=yes
1724 USE_RAND_HELPER=""
1725 fi
1726 else
1727 USE_RAND_HELPER=yes
1728 fi
1729 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001730)
Damien Miller6c21c512002-01-22 21:57:53 +11001731
1732# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001733if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001734 # OpenSSL only
1735 AC_DEFINE(OPENSSL_PRNG_ONLY)
1736 RAND_MSG="OpenSSL internal ONLY"
1737 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001738elif test ! -z "$USE_RAND_HELPER" ; then
1739 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001740 RAND_MSG="ssh-rand-helper"
1741 INSTALL_SSH_RAND_HELPER="yes"
1742fi
1743AC_SUBST(INSTALL_SSH_RAND_HELPER)
1744
1745### Configuration of ssh-rand-helper
1746
1747# PRNGD TCP socket
1748AC_ARG_WITH(prngd-port,
1749 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1750 [
Damien Millere996d722002-01-23 11:20:59 +11001751 case "$withval" in
1752 no)
1753 withval=""
1754 ;;
1755 [[0-9]]*)
1756 ;;
1757 *)
1758 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1759 ;;
1760 esac
1761 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001762 PRNGD_PORT="$withval"
1763 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1764 fi
1765 ]
1766)
1767
1768# PRNGD Unix domain socket
1769AC_ARG_WITH(prngd-socket,
1770 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1771 [
Damien Millere996d722002-01-23 11:20:59 +11001772 case "$withval" in
1773 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001774 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001775 ;;
1776 no)
1777 withval=""
1778 ;;
1779 /*)
1780 ;;
1781 *)
1782 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1783 ;;
1784 esac
1785
1786 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001787 if test ! -z "$PRNGD_PORT" ; then
1788 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1789 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001790 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001791 AC_MSG_WARN(Entropy socket is not readable)
1792 fi
1793 PRNGD_SOCKET="$withval"
1794 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1795 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001796 ],
1797 [
1798 # Check for existing socket only if we don't have a random device already
1799 if test "$USE_RAND_HELPER" = yes ; then
1800 AC_MSG_CHECKING(for PRNGD/EGD socket)
1801 # Insert other locations here
1802 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1803 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1804 PRNGD_SOCKET="$sock"
1805 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1806 break;
1807 fi
1808 done
1809 if test ! -z "$PRNGD_SOCKET" ; then
1810 AC_MSG_RESULT($PRNGD_SOCKET)
1811 else
1812 AC_MSG_RESULT(not found)
1813 fi
1814 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001815 ]
1816)
1817
1818# Change default command timeout for hashing entropy source
1819entropy_timeout=200
1820AC_ARG_WITH(entropy-timeout,
1821 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1822 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001823 if test -n "$withval" && test "x$withval" != "xno" && \
1824 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001825 entropy_timeout=$withval
1826 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001827 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001828)
Damien Miller6c21c512002-01-22 21:57:53 +11001829AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1830
Damien Millerd3f6ad22002-06-25 10:24:47 +10001831SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001832AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001833 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001834 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001835 if test -n "$withval" && test "x$withval" != "xno" && \
1836 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001837 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001838 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001839 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001840)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001841AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1842AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001843
Tim Rice88f2ab52002-03-17 12:17:34 -08001844# We do this little dance with the search path to insure
1845# that programs that we select for use by installed programs
1846# (which may be run by the super-user) come from trusted
1847# locations before they come from the user's private area.
1848# This should help avoid accidentally configuring some
1849# random version of a program in someone's personal bin.
1850
1851OPATH=$PATH
1852PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001853test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001854test -d /sbin && PATH=$PATH:/sbin
1855test -d /usr/sbin && PATH=$PATH:/usr/sbin
1856PATH=$PATH:/etc:$OPATH
1857
Damien Millera8e06ce2003-11-21 23:48:55 +11001858# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001859OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1860OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1861OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1862OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1863OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1864OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1865OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1866OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1867OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1868OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1869OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1870OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1871OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1872OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1873OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1874OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001875# restore PATH
1876PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001877
1878# Where does ssh-rand-helper get its randomness from?
1879INSTALL_SSH_PRNG_CMDS=""
1880if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1881 if test ! -z "$PRNGD_PORT" ; then
1882 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1883 elif test ! -z "$PRNGD_SOCKET" ; then
1884 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1885 else
1886 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1887 RAND_HELPER_CMDHASH=yes
1888 INSTALL_SSH_PRNG_CMDS="yes"
1889 fi
1890fi
1891AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1892
1893
Ben Lindstromb5628642000-10-18 00:02:25 +00001894# Cheap hack to ensure NEWS-OS libraries are arranged right.
1895if test ! -z "$SONY" ; then
1896 LIBS="$LIBS -liberty";
1897fi
1898
Damien Millera22ba012000-03-02 23:09:20 +11001899# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001900AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001901AC_CHECK_SIZEOF(short int, 2)
1902AC_CHECK_SIZEOF(int, 4)
1903AC_CHECK_SIZEOF(long int, 4)
1904AC_CHECK_SIZEOF(long long int, 8)
1905
Damien Millerfa2bb692002-04-23 23:22:25 +10001906# Sanity check long long for some platforms (AIX)
1907if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1908 ac_cv_sizeof_long_long_int=0
1909fi
1910
Damien Millera22ba012000-03-02 23:09:20 +11001911# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001912AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1913 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001914 [ #include <sys/types.h> ],
1915 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001916 [ ac_cv_have_u_int="yes" ],
1917 [ ac_cv_have_u_int="no" ]
1918 )
1919])
1920if test "x$ac_cv_have_u_int" = "xyes" ; then
1921 AC_DEFINE(HAVE_U_INT)
1922 have_u_int=1
1923fi
1924
Damien Miller61e50f12000-05-08 20:49:37 +10001925AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1926 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001927 [ #include <sys/types.h> ],
1928 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001929 [ ac_cv_have_intxx_t="yes" ],
1930 [ ac_cv_have_intxx_t="no" ]
1931 )
1932])
1933if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1934 AC_DEFINE(HAVE_INTXX_T)
1935 have_intxx_t=1
1936fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001937
1938if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001939 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001940then
1941 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1942 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001943 [ #include <stdint.h> ],
1944 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001945 [
1946 AC_DEFINE(HAVE_INTXX_T)
1947 AC_MSG_RESULT(yes)
1948 ],
1949 [ AC_MSG_RESULT(no) ]
1950 )
1951fi
1952
Damien Miller578783e2000-09-23 14:12:24 +11001953AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1954 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001955 [
1956#include <sys/types.h>
1957#ifdef HAVE_STDINT_H
1958# include <stdint.h>
1959#endif
1960#include <sys/socket.h>
1961#ifdef HAVE_SYS_BITYPES_H
1962# include <sys/bitypes.h>
1963#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001964 ],
1965 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001966 [ ac_cv_have_int64_t="yes" ],
1967 [ ac_cv_have_int64_t="no" ]
1968 )
1969])
1970if test "x$ac_cv_have_int64_t" = "xyes" ; then
1971 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001972fi
1973
Damien Miller61e50f12000-05-08 20:49:37 +10001974AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1975 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001976 [ #include <sys/types.h> ],
1977 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001978 [ ac_cv_have_u_intxx_t="yes" ],
1979 [ ac_cv_have_u_intxx_t="no" ]
1980 )
1981])
1982if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1983 AC_DEFINE(HAVE_U_INTXX_T)
1984 have_u_intxx_t=1
1985fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001986
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001987if test -z "$have_u_intxx_t" ; then
1988 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1989 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001990 [ #include <sys/socket.h> ],
1991 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001992 [
1993 AC_DEFINE(HAVE_U_INTXX_T)
1994 AC_MSG_RESULT(yes)
1995 ],
1996 [ AC_MSG_RESULT(no) ]
1997 )
1998fi
1999
Damien Miller578783e2000-09-23 14:12:24 +11002000AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2001 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002002 [ #include <sys/types.h> ],
2003 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002004 [ ac_cv_have_u_int64_t="yes" ],
2005 [ ac_cv_have_u_int64_t="no" ]
2006 )
2007])
2008if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2009 AC_DEFINE(HAVE_U_INT64_T)
2010 have_u_int64_t=1
2011fi
2012
Tim Rice4cec93f2002-02-26 08:40:48 -08002013if test -z "$have_u_int64_t" ; then
2014 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2015 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002016 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002017 [ u_int64_t a; a = 1],
2018 [
2019 AC_DEFINE(HAVE_U_INT64_T)
2020 AC_MSG_RESULT(yes)
2021 ],
2022 [ AC_MSG_RESULT(no) ]
2023 )
2024fi
2025
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002026if test -z "$have_u_intxx_t" ; then
2027 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2028 AC_TRY_COMPILE(
2029 [
2030#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002031 ],
2032 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002033 [ ac_cv_have_uintxx_t="yes" ],
2034 [ ac_cv_have_uintxx_t="no" ]
2035 )
2036 ])
2037 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2038 AC_DEFINE(HAVE_UINTXX_T)
2039 fi
2040fi
2041
2042if test -z "$have_uintxx_t" ; then
2043 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2044 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002045 [ #include <stdint.h> ],
2046 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002047 [
2048 AC_DEFINE(HAVE_UINTXX_T)
2049 AC_MSG_RESULT(yes)
2050 ],
2051 [ AC_MSG_RESULT(no) ]
2052 )
2053fi
2054
Damien Milleredb82922000-06-20 13:25:52 +10002055if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002056 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002057then
2058 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2059 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002060 [
2061#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002062 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002063 [
Damien Miller70494d12000-04-03 15:57:06 +10002064 int8_t a; int16_t b; int32_t c;
2065 u_int8_t e; u_int16_t f; u_int32_t g;
2066 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002067 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002068 [
2069 AC_DEFINE(HAVE_U_INTXX_T)
2070 AC_DEFINE(HAVE_INTXX_T)
2071 AC_MSG_RESULT(yes)
2072 ],
2073 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002074 )
Damien Millerb29ea912000-01-15 14:12:03 +11002075fi
2076
Damien Miller58be7382001-09-15 21:31:54 +10002077
2078AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2079 AC_TRY_COMPILE(
2080 [
2081#include <sys/types.h>
2082 ],
2083 [ u_char foo; foo = 125; ],
2084 [ ac_cv_have_u_char="yes" ],
2085 [ ac_cv_have_u_char="no" ]
2086 )
2087])
2088if test "x$ac_cv_have_u_char" = "xyes" ; then
2089 AC_DEFINE(HAVE_U_CHAR)
2090fi
2091
Tim Rice13aae5e2001-10-21 17:53:58 -07002092TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002093
Tim Rice200a5c02002-02-26 22:12:34 -08002094AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002095
Damien Miller848b9932005-02-24 12:12:34 +11002096AC_CHECK_TYPES(in_addr_t,,,
2097[#include <sys/types.h>
2098#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002099
Damien Miller61e50f12000-05-08 20:49:37 +10002100AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2101 AC_TRY_COMPILE(
2102 [
2103#include <sys/types.h>
2104 ],
2105 [ size_t foo; foo = 1235; ],
2106 [ ac_cv_have_size_t="yes" ],
2107 [ ac_cv_have_size_t="no" ]
2108 )
2109])
2110if test "x$ac_cv_have_size_t" = "xyes" ; then
2111 AC_DEFINE(HAVE_SIZE_T)
2112fi
Damien Miller95058511999-12-29 10:36:45 +11002113
Damien Miller615f9392000-05-17 22:53:33 +10002114AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2115 AC_TRY_COMPILE(
2116 [
2117#include <sys/types.h>
2118 ],
2119 [ ssize_t foo; foo = 1235; ],
2120 [ ac_cv_have_ssize_t="yes" ],
2121 [ ac_cv_have_ssize_t="no" ]
2122 )
2123])
2124if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2125 AC_DEFINE(HAVE_SSIZE_T)
2126fi
2127
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002128AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2129 AC_TRY_COMPILE(
2130 [
2131#include <time.h>
2132 ],
2133 [ clock_t foo; foo = 1235; ],
2134 [ ac_cv_have_clock_t="yes" ],
2135 [ ac_cv_have_clock_t="no" ]
2136 )
2137])
2138if test "x$ac_cv_have_clock_t" = "xyes" ; then
2139 AC_DEFINE(HAVE_CLOCK_T)
2140fi
2141
Damien Millerb54b40e2000-06-23 08:23:34 +10002142AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2143 AC_TRY_COMPILE(
2144 [
2145#include <sys/types.h>
2146#include <sys/socket.h>
2147 ],
2148 [ sa_family_t foo; foo = 1235; ],
2149 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002150 [ AC_TRY_COMPILE(
2151 [
2152#include <sys/types.h>
2153#include <sys/socket.h>
2154#include <netinet/in.h>
2155 ],
2156 [ sa_family_t foo; foo = 1235; ],
2157 [ ac_cv_have_sa_family_t="yes" ],
2158
Damien Millerb54b40e2000-06-23 08:23:34 +10002159 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002160 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002161 )
2162])
2163if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2164 AC_DEFINE(HAVE_SA_FAMILY_T)
2165fi
2166
Damien Miller0f91b4e2000-06-18 15:43:25 +10002167AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2168 AC_TRY_COMPILE(
2169 [
2170#include <sys/types.h>
2171 ],
2172 [ pid_t foo; foo = 1235; ],
2173 [ ac_cv_have_pid_t="yes" ],
2174 [ ac_cv_have_pid_t="no" ]
2175 )
2176])
2177if test "x$ac_cv_have_pid_t" = "xyes" ; then
2178 AC_DEFINE(HAVE_PID_T)
2179fi
2180
2181AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2182 AC_TRY_COMPILE(
2183 [
2184#include <sys/types.h>
2185 ],
2186 [ mode_t foo; foo = 1235; ],
2187 [ ac_cv_have_mode_t="yes" ],
2188 [ ac_cv_have_mode_t="no" ]
2189 )
2190])
2191if test "x$ac_cv_have_mode_t" = "xyes" ; then
2192 AC_DEFINE(HAVE_MODE_T)
2193fi
2194
Damien Miller61e50f12000-05-08 20:49:37 +10002195
2196AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2197 AC_TRY_COMPILE(
2198 [
Damien Miller81171112000-04-23 11:14:01 +10002199#include <sys/types.h>
2200#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002201 ],
2202 [ struct sockaddr_storage s; ],
2203 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2204 [ ac_cv_have_struct_sockaddr_storage="no" ]
2205 )
2206])
2207if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2208 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2209fi
Damien Miller34132e52000-01-14 15:45:46 +11002210
Damien Miller61e50f12000-05-08 20:49:37 +10002211AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2212 AC_TRY_COMPILE(
2213 [
Damien Miller7b22d652000-06-18 14:07:04 +10002214#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002215#include <netinet/in.h>
2216 ],
2217 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2218 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2219 [ ac_cv_have_struct_sockaddr_in6="no" ]
2220 )
2221])
2222if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2223 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2224fi
Damien Miller34132e52000-01-14 15:45:46 +11002225
Damien Miller61e50f12000-05-08 20:49:37 +10002226AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2227 AC_TRY_COMPILE(
2228 [
Damien Miller7b22d652000-06-18 14:07:04 +10002229#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002230#include <netinet/in.h>
2231 ],
2232 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2233 [ ac_cv_have_struct_in6_addr="yes" ],
2234 [ ac_cv_have_struct_in6_addr="no" ]
2235 )
2236])
2237if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2238 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2239fi
Damien Miller34132e52000-01-14 15:45:46 +11002240
Damien Miller61e50f12000-05-08 20:49:37 +10002241AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2242 AC_TRY_COMPILE(
2243 [
Damien Miller81171112000-04-23 11:14:01 +10002244#include <sys/types.h>
2245#include <sys/socket.h>
2246#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002247 ],
2248 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2249 [ ac_cv_have_struct_addrinfo="yes" ],
2250 [ ac_cv_have_struct_addrinfo="no" ]
2251 )
2252])
2253if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2254 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2255fi
2256
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002257AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2258 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002259 [ #include <sys/time.h> ],
2260 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002261 [ ac_cv_have_struct_timeval="yes" ],
2262 [ ac_cv_have_struct_timeval="no" ]
2263 )
2264])
2265if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2266 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2267 have_struct_timeval=1
2268fi
2269
Tim Rice4e4dc562003-03-18 10:21:40 -08002270AC_CHECK_TYPES(struct timespec)
2271
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002272# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002273if test "x$ac_cv_have_int64_t" = "xno" && \
2274 test "x$ac_cv_sizeof_long_int" != "x8" && \
2275 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002276 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2277 echo "an alternative compiler (I.E., GCC) before continuing."
2278 echo ""
2279 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002280else
2281dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002282 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002283 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002284#include <stdio.h>
2285#include <string.h>
2286#ifdef HAVE_SNPRINTF
2287main()
2288{
2289 char buf[50];
2290 char expected_out[50];
2291 int mazsize = 50 ;
2292#if (SIZEOF_LONG_INT == 8)
2293 long int num = 0x7fffffffffffffff;
2294#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002295 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002296#endif
2297 strcpy(expected_out, "9223372036854775807");
2298 snprintf(buf, mazsize, "%lld", num);
2299 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002300 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002301 exit(0);
2302}
2303#else
2304main() { exit(0); }
2305#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002306 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002307 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002308 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002309fi
2310
Damien Miller78315eb2000-09-29 23:01:36 +11002311dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002312OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2313OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2314OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2315OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2316OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002317OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002318OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2319OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002320OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002321OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2322OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2323OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2324OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002325OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2326OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2327OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2328OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002329
2330AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002331
Damien Miller61e50f12000-05-08 20:49:37 +10002332AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2333 ac_cv_have_ss_family_in_struct_ss, [
2334 AC_TRY_COMPILE(
2335 [
Damien Miller81171112000-04-23 11:14:01 +10002336#include <sys/types.h>
2337#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002338 ],
2339 [ struct sockaddr_storage s; s.ss_family = 1; ],
2340 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2341 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2342 )
2343])
2344if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2345 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2346fi
2347
Damien Miller61e50f12000-05-08 20:49:37 +10002348AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2349 ac_cv_have___ss_family_in_struct_ss, [
2350 AC_TRY_COMPILE(
2351 [
Damien Miller81171112000-04-23 11:14:01 +10002352#include <sys/types.h>
2353#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002354 ],
2355 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2356 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2357 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2358 )
2359])
2360if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2361 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2362fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002363
Damien Millerad833b32000-08-23 10:46:23 +10002364AC_CACHE_CHECK([for pw_class field in struct passwd],
2365 ac_cv_have_pw_class_in_struct_passwd, [
2366 AC_TRY_COMPILE(
2367 [
Damien Millerad833b32000-08-23 10:46:23 +10002368#include <pwd.h>
2369 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002370 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002371 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2372 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2373 )
2374])
2375if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2376 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2377fi
2378
Kevin Steves82456952001-06-22 21:14:18 +00002379AC_CACHE_CHECK([for pw_expire field in struct passwd],
2380 ac_cv_have_pw_expire_in_struct_passwd, [
2381 AC_TRY_COMPILE(
2382 [
2383#include <pwd.h>
2384 ],
2385 [ struct passwd p; p.pw_expire = 0; ],
2386 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2387 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2388 )
2389])
2390if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2391 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2392fi
2393
2394AC_CACHE_CHECK([for pw_change field in struct passwd],
2395 ac_cv_have_pw_change_in_struct_passwd, [
2396 AC_TRY_COMPILE(
2397 [
2398#include <pwd.h>
2399 ],
2400 [ struct passwd p; p.pw_change = 0; ],
2401 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2402 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2403 )
2404])
2405if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2406 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2407fi
Damien Miller61e50f12000-05-08 20:49:37 +10002408
Tim Rice28bbb0c2002-05-27 17:37:32 -07002409dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002410AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2411 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002412 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002413 [
Tim Riceae49fe62002-04-12 10:26:21 -07002414#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002415#include <sys/socket.h>
2416#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002417int main() {
2418#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002419#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002420exit(1);
2421#endif
2422struct msghdr m;
2423m.msg_accrights = 0;
2424exit(0);
2425}
Kevin Steves939c9db2002-03-22 17:23:25 +00002426 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002427 [ ac_cv_have_accrights_in_msghdr="yes" ],
2428 [ ac_cv_have_accrights_in_msghdr="no" ]
2429 )
2430])
2431if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2432 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2433fi
2434
Kevin Stevesa44e0352002-04-07 16:18:03 +00002435AC_CACHE_CHECK([for msg_control field in struct msghdr],
2436 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002437 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002438 [
Tim Riceae49fe62002-04-12 10:26:21 -07002439#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002440#include <sys/socket.h>
2441#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002442int main() {
2443#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002444#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002445exit(1);
2446#endif
2447struct msghdr m;
2448m.msg_control = 0;
2449exit(0);
2450}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002451 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002452 [ ac_cv_have_control_in_msghdr="yes" ],
2453 [ ac_cv_have_control_in_msghdr="no" ]
2454 )
2455])
2456if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2457 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2458fi
2459
Damien Miller61e50f12000-05-08 20:49:37 +10002460AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002461 AC_TRY_LINK([],
2462 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002463 [ ac_cv_libc_defines___progname="yes" ],
2464 [ ac_cv_libc_defines___progname="no" ]
2465 )
2466])
2467if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2468 AC_DEFINE(HAVE___PROGNAME)
2469fi
2470
Kevin Steves4846f4a2002-03-22 18:19:53 +00002471AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2472 AC_TRY_LINK([
2473#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002474],
2475 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002476 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2477 [ ac_cv_cc_implements___FUNCTION__="no" ]
2478 )
2479])
2480if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2481 AC_DEFINE(HAVE___FUNCTION__)
2482fi
2483
2484AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2485 AC_TRY_LINK([
2486#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002487],
2488 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002489 [ ac_cv_cc_implements___func__="yes" ],
2490 [ ac_cv_cc_implements___func__="no" ]
2491 )
2492])
2493if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2494 AC_DEFINE(HAVE___func__)
2495fi
2496
Damien Miller4f8e6692001-07-14 13:22:53 +10002497AC_CACHE_CHECK([whether getopt has optreset support],
2498 ac_cv_have_getopt_optreset, [
2499 AC_TRY_LINK(
2500 [
2501#include <getopt.h>
2502 ],
2503 [ extern int optreset; optreset = 0; ],
2504 [ ac_cv_have_getopt_optreset="yes" ],
2505 [ ac_cv_have_getopt_optreset="no" ]
2506 )
2507])
2508if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2509 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2510fi
Damien Millera22ba012000-03-02 23:09:20 +11002511
Damien Millerecbb26d2000-07-15 14:59:14 +10002512AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002513 AC_TRY_LINK([],
2514 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002515 [ ac_cv_libc_defines_sys_errlist="yes" ],
2516 [ ac_cv_libc_defines_sys_errlist="no" ]
2517 )
2518])
2519if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2520 AC_DEFINE(HAVE_SYS_ERRLIST)
2521fi
2522
2523
Damien Miller11fa2cc2000-08-16 10:35:58 +10002524AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002525 AC_TRY_LINK([],
2526 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002527 [ ac_cv_libc_defines_sys_nerr="yes" ],
2528 [ ac_cv_libc_defines_sys_nerr="no" ]
2529 )
2530])
2531if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2532 AC_DEFINE(HAVE_SYS_NERR)
2533fi
2534
Damien Millera8e06ce2003-11-21 23:48:55 +11002535SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002536# Check whether user wants sectok support
2537AC_ARG_WITH(sectok,
2538 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002539 [
2540 if test "x$withval" != "xno" ; then
2541 if test "x$withval" != "xyes" ; then
2542 CPPFLAGS="$CPPFLAGS -I${withval}"
2543 LDFLAGS="$LDFLAGS -L${withval}"
2544 if test ! -z "$need_dash_r" ; then
2545 LDFLAGS="$LDFLAGS -R${withval}"
2546 fi
2547 if test ! -z "$blibpath" ; then
2548 blibpath="$blibpath:${withval}"
2549 fi
2550 fi
2551 AC_CHECK_HEADERS(sectok.h)
2552 if test "$ac_cv_header_sectok_h" != yes; then
2553 AC_MSG_ERROR(Can't find sectok.h)
2554 fi
2555 AC_CHECK_LIB(sectok, sectok_open)
2556 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2557 AC_MSG_ERROR(Can't find libsectok)
2558 fi
2559 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002560 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002561 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002562 fi
2563 ]
2564)
2565
2566# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002567OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002568AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002569 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2570 [
2571 if test "x$withval" != "xno" ; then
2572 if test "x$withval" != "xyes" ; then
2573 OPENSC_CONFIG=$withval/bin/opensc-config
2574 else
2575 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2576 fi
2577 if test "$OPENSC_CONFIG" != "no"; then
2578 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2579 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2580 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2581 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2582 AC_DEFINE(SMARTCARD)
2583 AC_DEFINE(USE_OPENSC)
2584 SCARD_MSG="yes, using OpenSC"
2585 fi
2586 fi
2587 ]
2588)
Damien Miller85de5802001-09-18 14:01:11 +10002589
Darren Tucker5f88d342003-10-15 16:57:57 +10002590# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002591AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002592 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002593 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002594 # Needed by our getrrsetbyname()
2595 AC_SEARCH_LIBS(res_query, resolv)
2596 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002597 AC_MSG_CHECKING(if res_query will link)
2598 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2599 [AC_MSG_RESULT(no)
2600 saved_LIBS="$LIBS"
2601 LIBS="$LIBS -lresolv"
2602 AC_MSG_CHECKING(for res_query in -lresolv)
2603 AC_LINK_IFELSE([
2604#include <resolv.h>
2605int main()
2606{
2607 res_query (0, 0, 0, 0, 0);
2608 return 0;
2609}
2610 ],
2611 [LIBS="$LIBS -lresolv"
2612 AC_MSG_RESULT(yes)],
2613 [LIBS="$saved_LIBS"
2614 AC_MSG_RESULT(no)])
2615 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002616 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002617 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002618 [#include <sys/types.h>
2619 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002620 AC_CHECK_MEMBER(HEADER.ad,
2621 [AC_DEFINE(HAVE_HEADER_AD)],,
2622 [#include <arpa/nameser.h>])
2623 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002624
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002625# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002626KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002627AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002628 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002629 [ if test "x$withval" != "xno" ; then
2630 if test "x$withval" = "xyes" ; then
2631 KRB5ROOT="/usr/local"
2632 else
2633 KRB5ROOT=${withval}
2634 fi
2635
2636 AC_DEFINE(KRB5)
2637 KRB5_MSG="yes"
2638
2639 AC_MSG_CHECKING(for krb5-config)
2640 if test -x $KRB5ROOT/bin/krb5-config ; then
2641 KRB5CONF=$KRB5ROOT/bin/krb5-config
2642 AC_MSG_RESULT($KRB5CONF)
2643
2644 AC_MSG_CHECKING(for gssapi support)
2645 if $KRB5CONF | grep gssapi >/dev/null ; then
2646 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002647 AC_DEFINE(GSSAPI)
2648 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002649 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002650 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002651 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002652 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002653 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2654 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002655 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002656 AC_MSG_CHECKING(whether we are using Heimdal)
2657 AC_TRY_COMPILE([ #include <krb5.h> ],
2658 [ char *tmp = heimdal_version; ],
2659 [ AC_MSG_RESULT(yes)
2660 AC_DEFINE(HEIMDAL) ],
2661 AC_MSG_RESULT(no)
2662 )
2663 else
2664 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002665 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002666 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002667 AC_MSG_CHECKING(whether we are using Heimdal)
2668 AC_TRY_COMPILE([ #include <krb5.h> ],
2669 [ char *tmp = heimdal_version; ],
2670 [ AC_MSG_RESULT(yes)
2671 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002672 K5LIBS="-lkrb5 -ldes"
2673 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002674 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002675 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002676 ],
2677 [ AC_MSG_RESULT(no)
2678 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2679 ]
2680 )
Damien Miller200d0a72003-06-30 19:21:36 +10002681 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002682
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002683 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2684 [ AC_DEFINE(GSSAPI)
2685 K5LIBS="-lgssapi $K5LIBS" ],
2686 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2687 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002688 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002689 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2690 $K5LIBS)
2691 ],
2692 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002693
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002694 AC_CHECK_HEADER(gssapi.h, ,
2695 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002696 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002697 AC_CHECK_HEADERS(gssapi.h, ,
2698 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002699 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002700 ]
2701 )
2702
2703 oldCPP="$CPPFLAGS"
2704 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2705 AC_CHECK_HEADER(gssapi_krb5.h, ,
2706 [ CPPFLAGS="$oldCPP" ])
2707
Damien Millera8e06ce2003-11-21 23:48:55 +11002708 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002709 if test ! -z "$need_dash_r" ; then
2710 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2711 fi
2712 if test ! -z "$blibpath" ; then
2713 blibpath="$blibpath:${KRB5ROOT}/lib"
2714 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002715 fi
2716
2717 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2718 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2719 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2720
2721 LIBS="$LIBS $K5LIBS"
2722 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2723 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002724)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002725
Damien Millera22ba012000-03-02 23:09:20 +11002726# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002727
Damien Millerf58c6722002-05-13 13:15:42 +10002728PRIVSEP_PATH=/var/empty
2729AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002730 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002731 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002732 if test -n "$withval" && test "x$withval" != "xno" && \
2733 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002734 PRIVSEP_PATH=$withval
2735 fi
2736 ]
2737)
2738AC_SUBST(PRIVSEP_PATH)
2739
Damien Millera22ba012000-03-02 23:09:20 +11002740AC_ARG_WITH(xauth,
2741 [ --with-xauth=PATH Specify path to xauth program ],
2742 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002743 if test -n "$withval" && test "x$withval" != "xno" && \
2744 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002745 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002746 fi
2747 ],
2748 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002749 TestPath="$PATH"
2750 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2751 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2752 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2753 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2754 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002755 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002756 xauth_path="/usr/openwin/bin/xauth"
2757 fi
2758 ]
2759)
2760
Damien Miller7d901272003-01-13 16:55:22 +11002761STRIP_OPT=-s
2762AC_ARG_ENABLE(strip,
2763 [ --disable-strip Disable calling strip(1) on install],
2764 [
2765 if test "x$enableval" = "xno" ; then
2766 STRIP_OPT=
2767 fi
2768 ]
2769)
2770AC_SUBST(STRIP_OPT)
2771
Damien Millera19cf472000-11-29 13:28:50 +11002772if test -z "$xauth_path" ; then
2773 XAUTH_PATH="undefined"
2774 AC_SUBST(XAUTH_PATH)
2775else
Damien Millera22ba012000-03-02 23:09:20 +11002776 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002777 XAUTH_PATH=$xauth_path
2778 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002779fi
Damien Millera22ba012000-03-02 23:09:20 +11002780
2781# Check for mail directory (last resort if we cannot get it from headers)
2782if test ! -z "$MAIL" ; then
2783 maildir=`dirname $MAIL`
2784 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2785fi
2786
Darren Tucker623d92f2004-09-12 22:36:15 +10002787if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002788 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2789 disable_ptmx_check=yes
2790fi
Damien Millera22ba012000-03-02 23:09:20 +11002791if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002792 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002793 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002794 [
2795 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2796 have_dev_ptmx=1
2797 ]
2798 )
2799 fi
Damien Millera22ba012000-03-02 23:09:20 +11002800fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002801
Darren Tucker623d92f2004-09-12 22:36:15 +10002802if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002803 AC_CHECK_FILE("/dev/ptc",
2804 [
2805 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2806 have_dev_ptc=1
2807 ]
2808 )
2809else
2810 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2811fi
Damien Miller204ad072000-03-02 23:56:12 +11002812
Damien Millera22ba012000-03-02 23:09:20 +11002813# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002814AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002815 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002816 [
Damien Miller897741e2001-04-16 10:41:46 +10002817 case "$withval" in
2818 man|cat|doc)
2819 MANTYPE=$withval
2820 ;;
2821 *)
2822 AC_MSG_ERROR(invalid man type: $withval)
2823 ;;
2824 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002825 ]
2826)
Ben Lindstrombc709922001-04-18 18:04:21 +00002827if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002828 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2829 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002830 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2831 MANTYPE=doc
2832 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2833 MANTYPE=man
2834 else
2835 MANTYPE=cat
2836 fi
2837fi
Damien Miller670a4b82000-01-22 13:53:11 +11002838AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002839if test "$MANTYPE" = "doc"; then
2840 mansubdir=man;
2841else
2842 mansubdir=$MANTYPE;
2843fi
2844AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002845
Damien Millera22ba012000-03-02 23:09:20 +11002846# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002847MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002848AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002849 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002850 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002851 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002852 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002853 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002854 fi
2855 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002856)
2857
Damien Millera22ba012000-03-02 23:09:20 +11002858# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002859AC_ARG_WITH(shadow,
2860 [ --without-shadow Disable shadow password support],
2861 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002862 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002863 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002864 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002865 fi
2866 ]
2867)
2868
Damien Miller1f335fb2000-06-26 11:31:33 +10002869if test -z "$disable_shadow" ; then
2870 AC_MSG_CHECKING([if the systems has expire shadow information])
2871 AC_TRY_COMPILE(
2872 [
2873#include <sys/types.h>
2874#include <shadow.h>
2875 struct spwd sp;
2876 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2877 [ sp_expire_available=yes ], []
2878 )
2879
2880 if test "x$sp_expire_available" = "xyes" ; then
2881 AC_MSG_RESULT(yes)
2882 AC_DEFINE(HAS_SHADOW_EXPIRE)
2883 else
2884 AC_MSG_RESULT(no)
2885 fi
2886fi
2887
Damien Millera22ba012000-03-02 23:09:20 +11002888# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002889if test ! -z "$IPADDR_IN_DISPLAY" ; then
2890 DISPLAY_HACK_MSG="yes"
2891 AC_DEFINE(IPADDR_IN_DISPLAY)
2892else
Damien Millera8e06ce2003-11-21 23:48:55 +11002893 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002894 AC_ARG_WITH(ipaddr-display,
2895 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2896 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002897 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002898 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002899 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002900 fi
2901 ]
2902 )
2903fi
Damien Miller76112de1999-12-21 11:18:08 +11002904
Darren Tuckere1a790d2003-09-16 11:52:19 +10002905# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002906AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002907 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002908 [ if test "x$enableval" = "xno"; then
2909 AC_MSG_NOTICE([/etc/default/login handling disabled])
2910 etc_default_login=no
2911 else
2912 etc_default_login=yes
2913 fi ],
2914 [ etc_default_login=yes ]
2915)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002916
Darren Tucker2f9573d2005-02-10 22:28:54 +11002917if test "x$etc_default_login" != "xno"; then
2918 AC_CHECK_FILE("/etc/default/login",
2919 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002920 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2921 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002922 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2923 elif test "x$external_path_file" = "x/etc/default/login"; then
2924 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2925 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002926fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002927
Tim Rice43a1c132002-04-17 21:19:14 -07002928dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002929if test $ac_cv_func_login_getcapbool = "yes" && \
2930 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002931 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002932fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002933
Damien Millera22ba012000-03-02 23:09:20 +11002934# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002935SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002936AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002937 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002938 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002939 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002940 AC_MSG_WARN([
2941--with-default-path=PATH has no effect on this system.
2942Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002943 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002944 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002945 AC_MSG_WARN([
2946--with-default-path=PATH will only be used if PATH is not defined in
2947$external_path_file .])
2948 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002949 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002950 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002951 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002952 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002953 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2954 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002955 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002956 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002957 AC_MSG_WARN([
2958If PATH is defined in $external_path_file, ensure the path to scp is included,
2959otherwise scp will not work.])
2960 fi
2961 AC_TRY_RUN(
2962 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002963/* find out what STDPATH is */
2964#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002965#ifdef HAVE_PATHS_H
2966# include <paths.h>
2967#endif
2968#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002969# ifdef _PATH_USERPATH /* Irix */
2970# define _PATH_STDPATH _PATH_USERPATH
2971# else
2972# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2973# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002974#endif
2975#include <sys/types.h>
2976#include <sys/stat.h>
2977#include <fcntl.h>
2978#define DATA "conftest.stdpath"
2979
2980main()
2981{
2982 FILE *fd;
2983 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002984
Tim Rice59ea0a02001-03-10 13:50:45 -08002985 fd = fopen(DATA,"w");
2986 if(fd == NULL)
2987 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002988
Tim Rice59ea0a02001-03-10 13:50:45 -08002989 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2990 exit(1);
2991
2992 exit(0);
2993}
2994 ], [ user_path=`cat conftest.stdpath` ],
2995 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2996 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2997 )
2998# make sure $bindir is in USER_PATH so scp will work
2999 t_bindir=`eval echo ${bindir}`
3000 case $t_bindir in
3001 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3002 esac
3003 case $t_bindir in
3004 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3005 esac
3006 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3007 if test $? -ne 0 ; then
3008 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3009 if test $? -ne 0 ; then
3010 user_path=$user_path:$t_bindir
3011 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3012 fi
3013 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003014 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003015)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003016if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003017 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3018 AC_SUBST(user_path)
3019fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003020
Damien Millera18bbd32002-05-13 10:48:57 +10003021# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003022AC_ARG_WITH(superuser-path,
3023 [ --with-superuser-path= Specify different path for super-user],
3024 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003025 if test -n "$withval" && test "x$withval" != "xno" && \
3026 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003027 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3028 superuser_path=$withval
3029 fi
3030 ]
3031)
3032
3033
Damien Miller61e50f12000-05-08 20:49:37 +10003034AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003035IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003036AC_ARG_WITH(4in6,
3037 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3038 [
3039 if test "x$withval" != "xno" ; then
3040 AC_MSG_RESULT(yes)
3041 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003042 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003043 else
3044 AC_MSG_RESULT(no)
3045 fi
3046 ],[
3047 if test "x$inet6_default_4in6" = "xyes"; then
3048 AC_MSG_RESULT([yes (default)])
3049 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003050 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003051 else
3052 AC_MSG_RESULT([no (default)])
3053 fi
3054 ]
3055)
3056
Damien Miller60396b02001-02-18 17:01:00 +11003057# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003058BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003059AC_ARG_WITH(bsd-auth,
3060 [ --with-bsd-auth Enable BSD auth support],
3061 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003062 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003063 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003064 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003065 fi
3066 ]
3067)
3068
Damien Millera22ba012000-03-02 23:09:20 +11003069# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003070piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003071# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003072if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003073 piddir=`eval echo ${sysconfdir}`
3074 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003075 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003076 esac
3077fi
3078
Tim Rice88f2ab52002-03-17 12:17:34 -08003079AC_ARG_WITH(pid-dir,
3080 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3081 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003082 if test -n "$withval" && test "x$withval" != "xno" && \
3083 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003084 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003085 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003086 AC_MSG_WARN([** no $piddir directory on this system **])
3087 fi
3088 fi
3089 ]
3090)
3091
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003092AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003093AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003094
andre2ff7b5d2000-06-03 14:57:40 +00003095dnl allow user to disable some login recording features
3096AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003097 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003098 [
3099 if test "x$enableval" = "xno" ; then
3100 AC_DEFINE(DISABLE_LASTLOG)
3101 fi
3102 ]
andre2ff7b5d2000-06-03 14:57:40 +00003103)
3104AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003105 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003106 [
3107 if test "x$enableval" = "xno" ; then
3108 AC_DEFINE(DISABLE_UTMP)
3109 fi
3110 ]
andre2ff7b5d2000-06-03 14:57:40 +00003111)
3112AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003113 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003114 [
3115 if test "x$enableval" = "xno" ; then
3116 AC_DEFINE(DISABLE_UTMPX)
3117 fi
3118 ]
andre2ff7b5d2000-06-03 14:57:40 +00003119)
3120AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003121 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003122 [
3123 if test "x$enableval" = "xno" ; then
3124 AC_DEFINE(DISABLE_WTMP)
3125 fi
3126 ]
andre2ff7b5d2000-06-03 14:57:40 +00003127)
3128AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003129 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003130 [
3131 if test "x$enableval" = "xno" ; then
3132 AC_DEFINE(DISABLE_WTMPX)
3133 fi
3134 ]
andre2ff7b5d2000-06-03 14:57:40 +00003135)
3136AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003137 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003138 [
3139 if test "x$enableval" = "xno" ; then
3140 AC_DEFINE(DISABLE_LOGIN)
3141 fi
3142 ]
andre2ff7b5d2000-06-03 14:57:40 +00003143)
3144AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003145 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003146 [
3147 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003148 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003149 fi
3150 ]
andre2ff7b5d2000-06-03 14:57:40 +00003151)
3152AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003153 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003154 [
3155 if test "x$enableval" = "xno" ; then
3156 AC_DEFINE(DISABLE_PUTUTXLINE)
3157 fi
3158 ]
andre2ff7b5d2000-06-03 14:57:40 +00003159)
3160AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003161 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003162 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003163 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003164 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003165 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003166 conf_lastlog_location=$withval
3167 fi
3168 ]
3169)
andre2ff7b5d2000-06-03 14:57:40 +00003170
3171dnl lastlog, [uw]tmpx? detection
3172dnl NOTE: set the paths in the platform section to avoid the
3173dnl need for command-line parameters
3174dnl lastlog and [uw]tmp are subject to a file search if all else fails
3175
3176dnl lastlog detection
3177dnl NOTE: the code itself will detect if lastlog is a directory
3178AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3179AC_TRY_COMPILE([
3180#include <sys/types.h>
3181#include <utmp.h>
3182#ifdef HAVE_LASTLOG_H
3183# include <lastlog.h>
3184#endif
Damien Miller2994e082000-06-04 15:51:47 +10003185#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003186# include <paths.h>
3187#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003188#ifdef HAVE_LOGIN_H
3189# include <login.h>
3190#endif
andre2ff7b5d2000-06-03 14:57:40 +00003191 ],
3192 [ char *lastlog = LASTLOG_FILE; ],
3193 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003194 [
3195 AC_MSG_RESULT(no)
3196 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3197 AC_TRY_COMPILE([
3198#include <sys/types.h>
3199#include <utmp.h>
3200#ifdef HAVE_LASTLOG_H
3201# include <lastlog.h>
3202#endif
3203#ifdef HAVE_PATHS_H
3204# include <paths.h>
3205#endif
3206 ],
3207 [ char *lastlog = _PATH_LASTLOG; ],
3208 [ AC_MSG_RESULT(yes) ],
3209 [
andree441aa32000-06-12 22:34:38 +00003210 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003211 system_lastlog_path=no
3212 ])
3213 ]
andre2ff7b5d2000-06-03 14:57:40 +00003214)
Damien Miller2994e082000-06-04 15:51:47 +10003215
andre2ff7b5d2000-06-03 14:57:40 +00003216if test -z "$conf_lastlog_location"; then
3217 if test x"$system_lastlog_path" = x"no" ; then
3218 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003219 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003220 conf_lastlog_location=$f
3221 fi
3222 done
3223 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003224 AC_MSG_WARN([** Cannot find lastlog **])
3225 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003226 fi
3227 fi
3228fi
3229
3230if test -n "$conf_lastlog_location"; then
3231 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003232fi
andre2ff7b5d2000-06-03 14:57:40 +00003233
3234dnl utmp detection
3235AC_MSG_CHECKING([if your system defines UTMP_FILE])
3236AC_TRY_COMPILE([
3237#include <sys/types.h>
3238#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003239#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003240# include <paths.h>
3241#endif
3242 ],
3243 [ char *utmp = UTMP_FILE; ],
3244 [ AC_MSG_RESULT(yes) ],
3245 [ AC_MSG_RESULT(no)
3246 system_utmp_path=no ]
3247)
3248if test -z "$conf_utmp_location"; then
3249 if test x"$system_utmp_path" = x"no" ; then
3250 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3251 if test -f $f ; then
3252 conf_utmp_location=$f
3253 fi
3254 done
3255 if test -z "$conf_utmp_location"; then
3256 AC_DEFINE(DISABLE_UTMP)
3257 fi
3258 fi
3259fi
3260if test -n "$conf_utmp_location"; then
3261 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003262fi
andre2ff7b5d2000-06-03 14:57:40 +00003263
3264dnl wtmp detection
3265AC_MSG_CHECKING([if your system defines WTMP_FILE])
3266AC_TRY_COMPILE([
3267#include <sys/types.h>
3268#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003269#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003270# include <paths.h>
3271#endif
3272 ],
3273 [ char *wtmp = WTMP_FILE; ],
3274 [ AC_MSG_RESULT(yes) ],
3275 [ AC_MSG_RESULT(no)
3276 system_wtmp_path=no ]
3277)
3278if test -z "$conf_wtmp_location"; then
3279 if test x"$system_wtmp_path" = x"no" ; then
3280 for f in /usr/adm/wtmp /var/log/wtmp; do
3281 if test -f $f ; then
3282 conf_wtmp_location=$f
3283 fi
3284 done
3285 if test -z "$conf_wtmp_location"; then
3286 AC_DEFINE(DISABLE_WTMP)
3287 fi
3288 fi
3289fi
3290if test -n "$conf_wtmp_location"; then
3291 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003292fi
andre2ff7b5d2000-06-03 14:57:40 +00003293
3294
3295dnl utmpx detection - I don't know any system so perverse as to require
3296dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3297dnl there, though.
3298AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3299AC_TRY_COMPILE([
3300#include <sys/types.h>
3301#include <utmp.h>
3302#ifdef HAVE_UTMPX_H
3303#include <utmpx.h>
3304#endif
Damien Miller2994e082000-06-04 15:51:47 +10003305#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003306# include <paths.h>
3307#endif
3308 ],
3309 [ char *utmpx = UTMPX_FILE; ],
3310 [ AC_MSG_RESULT(yes) ],
3311 [ AC_MSG_RESULT(no)
3312 system_utmpx_path=no ]
3313)
3314if test -z "$conf_utmpx_location"; then
3315 if test x"$system_utmpx_path" = x"no" ; then
3316 AC_DEFINE(DISABLE_UTMPX)
3317 fi
3318else
3319 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003320fi
andre2ff7b5d2000-06-03 14:57:40 +00003321
3322dnl wtmpx detection
3323AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3324AC_TRY_COMPILE([
3325#include <sys/types.h>
3326#include <utmp.h>
3327#ifdef HAVE_UTMPX_H
3328#include <utmpx.h>
3329#endif
Damien Miller2994e082000-06-04 15:51:47 +10003330#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003331# include <paths.h>
3332#endif
3333 ],
3334 [ char *wtmpx = WTMPX_FILE; ],
3335 [ AC_MSG_RESULT(yes) ],
3336 [ AC_MSG_RESULT(no)
3337 system_wtmpx_path=no ]
3338)
3339if test -z "$conf_wtmpx_location"; then
3340 if test x"$system_wtmpx_path" = x"no" ; then
3341 AC_DEFINE(DISABLE_WTMPX)
3342 fi
3343else
3344 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003345fi
andre2ff7b5d2000-06-03 14:57:40 +00003346
Damien Miller4018c192000-04-30 09:30:44 +10003347
Damien Miller29ea30d2000-03-17 10:54:15 +11003348if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003349 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3350 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003351fi
3352
Tim Rice4cec93f2002-02-26 08:40:48 -08003353dnl remove pam and dl because they are in $LIBPAM
3354if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003355 LIBS=`echo $LIBS | sed 's/-lpam //'`
3356fi
3357if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3358 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003359fi
3360
Damien Millerbac2d8a2000-09-05 16:13:06 +11003361AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003362AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3363 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003364AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003365
Damien Miller7b22d652000-06-18 14:07:04 +10003366# Print summary of options
3367
Damien Miller7b22d652000-06-18 14:07:04 +10003368# Someone please show me a better way :)
3369A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3370B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3371C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3372D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003373E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003374F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003375G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003376H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3377I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3378J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003379
3380echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003381echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003382echo " User binaries: $B"
3383echo " System binaries: $C"
3384echo " Configuration files: $D"
3385echo " Askpass program: $E"
3386echo " Manual pages: $F"
3387echo " PID file: $G"
3388echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003389if test "x$external_path_file" = "x/etc/login.conf" ; then
3390echo " At runtime, sshd will use the path defined in $external_path_file"
3391echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003392else
Damien Millerf58c6722002-05-13 13:15:42 +10003393echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003394 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003395echo " (If PATH is set in $external_path_file it will be used instead. If"
3396echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3397 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003398fi
Damien Millera18bbd32002-05-13 10:48:57 +10003399if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003400echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003401fi
Damien Millerf58c6722002-05-13 13:15:42 +10003402echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003403echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003404echo " KerberosV support: $KRB5_MSG"
3405echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003406echo " S/KEY support: $SKEY_MSG"
3407echo " TCP Wrappers support: $TCPW_MSG"
3408echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003409echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003410echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003411echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3412echo " BSD Auth support: $BSD_AUTH_MSG"
3413echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003414if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003415echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003416fi
3417
Damien Miller7b22d652000-06-18 14:07:04 +10003418echo ""
3419
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003420echo " Host: ${host}"
3421echo " Compiler: ${CC}"
3422echo " Compiler flags: ${CFLAGS}"
3423echo "Preprocessor flags: ${CPPFLAGS}"
3424echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003425echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003426
3427echo ""
3428
Tim Rice6f1f7582004-05-30 21:38:51 -07003429if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003430 echo "SVR4 style packages are supported with \"make package\""
3431 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003432fi
3433
Damien Miller82cf0ce2000-12-20 13:34:48 +11003434if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003435 echo "PAM is enabled. You may need to install a PAM control file "
3436 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003437 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003438 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003439 echo ""
3440fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003441
Damien Miller6c21c512002-01-22 21:57:53 +11003442if test ! -z "$RAND_HELPER_CMDHASH" ; then
3443 echo "WARNING: you are using the builtin random number collection "
3444 echo "service. Please read WARNING.RNG and request that your OS "
3445 echo "vendor includes kernel-based random number collection in "
3446 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003447 echo ""
3448fi
Damien Miller60396b02001-02-18 17:01:00 +11003449
Damien Millerb4097182004-05-23 14:09:40 +10003450if test ! -z "$NO_PEERCHECK" ; then
3451 echo "WARNING: the operating system that you are using does not "
3452 echo "appear to support either the getpeereid() API nor the "
3453 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3454 echo "enforce security checks to prevent unauthorised connections to "
3455 echo "ssh-agent. Their absence increases the risk that a malicious "
3456 echo "user can connect to your agent. "
3457 echo ""
3458fi
3459
Darren Tuckerd9f88912005-02-20 21:01:48 +11003460if test "$AUDIT_MODULE" = "bsm" ; then
3461 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3462 echo "See the Solaris section in README.platform for details."
3463fi