blob: 619a4e76ae71545214c2036a15f7ec922a0f6e77 [file] [log] [blame]
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001# $Id: configure.ac,v 1.287 2005/08/22 22:06:56 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 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000558
559*-*-lynxos)
560 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
561 AC_DEFINE(MISSING_HOWMANY)
562 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
563 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100564esac
565
Damien Millere37bfc12000-06-05 09:37:43 +1000566# Allow user to specify flags
567AC_ARG_WITH(cflags,
568 [ --with-cflags Specify additional flags to pass to compiler],
569 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800570 if test -n "$withval" && test "x$withval" != "xno" && \
571 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000572 CFLAGS="$CFLAGS $withval"
573 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800574 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000575)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000576AC_ARG_WITH(cppflags,
577 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
578 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800579 if test -n "$withval" && test "x$withval" != "xno" && \
580 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000581 CPPFLAGS="$CPPFLAGS $withval"
582 fi
583 ]
584)
Damien Millere37bfc12000-06-05 09:37:43 +1000585AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000586 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000587 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800588 if test -n "$withval" && test "x$withval" != "xno" && \
589 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000590 LDFLAGS="$LDFLAGS $withval"
591 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800592 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000593)
594AC_ARG_WITH(libs,
595 [ --with-libs Specify additional libraries to link with],
596 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800597 if test -n "$withval" && test "x$withval" != "xno" && \
598 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000599 LIBS="$LIBS $withval"
600 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800601 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000602)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000603AC_ARG_WITH(Werror,
604 [ --with-Werror Build main code with -Werror],
605 [
606 if test -n "$withval" && test "x$withval" != "xno"; then
607 werror_flags="-Werror"
608 if "x${withval}" != "xyes"; then
609 werror_flags="$withval"
610 fi
611 fi
612 ]
613)
Damien Millere37bfc12000-06-05 09:37:43 +1000614
Darren Tucker6eb93042003-06-29 21:30:41 +1000615AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000616AC_RUN_IFELSE(
617 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000618#include <stdio.h>
619int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000620 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000621 [ AC_MSG_RESULT(yes) ],
622 [
623 AC_MSG_RESULT(no)
624 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000625 ],
626 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000627)
628
Darren Tucker0c9653f2005-05-28 15:58:14 +1000629dnl Checks for header files.
630AC_CHECK_HEADERS( \
631 bstring.h \
632 crypt.h \
633 dirent.h \
634 endian.h \
635 features.h \
636 floatingpoint.h \
637 getopt.h \
638 glob.h \
639 ia.h \
640 lastlog.h \
641 limits.h \
642 login.h \
643 login_cap.h \
644 maillock.h \
645 ndir.h \
646 netdb.h \
647 netgroup.h \
648 netinet/in_systm.h \
649 pam/pam_appl.h \
650 paths.h \
651 pty.h \
652 readpassphrase.h \
653 rpc/types.h \
654 security/pam_appl.h \
655 shadow.h \
656 stddef.h \
657 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000658 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000659 strings.h \
660 sys/audit.h \
661 sys/bitypes.h \
662 sys/bsdtty.h \
663 sys/cdefs.h \
664 sys/dir.h \
665 sys/mman.h \
666 sys/ndir.h \
667 sys/prctl.h \
668 sys/pstat.h \
669 sys/select.h \
670 sys/stat.h \
671 sys/stream.h \
672 sys/stropts.h \
673 sys/strtio.h \
674 sys/sysmacros.h \
675 sys/time.h \
676 sys/timers.h \
677 sys/un.h \
678 time.h \
679 tmpdir.h \
680 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000681 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000682 usersec.h \
683 util.h \
684 utime.h \
685 utmp.h \
686 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000687 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000688)
Tim Rice4cec93f2002-02-26 08:40:48 -0800689
Darren Tucker48d99d32004-08-29 17:04:50 +1000690# sys/ptms.h requires sys/stream.h to be included first on Solaris
691AC_CHECK_HEADERS(sys/ptms.h, [], [], [
692#ifdef HAVE_SYS_STREAM_H
693# include <sys/stream.h>
694#endif
695])
696
Damien Millera22ba012000-03-02 23:09:20 +1100697# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700698AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
699AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000700
Tim Rice1e1ef642003-09-11 22:19:31 -0700701dnl IRIX and Solaris 2.5.1 have dirname() in libgen
702AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
703 AC_CHECK_LIB(gen, dirname,[
704 AC_CACHE_CHECK([for broken dirname],
705 ac_cv_have_broken_dirname, [
706 save_LIBS="$LIBS"
707 LIBS="$LIBS -lgen"
708 AC_TRY_RUN(
709 [
710#include <libgen.h>
711#include <string.h>
712
713int main(int argc, char **argv) {
714 char *s, buf[32];
715
716 strncpy(buf,"/etc", 32);
717 s = dirname(buf);
718 if (!s || strncmp(s, "/", 32) != 0) {
719 exit(1);
720 } else {
721 exit(0);
722 }
723}
724 ],
725 [ ac_cv_have_broken_dirname="no" ],
726 [ ac_cv_have_broken_dirname="yes" ]
727 )
728 LIBS="$save_LIBS"
729 ])
730 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
731 LIBS="$LIBS -lgen"
732 AC_DEFINE(HAVE_DIRNAME)
733 AC_CHECK_HEADERS(libgen.h)
734 fi
735 ])
736])
737
738AC_CHECK_FUNC(getspnam, ,
739 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
740AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
741
Tim Rice13aae5e2001-10-21 17:53:58 -0700742dnl zlib is required
743AC_ARG_WITH(zlib,
744 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100745 [ if test "x$withval" = "xno" ; then
746 AC_MSG_ERROR([*** zlib is required ***])
747 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700748 if test -d "$withval/lib"; then
749 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700750 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700751 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700752 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700753 fi
754 else
755 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700756 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700757 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700758 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 fi
760 fi
761 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700762 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700763 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700764 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700765 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100766 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700767)
768
Tim Ricefcb62202004-01-23 18:35:16 -0800769AC_CHECK_LIB(z, deflate, ,
770 [
771 saved_CPPFLAGS="$CPPFLAGS"
772 saved_LDFLAGS="$LDFLAGS"
773 save_LIBS="$LIBS"
774 dnl Check default zlib install dir
775 if test -n "${need_dash_r}"; then
776 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
777 else
778 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
779 fi
780 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
781 LIBS="$LIBS -lz"
782 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
783 [
784 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
785 ]
786 )
787 ]
788)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100789AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100790
791AC_ARG_WITH(zlib-version-check,
792 [ --without-zlib-version-check Disable zlib version check],
793 [ if test "x$withval" = "xno" ; then
794 zlib_check_nonfatal=1
795 fi
796 ]
797)
798
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000799AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000800AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000801#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100802#include <zlib.h>
803int main()
804{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000805 int a=0, b=0, c=0, d=0, n, v;
806 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
807 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100808 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000809 v = a*1000000 + b*10000 + c*100 + d;
810 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
811
812 /* 1.1.4 is OK */
813 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100814 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000815
Darren Tucker41097ed2005-07-25 15:24:21 +1000816 /* 1.2.3 and up are OK */
817 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000818 exit(0);
819
Darren Tucker2dcd2392004-01-23 17:13:33 +1100820 exit(2);
821}
Darren Tucker623d92f2004-09-12 22:36:15 +1000822 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000823 AC_MSG_RESULT(no),
824 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100825 if test -z "$zlib_check_nonfatal" ; then
826 AC_MSG_ERROR([*** zlib too old - check config.log ***
827Your reported zlib version has known security problems. It's possible your
828vendor has fixed these problems without changing the version number. If you
829are sure this is the case, you can disable the check by running
830"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000831If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000832See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100833 else
834 AC_MSG_WARN([zlib version may have security problems])
835 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000836 ],
837 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100838)
Damien Miller6f9c3372000-10-25 10:06:04 +1100839
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000840dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100841AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000842 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
843)
Damien Millera8e06ce2003-11-21 23:48:55 +1100844AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700845 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
846 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000847)
Damien Millerab18c411999-11-11 10:40:23 +1100848
Tim Ricee589a292001-11-03 11:09:32 -0800849dnl Checks for libutil functions
850AC_CHECK_HEADERS(libutil.h)
851AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
852AC_CHECK_FUNCS(logout updwtmp logwtmp)
853
Ben Lindstrom8697e082001-02-24 21:41:10 +0000854AC_FUNC_STRFTIME
855
Damien Miller3c027682001-03-14 11:39:45 +1100856# Check for ALTDIRFUNC glob() extension
857AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
858AC_EGREP_CPP(FOUNDIT,
859 [
860 #include <glob.h>
861 #ifdef GLOB_ALTDIRFUNC
862 FOUNDIT
863 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100864 ],
Damien Miller3c027682001-03-14 11:39:45 +1100865 [
866 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
867 AC_MSG_RESULT(yes)
868 ],
869 [
870 AC_MSG_RESULT(no)
871 ]
872)
Damien Millerab18c411999-11-11 10:40:23 +1100873
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000874# Check for g.gl_matchc glob() extension
875AC_MSG_CHECKING(for gl_matchc field in glob_t)
876AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100877 [
878 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000879 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100880 ],
881 [
882 AC_DEFINE(GLOB_HAS_GL_MATCHC)
883 AC_MSG_RESULT(yes)
884 ],
885 [
886 AC_MSG_RESULT(no)
887 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000888)
889
Damien Miller18bb4732001-03-28 14:35:30 +1000890AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000891AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000892 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000893#include <sys/types.h>
894#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700895int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000896 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100897 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000898 [
899 AC_MSG_RESULT(no)
900 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000901 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800902 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000903 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
904 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000905 ]
906)
907
Damien Miller36f49652004-08-15 18:40:59 +1000908AC_MSG_CHECKING([for /proc/pid/fd directory])
909if test -d "/proc/$$/fd" ; then
910 AC_DEFINE(HAVE_PROC_PID)
911 AC_MSG_RESULT(yes)
912else
913 AC_MSG_RESULT(no)
914fi
915
Damien Millerc547bf12001-02-16 10:18:12 +1100916# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100917SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100918AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100919 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100920 [
921 if test "x$withval" != "xno" ; then
922
923 if test "x$withval" != "xyes" ; then
924 CPPFLAGS="$CPPFLAGS -I${withval}/include"
925 LDFLAGS="$LDFLAGS -L${withval}/lib"
926 fi
927
928 AC_DEFINE(SKEY)
929 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100930 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800931
Tim Rice4cec93f2002-02-26 08:40:48 -0800932 AC_MSG_CHECKING([for s/key support])
933 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100934 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800935#include <stdio.h>
936#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700937int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800938 ],
939 [AC_MSG_RESULT(yes)],
940 [
941 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100942 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
943 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000944 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
945 AC_TRY_COMPILE(
946 [#include <stdio.h>
947 #include <skey.h>],
948 [(void)skeychallenge(NULL,"name","",0);],
949 [AC_MSG_RESULT(yes)
950 AC_DEFINE(SKEYCHALLENGE_4ARG)],
951 [AC_MSG_RESULT(no)]
952 )
Damien Millerc547bf12001-02-16 10:18:12 +1100953 fi
954 ]
955)
956
957# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700958TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100959AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100960 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100961 [
962 if test "x$withval" != "xno" ; then
963 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700964 saved_LDFLAGS="$LDFLAGS"
965 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800966 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800967 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700968 if test -d "${withval}/lib"; then
969 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700970 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700971 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700972 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700973 fi
974 else
975 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700976 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700977 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700978 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700979 fi
980 fi
981 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700982 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700983 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700984 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700985 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700986 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800987 LIBWRAP="-lwrap"
988 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100989 AC_MSG_CHECKING(for libwrap)
990 AC_TRY_LINK(
991 [
Damien Miller0ac45002004-04-14 20:14:26 +1000992#include <sys/types.h>
993#include <sys/socket.h>
994#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100995#include <tcpd.h>
996 int deny_severity = 0, allow_severity = 0;
997 ],
998 [hosts_access(0);],
999 [
1000 AC_MSG_RESULT(yes)
1001 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -08001002 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001003 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001004 ],
1005 [
1006 AC_MSG_ERROR([*** libwrap missing])
1007 ]
1008 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001009 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001010 fi
1011 ]
1012)
1013
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001014# Check whether user wants libedit support
1015LIBEDIT_MSG="no"
1016AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001017 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001018 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001019 if test "x$withval" != "xyes"; then
1020 CPPFLAGS="$CPPFLAGS -I$withval/include"
1021 LDFLAGS="$LDFLAGS -L$withval/lib"
1022 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001023 AC_CHECK_LIB(edit, el_init,
1024 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1025 LIBEDIT="-ledit -lcurses"
1026 LIBEDIT_MSG="yes"
1027 AC_SUBST(LIBEDIT)
1028 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001029 [ AC_MSG_ERROR(libedit not found) ],
1030 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001031 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001032 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001033 AC_COMPILE_IFELSE(
1034 [AC_LANG_SOURCE([[
1035#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001036int main(void)
1037{
1038 int i = H_SETSIZE;
1039 el_init("", NULL, NULL, NULL);
1040 exit(0);
1041}
Tim Ricec1819c82005-08-15 17:48:40 -07001042 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001043 [ AC_MSG_RESULT(yes) ],
1044 [ AC_MSG_RESULT(no)
1045 AC_MSG_ERROR(libedit version is not compatible) ]
1046 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001047 fi ]
1048)
1049
Darren Tuckerd9f88912005-02-20 21:01:48 +11001050AUDIT_MODULE=none
1051AC_ARG_WITH(audit,
1052 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1053 [
1054 AC_MSG_CHECKING(for supported audit module)
1055 case "$withval" in
1056 bsm)
1057 AC_MSG_RESULT(bsm)
1058 AUDIT_MODULE=bsm
1059 dnl Checks for headers, libs and functions
1060 AC_CHECK_HEADERS(bsm/audit.h, [],
1061 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1062 AC_CHECK_LIB(bsm, getaudit, [],
1063 [AC_MSG_ERROR(BSM enabled and required library not found)])
1064 AC_CHECK_FUNCS(getaudit, [],
1065 [AC_MSG_ERROR(BSM enabled and required function not found)])
1066 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001067 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001068 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1069 ;;
1070 debug)
1071 AUDIT_MODULE=debug
1072 AC_MSG_RESULT(debug)
1073 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1074 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001075 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001076 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001077 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001078 *)
1079 AC_MSG_ERROR([Unknown audit module $withval])
1080 ;;
1081 esac ]
1082)
1083
Damien Millerfe1f1432003-02-24 15:45:42 +11001084dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001085AC_CHECK_FUNCS( \
1086 arc4random \
1087 b64_ntop \
1088 __b64_ntop \
1089 b64_pton \
1090 __b64_pton \
1091 bcopy \
1092 bindresvport_sa \
1093 clock \
1094 closefrom \
1095 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001096 fchmod \
1097 fchown \
1098 freeaddrinfo \
1099 futimes \
1100 getaddrinfo \
1101 getcwd \
1102 getgrouplist \
1103 getnameinfo \
1104 getopt \
1105 getpeereid \
1106 _getpty \
1107 getrlimit \
1108 getttyent \
1109 glob \
1110 inet_aton \
1111 inet_ntoa \
1112 inet_ntop \
1113 innetgr \
1114 login_getcapbool \
1115 md5_crypt \
1116 memmove \
1117 mkdtemp \
1118 mmap \
1119 ngetaddrinfo \
1120 nsleep \
1121 ogetaddrinfo \
1122 openlog_r \
1123 openpty \
1124 prctl \
1125 pstat \
1126 readpassphrase \
1127 realpath \
1128 recvmsg \
1129 rresvport_af \
1130 sendmsg \
1131 setdtablesize \
1132 setegid \
1133 setenv \
1134 seteuid \
1135 setgroups \
1136 setlogin \
1137 setpcred \
1138 setproctitle \
1139 setregid \
1140 setreuid \
1141 setrlimit \
1142 setsid \
1143 setvbuf \
1144 sigaction \
1145 sigvec \
1146 snprintf \
1147 socketpair \
1148 strdup \
1149 strerror \
1150 strlcat \
1151 strlcpy \
1152 strmode \
1153 strnvis \
1154 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001155 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001156 strtoul \
1157 sysconf \
1158 tcgetpgrp \
1159 truncate \
1160 unsetenv \
1161 updwtmpx \
1162 utimes \
1163 vhangup \
1164 vsnprintf \
1165 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001166)
Tim Rice13aae5e2001-10-21 17:53:58 -07001167
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001168# IRIX has a const char return value for gai_strerror()
1169AC_CHECK_FUNCS(gai_strerror,[
1170 AC_DEFINE(HAVE_GAI_STRERROR)
1171 AC_TRY_COMPILE([
1172#include <sys/types.h>
1173#include <sys/socket.h>
1174#include <netdb.h>
1175
1176const char *gai_strerror(int);],[
1177char *str;
1178
1179str = gai_strerror(0);],[
1180 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1181 [Define if gai_strerror() returns const char *])])])
1182
Damien Millercd6853c2003-01-28 11:33:42 +11001183AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1184
Darren Tuckerf1159b52003-07-07 19:44:01 +10001185dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001186AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001187AC_CHECK_DECL(strsep,
1188 [AC_CHECK_FUNCS(strsep)],
1189 [],
1190 [
1191#ifdef HAVE_STRING_H
1192# include <string.h>
1193#endif
1194 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001195
Darren Tuckerb2427c82003-09-10 15:22:44 +10001196dnl tcsendbreak might be a macro
1197AC_CHECK_DECL(tcsendbreak,
1198 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001199 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001200 [#include <termios.h>]
1201)
1202
Darren Tucker5bb14002004-04-23 18:53:10 +10001203AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1204
Darren Tucker2a6b0292003-12-31 14:59:17 +11001205AC_CHECK_FUNCS(setresuid, [
1206 dnl Some platorms have setresuid that isn't implemented, test for this
1207 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001208 AC_RUN_IFELSE(
1209 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001210#include <stdlib.h>
1211#include <errno.h>
1212int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001213 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001214 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001215 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001216 AC_MSG_RESULT(not implemented)],
1217 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001218 )
1219])
Darren Tuckere937be32003-12-17 18:53:26 +11001220
Darren Tucker2a6b0292003-12-31 14:59:17 +11001221AC_CHECK_FUNCS(setresgid, [
1222 dnl Some platorms have setresgid that isn't implemented, test for this
1223 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001224 AC_RUN_IFELSE(
1225 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001226#include <stdlib.h>
1227#include <errno.h>
1228int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001229 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001230 [AC_MSG_RESULT(yes)],
1231 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001232 AC_MSG_RESULT(not implemented)],
1233 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001234 )
1235])
Darren Tuckere937be32003-12-17 18:53:26 +11001236
Damien Millerad833b32000-08-23 10:46:23 +10001237dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001238AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001239dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001240AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001241AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001242dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001243AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001244AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001245
Damien Millera8e06ce2003-11-21 23:48:55 +11001246AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001247 [AC_DEFINE(HAVE_DAEMON)],
1248 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1249)
1250
Damien Millera8e06ce2003-11-21 23:48:55 +11001251AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001252 [AC_DEFINE(HAVE_GETPAGESIZE)],
1253 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1254)
1255
Damien Millercb170cb2000-07-01 16:52:55 +10001256# Check for broken snprintf
1257if test "x$ac_cv_func_snprintf" = "xyes" ; then
1258 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001259 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001260 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001261#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001262int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001263 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001264 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001265 [
1266 AC_MSG_RESULT(no)
1267 AC_DEFINE(BROKEN_SNPRINTF)
1268 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001269 ],
1270 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001271 )
1272fi
1273
Damien Millerb4097182004-05-23 14:09:40 +10001274# Check for missing getpeereid (or equiv) support
1275NO_PEERCHECK=""
1276if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1277 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1278 AC_TRY_COMPILE(
1279 [#include <sys/types.h>
1280 #include <sys/socket.h>],
1281 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001282 [ AC_MSG_RESULT(yes)
1283 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1284 ],
Damien Millerb4097182004-05-23 14:09:40 +10001285 [AC_MSG_RESULT(no)
1286 NO_PEERCHECK=1]
1287 )
1288fi
1289
Damien Millere8328192003-01-07 15:18:32 +11001290dnl see whether mkstemp() requires XXXXXX
1291if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1292AC_MSG_CHECKING([for (overly) strict mkstemp])
1293AC_TRY_RUN(
1294 [
1295#include <stdlib.h>
1296main() { char template[]="conftest.mkstemp-test";
1297if (mkstemp(template) == -1)
1298 exit(1);
1299unlink(template); exit(0);
1300}
1301 ],
1302 [
1303 AC_MSG_RESULT(no)
1304 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001305 [
Damien Millere8328192003-01-07 15:18:32 +11001306 AC_MSG_RESULT(yes)
1307 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1308 ],
1309 [
1310 AC_MSG_RESULT(yes)
1311 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001312 ]
Damien Millere8328192003-01-07 15:18:32 +11001313)
1314fi
1315
Darren Tucker70a3d552003-08-21 17:58:29 +10001316dnl make sure that openpty does not reacquire controlling terminal
1317if test ! -z "$check_for_openpty_ctty_bug"; then
1318 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1319 AC_TRY_RUN(
1320 [
1321#include <stdio.h>
1322#include <sys/fcntl.h>
1323#include <sys/types.h>
1324#include <sys/wait.h>
1325
1326int
1327main()
1328{
1329 pid_t pid;
1330 int fd, ptyfd, ttyfd, status;
1331
1332 pid = fork();
1333 if (pid < 0) { /* failed */
1334 exit(1);
1335 } else if (pid > 0) { /* parent */
1336 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001337 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001338 exit(WEXITSTATUS(status));
1339 else
1340 exit(2);
1341 } else { /* child */
1342 close(0); close(1); close(2);
1343 setsid();
1344 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1345 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1346 if (fd >= 0)
1347 exit(3); /* Acquired ctty: broken */
1348 else
1349 exit(0); /* Did not acquire ctty: OK */
1350 }
1351}
1352 ],
1353 [
1354 AC_MSG_RESULT(yes)
1355 ],
1356 [
1357 AC_MSG_RESULT(no)
1358 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1359 ]
1360 )
1361fi
1362
Tim Rice8bb561b2005-03-17 16:23:19 -08001363if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1364 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001365 AC_MSG_CHECKING(if getaddrinfo seems to work)
1366 AC_TRY_RUN(
1367 [
1368#include <stdio.h>
1369#include <sys/socket.h>
1370#include <netdb.h>
1371#include <errno.h>
1372#include <netinet/in.h>
1373
1374#define TEST_PORT "2222"
1375
1376int
1377main(void)
1378{
1379 int err, sock;
1380 struct addrinfo *gai_ai, *ai, hints;
1381 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1382
1383 memset(&hints, 0, sizeof(hints));
1384 hints.ai_family = PF_UNSPEC;
1385 hints.ai_socktype = SOCK_STREAM;
1386 hints.ai_flags = AI_PASSIVE;
1387
1388 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1389 if (err != 0) {
1390 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1391 exit(1);
1392 }
1393
1394 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1395 if (ai->ai_family != AF_INET6)
1396 continue;
1397
1398 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1399 sizeof(ntop), strport, sizeof(strport),
1400 NI_NUMERICHOST|NI_NUMERICSERV);
1401
1402 if (err != 0) {
1403 if (err == EAI_SYSTEM)
1404 perror("getnameinfo EAI_SYSTEM");
1405 else
1406 fprintf(stderr, "getnameinfo failed: %s\n",
1407 gai_strerror(err));
1408 exit(2);
1409 }
1410
1411 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1412 if (sock < 0)
1413 perror("socket");
1414 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1415 if (errno == EBADF)
1416 exit(3);
1417 }
1418 }
1419 exit(0);
1420}
1421 ],
1422 [
1423 AC_MSG_RESULT(yes)
1424 ],
1425 [
1426 AC_MSG_RESULT(no)
1427 AC_DEFINE(BROKEN_GETADDRINFO)
1428 ]
1429 )
1430fi
1431
Tim Rice8bb561b2005-03-17 16:23:19 -08001432if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1433 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001434 AC_MSG_CHECKING(if getaddrinfo seems to work)
1435 AC_TRY_RUN(
1436 [
1437#include <stdio.h>
1438#include <sys/socket.h>
1439#include <netdb.h>
1440#include <errno.h>
1441#include <netinet/in.h>
1442
1443#define TEST_PORT "2222"
1444
1445int
1446main(void)
1447{
1448 int err, sock;
1449 struct addrinfo *gai_ai, *ai, hints;
1450 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1451
1452 memset(&hints, 0, sizeof(hints));
1453 hints.ai_family = PF_UNSPEC;
1454 hints.ai_socktype = SOCK_STREAM;
1455 hints.ai_flags = AI_PASSIVE;
1456
1457 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1458 if (err != 0) {
1459 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1460 exit(1);
1461 }
1462
1463 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1464 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1465 continue;
1466
1467 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1468 sizeof(ntop), strport, sizeof(strport),
1469 NI_NUMERICHOST|NI_NUMERICSERV);
1470
1471 if (ai->ai_family == AF_INET && err != 0) {
1472 perror("getnameinfo");
1473 exit(2);
1474 }
1475 }
1476 exit(0);
1477}
1478 ],
1479 [
1480 AC_MSG_RESULT(yes)
1481 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1482[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1483 ],
1484 [
1485 AC_MSG_RESULT(no)
1486 AC_DEFINE(BROKEN_GETADDRINFO)
1487 ]
1488 )
1489fi
1490
Darren Tuckera56f1912004-11-02 20:30:54 +11001491if test "x$check_for_conflicting_getspnam" = "x1"; then
1492 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1493 AC_COMPILE_IFELSE(
1494 [
1495#include <shadow.h>
1496int main(void) {exit(0);}
1497 ],
1498 [
1499 AC_MSG_RESULT(no)
1500 ],
1501 [
1502 AC_MSG_RESULT(yes)
1503 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1504 [Conflicting defs for getspnam])
1505 ]
1506 )
1507fi
1508
Damien Miller606f8802000-09-16 15:39:56 +11001509AC_FUNC_GETPGRP
1510
Damien Millera64b57a2001-01-17 10:44:13 +11001511# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001512PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001513AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001514 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001515 [
Damien Millera64b57a2001-01-17 10:44:13 +11001516 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001517 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1518 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001519 AC_MSG_ERROR([PAM headers not found])
1520 fi
1521
1522 AC_CHECK_LIB(dl, dlopen, , )
1523 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1524 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001525 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001526
Damien Millera64b57a2001-01-17 10:44:13 +11001527 PAM_MSG="yes"
1528
1529 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001530 if test $ac_cv_lib_dl_dlopen = yes; then
1531 LIBPAM="-lpam -ldl"
1532 else
1533 LIBPAM="-lpam"
1534 fi
1535 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001536 fi
1537 ]
1538)
Damien Millera22ba012000-03-02 23:09:20 +11001539
Damien Millera64b57a2001-01-17 10:44:13 +11001540# Check for older PAM
1541if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001542 # Check PAM strerror arguments (old PAM)
1543 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1544 AC_TRY_COMPILE(
1545 [
Damien Miller81171112000-04-23 11:14:01 +10001546#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001547#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001548#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001549#elif defined (HAVE_PAM_PAM_APPL_H)
1550#include <pam/pam_appl.h>
1551#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001552 ],
1553 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001554 [AC_MSG_RESULT(no)],
1555 [
1556 AC_DEFINE(HAVE_OLD_PAM)
1557 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001558 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001559 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001560 )
Damien Millera22ba012000-03-02 23:09:20 +11001561fi
1562
Tim Riceaef73712002-05-11 13:17:42 -07001563# Search for OpenSSL
1564saved_CPPFLAGS="$CPPFLAGS"
1565saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001566AC_ARG_WITH(ssl-dir,
1567 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1568 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001569 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001570 case "$withval" in
1571 # Relative paths
1572 ./*|../*) withval="`pwd`/$withval"
1573 esac
Tim Riceaef73712002-05-11 13:17:42 -07001574 if test -d "$withval/lib"; then
1575 if test -n "${need_dash_r}"; then
1576 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1577 else
1578 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1579 fi
1580 else
1581 if test -n "${need_dash_r}"; then
1582 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1583 else
1584 LDFLAGS="-L${withval} ${LDFLAGS}"
1585 fi
1586 fi
1587 if test -d "$withval/include"; then
1588 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1589 else
1590 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1591 fi
Damien Millera22ba012000-03-02 23:09:20 +11001592 fi
1593 ]
1594)
Tim Rice3d5352e2004-02-12 09:27:21 -08001595LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001596AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001597 [
Tim Riceaef73712002-05-11 13:17:42 -07001598 dnl Check default openssl install dir
1599 if test -n "${need_dash_r}"; then
1600 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001601 else
Tim Riceaef73712002-05-11 13:17:42 -07001602 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001603 fi
Tim Riceaef73712002-05-11 13:17:42 -07001604 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1605 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1606 [
1607 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1608 ]
1609 )
1610 ]
1611)
1612
Tim Riced730b782002-08-13 18:52:10 -07001613# Determine OpenSSL header version
1614AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001615AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001616 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001617#include <stdio.h>
1618#include <string.h>
1619#include <openssl/opensslv.h>
1620#define DATA "conftest.sslincver"
1621int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001622 FILE *fd;
1623 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001624
Damien Millera8e06ce2003-11-21 23:48:55 +11001625 fd = fopen(DATA,"w");
1626 if(fd == NULL)
1627 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001628
1629 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1630 exit(1);
1631
1632 exit(0);
1633}
Darren Tucker623d92f2004-09-12 22:36:15 +10001634 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001635 [
1636 ssl_header_ver=`cat conftest.sslincver`
1637 AC_MSG_RESULT($ssl_header_ver)
1638 ],
1639 [
1640 AC_MSG_RESULT(not found)
1641 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001642 ],
1643 [
1644 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001645 ]
1646)
1647
1648# Determine OpenSSL library version
1649AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001650AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001651 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001652#include <stdio.h>
1653#include <string.h>
1654#include <openssl/opensslv.h>
1655#include <openssl/crypto.h>
1656#define DATA "conftest.ssllibver"
1657int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001658 FILE *fd;
1659 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001660
Damien Millera8e06ce2003-11-21 23:48:55 +11001661 fd = fopen(DATA,"w");
1662 if(fd == NULL)
1663 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001664
1665 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1666 exit(1);
1667
1668 exit(0);
1669}
Darren Tucker623d92f2004-09-12 22:36:15 +10001670 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001671 [
1672 ssl_library_ver=`cat conftest.ssllibver`
1673 AC_MSG_RESULT($ssl_library_ver)
1674 ],
1675 [
1676 AC_MSG_RESULT(not found)
1677 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001678 ],
1679 [
1680 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001681 ]
1682)
Damien Millera22ba012000-03-02 23:09:20 +11001683
Damien Millerec932372002-01-22 22:16:03 +11001684# Sanity check OpenSSL headers
1685AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001686AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001687 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001688#include <string.h>
1689#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001690int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001691 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001692 [
1693 AC_MSG_RESULT(yes)
1694 ],
1695 [
1696 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001697 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1698Check config.log for details.
1699Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001700 ],
1701 [
1702 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001703 ]
1704)
1705
Tim Rice3d5352e2004-02-12 09:27:21 -08001706# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1707# because the system crypt() is more featureful.
1708if test "x$check_for_libcrypt_before" = "x1"; then
1709 AC_CHECK_LIB(crypt, crypt)
1710fi
1711
Damien Millera8e06ce2003-11-21 23:48:55 +11001712# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001713# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001714if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001715 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001716fi
1717
Damien Miller6c21c512002-01-22 21:57:53 +11001718
1719### Configure cryptographic random number support
1720
1721# Check wheter OpenSSL seeds itself
1722AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001723AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001724 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001725#include <string.h>
1726#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001727int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001728 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001729 [
1730 OPENSSL_SEEDS_ITSELF=yes
1731 AC_MSG_RESULT(yes)
1732 ],
1733 [
1734 AC_MSG_RESULT(no)
1735 # Default to use of the rand helper if OpenSSL doesn't
1736 # seed itself
1737 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001738 ],
1739 [
1740 AC_MSG_WARN([cross compiling: assuming yes])
1741 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001742 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001743 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001744 ]
1745)
1746
1747
1748# Do we want to force the use of the rand helper?
1749AC_ARG_WITH(rand-helper,
1750 [ --with-rand-helper Use subprocess to gather strong randomness ],
1751 [
1752 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001753 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001754 # the previous test showed it to be unseeded.
1755 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1756 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1757 OPENSSL_SEEDS_ITSELF=yes
1758 USE_RAND_HELPER=""
1759 fi
1760 else
1761 USE_RAND_HELPER=yes
1762 fi
1763 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001764)
Damien Miller6c21c512002-01-22 21:57:53 +11001765
1766# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001767if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001768 # OpenSSL only
1769 AC_DEFINE(OPENSSL_PRNG_ONLY)
1770 RAND_MSG="OpenSSL internal ONLY"
1771 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001772elif test ! -z "$USE_RAND_HELPER" ; then
1773 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001774 RAND_MSG="ssh-rand-helper"
1775 INSTALL_SSH_RAND_HELPER="yes"
1776fi
1777AC_SUBST(INSTALL_SSH_RAND_HELPER)
1778
1779### Configuration of ssh-rand-helper
1780
1781# PRNGD TCP socket
1782AC_ARG_WITH(prngd-port,
1783 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1784 [
Damien Millere996d722002-01-23 11:20:59 +11001785 case "$withval" in
1786 no)
1787 withval=""
1788 ;;
1789 [[0-9]]*)
1790 ;;
1791 *)
1792 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1793 ;;
1794 esac
1795 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001796 PRNGD_PORT="$withval"
1797 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1798 fi
1799 ]
1800)
1801
1802# PRNGD Unix domain socket
1803AC_ARG_WITH(prngd-socket,
1804 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1805 [
Damien Millere996d722002-01-23 11:20:59 +11001806 case "$withval" in
1807 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001808 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001809 ;;
1810 no)
1811 withval=""
1812 ;;
1813 /*)
1814 ;;
1815 *)
1816 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1817 ;;
1818 esac
1819
1820 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001821 if test ! -z "$PRNGD_PORT" ; then
1822 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1823 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001824 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001825 AC_MSG_WARN(Entropy socket is not readable)
1826 fi
1827 PRNGD_SOCKET="$withval"
1828 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1829 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001830 ],
1831 [
1832 # Check for existing socket only if we don't have a random device already
1833 if test "$USE_RAND_HELPER" = yes ; then
1834 AC_MSG_CHECKING(for PRNGD/EGD socket)
1835 # Insert other locations here
1836 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1837 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1838 PRNGD_SOCKET="$sock"
1839 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1840 break;
1841 fi
1842 done
1843 if test ! -z "$PRNGD_SOCKET" ; then
1844 AC_MSG_RESULT($PRNGD_SOCKET)
1845 else
1846 AC_MSG_RESULT(not found)
1847 fi
1848 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001849 ]
1850)
1851
1852# Change default command timeout for hashing entropy source
1853entropy_timeout=200
1854AC_ARG_WITH(entropy-timeout,
1855 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1856 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001857 if test -n "$withval" && test "x$withval" != "xno" && \
1858 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001859 entropy_timeout=$withval
1860 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001861 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001862)
Damien Miller6c21c512002-01-22 21:57:53 +11001863AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1864
Damien Millerd3f6ad22002-06-25 10:24:47 +10001865SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001866AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001867 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001868 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001869 if test -n "$withval" && test "x$withval" != "xno" && \
1870 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001871 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001872 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001873 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001874)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001875AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1876AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001877
Tim Rice88f2ab52002-03-17 12:17:34 -08001878# We do this little dance with the search path to insure
1879# that programs that we select for use by installed programs
1880# (which may be run by the super-user) come from trusted
1881# locations before they come from the user's private area.
1882# This should help avoid accidentally configuring some
1883# random version of a program in someone's personal bin.
1884
1885OPATH=$PATH
1886PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001887test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001888test -d /sbin && PATH=$PATH:/sbin
1889test -d /usr/sbin && PATH=$PATH:/usr/sbin
1890PATH=$PATH:/etc:$OPATH
1891
Damien Millera8e06ce2003-11-21 23:48:55 +11001892# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001893OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1894OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1895OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1896OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1897OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1898OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1899OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1900OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1901OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1902OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1903OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1904OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1905OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1906OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1907OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1908OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001909# restore PATH
1910PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001911
1912# Where does ssh-rand-helper get its randomness from?
1913INSTALL_SSH_PRNG_CMDS=""
1914if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1915 if test ! -z "$PRNGD_PORT" ; then
1916 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1917 elif test ! -z "$PRNGD_SOCKET" ; then
1918 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1919 else
1920 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1921 RAND_HELPER_CMDHASH=yes
1922 INSTALL_SSH_PRNG_CMDS="yes"
1923 fi
1924fi
1925AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1926
1927
Ben Lindstromb5628642000-10-18 00:02:25 +00001928# Cheap hack to ensure NEWS-OS libraries are arranged right.
1929if test ! -z "$SONY" ; then
1930 LIBS="$LIBS -liberty";
1931fi
1932
Damien Millera22ba012000-03-02 23:09:20 +11001933# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001934AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001935AC_CHECK_SIZEOF(short int, 2)
1936AC_CHECK_SIZEOF(int, 4)
1937AC_CHECK_SIZEOF(long int, 4)
1938AC_CHECK_SIZEOF(long long int, 8)
1939
Damien Millerfa2bb692002-04-23 23:22:25 +10001940# Sanity check long long for some platforms (AIX)
1941if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1942 ac_cv_sizeof_long_long_int=0
1943fi
1944
Damien Millera22ba012000-03-02 23:09:20 +11001945# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001946AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1947 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001948 [ #include <sys/types.h> ],
1949 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001950 [ ac_cv_have_u_int="yes" ],
1951 [ ac_cv_have_u_int="no" ]
1952 )
1953])
1954if test "x$ac_cv_have_u_int" = "xyes" ; then
1955 AC_DEFINE(HAVE_U_INT)
1956 have_u_int=1
1957fi
1958
Damien Miller61e50f12000-05-08 20:49:37 +10001959AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1960 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001961 [ #include <sys/types.h> ],
1962 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001963 [ ac_cv_have_intxx_t="yes" ],
1964 [ ac_cv_have_intxx_t="no" ]
1965 )
1966])
1967if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1968 AC_DEFINE(HAVE_INTXX_T)
1969 have_intxx_t=1
1970fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001971
1972if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001973 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001974then
1975 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1976 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001977 [ #include <stdint.h> ],
1978 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001979 [
1980 AC_DEFINE(HAVE_INTXX_T)
1981 AC_MSG_RESULT(yes)
1982 ],
1983 [ AC_MSG_RESULT(no) ]
1984 )
1985fi
1986
Damien Miller578783e2000-09-23 14:12:24 +11001987AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1988 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001989 [
1990#include <sys/types.h>
1991#ifdef HAVE_STDINT_H
1992# include <stdint.h>
1993#endif
1994#include <sys/socket.h>
1995#ifdef HAVE_SYS_BITYPES_H
1996# include <sys/bitypes.h>
1997#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001998 ],
1999 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002000 [ ac_cv_have_int64_t="yes" ],
2001 [ ac_cv_have_int64_t="no" ]
2002 )
2003])
2004if test "x$ac_cv_have_int64_t" = "xyes" ; then
2005 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08002006fi
2007
Damien Miller61e50f12000-05-08 20:49:37 +10002008AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2009 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002010 [ #include <sys/types.h> ],
2011 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002012 [ ac_cv_have_u_intxx_t="yes" ],
2013 [ ac_cv_have_u_intxx_t="no" ]
2014 )
2015])
2016if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2017 AC_DEFINE(HAVE_U_INTXX_T)
2018 have_u_intxx_t=1
2019fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002020
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002021if test -z "$have_u_intxx_t" ; then
2022 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2023 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002024 [ #include <sys/socket.h> ],
2025 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002026 [
2027 AC_DEFINE(HAVE_U_INTXX_T)
2028 AC_MSG_RESULT(yes)
2029 ],
2030 [ AC_MSG_RESULT(no) ]
2031 )
2032fi
2033
Damien Miller578783e2000-09-23 14:12:24 +11002034AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2035 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002036 [ #include <sys/types.h> ],
2037 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002038 [ ac_cv_have_u_int64_t="yes" ],
2039 [ ac_cv_have_u_int64_t="no" ]
2040 )
2041])
2042if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2043 AC_DEFINE(HAVE_U_INT64_T)
2044 have_u_int64_t=1
2045fi
2046
Tim Rice4cec93f2002-02-26 08:40:48 -08002047if test -z "$have_u_int64_t" ; then
2048 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2049 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002050 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002051 [ u_int64_t a; a = 1],
2052 [
2053 AC_DEFINE(HAVE_U_INT64_T)
2054 AC_MSG_RESULT(yes)
2055 ],
2056 [ AC_MSG_RESULT(no) ]
2057 )
2058fi
2059
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002060if test -z "$have_u_intxx_t" ; then
2061 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2062 AC_TRY_COMPILE(
2063 [
2064#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002065 ],
2066 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002067 [ ac_cv_have_uintxx_t="yes" ],
2068 [ ac_cv_have_uintxx_t="no" ]
2069 )
2070 ])
2071 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2072 AC_DEFINE(HAVE_UINTXX_T)
2073 fi
2074fi
2075
2076if test -z "$have_uintxx_t" ; then
2077 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2078 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002079 [ #include <stdint.h> ],
2080 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002081 [
2082 AC_DEFINE(HAVE_UINTXX_T)
2083 AC_MSG_RESULT(yes)
2084 ],
2085 [ AC_MSG_RESULT(no) ]
2086 )
2087fi
2088
Damien Milleredb82922000-06-20 13:25:52 +10002089if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002090 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002091then
2092 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2093 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002094 [
2095#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002096 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002097 [
Damien Miller70494d12000-04-03 15:57:06 +10002098 int8_t a; int16_t b; int32_t c;
2099 u_int8_t e; u_int16_t f; u_int32_t g;
2100 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002101 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002102 [
2103 AC_DEFINE(HAVE_U_INTXX_T)
2104 AC_DEFINE(HAVE_INTXX_T)
2105 AC_MSG_RESULT(yes)
2106 ],
2107 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002108 )
Damien Millerb29ea912000-01-15 14:12:03 +11002109fi
2110
Damien Miller58be7382001-09-15 21:31:54 +10002111
2112AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2113 AC_TRY_COMPILE(
2114 [
2115#include <sys/types.h>
2116 ],
2117 [ u_char foo; foo = 125; ],
2118 [ ac_cv_have_u_char="yes" ],
2119 [ ac_cv_have_u_char="no" ]
2120 )
2121])
2122if test "x$ac_cv_have_u_char" = "xyes" ; then
2123 AC_DEFINE(HAVE_U_CHAR)
2124fi
2125
Tim Rice13aae5e2001-10-21 17:53:58 -07002126TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002127
Tim Rice200a5c02002-02-26 22:12:34 -08002128AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002129
Damien Miller848b9932005-02-24 12:12:34 +11002130AC_CHECK_TYPES(in_addr_t,,,
2131[#include <sys/types.h>
2132#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002133
Damien Miller61e50f12000-05-08 20:49:37 +10002134AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2135 AC_TRY_COMPILE(
2136 [
2137#include <sys/types.h>
2138 ],
2139 [ size_t foo; foo = 1235; ],
2140 [ ac_cv_have_size_t="yes" ],
2141 [ ac_cv_have_size_t="no" ]
2142 )
2143])
2144if test "x$ac_cv_have_size_t" = "xyes" ; then
2145 AC_DEFINE(HAVE_SIZE_T)
2146fi
Damien Miller95058511999-12-29 10:36:45 +11002147
Damien Miller615f9392000-05-17 22:53:33 +10002148AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2149 AC_TRY_COMPILE(
2150 [
2151#include <sys/types.h>
2152 ],
2153 [ ssize_t foo; foo = 1235; ],
2154 [ ac_cv_have_ssize_t="yes" ],
2155 [ ac_cv_have_ssize_t="no" ]
2156 )
2157])
2158if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2159 AC_DEFINE(HAVE_SSIZE_T)
2160fi
2161
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002162AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2163 AC_TRY_COMPILE(
2164 [
2165#include <time.h>
2166 ],
2167 [ clock_t foo; foo = 1235; ],
2168 [ ac_cv_have_clock_t="yes" ],
2169 [ ac_cv_have_clock_t="no" ]
2170 )
2171])
2172if test "x$ac_cv_have_clock_t" = "xyes" ; then
2173 AC_DEFINE(HAVE_CLOCK_T)
2174fi
2175
Damien Millerb54b40e2000-06-23 08:23:34 +10002176AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2177 AC_TRY_COMPILE(
2178 [
2179#include <sys/types.h>
2180#include <sys/socket.h>
2181 ],
2182 [ sa_family_t foo; foo = 1235; ],
2183 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002184 [ AC_TRY_COMPILE(
2185 [
2186#include <sys/types.h>
2187#include <sys/socket.h>
2188#include <netinet/in.h>
2189 ],
2190 [ sa_family_t foo; foo = 1235; ],
2191 [ ac_cv_have_sa_family_t="yes" ],
2192
Damien Millerb54b40e2000-06-23 08:23:34 +10002193 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002194 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002195 )
2196])
2197if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2198 AC_DEFINE(HAVE_SA_FAMILY_T)
2199fi
2200
Damien Miller0f91b4e2000-06-18 15:43:25 +10002201AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2202 AC_TRY_COMPILE(
2203 [
2204#include <sys/types.h>
2205 ],
2206 [ pid_t foo; foo = 1235; ],
2207 [ ac_cv_have_pid_t="yes" ],
2208 [ ac_cv_have_pid_t="no" ]
2209 )
2210])
2211if test "x$ac_cv_have_pid_t" = "xyes" ; then
2212 AC_DEFINE(HAVE_PID_T)
2213fi
2214
2215AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2216 AC_TRY_COMPILE(
2217 [
2218#include <sys/types.h>
2219 ],
2220 [ mode_t foo; foo = 1235; ],
2221 [ ac_cv_have_mode_t="yes" ],
2222 [ ac_cv_have_mode_t="no" ]
2223 )
2224])
2225if test "x$ac_cv_have_mode_t" = "xyes" ; then
2226 AC_DEFINE(HAVE_MODE_T)
2227fi
2228
Damien Miller61e50f12000-05-08 20:49:37 +10002229
2230AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2231 AC_TRY_COMPILE(
2232 [
Damien Miller81171112000-04-23 11:14:01 +10002233#include <sys/types.h>
2234#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002235 ],
2236 [ struct sockaddr_storage s; ],
2237 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2238 [ ac_cv_have_struct_sockaddr_storage="no" ]
2239 )
2240])
2241if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2242 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2243fi
Damien Miller34132e52000-01-14 15:45:46 +11002244
Damien Miller61e50f12000-05-08 20:49:37 +10002245AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2246 AC_TRY_COMPILE(
2247 [
Damien Miller7b22d652000-06-18 14:07:04 +10002248#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002249#include <netinet/in.h>
2250 ],
2251 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2252 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2253 [ ac_cv_have_struct_sockaddr_in6="no" ]
2254 )
2255])
2256if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2257 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2258fi
Damien Miller34132e52000-01-14 15:45:46 +11002259
Damien Miller61e50f12000-05-08 20:49:37 +10002260AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2261 AC_TRY_COMPILE(
2262 [
Damien Miller7b22d652000-06-18 14:07:04 +10002263#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002264#include <netinet/in.h>
2265 ],
2266 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2267 [ ac_cv_have_struct_in6_addr="yes" ],
2268 [ ac_cv_have_struct_in6_addr="no" ]
2269 )
2270])
2271if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2272 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2273fi
Damien Miller34132e52000-01-14 15:45:46 +11002274
Damien Miller61e50f12000-05-08 20:49:37 +10002275AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2276 AC_TRY_COMPILE(
2277 [
Damien Miller81171112000-04-23 11:14:01 +10002278#include <sys/types.h>
2279#include <sys/socket.h>
2280#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002281 ],
2282 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2283 [ ac_cv_have_struct_addrinfo="yes" ],
2284 [ ac_cv_have_struct_addrinfo="no" ]
2285 )
2286])
2287if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2288 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2289fi
2290
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002291AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2292 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002293 [ #include <sys/time.h> ],
2294 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002295 [ ac_cv_have_struct_timeval="yes" ],
2296 [ ac_cv_have_struct_timeval="no" ]
2297 )
2298])
2299if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2300 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2301 have_struct_timeval=1
2302fi
2303
Tim Rice4e4dc562003-03-18 10:21:40 -08002304AC_CHECK_TYPES(struct timespec)
2305
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002306# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002307if test "x$ac_cv_have_int64_t" = "xno" && \
2308 test "x$ac_cv_sizeof_long_int" != "x8" && \
2309 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002310 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2311 echo "an alternative compiler (I.E., GCC) before continuing."
2312 echo ""
2313 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002314else
2315dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002316 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002317 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002318#include <stdio.h>
2319#include <string.h>
2320#ifdef HAVE_SNPRINTF
2321main()
2322{
2323 char buf[50];
2324 char expected_out[50];
2325 int mazsize = 50 ;
2326#if (SIZEOF_LONG_INT == 8)
2327 long int num = 0x7fffffffffffffff;
2328#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002329 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002330#endif
2331 strcpy(expected_out, "9223372036854775807");
2332 snprintf(buf, mazsize, "%lld", num);
2333 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002334 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002335 exit(0);
2336}
2337#else
2338main() { exit(0); }
2339#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002340 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002341 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002342 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002343fi
2344
Damien Miller78315eb2000-09-29 23:01:36 +11002345dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002346OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2347OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2348OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2349OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2350OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002351OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002352OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2353OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002354OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002355OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2356OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2357OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2358OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002359OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2360OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2361OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2362OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002363
2364AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002365
Damien Miller61e50f12000-05-08 20:49:37 +10002366AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2367 ac_cv_have_ss_family_in_struct_ss, [
2368 AC_TRY_COMPILE(
2369 [
Damien Miller81171112000-04-23 11:14:01 +10002370#include <sys/types.h>
2371#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002372 ],
2373 [ struct sockaddr_storage s; s.ss_family = 1; ],
2374 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2375 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2376 )
2377])
2378if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2379 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2380fi
2381
Damien Miller61e50f12000-05-08 20:49:37 +10002382AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2383 ac_cv_have___ss_family_in_struct_ss, [
2384 AC_TRY_COMPILE(
2385 [
Damien Miller81171112000-04-23 11:14:01 +10002386#include <sys/types.h>
2387#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002388 ],
2389 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2390 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2391 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2392 )
2393])
2394if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2395 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2396fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002397
Damien Millerad833b32000-08-23 10:46:23 +10002398AC_CACHE_CHECK([for pw_class field in struct passwd],
2399 ac_cv_have_pw_class_in_struct_passwd, [
2400 AC_TRY_COMPILE(
2401 [
Damien Millerad833b32000-08-23 10:46:23 +10002402#include <pwd.h>
2403 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002404 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002405 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2406 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2407 )
2408])
2409if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2410 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2411fi
2412
Kevin Steves82456952001-06-22 21:14:18 +00002413AC_CACHE_CHECK([for pw_expire field in struct passwd],
2414 ac_cv_have_pw_expire_in_struct_passwd, [
2415 AC_TRY_COMPILE(
2416 [
2417#include <pwd.h>
2418 ],
2419 [ struct passwd p; p.pw_expire = 0; ],
2420 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2421 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2422 )
2423])
2424if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2425 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2426fi
2427
2428AC_CACHE_CHECK([for pw_change field in struct passwd],
2429 ac_cv_have_pw_change_in_struct_passwd, [
2430 AC_TRY_COMPILE(
2431 [
2432#include <pwd.h>
2433 ],
2434 [ struct passwd p; p.pw_change = 0; ],
2435 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2436 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2437 )
2438])
2439if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2440 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2441fi
Damien Miller61e50f12000-05-08 20:49:37 +10002442
Tim Rice28bbb0c2002-05-27 17:37:32 -07002443dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002444AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2445 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002446 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002447 [
Tim Riceae49fe62002-04-12 10:26:21 -07002448#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002449#include <sys/socket.h>
2450#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002451int main() {
2452#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002453#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002454exit(1);
2455#endif
2456struct msghdr m;
2457m.msg_accrights = 0;
2458exit(0);
2459}
Kevin Steves939c9db2002-03-22 17:23:25 +00002460 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002461 [ ac_cv_have_accrights_in_msghdr="yes" ],
2462 [ ac_cv_have_accrights_in_msghdr="no" ]
2463 )
2464])
2465if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2466 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2467fi
2468
Kevin Stevesa44e0352002-04-07 16:18:03 +00002469AC_CACHE_CHECK([for msg_control field in struct msghdr],
2470 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002471 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002472 [
Tim Riceae49fe62002-04-12 10:26:21 -07002473#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002474#include <sys/socket.h>
2475#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002476int main() {
2477#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002478#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002479exit(1);
2480#endif
2481struct msghdr m;
2482m.msg_control = 0;
2483exit(0);
2484}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002485 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002486 [ ac_cv_have_control_in_msghdr="yes" ],
2487 [ ac_cv_have_control_in_msghdr="no" ]
2488 )
2489])
2490if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2491 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2492fi
2493
Damien Miller61e50f12000-05-08 20:49:37 +10002494AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002495 AC_TRY_LINK([],
2496 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002497 [ ac_cv_libc_defines___progname="yes" ],
2498 [ ac_cv_libc_defines___progname="no" ]
2499 )
2500])
2501if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2502 AC_DEFINE(HAVE___PROGNAME)
2503fi
2504
Kevin Steves4846f4a2002-03-22 18:19:53 +00002505AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2506 AC_TRY_LINK([
2507#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002508],
2509 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002510 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2511 [ ac_cv_cc_implements___FUNCTION__="no" ]
2512 )
2513])
2514if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2515 AC_DEFINE(HAVE___FUNCTION__)
2516fi
2517
2518AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2519 AC_TRY_LINK([
2520#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002521],
2522 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002523 [ ac_cv_cc_implements___func__="yes" ],
2524 [ ac_cv_cc_implements___func__="no" ]
2525 )
2526])
2527if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2528 AC_DEFINE(HAVE___func__)
2529fi
2530
Damien Miller4f8e6692001-07-14 13:22:53 +10002531AC_CACHE_CHECK([whether getopt has optreset support],
2532 ac_cv_have_getopt_optreset, [
2533 AC_TRY_LINK(
2534 [
2535#include <getopt.h>
2536 ],
2537 [ extern int optreset; optreset = 0; ],
2538 [ ac_cv_have_getopt_optreset="yes" ],
2539 [ ac_cv_have_getopt_optreset="no" ]
2540 )
2541])
2542if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2543 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2544fi
Damien Millera22ba012000-03-02 23:09:20 +11002545
Damien Millerecbb26d2000-07-15 14:59:14 +10002546AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002547 AC_TRY_LINK([],
2548 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002549 [ ac_cv_libc_defines_sys_errlist="yes" ],
2550 [ ac_cv_libc_defines_sys_errlist="no" ]
2551 )
2552])
2553if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2554 AC_DEFINE(HAVE_SYS_ERRLIST)
2555fi
2556
2557
Damien Miller11fa2cc2000-08-16 10:35:58 +10002558AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002559 AC_TRY_LINK([],
2560 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002561 [ ac_cv_libc_defines_sys_nerr="yes" ],
2562 [ ac_cv_libc_defines_sys_nerr="no" ]
2563 )
2564])
2565if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2566 AC_DEFINE(HAVE_SYS_NERR)
2567fi
2568
Damien Millera8e06ce2003-11-21 23:48:55 +11002569SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002570# Check whether user wants sectok support
2571AC_ARG_WITH(sectok,
2572 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002573 [
2574 if test "x$withval" != "xno" ; then
2575 if test "x$withval" != "xyes" ; then
2576 CPPFLAGS="$CPPFLAGS -I${withval}"
2577 LDFLAGS="$LDFLAGS -L${withval}"
2578 if test ! -z "$need_dash_r" ; then
2579 LDFLAGS="$LDFLAGS -R${withval}"
2580 fi
2581 if test ! -z "$blibpath" ; then
2582 blibpath="$blibpath:${withval}"
2583 fi
2584 fi
2585 AC_CHECK_HEADERS(sectok.h)
2586 if test "$ac_cv_header_sectok_h" != yes; then
2587 AC_MSG_ERROR(Can't find sectok.h)
2588 fi
2589 AC_CHECK_LIB(sectok, sectok_open)
2590 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2591 AC_MSG_ERROR(Can't find libsectok)
2592 fi
2593 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002594 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002595 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002596 fi
2597 ]
2598)
2599
2600# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002601OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002602AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002603 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2604 [
2605 if test "x$withval" != "xno" ; then
2606 if test "x$withval" != "xyes" ; then
2607 OPENSC_CONFIG=$withval/bin/opensc-config
2608 else
2609 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2610 fi
2611 if test "$OPENSC_CONFIG" != "no"; then
2612 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2613 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2614 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2615 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2616 AC_DEFINE(SMARTCARD)
2617 AC_DEFINE(USE_OPENSC)
2618 SCARD_MSG="yes, using OpenSC"
2619 fi
2620 fi
2621 ]
2622)
Damien Miller85de5802001-09-18 14:01:11 +10002623
Darren Tucker5f88d342003-10-15 16:57:57 +10002624# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002625AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002626 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002627 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002628 # Needed by our getrrsetbyname()
2629 AC_SEARCH_LIBS(res_query, resolv)
2630 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002631 AC_MSG_CHECKING(if res_query will link)
2632 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2633 [AC_MSG_RESULT(no)
2634 saved_LIBS="$LIBS"
2635 LIBS="$LIBS -lresolv"
2636 AC_MSG_CHECKING(for res_query in -lresolv)
2637 AC_LINK_IFELSE([
2638#include <resolv.h>
2639int main()
2640{
2641 res_query (0, 0, 0, 0, 0);
2642 return 0;
2643}
2644 ],
2645 [LIBS="$LIBS -lresolv"
2646 AC_MSG_RESULT(yes)],
2647 [LIBS="$saved_LIBS"
2648 AC_MSG_RESULT(no)])
2649 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002650 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002651 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002652 [#include <sys/types.h>
2653 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002654 AC_CHECK_MEMBER(HEADER.ad,
2655 [AC_DEFINE(HAVE_HEADER_AD)],,
2656 [#include <arpa/nameser.h>])
2657 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002658
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002659# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002660KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002661AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002662 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002663 [ if test "x$withval" != "xno" ; then
2664 if test "x$withval" = "xyes" ; then
2665 KRB5ROOT="/usr/local"
2666 else
2667 KRB5ROOT=${withval}
2668 fi
2669
2670 AC_DEFINE(KRB5)
2671 KRB5_MSG="yes"
2672
2673 AC_MSG_CHECKING(for krb5-config)
2674 if test -x $KRB5ROOT/bin/krb5-config ; then
2675 KRB5CONF=$KRB5ROOT/bin/krb5-config
2676 AC_MSG_RESULT($KRB5CONF)
2677
2678 AC_MSG_CHECKING(for gssapi support)
2679 if $KRB5CONF | grep gssapi >/dev/null ; then
2680 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002681 AC_DEFINE(GSSAPI)
2682 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002683 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002684 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002685 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002686 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002687 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2688 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002689 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002690 AC_MSG_CHECKING(whether we are using Heimdal)
2691 AC_TRY_COMPILE([ #include <krb5.h> ],
2692 [ char *tmp = heimdal_version; ],
2693 [ AC_MSG_RESULT(yes)
2694 AC_DEFINE(HEIMDAL) ],
2695 AC_MSG_RESULT(no)
2696 )
2697 else
2698 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002699 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002700 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002701 AC_MSG_CHECKING(whether we are using Heimdal)
2702 AC_TRY_COMPILE([ #include <krb5.h> ],
2703 [ char *tmp = heimdal_version; ],
2704 [ AC_MSG_RESULT(yes)
2705 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002706 K5LIBS="-lkrb5 -ldes"
2707 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002708 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002709 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002710 ],
2711 [ AC_MSG_RESULT(no)
2712 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2713 ]
2714 )
Damien Miller200d0a72003-06-30 19:21:36 +10002715 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002716
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002717 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2718 [ AC_DEFINE(GSSAPI)
2719 K5LIBS="-lgssapi $K5LIBS" ],
2720 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2721 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002722 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002723 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2724 $K5LIBS)
2725 ],
2726 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002727
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002728 AC_CHECK_HEADER(gssapi.h, ,
2729 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002730 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002731 AC_CHECK_HEADERS(gssapi.h, ,
2732 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002733 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002734 ]
2735 )
2736
2737 oldCPP="$CPPFLAGS"
2738 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2739 AC_CHECK_HEADER(gssapi_krb5.h, ,
2740 [ CPPFLAGS="$oldCPP" ])
2741
Damien Millera8e06ce2003-11-21 23:48:55 +11002742 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002743 if test ! -z "$need_dash_r" ; then
2744 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2745 fi
2746 if test ! -z "$blibpath" ; then
2747 blibpath="$blibpath:${KRB5ROOT}/lib"
2748 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002749 fi
2750
2751 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2752 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2753 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2754
2755 LIBS="$LIBS $K5LIBS"
2756 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2757 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002758)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002759
Damien Millera22ba012000-03-02 23:09:20 +11002760# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002761
Damien Millerf58c6722002-05-13 13:15:42 +10002762PRIVSEP_PATH=/var/empty
2763AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002764 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002765 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002766 if test -n "$withval" && test "x$withval" != "xno" && \
2767 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002768 PRIVSEP_PATH=$withval
2769 fi
2770 ]
2771)
2772AC_SUBST(PRIVSEP_PATH)
2773
Damien Millera22ba012000-03-02 23:09:20 +11002774AC_ARG_WITH(xauth,
2775 [ --with-xauth=PATH Specify path to xauth program ],
2776 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002777 if test -n "$withval" && test "x$withval" != "xno" && \
2778 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002779 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002780 fi
2781 ],
2782 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002783 TestPath="$PATH"
2784 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2785 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2786 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2787 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2788 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002789 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002790 xauth_path="/usr/openwin/bin/xauth"
2791 fi
2792 ]
2793)
2794
Damien Miller7d901272003-01-13 16:55:22 +11002795STRIP_OPT=-s
2796AC_ARG_ENABLE(strip,
2797 [ --disable-strip Disable calling strip(1) on install],
2798 [
2799 if test "x$enableval" = "xno" ; then
2800 STRIP_OPT=
2801 fi
2802 ]
2803)
2804AC_SUBST(STRIP_OPT)
2805
Damien Millera19cf472000-11-29 13:28:50 +11002806if test -z "$xauth_path" ; then
2807 XAUTH_PATH="undefined"
2808 AC_SUBST(XAUTH_PATH)
2809else
Damien Millera22ba012000-03-02 23:09:20 +11002810 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002811 XAUTH_PATH=$xauth_path
2812 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002813fi
Damien Millera22ba012000-03-02 23:09:20 +11002814
2815# Check for mail directory (last resort if we cannot get it from headers)
2816if test ! -z "$MAIL" ; then
2817 maildir=`dirname $MAIL`
2818 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2819fi
2820
Darren Tucker623d92f2004-09-12 22:36:15 +10002821if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002822 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2823 disable_ptmx_check=yes
2824fi
Damien Millera22ba012000-03-02 23:09:20 +11002825if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002826 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002827 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002828 [
2829 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2830 have_dev_ptmx=1
2831 ]
2832 )
2833 fi
Damien Millera22ba012000-03-02 23:09:20 +11002834fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002835
Darren Tucker623d92f2004-09-12 22:36:15 +10002836if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002837 AC_CHECK_FILE("/dev/ptc",
2838 [
2839 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2840 have_dev_ptc=1
2841 ]
2842 )
2843else
2844 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2845fi
Damien Miller204ad072000-03-02 23:56:12 +11002846
Damien Millera22ba012000-03-02 23:09:20 +11002847# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002848AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002849 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002850 [
Damien Miller897741e2001-04-16 10:41:46 +10002851 case "$withval" in
2852 man|cat|doc)
2853 MANTYPE=$withval
2854 ;;
2855 *)
2856 AC_MSG_ERROR(invalid man type: $withval)
2857 ;;
2858 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002859 ]
2860)
Ben Lindstrombc709922001-04-18 18:04:21 +00002861if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002862 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2863 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002864 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2865 MANTYPE=doc
2866 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2867 MANTYPE=man
2868 else
2869 MANTYPE=cat
2870 fi
2871fi
Damien Miller670a4b82000-01-22 13:53:11 +11002872AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002873if test "$MANTYPE" = "doc"; then
2874 mansubdir=man;
2875else
2876 mansubdir=$MANTYPE;
2877fi
2878AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002879
Damien Millera22ba012000-03-02 23:09:20 +11002880# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002881MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002882AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002883 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002884 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002885 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002886 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002887 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002888 fi
2889 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002890)
2891
Damien Millera22ba012000-03-02 23:09:20 +11002892# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002893AC_ARG_WITH(shadow,
2894 [ --without-shadow Disable shadow password support],
2895 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002896 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002897 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002898 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002899 fi
2900 ]
2901)
2902
Damien Miller1f335fb2000-06-26 11:31:33 +10002903if test -z "$disable_shadow" ; then
2904 AC_MSG_CHECKING([if the systems has expire shadow information])
2905 AC_TRY_COMPILE(
2906 [
2907#include <sys/types.h>
2908#include <shadow.h>
2909 struct spwd sp;
2910 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2911 [ sp_expire_available=yes ], []
2912 )
2913
2914 if test "x$sp_expire_available" = "xyes" ; then
2915 AC_MSG_RESULT(yes)
2916 AC_DEFINE(HAS_SHADOW_EXPIRE)
2917 else
2918 AC_MSG_RESULT(no)
2919 fi
2920fi
2921
Damien Millera22ba012000-03-02 23:09:20 +11002922# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002923if test ! -z "$IPADDR_IN_DISPLAY" ; then
2924 DISPLAY_HACK_MSG="yes"
2925 AC_DEFINE(IPADDR_IN_DISPLAY)
2926else
Damien Millera8e06ce2003-11-21 23:48:55 +11002927 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002928 AC_ARG_WITH(ipaddr-display,
2929 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2930 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002931 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002932 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002933 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002934 fi
2935 ]
2936 )
2937fi
Damien Miller76112de1999-12-21 11:18:08 +11002938
Darren Tuckere1a790d2003-09-16 11:52:19 +10002939# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002940AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002941 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002942 [ if test "x$enableval" = "xno"; then
2943 AC_MSG_NOTICE([/etc/default/login handling disabled])
2944 etc_default_login=no
2945 else
2946 etc_default_login=yes
2947 fi ],
2948 [ etc_default_login=yes ]
2949)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002950
Darren Tucker2f9573d2005-02-10 22:28:54 +11002951if test "x$etc_default_login" != "xno"; then
2952 AC_CHECK_FILE("/etc/default/login",
2953 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002954 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2955 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002956 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2957 elif test "x$external_path_file" = "x/etc/default/login"; then
2958 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2959 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002960fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002961
Tim Rice43a1c132002-04-17 21:19:14 -07002962dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002963if test $ac_cv_func_login_getcapbool = "yes" && \
2964 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002965 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002966fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002967
Damien Millera22ba012000-03-02 23:09:20 +11002968# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002969SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002970AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002971 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002972 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002973 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002974 AC_MSG_WARN([
2975--with-default-path=PATH has no effect on this system.
2976Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002977 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002978 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002979 AC_MSG_WARN([
2980--with-default-path=PATH will only be used if PATH is not defined in
2981$external_path_file .])
2982 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002983 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002984 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002985 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002986 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002987 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2988 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002989 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002990 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002991 AC_MSG_WARN([
2992If PATH is defined in $external_path_file, ensure the path to scp is included,
2993otherwise scp will not work.])
2994 fi
2995 AC_TRY_RUN(
2996 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002997/* find out what STDPATH is */
2998#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002999#ifdef HAVE_PATHS_H
3000# include <paths.h>
3001#endif
3002#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003003# ifdef _PATH_USERPATH /* Irix */
3004# define _PATH_STDPATH _PATH_USERPATH
3005# else
3006# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3007# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003008#endif
3009#include <sys/types.h>
3010#include <sys/stat.h>
3011#include <fcntl.h>
3012#define DATA "conftest.stdpath"
3013
3014main()
3015{
3016 FILE *fd;
3017 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003018
Tim Rice59ea0a02001-03-10 13:50:45 -08003019 fd = fopen(DATA,"w");
3020 if(fd == NULL)
3021 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003022
Tim Rice59ea0a02001-03-10 13:50:45 -08003023 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3024 exit(1);
3025
3026 exit(0);
3027}
3028 ], [ user_path=`cat conftest.stdpath` ],
3029 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3030 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3031 )
3032# make sure $bindir is in USER_PATH so scp will work
3033 t_bindir=`eval echo ${bindir}`
3034 case $t_bindir in
3035 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3036 esac
3037 case $t_bindir in
3038 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3039 esac
3040 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3041 if test $? -ne 0 ; then
3042 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3043 if test $? -ne 0 ; then
3044 user_path=$user_path:$t_bindir
3045 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3046 fi
3047 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003048 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003049)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003050if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003051 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3052 AC_SUBST(user_path)
3053fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003054
Damien Millera18bbd32002-05-13 10:48:57 +10003055# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003056AC_ARG_WITH(superuser-path,
3057 [ --with-superuser-path= Specify different path for super-user],
3058 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003059 if test -n "$withval" && test "x$withval" != "xno" && \
3060 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003061 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3062 superuser_path=$withval
3063 fi
3064 ]
3065)
3066
3067
Damien Miller61e50f12000-05-08 20:49:37 +10003068AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003069IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003070AC_ARG_WITH(4in6,
3071 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3072 [
3073 if test "x$withval" != "xno" ; then
3074 AC_MSG_RESULT(yes)
3075 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003076 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003077 else
3078 AC_MSG_RESULT(no)
3079 fi
3080 ],[
3081 if test "x$inet6_default_4in6" = "xyes"; then
3082 AC_MSG_RESULT([yes (default)])
3083 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003084 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003085 else
3086 AC_MSG_RESULT([no (default)])
3087 fi
3088 ]
3089)
3090
Damien Miller60396b02001-02-18 17:01:00 +11003091# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003092BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003093AC_ARG_WITH(bsd-auth,
3094 [ --with-bsd-auth Enable BSD auth support],
3095 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003096 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003097 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003098 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003099 fi
3100 ]
3101)
3102
Damien Millera22ba012000-03-02 23:09:20 +11003103# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003104piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003105# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003106if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003107 piddir=`eval echo ${sysconfdir}`
3108 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003109 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003110 esac
3111fi
3112
Tim Rice88f2ab52002-03-17 12:17:34 -08003113AC_ARG_WITH(pid-dir,
3114 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3115 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003116 if test -n "$withval" && test "x$withval" != "xno" && \
3117 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003118 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003119 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003120 AC_MSG_WARN([** no $piddir directory on this system **])
3121 fi
3122 fi
3123 ]
3124)
3125
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003126AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003127AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003128
andre2ff7b5d2000-06-03 14:57:40 +00003129dnl allow user to disable some login recording features
3130AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003131 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003132 [
3133 if test "x$enableval" = "xno" ; then
3134 AC_DEFINE(DISABLE_LASTLOG)
3135 fi
3136 ]
andre2ff7b5d2000-06-03 14:57:40 +00003137)
3138AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003139 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003140 [
3141 if test "x$enableval" = "xno" ; then
3142 AC_DEFINE(DISABLE_UTMP)
3143 fi
3144 ]
andre2ff7b5d2000-06-03 14:57:40 +00003145)
3146AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003147 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003148 [
3149 if test "x$enableval" = "xno" ; then
3150 AC_DEFINE(DISABLE_UTMPX)
3151 fi
3152 ]
andre2ff7b5d2000-06-03 14:57:40 +00003153)
3154AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003155 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003156 [
3157 if test "x$enableval" = "xno" ; then
3158 AC_DEFINE(DISABLE_WTMP)
3159 fi
3160 ]
andre2ff7b5d2000-06-03 14:57:40 +00003161)
3162AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003163 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003164 [
3165 if test "x$enableval" = "xno" ; then
3166 AC_DEFINE(DISABLE_WTMPX)
3167 fi
3168 ]
andre2ff7b5d2000-06-03 14:57:40 +00003169)
3170AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003171 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003172 [
3173 if test "x$enableval" = "xno" ; then
3174 AC_DEFINE(DISABLE_LOGIN)
3175 fi
3176 ]
andre2ff7b5d2000-06-03 14:57:40 +00003177)
3178AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003179 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003180 [
3181 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003182 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003183 fi
3184 ]
andre2ff7b5d2000-06-03 14:57:40 +00003185)
3186AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003187 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003188 [
3189 if test "x$enableval" = "xno" ; then
3190 AC_DEFINE(DISABLE_PUTUTXLINE)
3191 fi
3192 ]
andre2ff7b5d2000-06-03 14:57:40 +00003193)
3194AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003195 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003196 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003197 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003198 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003199 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003200 conf_lastlog_location=$withval
3201 fi
3202 ]
3203)
andre2ff7b5d2000-06-03 14:57:40 +00003204
3205dnl lastlog, [uw]tmpx? detection
3206dnl NOTE: set the paths in the platform section to avoid the
3207dnl need for command-line parameters
3208dnl lastlog and [uw]tmp are subject to a file search if all else fails
3209
3210dnl lastlog detection
3211dnl NOTE: the code itself will detect if lastlog is a directory
3212AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3213AC_TRY_COMPILE([
3214#include <sys/types.h>
3215#include <utmp.h>
3216#ifdef HAVE_LASTLOG_H
3217# include <lastlog.h>
3218#endif
Damien Miller2994e082000-06-04 15:51:47 +10003219#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003220# include <paths.h>
3221#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003222#ifdef HAVE_LOGIN_H
3223# include <login.h>
3224#endif
andre2ff7b5d2000-06-03 14:57:40 +00003225 ],
3226 [ char *lastlog = LASTLOG_FILE; ],
3227 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003228 [
3229 AC_MSG_RESULT(no)
3230 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3231 AC_TRY_COMPILE([
3232#include <sys/types.h>
3233#include <utmp.h>
3234#ifdef HAVE_LASTLOG_H
3235# include <lastlog.h>
3236#endif
3237#ifdef HAVE_PATHS_H
3238# include <paths.h>
3239#endif
3240 ],
3241 [ char *lastlog = _PATH_LASTLOG; ],
3242 [ AC_MSG_RESULT(yes) ],
3243 [
andree441aa32000-06-12 22:34:38 +00003244 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003245 system_lastlog_path=no
3246 ])
3247 ]
andre2ff7b5d2000-06-03 14:57:40 +00003248)
Damien Miller2994e082000-06-04 15:51:47 +10003249
andre2ff7b5d2000-06-03 14:57:40 +00003250if test -z "$conf_lastlog_location"; then
3251 if test x"$system_lastlog_path" = x"no" ; then
3252 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003253 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003254 conf_lastlog_location=$f
3255 fi
3256 done
3257 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003258 AC_MSG_WARN([** Cannot find lastlog **])
3259 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003260 fi
3261 fi
3262fi
3263
3264if test -n "$conf_lastlog_location"; then
3265 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003266fi
andre2ff7b5d2000-06-03 14:57:40 +00003267
3268dnl utmp detection
3269AC_MSG_CHECKING([if your system defines UTMP_FILE])
3270AC_TRY_COMPILE([
3271#include <sys/types.h>
3272#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003273#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003274# include <paths.h>
3275#endif
3276 ],
3277 [ char *utmp = UTMP_FILE; ],
3278 [ AC_MSG_RESULT(yes) ],
3279 [ AC_MSG_RESULT(no)
3280 system_utmp_path=no ]
3281)
3282if test -z "$conf_utmp_location"; then
3283 if test x"$system_utmp_path" = x"no" ; then
3284 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3285 if test -f $f ; then
3286 conf_utmp_location=$f
3287 fi
3288 done
3289 if test -z "$conf_utmp_location"; then
3290 AC_DEFINE(DISABLE_UTMP)
3291 fi
3292 fi
3293fi
3294if test -n "$conf_utmp_location"; then
3295 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003296fi
andre2ff7b5d2000-06-03 14:57:40 +00003297
3298dnl wtmp detection
3299AC_MSG_CHECKING([if your system defines WTMP_FILE])
3300AC_TRY_COMPILE([
3301#include <sys/types.h>
3302#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003303#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003304# include <paths.h>
3305#endif
3306 ],
3307 [ char *wtmp = WTMP_FILE; ],
3308 [ AC_MSG_RESULT(yes) ],
3309 [ AC_MSG_RESULT(no)
3310 system_wtmp_path=no ]
3311)
3312if test -z "$conf_wtmp_location"; then
3313 if test x"$system_wtmp_path" = x"no" ; then
3314 for f in /usr/adm/wtmp /var/log/wtmp; do
3315 if test -f $f ; then
3316 conf_wtmp_location=$f
3317 fi
3318 done
3319 if test -z "$conf_wtmp_location"; then
3320 AC_DEFINE(DISABLE_WTMP)
3321 fi
3322 fi
3323fi
3324if test -n "$conf_wtmp_location"; then
3325 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003326fi
andre2ff7b5d2000-06-03 14:57:40 +00003327
3328
3329dnl utmpx detection - I don't know any system so perverse as to require
3330dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3331dnl there, though.
3332AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3333AC_TRY_COMPILE([
3334#include <sys/types.h>
3335#include <utmp.h>
3336#ifdef HAVE_UTMPX_H
3337#include <utmpx.h>
3338#endif
Damien Miller2994e082000-06-04 15:51:47 +10003339#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003340# include <paths.h>
3341#endif
3342 ],
3343 [ char *utmpx = UTMPX_FILE; ],
3344 [ AC_MSG_RESULT(yes) ],
3345 [ AC_MSG_RESULT(no)
3346 system_utmpx_path=no ]
3347)
3348if test -z "$conf_utmpx_location"; then
3349 if test x"$system_utmpx_path" = x"no" ; then
3350 AC_DEFINE(DISABLE_UTMPX)
3351 fi
3352else
3353 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003354fi
andre2ff7b5d2000-06-03 14:57:40 +00003355
3356dnl wtmpx detection
3357AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3358AC_TRY_COMPILE([
3359#include <sys/types.h>
3360#include <utmp.h>
3361#ifdef HAVE_UTMPX_H
3362#include <utmpx.h>
3363#endif
Damien Miller2994e082000-06-04 15:51:47 +10003364#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003365# include <paths.h>
3366#endif
3367 ],
3368 [ char *wtmpx = WTMPX_FILE; ],
3369 [ AC_MSG_RESULT(yes) ],
3370 [ AC_MSG_RESULT(no)
3371 system_wtmpx_path=no ]
3372)
3373if test -z "$conf_wtmpx_location"; then
3374 if test x"$system_wtmpx_path" = x"no" ; then
3375 AC_DEFINE(DISABLE_WTMPX)
3376 fi
3377else
3378 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003379fi
andre2ff7b5d2000-06-03 14:57:40 +00003380
Damien Miller4018c192000-04-30 09:30:44 +10003381
Damien Miller29ea30d2000-03-17 10:54:15 +11003382if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003383 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3384 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003385fi
3386
Tim Rice4cec93f2002-02-26 08:40:48 -08003387dnl remove pam and dl because they are in $LIBPAM
3388if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003389 LIBS=`echo $LIBS | sed 's/-lpam //'`
3390fi
3391if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3392 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003393fi
3394
Darren Tucker7da23cb2005-08-03 00:20:15 +10003395dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3396dnl Add now.
3397CFLAGS="$CFLAGS $werror_flags"
3398
Damien Millerbac2d8a2000-09-05 16:13:06 +11003399AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003400AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3401 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003402AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003403
Damien Miller7b22d652000-06-18 14:07:04 +10003404# Print summary of options
3405
Damien Miller7b22d652000-06-18 14:07:04 +10003406# Someone please show me a better way :)
3407A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3408B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3409C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3410D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003411E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003412F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003413G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003414H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3415I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3416J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003417
3418echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003419echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003420echo " User binaries: $B"
3421echo " System binaries: $C"
3422echo " Configuration files: $D"
3423echo " Askpass program: $E"
3424echo " Manual pages: $F"
3425echo " PID file: $G"
3426echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003427if test "x$external_path_file" = "x/etc/login.conf" ; then
3428echo " At runtime, sshd will use the path defined in $external_path_file"
3429echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003430else
Damien Millerf58c6722002-05-13 13:15:42 +10003431echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003432 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003433echo " (If PATH is set in $external_path_file it will be used instead. If"
3434echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3435 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003436fi
Damien Millera18bbd32002-05-13 10:48:57 +10003437if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003438echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003439fi
Damien Millerf58c6722002-05-13 13:15:42 +10003440echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003441echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003442echo " KerberosV support: $KRB5_MSG"
3443echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003444echo " S/KEY support: $SKEY_MSG"
3445echo " TCP Wrappers support: $TCPW_MSG"
3446echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003447echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003448echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003449echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3450echo " BSD Auth support: $BSD_AUTH_MSG"
3451echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003452if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003453echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003454fi
3455
Damien Miller7b22d652000-06-18 14:07:04 +10003456echo ""
3457
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003458echo " Host: ${host}"
3459echo " Compiler: ${CC}"
3460echo " Compiler flags: ${CFLAGS}"
3461echo "Preprocessor flags: ${CPPFLAGS}"
3462echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003463echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003464
3465echo ""
3466
Tim Rice6f1f7582004-05-30 21:38:51 -07003467if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003468 echo "SVR4 style packages are supported with \"make package\""
3469 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003470fi
3471
Damien Miller82cf0ce2000-12-20 13:34:48 +11003472if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003473 echo "PAM is enabled. You may need to install a PAM control file "
3474 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003475 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003476 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003477 echo ""
3478fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003479
Damien Miller6c21c512002-01-22 21:57:53 +11003480if test ! -z "$RAND_HELPER_CMDHASH" ; then
3481 echo "WARNING: you are using the builtin random number collection "
3482 echo "service. Please read WARNING.RNG and request that your OS "
3483 echo "vendor includes kernel-based random number collection in "
3484 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003485 echo ""
3486fi
Damien Miller60396b02001-02-18 17:01:00 +11003487
Damien Millerb4097182004-05-23 14:09:40 +10003488if test ! -z "$NO_PEERCHECK" ; then
3489 echo "WARNING: the operating system that you are using does not "
3490 echo "appear to support either the getpeereid() API nor the "
3491 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3492 echo "enforce security checks to prevent unauthorised connections to "
3493 echo "ssh-agent. Their absence increases the risk that a malicious "
3494 echo "user can connect to your agent. "
3495 echo ""
3496fi
3497
Darren Tuckerd9f88912005-02-20 21:01:48 +11003498if test "$AUDIT_MODULE" = "bsm" ; then
3499 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3500 echo "See the Solaris section in README.platform for details."
3501fi