blob: 93297bbd8f1f83cdf3abdaf6bff808da5d65d85f [file] [log] [blame]
Darren Tucker7da23cb2005-08-03 00:20:15 +10001# $Id: configure.ac,v 1.282 2005/08/02 14:20:15 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080078
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100080
81AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
82
Damien Millera8e06ce2003-11-21 23:48:55 +110083if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100084 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Damien Miller52c8afe2005-06-19 10:19:43 +100085 CFLAGS="$CFLAGS -Wsign-compare"
Damien Millerde3cb0a2005-05-26 20:48:25 +100086
Darren Tucker67b37032005-06-03 17:58:31 +100087 if test -z "$have_llong_max"; then
88 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
89 unset ac_cv_have_decl_LLONG_MAX
90 saved_CFLAGS="$CFLAGS"
91 CFLAGS="$CFLAGS -std=gnu99"
92 AC_CHECK_DECL(LLONG_MAX,
93 [have_llong_max=1],
94 [CFLAGS="$saved_CFLAGS"],
95 [#include <limits.h>]
96 )
97 fi
Damien Miller166bd442000-03-16 10:48:25 +110098fi
99
Darren Tucker431f0222005-06-07 17:53:40 +1000100if test -z "$have_llong_max"; then
101 AC_MSG_CHECKING([for max value of long long])
102 AC_RUN_IFELSE(
103 [AC_LANG_SOURCE([[
104#include <stdio.h>
105/* Why is this so damn hard? */
106#ifdef __GNUC__
107# undef __GNUC__
108#endif
109#define __USE_ISOC99
110#include <limits.h>
111#define DATA "conftest.llminmax"
112int main(void) {
113 FILE *f;
114 long long i, llmin, llmax = 0;
115
116 if((f = fopen(DATA,"w")) == NULL)
117 exit(1);
118
119#if defined(LLONG_MIN) && defined(LLONG_MAX)
120 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
121 llmin = LLONG_MIN;
122 llmax = LLONG_MAX;
123#else
124 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
125 /* This will work on one's complement and two's complement */
126 for (i = 1; i > llmax; i <<= 1, i++)
127 llmax = i;
128 llmin = llmax + 1LL; /* wrap */
129#endif
130
131 /* Sanity check */
132 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
133 || llmax - 1 > llmax) {
134 fprintf(f, "unknown unknown\n");
135 exit(2);
136 }
137
138 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
139 exit(3);
140
141 exit(0);
142}
143 ]])],
144 [
145 llong_min=`$AWK '{print $1}' conftest.llminmax`
146 llong_max=`$AWK '{print $2}' conftest.llminmax`
147 AC_MSG_RESULT($llong_max)
148 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
149 [max value of long long calculated by configure])
150 AC_MSG_CHECKING([for min value of long long])
151 AC_MSG_RESULT($llong_min)
152 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
153 [min value of long long calculated by configure])
154 ],
155 [
156 AC_MSG_RESULT(not found)
157 ],
158 [
159 AC_MSG_WARN([cross compiling: not checking])
160 ]
161 )
162fi
163
Tim Rice88368a32003-12-08 12:35:59 -0800164AC_ARG_WITH(rpath,
165 [ --without-rpath Disable auto-added -R linker paths],
166 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800167 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800168 need_dash_r=""
169 fi
170 if test "x$withval" = "xyes" ; then
171 need_dash_r=1
172 fi
173 ]
174)
175
Damien Millera22ba012000-03-02 23:09:20 +1100176# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100177case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100178*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100179 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000180 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800181 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100182 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000183 saved_LDFLAGS="$LDFLAGS"
184 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
185 if (test -z "$blibflags"); then
186 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
187 AC_TRY_LINK([], [], [blibflags=$tryflags])
188 fi
189 done
190 if (test -z "$blibflags"); then
191 AC_MSG_RESULT(not found)
192 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
193 else
194 AC_MSG_RESULT($blibflags)
195 fi
196 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000197 dnl Check for authenticate. Might be in libs.a on older AIXes
198 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700199 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000200 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700201 LIBS="$LIBS -ls"
202 ])
203 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100204 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100205 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100206 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000207 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100208 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000209 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
210 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000211 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000212 [(void)loginfailed("user","host","tty",0);],
213 [AC_MSG_RESULT(yes)
214 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000215 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000216 )],
217 [],
218 [#include <usersec.h>]
219 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000220 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100221 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000222 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000223 AC_DEFINE(SETEUID_BREAKS_SETUID)
224 AC_DEFINE(BROKEN_SETREUID)
225 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000226 dnl AIX handles lastlog as part of its login message
227 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000228 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000229 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100230 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100231*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100232 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800233 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100234 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000235 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100236 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100237 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000238 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000239 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700240 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100241 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000242*-*-dgux*)
243 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100244 AC_DEFINE(SETEUID_BREAKS_SETUID)
245 AC_DEFINE(BROKEN_SETREUID)
246 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000247 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000248*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000249 AC_MSG_CHECKING(if we have working getaddrinfo)
250 AC_TRY_RUN([#include <mach-o/dyld.h>
251main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
252 exit(0);
253 else
254 exit(1);
255}], [AC_MSG_RESULT(working)],
256 [AC_MSG_RESULT(buggy)
257 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700258 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000259 AC_DEFINE(SETEUID_BREAKS_SETUID)
260 AC_DEFINE(BROKEN_SETREUID)
261 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100262 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000263 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000264*-*-hpux*)
265 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000266 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100267 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000268 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000269 AC_DEFINE(LOGIN_NO_ENDOPT)
270 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000271 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000272 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700273 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000274 AC_CHECK_LIB(xnet, t_error, ,
275 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
276
277 # next, we define all of the options specific to major releases
278 case "$host" in
279 *-*-hpux10*)
280 if test -z "$GCC"; then
281 CFLAGS="$CFLAGS -Ae"
282 fi
283 ;;
284 *-*-hpux11*)
285 AC_DEFINE(PAM_SUN_CODEBASE)
286 AC_DEFINE(DISABLE_UTMP)
287 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
288 check_for_hpux_broken_getaddrinfo=1
289 check_for_conflicting_getspnam=1
290 ;;
291 esac
292
293 # lastly, we define options specific to minor releases
294 case "$host" in
295 *-*-hpux10.26)
296 AC_DEFINE(HAVE_SECUREWARE)
297 disable_ptmx_check=yes
298 LIBS="$LIBS -lsecpw"
299 ;;
300 esac
Damien Miller1bead332000-04-30 00:47:29 +1000301 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100302*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100303 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000304 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000305 AC_DEFINE(SETEUID_BREAKS_SETUID)
306 AC_DEFINE(BROKEN_SETREUID)
307 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000308 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000309 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100310 ;;
311*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100312 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000313 AC_DEFINE(WITH_IRIX_ARRAY)
314 AC_DEFINE(WITH_IRIX_PROJECT)
315 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000316 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000317 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000318 AC_DEFINE(SETEUID_BREAKS_SETUID)
319 AC_DEFINE(BROKEN_SETREUID)
320 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000321 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000322 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000323 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100324 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100325*-*-linux*)
326 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100327 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000328 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100329 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000330 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000331 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000332 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000333 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100334 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
335 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100336 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000337 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000338 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000339 AC_DEFINE(BROKEN_CMSG_TYPE)
340 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000341 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100342 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000343mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000344 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000345 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000346 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100347*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000348 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800349 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800350 need_dash_r=1
351 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100352 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100353*-*-freebsd*)
354 check_for_libcrypt_later=1
355 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000356*-*-bsdi*)
357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
360 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000361*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000362 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100363 conf_utmp_location=/etc/utmp
364 conf_wtmp_location=/usr/adm/wtmp
365 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000366 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000367 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000368 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100369 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000370 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000371*-*-openbsd*)
372 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
373 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100374*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800375 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800376 need_dash_r=1
377 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100378 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000379 AC_DEFINE(LOGIN_NEEDS_UTMPX)
380 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000381 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000382 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000383 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000384 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
385 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000386 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000387 # hardwire lastlog location (can't detect it on some versions)
388 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000389 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
390 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
391 if test "$sol2ver" -ge 8; then
392 AC_MSG_RESULT(yes)
393 AC_DEFINE(DISABLE_UTMP)
394 AC_DEFINE(DISABLE_WTMP)
395 else
396 AC_MSG_RESULT(no)
397 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100398 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000399*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000400 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000401 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100402 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000403 conf_utmp_location=/etc/utmp
404 conf_wtmp_location=/var/adm/wtmp
405 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000406 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000407 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000408*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700409 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000410 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000411 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000415 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000416*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700417 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000418 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100419 # -lresolv needs to be at then end of LIBS or DNS lookups break
420 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100421 IPADDR_IN_DISPLAY=yes
422 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000423 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000427 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000428 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700429 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
430 # Attention: always take care to bind libsocket and libnsl before libc,
431 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000432 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800433# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100434*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100435 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700436 AC_DEFINE(SETEUID_BREAKS_SETUID)
437 AC_DEFINE(BROKEN_SETREUID)
438 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700439 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100440 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800441# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100442*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100443 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700444 AC_DEFINE(SETEUID_BREAKS_SETUID)
445 AC_DEFINE(BROKEN_SETREUID)
446 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700447 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700448 case "$host" in
449 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
450 TEST_SHELL=/u95/bin/sh
451 ;;
452 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100453 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100454*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100455 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800456# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100457*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800458 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100459 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800460# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100461*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800462 if test -z "$GCC"; then
463 CFLAGS="$CFLAGS -belf"
464 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100465 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000466 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100467 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000468 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000469 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700470 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700471 AC_DEFINE(SETEUID_BREAKS_SETUID)
472 AC_DEFINE(BROKEN_SETREUID)
473 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700474 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700475 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100476 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100477 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700478 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700479 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000480 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000481*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100482 AC_DEFINE(NO_SSH_LASTLOG)
483 AC_DEFINE(SETEUID_BREAKS_SETUID)
484 AC_DEFINE(BROKEN_SETREUID)
485 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000486 AC_DEFINE(USE_PIPES)
487 AC_DEFINE(DISABLE_FD_PASSING)
488 LDFLAGS="$LDFLAGS"
489 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
490 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000491 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000492*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100493 AC_DEFINE(SETEUID_BREAKS_SETUID)
494 AC_DEFINE(BROKEN_SETREUID)
495 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000496 AC_DEFINE(WITH_ABBREV_NO_TTY)
497 AC_DEFINE(USE_PIPES)
498 AC_DEFINE(DISABLE_FD_PASSING)
499 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100500 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000501 MANTYPE=cat
502 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000503*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100504 AC_DEFINE(SETEUID_BREAKS_SETUID)
505 AC_DEFINE(BROKEN_SETREUID)
506 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000507 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700508 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700509 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000510 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
511 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
512 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700513 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000514*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000515 AC_MSG_CHECKING(for Digital Unix SIA)
516 no_osfsia=""
517 AC_ARG_WITH(osfsia,
518 [ --with-osfsia Enable Digital Unix SIA],
519 [
520 if test "x$withval" = "xno" ; then
521 AC_MSG_RESULT(disabled)
522 no_osfsia=1
523 fi
524 ],
525 )
526 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000527 if test -f /etc/sia/matrix.conf; then
528 AC_MSG_RESULT(yes)
529 AC_DEFINE(HAVE_OSF_SIA)
530 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000531 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000532 LIBS="$LIBS -lsecurity -ldb -lm -laud"
533 else
534 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100535 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000536 fi
537 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000538 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700539 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000540 AC_DEFINE(BROKEN_SETREUID)
541 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000542 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000543
544*-*-nto-qnx)
545 AC_DEFINE(USE_PIPES)
546 AC_DEFINE(NO_X11_UNIX_SOCKETS)
547 AC_DEFINE(MISSING_NFDBITS)
548 AC_DEFINE(MISSING_HOWMANY)
549 AC_DEFINE(MISSING_FD_MASK)
550 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000551
552*-*-ultrix*)
553 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
554 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
555 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700556 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
557 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100558esac
559
Damien Millere37bfc12000-06-05 09:37:43 +1000560# Allow user to specify flags
561AC_ARG_WITH(cflags,
562 [ --with-cflags Specify additional flags to pass to compiler],
563 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800564 if test -n "$withval" && test "x$withval" != "xno" && \
565 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000566 CFLAGS="$CFLAGS $withval"
567 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800568 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000569)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000570AC_ARG_WITH(cppflags,
571 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
572 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800573 if test -n "$withval" && test "x$withval" != "xno" && \
574 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000575 CPPFLAGS="$CPPFLAGS $withval"
576 fi
577 ]
578)
Damien Millere37bfc12000-06-05 09:37:43 +1000579AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000580 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000581 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800582 if test -n "$withval" && test "x$withval" != "xno" && \
583 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000584 LDFLAGS="$LDFLAGS $withval"
585 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800586 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000587)
588AC_ARG_WITH(libs,
589 [ --with-libs Specify additional libraries to link with],
590 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800591 if test -n "$withval" && test "x$withval" != "xno" && \
592 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000593 LIBS="$LIBS $withval"
594 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800595 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000596)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000597AC_ARG_WITH(Werror,
598 [ --with-Werror Build main code with -Werror],
599 [
600 if test -n "$withval" && test "x$withval" != "xno"; then
601 werror_flags="-Werror"
602 if "x${withval}" != "xyes"; then
603 werror_flags="$withval"
604 fi
605 fi
606 ]
607)
Damien Millere37bfc12000-06-05 09:37:43 +1000608
Darren Tucker6eb93042003-06-29 21:30:41 +1000609AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000610AC_RUN_IFELSE(
611 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000612#include <stdio.h>
613int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000614 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000615 [ AC_MSG_RESULT(yes) ],
616 [
617 AC_MSG_RESULT(no)
618 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000619 ],
620 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000621)
622
Darren Tucker0c9653f2005-05-28 15:58:14 +1000623dnl Checks for header files.
624AC_CHECK_HEADERS( \
625 bstring.h \
626 crypt.h \
627 dirent.h \
628 endian.h \
629 features.h \
630 floatingpoint.h \
631 getopt.h \
632 glob.h \
633 ia.h \
634 lastlog.h \
635 limits.h \
636 login.h \
637 login_cap.h \
638 maillock.h \
639 ndir.h \
640 netdb.h \
641 netgroup.h \
642 netinet/in_systm.h \
643 pam/pam_appl.h \
644 paths.h \
645 pty.h \
646 readpassphrase.h \
647 rpc/types.h \
648 security/pam_appl.h \
649 shadow.h \
650 stddef.h \
651 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000652 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000653 strings.h \
654 sys/audit.h \
655 sys/bitypes.h \
656 sys/bsdtty.h \
657 sys/cdefs.h \
658 sys/dir.h \
659 sys/mman.h \
660 sys/ndir.h \
661 sys/prctl.h \
662 sys/pstat.h \
663 sys/select.h \
664 sys/stat.h \
665 sys/stream.h \
666 sys/stropts.h \
667 sys/strtio.h \
668 sys/sysmacros.h \
669 sys/time.h \
670 sys/timers.h \
671 sys/un.h \
672 time.h \
673 tmpdir.h \
674 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000675 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000676 usersec.h \
677 util.h \
678 utime.h \
679 utmp.h \
680 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000681 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000682)
Tim Rice4cec93f2002-02-26 08:40:48 -0800683
Darren Tucker48d99d32004-08-29 17:04:50 +1000684# sys/ptms.h requires sys/stream.h to be included first on Solaris
685AC_CHECK_HEADERS(sys/ptms.h, [], [], [
686#ifdef HAVE_SYS_STREAM_H
687# include <sys/stream.h>
688#endif
689])
690
Damien Millera22ba012000-03-02 23:09:20 +1100691# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700692AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
693AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000694
Tim Rice1e1ef642003-09-11 22:19:31 -0700695dnl IRIX and Solaris 2.5.1 have dirname() in libgen
696AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
697 AC_CHECK_LIB(gen, dirname,[
698 AC_CACHE_CHECK([for broken dirname],
699 ac_cv_have_broken_dirname, [
700 save_LIBS="$LIBS"
701 LIBS="$LIBS -lgen"
702 AC_TRY_RUN(
703 [
704#include <libgen.h>
705#include <string.h>
706
707int main(int argc, char **argv) {
708 char *s, buf[32];
709
710 strncpy(buf,"/etc", 32);
711 s = dirname(buf);
712 if (!s || strncmp(s, "/", 32) != 0) {
713 exit(1);
714 } else {
715 exit(0);
716 }
717}
718 ],
719 [ ac_cv_have_broken_dirname="no" ],
720 [ ac_cv_have_broken_dirname="yes" ]
721 )
722 LIBS="$save_LIBS"
723 ])
724 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
725 LIBS="$LIBS -lgen"
726 AC_DEFINE(HAVE_DIRNAME)
727 AC_CHECK_HEADERS(libgen.h)
728 fi
729 ])
730])
731
732AC_CHECK_FUNC(getspnam, ,
733 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
734AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
735
Tim Rice13aae5e2001-10-21 17:53:58 -0700736dnl zlib is required
737AC_ARG_WITH(zlib,
738 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100739 [ if test "x$withval" = "xno" ; then
740 AC_MSG_ERROR([*** zlib is required ***])
741 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700742 if test -d "$withval/lib"; then
743 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700744 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700745 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700746 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700747 fi
748 else
749 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700750 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700751 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700752 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700753 fi
754 fi
755 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700756 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700757 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700758 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100760 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700761)
762
Tim Ricefcb62202004-01-23 18:35:16 -0800763AC_CHECK_LIB(z, deflate, ,
764 [
765 saved_CPPFLAGS="$CPPFLAGS"
766 saved_LDFLAGS="$LDFLAGS"
767 save_LIBS="$LIBS"
768 dnl Check default zlib install dir
769 if test -n "${need_dash_r}"; then
770 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
771 else
772 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
773 fi
774 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
775 LIBS="$LIBS -lz"
776 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
777 [
778 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
779 ]
780 )
781 ]
782)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100783AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100784
785AC_ARG_WITH(zlib-version-check,
786 [ --without-zlib-version-check Disable zlib version check],
787 [ if test "x$withval" = "xno" ; then
788 zlib_check_nonfatal=1
789 fi
790 ]
791)
792
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000793AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000794AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000795#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100796#include <zlib.h>
797int main()
798{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000799 int a=0, b=0, c=0, d=0, n, v;
800 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
801 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100802 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000803 v = a*1000000 + b*10000 + c*100 + d;
804 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
805
806 /* 1.1.4 is OK */
807 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100808 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000809
Darren Tucker41097ed2005-07-25 15:24:21 +1000810 /* 1.2.3 and up are OK */
811 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000812 exit(0);
813
Darren Tucker2dcd2392004-01-23 17:13:33 +1100814 exit(2);
815}
Darren Tucker623d92f2004-09-12 22:36:15 +1000816 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000817 AC_MSG_RESULT(no),
818 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100819 if test -z "$zlib_check_nonfatal" ; then
820 AC_MSG_ERROR([*** zlib too old - check config.log ***
821Your reported zlib version has known security problems. It's possible your
822vendor has fixed these problems without changing the version number. If you
823are sure this is the case, you can disable the check by running
824"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000825If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000826See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100827 else
828 AC_MSG_WARN([zlib version may have security problems])
829 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000830 ],
831 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100832)
Damien Miller6f9c3372000-10-25 10:06:04 +1100833
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000834dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100835AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000836 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
837)
Damien Millera8e06ce2003-11-21 23:48:55 +1100838AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700839 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
840 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000841)
Damien Millerab18c411999-11-11 10:40:23 +1100842
Tim Ricee589a292001-11-03 11:09:32 -0800843dnl Checks for libutil functions
844AC_CHECK_HEADERS(libutil.h)
845AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
846AC_CHECK_FUNCS(logout updwtmp logwtmp)
847
Ben Lindstrom8697e082001-02-24 21:41:10 +0000848AC_FUNC_STRFTIME
849
Damien Miller3c027682001-03-14 11:39:45 +1100850# Check for ALTDIRFUNC glob() extension
851AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
852AC_EGREP_CPP(FOUNDIT,
853 [
854 #include <glob.h>
855 #ifdef GLOB_ALTDIRFUNC
856 FOUNDIT
857 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100858 ],
Damien Miller3c027682001-03-14 11:39:45 +1100859 [
860 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
861 AC_MSG_RESULT(yes)
862 ],
863 [
864 AC_MSG_RESULT(no)
865 ]
866)
Damien Millerab18c411999-11-11 10:40:23 +1100867
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000868# Check for g.gl_matchc glob() extension
869AC_MSG_CHECKING(for gl_matchc field in glob_t)
870AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100871 [
872 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000873 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100874 ],
875 [
876 AC_DEFINE(GLOB_HAS_GL_MATCHC)
877 AC_MSG_RESULT(yes)
878 ],
879 [
880 AC_MSG_RESULT(no)
881 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000882)
883
Damien Miller18bb4732001-03-28 14:35:30 +1000884AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000885AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000886 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000887#include <sys/types.h>
888#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700889int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000890 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100891 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000892 [
893 AC_MSG_RESULT(no)
894 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000895 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800896 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000897 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
898 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000899 ]
900)
901
Damien Miller36f49652004-08-15 18:40:59 +1000902AC_MSG_CHECKING([for /proc/pid/fd directory])
903if test -d "/proc/$$/fd" ; then
904 AC_DEFINE(HAVE_PROC_PID)
905 AC_MSG_RESULT(yes)
906else
907 AC_MSG_RESULT(no)
908fi
909
Damien Millerc547bf12001-02-16 10:18:12 +1100910# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100911SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100912AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100913 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100914 [
915 if test "x$withval" != "xno" ; then
916
917 if test "x$withval" != "xyes" ; then
918 CPPFLAGS="$CPPFLAGS -I${withval}/include"
919 LDFLAGS="$LDFLAGS -L${withval}/lib"
920 fi
921
922 AC_DEFINE(SKEY)
923 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100924 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800925
Tim Rice4cec93f2002-02-26 08:40:48 -0800926 AC_MSG_CHECKING([for s/key support])
927 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100928 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800929#include <stdio.h>
930#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700931int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800932 ],
933 [AC_MSG_RESULT(yes)],
934 [
935 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100936 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
937 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000938 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
939 AC_TRY_COMPILE(
940 [#include <stdio.h>
941 #include <skey.h>],
942 [(void)skeychallenge(NULL,"name","",0);],
943 [AC_MSG_RESULT(yes)
944 AC_DEFINE(SKEYCHALLENGE_4ARG)],
945 [AC_MSG_RESULT(no)]
946 )
Damien Millerc547bf12001-02-16 10:18:12 +1100947 fi
948 ]
949)
950
951# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700952TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100953AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100954 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100955 [
956 if test "x$withval" != "xno" ; then
957 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700958 saved_LDFLAGS="$LDFLAGS"
959 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800960 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800961 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700962 if test -d "${withval}/lib"; then
963 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700964 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700965 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700966 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700967 fi
968 else
969 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700970 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700971 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700972 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700973 fi
974 fi
975 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700976 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700977 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700978 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700979 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700980 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800981 LIBWRAP="-lwrap"
982 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100983 AC_MSG_CHECKING(for libwrap)
984 AC_TRY_LINK(
985 [
Damien Miller0ac45002004-04-14 20:14:26 +1000986#include <sys/types.h>
987#include <sys/socket.h>
988#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100989#include <tcpd.h>
990 int deny_severity = 0, allow_severity = 0;
991 ],
992 [hosts_access(0);],
993 [
994 AC_MSG_RESULT(yes)
995 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800996 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700997 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100998 ],
999 [
1000 AC_MSG_ERROR([*** libwrap missing])
1001 ]
1002 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001003 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001004 fi
1005 ]
1006)
1007
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001008# Check whether user wants libedit support
1009LIBEDIT_MSG="no"
1010AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001011 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001012 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001013 if test "x$withval" != "xyes"; then
1014 CPPFLAGS="$CPPFLAGS -I$withval/include"
1015 LDFLAGS="$LDFLAGS -L$withval/lib"
1016 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001017 AC_CHECK_LIB(edit, el_init,
1018 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1019 LIBEDIT="-ledit -lcurses"
1020 LIBEDIT_MSG="yes"
1021 AC_SUBST(LIBEDIT)
1022 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001023 [ AC_MSG_ERROR(libedit not found) ],
1024 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001025 )
1026 fi ]
1027)
1028
Darren Tuckerd9f88912005-02-20 21:01:48 +11001029AUDIT_MODULE=none
1030AC_ARG_WITH(audit,
1031 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1032 [
1033 AC_MSG_CHECKING(for supported audit module)
1034 case "$withval" in
1035 bsm)
1036 AC_MSG_RESULT(bsm)
1037 AUDIT_MODULE=bsm
1038 dnl Checks for headers, libs and functions
1039 AC_CHECK_HEADERS(bsm/audit.h, [],
1040 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1041 AC_CHECK_LIB(bsm, getaudit, [],
1042 [AC_MSG_ERROR(BSM enabled and required library not found)])
1043 AC_CHECK_FUNCS(getaudit, [],
1044 [AC_MSG_ERROR(BSM enabled and required function not found)])
1045 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001046 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001047 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1048 ;;
1049 debug)
1050 AUDIT_MODULE=debug
1051 AC_MSG_RESULT(debug)
1052 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1053 ;;
1054 *)
1055 AC_MSG_ERROR([Unknown audit module $withval])
1056 ;;
1057 esac ]
1058)
1059
Damien Millerfe1f1432003-02-24 15:45:42 +11001060dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001061AC_CHECK_FUNCS( \
1062 arc4random \
1063 b64_ntop \
1064 __b64_ntop \
1065 b64_pton \
1066 __b64_pton \
1067 bcopy \
1068 bindresvport_sa \
1069 clock \
1070 closefrom \
1071 dirfd \
1072 fchdir \
1073 fchmod \
1074 fchown \
1075 freeaddrinfo \
1076 futimes \
1077 getaddrinfo \
1078 getcwd \
1079 getgrouplist \
1080 getnameinfo \
1081 getopt \
1082 getpeereid \
1083 _getpty \
1084 getrlimit \
1085 getttyent \
1086 glob \
1087 inet_aton \
1088 inet_ntoa \
1089 inet_ntop \
1090 innetgr \
1091 login_getcapbool \
1092 md5_crypt \
1093 memmove \
1094 mkdtemp \
1095 mmap \
1096 ngetaddrinfo \
1097 nsleep \
1098 ogetaddrinfo \
1099 openlog_r \
1100 openpty \
1101 prctl \
1102 pstat \
1103 readpassphrase \
1104 realpath \
1105 recvmsg \
1106 rresvport_af \
1107 sendmsg \
1108 setdtablesize \
1109 setegid \
1110 setenv \
1111 seteuid \
1112 setgroups \
1113 setlogin \
1114 setpcred \
1115 setproctitle \
1116 setregid \
1117 setreuid \
1118 setrlimit \
1119 setsid \
1120 setvbuf \
1121 sigaction \
1122 sigvec \
1123 snprintf \
1124 socketpair \
1125 strdup \
1126 strerror \
1127 strlcat \
1128 strlcpy \
1129 strmode \
1130 strnvis \
1131 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001132 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001133 strtoul \
1134 sysconf \
1135 tcgetpgrp \
1136 truncate \
1137 unsetenv \
1138 updwtmpx \
1139 utimes \
1140 vhangup \
1141 vsnprintf \
1142 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001143)
Tim Rice13aae5e2001-10-21 17:53:58 -07001144
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001145# IRIX has a const char return value for gai_strerror()
1146AC_CHECK_FUNCS(gai_strerror,[
1147 AC_DEFINE(HAVE_GAI_STRERROR)
1148 AC_TRY_COMPILE([
1149#include <sys/types.h>
1150#include <sys/socket.h>
1151#include <netdb.h>
1152
1153const char *gai_strerror(int);],[
1154char *str;
1155
1156str = gai_strerror(0);],[
1157 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1158 [Define if gai_strerror() returns const char *])])])
1159
Damien Millercd6853c2003-01-28 11:33:42 +11001160AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1161
Darren Tuckerf1159b52003-07-07 19:44:01 +10001162dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001163AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001164AC_CHECK_DECL(strsep,
1165 [AC_CHECK_FUNCS(strsep)],
1166 [],
1167 [
1168#ifdef HAVE_STRING_H
1169# include <string.h>
1170#endif
1171 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001172
Darren Tuckerb2427c82003-09-10 15:22:44 +10001173dnl tcsendbreak might be a macro
1174AC_CHECK_DECL(tcsendbreak,
1175 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001176 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001177 [#include <termios.h>]
1178)
1179
Darren Tucker5bb14002004-04-23 18:53:10 +10001180AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1181
Darren Tucker2a6b0292003-12-31 14:59:17 +11001182AC_CHECK_FUNCS(setresuid, [
1183 dnl Some platorms have setresuid that isn't implemented, test for this
1184 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001185 AC_RUN_IFELSE(
1186 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001187#include <stdlib.h>
1188#include <errno.h>
1189int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001190 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001191 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001192 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001193 AC_MSG_RESULT(not implemented)],
1194 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001195 )
1196])
Darren Tuckere937be32003-12-17 18:53:26 +11001197
Darren Tucker2a6b0292003-12-31 14:59:17 +11001198AC_CHECK_FUNCS(setresgid, [
1199 dnl Some platorms have setresgid that isn't implemented, test for this
1200 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001201 AC_RUN_IFELSE(
1202 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001203#include <stdlib.h>
1204#include <errno.h>
1205int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001206 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001207 [AC_MSG_RESULT(yes)],
1208 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001209 AC_MSG_RESULT(not implemented)],
1210 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001211 )
1212])
Darren Tuckere937be32003-12-17 18:53:26 +11001213
Damien Millerad833b32000-08-23 10:46:23 +10001214dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001215AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001216dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001217AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001218AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001219dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001220AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001221AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001222
Damien Millera8e06ce2003-11-21 23:48:55 +11001223AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001224 [AC_DEFINE(HAVE_DAEMON)],
1225 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1226)
1227
Damien Millera8e06ce2003-11-21 23:48:55 +11001228AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001229 [AC_DEFINE(HAVE_GETPAGESIZE)],
1230 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1231)
1232
Damien Millercb170cb2000-07-01 16:52:55 +10001233# Check for broken snprintf
1234if test "x$ac_cv_func_snprintf" = "xyes" ; then
1235 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001236 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001237 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001238#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001239int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001240 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001241 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001242 [
1243 AC_MSG_RESULT(no)
1244 AC_DEFINE(BROKEN_SNPRINTF)
1245 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001246 ],
1247 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001248 )
1249fi
1250
Damien Millerb4097182004-05-23 14:09:40 +10001251# Check for missing getpeereid (or equiv) support
1252NO_PEERCHECK=""
1253if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1254 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1255 AC_TRY_COMPILE(
1256 [#include <sys/types.h>
1257 #include <sys/socket.h>],
1258 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001259 [ AC_MSG_RESULT(yes)
1260 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1261 ],
Damien Millerb4097182004-05-23 14:09:40 +10001262 [AC_MSG_RESULT(no)
1263 NO_PEERCHECK=1]
1264 )
1265fi
1266
Damien Millere8328192003-01-07 15:18:32 +11001267dnl see whether mkstemp() requires XXXXXX
1268if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1269AC_MSG_CHECKING([for (overly) strict mkstemp])
1270AC_TRY_RUN(
1271 [
1272#include <stdlib.h>
1273main() { char template[]="conftest.mkstemp-test";
1274if (mkstemp(template) == -1)
1275 exit(1);
1276unlink(template); exit(0);
1277}
1278 ],
1279 [
1280 AC_MSG_RESULT(no)
1281 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001282 [
Damien Millere8328192003-01-07 15:18:32 +11001283 AC_MSG_RESULT(yes)
1284 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1285 ],
1286 [
1287 AC_MSG_RESULT(yes)
1288 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001289 ]
Damien Millere8328192003-01-07 15:18:32 +11001290)
1291fi
1292
Darren Tucker70a3d552003-08-21 17:58:29 +10001293dnl make sure that openpty does not reacquire controlling terminal
1294if test ! -z "$check_for_openpty_ctty_bug"; then
1295 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1296 AC_TRY_RUN(
1297 [
1298#include <stdio.h>
1299#include <sys/fcntl.h>
1300#include <sys/types.h>
1301#include <sys/wait.h>
1302
1303int
1304main()
1305{
1306 pid_t pid;
1307 int fd, ptyfd, ttyfd, status;
1308
1309 pid = fork();
1310 if (pid < 0) { /* failed */
1311 exit(1);
1312 } else if (pid > 0) { /* parent */
1313 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001314 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001315 exit(WEXITSTATUS(status));
1316 else
1317 exit(2);
1318 } else { /* child */
1319 close(0); close(1); close(2);
1320 setsid();
1321 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1322 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1323 if (fd >= 0)
1324 exit(3); /* Acquired ctty: broken */
1325 else
1326 exit(0); /* Did not acquire ctty: OK */
1327 }
1328}
1329 ],
1330 [
1331 AC_MSG_RESULT(yes)
1332 ],
1333 [
1334 AC_MSG_RESULT(no)
1335 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1336 ]
1337 )
1338fi
1339
Tim Rice8bb561b2005-03-17 16:23:19 -08001340if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1341 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001342 AC_MSG_CHECKING(if getaddrinfo seems to work)
1343 AC_TRY_RUN(
1344 [
1345#include <stdio.h>
1346#include <sys/socket.h>
1347#include <netdb.h>
1348#include <errno.h>
1349#include <netinet/in.h>
1350
1351#define TEST_PORT "2222"
1352
1353int
1354main(void)
1355{
1356 int err, sock;
1357 struct addrinfo *gai_ai, *ai, hints;
1358 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1359
1360 memset(&hints, 0, sizeof(hints));
1361 hints.ai_family = PF_UNSPEC;
1362 hints.ai_socktype = SOCK_STREAM;
1363 hints.ai_flags = AI_PASSIVE;
1364
1365 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1366 if (err != 0) {
1367 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1368 exit(1);
1369 }
1370
1371 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1372 if (ai->ai_family != AF_INET6)
1373 continue;
1374
1375 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1376 sizeof(ntop), strport, sizeof(strport),
1377 NI_NUMERICHOST|NI_NUMERICSERV);
1378
1379 if (err != 0) {
1380 if (err == EAI_SYSTEM)
1381 perror("getnameinfo EAI_SYSTEM");
1382 else
1383 fprintf(stderr, "getnameinfo failed: %s\n",
1384 gai_strerror(err));
1385 exit(2);
1386 }
1387
1388 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1389 if (sock < 0)
1390 perror("socket");
1391 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1392 if (errno == EBADF)
1393 exit(3);
1394 }
1395 }
1396 exit(0);
1397}
1398 ],
1399 [
1400 AC_MSG_RESULT(yes)
1401 ],
1402 [
1403 AC_MSG_RESULT(no)
1404 AC_DEFINE(BROKEN_GETADDRINFO)
1405 ]
1406 )
1407fi
1408
Tim Rice8bb561b2005-03-17 16:23:19 -08001409if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1410 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001411 AC_MSG_CHECKING(if getaddrinfo seems to work)
1412 AC_TRY_RUN(
1413 [
1414#include <stdio.h>
1415#include <sys/socket.h>
1416#include <netdb.h>
1417#include <errno.h>
1418#include <netinet/in.h>
1419
1420#define TEST_PORT "2222"
1421
1422int
1423main(void)
1424{
1425 int err, sock;
1426 struct addrinfo *gai_ai, *ai, hints;
1427 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1428
1429 memset(&hints, 0, sizeof(hints));
1430 hints.ai_family = PF_UNSPEC;
1431 hints.ai_socktype = SOCK_STREAM;
1432 hints.ai_flags = AI_PASSIVE;
1433
1434 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1435 if (err != 0) {
1436 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1437 exit(1);
1438 }
1439
1440 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1441 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1442 continue;
1443
1444 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1445 sizeof(ntop), strport, sizeof(strport),
1446 NI_NUMERICHOST|NI_NUMERICSERV);
1447
1448 if (ai->ai_family == AF_INET && err != 0) {
1449 perror("getnameinfo");
1450 exit(2);
1451 }
1452 }
1453 exit(0);
1454}
1455 ],
1456 [
1457 AC_MSG_RESULT(yes)
1458 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1459[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1460 ],
1461 [
1462 AC_MSG_RESULT(no)
1463 AC_DEFINE(BROKEN_GETADDRINFO)
1464 ]
1465 )
1466fi
1467
Darren Tuckera56f1912004-11-02 20:30:54 +11001468if test "x$check_for_conflicting_getspnam" = "x1"; then
1469 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1470 AC_COMPILE_IFELSE(
1471 [
1472#include <shadow.h>
1473int main(void) {exit(0);}
1474 ],
1475 [
1476 AC_MSG_RESULT(no)
1477 ],
1478 [
1479 AC_MSG_RESULT(yes)
1480 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1481 [Conflicting defs for getspnam])
1482 ]
1483 )
1484fi
1485
Damien Miller606f8802000-09-16 15:39:56 +11001486AC_FUNC_GETPGRP
1487
Damien Millera64b57a2001-01-17 10:44:13 +11001488# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001489PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001490AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001491 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001492 [
Damien Millera64b57a2001-01-17 10:44:13 +11001493 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001494 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1495 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001496 AC_MSG_ERROR([PAM headers not found])
1497 fi
1498
1499 AC_CHECK_LIB(dl, dlopen, , )
1500 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1501 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001502 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001503
Damien Millera64b57a2001-01-17 10:44:13 +11001504 PAM_MSG="yes"
1505
1506 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001507 if test $ac_cv_lib_dl_dlopen = yes; then
1508 LIBPAM="-lpam -ldl"
1509 else
1510 LIBPAM="-lpam"
1511 fi
1512 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001513 fi
1514 ]
1515)
Damien Millera22ba012000-03-02 23:09:20 +11001516
Damien Millera64b57a2001-01-17 10:44:13 +11001517# Check for older PAM
1518if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001519 # Check PAM strerror arguments (old PAM)
1520 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1521 AC_TRY_COMPILE(
1522 [
Damien Miller81171112000-04-23 11:14:01 +10001523#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001524#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001525#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001526#elif defined (HAVE_PAM_PAM_APPL_H)
1527#include <pam/pam_appl.h>
1528#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001529 ],
1530 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001531 [AC_MSG_RESULT(no)],
1532 [
1533 AC_DEFINE(HAVE_OLD_PAM)
1534 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001535 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001536 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001537 )
Damien Millera22ba012000-03-02 23:09:20 +11001538fi
1539
Tim Riceaef73712002-05-11 13:17:42 -07001540# Search for OpenSSL
1541saved_CPPFLAGS="$CPPFLAGS"
1542saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001543AC_ARG_WITH(ssl-dir,
1544 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1545 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001546 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001547 case "$withval" in
1548 # Relative paths
1549 ./*|../*) withval="`pwd`/$withval"
1550 esac
Tim Riceaef73712002-05-11 13:17:42 -07001551 if test -d "$withval/lib"; then
1552 if test -n "${need_dash_r}"; then
1553 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1554 else
1555 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1556 fi
1557 else
1558 if test -n "${need_dash_r}"; then
1559 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1560 else
1561 LDFLAGS="-L${withval} ${LDFLAGS}"
1562 fi
1563 fi
1564 if test -d "$withval/include"; then
1565 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1566 else
1567 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1568 fi
Damien Millera22ba012000-03-02 23:09:20 +11001569 fi
1570 ]
1571)
Tim Rice3d5352e2004-02-12 09:27:21 -08001572LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001573AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001574 [
Tim Riceaef73712002-05-11 13:17:42 -07001575 dnl Check default openssl install dir
1576 if test -n "${need_dash_r}"; then
1577 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001578 else
Tim Riceaef73712002-05-11 13:17:42 -07001579 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001580 fi
Tim Riceaef73712002-05-11 13:17:42 -07001581 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1582 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1583 [
1584 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1585 ]
1586 )
1587 ]
1588)
1589
Tim Riced730b782002-08-13 18:52:10 -07001590# Determine OpenSSL header version
1591AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001592AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001593 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001594#include <stdio.h>
1595#include <string.h>
1596#include <openssl/opensslv.h>
1597#define DATA "conftest.sslincver"
1598int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001599 FILE *fd;
1600 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001601
Damien Millera8e06ce2003-11-21 23:48:55 +11001602 fd = fopen(DATA,"w");
1603 if(fd == NULL)
1604 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001605
1606 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1607 exit(1);
1608
1609 exit(0);
1610}
Darren Tucker623d92f2004-09-12 22:36:15 +10001611 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001612 [
1613 ssl_header_ver=`cat conftest.sslincver`
1614 AC_MSG_RESULT($ssl_header_ver)
1615 ],
1616 [
1617 AC_MSG_RESULT(not found)
1618 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001619 ],
1620 [
1621 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001622 ]
1623)
1624
1625# Determine OpenSSL library version
1626AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001627AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001628 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001629#include <stdio.h>
1630#include <string.h>
1631#include <openssl/opensslv.h>
1632#include <openssl/crypto.h>
1633#define DATA "conftest.ssllibver"
1634int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001635 FILE *fd;
1636 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001637
Damien Millera8e06ce2003-11-21 23:48:55 +11001638 fd = fopen(DATA,"w");
1639 if(fd == NULL)
1640 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001641
1642 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1643 exit(1);
1644
1645 exit(0);
1646}
Darren Tucker623d92f2004-09-12 22:36:15 +10001647 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001648 [
1649 ssl_library_ver=`cat conftest.ssllibver`
1650 AC_MSG_RESULT($ssl_library_ver)
1651 ],
1652 [
1653 AC_MSG_RESULT(not found)
1654 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001655 ],
1656 [
1657 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001658 ]
1659)
Damien Millera22ba012000-03-02 23:09:20 +11001660
Damien Millerec932372002-01-22 22:16:03 +11001661# Sanity check OpenSSL headers
1662AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001663AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001664 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001665#include <string.h>
1666#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001667int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001668 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001669 [
1670 AC_MSG_RESULT(yes)
1671 ],
1672 [
1673 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001674 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1675Check config.log for details.
1676Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001677 ],
1678 [
1679 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001680 ]
1681)
1682
Tim Rice3d5352e2004-02-12 09:27:21 -08001683# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1684# because the system crypt() is more featureful.
1685if test "x$check_for_libcrypt_before" = "x1"; then
1686 AC_CHECK_LIB(crypt, crypt)
1687fi
1688
Damien Millera8e06ce2003-11-21 23:48:55 +11001689# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001690# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001691if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001692 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001693fi
1694
Damien Miller6c21c512002-01-22 21:57:53 +11001695
1696### Configure cryptographic random number support
1697
1698# Check wheter OpenSSL seeds itself
1699AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001700AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001701 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001702#include <string.h>
1703#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001704int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001705 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001706 [
1707 OPENSSL_SEEDS_ITSELF=yes
1708 AC_MSG_RESULT(yes)
1709 ],
1710 [
1711 AC_MSG_RESULT(no)
1712 # Default to use of the rand helper if OpenSSL doesn't
1713 # seed itself
1714 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001715 ],
1716 [
1717 AC_MSG_WARN([cross compiling: assuming yes])
1718 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001719 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001720 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001721 ]
1722)
1723
1724
1725# Do we want to force the use of the rand helper?
1726AC_ARG_WITH(rand-helper,
1727 [ --with-rand-helper Use subprocess to gather strong randomness ],
1728 [
1729 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001730 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001731 # the previous test showed it to be unseeded.
1732 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1733 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1734 OPENSSL_SEEDS_ITSELF=yes
1735 USE_RAND_HELPER=""
1736 fi
1737 else
1738 USE_RAND_HELPER=yes
1739 fi
1740 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001741)
Damien Miller6c21c512002-01-22 21:57:53 +11001742
1743# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001744if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001745 # OpenSSL only
1746 AC_DEFINE(OPENSSL_PRNG_ONLY)
1747 RAND_MSG="OpenSSL internal ONLY"
1748 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001749elif test ! -z "$USE_RAND_HELPER" ; then
1750 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001751 RAND_MSG="ssh-rand-helper"
1752 INSTALL_SSH_RAND_HELPER="yes"
1753fi
1754AC_SUBST(INSTALL_SSH_RAND_HELPER)
1755
1756### Configuration of ssh-rand-helper
1757
1758# PRNGD TCP socket
1759AC_ARG_WITH(prngd-port,
1760 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1761 [
Damien Millere996d722002-01-23 11:20:59 +11001762 case "$withval" in
1763 no)
1764 withval=""
1765 ;;
1766 [[0-9]]*)
1767 ;;
1768 *)
1769 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1770 ;;
1771 esac
1772 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001773 PRNGD_PORT="$withval"
1774 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1775 fi
1776 ]
1777)
1778
1779# PRNGD Unix domain socket
1780AC_ARG_WITH(prngd-socket,
1781 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1782 [
Damien Millere996d722002-01-23 11:20:59 +11001783 case "$withval" in
1784 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001785 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001786 ;;
1787 no)
1788 withval=""
1789 ;;
1790 /*)
1791 ;;
1792 *)
1793 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1794 ;;
1795 esac
1796
1797 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001798 if test ! -z "$PRNGD_PORT" ; then
1799 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1800 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001801 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001802 AC_MSG_WARN(Entropy socket is not readable)
1803 fi
1804 PRNGD_SOCKET="$withval"
1805 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1806 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001807 ],
1808 [
1809 # Check for existing socket only if we don't have a random device already
1810 if test "$USE_RAND_HELPER" = yes ; then
1811 AC_MSG_CHECKING(for PRNGD/EGD socket)
1812 # Insert other locations here
1813 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1814 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1815 PRNGD_SOCKET="$sock"
1816 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1817 break;
1818 fi
1819 done
1820 if test ! -z "$PRNGD_SOCKET" ; then
1821 AC_MSG_RESULT($PRNGD_SOCKET)
1822 else
1823 AC_MSG_RESULT(not found)
1824 fi
1825 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001826 ]
1827)
1828
1829# Change default command timeout for hashing entropy source
1830entropy_timeout=200
1831AC_ARG_WITH(entropy-timeout,
1832 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1833 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001834 if test -n "$withval" && test "x$withval" != "xno" && \
1835 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001836 entropy_timeout=$withval
1837 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001838 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001839)
Damien Miller6c21c512002-01-22 21:57:53 +11001840AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1841
Damien Millerd3f6ad22002-06-25 10:24:47 +10001842SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001843AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001844 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001845 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001846 if test -n "$withval" && test "x$withval" != "xno" && \
1847 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001848 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001849 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001850 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001851)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001852AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1853AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001854
Tim Rice88f2ab52002-03-17 12:17:34 -08001855# We do this little dance with the search path to insure
1856# that programs that we select for use by installed programs
1857# (which may be run by the super-user) come from trusted
1858# locations before they come from the user's private area.
1859# This should help avoid accidentally configuring some
1860# random version of a program in someone's personal bin.
1861
1862OPATH=$PATH
1863PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001864test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001865test -d /sbin && PATH=$PATH:/sbin
1866test -d /usr/sbin && PATH=$PATH:/usr/sbin
1867PATH=$PATH:/etc:$OPATH
1868
Damien Millera8e06ce2003-11-21 23:48:55 +11001869# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001870OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1871OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1872OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1873OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1874OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1875OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1876OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1877OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1878OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1879OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1880OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1881OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1882OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1883OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1884OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1885OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001886# restore PATH
1887PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001888
1889# Where does ssh-rand-helper get its randomness from?
1890INSTALL_SSH_PRNG_CMDS=""
1891if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1892 if test ! -z "$PRNGD_PORT" ; then
1893 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1894 elif test ! -z "$PRNGD_SOCKET" ; then
1895 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1896 else
1897 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1898 RAND_HELPER_CMDHASH=yes
1899 INSTALL_SSH_PRNG_CMDS="yes"
1900 fi
1901fi
1902AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1903
1904
Ben Lindstromb5628642000-10-18 00:02:25 +00001905# Cheap hack to ensure NEWS-OS libraries are arranged right.
1906if test ! -z "$SONY" ; then
1907 LIBS="$LIBS -liberty";
1908fi
1909
Damien Millera22ba012000-03-02 23:09:20 +11001910# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001911AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001912AC_CHECK_SIZEOF(short int, 2)
1913AC_CHECK_SIZEOF(int, 4)
1914AC_CHECK_SIZEOF(long int, 4)
1915AC_CHECK_SIZEOF(long long int, 8)
1916
Damien Millerfa2bb692002-04-23 23:22:25 +10001917# Sanity check long long for some platforms (AIX)
1918if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1919 ac_cv_sizeof_long_long_int=0
1920fi
1921
Damien Millera22ba012000-03-02 23:09:20 +11001922# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001923AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1924 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001925 [ #include <sys/types.h> ],
1926 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001927 [ ac_cv_have_u_int="yes" ],
1928 [ ac_cv_have_u_int="no" ]
1929 )
1930])
1931if test "x$ac_cv_have_u_int" = "xyes" ; then
1932 AC_DEFINE(HAVE_U_INT)
1933 have_u_int=1
1934fi
1935
Damien Miller61e50f12000-05-08 20:49:37 +10001936AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1937 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001938 [ #include <sys/types.h> ],
1939 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001940 [ ac_cv_have_intxx_t="yes" ],
1941 [ ac_cv_have_intxx_t="no" ]
1942 )
1943])
1944if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1945 AC_DEFINE(HAVE_INTXX_T)
1946 have_intxx_t=1
1947fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001948
1949if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001950 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001951then
1952 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1953 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001954 [ #include <stdint.h> ],
1955 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001956 [
1957 AC_DEFINE(HAVE_INTXX_T)
1958 AC_MSG_RESULT(yes)
1959 ],
1960 [ AC_MSG_RESULT(no) ]
1961 )
1962fi
1963
Damien Miller578783e2000-09-23 14:12:24 +11001964AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1965 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001966 [
1967#include <sys/types.h>
1968#ifdef HAVE_STDINT_H
1969# include <stdint.h>
1970#endif
1971#include <sys/socket.h>
1972#ifdef HAVE_SYS_BITYPES_H
1973# include <sys/bitypes.h>
1974#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001975 ],
1976 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001977 [ ac_cv_have_int64_t="yes" ],
1978 [ ac_cv_have_int64_t="no" ]
1979 )
1980])
1981if test "x$ac_cv_have_int64_t" = "xyes" ; then
1982 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001983fi
1984
Damien Miller61e50f12000-05-08 20:49:37 +10001985AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1986 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001987 [ #include <sys/types.h> ],
1988 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001989 [ ac_cv_have_u_intxx_t="yes" ],
1990 [ ac_cv_have_u_intxx_t="no" ]
1991 )
1992])
1993if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1994 AC_DEFINE(HAVE_U_INTXX_T)
1995 have_u_intxx_t=1
1996fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001997
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001998if test -z "$have_u_intxx_t" ; then
1999 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2000 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002001 [ #include <sys/socket.h> ],
2002 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002003 [
2004 AC_DEFINE(HAVE_U_INTXX_T)
2005 AC_MSG_RESULT(yes)
2006 ],
2007 [ AC_MSG_RESULT(no) ]
2008 )
2009fi
2010
Damien Miller578783e2000-09-23 14:12:24 +11002011AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2012 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002013 [ #include <sys/types.h> ],
2014 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002015 [ ac_cv_have_u_int64_t="yes" ],
2016 [ ac_cv_have_u_int64_t="no" ]
2017 )
2018])
2019if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2020 AC_DEFINE(HAVE_U_INT64_T)
2021 have_u_int64_t=1
2022fi
2023
Tim Rice4cec93f2002-02-26 08:40:48 -08002024if test -z "$have_u_int64_t" ; then
2025 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2026 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002027 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002028 [ u_int64_t a; a = 1],
2029 [
2030 AC_DEFINE(HAVE_U_INT64_T)
2031 AC_MSG_RESULT(yes)
2032 ],
2033 [ AC_MSG_RESULT(no) ]
2034 )
2035fi
2036
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002037if test -z "$have_u_intxx_t" ; then
2038 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2039 AC_TRY_COMPILE(
2040 [
2041#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002042 ],
2043 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002044 [ ac_cv_have_uintxx_t="yes" ],
2045 [ ac_cv_have_uintxx_t="no" ]
2046 )
2047 ])
2048 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2049 AC_DEFINE(HAVE_UINTXX_T)
2050 fi
2051fi
2052
2053if test -z "$have_uintxx_t" ; then
2054 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2055 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002056 [ #include <stdint.h> ],
2057 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002058 [
2059 AC_DEFINE(HAVE_UINTXX_T)
2060 AC_MSG_RESULT(yes)
2061 ],
2062 [ AC_MSG_RESULT(no) ]
2063 )
2064fi
2065
Damien Milleredb82922000-06-20 13:25:52 +10002066if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002067 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002068then
2069 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2070 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002071 [
2072#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002073 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002074 [
Damien Miller70494d12000-04-03 15:57:06 +10002075 int8_t a; int16_t b; int32_t c;
2076 u_int8_t e; u_int16_t f; u_int32_t g;
2077 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002078 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002079 [
2080 AC_DEFINE(HAVE_U_INTXX_T)
2081 AC_DEFINE(HAVE_INTXX_T)
2082 AC_MSG_RESULT(yes)
2083 ],
2084 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002085 )
Damien Millerb29ea912000-01-15 14:12:03 +11002086fi
2087
Damien Miller58be7382001-09-15 21:31:54 +10002088
2089AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2090 AC_TRY_COMPILE(
2091 [
2092#include <sys/types.h>
2093 ],
2094 [ u_char foo; foo = 125; ],
2095 [ ac_cv_have_u_char="yes" ],
2096 [ ac_cv_have_u_char="no" ]
2097 )
2098])
2099if test "x$ac_cv_have_u_char" = "xyes" ; then
2100 AC_DEFINE(HAVE_U_CHAR)
2101fi
2102
Tim Rice13aae5e2001-10-21 17:53:58 -07002103TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002104
Tim Rice200a5c02002-02-26 22:12:34 -08002105AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002106
Damien Miller848b9932005-02-24 12:12:34 +11002107AC_CHECK_TYPES(in_addr_t,,,
2108[#include <sys/types.h>
2109#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002110
Damien Miller61e50f12000-05-08 20:49:37 +10002111AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2112 AC_TRY_COMPILE(
2113 [
2114#include <sys/types.h>
2115 ],
2116 [ size_t foo; foo = 1235; ],
2117 [ ac_cv_have_size_t="yes" ],
2118 [ ac_cv_have_size_t="no" ]
2119 )
2120])
2121if test "x$ac_cv_have_size_t" = "xyes" ; then
2122 AC_DEFINE(HAVE_SIZE_T)
2123fi
Damien Miller95058511999-12-29 10:36:45 +11002124
Damien Miller615f9392000-05-17 22:53:33 +10002125AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2126 AC_TRY_COMPILE(
2127 [
2128#include <sys/types.h>
2129 ],
2130 [ ssize_t foo; foo = 1235; ],
2131 [ ac_cv_have_ssize_t="yes" ],
2132 [ ac_cv_have_ssize_t="no" ]
2133 )
2134])
2135if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2136 AC_DEFINE(HAVE_SSIZE_T)
2137fi
2138
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002139AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2140 AC_TRY_COMPILE(
2141 [
2142#include <time.h>
2143 ],
2144 [ clock_t foo; foo = 1235; ],
2145 [ ac_cv_have_clock_t="yes" ],
2146 [ ac_cv_have_clock_t="no" ]
2147 )
2148])
2149if test "x$ac_cv_have_clock_t" = "xyes" ; then
2150 AC_DEFINE(HAVE_CLOCK_T)
2151fi
2152
Damien Millerb54b40e2000-06-23 08:23:34 +10002153AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2154 AC_TRY_COMPILE(
2155 [
2156#include <sys/types.h>
2157#include <sys/socket.h>
2158 ],
2159 [ sa_family_t foo; foo = 1235; ],
2160 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002161 [ AC_TRY_COMPILE(
2162 [
2163#include <sys/types.h>
2164#include <sys/socket.h>
2165#include <netinet/in.h>
2166 ],
2167 [ sa_family_t foo; foo = 1235; ],
2168 [ ac_cv_have_sa_family_t="yes" ],
2169
Damien Millerb54b40e2000-06-23 08:23:34 +10002170 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002171 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002172 )
2173])
2174if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2175 AC_DEFINE(HAVE_SA_FAMILY_T)
2176fi
2177
Damien Miller0f91b4e2000-06-18 15:43:25 +10002178AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2179 AC_TRY_COMPILE(
2180 [
2181#include <sys/types.h>
2182 ],
2183 [ pid_t foo; foo = 1235; ],
2184 [ ac_cv_have_pid_t="yes" ],
2185 [ ac_cv_have_pid_t="no" ]
2186 )
2187])
2188if test "x$ac_cv_have_pid_t" = "xyes" ; then
2189 AC_DEFINE(HAVE_PID_T)
2190fi
2191
2192AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2193 AC_TRY_COMPILE(
2194 [
2195#include <sys/types.h>
2196 ],
2197 [ mode_t foo; foo = 1235; ],
2198 [ ac_cv_have_mode_t="yes" ],
2199 [ ac_cv_have_mode_t="no" ]
2200 )
2201])
2202if test "x$ac_cv_have_mode_t" = "xyes" ; then
2203 AC_DEFINE(HAVE_MODE_T)
2204fi
2205
Damien Miller61e50f12000-05-08 20:49:37 +10002206
2207AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2208 AC_TRY_COMPILE(
2209 [
Damien Miller81171112000-04-23 11:14:01 +10002210#include <sys/types.h>
2211#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002212 ],
2213 [ struct sockaddr_storage s; ],
2214 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2215 [ ac_cv_have_struct_sockaddr_storage="no" ]
2216 )
2217])
2218if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2219 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2220fi
Damien Miller34132e52000-01-14 15:45:46 +11002221
Damien Miller61e50f12000-05-08 20:49:37 +10002222AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2223 AC_TRY_COMPILE(
2224 [
Damien Miller7b22d652000-06-18 14:07:04 +10002225#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002226#include <netinet/in.h>
2227 ],
2228 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2229 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2230 [ ac_cv_have_struct_sockaddr_in6="no" ]
2231 )
2232])
2233if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2234 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2235fi
Damien Miller34132e52000-01-14 15:45:46 +11002236
Damien Miller61e50f12000-05-08 20:49:37 +10002237AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2238 AC_TRY_COMPILE(
2239 [
Damien Miller7b22d652000-06-18 14:07:04 +10002240#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002241#include <netinet/in.h>
2242 ],
2243 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2244 [ ac_cv_have_struct_in6_addr="yes" ],
2245 [ ac_cv_have_struct_in6_addr="no" ]
2246 )
2247])
2248if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2249 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2250fi
Damien Miller34132e52000-01-14 15:45:46 +11002251
Damien Miller61e50f12000-05-08 20:49:37 +10002252AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2253 AC_TRY_COMPILE(
2254 [
Damien Miller81171112000-04-23 11:14:01 +10002255#include <sys/types.h>
2256#include <sys/socket.h>
2257#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002258 ],
2259 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2260 [ ac_cv_have_struct_addrinfo="yes" ],
2261 [ ac_cv_have_struct_addrinfo="no" ]
2262 )
2263])
2264if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2265 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2266fi
2267
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002268AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2269 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002270 [ #include <sys/time.h> ],
2271 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002272 [ ac_cv_have_struct_timeval="yes" ],
2273 [ ac_cv_have_struct_timeval="no" ]
2274 )
2275])
2276if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2277 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2278 have_struct_timeval=1
2279fi
2280
Tim Rice4e4dc562003-03-18 10:21:40 -08002281AC_CHECK_TYPES(struct timespec)
2282
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002283# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002284if test "x$ac_cv_have_int64_t" = "xno" && \
2285 test "x$ac_cv_sizeof_long_int" != "x8" && \
2286 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002287 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2288 echo "an alternative compiler (I.E., GCC) before continuing."
2289 echo ""
2290 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002291else
2292dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002293 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002294 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002295#include <stdio.h>
2296#include <string.h>
2297#ifdef HAVE_SNPRINTF
2298main()
2299{
2300 char buf[50];
2301 char expected_out[50];
2302 int mazsize = 50 ;
2303#if (SIZEOF_LONG_INT == 8)
2304 long int num = 0x7fffffffffffffff;
2305#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002306 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002307#endif
2308 strcpy(expected_out, "9223372036854775807");
2309 snprintf(buf, mazsize, "%lld", num);
2310 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002311 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002312 exit(0);
2313}
2314#else
2315main() { exit(0); }
2316#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002317 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002318 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002319 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002320fi
2321
Damien Miller78315eb2000-09-29 23:01:36 +11002322dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002323OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2324OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2325OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2326OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2327OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002328OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002329OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2330OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002331OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002332OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2333OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2334OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2335OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002336OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2337OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2338OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2339OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002340
2341AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002342
Damien Miller61e50f12000-05-08 20:49:37 +10002343AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2344 ac_cv_have_ss_family_in_struct_ss, [
2345 AC_TRY_COMPILE(
2346 [
Damien Miller81171112000-04-23 11:14:01 +10002347#include <sys/types.h>
2348#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002349 ],
2350 [ struct sockaddr_storage s; s.ss_family = 1; ],
2351 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2352 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2353 )
2354])
2355if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2356 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2357fi
2358
Damien Miller61e50f12000-05-08 20:49:37 +10002359AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2360 ac_cv_have___ss_family_in_struct_ss, [
2361 AC_TRY_COMPILE(
2362 [
Damien Miller81171112000-04-23 11:14:01 +10002363#include <sys/types.h>
2364#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002365 ],
2366 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2367 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2368 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2369 )
2370])
2371if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2372 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2373fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002374
Damien Millerad833b32000-08-23 10:46:23 +10002375AC_CACHE_CHECK([for pw_class field in struct passwd],
2376 ac_cv_have_pw_class_in_struct_passwd, [
2377 AC_TRY_COMPILE(
2378 [
Damien Millerad833b32000-08-23 10:46:23 +10002379#include <pwd.h>
2380 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002381 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002382 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2383 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2384 )
2385])
2386if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2387 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2388fi
2389
Kevin Steves82456952001-06-22 21:14:18 +00002390AC_CACHE_CHECK([for pw_expire field in struct passwd],
2391 ac_cv_have_pw_expire_in_struct_passwd, [
2392 AC_TRY_COMPILE(
2393 [
2394#include <pwd.h>
2395 ],
2396 [ struct passwd p; p.pw_expire = 0; ],
2397 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2398 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2399 )
2400])
2401if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2402 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2403fi
2404
2405AC_CACHE_CHECK([for pw_change field in struct passwd],
2406 ac_cv_have_pw_change_in_struct_passwd, [
2407 AC_TRY_COMPILE(
2408 [
2409#include <pwd.h>
2410 ],
2411 [ struct passwd p; p.pw_change = 0; ],
2412 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2413 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2414 )
2415])
2416if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2417 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2418fi
Damien Miller61e50f12000-05-08 20:49:37 +10002419
Tim Rice28bbb0c2002-05-27 17:37:32 -07002420dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002421AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2422 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002423 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002424 [
Tim Riceae49fe62002-04-12 10:26:21 -07002425#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002426#include <sys/socket.h>
2427#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002428int main() {
2429#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002430#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002431exit(1);
2432#endif
2433struct msghdr m;
2434m.msg_accrights = 0;
2435exit(0);
2436}
Kevin Steves939c9db2002-03-22 17:23:25 +00002437 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002438 [ ac_cv_have_accrights_in_msghdr="yes" ],
2439 [ ac_cv_have_accrights_in_msghdr="no" ]
2440 )
2441])
2442if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2443 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2444fi
2445
Kevin Stevesa44e0352002-04-07 16:18:03 +00002446AC_CACHE_CHECK([for msg_control field in struct msghdr],
2447 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002448 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002449 [
Tim Riceae49fe62002-04-12 10:26:21 -07002450#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002451#include <sys/socket.h>
2452#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002453int main() {
2454#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002455#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002456exit(1);
2457#endif
2458struct msghdr m;
2459m.msg_control = 0;
2460exit(0);
2461}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002462 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002463 [ ac_cv_have_control_in_msghdr="yes" ],
2464 [ ac_cv_have_control_in_msghdr="no" ]
2465 )
2466])
2467if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2468 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2469fi
2470
Damien Miller61e50f12000-05-08 20:49:37 +10002471AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002472 AC_TRY_LINK([],
2473 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002474 [ ac_cv_libc_defines___progname="yes" ],
2475 [ ac_cv_libc_defines___progname="no" ]
2476 )
2477])
2478if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2479 AC_DEFINE(HAVE___PROGNAME)
2480fi
2481
Kevin Steves4846f4a2002-03-22 18:19:53 +00002482AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2483 AC_TRY_LINK([
2484#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002485],
2486 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002487 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2488 [ ac_cv_cc_implements___FUNCTION__="no" ]
2489 )
2490])
2491if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2492 AC_DEFINE(HAVE___FUNCTION__)
2493fi
2494
2495AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2496 AC_TRY_LINK([
2497#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002498],
2499 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002500 [ ac_cv_cc_implements___func__="yes" ],
2501 [ ac_cv_cc_implements___func__="no" ]
2502 )
2503])
2504if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2505 AC_DEFINE(HAVE___func__)
2506fi
2507
Damien Miller4f8e6692001-07-14 13:22:53 +10002508AC_CACHE_CHECK([whether getopt has optreset support],
2509 ac_cv_have_getopt_optreset, [
2510 AC_TRY_LINK(
2511 [
2512#include <getopt.h>
2513 ],
2514 [ extern int optreset; optreset = 0; ],
2515 [ ac_cv_have_getopt_optreset="yes" ],
2516 [ ac_cv_have_getopt_optreset="no" ]
2517 )
2518])
2519if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2520 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2521fi
Damien Millera22ba012000-03-02 23:09:20 +11002522
Damien Millerecbb26d2000-07-15 14:59:14 +10002523AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002524 AC_TRY_LINK([],
2525 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002526 [ ac_cv_libc_defines_sys_errlist="yes" ],
2527 [ ac_cv_libc_defines_sys_errlist="no" ]
2528 )
2529])
2530if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2531 AC_DEFINE(HAVE_SYS_ERRLIST)
2532fi
2533
2534
Damien Miller11fa2cc2000-08-16 10:35:58 +10002535AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002536 AC_TRY_LINK([],
2537 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002538 [ ac_cv_libc_defines_sys_nerr="yes" ],
2539 [ ac_cv_libc_defines_sys_nerr="no" ]
2540 )
2541])
2542if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2543 AC_DEFINE(HAVE_SYS_NERR)
2544fi
2545
Damien Millera8e06ce2003-11-21 23:48:55 +11002546SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002547# Check whether user wants sectok support
2548AC_ARG_WITH(sectok,
2549 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002550 [
2551 if test "x$withval" != "xno" ; then
2552 if test "x$withval" != "xyes" ; then
2553 CPPFLAGS="$CPPFLAGS -I${withval}"
2554 LDFLAGS="$LDFLAGS -L${withval}"
2555 if test ! -z "$need_dash_r" ; then
2556 LDFLAGS="$LDFLAGS -R${withval}"
2557 fi
2558 if test ! -z "$blibpath" ; then
2559 blibpath="$blibpath:${withval}"
2560 fi
2561 fi
2562 AC_CHECK_HEADERS(sectok.h)
2563 if test "$ac_cv_header_sectok_h" != yes; then
2564 AC_MSG_ERROR(Can't find sectok.h)
2565 fi
2566 AC_CHECK_LIB(sectok, sectok_open)
2567 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2568 AC_MSG_ERROR(Can't find libsectok)
2569 fi
2570 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002571 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002572 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002573 fi
2574 ]
2575)
2576
2577# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002578OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002579AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002580 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2581 [
2582 if test "x$withval" != "xno" ; then
2583 if test "x$withval" != "xyes" ; then
2584 OPENSC_CONFIG=$withval/bin/opensc-config
2585 else
2586 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2587 fi
2588 if test "$OPENSC_CONFIG" != "no"; then
2589 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2590 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2591 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2592 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2593 AC_DEFINE(SMARTCARD)
2594 AC_DEFINE(USE_OPENSC)
2595 SCARD_MSG="yes, using OpenSC"
2596 fi
2597 fi
2598 ]
2599)
Damien Miller85de5802001-09-18 14:01:11 +10002600
Darren Tucker5f88d342003-10-15 16:57:57 +10002601# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002602AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002603 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002604 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002605 # Needed by our getrrsetbyname()
2606 AC_SEARCH_LIBS(res_query, resolv)
2607 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002608 AC_MSG_CHECKING(if res_query will link)
2609 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2610 [AC_MSG_RESULT(no)
2611 saved_LIBS="$LIBS"
2612 LIBS="$LIBS -lresolv"
2613 AC_MSG_CHECKING(for res_query in -lresolv)
2614 AC_LINK_IFELSE([
2615#include <resolv.h>
2616int main()
2617{
2618 res_query (0, 0, 0, 0, 0);
2619 return 0;
2620}
2621 ],
2622 [LIBS="$LIBS -lresolv"
2623 AC_MSG_RESULT(yes)],
2624 [LIBS="$saved_LIBS"
2625 AC_MSG_RESULT(no)])
2626 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002627 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002628 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002629 [#include <sys/types.h>
2630 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002631 AC_CHECK_MEMBER(HEADER.ad,
2632 [AC_DEFINE(HAVE_HEADER_AD)],,
2633 [#include <arpa/nameser.h>])
2634 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002635
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002636# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002637KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002638AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002639 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002640 [ if test "x$withval" != "xno" ; then
2641 if test "x$withval" = "xyes" ; then
2642 KRB5ROOT="/usr/local"
2643 else
2644 KRB5ROOT=${withval}
2645 fi
2646
2647 AC_DEFINE(KRB5)
2648 KRB5_MSG="yes"
2649
2650 AC_MSG_CHECKING(for krb5-config)
2651 if test -x $KRB5ROOT/bin/krb5-config ; then
2652 KRB5CONF=$KRB5ROOT/bin/krb5-config
2653 AC_MSG_RESULT($KRB5CONF)
2654
2655 AC_MSG_CHECKING(for gssapi support)
2656 if $KRB5CONF | grep gssapi >/dev/null ; then
2657 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002658 AC_DEFINE(GSSAPI)
2659 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002660 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002661 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002662 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002663 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002664 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2665 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002666 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002667 AC_MSG_CHECKING(whether we are using Heimdal)
2668 AC_TRY_COMPILE([ #include <krb5.h> ],
2669 [ char *tmp = heimdal_version; ],
2670 [ AC_MSG_RESULT(yes)
2671 AC_DEFINE(HEIMDAL) ],
2672 AC_MSG_RESULT(no)
2673 )
2674 else
2675 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002676 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002677 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002678 AC_MSG_CHECKING(whether we are using Heimdal)
2679 AC_TRY_COMPILE([ #include <krb5.h> ],
2680 [ char *tmp = heimdal_version; ],
2681 [ AC_MSG_RESULT(yes)
2682 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002683 K5LIBS="-lkrb5 -ldes"
2684 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002685 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002686 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002687 ],
2688 [ AC_MSG_RESULT(no)
2689 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2690 ]
2691 )
Damien Miller200d0a72003-06-30 19:21:36 +10002692 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002693
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002694 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2695 [ AC_DEFINE(GSSAPI)
2696 K5LIBS="-lgssapi $K5LIBS" ],
2697 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2698 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002699 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002700 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2701 $K5LIBS)
2702 ],
2703 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002704
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002705 AC_CHECK_HEADER(gssapi.h, ,
2706 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002707 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002708 AC_CHECK_HEADERS(gssapi.h, ,
2709 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002710 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002711 ]
2712 )
2713
2714 oldCPP="$CPPFLAGS"
2715 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2716 AC_CHECK_HEADER(gssapi_krb5.h, ,
2717 [ CPPFLAGS="$oldCPP" ])
2718
Damien Millera8e06ce2003-11-21 23:48:55 +11002719 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002720 if test ! -z "$need_dash_r" ; then
2721 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2722 fi
2723 if test ! -z "$blibpath" ; then
2724 blibpath="$blibpath:${KRB5ROOT}/lib"
2725 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002726 fi
2727
2728 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2729 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2730 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2731
2732 LIBS="$LIBS $K5LIBS"
2733 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2734 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002735)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002736
Damien Millera22ba012000-03-02 23:09:20 +11002737# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002738
Damien Millerf58c6722002-05-13 13:15:42 +10002739PRIVSEP_PATH=/var/empty
2740AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002741 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002742 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002743 if test -n "$withval" && test "x$withval" != "xno" && \
2744 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002745 PRIVSEP_PATH=$withval
2746 fi
2747 ]
2748)
2749AC_SUBST(PRIVSEP_PATH)
2750
Damien Millera22ba012000-03-02 23:09:20 +11002751AC_ARG_WITH(xauth,
2752 [ --with-xauth=PATH Specify path to xauth program ],
2753 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002754 if test -n "$withval" && test "x$withval" != "xno" && \
2755 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002756 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002757 fi
2758 ],
2759 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002760 TestPath="$PATH"
2761 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2762 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2763 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2764 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2765 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002766 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002767 xauth_path="/usr/openwin/bin/xauth"
2768 fi
2769 ]
2770)
2771
Damien Miller7d901272003-01-13 16:55:22 +11002772STRIP_OPT=-s
2773AC_ARG_ENABLE(strip,
2774 [ --disable-strip Disable calling strip(1) on install],
2775 [
2776 if test "x$enableval" = "xno" ; then
2777 STRIP_OPT=
2778 fi
2779 ]
2780)
2781AC_SUBST(STRIP_OPT)
2782
Damien Millera19cf472000-11-29 13:28:50 +11002783if test -z "$xauth_path" ; then
2784 XAUTH_PATH="undefined"
2785 AC_SUBST(XAUTH_PATH)
2786else
Damien Millera22ba012000-03-02 23:09:20 +11002787 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002788 XAUTH_PATH=$xauth_path
2789 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002790fi
Damien Millera22ba012000-03-02 23:09:20 +11002791
2792# Check for mail directory (last resort if we cannot get it from headers)
2793if test ! -z "$MAIL" ; then
2794 maildir=`dirname $MAIL`
2795 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2796fi
2797
Darren Tucker623d92f2004-09-12 22:36:15 +10002798if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002799 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2800 disable_ptmx_check=yes
2801fi
Damien Millera22ba012000-03-02 23:09:20 +11002802if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002803 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002804 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002805 [
2806 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2807 have_dev_ptmx=1
2808 ]
2809 )
2810 fi
Damien Millera22ba012000-03-02 23:09:20 +11002811fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002812
Darren Tucker623d92f2004-09-12 22:36:15 +10002813if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002814 AC_CHECK_FILE("/dev/ptc",
2815 [
2816 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2817 have_dev_ptc=1
2818 ]
2819 )
2820else
2821 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2822fi
Damien Miller204ad072000-03-02 23:56:12 +11002823
Damien Millera22ba012000-03-02 23:09:20 +11002824# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002825AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002826 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002827 [
Damien Miller897741e2001-04-16 10:41:46 +10002828 case "$withval" in
2829 man|cat|doc)
2830 MANTYPE=$withval
2831 ;;
2832 *)
2833 AC_MSG_ERROR(invalid man type: $withval)
2834 ;;
2835 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002836 ]
2837)
Ben Lindstrombc709922001-04-18 18:04:21 +00002838if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002839 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2840 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002841 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2842 MANTYPE=doc
2843 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2844 MANTYPE=man
2845 else
2846 MANTYPE=cat
2847 fi
2848fi
Damien Miller670a4b82000-01-22 13:53:11 +11002849AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002850if test "$MANTYPE" = "doc"; then
2851 mansubdir=man;
2852else
2853 mansubdir=$MANTYPE;
2854fi
2855AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002856
Damien Millera22ba012000-03-02 23:09:20 +11002857# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002858MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002859AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002860 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002861 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002862 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002863 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002864 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002865 fi
2866 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002867)
2868
Damien Millera22ba012000-03-02 23:09:20 +11002869# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002870AC_ARG_WITH(shadow,
2871 [ --without-shadow Disable shadow password support],
2872 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002873 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002874 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002875 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002876 fi
2877 ]
2878)
2879
Damien Miller1f335fb2000-06-26 11:31:33 +10002880if test -z "$disable_shadow" ; then
2881 AC_MSG_CHECKING([if the systems has expire shadow information])
2882 AC_TRY_COMPILE(
2883 [
2884#include <sys/types.h>
2885#include <shadow.h>
2886 struct spwd sp;
2887 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2888 [ sp_expire_available=yes ], []
2889 )
2890
2891 if test "x$sp_expire_available" = "xyes" ; then
2892 AC_MSG_RESULT(yes)
2893 AC_DEFINE(HAS_SHADOW_EXPIRE)
2894 else
2895 AC_MSG_RESULT(no)
2896 fi
2897fi
2898
Damien Millera22ba012000-03-02 23:09:20 +11002899# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002900if test ! -z "$IPADDR_IN_DISPLAY" ; then
2901 DISPLAY_HACK_MSG="yes"
2902 AC_DEFINE(IPADDR_IN_DISPLAY)
2903else
Damien Millera8e06ce2003-11-21 23:48:55 +11002904 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002905 AC_ARG_WITH(ipaddr-display,
2906 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2907 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002908 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002909 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002910 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002911 fi
2912 ]
2913 )
2914fi
Damien Miller76112de1999-12-21 11:18:08 +11002915
Darren Tuckere1a790d2003-09-16 11:52:19 +10002916# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002917AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002918 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002919 [ if test "x$enableval" = "xno"; then
2920 AC_MSG_NOTICE([/etc/default/login handling disabled])
2921 etc_default_login=no
2922 else
2923 etc_default_login=yes
2924 fi ],
2925 [ etc_default_login=yes ]
2926)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002927
Darren Tucker2f9573d2005-02-10 22:28:54 +11002928if test "x$etc_default_login" != "xno"; then
2929 AC_CHECK_FILE("/etc/default/login",
2930 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002931 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2932 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002933 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2934 elif test "x$external_path_file" = "x/etc/default/login"; then
2935 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2936 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002937fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002938
Tim Rice43a1c132002-04-17 21:19:14 -07002939dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002940if test $ac_cv_func_login_getcapbool = "yes" && \
2941 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002942 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002943fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002944
Damien Millera22ba012000-03-02 23:09:20 +11002945# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002946SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002947AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002948 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002949 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002950 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002951 AC_MSG_WARN([
2952--with-default-path=PATH has no effect on this system.
2953Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002954 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002955 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002956 AC_MSG_WARN([
2957--with-default-path=PATH will only be used if PATH is not defined in
2958$external_path_file .])
2959 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002960 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002961 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002962 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002963 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002964 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2965 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002966 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002967 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002968 AC_MSG_WARN([
2969If PATH is defined in $external_path_file, ensure the path to scp is included,
2970otherwise scp will not work.])
2971 fi
2972 AC_TRY_RUN(
2973 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002974/* find out what STDPATH is */
2975#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002976#ifdef HAVE_PATHS_H
2977# include <paths.h>
2978#endif
2979#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002980# ifdef _PATH_USERPATH /* Irix */
2981# define _PATH_STDPATH _PATH_USERPATH
2982# else
2983# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2984# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002985#endif
2986#include <sys/types.h>
2987#include <sys/stat.h>
2988#include <fcntl.h>
2989#define DATA "conftest.stdpath"
2990
2991main()
2992{
2993 FILE *fd;
2994 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002995
Tim Rice59ea0a02001-03-10 13:50:45 -08002996 fd = fopen(DATA,"w");
2997 if(fd == NULL)
2998 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002999
Tim Rice59ea0a02001-03-10 13:50:45 -08003000 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3001 exit(1);
3002
3003 exit(0);
3004}
3005 ], [ user_path=`cat conftest.stdpath` ],
3006 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3007 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3008 )
3009# make sure $bindir is in USER_PATH so scp will work
3010 t_bindir=`eval echo ${bindir}`
3011 case $t_bindir in
3012 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3013 esac
3014 case $t_bindir in
3015 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3016 esac
3017 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3018 if test $? -ne 0 ; then
3019 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3020 if test $? -ne 0 ; then
3021 user_path=$user_path:$t_bindir
3022 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3023 fi
3024 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003025 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003026)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003027if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003028 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3029 AC_SUBST(user_path)
3030fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003031
Damien Millera18bbd32002-05-13 10:48:57 +10003032# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003033AC_ARG_WITH(superuser-path,
3034 [ --with-superuser-path= Specify different path for super-user],
3035 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003036 if test -n "$withval" && test "x$withval" != "xno" && \
3037 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003038 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3039 superuser_path=$withval
3040 fi
3041 ]
3042)
3043
3044
Damien Miller61e50f12000-05-08 20:49:37 +10003045AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003046IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003047AC_ARG_WITH(4in6,
3048 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3049 [
3050 if test "x$withval" != "xno" ; then
3051 AC_MSG_RESULT(yes)
3052 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003053 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003054 else
3055 AC_MSG_RESULT(no)
3056 fi
3057 ],[
3058 if test "x$inet6_default_4in6" = "xyes"; then
3059 AC_MSG_RESULT([yes (default)])
3060 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003061 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003062 else
3063 AC_MSG_RESULT([no (default)])
3064 fi
3065 ]
3066)
3067
Damien Miller60396b02001-02-18 17:01:00 +11003068# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003069BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003070AC_ARG_WITH(bsd-auth,
3071 [ --with-bsd-auth Enable BSD auth support],
3072 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003073 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003074 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003075 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003076 fi
3077 ]
3078)
3079
Damien Millera22ba012000-03-02 23:09:20 +11003080# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003081piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003082# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003083if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003084 piddir=`eval echo ${sysconfdir}`
3085 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003086 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003087 esac
3088fi
3089
Tim Rice88f2ab52002-03-17 12:17:34 -08003090AC_ARG_WITH(pid-dir,
3091 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3092 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003093 if test -n "$withval" && test "x$withval" != "xno" && \
3094 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003095 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003096 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003097 AC_MSG_WARN([** no $piddir directory on this system **])
3098 fi
3099 fi
3100 ]
3101)
3102
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003103AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003104AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003105
andre2ff7b5d2000-06-03 14:57:40 +00003106dnl allow user to disable some login recording features
3107AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003108 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003109 [
3110 if test "x$enableval" = "xno" ; then
3111 AC_DEFINE(DISABLE_LASTLOG)
3112 fi
3113 ]
andre2ff7b5d2000-06-03 14:57:40 +00003114)
3115AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003116 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003117 [
3118 if test "x$enableval" = "xno" ; then
3119 AC_DEFINE(DISABLE_UTMP)
3120 fi
3121 ]
andre2ff7b5d2000-06-03 14:57:40 +00003122)
3123AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003124 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003125 [
3126 if test "x$enableval" = "xno" ; then
3127 AC_DEFINE(DISABLE_UTMPX)
3128 fi
3129 ]
andre2ff7b5d2000-06-03 14:57:40 +00003130)
3131AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003132 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003133 [
3134 if test "x$enableval" = "xno" ; then
3135 AC_DEFINE(DISABLE_WTMP)
3136 fi
3137 ]
andre2ff7b5d2000-06-03 14:57:40 +00003138)
3139AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003140 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003141 [
3142 if test "x$enableval" = "xno" ; then
3143 AC_DEFINE(DISABLE_WTMPX)
3144 fi
3145 ]
andre2ff7b5d2000-06-03 14:57:40 +00003146)
3147AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003148 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003149 [
3150 if test "x$enableval" = "xno" ; then
3151 AC_DEFINE(DISABLE_LOGIN)
3152 fi
3153 ]
andre2ff7b5d2000-06-03 14:57:40 +00003154)
3155AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003156 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003157 [
3158 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003159 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003160 fi
3161 ]
andre2ff7b5d2000-06-03 14:57:40 +00003162)
3163AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003164 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003165 [
3166 if test "x$enableval" = "xno" ; then
3167 AC_DEFINE(DISABLE_PUTUTXLINE)
3168 fi
3169 ]
andre2ff7b5d2000-06-03 14:57:40 +00003170)
3171AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003172 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003173 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003174 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003175 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003176 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003177 conf_lastlog_location=$withval
3178 fi
3179 ]
3180)
andre2ff7b5d2000-06-03 14:57:40 +00003181
3182dnl lastlog, [uw]tmpx? detection
3183dnl NOTE: set the paths in the platform section to avoid the
3184dnl need for command-line parameters
3185dnl lastlog and [uw]tmp are subject to a file search if all else fails
3186
3187dnl lastlog detection
3188dnl NOTE: the code itself will detect if lastlog is a directory
3189AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3190AC_TRY_COMPILE([
3191#include <sys/types.h>
3192#include <utmp.h>
3193#ifdef HAVE_LASTLOG_H
3194# include <lastlog.h>
3195#endif
Damien Miller2994e082000-06-04 15:51:47 +10003196#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003197# include <paths.h>
3198#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003199#ifdef HAVE_LOGIN_H
3200# include <login.h>
3201#endif
andre2ff7b5d2000-06-03 14:57:40 +00003202 ],
3203 [ char *lastlog = LASTLOG_FILE; ],
3204 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003205 [
3206 AC_MSG_RESULT(no)
3207 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3208 AC_TRY_COMPILE([
3209#include <sys/types.h>
3210#include <utmp.h>
3211#ifdef HAVE_LASTLOG_H
3212# include <lastlog.h>
3213#endif
3214#ifdef HAVE_PATHS_H
3215# include <paths.h>
3216#endif
3217 ],
3218 [ char *lastlog = _PATH_LASTLOG; ],
3219 [ AC_MSG_RESULT(yes) ],
3220 [
andree441aa32000-06-12 22:34:38 +00003221 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003222 system_lastlog_path=no
3223 ])
3224 ]
andre2ff7b5d2000-06-03 14:57:40 +00003225)
Damien Miller2994e082000-06-04 15:51:47 +10003226
andre2ff7b5d2000-06-03 14:57:40 +00003227if test -z "$conf_lastlog_location"; then
3228 if test x"$system_lastlog_path" = x"no" ; then
3229 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003230 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003231 conf_lastlog_location=$f
3232 fi
3233 done
3234 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003235 AC_MSG_WARN([** Cannot find lastlog **])
3236 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003237 fi
3238 fi
3239fi
3240
3241if test -n "$conf_lastlog_location"; then
3242 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003243fi
andre2ff7b5d2000-06-03 14:57:40 +00003244
3245dnl utmp detection
3246AC_MSG_CHECKING([if your system defines UTMP_FILE])
3247AC_TRY_COMPILE([
3248#include <sys/types.h>
3249#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003250#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003251# include <paths.h>
3252#endif
3253 ],
3254 [ char *utmp = UTMP_FILE; ],
3255 [ AC_MSG_RESULT(yes) ],
3256 [ AC_MSG_RESULT(no)
3257 system_utmp_path=no ]
3258)
3259if test -z "$conf_utmp_location"; then
3260 if test x"$system_utmp_path" = x"no" ; then
3261 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3262 if test -f $f ; then
3263 conf_utmp_location=$f
3264 fi
3265 done
3266 if test -z "$conf_utmp_location"; then
3267 AC_DEFINE(DISABLE_UTMP)
3268 fi
3269 fi
3270fi
3271if test -n "$conf_utmp_location"; then
3272 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003273fi
andre2ff7b5d2000-06-03 14:57:40 +00003274
3275dnl wtmp detection
3276AC_MSG_CHECKING([if your system defines WTMP_FILE])
3277AC_TRY_COMPILE([
3278#include <sys/types.h>
3279#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003280#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003281# include <paths.h>
3282#endif
3283 ],
3284 [ char *wtmp = WTMP_FILE; ],
3285 [ AC_MSG_RESULT(yes) ],
3286 [ AC_MSG_RESULT(no)
3287 system_wtmp_path=no ]
3288)
3289if test -z "$conf_wtmp_location"; then
3290 if test x"$system_wtmp_path" = x"no" ; then
3291 for f in /usr/adm/wtmp /var/log/wtmp; do
3292 if test -f $f ; then
3293 conf_wtmp_location=$f
3294 fi
3295 done
3296 if test -z "$conf_wtmp_location"; then
3297 AC_DEFINE(DISABLE_WTMP)
3298 fi
3299 fi
3300fi
3301if test -n "$conf_wtmp_location"; then
3302 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003303fi
andre2ff7b5d2000-06-03 14:57:40 +00003304
3305
3306dnl utmpx detection - I don't know any system so perverse as to require
3307dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3308dnl there, though.
3309AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3310AC_TRY_COMPILE([
3311#include <sys/types.h>
3312#include <utmp.h>
3313#ifdef HAVE_UTMPX_H
3314#include <utmpx.h>
3315#endif
Damien Miller2994e082000-06-04 15:51:47 +10003316#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003317# include <paths.h>
3318#endif
3319 ],
3320 [ char *utmpx = UTMPX_FILE; ],
3321 [ AC_MSG_RESULT(yes) ],
3322 [ AC_MSG_RESULT(no)
3323 system_utmpx_path=no ]
3324)
3325if test -z "$conf_utmpx_location"; then
3326 if test x"$system_utmpx_path" = x"no" ; then
3327 AC_DEFINE(DISABLE_UTMPX)
3328 fi
3329else
3330 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003331fi
andre2ff7b5d2000-06-03 14:57:40 +00003332
3333dnl wtmpx detection
3334AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3335AC_TRY_COMPILE([
3336#include <sys/types.h>
3337#include <utmp.h>
3338#ifdef HAVE_UTMPX_H
3339#include <utmpx.h>
3340#endif
Damien Miller2994e082000-06-04 15:51:47 +10003341#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003342# include <paths.h>
3343#endif
3344 ],
3345 [ char *wtmpx = WTMPX_FILE; ],
3346 [ AC_MSG_RESULT(yes) ],
3347 [ AC_MSG_RESULT(no)
3348 system_wtmpx_path=no ]
3349)
3350if test -z "$conf_wtmpx_location"; then
3351 if test x"$system_wtmpx_path" = x"no" ; then
3352 AC_DEFINE(DISABLE_WTMPX)
3353 fi
3354else
3355 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003356fi
andre2ff7b5d2000-06-03 14:57:40 +00003357
Damien Miller4018c192000-04-30 09:30:44 +10003358
Damien Miller29ea30d2000-03-17 10:54:15 +11003359if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003360 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3361 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003362fi
3363
Tim Rice4cec93f2002-02-26 08:40:48 -08003364dnl remove pam and dl because they are in $LIBPAM
3365if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003366 LIBS=`echo $LIBS | sed 's/-lpam //'`
3367fi
3368if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3369 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003370fi
3371
Darren Tucker7da23cb2005-08-03 00:20:15 +10003372dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3373dnl Add now.
3374CFLAGS="$CFLAGS $werror_flags"
3375
Damien Millerbac2d8a2000-09-05 16:13:06 +11003376AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003377AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3378 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003379AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003380
Damien Miller7b22d652000-06-18 14:07:04 +10003381# Print summary of options
3382
Damien Miller7b22d652000-06-18 14:07:04 +10003383# Someone please show me a better way :)
3384A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3385B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3386C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3387D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003388E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003389F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003390G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003391H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3392I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3393J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003394
3395echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003396echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003397echo " User binaries: $B"
3398echo " System binaries: $C"
3399echo " Configuration files: $D"
3400echo " Askpass program: $E"
3401echo " Manual pages: $F"
3402echo " PID file: $G"
3403echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003404if test "x$external_path_file" = "x/etc/login.conf" ; then
3405echo " At runtime, sshd will use the path defined in $external_path_file"
3406echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003407else
Damien Millerf58c6722002-05-13 13:15:42 +10003408echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003409 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003410echo " (If PATH is set in $external_path_file it will be used instead. If"
3411echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3412 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003413fi
Damien Millera18bbd32002-05-13 10:48:57 +10003414if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003415echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003416fi
Damien Millerf58c6722002-05-13 13:15:42 +10003417echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003418echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003419echo " KerberosV support: $KRB5_MSG"
3420echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003421echo " S/KEY support: $SKEY_MSG"
3422echo " TCP Wrappers support: $TCPW_MSG"
3423echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003424echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003425echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003426echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3427echo " BSD Auth support: $BSD_AUTH_MSG"
3428echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003429if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003430echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003431fi
3432
Damien Miller7b22d652000-06-18 14:07:04 +10003433echo ""
3434
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003435echo " Host: ${host}"
3436echo " Compiler: ${CC}"
3437echo " Compiler flags: ${CFLAGS}"
3438echo "Preprocessor flags: ${CPPFLAGS}"
3439echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003440echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003441
3442echo ""
3443
Tim Rice6f1f7582004-05-30 21:38:51 -07003444if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003445 echo "SVR4 style packages are supported with \"make package\""
3446 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003447fi
3448
Damien Miller82cf0ce2000-12-20 13:34:48 +11003449if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003450 echo "PAM is enabled. You may need to install a PAM control file "
3451 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003452 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003453 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003454 echo ""
3455fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003456
Damien Miller6c21c512002-01-22 21:57:53 +11003457if test ! -z "$RAND_HELPER_CMDHASH" ; then
3458 echo "WARNING: you are using the builtin random number collection "
3459 echo "service. Please read WARNING.RNG and request that your OS "
3460 echo "vendor includes kernel-based random number collection in "
3461 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003462 echo ""
3463fi
Damien Miller60396b02001-02-18 17:01:00 +11003464
Damien Millerb4097182004-05-23 14:09:40 +10003465if test ! -z "$NO_PEERCHECK" ; then
3466 echo "WARNING: the operating system that you are using does not "
3467 echo "appear to support either the getpeereid() API nor the "
3468 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3469 echo "enforce security checks to prevent unauthorised connections to "
3470 echo "ssh-agent. Their absence increases the risk that a malicious "
3471 echo "user can connect to your agent. "
3472 echo ""
3473fi
3474
Darren Tuckerd9f88912005-02-20 21:01:48 +11003475if test "$AUDIT_MODULE" = "bsm" ; then
3476 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3477 echo "See the Solaris section in README.platform for details."
3478fi