blob: 027b2a4e1b22d115b305d11e25fdfed279f1a014 [file] [log] [blame]
Damien Miller52c8afe2005-06-19 10:19:43 +10001# $Id: configure.ac,v 1.276 2005/06/19 00:19:43 djm 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 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100371*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800372 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800373 need_dash_r=1
374 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100375 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000376 AC_DEFINE(LOGIN_NEEDS_UTMPX)
377 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000378 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000379 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000380 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000381 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
382 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000383 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000384 # hardwire lastlog location (can't detect it on some versions)
385 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000386 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
387 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
388 if test "$sol2ver" -ge 8; then
389 AC_MSG_RESULT(yes)
390 AC_DEFINE(DISABLE_UTMP)
391 AC_DEFINE(DISABLE_WTMP)
392 else
393 AC_MSG_RESULT(no)
394 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100395 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000396*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000397 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000398 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100399 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000400 conf_utmp_location=/etc/utmp
401 conf_wtmp_location=/var/adm/wtmp
402 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000403 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000404 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000405*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700406 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000407 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000408 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000409 AC_DEFINE(SETEUID_BREAKS_SETUID)
410 AC_DEFINE(BROKEN_SETREUID)
411 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000412 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000413*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700414 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000415 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100416 # -lresolv needs to be at then end of LIBS or DNS lookups break
417 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100418 IPADDR_IN_DISPLAY=yes
419 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000420 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000421 AC_DEFINE(SETEUID_BREAKS_SETUID)
422 AC_DEFINE(BROKEN_SETREUID)
423 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000424 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000425 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700426 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
427 # Attention: always take care to bind libsocket and libnsl before libc,
428 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000429 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800430# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100431*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100432 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700436 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100437 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800438# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100439*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100440 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700441 AC_DEFINE(SETEUID_BREAKS_SETUID)
442 AC_DEFINE(BROKEN_SETREUID)
443 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700444 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700445 case "$host" in
446 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
447 TEST_SHELL=/u95/bin/sh
448 ;;
449 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100450 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100451*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100452 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800453# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100454*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800455 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100456 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800457# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100458*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800459 if test -z "$GCC"; then
460 CFLAGS="$CFLAGS -belf"
461 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100462 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000463 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100464 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000465 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000466 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700467 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700468 AC_DEFINE(SETEUID_BREAKS_SETUID)
469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700471 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700472 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100473 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100474 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700475 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700476 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000477 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000478*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100479 AC_DEFINE(NO_SSH_LASTLOG)
480 AC_DEFINE(SETEUID_BREAKS_SETUID)
481 AC_DEFINE(BROKEN_SETREUID)
482 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000483 AC_DEFINE(USE_PIPES)
484 AC_DEFINE(DISABLE_FD_PASSING)
485 LDFLAGS="$LDFLAGS"
486 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
487 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000488 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000489*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100490 AC_DEFINE(SETEUID_BREAKS_SETUID)
491 AC_DEFINE(BROKEN_SETREUID)
492 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000493 AC_DEFINE(WITH_ABBREV_NO_TTY)
494 AC_DEFINE(USE_PIPES)
495 AC_DEFINE(DISABLE_FD_PASSING)
496 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100497 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000498 MANTYPE=cat
499 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000500*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100501 AC_DEFINE(SETEUID_BREAKS_SETUID)
502 AC_DEFINE(BROKEN_SETREUID)
503 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000504 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700505 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700506 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000507 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
508 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
509 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700510 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000511*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000512 AC_MSG_CHECKING(for Digital Unix SIA)
513 no_osfsia=""
514 AC_ARG_WITH(osfsia,
515 [ --with-osfsia Enable Digital Unix SIA],
516 [
517 if test "x$withval" = "xno" ; then
518 AC_MSG_RESULT(disabled)
519 no_osfsia=1
520 fi
521 ],
522 )
523 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000524 if test -f /etc/sia/matrix.conf; then
525 AC_MSG_RESULT(yes)
526 AC_DEFINE(HAVE_OSF_SIA)
527 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000528 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000529 LIBS="$LIBS -lsecurity -ldb -lm -laud"
530 else
531 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100532 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000533 fi
534 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000535 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700536 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000537 AC_DEFINE(BROKEN_SETREUID)
538 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000539 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000540
541*-*-nto-qnx)
542 AC_DEFINE(USE_PIPES)
543 AC_DEFINE(NO_X11_UNIX_SOCKETS)
544 AC_DEFINE(MISSING_NFDBITS)
545 AC_DEFINE(MISSING_HOWMANY)
546 AC_DEFINE(MISSING_FD_MASK)
547 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000548
549*-*-ultrix*)
550 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
551 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
552 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700553 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
554 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100555esac
556
Damien Millere37bfc12000-06-05 09:37:43 +1000557# Allow user to specify flags
558AC_ARG_WITH(cflags,
559 [ --with-cflags Specify additional flags to pass to compiler],
560 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800561 if test -n "$withval" && test "x$withval" != "xno" && \
562 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000563 CFLAGS="$CFLAGS $withval"
564 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800565 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000566)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000567AC_ARG_WITH(cppflags,
568 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
569 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800570 if test -n "$withval" && test "x$withval" != "xno" && \
571 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000572 CPPFLAGS="$CPPFLAGS $withval"
573 fi
574 ]
575)
Damien Millere37bfc12000-06-05 09:37:43 +1000576AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000577 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000578 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800579 if test -n "$withval" && test "x$withval" != "xno" && \
580 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000581 LDFLAGS="$LDFLAGS $withval"
582 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800583 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000584)
585AC_ARG_WITH(libs,
586 [ --with-libs Specify additional libraries to link with],
587 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800588 if test -n "$withval" && test "x$withval" != "xno" && \
589 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000590 LIBS="$LIBS $withval"
591 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800592 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000593)
594
Darren Tucker6eb93042003-06-29 21:30:41 +1000595AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000596AC_RUN_IFELSE(
597 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000598#include <stdio.h>
599int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000600 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000601 [ AC_MSG_RESULT(yes) ],
602 [
603 AC_MSG_RESULT(no)
604 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000605 ],
606 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000607)
608
Darren Tucker0c9653f2005-05-28 15:58:14 +1000609dnl Checks for header files.
610AC_CHECK_HEADERS( \
611 bstring.h \
612 crypt.h \
613 dirent.h \
614 endian.h \
615 features.h \
616 floatingpoint.h \
617 getopt.h \
618 glob.h \
619 ia.h \
620 lastlog.h \
621 limits.h \
622 login.h \
623 login_cap.h \
624 maillock.h \
625 ndir.h \
626 netdb.h \
627 netgroup.h \
628 netinet/in_systm.h \
629 pam/pam_appl.h \
630 paths.h \
631 pty.h \
632 readpassphrase.h \
633 rpc/types.h \
634 security/pam_appl.h \
635 shadow.h \
636 stddef.h \
637 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000638 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000639 strings.h \
640 sys/audit.h \
641 sys/bitypes.h \
642 sys/bsdtty.h \
643 sys/cdefs.h \
644 sys/dir.h \
645 sys/mman.h \
646 sys/ndir.h \
647 sys/prctl.h \
648 sys/pstat.h \
649 sys/select.h \
650 sys/stat.h \
651 sys/stream.h \
652 sys/stropts.h \
653 sys/strtio.h \
654 sys/sysmacros.h \
655 sys/time.h \
656 sys/timers.h \
657 sys/un.h \
658 time.h \
659 tmpdir.h \
660 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000661 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000662 usersec.h \
663 util.h \
664 utime.h \
665 utmp.h \
666 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000667 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000668)
Tim Rice4cec93f2002-02-26 08:40:48 -0800669
Darren Tucker48d99d32004-08-29 17:04:50 +1000670# sys/ptms.h requires sys/stream.h to be included first on Solaris
671AC_CHECK_HEADERS(sys/ptms.h, [], [], [
672#ifdef HAVE_SYS_STREAM_H
673# include <sys/stream.h>
674#endif
675])
676
Damien Millera22ba012000-03-02 23:09:20 +1100677# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700678AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
679AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000680
Tim Rice1e1ef642003-09-11 22:19:31 -0700681dnl IRIX and Solaris 2.5.1 have dirname() in libgen
682AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
683 AC_CHECK_LIB(gen, dirname,[
684 AC_CACHE_CHECK([for broken dirname],
685 ac_cv_have_broken_dirname, [
686 save_LIBS="$LIBS"
687 LIBS="$LIBS -lgen"
688 AC_TRY_RUN(
689 [
690#include <libgen.h>
691#include <string.h>
692
693int main(int argc, char **argv) {
694 char *s, buf[32];
695
696 strncpy(buf,"/etc", 32);
697 s = dirname(buf);
698 if (!s || strncmp(s, "/", 32) != 0) {
699 exit(1);
700 } else {
701 exit(0);
702 }
703}
704 ],
705 [ ac_cv_have_broken_dirname="no" ],
706 [ ac_cv_have_broken_dirname="yes" ]
707 )
708 LIBS="$save_LIBS"
709 ])
710 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
711 LIBS="$LIBS -lgen"
712 AC_DEFINE(HAVE_DIRNAME)
713 AC_CHECK_HEADERS(libgen.h)
714 fi
715 ])
716])
717
718AC_CHECK_FUNC(getspnam, ,
719 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
720AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
721
Tim Rice13aae5e2001-10-21 17:53:58 -0700722dnl zlib is required
723AC_ARG_WITH(zlib,
724 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100725 [ if test "x$withval" = "xno" ; then
726 AC_MSG_ERROR([*** zlib is required ***])
727 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700728 if test -d "$withval/lib"; then
729 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700730 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700731 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700732 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700733 fi
734 else
735 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700736 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700737 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700738 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700739 fi
740 fi
741 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700742 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700743 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700744 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700745 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100746 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700747)
748
Tim Ricefcb62202004-01-23 18:35:16 -0800749AC_CHECK_LIB(z, deflate, ,
750 [
751 saved_CPPFLAGS="$CPPFLAGS"
752 saved_LDFLAGS="$LDFLAGS"
753 save_LIBS="$LIBS"
754 dnl Check default zlib install dir
755 if test -n "${need_dash_r}"; then
756 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
757 else
758 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
759 fi
760 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
761 LIBS="$LIBS -lz"
762 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
763 [
764 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
765 ]
766 )
767 ]
768)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100769AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100770
771AC_ARG_WITH(zlib-version-check,
772 [ --without-zlib-version-check Disable zlib version check],
773 [ if test "x$withval" = "xno" ; then
774 zlib_check_nonfatal=1
775 fi
776 ]
777)
778
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000779AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000780AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000781#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100782#include <zlib.h>
783int main()
784{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000785 int a=0, b=0, c=0, d=0, n, v;
786 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
787 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100788 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000789 v = a*1000000 + b*10000 + c*100 + d;
790 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
791
792 /* 1.1.4 is OK */
793 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100794 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000795
796 /* 1.2.1.2 and up are OK */
797 if (v >= 1020102)
798 exit(0);
799
Darren Tucker2dcd2392004-01-23 17:13:33 +1100800 exit(2);
801}
Darren Tucker623d92f2004-09-12 22:36:15 +1000802 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000803 AC_MSG_RESULT(no),
804 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100805 if test -z "$zlib_check_nonfatal" ; then
806 AC_MSG_ERROR([*** zlib too old - check config.log ***
807Your reported zlib version has known security problems. It's possible your
808vendor has fixed these problems without changing the version number. If you
809are sure this is the case, you can disable the check by running
810"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000811If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
812See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100813 else
814 AC_MSG_WARN([zlib version may have security problems])
815 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000816 ],
817 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100818)
Damien Miller6f9c3372000-10-25 10:06:04 +1100819
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000820dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100821AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000822 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
823)
Damien Millera8e06ce2003-11-21 23:48:55 +1100824AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700825 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
826 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000827)
Damien Millerab18c411999-11-11 10:40:23 +1100828
Tim Ricee589a292001-11-03 11:09:32 -0800829dnl Checks for libutil functions
830AC_CHECK_HEADERS(libutil.h)
831AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
832AC_CHECK_FUNCS(logout updwtmp logwtmp)
833
Ben Lindstrom8697e082001-02-24 21:41:10 +0000834AC_FUNC_STRFTIME
835
Damien Miller3c027682001-03-14 11:39:45 +1100836# Check for ALTDIRFUNC glob() extension
837AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
838AC_EGREP_CPP(FOUNDIT,
839 [
840 #include <glob.h>
841 #ifdef GLOB_ALTDIRFUNC
842 FOUNDIT
843 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100844 ],
Damien Miller3c027682001-03-14 11:39:45 +1100845 [
846 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
847 AC_MSG_RESULT(yes)
848 ],
849 [
850 AC_MSG_RESULT(no)
851 ]
852)
Damien Millerab18c411999-11-11 10:40:23 +1100853
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000854# Check for g.gl_matchc glob() extension
855AC_MSG_CHECKING(for gl_matchc field in glob_t)
856AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100857 [
858 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000859 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100860 ],
861 [
862 AC_DEFINE(GLOB_HAS_GL_MATCHC)
863 AC_MSG_RESULT(yes)
864 ],
865 [
866 AC_MSG_RESULT(no)
867 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000868)
869
Damien Miller18bb4732001-03-28 14:35:30 +1000870AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000871AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000872 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000873#include <sys/types.h>
874#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700875int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000876 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100877 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000878 [
879 AC_MSG_RESULT(no)
880 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000881 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800882 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000883 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
884 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000885 ]
886)
887
Damien Miller36f49652004-08-15 18:40:59 +1000888AC_MSG_CHECKING([for /proc/pid/fd directory])
889if test -d "/proc/$$/fd" ; then
890 AC_DEFINE(HAVE_PROC_PID)
891 AC_MSG_RESULT(yes)
892else
893 AC_MSG_RESULT(no)
894fi
895
Damien Millerc547bf12001-02-16 10:18:12 +1100896# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100897SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100898AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100899 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100900 [
901 if test "x$withval" != "xno" ; then
902
903 if test "x$withval" != "xyes" ; then
904 CPPFLAGS="$CPPFLAGS -I${withval}/include"
905 LDFLAGS="$LDFLAGS -L${withval}/lib"
906 fi
907
908 AC_DEFINE(SKEY)
909 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100910 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800911
Tim Rice4cec93f2002-02-26 08:40:48 -0800912 AC_MSG_CHECKING([for s/key support])
913 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100914 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800915#include <stdio.h>
916#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700917int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800918 ],
919 [AC_MSG_RESULT(yes)],
920 [
921 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100922 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
923 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000924 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
925 AC_TRY_COMPILE(
926 [#include <stdio.h>
927 #include <skey.h>],
928 [(void)skeychallenge(NULL,"name","",0);],
929 [AC_MSG_RESULT(yes)
930 AC_DEFINE(SKEYCHALLENGE_4ARG)],
931 [AC_MSG_RESULT(no)]
932 )
Damien Millerc547bf12001-02-16 10:18:12 +1100933 fi
934 ]
935)
936
937# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700938TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100939AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100940 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100941 [
942 if test "x$withval" != "xno" ; then
943 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700944 saved_LDFLAGS="$LDFLAGS"
945 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800946 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800947 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700948 if test -d "${withval}/lib"; then
949 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700950 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700951 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700952 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700953 fi
954 else
955 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700956 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700957 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700958 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700959 fi
960 fi
961 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700962 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700963 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700964 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700965 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700966 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800967 LIBWRAP="-lwrap"
968 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100969 AC_MSG_CHECKING(for libwrap)
970 AC_TRY_LINK(
971 [
Damien Miller0ac45002004-04-14 20:14:26 +1000972#include <sys/types.h>
973#include <sys/socket.h>
974#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100975#include <tcpd.h>
976 int deny_severity = 0, allow_severity = 0;
977 ],
978 [hosts_access(0);],
979 [
980 AC_MSG_RESULT(yes)
981 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800982 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700983 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100984 ],
985 [
986 AC_MSG_ERROR([*** libwrap missing])
987 ]
988 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800989 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100990 fi
991 ]
992)
993
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100994# Check whether user wants libedit support
995LIBEDIT_MSG="no"
996AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100997 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100998 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100999 if test "x$withval" != "xyes"; then
1000 CPPFLAGS="$CPPFLAGS -I$withval/include"
1001 LDFLAGS="$LDFLAGS -L$withval/lib"
1002 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001003 AC_CHECK_LIB(edit, el_init,
1004 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1005 LIBEDIT="-ledit -lcurses"
1006 LIBEDIT_MSG="yes"
1007 AC_SUBST(LIBEDIT)
1008 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001009 [ AC_MSG_ERROR(libedit not found) ],
1010 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001011 )
1012 fi ]
1013)
1014
Darren Tuckerd9f88912005-02-20 21:01:48 +11001015AUDIT_MODULE=none
1016AC_ARG_WITH(audit,
1017 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1018 [
1019 AC_MSG_CHECKING(for supported audit module)
1020 case "$withval" in
1021 bsm)
1022 AC_MSG_RESULT(bsm)
1023 AUDIT_MODULE=bsm
1024 dnl Checks for headers, libs and functions
1025 AC_CHECK_HEADERS(bsm/audit.h, [],
1026 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1027 AC_CHECK_LIB(bsm, getaudit, [],
1028 [AC_MSG_ERROR(BSM enabled and required library not found)])
1029 AC_CHECK_FUNCS(getaudit, [],
1030 [AC_MSG_ERROR(BSM enabled and required function not found)])
1031 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001032 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001033 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1034 ;;
1035 debug)
1036 AUDIT_MODULE=debug
1037 AC_MSG_RESULT(debug)
1038 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1039 ;;
1040 *)
1041 AC_MSG_ERROR([Unknown audit module $withval])
1042 ;;
1043 esac ]
1044)
1045
Damien Millerfe1f1432003-02-24 15:45:42 +11001046dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001047AC_CHECK_FUNCS( \
1048 arc4random \
1049 b64_ntop \
1050 __b64_ntop \
1051 b64_pton \
1052 __b64_pton \
1053 bcopy \
1054 bindresvport_sa \
1055 clock \
1056 closefrom \
1057 dirfd \
1058 fchdir \
1059 fchmod \
1060 fchown \
1061 freeaddrinfo \
1062 futimes \
1063 getaddrinfo \
1064 getcwd \
1065 getgrouplist \
1066 getnameinfo \
1067 getopt \
1068 getpeereid \
1069 _getpty \
1070 getrlimit \
1071 getttyent \
1072 glob \
1073 inet_aton \
1074 inet_ntoa \
1075 inet_ntop \
1076 innetgr \
1077 login_getcapbool \
1078 md5_crypt \
1079 memmove \
1080 mkdtemp \
1081 mmap \
1082 ngetaddrinfo \
1083 nsleep \
1084 ogetaddrinfo \
1085 openlog_r \
1086 openpty \
1087 prctl \
1088 pstat \
1089 readpassphrase \
1090 realpath \
1091 recvmsg \
1092 rresvport_af \
1093 sendmsg \
1094 setdtablesize \
1095 setegid \
1096 setenv \
1097 seteuid \
1098 setgroups \
1099 setlogin \
1100 setpcred \
1101 setproctitle \
1102 setregid \
1103 setreuid \
1104 setrlimit \
1105 setsid \
1106 setvbuf \
1107 sigaction \
1108 sigvec \
1109 snprintf \
1110 socketpair \
1111 strdup \
1112 strerror \
1113 strlcat \
1114 strlcpy \
1115 strmode \
1116 strnvis \
1117 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001118 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001119 strtoul \
1120 sysconf \
1121 tcgetpgrp \
1122 truncate \
1123 unsetenv \
1124 updwtmpx \
1125 utimes \
1126 vhangup \
1127 vsnprintf \
1128 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001129)
Tim Rice13aae5e2001-10-21 17:53:58 -07001130
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001131# IRIX has a const char return value for gai_strerror()
1132AC_CHECK_FUNCS(gai_strerror,[
1133 AC_DEFINE(HAVE_GAI_STRERROR)
1134 AC_TRY_COMPILE([
1135#include <sys/types.h>
1136#include <sys/socket.h>
1137#include <netdb.h>
1138
1139const char *gai_strerror(int);],[
1140char *str;
1141
1142str = gai_strerror(0);],[
1143 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1144 [Define if gai_strerror() returns const char *])])])
1145
Damien Millercd6853c2003-01-28 11:33:42 +11001146AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1147
Darren Tuckerf1159b52003-07-07 19:44:01 +10001148dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001149AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001150AC_CHECK_DECL(strsep,
1151 [AC_CHECK_FUNCS(strsep)],
1152 [],
1153 [
1154#ifdef HAVE_STRING_H
1155# include <string.h>
1156#endif
1157 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001158
Darren Tuckerb2427c82003-09-10 15:22:44 +10001159dnl tcsendbreak might be a macro
1160AC_CHECK_DECL(tcsendbreak,
1161 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001162 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001163 [#include <termios.h>]
1164)
1165
Darren Tucker5bb14002004-04-23 18:53:10 +10001166AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1167
Darren Tucker2a6b0292003-12-31 14:59:17 +11001168AC_CHECK_FUNCS(setresuid, [
1169 dnl Some platorms have setresuid that isn't implemented, test for this
1170 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001171 AC_RUN_IFELSE(
1172 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001173#include <stdlib.h>
1174#include <errno.h>
1175int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001176 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001177 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001178 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001179 AC_MSG_RESULT(not implemented)],
1180 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001181 )
1182])
Darren Tuckere937be32003-12-17 18:53:26 +11001183
Darren Tucker2a6b0292003-12-31 14:59:17 +11001184AC_CHECK_FUNCS(setresgid, [
1185 dnl Some platorms have setresgid that isn't implemented, test for this
1186 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001187 AC_RUN_IFELSE(
1188 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001189#include <stdlib.h>
1190#include <errno.h>
1191int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001192 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001193 [AC_MSG_RESULT(yes)],
1194 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001195 AC_MSG_RESULT(not implemented)],
1196 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001197 )
1198])
Darren Tuckere937be32003-12-17 18:53:26 +11001199
Damien Millerad833b32000-08-23 10:46:23 +10001200dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001201AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001202dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001203AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001204AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001205dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001206AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001207AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001208
Damien Millera8e06ce2003-11-21 23:48:55 +11001209AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001210 [AC_DEFINE(HAVE_DAEMON)],
1211 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1212)
1213
Damien Millera8e06ce2003-11-21 23:48:55 +11001214AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001215 [AC_DEFINE(HAVE_GETPAGESIZE)],
1216 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1217)
1218
Damien Millercb170cb2000-07-01 16:52:55 +10001219# Check for broken snprintf
1220if test "x$ac_cv_func_snprintf" = "xyes" ; then
1221 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001222 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001223 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001224#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001225int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001226 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001227 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001228 [
1229 AC_MSG_RESULT(no)
1230 AC_DEFINE(BROKEN_SNPRINTF)
1231 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001232 ],
1233 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001234 )
1235fi
1236
Damien Millerb4097182004-05-23 14:09:40 +10001237# Check for missing getpeereid (or equiv) support
1238NO_PEERCHECK=""
1239if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1240 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1241 AC_TRY_COMPILE(
1242 [#include <sys/types.h>
1243 #include <sys/socket.h>],
1244 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001245 [ AC_MSG_RESULT(yes)
1246 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1247 ],
Damien Millerb4097182004-05-23 14:09:40 +10001248 [AC_MSG_RESULT(no)
1249 NO_PEERCHECK=1]
1250 )
1251fi
1252
Damien Millere8328192003-01-07 15:18:32 +11001253dnl see whether mkstemp() requires XXXXXX
1254if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1255AC_MSG_CHECKING([for (overly) strict mkstemp])
1256AC_TRY_RUN(
1257 [
1258#include <stdlib.h>
1259main() { char template[]="conftest.mkstemp-test";
1260if (mkstemp(template) == -1)
1261 exit(1);
1262unlink(template); exit(0);
1263}
1264 ],
1265 [
1266 AC_MSG_RESULT(no)
1267 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001268 [
Damien Millere8328192003-01-07 15:18:32 +11001269 AC_MSG_RESULT(yes)
1270 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1271 ],
1272 [
1273 AC_MSG_RESULT(yes)
1274 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001275 ]
Damien Millere8328192003-01-07 15:18:32 +11001276)
1277fi
1278
Darren Tucker70a3d552003-08-21 17:58:29 +10001279dnl make sure that openpty does not reacquire controlling terminal
1280if test ! -z "$check_for_openpty_ctty_bug"; then
1281 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1282 AC_TRY_RUN(
1283 [
1284#include <stdio.h>
1285#include <sys/fcntl.h>
1286#include <sys/types.h>
1287#include <sys/wait.h>
1288
1289int
1290main()
1291{
1292 pid_t pid;
1293 int fd, ptyfd, ttyfd, status;
1294
1295 pid = fork();
1296 if (pid < 0) { /* failed */
1297 exit(1);
1298 } else if (pid > 0) { /* parent */
1299 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001300 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001301 exit(WEXITSTATUS(status));
1302 else
1303 exit(2);
1304 } else { /* child */
1305 close(0); close(1); close(2);
1306 setsid();
1307 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1308 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1309 if (fd >= 0)
1310 exit(3); /* Acquired ctty: broken */
1311 else
1312 exit(0); /* Did not acquire ctty: OK */
1313 }
1314}
1315 ],
1316 [
1317 AC_MSG_RESULT(yes)
1318 ],
1319 [
1320 AC_MSG_RESULT(no)
1321 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1322 ]
1323 )
1324fi
1325
Tim Rice8bb561b2005-03-17 16:23:19 -08001326if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1327 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001328 AC_MSG_CHECKING(if getaddrinfo seems to work)
1329 AC_TRY_RUN(
1330 [
1331#include <stdio.h>
1332#include <sys/socket.h>
1333#include <netdb.h>
1334#include <errno.h>
1335#include <netinet/in.h>
1336
1337#define TEST_PORT "2222"
1338
1339int
1340main(void)
1341{
1342 int err, sock;
1343 struct addrinfo *gai_ai, *ai, hints;
1344 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1345
1346 memset(&hints, 0, sizeof(hints));
1347 hints.ai_family = PF_UNSPEC;
1348 hints.ai_socktype = SOCK_STREAM;
1349 hints.ai_flags = AI_PASSIVE;
1350
1351 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1352 if (err != 0) {
1353 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1354 exit(1);
1355 }
1356
1357 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1358 if (ai->ai_family != AF_INET6)
1359 continue;
1360
1361 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1362 sizeof(ntop), strport, sizeof(strport),
1363 NI_NUMERICHOST|NI_NUMERICSERV);
1364
1365 if (err != 0) {
1366 if (err == EAI_SYSTEM)
1367 perror("getnameinfo EAI_SYSTEM");
1368 else
1369 fprintf(stderr, "getnameinfo failed: %s\n",
1370 gai_strerror(err));
1371 exit(2);
1372 }
1373
1374 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1375 if (sock < 0)
1376 perror("socket");
1377 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1378 if (errno == EBADF)
1379 exit(3);
1380 }
1381 }
1382 exit(0);
1383}
1384 ],
1385 [
1386 AC_MSG_RESULT(yes)
1387 ],
1388 [
1389 AC_MSG_RESULT(no)
1390 AC_DEFINE(BROKEN_GETADDRINFO)
1391 ]
1392 )
1393fi
1394
Tim Rice8bb561b2005-03-17 16:23:19 -08001395if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1396 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001397 AC_MSG_CHECKING(if getaddrinfo seems to work)
1398 AC_TRY_RUN(
1399 [
1400#include <stdio.h>
1401#include <sys/socket.h>
1402#include <netdb.h>
1403#include <errno.h>
1404#include <netinet/in.h>
1405
1406#define TEST_PORT "2222"
1407
1408int
1409main(void)
1410{
1411 int err, sock;
1412 struct addrinfo *gai_ai, *ai, hints;
1413 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1414
1415 memset(&hints, 0, sizeof(hints));
1416 hints.ai_family = PF_UNSPEC;
1417 hints.ai_socktype = SOCK_STREAM;
1418 hints.ai_flags = AI_PASSIVE;
1419
1420 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1421 if (err != 0) {
1422 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1423 exit(1);
1424 }
1425
1426 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1427 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1428 continue;
1429
1430 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1431 sizeof(ntop), strport, sizeof(strport),
1432 NI_NUMERICHOST|NI_NUMERICSERV);
1433
1434 if (ai->ai_family == AF_INET && err != 0) {
1435 perror("getnameinfo");
1436 exit(2);
1437 }
1438 }
1439 exit(0);
1440}
1441 ],
1442 [
1443 AC_MSG_RESULT(yes)
1444 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1445[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1446 ],
1447 [
1448 AC_MSG_RESULT(no)
1449 AC_DEFINE(BROKEN_GETADDRINFO)
1450 ]
1451 )
1452fi
1453
Darren Tuckera56f1912004-11-02 20:30:54 +11001454if test "x$check_for_conflicting_getspnam" = "x1"; then
1455 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1456 AC_COMPILE_IFELSE(
1457 [
1458#include <shadow.h>
1459int main(void) {exit(0);}
1460 ],
1461 [
1462 AC_MSG_RESULT(no)
1463 ],
1464 [
1465 AC_MSG_RESULT(yes)
1466 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1467 [Conflicting defs for getspnam])
1468 ]
1469 )
1470fi
1471
Damien Miller606f8802000-09-16 15:39:56 +11001472AC_FUNC_GETPGRP
1473
Damien Millera64b57a2001-01-17 10:44:13 +11001474# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001475PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001476AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001477 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001478 [
Damien Millera64b57a2001-01-17 10:44:13 +11001479 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001480 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1481 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001482 AC_MSG_ERROR([PAM headers not found])
1483 fi
1484
1485 AC_CHECK_LIB(dl, dlopen, , )
1486 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1487 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001488 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001489
Damien Millera64b57a2001-01-17 10:44:13 +11001490 PAM_MSG="yes"
1491
1492 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001493 if test $ac_cv_lib_dl_dlopen = yes; then
1494 LIBPAM="-lpam -ldl"
1495 else
1496 LIBPAM="-lpam"
1497 fi
1498 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001499 fi
1500 ]
1501)
Damien Millera22ba012000-03-02 23:09:20 +11001502
Damien Millera64b57a2001-01-17 10:44:13 +11001503# Check for older PAM
1504if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001505 # Check PAM strerror arguments (old PAM)
1506 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1507 AC_TRY_COMPILE(
1508 [
Damien Miller81171112000-04-23 11:14:01 +10001509#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001510#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001511#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001512#elif defined (HAVE_PAM_PAM_APPL_H)
1513#include <pam/pam_appl.h>
1514#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001515 ],
1516 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001517 [AC_MSG_RESULT(no)],
1518 [
1519 AC_DEFINE(HAVE_OLD_PAM)
1520 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001521 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001522 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001523 )
Damien Millera22ba012000-03-02 23:09:20 +11001524fi
1525
Tim Riceaef73712002-05-11 13:17:42 -07001526# Search for OpenSSL
1527saved_CPPFLAGS="$CPPFLAGS"
1528saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001529AC_ARG_WITH(ssl-dir,
1530 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1531 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001532 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001533 case "$withval" in
1534 # Relative paths
1535 ./*|../*) withval="`pwd`/$withval"
1536 esac
Tim Riceaef73712002-05-11 13:17:42 -07001537 if test -d "$withval/lib"; then
1538 if test -n "${need_dash_r}"; then
1539 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1540 else
1541 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1542 fi
1543 else
1544 if test -n "${need_dash_r}"; then
1545 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1546 else
1547 LDFLAGS="-L${withval} ${LDFLAGS}"
1548 fi
1549 fi
1550 if test -d "$withval/include"; then
1551 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1552 else
1553 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1554 fi
Damien Millera22ba012000-03-02 23:09:20 +11001555 fi
1556 ]
1557)
Tim Rice3d5352e2004-02-12 09:27:21 -08001558LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001559AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001560 [
Tim Riceaef73712002-05-11 13:17:42 -07001561 dnl Check default openssl install dir
1562 if test -n "${need_dash_r}"; then
1563 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001564 else
Tim Riceaef73712002-05-11 13:17:42 -07001565 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001566 fi
Tim Riceaef73712002-05-11 13:17:42 -07001567 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1568 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1569 [
1570 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1571 ]
1572 )
1573 ]
1574)
1575
Tim Riced730b782002-08-13 18:52:10 -07001576# Determine OpenSSL header version
1577AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001578AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001579 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001580#include <stdio.h>
1581#include <string.h>
1582#include <openssl/opensslv.h>
1583#define DATA "conftest.sslincver"
1584int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001585 FILE *fd;
1586 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001587
Damien Millera8e06ce2003-11-21 23:48:55 +11001588 fd = fopen(DATA,"w");
1589 if(fd == NULL)
1590 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001591
1592 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1593 exit(1);
1594
1595 exit(0);
1596}
Darren Tucker623d92f2004-09-12 22:36:15 +10001597 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001598 [
1599 ssl_header_ver=`cat conftest.sslincver`
1600 AC_MSG_RESULT($ssl_header_ver)
1601 ],
1602 [
1603 AC_MSG_RESULT(not found)
1604 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001605 ],
1606 [
1607 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001608 ]
1609)
1610
1611# Determine OpenSSL library version
1612AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001613AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001614 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001615#include <stdio.h>
1616#include <string.h>
1617#include <openssl/opensslv.h>
1618#include <openssl/crypto.h>
1619#define DATA "conftest.ssllibver"
1620int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001621 FILE *fd;
1622 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001623
Damien Millera8e06ce2003-11-21 23:48:55 +11001624 fd = fopen(DATA,"w");
1625 if(fd == NULL)
1626 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001627
1628 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1629 exit(1);
1630
1631 exit(0);
1632}
Darren Tucker623d92f2004-09-12 22:36:15 +10001633 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001634 [
1635 ssl_library_ver=`cat conftest.ssllibver`
1636 AC_MSG_RESULT($ssl_library_ver)
1637 ],
1638 [
1639 AC_MSG_RESULT(not found)
1640 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001641 ],
1642 [
1643 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001644 ]
1645)
Damien Millera22ba012000-03-02 23:09:20 +11001646
Damien Millerec932372002-01-22 22:16:03 +11001647# Sanity check OpenSSL headers
1648AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001649AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001650 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001651#include <string.h>
1652#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001653int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001654 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001655 [
1656 AC_MSG_RESULT(yes)
1657 ],
1658 [
1659 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001660 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1661Check config.log for details.
1662Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001663 ],
1664 [
1665 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001666 ]
1667)
1668
Tim Rice3d5352e2004-02-12 09:27:21 -08001669# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1670# because the system crypt() is more featureful.
1671if test "x$check_for_libcrypt_before" = "x1"; then
1672 AC_CHECK_LIB(crypt, crypt)
1673fi
1674
Damien Millera8e06ce2003-11-21 23:48:55 +11001675# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001676# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001677if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001678 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001679fi
1680
Damien Miller6c21c512002-01-22 21:57:53 +11001681
1682### Configure cryptographic random number support
1683
1684# Check wheter OpenSSL seeds itself
1685AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001686AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001687 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001688#include <string.h>
1689#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001690int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001691 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001692 [
1693 OPENSSL_SEEDS_ITSELF=yes
1694 AC_MSG_RESULT(yes)
1695 ],
1696 [
1697 AC_MSG_RESULT(no)
1698 # Default to use of the rand helper if OpenSSL doesn't
1699 # seed itself
1700 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001701 ],
1702 [
1703 AC_MSG_WARN([cross compiling: assuming yes])
1704 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001705 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001706 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001707 ]
1708)
1709
1710
1711# Do we want to force the use of the rand helper?
1712AC_ARG_WITH(rand-helper,
1713 [ --with-rand-helper Use subprocess to gather strong randomness ],
1714 [
1715 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001716 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001717 # the previous test showed it to be unseeded.
1718 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1719 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1720 OPENSSL_SEEDS_ITSELF=yes
1721 USE_RAND_HELPER=""
1722 fi
1723 else
1724 USE_RAND_HELPER=yes
1725 fi
1726 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001727)
Damien Miller6c21c512002-01-22 21:57:53 +11001728
1729# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001730if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001731 # OpenSSL only
1732 AC_DEFINE(OPENSSL_PRNG_ONLY)
1733 RAND_MSG="OpenSSL internal ONLY"
1734 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001735elif test ! -z "$USE_RAND_HELPER" ; then
1736 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001737 RAND_MSG="ssh-rand-helper"
1738 INSTALL_SSH_RAND_HELPER="yes"
1739fi
1740AC_SUBST(INSTALL_SSH_RAND_HELPER)
1741
1742### Configuration of ssh-rand-helper
1743
1744# PRNGD TCP socket
1745AC_ARG_WITH(prngd-port,
1746 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1747 [
Damien Millere996d722002-01-23 11:20:59 +11001748 case "$withval" in
1749 no)
1750 withval=""
1751 ;;
1752 [[0-9]]*)
1753 ;;
1754 *)
1755 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1756 ;;
1757 esac
1758 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001759 PRNGD_PORT="$withval"
1760 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1761 fi
1762 ]
1763)
1764
1765# PRNGD Unix domain socket
1766AC_ARG_WITH(prngd-socket,
1767 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1768 [
Damien Millere996d722002-01-23 11:20:59 +11001769 case "$withval" in
1770 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001771 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001772 ;;
1773 no)
1774 withval=""
1775 ;;
1776 /*)
1777 ;;
1778 *)
1779 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1780 ;;
1781 esac
1782
1783 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001784 if test ! -z "$PRNGD_PORT" ; then
1785 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1786 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001787 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001788 AC_MSG_WARN(Entropy socket is not readable)
1789 fi
1790 PRNGD_SOCKET="$withval"
1791 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1792 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001793 ],
1794 [
1795 # Check for existing socket only if we don't have a random device already
1796 if test "$USE_RAND_HELPER" = yes ; then
1797 AC_MSG_CHECKING(for PRNGD/EGD socket)
1798 # Insert other locations here
1799 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1800 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1801 PRNGD_SOCKET="$sock"
1802 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1803 break;
1804 fi
1805 done
1806 if test ! -z "$PRNGD_SOCKET" ; then
1807 AC_MSG_RESULT($PRNGD_SOCKET)
1808 else
1809 AC_MSG_RESULT(not found)
1810 fi
1811 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001812 ]
1813)
1814
1815# Change default command timeout for hashing entropy source
1816entropy_timeout=200
1817AC_ARG_WITH(entropy-timeout,
1818 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1819 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001820 if test -n "$withval" && test "x$withval" != "xno" && \
1821 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001822 entropy_timeout=$withval
1823 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001824 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001825)
Damien Miller6c21c512002-01-22 21:57:53 +11001826AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1827
Damien Millerd3f6ad22002-06-25 10:24:47 +10001828SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001829AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001830 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001831 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001832 if test -n "$withval" && test "x$withval" != "xno" && \
1833 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001834 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001835 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001836 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001837)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001838AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1839AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001840
Tim Rice88f2ab52002-03-17 12:17:34 -08001841# We do this little dance with the search path to insure
1842# that programs that we select for use by installed programs
1843# (which may be run by the super-user) come from trusted
1844# locations before they come from the user's private area.
1845# This should help avoid accidentally configuring some
1846# random version of a program in someone's personal bin.
1847
1848OPATH=$PATH
1849PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001850test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001851test -d /sbin && PATH=$PATH:/sbin
1852test -d /usr/sbin && PATH=$PATH:/usr/sbin
1853PATH=$PATH:/etc:$OPATH
1854
Damien Millera8e06ce2003-11-21 23:48:55 +11001855# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001856OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1857OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1858OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1859OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1860OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1861OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1862OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1863OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1864OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1865OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1866OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1867OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1868OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1869OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1870OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1871OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001872# restore PATH
1873PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001874
1875# Where does ssh-rand-helper get its randomness from?
1876INSTALL_SSH_PRNG_CMDS=""
1877if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1878 if test ! -z "$PRNGD_PORT" ; then
1879 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1880 elif test ! -z "$PRNGD_SOCKET" ; then
1881 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1882 else
1883 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1884 RAND_HELPER_CMDHASH=yes
1885 INSTALL_SSH_PRNG_CMDS="yes"
1886 fi
1887fi
1888AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1889
1890
Ben Lindstromb5628642000-10-18 00:02:25 +00001891# Cheap hack to ensure NEWS-OS libraries are arranged right.
1892if test ! -z "$SONY" ; then
1893 LIBS="$LIBS -liberty";
1894fi
1895
Damien Millera22ba012000-03-02 23:09:20 +11001896# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001897AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001898AC_CHECK_SIZEOF(short int, 2)
1899AC_CHECK_SIZEOF(int, 4)
1900AC_CHECK_SIZEOF(long int, 4)
1901AC_CHECK_SIZEOF(long long int, 8)
1902
Damien Millerfa2bb692002-04-23 23:22:25 +10001903# Sanity check long long for some platforms (AIX)
1904if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1905 ac_cv_sizeof_long_long_int=0
1906fi
1907
Damien Millera22ba012000-03-02 23:09:20 +11001908# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001909AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1910 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001911 [ #include <sys/types.h> ],
1912 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001913 [ ac_cv_have_u_int="yes" ],
1914 [ ac_cv_have_u_int="no" ]
1915 )
1916])
1917if test "x$ac_cv_have_u_int" = "xyes" ; then
1918 AC_DEFINE(HAVE_U_INT)
1919 have_u_int=1
1920fi
1921
Damien Miller61e50f12000-05-08 20:49:37 +10001922AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1923 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001924 [ #include <sys/types.h> ],
1925 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001926 [ ac_cv_have_intxx_t="yes" ],
1927 [ ac_cv_have_intxx_t="no" ]
1928 )
1929])
1930if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1931 AC_DEFINE(HAVE_INTXX_T)
1932 have_intxx_t=1
1933fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001934
1935if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001936 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001937then
1938 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1939 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001940 [ #include <stdint.h> ],
1941 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001942 [
1943 AC_DEFINE(HAVE_INTXX_T)
1944 AC_MSG_RESULT(yes)
1945 ],
1946 [ AC_MSG_RESULT(no) ]
1947 )
1948fi
1949
Damien Miller578783e2000-09-23 14:12:24 +11001950AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1951 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001952 [
1953#include <sys/types.h>
1954#ifdef HAVE_STDINT_H
1955# include <stdint.h>
1956#endif
1957#include <sys/socket.h>
1958#ifdef HAVE_SYS_BITYPES_H
1959# include <sys/bitypes.h>
1960#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001961 ],
1962 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001963 [ ac_cv_have_int64_t="yes" ],
1964 [ ac_cv_have_int64_t="no" ]
1965 )
1966])
1967if test "x$ac_cv_have_int64_t" = "xyes" ; then
1968 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001969fi
1970
Damien Miller61e50f12000-05-08 20:49:37 +10001971AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1972 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001973 [ #include <sys/types.h> ],
1974 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001975 [ ac_cv_have_u_intxx_t="yes" ],
1976 [ ac_cv_have_u_intxx_t="no" ]
1977 )
1978])
1979if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1980 AC_DEFINE(HAVE_U_INTXX_T)
1981 have_u_intxx_t=1
1982fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001983
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001984if test -z "$have_u_intxx_t" ; then
1985 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1986 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001987 [ #include <sys/socket.h> ],
1988 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001989 [
1990 AC_DEFINE(HAVE_U_INTXX_T)
1991 AC_MSG_RESULT(yes)
1992 ],
1993 [ AC_MSG_RESULT(no) ]
1994 )
1995fi
1996
Damien Miller578783e2000-09-23 14:12:24 +11001997AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1998 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001999 [ #include <sys/types.h> ],
2000 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002001 [ ac_cv_have_u_int64_t="yes" ],
2002 [ ac_cv_have_u_int64_t="no" ]
2003 )
2004])
2005if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2006 AC_DEFINE(HAVE_U_INT64_T)
2007 have_u_int64_t=1
2008fi
2009
Tim Rice4cec93f2002-02-26 08:40:48 -08002010if test -z "$have_u_int64_t" ; then
2011 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2012 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002013 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002014 [ u_int64_t a; a = 1],
2015 [
2016 AC_DEFINE(HAVE_U_INT64_T)
2017 AC_MSG_RESULT(yes)
2018 ],
2019 [ AC_MSG_RESULT(no) ]
2020 )
2021fi
2022
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002023if test -z "$have_u_intxx_t" ; then
2024 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2025 AC_TRY_COMPILE(
2026 [
2027#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002028 ],
2029 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002030 [ ac_cv_have_uintxx_t="yes" ],
2031 [ ac_cv_have_uintxx_t="no" ]
2032 )
2033 ])
2034 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2035 AC_DEFINE(HAVE_UINTXX_T)
2036 fi
2037fi
2038
2039if test -z "$have_uintxx_t" ; then
2040 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2041 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002042 [ #include <stdint.h> ],
2043 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002044 [
2045 AC_DEFINE(HAVE_UINTXX_T)
2046 AC_MSG_RESULT(yes)
2047 ],
2048 [ AC_MSG_RESULT(no) ]
2049 )
2050fi
2051
Damien Milleredb82922000-06-20 13:25:52 +10002052if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002053 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002054then
2055 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2056 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002057 [
2058#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002059 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002060 [
Damien Miller70494d12000-04-03 15:57:06 +10002061 int8_t a; int16_t b; int32_t c;
2062 u_int8_t e; u_int16_t f; u_int32_t g;
2063 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002064 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002065 [
2066 AC_DEFINE(HAVE_U_INTXX_T)
2067 AC_DEFINE(HAVE_INTXX_T)
2068 AC_MSG_RESULT(yes)
2069 ],
2070 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002071 )
Damien Millerb29ea912000-01-15 14:12:03 +11002072fi
2073
Damien Miller58be7382001-09-15 21:31:54 +10002074
2075AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2076 AC_TRY_COMPILE(
2077 [
2078#include <sys/types.h>
2079 ],
2080 [ u_char foo; foo = 125; ],
2081 [ ac_cv_have_u_char="yes" ],
2082 [ ac_cv_have_u_char="no" ]
2083 )
2084])
2085if test "x$ac_cv_have_u_char" = "xyes" ; then
2086 AC_DEFINE(HAVE_U_CHAR)
2087fi
2088
Tim Rice13aae5e2001-10-21 17:53:58 -07002089TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002090
Tim Rice200a5c02002-02-26 22:12:34 -08002091AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002092
Damien Miller848b9932005-02-24 12:12:34 +11002093AC_CHECK_TYPES(in_addr_t,,,
2094[#include <sys/types.h>
2095#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002096
Damien Miller61e50f12000-05-08 20:49:37 +10002097AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2098 AC_TRY_COMPILE(
2099 [
2100#include <sys/types.h>
2101 ],
2102 [ size_t foo; foo = 1235; ],
2103 [ ac_cv_have_size_t="yes" ],
2104 [ ac_cv_have_size_t="no" ]
2105 )
2106])
2107if test "x$ac_cv_have_size_t" = "xyes" ; then
2108 AC_DEFINE(HAVE_SIZE_T)
2109fi
Damien Miller95058511999-12-29 10:36:45 +11002110
Damien Miller615f9392000-05-17 22:53:33 +10002111AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2112 AC_TRY_COMPILE(
2113 [
2114#include <sys/types.h>
2115 ],
2116 [ ssize_t foo; foo = 1235; ],
2117 [ ac_cv_have_ssize_t="yes" ],
2118 [ ac_cv_have_ssize_t="no" ]
2119 )
2120])
2121if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2122 AC_DEFINE(HAVE_SSIZE_T)
2123fi
2124
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002125AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2126 AC_TRY_COMPILE(
2127 [
2128#include <time.h>
2129 ],
2130 [ clock_t foo; foo = 1235; ],
2131 [ ac_cv_have_clock_t="yes" ],
2132 [ ac_cv_have_clock_t="no" ]
2133 )
2134])
2135if test "x$ac_cv_have_clock_t" = "xyes" ; then
2136 AC_DEFINE(HAVE_CLOCK_T)
2137fi
2138
Damien Millerb54b40e2000-06-23 08:23:34 +10002139AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2140 AC_TRY_COMPILE(
2141 [
2142#include <sys/types.h>
2143#include <sys/socket.h>
2144 ],
2145 [ sa_family_t foo; foo = 1235; ],
2146 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002147 [ AC_TRY_COMPILE(
2148 [
2149#include <sys/types.h>
2150#include <sys/socket.h>
2151#include <netinet/in.h>
2152 ],
2153 [ sa_family_t foo; foo = 1235; ],
2154 [ ac_cv_have_sa_family_t="yes" ],
2155
Damien Millerb54b40e2000-06-23 08:23:34 +10002156 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002157 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002158 )
2159])
2160if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2161 AC_DEFINE(HAVE_SA_FAMILY_T)
2162fi
2163
Damien Miller0f91b4e2000-06-18 15:43:25 +10002164AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2165 AC_TRY_COMPILE(
2166 [
2167#include <sys/types.h>
2168 ],
2169 [ pid_t foo; foo = 1235; ],
2170 [ ac_cv_have_pid_t="yes" ],
2171 [ ac_cv_have_pid_t="no" ]
2172 )
2173])
2174if test "x$ac_cv_have_pid_t" = "xyes" ; then
2175 AC_DEFINE(HAVE_PID_T)
2176fi
2177
2178AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2179 AC_TRY_COMPILE(
2180 [
2181#include <sys/types.h>
2182 ],
2183 [ mode_t foo; foo = 1235; ],
2184 [ ac_cv_have_mode_t="yes" ],
2185 [ ac_cv_have_mode_t="no" ]
2186 )
2187])
2188if test "x$ac_cv_have_mode_t" = "xyes" ; then
2189 AC_DEFINE(HAVE_MODE_T)
2190fi
2191
Damien Miller61e50f12000-05-08 20:49:37 +10002192
2193AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2194 AC_TRY_COMPILE(
2195 [
Damien Miller81171112000-04-23 11:14:01 +10002196#include <sys/types.h>
2197#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002198 ],
2199 [ struct sockaddr_storage s; ],
2200 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2201 [ ac_cv_have_struct_sockaddr_storage="no" ]
2202 )
2203])
2204if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2205 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2206fi
Damien Miller34132e52000-01-14 15:45:46 +11002207
Damien Miller61e50f12000-05-08 20:49:37 +10002208AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2209 AC_TRY_COMPILE(
2210 [
Damien Miller7b22d652000-06-18 14:07:04 +10002211#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002212#include <netinet/in.h>
2213 ],
2214 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2215 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2216 [ ac_cv_have_struct_sockaddr_in6="no" ]
2217 )
2218])
2219if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2220 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2221fi
Damien Miller34132e52000-01-14 15:45:46 +11002222
Damien Miller61e50f12000-05-08 20:49:37 +10002223AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2224 AC_TRY_COMPILE(
2225 [
Damien Miller7b22d652000-06-18 14:07:04 +10002226#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002227#include <netinet/in.h>
2228 ],
2229 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2230 [ ac_cv_have_struct_in6_addr="yes" ],
2231 [ ac_cv_have_struct_in6_addr="no" ]
2232 )
2233])
2234if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2235 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2236fi
Damien Miller34132e52000-01-14 15:45:46 +11002237
Damien Miller61e50f12000-05-08 20:49:37 +10002238AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2239 AC_TRY_COMPILE(
2240 [
Damien Miller81171112000-04-23 11:14:01 +10002241#include <sys/types.h>
2242#include <sys/socket.h>
2243#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002244 ],
2245 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2246 [ ac_cv_have_struct_addrinfo="yes" ],
2247 [ ac_cv_have_struct_addrinfo="no" ]
2248 )
2249])
2250if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2251 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2252fi
2253
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002254AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2255 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002256 [ #include <sys/time.h> ],
2257 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002258 [ ac_cv_have_struct_timeval="yes" ],
2259 [ ac_cv_have_struct_timeval="no" ]
2260 )
2261])
2262if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2263 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2264 have_struct_timeval=1
2265fi
2266
Tim Rice4e4dc562003-03-18 10:21:40 -08002267AC_CHECK_TYPES(struct timespec)
2268
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002269# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002270if test "x$ac_cv_have_int64_t" = "xno" && \
2271 test "x$ac_cv_sizeof_long_int" != "x8" && \
2272 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002273 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2274 echo "an alternative compiler (I.E., GCC) before continuing."
2275 echo ""
2276 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002277else
2278dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002279 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002280 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002281#include <stdio.h>
2282#include <string.h>
2283#ifdef HAVE_SNPRINTF
2284main()
2285{
2286 char buf[50];
2287 char expected_out[50];
2288 int mazsize = 50 ;
2289#if (SIZEOF_LONG_INT == 8)
2290 long int num = 0x7fffffffffffffff;
2291#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002292 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002293#endif
2294 strcpy(expected_out, "9223372036854775807");
2295 snprintf(buf, mazsize, "%lld", num);
2296 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002297 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002298 exit(0);
2299}
2300#else
2301main() { exit(0); }
2302#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002303 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002304 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002305 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002306fi
2307
Damien Miller78315eb2000-09-29 23:01:36 +11002308dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002309OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2310OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2311OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2312OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2313OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002314OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002315OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2316OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002317OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002318OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2319OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2320OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2321OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002322OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2323OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2324OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2325OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002326
2327AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002328
Damien Miller61e50f12000-05-08 20:49:37 +10002329AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2330 ac_cv_have_ss_family_in_struct_ss, [
2331 AC_TRY_COMPILE(
2332 [
Damien Miller81171112000-04-23 11:14:01 +10002333#include <sys/types.h>
2334#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002335 ],
2336 [ struct sockaddr_storage s; s.ss_family = 1; ],
2337 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2338 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2339 )
2340])
2341if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2342 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2343fi
2344
Damien Miller61e50f12000-05-08 20:49:37 +10002345AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2346 ac_cv_have___ss_family_in_struct_ss, [
2347 AC_TRY_COMPILE(
2348 [
Damien Miller81171112000-04-23 11:14:01 +10002349#include <sys/types.h>
2350#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002351 ],
2352 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2353 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2354 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2355 )
2356])
2357if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2358 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2359fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002360
Damien Millerad833b32000-08-23 10:46:23 +10002361AC_CACHE_CHECK([for pw_class field in struct passwd],
2362 ac_cv_have_pw_class_in_struct_passwd, [
2363 AC_TRY_COMPILE(
2364 [
Damien Millerad833b32000-08-23 10:46:23 +10002365#include <pwd.h>
2366 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002367 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002368 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2369 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2370 )
2371])
2372if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2373 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2374fi
2375
Kevin Steves82456952001-06-22 21:14:18 +00002376AC_CACHE_CHECK([for pw_expire field in struct passwd],
2377 ac_cv_have_pw_expire_in_struct_passwd, [
2378 AC_TRY_COMPILE(
2379 [
2380#include <pwd.h>
2381 ],
2382 [ struct passwd p; p.pw_expire = 0; ],
2383 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2384 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2385 )
2386])
2387if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2388 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2389fi
2390
2391AC_CACHE_CHECK([for pw_change field in struct passwd],
2392 ac_cv_have_pw_change_in_struct_passwd, [
2393 AC_TRY_COMPILE(
2394 [
2395#include <pwd.h>
2396 ],
2397 [ struct passwd p; p.pw_change = 0; ],
2398 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2399 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2400 )
2401])
2402if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2403 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2404fi
Damien Miller61e50f12000-05-08 20:49:37 +10002405
Tim Rice28bbb0c2002-05-27 17:37:32 -07002406dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002407AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2408 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002409 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002410 [
Tim Riceae49fe62002-04-12 10:26:21 -07002411#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002412#include <sys/socket.h>
2413#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002414int main() {
2415#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002416#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002417exit(1);
2418#endif
2419struct msghdr m;
2420m.msg_accrights = 0;
2421exit(0);
2422}
Kevin Steves939c9db2002-03-22 17:23:25 +00002423 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002424 [ ac_cv_have_accrights_in_msghdr="yes" ],
2425 [ ac_cv_have_accrights_in_msghdr="no" ]
2426 )
2427])
2428if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2429 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2430fi
2431
Kevin Stevesa44e0352002-04-07 16:18:03 +00002432AC_CACHE_CHECK([for msg_control field in struct msghdr],
2433 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002434 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002435 [
Tim Riceae49fe62002-04-12 10:26:21 -07002436#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002437#include <sys/socket.h>
2438#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002439int main() {
2440#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002441#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002442exit(1);
2443#endif
2444struct msghdr m;
2445m.msg_control = 0;
2446exit(0);
2447}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002448 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002449 [ ac_cv_have_control_in_msghdr="yes" ],
2450 [ ac_cv_have_control_in_msghdr="no" ]
2451 )
2452])
2453if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2454 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2455fi
2456
Damien Miller61e50f12000-05-08 20:49:37 +10002457AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002458 AC_TRY_LINK([],
2459 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002460 [ ac_cv_libc_defines___progname="yes" ],
2461 [ ac_cv_libc_defines___progname="no" ]
2462 )
2463])
2464if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2465 AC_DEFINE(HAVE___PROGNAME)
2466fi
2467
Kevin Steves4846f4a2002-03-22 18:19:53 +00002468AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2469 AC_TRY_LINK([
2470#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002471],
2472 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002473 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2474 [ ac_cv_cc_implements___FUNCTION__="no" ]
2475 )
2476])
2477if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2478 AC_DEFINE(HAVE___FUNCTION__)
2479fi
2480
2481AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2482 AC_TRY_LINK([
2483#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002484],
2485 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002486 [ ac_cv_cc_implements___func__="yes" ],
2487 [ ac_cv_cc_implements___func__="no" ]
2488 )
2489])
2490if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2491 AC_DEFINE(HAVE___func__)
2492fi
2493
Damien Miller4f8e6692001-07-14 13:22:53 +10002494AC_CACHE_CHECK([whether getopt has optreset support],
2495 ac_cv_have_getopt_optreset, [
2496 AC_TRY_LINK(
2497 [
2498#include <getopt.h>
2499 ],
2500 [ extern int optreset; optreset = 0; ],
2501 [ ac_cv_have_getopt_optreset="yes" ],
2502 [ ac_cv_have_getopt_optreset="no" ]
2503 )
2504])
2505if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2506 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2507fi
Damien Millera22ba012000-03-02 23:09:20 +11002508
Damien Millerecbb26d2000-07-15 14:59:14 +10002509AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002510 AC_TRY_LINK([],
2511 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002512 [ ac_cv_libc_defines_sys_errlist="yes" ],
2513 [ ac_cv_libc_defines_sys_errlist="no" ]
2514 )
2515])
2516if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2517 AC_DEFINE(HAVE_SYS_ERRLIST)
2518fi
2519
2520
Damien Miller11fa2cc2000-08-16 10:35:58 +10002521AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002522 AC_TRY_LINK([],
2523 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002524 [ ac_cv_libc_defines_sys_nerr="yes" ],
2525 [ ac_cv_libc_defines_sys_nerr="no" ]
2526 )
2527])
2528if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2529 AC_DEFINE(HAVE_SYS_NERR)
2530fi
2531
Damien Millera8e06ce2003-11-21 23:48:55 +11002532SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002533# Check whether user wants sectok support
2534AC_ARG_WITH(sectok,
2535 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002536 [
2537 if test "x$withval" != "xno" ; then
2538 if test "x$withval" != "xyes" ; then
2539 CPPFLAGS="$CPPFLAGS -I${withval}"
2540 LDFLAGS="$LDFLAGS -L${withval}"
2541 if test ! -z "$need_dash_r" ; then
2542 LDFLAGS="$LDFLAGS -R${withval}"
2543 fi
2544 if test ! -z "$blibpath" ; then
2545 blibpath="$blibpath:${withval}"
2546 fi
2547 fi
2548 AC_CHECK_HEADERS(sectok.h)
2549 if test "$ac_cv_header_sectok_h" != yes; then
2550 AC_MSG_ERROR(Can't find sectok.h)
2551 fi
2552 AC_CHECK_LIB(sectok, sectok_open)
2553 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2554 AC_MSG_ERROR(Can't find libsectok)
2555 fi
2556 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002557 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002558 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002559 fi
2560 ]
2561)
2562
2563# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002564OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002565AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002566 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2567 [
2568 if test "x$withval" != "xno" ; then
2569 if test "x$withval" != "xyes" ; then
2570 OPENSC_CONFIG=$withval/bin/opensc-config
2571 else
2572 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2573 fi
2574 if test "$OPENSC_CONFIG" != "no"; then
2575 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2576 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2577 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2578 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2579 AC_DEFINE(SMARTCARD)
2580 AC_DEFINE(USE_OPENSC)
2581 SCARD_MSG="yes, using OpenSC"
2582 fi
2583 fi
2584 ]
2585)
Damien Miller85de5802001-09-18 14:01:11 +10002586
Darren Tucker5f88d342003-10-15 16:57:57 +10002587# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002588AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002589 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002590 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002591 # Needed by our getrrsetbyname()
2592 AC_SEARCH_LIBS(res_query, resolv)
2593 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002594 AC_MSG_CHECKING(if res_query will link)
2595 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2596 [AC_MSG_RESULT(no)
2597 saved_LIBS="$LIBS"
2598 LIBS="$LIBS -lresolv"
2599 AC_MSG_CHECKING(for res_query in -lresolv)
2600 AC_LINK_IFELSE([
2601#include <resolv.h>
2602int main()
2603{
2604 res_query (0, 0, 0, 0, 0);
2605 return 0;
2606}
2607 ],
2608 [LIBS="$LIBS -lresolv"
2609 AC_MSG_RESULT(yes)],
2610 [LIBS="$saved_LIBS"
2611 AC_MSG_RESULT(no)])
2612 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002613 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002614 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002615 [#include <sys/types.h>
2616 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002617 AC_CHECK_MEMBER(HEADER.ad,
2618 [AC_DEFINE(HAVE_HEADER_AD)],,
2619 [#include <arpa/nameser.h>])
2620 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002621
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002622# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002623KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002624AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002625 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002626 [ if test "x$withval" != "xno" ; then
2627 if test "x$withval" = "xyes" ; then
2628 KRB5ROOT="/usr/local"
2629 else
2630 KRB5ROOT=${withval}
2631 fi
2632
2633 AC_DEFINE(KRB5)
2634 KRB5_MSG="yes"
2635
2636 AC_MSG_CHECKING(for krb5-config)
2637 if test -x $KRB5ROOT/bin/krb5-config ; then
2638 KRB5CONF=$KRB5ROOT/bin/krb5-config
2639 AC_MSG_RESULT($KRB5CONF)
2640
2641 AC_MSG_CHECKING(for gssapi support)
2642 if $KRB5CONF | grep gssapi >/dev/null ; then
2643 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002644 AC_DEFINE(GSSAPI)
2645 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002646 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002647 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002648 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002649 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002650 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2651 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002652 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002653 AC_MSG_CHECKING(whether we are using Heimdal)
2654 AC_TRY_COMPILE([ #include <krb5.h> ],
2655 [ char *tmp = heimdal_version; ],
2656 [ AC_MSG_RESULT(yes)
2657 AC_DEFINE(HEIMDAL) ],
2658 AC_MSG_RESULT(no)
2659 )
2660 else
2661 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002662 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002663 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002664 AC_MSG_CHECKING(whether we are using Heimdal)
2665 AC_TRY_COMPILE([ #include <krb5.h> ],
2666 [ char *tmp = heimdal_version; ],
2667 [ AC_MSG_RESULT(yes)
2668 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002669 K5LIBS="-lkrb5 -ldes"
2670 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002671 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002672 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002673 ],
2674 [ AC_MSG_RESULT(no)
2675 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2676 ]
2677 )
Damien Miller200d0a72003-06-30 19:21:36 +10002678 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002679
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002680 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2681 [ AC_DEFINE(GSSAPI)
2682 K5LIBS="-lgssapi $K5LIBS" ],
2683 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2684 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002685 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002686 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2687 $K5LIBS)
2688 ],
2689 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002690
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002691 AC_CHECK_HEADER(gssapi.h, ,
2692 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002693 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002694 AC_CHECK_HEADERS(gssapi.h, ,
2695 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002696 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002697 ]
2698 )
2699
2700 oldCPP="$CPPFLAGS"
2701 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2702 AC_CHECK_HEADER(gssapi_krb5.h, ,
2703 [ CPPFLAGS="$oldCPP" ])
2704
Damien Millera8e06ce2003-11-21 23:48:55 +11002705 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002706 if test ! -z "$need_dash_r" ; then
2707 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2708 fi
2709 if test ! -z "$blibpath" ; then
2710 blibpath="$blibpath:${KRB5ROOT}/lib"
2711 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002712 fi
2713
2714 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2715 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2716 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2717
2718 LIBS="$LIBS $K5LIBS"
2719 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002720 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002721 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002722)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002723
Damien Millera22ba012000-03-02 23:09:20 +11002724# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002725
Damien Millerf58c6722002-05-13 13:15:42 +10002726PRIVSEP_PATH=/var/empty
2727AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002728 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002729 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002730 if test -n "$withval" && test "x$withval" != "xno" && \
2731 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002732 PRIVSEP_PATH=$withval
2733 fi
2734 ]
2735)
2736AC_SUBST(PRIVSEP_PATH)
2737
Damien Millera22ba012000-03-02 23:09:20 +11002738AC_ARG_WITH(xauth,
2739 [ --with-xauth=PATH Specify path to xauth program ],
2740 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002741 if test -n "$withval" && test "x$withval" != "xno" && \
2742 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002743 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002744 fi
2745 ],
2746 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002747 TestPath="$PATH"
2748 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2749 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2750 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2751 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2752 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002753 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002754 xauth_path="/usr/openwin/bin/xauth"
2755 fi
2756 ]
2757)
2758
Damien Miller7d901272003-01-13 16:55:22 +11002759STRIP_OPT=-s
2760AC_ARG_ENABLE(strip,
2761 [ --disable-strip Disable calling strip(1) on install],
2762 [
2763 if test "x$enableval" = "xno" ; then
2764 STRIP_OPT=
2765 fi
2766 ]
2767)
2768AC_SUBST(STRIP_OPT)
2769
Damien Millera19cf472000-11-29 13:28:50 +11002770if test -z "$xauth_path" ; then
2771 XAUTH_PATH="undefined"
2772 AC_SUBST(XAUTH_PATH)
2773else
Damien Millera22ba012000-03-02 23:09:20 +11002774 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002775 XAUTH_PATH=$xauth_path
2776 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002777fi
Damien Millera22ba012000-03-02 23:09:20 +11002778
2779# Check for mail directory (last resort if we cannot get it from headers)
2780if test ! -z "$MAIL" ; then
2781 maildir=`dirname $MAIL`
2782 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2783fi
2784
Darren Tucker623d92f2004-09-12 22:36:15 +10002785if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002786 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2787 disable_ptmx_check=yes
2788fi
Damien Millera22ba012000-03-02 23:09:20 +11002789if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002790 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002791 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002792 [
2793 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2794 have_dev_ptmx=1
2795 ]
2796 )
2797 fi
Damien Millera22ba012000-03-02 23:09:20 +11002798fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002799
Darren Tucker623d92f2004-09-12 22:36:15 +10002800if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002801 AC_CHECK_FILE("/dev/ptc",
2802 [
2803 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2804 have_dev_ptc=1
2805 ]
2806 )
2807else
2808 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2809fi
Damien Miller204ad072000-03-02 23:56:12 +11002810
Damien Millera22ba012000-03-02 23:09:20 +11002811# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002812AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002813 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002814 [
Damien Miller897741e2001-04-16 10:41:46 +10002815 case "$withval" in
2816 man|cat|doc)
2817 MANTYPE=$withval
2818 ;;
2819 *)
2820 AC_MSG_ERROR(invalid man type: $withval)
2821 ;;
2822 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002823 ]
2824)
Ben Lindstrombc709922001-04-18 18:04:21 +00002825if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002826 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2827 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002828 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2829 MANTYPE=doc
2830 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2831 MANTYPE=man
2832 else
2833 MANTYPE=cat
2834 fi
2835fi
Damien Miller670a4b82000-01-22 13:53:11 +11002836AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002837if test "$MANTYPE" = "doc"; then
2838 mansubdir=man;
2839else
2840 mansubdir=$MANTYPE;
2841fi
2842AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002843
Damien Millera22ba012000-03-02 23:09:20 +11002844# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002845MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002846AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002847 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002848 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002849 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002850 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002851 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002852 fi
2853 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002854)
2855
Damien Millera22ba012000-03-02 23:09:20 +11002856# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002857AC_ARG_WITH(shadow,
2858 [ --without-shadow Disable shadow password support],
2859 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002860 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002861 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002862 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002863 fi
2864 ]
2865)
2866
Damien Miller1f335fb2000-06-26 11:31:33 +10002867if test -z "$disable_shadow" ; then
2868 AC_MSG_CHECKING([if the systems has expire shadow information])
2869 AC_TRY_COMPILE(
2870 [
2871#include <sys/types.h>
2872#include <shadow.h>
2873 struct spwd sp;
2874 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2875 [ sp_expire_available=yes ], []
2876 )
2877
2878 if test "x$sp_expire_available" = "xyes" ; then
2879 AC_MSG_RESULT(yes)
2880 AC_DEFINE(HAS_SHADOW_EXPIRE)
2881 else
2882 AC_MSG_RESULT(no)
2883 fi
2884fi
2885
Damien Millera22ba012000-03-02 23:09:20 +11002886# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002887if test ! -z "$IPADDR_IN_DISPLAY" ; then
2888 DISPLAY_HACK_MSG="yes"
2889 AC_DEFINE(IPADDR_IN_DISPLAY)
2890else
Damien Millera8e06ce2003-11-21 23:48:55 +11002891 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002892 AC_ARG_WITH(ipaddr-display,
2893 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2894 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002895 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002896 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002897 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002898 fi
2899 ]
2900 )
2901fi
Damien Miller76112de1999-12-21 11:18:08 +11002902
Darren Tuckere1a790d2003-09-16 11:52:19 +10002903# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002904AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002905 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002906 [ if test "x$enableval" = "xno"; then
2907 AC_MSG_NOTICE([/etc/default/login handling disabled])
2908 etc_default_login=no
2909 else
2910 etc_default_login=yes
2911 fi ],
2912 [ etc_default_login=yes ]
2913)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002914
Darren Tucker2f9573d2005-02-10 22:28:54 +11002915if test "x$etc_default_login" != "xno"; then
2916 AC_CHECK_FILE("/etc/default/login",
2917 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002918 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2919 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002920 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2921 elif test "x$external_path_file" = "x/etc/default/login"; then
2922 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2923 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002924fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002925
Tim Rice43a1c132002-04-17 21:19:14 -07002926dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002927if test $ac_cv_func_login_getcapbool = "yes" && \
2928 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002929 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002930fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002931
Damien Millera22ba012000-03-02 23:09:20 +11002932# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002933SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002934AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002935 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002936 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002937 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002938 AC_MSG_WARN([
2939--with-default-path=PATH has no effect on this system.
2940Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002941 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002942 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002943 AC_MSG_WARN([
2944--with-default-path=PATH will only be used if PATH is not defined in
2945$external_path_file .])
2946 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002947 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002948 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002949 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002950 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002951 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2952 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002953 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002954 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002955 AC_MSG_WARN([
2956If PATH is defined in $external_path_file, ensure the path to scp is included,
2957otherwise scp will not work.])
2958 fi
2959 AC_TRY_RUN(
2960 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002961/* find out what STDPATH is */
2962#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002963#ifdef HAVE_PATHS_H
2964# include <paths.h>
2965#endif
2966#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002967# ifdef _PATH_USERPATH /* Irix */
2968# define _PATH_STDPATH _PATH_USERPATH
2969# else
2970# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2971# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002972#endif
2973#include <sys/types.h>
2974#include <sys/stat.h>
2975#include <fcntl.h>
2976#define DATA "conftest.stdpath"
2977
2978main()
2979{
2980 FILE *fd;
2981 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002982
Tim Rice59ea0a02001-03-10 13:50:45 -08002983 fd = fopen(DATA,"w");
2984 if(fd == NULL)
2985 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002986
Tim Rice59ea0a02001-03-10 13:50:45 -08002987 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2988 exit(1);
2989
2990 exit(0);
2991}
2992 ], [ user_path=`cat conftest.stdpath` ],
2993 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2994 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2995 )
2996# make sure $bindir is in USER_PATH so scp will work
2997 t_bindir=`eval echo ${bindir}`
2998 case $t_bindir in
2999 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3000 esac
3001 case $t_bindir in
3002 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3003 esac
3004 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3005 if test $? -ne 0 ; then
3006 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3007 if test $? -ne 0 ; then
3008 user_path=$user_path:$t_bindir
3009 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3010 fi
3011 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003012 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003013)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003014if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003015 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3016 AC_SUBST(user_path)
3017fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003018
Damien Millera18bbd32002-05-13 10:48:57 +10003019# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003020AC_ARG_WITH(superuser-path,
3021 [ --with-superuser-path= Specify different path for super-user],
3022 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003023 if test -n "$withval" && test "x$withval" != "xno" && \
3024 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003025 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3026 superuser_path=$withval
3027 fi
3028 ]
3029)
3030
3031
Damien Miller61e50f12000-05-08 20:49:37 +10003032AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003033IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003034AC_ARG_WITH(4in6,
3035 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3036 [
3037 if test "x$withval" != "xno" ; then
3038 AC_MSG_RESULT(yes)
3039 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003040 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003041 else
3042 AC_MSG_RESULT(no)
3043 fi
3044 ],[
3045 if test "x$inet6_default_4in6" = "xyes"; then
3046 AC_MSG_RESULT([yes (default)])
3047 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003048 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003049 else
3050 AC_MSG_RESULT([no (default)])
3051 fi
3052 ]
3053)
3054
Damien Miller60396b02001-02-18 17:01:00 +11003055# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003056BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003057AC_ARG_WITH(bsd-auth,
3058 [ --with-bsd-auth Enable BSD auth support],
3059 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003060 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003061 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003062 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003063 fi
3064 ]
3065)
3066
Damien Millera22ba012000-03-02 23:09:20 +11003067# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003068piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003069# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003070if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003071 piddir=`eval echo ${sysconfdir}`
3072 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003073 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003074 esac
3075fi
3076
Tim Rice88f2ab52002-03-17 12:17:34 -08003077AC_ARG_WITH(pid-dir,
3078 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3079 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003080 if test -n "$withval" && test "x$withval" != "xno" && \
3081 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003082 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003083 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003084 AC_MSG_WARN([** no $piddir directory on this system **])
3085 fi
3086 fi
3087 ]
3088)
3089
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003090AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003091AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003092
andre2ff7b5d2000-06-03 14:57:40 +00003093dnl allow user to disable some login recording features
3094AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003095 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003096 [
3097 if test "x$enableval" = "xno" ; then
3098 AC_DEFINE(DISABLE_LASTLOG)
3099 fi
3100 ]
andre2ff7b5d2000-06-03 14:57:40 +00003101)
3102AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003103 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003104 [
3105 if test "x$enableval" = "xno" ; then
3106 AC_DEFINE(DISABLE_UTMP)
3107 fi
3108 ]
andre2ff7b5d2000-06-03 14:57:40 +00003109)
3110AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003111 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003112 [
3113 if test "x$enableval" = "xno" ; then
3114 AC_DEFINE(DISABLE_UTMPX)
3115 fi
3116 ]
andre2ff7b5d2000-06-03 14:57:40 +00003117)
3118AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003119 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003120 [
3121 if test "x$enableval" = "xno" ; then
3122 AC_DEFINE(DISABLE_WTMP)
3123 fi
3124 ]
andre2ff7b5d2000-06-03 14:57:40 +00003125)
3126AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003127 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003128 [
3129 if test "x$enableval" = "xno" ; then
3130 AC_DEFINE(DISABLE_WTMPX)
3131 fi
3132 ]
andre2ff7b5d2000-06-03 14:57:40 +00003133)
3134AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003135 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003136 [
3137 if test "x$enableval" = "xno" ; then
3138 AC_DEFINE(DISABLE_LOGIN)
3139 fi
3140 ]
andre2ff7b5d2000-06-03 14:57:40 +00003141)
3142AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003143 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003144 [
3145 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003146 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003147 fi
3148 ]
andre2ff7b5d2000-06-03 14:57:40 +00003149)
3150AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003151 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003152 [
3153 if test "x$enableval" = "xno" ; then
3154 AC_DEFINE(DISABLE_PUTUTXLINE)
3155 fi
3156 ]
andre2ff7b5d2000-06-03 14:57:40 +00003157)
3158AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003159 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003160 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003161 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003162 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003163 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003164 conf_lastlog_location=$withval
3165 fi
3166 ]
3167)
andre2ff7b5d2000-06-03 14:57:40 +00003168
3169dnl lastlog, [uw]tmpx? detection
3170dnl NOTE: set the paths in the platform section to avoid the
3171dnl need for command-line parameters
3172dnl lastlog and [uw]tmp are subject to a file search if all else fails
3173
3174dnl lastlog detection
3175dnl NOTE: the code itself will detect if lastlog is a directory
3176AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3177AC_TRY_COMPILE([
3178#include <sys/types.h>
3179#include <utmp.h>
3180#ifdef HAVE_LASTLOG_H
3181# include <lastlog.h>
3182#endif
Damien Miller2994e082000-06-04 15:51:47 +10003183#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003184# include <paths.h>
3185#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003186#ifdef HAVE_LOGIN_H
3187# include <login.h>
3188#endif
andre2ff7b5d2000-06-03 14:57:40 +00003189 ],
3190 [ char *lastlog = LASTLOG_FILE; ],
3191 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003192 [
3193 AC_MSG_RESULT(no)
3194 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3195 AC_TRY_COMPILE([
3196#include <sys/types.h>
3197#include <utmp.h>
3198#ifdef HAVE_LASTLOG_H
3199# include <lastlog.h>
3200#endif
3201#ifdef HAVE_PATHS_H
3202# include <paths.h>
3203#endif
3204 ],
3205 [ char *lastlog = _PATH_LASTLOG; ],
3206 [ AC_MSG_RESULT(yes) ],
3207 [
andree441aa32000-06-12 22:34:38 +00003208 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003209 system_lastlog_path=no
3210 ])
3211 ]
andre2ff7b5d2000-06-03 14:57:40 +00003212)
Damien Miller2994e082000-06-04 15:51:47 +10003213
andre2ff7b5d2000-06-03 14:57:40 +00003214if test -z "$conf_lastlog_location"; then
3215 if test x"$system_lastlog_path" = x"no" ; then
3216 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003217 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003218 conf_lastlog_location=$f
3219 fi
3220 done
3221 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003222 AC_MSG_WARN([** Cannot find lastlog **])
3223 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003224 fi
3225 fi
3226fi
3227
3228if test -n "$conf_lastlog_location"; then
3229 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003230fi
andre2ff7b5d2000-06-03 14:57:40 +00003231
3232dnl utmp detection
3233AC_MSG_CHECKING([if your system defines UTMP_FILE])
3234AC_TRY_COMPILE([
3235#include <sys/types.h>
3236#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003237#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003238# include <paths.h>
3239#endif
3240 ],
3241 [ char *utmp = UTMP_FILE; ],
3242 [ AC_MSG_RESULT(yes) ],
3243 [ AC_MSG_RESULT(no)
3244 system_utmp_path=no ]
3245)
3246if test -z "$conf_utmp_location"; then
3247 if test x"$system_utmp_path" = x"no" ; then
3248 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3249 if test -f $f ; then
3250 conf_utmp_location=$f
3251 fi
3252 done
3253 if test -z "$conf_utmp_location"; then
3254 AC_DEFINE(DISABLE_UTMP)
3255 fi
3256 fi
3257fi
3258if test -n "$conf_utmp_location"; then
3259 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003260fi
andre2ff7b5d2000-06-03 14:57:40 +00003261
3262dnl wtmp detection
3263AC_MSG_CHECKING([if your system defines WTMP_FILE])
3264AC_TRY_COMPILE([
3265#include <sys/types.h>
3266#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003267#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003268# include <paths.h>
3269#endif
3270 ],
3271 [ char *wtmp = WTMP_FILE; ],
3272 [ AC_MSG_RESULT(yes) ],
3273 [ AC_MSG_RESULT(no)
3274 system_wtmp_path=no ]
3275)
3276if test -z "$conf_wtmp_location"; then
3277 if test x"$system_wtmp_path" = x"no" ; then
3278 for f in /usr/adm/wtmp /var/log/wtmp; do
3279 if test -f $f ; then
3280 conf_wtmp_location=$f
3281 fi
3282 done
3283 if test -z "$conf_wtmp_location"; then
3284 AC_DEFINE(DISABLE_WTMP)
3285 fi
3286 fi
3287fi
3288if test -n "$conf_wtmp_location"; then
3289 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003290fi
andre2ff7b5d2000-06-03 14:57:40 +00003291
3292
3293dnl utmpx detection - I don't know any system so perverse as to require
3294dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3295dnl there, though.
3296AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3297AC_TRY_COMPILE([
3298#include <sys/types.h>
3299#include <utmp.h>
3300#ifdef HAVE_UTMPX_H
3301#include <utmpx.h>
3302#endif
Damien Miller2994e082000-06-04 15:51:47 +10003303#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003304# include <paths.h>
3305#endif
3306 ],
3307 [ char *utmpx = UTMPX_FILE; ],
3308 [ AC_MSG_RESULT(yes) ],
3309 [ AC_MSG_RESULT(no)
3310 system_utmpx_path=no ]
3311)
3312if test -z "$conf_utmpx_location"; then
3313 if test x"$system_utmpx_path" = x"no" ; then
3314 AC_DEFINE(DISABLE_UTMPX)
3315 fi
3316else
3317 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003318fi
andre2ff7b5d2000-06-03 14:57:40 +00003319
3320dnl wtmpx detection
3321AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3322AC_TRY_COMPILE([
3323#include <sys/types.h>
3324#include <utmp.h>
3325#ifdef HAVE_UTMPX_H
3326#include <utmpx.h>
3327#endif
Damien Miller2994e082000-06-04 15:51:47 +10003328#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003329# include <paths.h>
3330#endif
3331 ],
3332 [ char *wtmpx = WTMPX_FILE; ],
3333 [ AC_MSG_RESULT(yes) ],
3334 [ AC_MSG_RESULT(no)
3335 system_wtmpx_path=no ]
3336)
3337if test -z "$conf_wtmpx_location"; then
3338 if test x"$system_wtmpx_path" = x"no" ; then
3339 AC_DEFINE(DISABLE_WTMPX)
3340 fi
3341else
3342 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003343fi
andre2ff7b5d2000-06-03 14:57:40 +00003344
Damien Miller4018c192000-04-30 09:30:44 +10003345
Damien Miller29ea30d2000-03-17 10:54:15 +11003346if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003347 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3348 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003349fi
3350
Tim Rice4cec93f2002-02-26 08:40:48 -08003351dnl remove pam and dl because they are in $LIBPAM
3352if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003353 LIBS=`echo $LIBS | sed 's/-lpam //'`
3354fi
3355if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3356 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003357fi
3358
Damien Millerbac2d8a2000-09-05 16:13:06 +11003359AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003360AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3361 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003362AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003363
Damien Miller7b22d652000-06-18 14:07:04 +10003364# Print summary of options
3365
Damien Miller7b22d652000-06-18 14:07:04 +10003366# Someone please show me a better way :)
3367A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3368B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3369C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3370D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003371E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003372F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003373G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003374H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3375I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3376J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003377
3378echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003379echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003380echo " User binaries: $B"
3381echo " System binaries: $C"
3382echo " Configuration files: $D"
3383echo " Askpass program: $E"
3384echo " Manual pages: $F"
3385echo " PID file: $G"
3386echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003387if test "x$external_path_file" = "x/etc/login.conf" ; then
3388echo " At runtime, sshd will use the path defined in $external_path_file"
3389echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003390else
Damien Millerf58c6722002-05-13 13:15:42 +10003391echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003392 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003393echo " (If PATH is set in $external_path_file it will be used instead. If"
3394echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3395 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003396fi
Damien Millera18bbd32002-05-13 10:48:57 +10003397if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003398echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003399fi
Damien Millerf58c6722002-05-13 13:15:42 +10003400echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003401echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003402echo " KerberosV support: $KRB5_MSG"
3403echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003404echo " S/KEY support: $SKEY_MSG"
3405echo " TCP Wrappers support: $TCPW_MSG"
3406echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003407echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003408echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003409echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3410echo " BSD Auth support: $BSD_AUTH_MSG"
3411echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003412if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003413echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003414fi
3415
Damien Miller7b22d652000-06-18 14:07:04 +10003416echo ""
3417
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003418echo " Host: ${host}"
3419echo " Compiler: ${CC}"
3420echo " Compiler flags: ${CFLAGS}"
3421echo "Preprocessor flags: ${CPPFLAGS}"
3422echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003423echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003424
3425echo ""
3426
Tim Rice6f1f7582004-05-30 21:38:51 -07003427if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003428 echo "SVR4 style packages are supported with \"make package\""
3429 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003430fi
3431
Damien Miller82cf0ce2000-12-20 13:34:48 +11003432if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003433 echo "PAM is enabled. You may need to install a PAM control file "
3434 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003435 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003436 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003437 echo ""
3438fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003439
Damien Miller6c21c512002-01-22 21:57:53 +11003440if test ! -z "$RAND_HELPER_CMDHASH" ; then
3441 echo "WARNING: you are using the builtin random number collection "
3442 echo "service. Please read WARNING.RNG and request that your OS "
3443 echo "vendor includes kernel-based random number collection in "
3444 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003445 echo ""
3446fi
Damien Miller60396b02001-02-18 17:01:00 +11003447
Damien Millerb4097182004-05-23 14:09:40 +10003448if test ! -z "$NO_PEERCHECK" ; then
3449 echo "WARNING: the operating system that you are using does not "
3450 echo "appear to support either the getpeereid() API nor the "
3451 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3452 echo "enforce security checks to prevent unauthorised connections to "
3453 echo "ssh-agent. Their absence increases the risk that a malicious "
3454 echo "user can connect to your agent. "
3455 echo ""
3456fi
3457
Darren Tuckerd9f88912005-02-20 21:01:48 +11003458if test "$AUDIT_MODULE" = "bsm" ; then
3459 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3460 echo "See the Solaris section in README.platform for details."
3461fi