blob: 62a11fa1ea6bd9a21e710812f8f07d02735089fc [file] [log] [blame]
Darren Tucker431f0222005-06-07 17:53:40 +10001# $Id: configure.ac,v 1.275 2005/06/07 07:53:40 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080078
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100080
81AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
82
Damien Millera8e06ce2003-11-21 23:48:55 +110083if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100084 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Millerde3cb0a2005-05-26 20:48:25 +100085
Darren Tucker67b37032005-06-03 17:58:31 +100086 if test -z "$have_llong_max"; then
87 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
88 unset ac_cv_have_decl_LLONG_MAX
89 saved_CFLAGS="$CFLAGS"
90 CFLAGS="$CFLAGS -std=gnu99"
91 AC_CHECK_DECL(LLONG_MAX,
92 [have_llong_max=1],
93 [CFLAGS="$saved_CFLAGS"],
94 [#include <limits.h>]
95 )
96 fi
Damien Miller166bd442000-03-16 10:48:25 +110097fi
98
Darren Tucker431f0222005-06-07 17:53:40 +100099if test -z "$have_llong_max"; then
100 AC_MSG_CHECKING([for max value of long long])
101 AC_RUN_IFELSE(
102 [AC_LANG_SOURCE([[
103#include <stdio.h>
104/* Why is this so damn hard? */
105#ifdef __GNUC__
106# undef __GNUC__
107#endif
108#define __USE_ISOC99
109#include <limits.h>
110#define DATA "conftest.llminmax"
111int main(void) {
112 FILE *f;
113 long long i, llmin, llmax = 0;
114
115 if((f = fopen(DATA,"w")) == NULL)
116 exit(1);
117
118#if defined(LLONG_MIN) && defined(LLONG_MAX)
119 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
120 llmin = LLONG_MIN;
121 llmax = LLONG_MAX;
122#else
123 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
124 /* This will work on one's complement and two's complement */
125 for (i = 1; i > llmax; i <<= 1, i++)
126 llmax = i;
127 llmin = llmax + 1LL; /* wrap */
128#endif
129
130 /* Sanity check */
131 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
132 || llmax - 1 > llmax) {
133 fprintf(f, "unknown unknown\n");
134 exit(2);
135 }
136
137 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
138 exit(3);
139
140 exit(0);
141}
142 ]])],
143 [
144 llong_min=`$AWK '{print $1}' conftest.llminmax`
145 llong_max=`$AWK '{print $2}' conftest.llminmax`
146 AC_MSG_RESULT($llong_max)
147 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
148 [max value of long long calculated by configure])
149 AC_MSG_CHECKING([for min value of long long])
150 AC_MSG_RESULT($llong_min)
151 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
152 [min value of long long calculated by configure])
153 ],
154 [
155 AC_MSG_RESULT(not found)
156 ],
157 [
158 AC_MSG_WARN([cross compiling: not checking])
159 ]
160 )
161fi
162
Tim Rice88368a32003-12-08 12:35:59 -0800163AC_ARG_WITH(rpath,
164 [ --without-rpath Disable auto-added -R linker paths],
165 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800166 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800167 need_dash_r=""
168 fi
169 if test "x$withval" = "xyes" ; then
170 need_dash_r=1
171 fi
172 ]
173)
174
Damien Millera22ba012000-03-02 23:09:20 +1100175# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100176case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100177*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100178 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000179 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800180 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100181 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000182 saved_LDFLAGS="$LDFLAGS"
183 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
184 if (test -z "$blibflags"); then
185 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
186 AC_TRY_LINK([], [], [blibflags=$tryflags])
187 fi
188 done
189 if (test -z "$blibflags"); then
190 AC_MSG_RESULT(not found)
191 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
192 else
193 AC_MSG_RESULT($blibflags)
194 fi
195 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000196 dnl Check for authenticate. Might be in libs.a on older AIXes
197 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700198 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000199 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700200 LIBS="$LIBS -ls"
201 ])
202 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100203 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100204 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100205 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000206 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100207 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000208 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
209 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000210 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000211 [(void)loginfailed("user","host","tty",0);],
212 [AC_MSG_RESULT(yes)
213 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000214 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000215 )],
216 [],
217 [#include <usersec.h>]
218 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000219 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100220 check_for_aix_broken_getaddrinfo=1
Damien Millerf5fea442002-04-23 22:52:45 +1000221 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000222 AC_DEFINE(SETEUID_BREAKS_SETUID)
223 AC_DEFINE(BROKEN_SETREUID)
224 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000225 dnl AIX handles lastlog as part of its login message
226 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000227 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000228 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100229 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100230*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100231 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800232 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100233 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000234 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100235 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100236 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000237 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000238 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700239 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100240 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000241*-*-dgux*)
242 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100243 AC_DEFINE(SETEUID_BREAKS_SETUID)
244 AC_DEFINE(BROKEN_SETREUID)
245 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000246 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000247*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000248 AC_MSG_CHECKING(if we have working getaddrinfo)
249 AC_TRY_RUN([#include <mach-o/dyld.h>
250main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
251 exit(0);
252 else
253 exit(1);
254}], [AC_MSG_RESULT(working)],
255 [AC_MSG_RESULT(buggy)
256 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700257 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000258 AC_DEFINE(SETEUID_BREAKS_SETUID)
259 AC_DEFINE(BROKEN_SETREUID)
260 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100261 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000262 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000263*-*-hpux*)
264 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000265 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100266 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000267 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000268 AC_DEFINE(LOGIN_NO_ENDOPT)
269 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000270 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000271 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700272 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000273 AC_CHECK_LIB(xnet, t_error, ,
274 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
275
276 # next, we define all of the options specific to major releases
277 case "$host" in
278 *-*-hpux10*)
279 if test -z "$GCC"; then
280 CFLAGS="$CFLAGS -Ae"
281 fi
282 ;;
283 *-*-hpux11*)
284 AC_DEFINE(PAM_SUN_CODEBASE)
285 AC_DEFINE(DISABLE_UTMP)
286 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
287 check_for_hpux_broken_getaddrinfo=1
288 check_for_conflicting_getspnam=1
289 ;;
290 esac
291
292 # lastly, we define options specific to minor releases
293 case "$host" in
294 *-*-hpux10.26)
295 AC_DEFINE(HAVE_SECUREWARE)
296 disable_ptmx_check=yes
297 LIBS="$LIBS -lsecpw"
298 ;;
299 esac
Damien Miller1bead332000-04-30 00:47:29 +1000300 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100301*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100302 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000303 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000304 AC_DEFINE(SETEUID_BREAKS_SETUID)
305 AC_DEFINE(BROKEN_SETREUID)
306 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000307 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000308 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100309 ;;
310*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100311 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000312 AC_DEFINE(WITH_IRIX_ARRAY)
313 AC_DEFINE(WITH_IRIX_PROJECT)
314 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000315 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000316 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000317 AC_DEFINE(SETEUID_BREAKS_SETUID)
318 AC_DEFINE(BROKEN_SETREUID)
319 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000320 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000321 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000322 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100323 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100324*-*-linux*)
325 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100326 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000327 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100328 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000329 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000330 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000331 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000332 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100333 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
334 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100335 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000336 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000337 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000338 AC_DEFINE(BROKEN_CMSG_TYPE)
339 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000340 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100341 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000342mips-sony-bsd|mips-sony-newsos4)
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000343 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000344 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000345 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100346*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000347 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800348 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800349 need_dash_r=1
350 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100351 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100352*-*-freebsd*)
353 check_for_libcrypt_later=1
354 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000355*-*-bsdi*)
356 AC_DEFINE(SETEUID_BREAKS_SETUID)
357 AC_DEFINE(BROKEN_SETREUID)
358 AC_DEFINE(BROKEN_SETREGID)
359 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000360*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000361 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100362 conf_utmp_location=/etc/utmp
363 conf_wtmp_location=/usr/adm/wtmp
364 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000365 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000366 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000367 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100368 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000369 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100370*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800371 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800372 need_dash_r=1
373 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100374 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000375 AC_DEFINE(LOGIN_NEEDS_UTMPX)
376 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000377 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000378 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000379 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000380 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
381 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000382 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000383 # hardwire lastlog location (can't detect it on some versions)
384 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000385 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
386 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
387 if test "$sol2ver" -ge 8; then
388 AC_MSG_RESULT(yes)
389 AC_DEFINE(DISABLE_UTMP)
390 AC_DEFINE(DISABLE_WTMP)
391 else
392 AC_MSG_RESULT(no)
393 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100394 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000395*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000396 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000397 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100398 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000399 conf_utmp_location=/etc/utmp
400 conf_wtmp_location=/var/adm/wtmp
401 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000402 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000403 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000404*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700405 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000406 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000407 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000408 AC_DEFINE(SETEUID_BREAKS_SETUID)
409 AC_DEFINE(BROKEN_SETREUID)
410 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000411 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000412*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700413 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000414 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tuckerca6e7a72005-02-16 16:19:17 +1100415 # -lresolv needs to be at then end of LIBS or DNS lookups break
416 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100417 IPADDR_IN_DISPLAY=yes
418 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000419 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000420 AC_DEFINE(SETEUID_BREAKS_SETUID)
421 AC_DEFINE(BROKEN_SETREUID)
422 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000423 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000424 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700425 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
426 # Attention: always take care to bind libsocket and libnsl before libc,
427 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000428 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800429# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100430*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100431 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700432 AC_DEFINE(SETEUID_BREAKS_SETUID)
433 AC_DEFINE(BROKEN_SETREUID)
434 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700435 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100436 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800437# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100438*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100439 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700440 AC_DEFINE(SETEUID_BREAKS_SETUID)
441 AC_DEFINE(BROKEN_SETREUID)
442 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700443 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice4dbacff2005-06-01 20:09:28 -0700444 case "$host" in
445 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
446 TEST_SHELL=/u95/bin/sh
447 ;;
448 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100449 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100450*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100451 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800452# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100453*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800454 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100455 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800456# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100457*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800458 if test -z "$GCC"; then
459 CFLAGS="$CFLAGS -belf"
460 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100461 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000462 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100463 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000464 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000465 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700466 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700467 AC_DEFINE(SETEUID_BREAKS_SETUID)
468 AC_DEFINE(BROKEN_SETREUID)
469 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700470 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700471 AC_DEFINE(BROKEN_UPDWTMPX)
Darren Tucker33370e02005-02-09 22:17:28 +1100472 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller217f5672001-02-16 12:12:41 +1100473 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700474 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700475 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000476 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000477*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100478 AC_DEFINE(NO_SSH_LASTLOG)
479 AC_DEFINE(SETEUID_BREAKS_SETUID)
480 AC_DEFINE(BROKEN_SETREUID)
481 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000482 AC_DEFINE(USE_PIPES)
483 AC_DEFINE(DISABLE_FD_PASSING)
484 LDFLAGS="$LDFLAGS"
485 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
486 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000487 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000488*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100489 AC_DEFINE(SETEUID_BREAKS_SETUID)
490 AC_DEFINE(BROKEN_SETREUID)
491 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000492 AC_DEFINE(WITH_ABBREV_NO_TTY)
493 AC_DEFINE(USE_PIPES)
494 AC_DEFINE(DISABLE_FD_PASSING)
495 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100496 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000497 MANTYPE=cat
498 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000499*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100500 AC_DEFINE(SETEUID_BREAKS_SETUID)
501 AC_DEFINE(BROKEN_SETREUID)
502 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000503 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700504 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700505 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000506 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
507 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
508 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700509 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000510*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000511 AC_MSG_CHECKING(for Digital Unix SIA)
512 no_osfsia=""
513 AC_ARG_WITH(osfsia,
514 [ --with-osfsia Enable Digital Unix SIA],
515 [
516 if test "x$withval" = "xno" ; then
517 AC_MSG_RESULT(disabled)
518 no_osfsia=1
519 fi
520 ],
521 )
522 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000523 if test -f /etc/sia/matrix.conf; then
524 AC_MSG_RESULT(yes)
525 AC_DEFINE(HAVE_OSF_SIA)
526 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000527 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000528 LIBS="$LIBS -lsecurity -ldb -lm -laud"
529 else
530 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100531 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000532 fi
533 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000534 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700535 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000536 AC_DEFINE(BROKEN_SETREUID)
537 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000538 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000539
540*-*-nto-qnx)
541 AC_DEFINE(USE_PIPES)
542 AC_DEFINE(NO_X11_UNIX_SOCKETS)
543 AC_DEFINE(MISSING_NFDBITS)
544 AC_DEFINE(MISSING_HOWMANY)
545 AC_DEFINE(MISSING_FD_MASK)
546 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000547
548*-*-ultrix*)
549 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
550 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
551 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700552 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
553 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100554esac
555
Damien Millere37bfc12000-06-05 09:37:43 +1000556# Allow user to specify flags
557AC_ARG_WITH(cflags,
558 [ --with-cflags Specify additional flags to pass to compiler],
559 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800560 if test -n "$withval" && test "x$withval" != "xno" && \
561 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000562 CFLAGS="$CFLAGS $withval"
563 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800564 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000565)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000566AC_ARG_WITH(cppflags,
567 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
568 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800569 if test -n "$withval" && test "x$withval" != "xno" && \
570 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000571 CPPFLAGS="$CPPFLAGS $withval"
572 fi
573 ]
574)
Damien Millere37bfc12000-06-05 09:37:43 +1000575AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000576 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000577 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800578 if test -n "$withval" && test "x$withval" != "xno" && \
579 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000580 LDFLAGS="$LDFLAGS $withval"
581 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800582 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000583)
584AC_ARG_WITH(libs,
585 [ --with-libs Specify additional libraries to link with],
586 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800587 if test -n "$withval" && test "x$withval" != "xno" && \
588 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000589 LIBS="$LIBS $withval"
590 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800591 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000592)
593
Darren Tucker6eb93042003-06-29 21:30:41 +1000594AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000595AC_RUN_IFELSE(
596 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000597#include <stdio.h>
598int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000599 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000600 [ AC_MSG_RESULT(yes) ],
601 [
602 AC_MSG_RESULT(no)
603 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000604 ],
605 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000606)
607
Darren Tucker0c9653f2005-05-28 15:58:14 +1000608dnl Checks for header files.
609AC_CHECK_HEADERS( \
610 bstring.h \
611 crypt.h \
612 dirent.h \
613 endian.h \
614 features.h \
615 floatingpoint.h \
616 getopt.h \
617 glob.h \
618 ia.h \
619 lastlog.h \
620 limits.h \
621 login.h \
622 login_cap.h \
623 maillock.h \
624 ndir.h \
625 netdb.h \
626 netgroup.h \
627 netinet/in_systm.h \
628 pam/pam_appl.h \
629 paths.h \
630 pty.h \
631 readpassphrase.h \
632 rpc/types.h \
633 security/pam_appl.h \
634 shadow.h \
635 stddef.h \
636 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000637 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000638 strings.h \
639 sys/audit.h \
640 sys/bitypes.h \
641 sys/bsdtty.h \
642 sys/cdefs.h \
643 sys/dir.h \
644 sys/mman.h \
645 sys/ndir.h \
646 sys/prctl.h \
647 sys/pstat.h \
648 sys/select.h \
649 sys/stat.h \
650 sys/stream.h \
651 sys/stropts.h \
652 sys/strtio.h \
653 sys/sysmacros.h \
654 sys/time.h \
655 sys/timers.h \
656 sys/un.h \
657 time.h \
658 tmpdir.h \
659 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000660 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000661 usersec.h \
662 util.h \
663 utime.h \
664 utmp.h \
665 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000666 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000667)
Tim Rice4cec93f2002-02-26 08:40:48 -0800668
Darren Tucker48d99d32004-08-29 17:04:50 +1000669# sys/ptms.h requires sys/stream.h to be included first on Solaris
670AC_CHECK_HEADERS(sys/ptms.h, [], [], [
671#ifdef HAVE_SYS_STREAM_H
672# include <sys/stream.h>
673#endif
674])
675
Damien Millera22ba012000-03-02 23:09:20 +1100676# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700677AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
678AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000679
Tim Rice1e1ef642003-09-11 22:19:31 -0700680dnl IRIX and Solaris 2.5.1 have dirname() in libgen
681AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
682 AC_CHECK_LIB(gen, dirname,[
683 AC_CACHE_CHECK([for broken dirname],
684 ac_cv_have_broken_dirname, [
685 save_LIBS="$LIBS"
686 LIBS="$LIBS -lgen"
687 AC_TRY_RUN(
688 [
689#include <libgen.h>
690#include <string.h>
691
692int main(int argc, char **argv) {
693 char *s, buf[32];
694
695 strncpy(buf,"/etc", 32);
696 s = dirname(buf);
697 if (!s || strncmp(s, "/", 32) != 0) {
698 exit(1);
699 } else {
700 exit(0);
701 }
702}
703 ],
704 [ ac_cv_have_broken_dirname="no" ],
705 [ ac_cv_have_broken_dirname="yes" ]
706 )
707 LIBS="$save_LIBS"
708 ])
709 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
710 LIBS="$LIBS -lgen"
711 AC_DEFINE(HAVE_DIRNAME)
712 AC_CHECK_HEADERS(libgen.h)
713 fi
714 ])
715])
716
717AC_CHECK_FUNC(getspnam, ,
718 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
719AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
720
Tim Rice13aae5e2001-10-21 17:53:58 -0700721dnl zlib is required
722AC_ARG_WITH(zlib,
723 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100724 [ if test "x$withval" = "xno" ; then
725 AC_MSG_ERROR([*** zlib is required ***])
726 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700727 if test -d "$withval/lib"; then
728 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700729 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700730 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700731 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700732 fi
733 else
734 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700735 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700736 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700737 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700738 fi
739 fi
740 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700741 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700742 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700743 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700744 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100745 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700746)
747
Tim Ricefcb62202004-01-23 18:35:16 -0800748AC_CHECK_LIB(z, deflate, ,
749 [
750 saved_CPPFLAGS="$CPPFLAGS"
751 saved_LDFLAGS="$LDFLAGS"
752 save_LIBS="$LIBS"
753 dnl Check default zlib install dir
754 if test -n "${need_dash_r}"; then
755 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
756 else
757 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
758 fi
759 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
760 LIBS="$LIBS -lz"
761 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
762 [
763 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
764 ]
765 )
766 ]
767)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100768AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100769
770AC_ARG_WITH(zlib-version-check,
771 [ --without-zlib-version-check Disable zlib version check],
772 [ if test "x$withval" = "xno" ; then
773 zlib_check_nonfatal=1
774 fi
775 ]
776)
777
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000778AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000779AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000780#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100781#include <zlib.h>
782int main()
783{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000784 int a=0, b=0, c=0, d=0, n, v;
785 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
786 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100787 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000788 v = a*1000000 + b*10000 + c*100 + d;
789 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
790
791 /* 1.1.4 is OK */
792 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100793 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000794
795 /* 1.2.1.2 and up are OK */
796 if (v >= 1020102)
797 exit(0);
798
Darren Tucker2dcd2392004-01-23 17:13:33 +1100799 exit(2);
800}
Darren Tucker623d92f2004-09-12 22:36:15 +1000801 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000802 AC_MSG_RESULT(no),
803 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100804 if test -z "$zlib_check_nonfatal" ; then
805 AC_MSG_ERROR([*** zlib too old - check config.log ***
806Your reported zlib version has known security problems. It's possible your
807vendor has fixed these problems without changing the version number. If you
808are sure this is the case, you can disable the check by running
809"./configure --without-zlib-version-check".
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000810If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
811See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100812 else
813 AC_MSG_WARN([zlib version may have security problems])
814 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000815 ],
816 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100817)
Damien Miller6f9c3372000-10-25 10:06:04 +1100818
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000819dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100820AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000821 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
822)
Damien Millera8e06ce2003-11-21 23:48:55 +1100823AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700824 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
825 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000826)
Damien Millerab18c411999-11-11 10:40:23 +1100827
Tim Ricee589a292001-11-03 11:09:32 -0800828dnl Checks for libutil functions
829AC_CHECK_HEADERS(libutil.h)
830AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
831AC_CHECK_FUNCS(logout updwtmp logwtmp)
832
Ben Lindstrom8697e082001-02-24 21:41:10 +0000833AC_FUNC_STRFTIME
834
Damien Miller3c027682001-03-14 11:39:45 +1100835# Check for ALTDIRFUNC glob() extension
836AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
837AC_EGREP_CPP(FOUNDIT,
838 [
839 #include <glob.h>
840 #ifdef GLOB_ALTDIRFUNC
841 FOUNDIT
842 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100843 ],
Damien Miller3c027682001-03-14 11:39:45 +1100844 [
845 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
846 AC_MSG_RESULT(yes)
847 ],
848 [
849 AC_MSG_RESULT(no)
850 ]
851)
Damien Millerab18c411999-11-11 10:40:23 +1100852
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000853# Check for g.gl_matchc glob() extension
854AC_MSG_CHECKING(for gl_matchc field in glob_t)
855AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100856 [
857 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000858 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100859 ],
860 [
861 AC_DEFINE(GLOB_HAS_GL_MATCHC)
862 AC_MSG_RESULT(yes)
863 ],
864 [
865 AC_MSG_RESULT(no)
866 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000867)
868
Damien Miller18bb4732001-03-28 14:35:30 +1000869AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000870AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000871 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000872#include <sys/types.h>
873#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700874int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000875 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100876 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000877 [
878 AC_MSG_RESULT(no)
879 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000880 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800881 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000882 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
883 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000884 ]
885)
886
Damien Miller36f49652004-08-15 18:40:59 +1000887AC_MSG_CHECKING([for /proc/pid/fd directory])
888if test -d "/proc/$$/fd" ; then
889 AC_DEFINE(HAVE_PROC_PID)
890 AC_MSG_RESULT(yes)
891else
892 AC_MSG_RESULT(no)
893fi
894
Damien Millerc547bf12001-02-16 10:18:12 +1100895# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100896SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100897AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100898 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100899 [
900 if test "x$withval" != "xno" ; then
901
902 if test "x$withval" != "xyes" ; then
903 CPPFLAGS="$CPPFLAGS -I${withval}/include"
904 LDFLAGS="$LDFLAGS -L${withval}/lib"
905 fi
906
907 AC_DEFINE(SKEY)
908 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100909 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800910
Tim Rice4cec93f2002-02-26 08:40:48 -0800911 AC_MSG_CHECKING([for s/key support])
912 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100913 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800914#include <stdio.h>
915#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700916int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800917 ],
918 [AC_MSG_RESULT(yes)],
919 [
920 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100921 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
922 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000923 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
924 AC_TRY_COMPILE(
925 [#include <stdio.h>
926 #include <skey.h>],
927 [(void)skeychallenge(NULL,"name","",0);],
928 [AC_MSG_RESULT(yes)
929 AC_DEFINE(SKEYCHALLENGE_4ARG)],
930 [AC_MSG_RESULT(no)]
931 )
Damien Millerc547bf12001-02-16 10:18:12 +1100932 fi
933 ]
934)
935
936# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700937TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100938AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100939 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100940 [
941 if test "x$withval" != "xno" ; then
942 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700943 saved_LDFLAGS="$LDFLAGS"
944 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800945 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800946 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700947 if test -d "${withval}/lib"; then
948 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700949 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700950 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700951 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700952 fi
953 else
954 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700955 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700956 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700957 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700958 fi
959 fi
960 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700961 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700962 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700963 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700964 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700965 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800966 LIBWRAP="-lwrap"
967 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100968 AC_MSG_CHECKING(for libwrap)
969 AC_TRY_LINK(
970 [
Damien Miller0ac45002004-04-14 20:14:26 +1000971#include <sys/types.h>
972#include <sys/socket.h>
973#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100974#include <tcpd.h>
975 int deny_severity = 0, allow_severity = 0;
976 ],
977 [hosts_access(0);],
978 [
979 AC_MSG_RESULT(yes)
980 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800981 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700982 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100983 ],
984 [
985 AC_MSG_ERROR([*** libwrap missing])
986 ]
987 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800988 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100989 fi
990 ]
991)
992
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100993# Check whether user wants libedit support
994LIBEDIT_MSG="no"
995AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100996 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100997 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +1100998 if test "x$withval" != "xyes"; then
999 CPPFLAGS="$CPPFLAGS -I$withval/include"
1000 LDFLAGS="$LDFLAGS -L$withval/lib"
1001 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001002 AC_CHECK_LIB(edit, el_init,
1003 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1004 LIBEDIT="-ledit -lcurses"
1005 LIBEDIT_MSG="yes"
1006 AC_SUBST(LIBEDIT)
1007 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001008 [ AC_MSG_ERROR(libedit not found) ],
1009 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001010 )
1011 fi ]
1012)
1013
Darren Tuckerd9f88912005-02-20 21:01:48 +11001014AUDIT_MODULE=none
1015AC_ARG_WITH(audit,
1016 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1017 [
1018 AC_MSG_CHECKING(for supported audit module)
1019 case "$withval" in
1020 bsm)
1021 AC_MSG_RESULT(bsm)
1022 AUDIT_MODULE=bsm
1023 dnl Checks for headers, libs and functions
1024 AC_CHECK_HEADERS(bsm/audit.h, [],
1025 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1026 AC_CHECK_LIB(bsm, getaudit, [],
1027 [AC_MSG_ERROR(BSM enabled and required library not found)])
1028 AC_CHECK_FUNCS(getaudit, [],
1029 [AC_MSG_ERROR(BSM enabled and required function not found)])
1030 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001031 AC_CHECK_FUNCS(getaudit_addr)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001032 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1033 ;;
1034 debug)
1035 AUDIT_MODULE=debug
1036 AC_MSG_RESULT(debug)
1037 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1038 ;;
1039 *)
1040 AC_MSG_ERROR([Unknown audit module $withval])
1041 ;;
1042 esac ]
1043)
1044
Damien Millerfe1f1432003-02-24 15:45:42 +11001045dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001046AC_CHECK_FUNCS( \
1047 arc4random \
1048 b64_ntop \
1049 __b64_ntop \
1050 b64_pton \
1051 __b64_pton \
1052 bcopy \
1053 bindresvport_sa \
1054 clock \
1055 closefrom \
1056 dirfd \
1057 fchdir \
1058 fchmod \
1059 fchown \
1060 freeaddrinfo \
1061 futimes \
1062 getaddrinfo \
1063 getcwd \
1064 getgrouplist \
1065 getnameinfo \
1066 getopt \
1067 getpeereid \
1068 _getpty \
1069 getrlimit \
1070 getttyent \
1071 glob \
1072 inet_aton \
1073 inet_ntoa \
1074 inet_ntop \
1075 innetgr \
1076 login_getcapbool \
1077 md5_crypt \
1078 memmove \
1079 mkdtemp \
1080 mmap \
1081 ngetaddrinfo \
1082 nsleep \
1083 ogetaddrinfo \
1084 openlog_r \
1085 openpty \
1086 prctl \
1087 pstat \
1088 readpassphrase \
1089 realpath \
1090 recvmsg \
1091 rresvport_af \
1092 sendmsg \
1093 setdtablesize \
1094 setegid \
1095 setenv \
1096 seteuid \
1097 setgroups \
1098 setlogin \
1099 setpcred \
1100 setproctitle \
1101 setregid \
1102 setreuid \
1103 setrlimit \
1104 setsid \
1105 setvbuf \
1106 sigaction \
1107 sigvec \
1108 snprintf \
1109 socketpair \
1110 strdup \
1111 strerror \
1112 strlcat \
1113 strlcpy \
1114 strmode \
1115 strnvis \
1116 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001117 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001118 strtoul \
1119 sysconf \
1120 tcgetpgrp \
1121 truncate \
1122 unsetenv \
1123 updwtmpx \
1124 utimes \
1125 vhangup \
1126 vsnprintf \
1127 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001128)
Tim Rice13aae5e2001-10-21 17:53:58 -07001129
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001130# IRIX has a const char return value for gai_strerror()
1131AC_CHECK_FUNCS(gai_strerror,[
1132 AC_DEFINE(HAVE_GAI_STRERROR)
1133 AC_TRY_COMPILE([
1134#include <sys/types.h>
1135#include <sys/socket.h>
1136#include <netdb.h>
1137
1138const char *gai_strerror(int);],[
1139char *str;
1140
1141str = gai_strerror(0);],[
1142 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1143 [Define if gai_strerror() returns const char *])])])
1144
Damien Millercd6853c2003-01-28 11:33:42 +11001145AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1146
Darren Tuckerf1159b52003-07-07 19:44:01 +10001147dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001148AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001149AC_CHECK_DECL(strsep,
1150 [AC_CHECK_FUNCS(strsep)],
1151 [],
1152 [
1153#ifdef HAVE_STRING_H
1154# include <string.h>
1155#endif
1156 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001157
Darren Tuckerb2427c82003-09-10 15:22:44 +10001158dnl tcsendbreak might be a macro
1159AC_CHECK_DECL(tcsendbreak,
1160 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001161 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001162 [#include <termios.h>]
1163)
1164
Darren Tucker5bb14002004-04-23 18:53:10 +10001165AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1166
Darren Tucker2a6b0292003-12-31 14:59:17 +11001167AC_CHECK_FUNCS(setresuid, [
1168 dnl Some platorms have setresuid that isn't implemented, test for this
1169 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001170 AC_RUN_IFELSE(
1171 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001172#include <stdlib.h>
1173#include <errno.h>
1174int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001175 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001176 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +11001177 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001178 AC_MSG_RESULT(not implemented)],
1179 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001180 )
1181])
Darren Tuckere937be32003-12-17 18:53:26 +11001182
Darren Tucker2a6b0292003-12-31 14:59:17 +11001183AC_CHECK_FUNCS(setresgid, [
1184 dnl Some platorms have setresgid that isn't implemented, test for this
1185 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001186 AC_RUN_IFELSE(
1187 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001188#include <stdlib.h>
1189#include <errno.h>
1190int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001191 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001192 [AC_MSG_RESULT(yes)],
1193 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001194 AC_MSG_RESULT(not implemented)],
1195 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001196 )
1197])
Darren Tuckere937be32003-12-17 18:53:26 +11001198
Damien Millerad833b32000-08-23 10:46:23 +10001199dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001200AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001201dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001202AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001203AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001204dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001205AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001206AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001207
Damien Millera8e06ce2003-11-21 23:48:55 +11001208AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +11001209 [AC_DEFINE(HAVE_DAEMON)],
1210 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1211)
1212
Damien Millera8e06ce2003-11-21 23:48:55 +11001213AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +11001214 [AC_DEFINE(HAVE_GETPAGESIZE)],
1215 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1216)
1217
Damien Millercb170cb2000-07-01 16:52:55 +10001218# Check for broken snprintf
1219if test "x$ac_cv_func_snprintf" = "xyes" ; then
1220 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001221 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001222 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001223#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001224int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001225 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001226 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001227 [
1228 AC_MSG_RESULT(no)
1229 AC_DEFINE(BROKEN_SNPRINTF)
1230 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001231 ],
1232 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001233 )
1234fi
1235
Damien Millerb4097182004-05-23 14:09:40 +10001236# Check for missing getpeereid (or equiv) support
1237NO_PEERCHECK=""
1238if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1239 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1240 AC_TRY_COMPILE(
1241 [#include <sys/types.h>
1242 #include <sys/socket.h>],
1243 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001244 [ AC_MSG_RESULT(yes)
1245 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1246 ],
Damien Millerb4097182004-05-23 14:09:40 +10001247 [AC_MSG_RESULT(no)
1248 NO_PEERCHECK=1]
1249 )
1250fi
1251
Damien Millere8328192003-01-07 15:18:32 +11001252dnl see whether mkstemp() requires XXXXXX
1253if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1254AC_MSG_CHECKING([for (overly) strict mkstemp])
1255AC_TRY_RUN(
1256 [
1257#include <stdlib.h>
1258main() { char template[]="conftest.mkstemp-test";
1259if (mkstemp(template) == -1)
1260 exit(1);
1261unlink(template); exit(0);
1262}
1263 ],
1264 [
1265 AC_MSG_RESULT(no)
1266 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001267 [
Damien Millere8328192003-01-07 15:18:32 +11001268 AC_MSG_RESULT(yes)
1269 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1270 ],
1271 [
1272 AC_MSG_RESULT(yes)
1273 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001274 ]
Damien Millere8328192003-01-07 15:18:32 +11001275)
1276fi
1277
Darren Tucker70a3d552003-08-21 17:58:29 +10001278dnl make sure that openpty does not reacquire controlling terminal
1279if test ! -z "$check_for_openpty_ctty_bug"; then
1280 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1281 AC_TRY_RUN(
1282 [
1283#include <stdio.h>
1284#include <sys/fcntl.h>
1285#include <sys/types.h>
1286#include <sys/wait.h>
1287
1288int
1289main()
1290{
1291 pid_t pid;
1292 int fd, ptyfd, ttyfd, status;
1293
1294 pid = fork();
1295 if (pid < 0) { /* failed */
1296 exit(1);
1297 } else if (pid > 0) { /* parent */
1298 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001299 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001300 exit(WEXITSTATUS(status));
1301 else
1302 exit(2);
1303 } else { /* child */
1304 close(0); close(1); close(2);
1305 setsid();
1306 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1307 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1308 if (fd >= 0)
1309 exit(3); /* Acquired ctty: broken */
1310 else
1311 exit(0); /* Did not acquire ctty: OK */
1312 }
1313}
1314 ],
1315 [
1316 AC_MSG_RESULT(yes)
1317 ],
1318 [
1319 AC_MSG_RESULT(no)
1320 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1321 ]
1322 )
1323fi
1324
Tim Rice8bb561b2005-03-17 16:23:19 -08001325if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1326 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001327 AC_MSG_CHECKING(if getaddrinfo seems to work)
1328 AC_TRY_RUN(
1329 [
1330#include <stdio.h>
1331#include <sys/socket.h>
1332#include <netdb.h>
1333#include <errno.h>
1334#include <netinet/in.h>
1335
1336#define TEST_PORT "2222"
1337
1338int
1339main(void)
1340{
1341 int err, sock;
1342 struct addrinfo *gai_ai, *ai, hints;
1343 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1344
1345 memset(&hints, 0, sizeof(hints));
1346 hints.ai_family = PF_UNSPEC;
1347 hints.ai_socktype = SOCK_STREAM;
1348 hints.ai_flags = AI_PASSIVE;
1349
1350 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1351 if (err != 0) {
1352 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1353 exit(1);
1354 }
1355
1356 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1357 if (ai->ai_family != AF_INET6)
1358 continue;
1359
1360 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1361 sizeof(ntop), strport, sizeof(strport),
1362 NI_NUMERICHOST|NI_NUMERICSERV);
1363
1364 if (err != 0) {
1365 if (err == EAI_SYSTEM)
1366 perror("getnameinfo EAI_SYSTEM");
1367 else
1368 fprintf(stderr, "getnameinfo failed: %s\n",
1369 gai_strerror(err));
1370 exit(2);
1371 }
1372
1373 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1374 if (sock < 0)
1375 perror("socket");
1376 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1377 if (errno == EBADF)
1378 exit(3);
1379 }
1380 }
1381 exit(0);
1382}
1383 ],
1384 [
1385 AC_MSG_RESULT(yes)
1386 ],
1387 [
1388 AC_MSG_RESULT(no)
1389 AC_DEFINE(BROKEN_GETADDRINFO)
1390 ]
1391 )
1392fi
1393
Tim Rice8bb561b2005-03-17 16:23:19 -08001394if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1395 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001396 AC_MSG_CHECKING(if getaddrinfo seems to work)
1397 AC_TRY_RUN(
1398 [
1399#include <stdio.h>
1400#include <sys/socket.h>
1401#include <netdb.h>
1402#include <errno.h>
1403#include <netinet/in.h>
1404
1405#define TEST_PORT "2222"
1406
1407int
1408main(void)
1409{
1410 int err, sock;
1411 struct addrinfo *gai_ai, *ai, hints;
1412 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1413
1414 memset(&hints, 0, sizeof(hints));
1415 hints.ai_family = PF_UNSPEC;
1416 hints.ai_socktype = SOCK_STREAM;
1417 hints.ai_flags = AI_PASSIVE;
1418
1419 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1420 if (err != 0) {
1421 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1422 exit(1);
1423 }
1424
1425 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1426 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1427 continue;
1428
1429 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1430 sizeof(ntop), strport, sizeof(strport),
1431 NI_NUMERICHOST|NI_NUMERICSERV);
1432
1433 if (ai->ai_family == AF_INET && err != 0) {
1434 perror("getnameinfo");
1435 exit(2);
1436 }
1437 }
1438 exit(0);
1439}
1440 ],
1441 [
1442 AC_MSG_RESULT(yes)
1443 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1444[Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1445 ],
1446 [
1447 AC_MSG_RESULT(no)
1448 AC_DEFINE(BROKEN_GETADDRINFO)
1449 ]
1450 )
1451fi
1452
Darren Tuckera56f1912004-11-02 20:30:54 +11001453if test "x$check_for_conflicting_getspnam" = "x1"; then
1454 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1455 AC_COMPILE_IFELSE(
1456 [
1457#include <shadow.h>
1458int main(void) {exit(0);}
1459 ],
1460 [
1461 AC_MSG_RESULT(no)
1462 ],
1463 [
1464 AC_MSG_RESULT(yes)
1465 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1466 [Conflicting defs for getspnam])
1467 ]
1468 )
1469fi
1470
Damien Miller606f8802000-09-16 15:39:56 +11001471AC_FUNC_GETPGRP
1472
Damien Millera64b57a2001-01-17 10:44:13 +11001473# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001474PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001475AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001476 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001477 [
Damien Millera64b57a2001-01-17 10:44:13 +11001478 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001479 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1480 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001481 AC_MSG_ERROR([PAM headers not found])
1482 fi
1483
1484 AC_CHECK_LIB(dl, dlopen, , )
1485 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1486 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001487 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001488
Damien Millera64b57a2001-01-17 10:44:13 +11001489 PAM_MSG="yes"
1490
1491 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001492 if test $ac_cv_lib_dl_dlopen = yes; then
1493 LIBPAM="-lpam -ldl"
1494 else
1495 LIBPAM="-lpam"
1496 fi
1497 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001498 fi
1499 ]
1500)
Damien Millera22ba012000-03-02 23:09:20 +11001501
Damien Millera64b57a2001-01-17 10:44:13 +11001502# Check for older PAM
1503if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001504 # Check PAM strerror arguments (old PAM)
1505 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1506 AC_TRY_COMPILE(
1507 [
Damien Miller81171112000-04-23 11:14:01 +10001508#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001509#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001510#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001511#elif defined (HAVE_PAM_PAM_APPL_H)
1512#include <pam/pam_appl.h>
1513#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001514 ],
1515 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001516 [AC_MSG_RESULT(no)],
1517 [
1518 AC_DEFINE(HAVE_OLD_PAM)
1519 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001520 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001521 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001522 )
Damien Millera22ba012000-03-02 23:09:20 +11001523fi
1524
Tim Riceaef73712002-05-11 13:17:42 -07001525# Search for OpenSSL
1526saved_CPPFLAGS="$CPPFLAGS"
1527saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001528AC_ARG_WITH(ssl-dir,
1529 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1530 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001531 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001532 case "$withval" in
1533 # Relative paths
1534 ./*|../*) withval="`pwd`/$withval"
1535 esac
Tim Riceaef73712002-05-11 13:17:42 -07001536 if test -d "$withval/lib"; then
1537 if test -n "${need_dash_r}"; then
1538 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1539 else
1540 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1541 fi
1542 else
1543 if test -n "${need_dash_r}"; then
1544 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1545 else
1546 LDFLAGS="-L${withval} ${LDFLAGS}"
1547 fi
1548 fi
1549 if test -d "$withval/include"; then
1550 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1551 else
1552 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1553 fi
Damien Millera22ba012000-03-02 23:09:20 +11001554 fi
1555 ]
1556)
Tim Rice3d5352e2004-02-12 09:27:21 -08001557LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001558AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001559 [
Tim Riceaef73712002-05-11 13:17:42 -07001560 dnl Check default openssl install dir
1561 if test -n "${need_dash_r}"; then
1562 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001563 else
Tim Riceaef73712002-05-11 13:17:42 -07001564 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001565 fi
Tim Riceaef73712002-05-11 13:17:42 -07001566 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1567 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1568 [
1569 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1570 ]
1571 )
1572 ]
1573)
1574
Tim Riced730b782002-08-13 18:52:10 -07001575# Determine OpenSSL header version
1576AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001577AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001578 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001579#include <stdio.h>
1580#include <string.h>
1581#include <openssl/opensslv.h>
1582#define DATA "conftest.sslincver"
1583int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001584 FILE *fd;
1585 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001586
Damien Millera8e06ce2003-11-21 23:48:55 +11001587 fd = fopen(DATA,"w");
1588 if(fd == NULL)
1589 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001590
1591 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1592 exit(1);
1593
1594 exit(0);
1595}
Darren Tucker623d92f2004-09-12 22:36:15 +10001596 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001597 [
1598 ssl_header_ver=`cat conftest.sslincver`
1599 AC_MSG_RESULT($ssl_header_ver)
1600 ],
1601 [
1602 AC_MSG_RESULT(not found)
1603 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001604 ],
1605 [
1606 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001607 ]
1608)
1609
1610# Determine OpenSSL library version
1611AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001612AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001613 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001614#include <stdio.h>
1615#include <string.h>
1616#include <openssl/opensslv.h>
1617#include <openssl/crypto.h>
1618#define DATA "conftest.ssllibver"
1619int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001620 FILE *fd;
1621 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001622
Damien Millera8e06ce2003-11-21 23:48:55 +11001623 fd = fopen(DATA,"w");
1624 if(fd == NULL)
1625 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001626
1627 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1628 exit(1);
1629
1630 exit(0);
1631}
Darren Tucker623d92f2004-09-12 22:36:15 +10001632 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001633 [
1634 ssl_library_ver=`cat conftest.ssllibver`
1635 AC_MSG_RESULT($ssl_library_ver)
1636 ],
1637 [
1638 AC_MSG_RESULT(not found)
1639 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001640 ],
1641 [
1642 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001643 ]
1644)
Damien Millera22ba012000-03-02 23:09:20 +11001645
Damien Millerec932372002-01-22 22:16:03 +11001646# Sanity check OpenSSL headers
1647AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001648AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001649 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001650#include <string.h>
1651#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001652int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001653 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001654 [
1655 AC_MSG_RESULT(yes)
1656 ],
1657 [
1658 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001659 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1660Check config.log for details.
1661Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001662 ],
1663 [
1664 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001665 ]
1666)
1667
Tim Rice3d5352e2004-02-12 09:27:21 -08001668# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1669# because the system crypt() is more featureful.
1670if test "x$check_for_libcrypt_before" = "x1"; then
1671 AC_CHECK_LIB(crypt, crypt)
1672fi
1673
Damien Millera8e06ce2003-11-21 23:48:55 +11001674# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001675# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001676if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001677 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001678fi
1679
Damien Miller6c21c512002-01-22 21:57:53 +11001680
1681### Configure cryptographic random number support
1682
1683# Check wheter OpenSSL seeds itself
1684AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001685AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001686 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001687#include <string.h>
1688#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001689int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001690 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001691 [
1692 OPENSSL_SEEDS_ITSELF=yes
1693 AC_MSG_RESULT(yes)
1694 ],
1695 [
1696 AC_MSG_RESULT(no)
1697 # Default to use of the rand helper if OpenSSL doesn't
1698 # seed itself
1699 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001700 ],
1701 [
1702 AC_MSG_WARN([cross compiling: assuming yes])
1703 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001704 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001705 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001706 ]
1707)
1708
1709
1710# Do we want to force the use of the rand helper?
1711AC_ARG_WITH(rand-helper,
1712 [ --with-rand-helper Use subprocess to gather strong randomness ],
1713 [
1714 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001715 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001716 # the previous test showed it to be unseeded.
1717 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1718 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1719 OPENSSL_SEEDS_ITSELF=yes
1720 USE_RAND_HELPER=""
1721 fi
1722 else
1723 USE_RAND_HELPER=yes
1724 fi
1725 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001726)
Damien Miller6c21c512002-01-22 21:57:53 +11001727
1728# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001729if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001730 # OpenSSL only
1731 AC_DEFINE(OPENSSL_PRNG_ONLY)
1732 RAND_MSG="OpenSSL internal ONLY"
1733 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001734elif test ! -z "$USE_RAND_HELPER" ; then
1735 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001736 RAND_MSG="ssh-rand-helper"
1737 INSTALL_SSH_RAND_HELPER="yes"
1738fi
1739AC_SUBST(INSTALL_SSH_RAND_HELPER)
1740
1741### Configuration of ssh-rand-helper
1742
1743# PRNGD TCP socket
1744AC_ARG_WITH(prngd-port,
1745 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1746 [
Damien Millere996d722002-01-23 11:20:59 +11001747 case "$withval" in
1748 no)
1749 withval=""
1750 ;;
1751 [[0-9]]*)
1752 ;;
1753 *)
1754 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1755 ;;
1756 esac
1757 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001758 PRNGD_PORT="$withval"
1759 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1760 fi
1761 ]
1762)
1763
1764# PRNGD Unix domain socket
1765AC_ARG_WITH(prngd-socket,
1766 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1767 [
Damien Millere996d722002-01-23 11:20:59 +11001768 case "$withval" in
1769 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001770 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001771 ;;
1772 no)
1773 withval=""
1774 ;;
1775 /*)
1776 ;;
1777 *)
1778 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1779 ;;
1780 esac
1781
1782 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001783 if test ! -z "$PRNGD_PORT" ; then
1784 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1785 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001786 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001787 AC_MSG_WARN(Entropy socket is not readable)
1788 fi
1789 PRNGD_SOCKET="$withval"
1790 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1791 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001792 ],
1793 [
1794 # Check for existing socket only if we don't have a random device already
1795 if test "$USE_RAND_HELPER" = yes ; then
1796 AC_MSG_CHECKING(for PRNGD/EGD socket)
1797 # Insert other locations here
1798 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1799 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1800 PRNGD_SOCKET="$sock"
1801 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1802 break;
1803 fi
1804 done
1805 if test ! -z "$PRNGD_SOCKET" ; then
1806 AC_MSG_RESULT($PRNGD_SOCKET)
1807 else
1808 AC_MSG_RESULT(not found)
1809 fi
1810 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001811 ]
1812)
1813
1814# Change default command timeout for hashing entropy source
1815entropy_timeout=200
1816AC_ARG_WITH(entropy-timeout,
1817 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1818 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001819 if test -n "$withval" && test "x$withval" != "xno" && \
1820 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001821 entropy_timeout=$withval
1822 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001823 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001824)
Damien Miller6c21c512002-01-22 21:57:53 +11001825AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1826
Damien Millerd3f6ad22002-06-25 10:24:47 +10001827SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001828AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001829 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001830 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001831 if test -n "$withval" && test "x$withval" != "xno" && \
1832 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001833 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001834 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001835 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001836)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001837AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1838AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001839
Tim Rice88f2ab52002-03-17 12:17:34 -08001840# We do this little dance with the search path to insure
1841# that programs that we select for use by installed programs
1842# (which may be run by the super-user) come from trusted
1843# locations before they come from the user's private area.
1844# This should help avoid accidentally configuring some
1845# random version of a program in someone's personal bin.
1846
1847OPATH=$PATH
1848PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001849test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001850test -d /sbin && PATH=$PATH:/sbin
1851test -d /usr/sbin && PATH=$PATH:/usr/sbin
1852PATH=$PATH:/etc:$OPATH
1853
Damien Millera8e06ce2003-11-21 23:48:55 +11001854# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001855OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1856OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1857OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1858OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1859OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1860OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1861OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1862OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1863OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1864OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1865OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1866OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1867OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1868OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1869OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1870OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001871# restore PATH
1872PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001873
1874# Where does ssh-rand-helper get its randomness from?
1875INSTALL_SSH_PRNG_CMDS=""
1876if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1877 if test ! -z "$PRNGD_PORT" ; then
1878 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1879 elif test ! -z "$PRNGD_SOCKET" ; then
1880 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1881 else
1882 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1883 RAND_HELPER_CMDHASH=yes
1884 INSTALL_SSH_PRNG_CMDS="yes"
1885 fi
1886fi
1887AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1888
1889
Ben Lindstromb5628642000-10-18 00:02:25 +00001890# Cheap hack to ensure NEWS-OS libraries are arranged right.
1891if test ! -z "$SONY" ; then
1892 LIBS="$LIBS -liberty";
1893fi
1894
Damien Millera22ba012000-03-02 23:09:20 +11001895# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001896AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001897AC_CHECK_SIZEOF(short int, 2)
1898AC_CHECK_SIZEOF(int, 4)
1899AC_CHECK_SIZEOF(long int, 4)
1900AC_CHECK_SIZEOF(long long int, 8)
1901
Damien Millerfa2bb692002-04-23 23:22:25 +10001902# Sanity check long long for some platforms (AIX)
1903if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1904 ac_cv_sizeof_long_long_int=0
1905fi
1906
Damien Millera22ba012000-03-02 23:09:20 +11001907# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001908AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1909 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001910 [ #include <sys/types.h> ],
1911 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001912 [ ac_cv_have_u_int="yes" ],
1913 [ ac_cv_have_u_int="no" ]
1914 )
1915])
1916if test "x$ac_cv_have_u_int" = "xyes" ; then
1917 AC_DEFINE(HAVE_U_INT)
1918 have_u_int=1
1919fi
1920
Damien Miller61e50f12000-05-08 20:49:37 +10001921AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1922 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001923 [ #include <sys/types.h> ],
1924 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001925 [ ac_cv_have_intxx_t="yes" ],
1926 [ ac_cv_have_intxx_t="no" ]
1927 )
1928])
1929if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1930 AC_DEFINE(HAVE_INTXX_T)
1931 have_intxx_t=1
1932fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001933
1934if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001935 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001936then
1937 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1938 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001939 [ #include <stdint.h> ],
1940 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001941 [
1942 AC_DEFINE(HAVE_INTXX_T)
1943 AC_MSG_RESULT(yes)
1944 ],
1945 [ AC_MSG_RESULT(no) ]
1946 )
1947fi
1948
Damien Miller578783e2000-09-23 14:12:24 +11001949AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1950 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001951 [
1952#include <sys/types.h>
1953#ifdef HAVE_STDINT_H
1954# include <stdint.h>
1955#endif
1956#include <sys/socket.h>
1957#ifdef HAVE_SYS_BITYPES_H
1958# include <sys/bitypes.h>
1959#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001960 ],
1961 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001962 [ ac_cv_have_int64_t="yes" ],
1963 [ ac_cv_have_int64_t="no" ]
1964 )
1965])
1966if test "x$ac_cv_have_int64_t" = "xyes" ; then
1967 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001968fi
1969
Damien Miller61e50f12000-05-08 20:49:37 +10001970AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1971 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001972 [ #include <sys/types.h> ],
1973 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001974 [ ac_cv_have_u_intxx_t="yes" ],
1975 [ ac_cv_have_u_intxx_t="no" ]
1976 )
1977])
1978if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1979 AC_DEFINE(HAVE_U_INTXX_T)
1980 have_u_intxx_t=1
1981fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001982
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001983if test -z "$have_u_intxx_t" ; then
1984 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1985 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001986 [ #include <sys/socket.h> ],
1987 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001988 [
1989 AC_DEFINE(HAVE_U_INTXX_T)
1990 AC_MSG_RESULT(yes)
1991 ],
1992 [ AC_MSG_RESULT(no) ]
1993 )
1994fi
1995
Damien Miller578783e2000-09-23 14:12:24 +11001996AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1997 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001998 [ #include <sys/types.h> ],
1999 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002000 [ ac_cv_have_u_int64_t="yes" ],
2001 [ ac_cv_have_u_int64_t="no" ]
2002 )
2003])
2004if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2005 AC_DEFINE(HAVE_U_INT64_T)
2006 have_u_int64_t=1
2007fi
2008
Tim Rice4cec93f2002-02-26 08:40:48 -08002009if test -z "$have_u_int64_t" ; then
2010 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2011 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002012 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002013 [ u_int64_t a; a = 1],
2014 [
2015 AC_DEFINE(HAVE_U_INT64_T)
2016 AC_MSG_RESULT(yes)
2017 ],
2018 [ AC_MSG_RESULT(no) ]
2019 )
2020fi
2021
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002022if test -z "$have_u_intxx_t" ; then
2023 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2024 AC_TRY_COMPILE(
2025 [
2026#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002027 ],
2028 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002029 [ ac_cv_have_uintxx_t="yes" ],
2030 [ ac_cv_have_uintxx_t="no" ]
2031 )
2032 ])
2033 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2034 AC_DEFINE(HAVE_UINTXX_T)
2035 fi
2036fi
2037
2038if test -z "$have_uintxx_t" ; then
2039 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2040 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002041 [ #include <stdint.h> ],
2042 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002043 [
2044 AC_DEFINE(HAVE_UINTXX_T)
2045 AC_MSG_RESULT(yes)
2046 ],
2047 [ AC_MSG_RESULT(no) ]
2048 )
2049fi
2050
Damien Milleredb82922000-06-20 13:25:52 +10002051if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002052 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002053then
2054 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2055 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002056 [
2057#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002058 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002059 [
Damien Miller70494d12000-04-03 15:57:06 +10002060 int8_t a; int16_t b; int32_t c;
2061 u_int8_t e; u_int16_t f; u_int32_t g;
2062 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002063 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002064 [
2065 AC_DEFINE(HAVE_U_INTXX_T)
2066 AC_DEFINE(HAVE_INTXX_T)
2067 AC_MSG_RESULT(yes)
2068 ],
2069 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002070 )
Damien Millerb29ea912000-01-15 14:12:03 +11002071fi
2072
Damien Miller58be7382001-09-15 21:31:54 +10002073
2074AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2075 AC_TRY_COMPILE(
2076 [
2077#include <sys/types.h>
2078 ],
2079 [ u_char foo; foo = 125; ],
2080 [ ac_cv_have_u_char="yes" ],
2081 [ ac_cv_have_u_char="no" ]
2082 )
2083])
2084if test "x$ac_cv_have_u_char" = "xyes" ; then
2085 AC_DEFINE(HAVE_U_CHAR)
2086fi
2087
Tim Rice13aae5e2001-10-21 17:53:58 -07002088TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002089
Tim Rice200a5c02002-02-26 22:12:34 -08002090AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002091
Damien Miller848b9932005-02-24 12:12:34 +11002092AC_CHECK_TYPES(in_addr_t,,,
2093[#include <sys/types.h>
2094#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002095
Damien Miller61e50f12000-05-08 20:49:37 +10002096AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2097 AC_TRY_COMPILE(
2098 [
2099#include <sys/types.h>
2100 ],
2101 [ size_t foo; foo = 1235; ],
2102 [ ac_cv_have_size_t="yes" ],
2103 [ ac_cv_have_size_t="no" ]
2104 )
2105])
2106if test "x$ac_cv_have_size_t" = "xyes" ; then
2107 AC_DEFINE(HAVE_SIZE_T)
2108fi
Damien Miller95058511999-12-29 10:36:45 +11002109
Damien Miller615f9392000-05-17 22:53:33 +10002110AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2111 AC_TRY_COMPILE(
2112 [
2113#include <sys/types.h>
2114 ],
2115 [ ssize_t foo; foo = 1235; ],
2116 [ ac_cv_have_ssize_t="yes" ],
2117 [ ac_cv_have_ssize_t="no" ]
2118 )
2119])
2120if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2121 AC_DEFINE(HAVE_SSIZE_T)
2122fi
2123
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002124AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2125 AC_TRY_COMPILE(
2126 [
2127#include <time.h>
2128 ],
2129 [ clock_t foo; foo = 1235; ],
2130 [ ac_cv_have_clock_t="yes" ],
2131 [ ac_cv_have_clock_t="no" ]
2132 )
2133])
2134if test "x$ac_cv_have_clock_t" = "xyes" ; then
2135 AC_DEFINE(HAVE_CLOCK_T)
2136fi
2137
Damien Millerb54b40e2000-06-23 08:23:34 +10002138AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2139 AC_TRY_COMPILE(
2140 [
2141#include <sys/types.h>
2142#include <sys/socket.h>
2143 ],
2144 [ sa_family_t foo; foo = 1235; ],
2145 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002146 [ AC_TRY_COMPILE(
2147 [
2148#include <sys/types.h>
2149#include <sys/socket.h>
2150#include <netinet/in.h>
2151 ],
2152 [ sa_family_t foo; foo = 1235; ],
2153 [ ac_cv_have_sa_family_t="yes" ],
2154
Damien Millerb54b40e2000-06-23 08:23:34 +10002155 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002156 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002157 )
2158])
2159if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2160 AC_DEFINE(HAVE_SA_FAMILY_T)
2161fi
2162
Damien Miller0f91b4e2000-06-18 15:43:25 +10002163AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2164 AC_TRY_COMPILE(
2165 [
2166#include <sys/types.h>
2167 ],
2168 [ pid_t foo; foo = 1235; ],
2169 [ ac_cv_have_pid_t="yes" ],
2170 [ ac_cv_have_pid_t="no" ]
2171 )
2172])
2173if test "x$ac_cv_have_pid_t" = "xyes" ; then
2174 AC_DEFINE(HAVE_PID_T)
2175fi
2176
2177AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2178 AC_TRY_COMPILE(
2179 [
2180#include <sys/types.h>
2181 ],
2182 [ mode_t foo; foo = 1235; ],
2183 [ ac_cv_have_mode_t="yes" ],
2184 [ ac_cv_have_mode_t="no" ]
2185 )
2186])
2187if test "x$ac_cv_have_mode_t" = "xyes" ; then
2188 AC_DEFINE(HAVE_MODE_T)
2189fi
2190
Damien Miller61e50f12000-05-08 20:49:37 +10002191
2192AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2193 AC_TRY_COMPILE(
2194 [
Damien Miller81171112000-04-23 11:14:01 +10002195#include <sys/types.h>
2196#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002197 ],
2198 [ struct sockaddr_storage s; ],
2199 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2200 [ ac_cv_have_struct_sockaddr_storage="no" ]
2201 )
2202])
2203if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2204 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2205fi
Damien Miller34132e52000-01-14 15:45:46 +11002206
Damien Miller61e50f12000-05-08 20:49:37 +10002207AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2208 AC_TRY_COMPILE(
2209 [
Damien Miller7b22d652000-06-18 14:07:04 +10002210#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002211#include <netinet/in.h>
2212 ],
2213 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2214 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2215 [ ac_cv_have_struct_sockaddr_in6="no" ]
2216 )
2217])
2218if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2219 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2220fi
Damien Miller34132e52000-01-14 15:45:46 +11002221
Damien Miller61e50f12000-05-08 20:49:37 +10002222AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2223 AC_TRY_COMPILE(
2224 [
Damien Miller7b22d652000-06-18 14:07:04 +10002225#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002226#include <netinet/in.h>
2227 ],
2228 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2229 [ ac_cv_have_struct_in6_addr="yes" ],
2230 [ ac_cv_have_struct_in6_addr="no" ]
2231 )
2232])
2233if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2234 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2235fi
Damien Miller34132e52000-01-14 15:45:46 +11002236
Damien Miller61e50f12000-05-08 20:49:37 +10002237AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2238 AC_TRY_COMPILE(
2239 [
Damien Miller81171112000-04-23 11:14:01 +10002240#include <sys/types.h>
2241#include <sys/socket.h>
2242#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002243 ],
2244 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2245 [ ac_cv_have_struct_addrinfo="yes" ],
2246 [ ac_cv_have_struct_addrinfo="no" ]
2247 )
2248])
2249if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2250 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2251fi
2252
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002253AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2254 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002255 [ #include <sys/time.h> ],
2256 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002257 [ ac_cv_have_struct_timeval="yes" ],
2258 [ ac_cv_have_struct_timeval="no" ]
2259 )
2260])
2261if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2262 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2263 have_struct_timeval=1
2264fi
2265
Tim Rice4e4dc562003-03-18 10:21:40 -08002266AC_CHECK_TYPES(struct timespec)
2267
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002268# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002269if test "x$ac_cv_have_int64_t" = "xno" && \
2270 test "x$ac_cv_sizeof_long_int" != "x8" && \
2271 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002272 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2273 echo "an alternative compiler (I.E., GCC) before continuing."
2274 echo ""
2275 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002276else
2277dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002278 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002279 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002280#include <stdio.h>
2281#include <string.h>
2282#ifdef HAVE_SNPRINTF
2283main()
2284{
2285 char buf[50];
2286 char expected_out[50];
2287 int mazsize = 50 ;
2288#if (SIZEOF_LONG_INT == 8)
2289 long int num = 0x7fffffffffffffff;
2290#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002291 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002292#endif
2293 strcpy(expected_out, "9223372036854775807");
2294 snprintf(buf, mazsize, "%lld", num);
2295 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002296 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002297 exit(0);
2298}
2299#else
2300main() { exit(0); }
2301#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002302 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002303 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002304 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002305fi
2306
Damien Miller78315eb2000-09-29 23:01:36 +11002307dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002308OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2309OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2310OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2311OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2312OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002313OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002314OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2315OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002316OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002317OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2318OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2319OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2320OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002321OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2322OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2323OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2324OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002325
2326AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002327
Damien Miller61e50f12000-05-08 20:49:37 +10002328AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2329 ac_cv_have_ss_family_in_struct_ss, [
2330 AC_TRY_COMPILE(
2331 [
Damien Miller81171112000-04-23 11:14:01 +10002332#include <sys/types.h>
2333#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002334 ],
2335 [ struct sockaddr_storage s; s.ss_family = 1; ],
2336 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2337 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2338 )
2339])
2340if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2341 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2342fi
2343
Damien Miller61e50f12000-05-08 20:49:37 +10002344AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2345 ac_cv_have___ss_family_in_struct_ss, [
2346 AC_TRY_COMPILE(
2347 [
Damien Miller81171112000-04-23 11:14:01 +10002348#include <sys/types.h>
2349#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002350 ],
2351 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2352 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2353 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2354 )
2355])
2356if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2357 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2358fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002359
Damien Millerad833b32000-08-23 10:46:23 +10002360AC_CACHE_CHECK([for pw_class field in struct passwd],
2361 ac_cv_have_pw_class_in_struct_passwd, [
2362 AC_TRY_COMPILE(
2363 [
Damien Millerad833b32000-08-23 10:46:23 +10002364#include <pwd.h>
2365 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002366 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002367 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2368 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2369 )
2370])
2371if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2372 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2373fi
2374
Kevin Steves82456952001-06-22 21:14:18 +00002375AC_CACHE_CHECK([for pw_expire field in struct passwd],
2376 ac_cv_have_pw_expire_in_struct_passwd, [
2377 AC_TRY_COMPILE(
2378 [
2379#include <pwd.h>
2380 ],
2381 [ struct passwd p; p.pw_expire = 0; ],
2382 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2383 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2384 )
2385])
2386if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2387 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2388fi
2389
2390AC_CACHE_CHECK([for pw_change field in struct passwd],
2391 ac_cv_have_pw_change_in_struct_passwd, [
2392 AC_TRY_COMPILE(
2393 [
2394#include <pwd.h>
2395 ],
2396 [ struct passwd p; p.pw_change = 0; ],
2397 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2398 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2399 )
2400])
2401if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2402 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2403fi
Damien Miller61e50f12000-05-08 20:49:37 +10002404
Tim Rice28bbb0c2002-05-27 17:37:32 -07002405dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002406AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2407 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002408 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002409 [
Tim Riceae49fe62002-04-12 10:26:21 -07002410#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002411#include <sys/socket.h>
2412#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002413int main() {
2414#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002415#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002416exit(1);
2417#endif
2418struct msghdr m;
2419m.msg_accrights = 0;
2420exit(0);
2421}
Kevin Steves939c9db2002-03-22 17:23:25 +00002422 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002423 [ ac_cv_have_accrights_in_msghdr="yes" ],
2424 [ ac_cv_have_accrights_in_msghdr="no" ]
2425 )
2426])
2427if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2428 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2429fi
2430
Kevin Stevesa44e0352002-04-07 16:18:03 +00002431AC_CACHE_CHECK([for msg_control field in struct msghdr],
2432 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002433 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002434 [
Tim Riceae49fe62002-04-12 10:26:21 -07002435#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002436#include <sys/socket.h>
2437#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002438int main() {
2439#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002440#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002441exit(1);
2442#endif
2443struct msghdr m;
2444m.msg_control = 0;
2445exit(0);
2446}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002447 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002448 [ ac_cv_have_control_in_msghdr="yes" ],
2449 [ ac_cv_have_control_in_msghdr="no" ]
2450 )
2451])
2452if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2453 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2454fi
2455
Damien Miller61e50f12000-05-08 20:49:37 +10002456AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002457 AC_TRY_LINK([],
2458 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002459 [ ac_cv_libc_defines___progname="yes" ],
2460 [ ac_cv_libc_defines___progname="no" ]
2461 )
2462])
2463if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2464 AC_DEFINE(HAVE___PROGNAME)
2465fi
2466
Kevin Steves4846f4a2002-03-22 18:19:53 +00002467AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2468 AC_TRY_LINK([
2469#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002470],
2471 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002472 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2473 [ ac_cv_cc_implements___FUNCTION__="no" ]
2474 )
2475])
2476if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2477 AC_DEFINE(HAVE___FUNCTION__)
2478fi
2479
2480AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2481 AC_TRY_LINK([
2482#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002483],
2484 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002485 [ ac_cv_cc_implements___func__="yes" ],
2486 [ ac_cv_cc_implements___func__="no" ]
2487 )
2488])
2489if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2490 AC_DEFINE(HAVE___func__)
2491fi
2492
Damien Miller4f8e6692001-07-14 13:22:53 +10002493AC_CACHE_CHECK([whether getopt has optreset support],
2494 ac_cv_have_getopt_optreset, [
2495 AC_TRY_LINK(
2496 [
2497#include <getopt.h>
2498 ],
2499 [ extern int optreset; optreset = 0; ],
2500 [ ac_cv_have_getopt_optreset="yes" ],
2501 [ ac_cv_have_getopt_optreset="no" ]
2502 )
2503])
2504if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2505 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2506fi
Damien Millera22ba012000-03-02 23:09:20 +11002507
Damien Millerecbb26d2000-07-15 14:59:14 +10002508AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002509 AC_TRY_LINK([],
2510 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002511 [ ac_cv_libc_defines_sys_errlist="yes" ],
2512 [ ac_cv_libc_defines_sys_errlist="no" ]
2513 )
2514])
2515if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2516 AC_DEFINE(HAVE_SYS_ERRLIST)
2517fi
2518
2519
Damien Miller11fa2cc2000-08-16 10:35:58 +10002520AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002521 AC_TRY_LINK([],
2522 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002523 [ ac_cv_libc_defines_sys_nerr="yes" ],
2524 [ ac_cv_libc_defines_sys_nerr="no" ]
2525 )
2526])
2527if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2528 AC_DEFINE(HAVE_SYS_NERR)
2529fi
2530
Damien Millera8e06ce2003-11-21 23:48:55 +11002531SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002532# Check whether user wants sectok support
2533AC_ARG_WITH(sectok,
2534 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002535 [
2536 if test "x$withval" != "xno" ; then
2537 if test "x$withval" != "xyes" ; then
2538 CPPFLAGS="$CPPFLAGS -I${withval}"
2539 LDFLAGS="$LDFLAGS -L${withval}"
2540 if test ! -z "$need_dash_r" ; then
2541 LDFLAGS="$LDFLAGS -R${withval}"
2542 fi
2543 if test ! -z "$blibpath" ; then
2544 blibpath="$blibpath:${withval}"
2545 fi
2546 fi
2547 AC_CHECK_HEADERS(sectok.h)
2548 if test "$ac_cv_header_sectok_h" != yes; then
2549 AC_MSG_ERROR(Can't find sectok.h)
2550 fi
2551 AC_CHECK_LIB(sectok, sectok_open)
2552 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2553 AC_MSG_ERROR(Can't find libsectok)
2554 fi
2555 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002556 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002557 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002558 fi
2559 ]
2560)
2561
2562# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002563OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002564AC_ARG_WITH(opensc,
Tim Rice12ee8e22005-03-17 13:37:04 -08002565 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2566 [
2567 if test "x$withval" != "xno" ; then
2568 if test "x$withval" != "xyes" ; then
2569 OPENSC_CONFIG=$withval/bin/opensc-config
2570 else
2571 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2572 fi
2573 if test "$OPENSC_CONFIG" != "no"; then
2574 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2575 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2576 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2577 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2578 AC_DEFINE(SMARTCARD)
2579 AC_DEFINE(USE_OPENSC)
2580 SCARD_MSG="yes, using OpenSC"
2581 fi
2582 fi
2583 ]
2584)
Damien Miller85de5802001-09-18 14:01:11 +10002585
Darren Tucker5f88d342003-10-15 16:57:57 +10002586# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002587AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002588 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002589 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002590 # Needed by our getrrsetbyname()
2591 AC_SEARCH_LIBS(res_query, resolv)
2592 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002593 AC_MSG_CHECKING(if res_query will link)
2594 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2595 [AC_MSG_RESULT(no)
2596 saved_LIBS="$LIBS"
2597 LIBS="$LIBS -lresolv"
2598 AC_MSG_CHECKING(for res_query in -lresolv)
2599 AC_LINK_IFELSE([
2600#include <resolv.h>
2601int main()
2602{
2603 res_query (0, 0, 0, 0, 0);
2604 return 0;
2605}
2606 ],
2607 [LIBS="$LIBS -lresolv"
2608 AC_MSG_RESULT(yes)],
2609 [LIBS="$saved_LIBS"
2610 AC_MSG_RESULT(no)])
2611 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002612 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002613 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002614 [#include <sys/types.h>
2615 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002616 AC_CHECK_MEMBER(HEADER.ad,
2617 [AC_DEFINE(HAVE_HEADER_AD)],,
2618 [#include <arpa/nameser.h>])
2619 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002620
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002621# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002622KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002623AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002624 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002625 [ if test "x$withval" != "xno" ; then
2626 if test "x$withval" = "xyes" ; then
2627 KRB5ROOT="/usr/local"
2628 else
2629 KRB5ROOT=${withval}
2630 fi
2631
2632 AC_DEFINE(KRB5)
2633 KRB5_MSG="yes"
2634
2635 AC_MSG_CHECKING(for krb5-config)
2636 if test -x $KRB5ROOT/bin/krb5-config ; then
2637 KRB5CONF=$KRB5ROOT/bin/krb5-config
2638 AC_MSG_RESULT($KRB5CONF)
2639
2640 AC_MSG_CHECKING(for gssapi support)
2641 if $KRB5CONF | grep gssapi >/dev/null ; then
2642 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002643 AC_DEFINE(GSSAPI)
2644 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002645 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002646 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002647 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002648 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002649 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2650 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002651 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002652 AC_MSG_CHECKING(whether we are using Heimdal)
2653 AC_TRY_COMPILE([ #include <krb5.h> ],
2654 [ char *tmp = heimdal_version; ],
2655 [ AC_MSG_RESULT(yes)
2656 AC_DEFINE(HEIMDAL) ],
2657 AC_MSG_RESULT(no)
2658 )
2659 else
2660 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002661 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002662 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002663 AC_MSG_CHECKING(whether we are using Heimdal)
2664 AC_TRY_COMPILE([ #include <krb5.h> ],
2665 [ char *tmp = heimdal_version; ],
2666 [ AC_MSG_RESULT(yes)
2667 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002668 K5LIBS="-lkrb5 -ldes"
2669 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002670 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002671 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002672 ],
2673 [ AC_MSG_RESULT(no)
2674 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2675 ]
2676 )
Damien Miller200d0a72003-06-30 19:21:36 +10002677 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002678
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002679 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2680 [ AC_DEFINE(GSSAPI)
2681 K5LIBS="-lgssapi $K5LIBS" ],
2682 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2683 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002684 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002685 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2686 $K5LIBS)
2687 ],
2688 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002689
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002690 AC_CHECK_HEADER(gssapi.h, ,
2691 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002692 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002693 AC_CHECK_HEADERS(gssapi.h, ,
2694 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002695 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002696 ]
2697 )
2698
2699 oldCPP="$CPPFLAGS"
2700 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2701 AC_CHECK_HEADER(gssapi_krb5.h, ,
2702 [ CPPFLAGS="$oldCPP" ])
2703
Damien Millera8e06ce2003-11-21 23:48:55 +11002704 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002705 if test ! -z "$need_dash_r" ; then
2706 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2707 fi
2708 if test ! -z "$blibpath" ; then
2709 blibpath="$blibpath:${KRB5ROOT}/lib"
2710 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002711 fi
2712
2713 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2714 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2715 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2716
2717 LIBS="$LIBS $K5LIBS"
2718 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002719 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002720 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002721)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002722
Damien Millera22ba012000-03-02 23:09:20 +11002723# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002724
Damien Millerf58c6722002-05-13 13:15:42 +10002725PRIVSEP_PATH=/var/empty
2726AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002727 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002728 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002729 if test -n "$withval" && test "x$withval" != "xno" && \
2730 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10002731 PRIVSEP_PATH=$withval
2732 fi
2733 ]
2734)
2735AC_SUBST(PRIVSEP_PATH)
2736
Damien Millera22ba012000-03-02 23:09:20 +11002737AC_ARG_WITH(xauth,
2738 [ --with-xauth=PATH Specify path to xauth program ],
2739 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002740 if test -n "$withval" && test "x$withval" != "xno" && \
2741 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10002742 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002743 fi
2744 ],
2745 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002746 TestPath="$PATH"
2747 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2748 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2749 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2750 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2751 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002752 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002753 xauth_path="/usr/openwin/bin/xauth"
2754 fi
2755 ]
2756)
2757
Damien Miller7d901272003-01-13 16:55:22 +11002758STRIP_OPT=-s
2759AC_ARG_ENABLE(strip,
2760 [ --disable-strip Disable calling strip(1) on install],
2761 [
2762 if test "x$enableval" = "xno" ; then
2763 STRIP_OPT=
2764 fi
2765 ]
2766)
2767AC_SUBST(STRIP_OPT)
2768
Damien Millera19cf472000-11-29 13:28:50 +11002769if test -z "$xauth_path" ; then
2770 XAUTH_PATH="undefined"
2771 AC_SUBST(XAUTH_PATH)
2772else
Damien Millera22ba012000-03-02 23:09:20 +11002773 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002774 XAUTH_PATH=$xauth_path
2775 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002776fi
Damien Millera22ba012000-03-02 23:09:20 +11002777
2778# Check for mail directory (last resort if we cannot get it from headers)
2779if test ! -z "$MAIL" ; then
2780 maildir=`dirname $MAIL`
2781 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2782fi
2783
Darren Tucker623d92f2004-09-12 22:36:15 +10002784if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002785 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2786 disable_ptmx_check=yes
2787fi
Damien Millera22ba012000-03-02 23:09:20 +11002788if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002789 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002790 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002791 [
2792 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2793 have_dev_ptmx=1
2794 ]
2795 )
2796 fi
Damien Millera22ba012000-03-02 23:09:20 +11002797fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002798
Darren Tucker623d92f2004-09-12 22:36:15 +10002799if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002800 AC_CHECK_FILE("/dev/ptc",
2801 [
2802 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2803 have_dev_ptc=1
2804 ]
2805 )
2806else
2807 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2808fi
Damien Miller204ad072000-03-02 23:56:12 +11002809
Damien Millera22ba012000-03-02 23:09:20 +11002810# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002811AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002812 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002813 [
Damien Miller897741e2001-04-16 10:41:46 +10002814 case "$withval" in
2815 man|cat|doc)
2816 MANTYPE=$withval
2817 ;;
2818 *)
2819 AC_MSG_ERROR(invalid man type: $withval)
2820 ;;
2821 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002822 ]
2823)
Ben Lindstrombc709922001-04-18 18:04:21 +00002824if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002825 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2826 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002827 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2828 MANTYPE=doc
2829 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2830 MANTYPE=man
2831 else
2832 MANTYPE=cat
2833 fi
2834fi
Damien Miller670a4b82000-01-22 13:53:11 +11002835AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002836if test "$MANTYPE" = "doc"; then
2837 mansubdir=man;
2838else
2839 mansubdir=$MANTYPE;
2840fi
2841AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002842
Damien Millera22ba012000-03-02 23:09:20 +11002843# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002844MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002845AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002846 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002847 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002848 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002849 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002850 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002851 fi
2852 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002853)
2854
Damien Millera22ba012000-03-02 23:09:20 +11002855# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002856AC_ARG_WITH(shadow,
2857 [ --without-shadow Disable shadow password support],
2858 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002859 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11002860 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002861 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002862 fi
2863 ]
2864)
2865
Damien Miller1f335fb2000-06-26 11:31:33 +10002866if test -z "$disable_shadow" ; then
2867 AC_MSG_CHECKING([if the systems has expire shadow information])
2868 AC_TRY_COMPILE(
2869 [
2870#include <sys/types.h>
2871#include <shadow.h>
2872 struct spwd sp;
2873 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2874 [ sp_expire_available=yes ], []
2875 )
2876
2877 if test "x$sp_expire_available" = "xyes" ; then
2878 AC_MSG_RESULT(yes)
2879 AC_DEFINE(HAS_SHADOW_EXPIRE)
2880 else
2881 AC_MSG_RESULT(no)
2882 fi
2883fi
2884
Damien Millera22ba012000-03-02 23:09:20 +11002885# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002886if test ! -z "$IPADDR_IN_DISPLAY" ; then
2887 DISPLAY_HACK_MSG="yes"
2888 AC_DEFINE(IPADDR_IN_DISPLAY)
2889else
Damien Millera8e06ce2003-11-21 23:48:55 +11002890 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002891 AC_ARG_WITH(ipaddr-display,
2892 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2893 [
Tim Riceeae17cc2005-03-17 16:52:20 -08002894 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11002895 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002896 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002897 fi
2898 ]
2899 )
2900fi
Damien Miller76112de1999-12-21 11:18:08 +11002901
Darren Tuckere1a790d2003-09-16 11:52:19 +10002902# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002903AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11002904 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11002905 [ if test "x$enableval" = "xno"; then
2906 AC_MSG_NOTICE([/etc/default/login handling disabled])
2907 etc_default_login=no
2908 else
2909 etc_default_login=yes
2910 fi ],
2911 [ etc_default_login=yes ]
2912)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002913
Darren Tucker2f9573d2005-02-10 22:28:54 +11002914if test "x$etc_default_login" != "xno"; then
2915 AC_CHECK_FILE("/etc/default/login",
2916 [ external_path_file=/etc/default/login ])
Darren Tucker623d92f2004-09-12 22:36:15 +10002917 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2918 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002919 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2920 elif test "x$external_path_file" = "x/etc/default/login"; then
2921 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2922 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11002923fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002924
Tim Rice43a1c132002-04-17 21:19:14 -07002925dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08002926if test $ac_cv_func_login_getcapbool = "yes" && \
2927 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002928 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002929fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002930
Damien Millera22ba012000-03-02 23:09:20 +11002931# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002932SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002933AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002934 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002935 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002936 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002937 AC_MSG_WARN([
2938--with-default-path=PATH has no effect on this system.
2939Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08002940 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002941 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002942 AC_MSG_WARN([
2943--with-default-path=PATH will only be used if PATH is not defined in
2944$external_path_file .])
2945 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002946 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002947 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002948 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002949 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002950 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2951 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002952 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002953 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002954 AC_MSG_WARN([
2955If PATH is defined in $external_path_file, ensure the path to scp is included,
2956otherwise scp will not work.])
2957 fi
2958 AC_TRY_RUN(
2959 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002960/* find out what STDPATH is */
2961#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002962#ifdef HAVE_PATHS_H
2963# include <paths.h>
2964#endif
2965#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002966# ifdef _PATH_USERPATH /* Irix */
2967# define _PATH_STDPATH _PATH_USERPATH
2968# else
2969# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2970# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002971#endif
2972#include <sys/types.h>
2973#include <sys/stat.h>
2974#include <fcntl.h>
2975#define DATA "conftest.stdpath"
2976
2977main()
2978{
2979 FILE *fd;
2980 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08002981
Tim Rice59ea0a02001-03-10 13:50:45 -08002982 fd = fopen(DATA,"w");
2983 if(fd == NULL)
2984 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08002985
Tim Rice59ea0a02001-03-10 13:50:45 -08002986 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2987 exit(1);
2988
2989 exit(0);
2990}
2991 ], [ user_path=`cat conftest.stdpath` ],
2992 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2993 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2994 )
2995# make sure $bindir is in USER_PATH so scp will work
2996 t_bindir=`eval echo ${bindir}`
2997 case $t_bindir in
2998 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2999 esac
3000 case $t_bindir in
3001 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3002 esac
3003 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3004 if test $? -ne 0 ; then
3005 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3006 if test $? -ne 0 ; then
3007 user_path=$user_path:$t_bindir
3008 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3009 fi
3010 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003011 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003012)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003013if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003014 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3015 AC_SUBST(user_path)
3016fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003017
Damien Millera18bbd32002-05-13 10:48:57 +10003018# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003019AC_ARG_WITH(superuser-path,
3020 [ --with-superuser-path= Specify different path for super-user],
3021 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003022 if test -n "$withval" && test "x$withval" != "xno" && \
3023 test "x${withval}" != "xyes"; then
Damien Millera18bbd32002-05-13 10:48:57 +10003024 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3025 superuser_path=$withval
3026 fi
3027 ]
3028)
3029
3030
Damien Miller61e50f12000-05-08 20:49:37 +10003031AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003032IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003033AC_ARG_WITH(4in6,
3034 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3035 [
3036 if test "x$withval" != "xno" ; then
3037 AC_MSG_RESULT(yes)
3038 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003039 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003040 else
3041 AC_MSG_RESULT(no)
3042 fi
3043 ],[
3044 if test "x$inet6_default_4in6" = "xyes"; then
3045 AC_MSG_RESULT([yes (default)])
3046 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003047 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003048 else
3049 AC_MSG_RESULT([no (default)])
3050 fi
3051 ]
3052)
3053
Damien Miller60396b02001-02-18 17:01:00 +11003054# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003055BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003056AC_ARG_WITH(bsd-auth,
3057 [ --with-bsd-auth Enable BSD auth support],
3058 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003059 if test "x$withval" != "xno" ; then
Damien Miller60396b02001-02-18 17:01:00 +11003060 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11003061 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003062 fi
3063 ]
3064)
3065
Damien Millera22ba012000-03-02 23:09:20 +11003066# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003067piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003068# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003069if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003070 piddir=`eval echo ${sysconfdir}`
3071 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003072 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003073 esac
3074fi
3075
Tim Rice88f2ab52002-03-17 12:17:34 -08003076AC_ARG_WITH(pid-dir,
3077 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3078 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003079 if test -n "$withval" && test "x$withval" != "xno" && \
3080 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003081 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003082 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003083 AC_MSG_WARN([** no $piddir directory on this system **])
3084 fi
3085 fi
3086 ]
3087)
3088
Ben Lindstrom226cfa02001-01-22 05:34:40 +00003089AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11003090AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003091
andre2ff7b5d2000-06-03 14:57:40 +00003092dnl allow user to disable some login recording features
3093AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003094 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003095 [
3096 if test "x$enableval" = "xno" ; then
3097 AC_DEFINE(DISABLE_LASTLOG)
3098 fi
3099 ]
andre2ff7b5d2000-06-03 14:57:40 +00003100)
3101AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003102 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003103 [
3104 if test "x$enableval" = "xno" ; then
3105 AC_DEFINE(DISABLE_UTMP)
3106 fi
3107 ]
andre2ff7b5d2000-06-03 14:57:40 +00003108)
3109AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003110 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003111 [
3112 if test "x$enableval" = "xno" ; then
3113 AC_DEFINE(DISABLE_UTMPX)
3114 fi
3115 ]
andre2ff7b5d2000-06-03 14:57:40 +00003116)
3117AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003118 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003119 [
3120 if test "x$enableval" = "xno" ; then
3121 AC_DEFINE(DISABLE_WTMP)
3122 fi
3123 ]
andre2ff7b5d2000-06-03 14:57:40 +00003124)
3125AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003126 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003127 [
3128 if test "x$enableval" = "xno" ; then
3129 AC_DEFINE(DISABLE_WTMPX)
3130 fi
3131 ]
andre2ff7b5d2000-06-03 14:57:40 +00003132)
3133AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003134 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003135 [
3136 if test "x$enableval" = "xno" ; then
3137 AC_DEFINE(DISABLE_LOGIN)
3138 fi
3139 ]
andre2ff7b5d2000-06-03 14:57:40 +00003140)
3141AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003142 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003143 [
3144 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003145 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10003146 fi
3147 ]
andre2ff7b5d2000-06-03 14:57:40 +00003148)
3149AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003150 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003151 [
3152 if test "x$enableval" = "xno" ; then
3153 AC_DEFINE(DISABLE_PUTUTXLINE)
3154 fi
3155 ]
andre2ff7b5d2000-06-03 14:57:40 +00003156)
3157AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003158 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003159 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003160 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003161 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003162 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003163 conf_lastlog_location=$withval
3164 fi
3165 ]
3166)
andre2ff7b5d2000-06-03 14:57:40 +00003167
3168dnl lastlog, [uw]tmpx? detection
3169dnl NOTE: set the paths in the platform section to avoid the
3170dnl need for command-line parameters
3171dnl lastlog and [uw]tmp are subject to a file search if all else fails
3172
3173dnl lastlog detection
3174dnl NOTE: the code itself will detect if lastlog is a directory
3175AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3176AC_TRY_COMPILE([
3177#include <sys/types.h>
3178#include <utmp.h>
3179#ifdef HAVE_LASTLOG_H
3180# include <lastlog.h>
3181#endif
Damien Miller2994e082000-06-04 15:51:47 +10003182#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003183# include <paths.h>
3184#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003185#ifdef HAVE_LOGIN_H
3186# include <login.h>
3187#endif
andre2ff7b5d2000-06-03 14:57:40 +00003188 ],
3189 [ char *lastlog = LASTLOG_FILE; ],
3190 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003191 [
3192 AC_MSG_RESULT(no)
3193 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3194 AC_TRY_COMPILE([
3195#include <sys/types.h>
3196#include <utmp.h>
3197#ifdef HAVE_LASTLOG_H
3198# include <lastlog.h>
3199#endif
3200#ifdef HAVE_PATHS_H
3201# include <paths.h>
3202#endif
3203 ],
3204 [ char *lastlog = _PATH_LASTLOG; ],
3205 [ AC_MSG_RESULT(yes) ],
3206 [
andree441aa32000-06-12 22:34:38 +00003207 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003208 system_lastlog_path=no
3209 ])
3210 ]
andre2ff7b5d2000-06-03 14:57:40 +00003211)
Damien Miller2994e082000-06-04 15:51:47 +10003212
andre2ff7b5d2000-06-03 14:57:40 +00003213if test -z "$conf_lastlog_location"; then
3214 if test x"$system_lastlog_path" = x"no" ; then
3215 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003216 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003217 conf_lastlog_location=$f
3218 fi
3219 done
3220 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003221 AC_MSG_WARN([** Cannot find lastlog **])
3222 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003223 fi
3224 fi
3225fi
3226
3227if test -n "$conf_lastlog_location"; then
3228 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003229fi
andre2ff7b5d2000-06-03 14:57:40 +00003230
3231dnl utmp detection
3232AC_MSG_CHECKING([if your system defines UTMP_FILE])
3233AC_TRY_COMPILE([
3234#include <sys/types.h>
3235#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003236#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003237# include <paths.h>
3238#endif
3239 ],
3240 [ char *utmp = UTMP_FILE; ],
3241 [ AC_MSG_RESULT(yes) ],
3242 [ AC_MSG_RESULT(no)
3243 system_utmp_path=no ]
3244)
3245if test -z "$conf_utmp_location"; then
3246 if test x"$system_utmp_path" = x"no" ; then
3247 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3248 if test -f $f ; then
3249 conf_utmp_location=$f
3250 fi
3251 done
3252 if test -z "$conf_utmp_location"; then
3253 AC_DEFINE(DISABLE_UTMP)
3254 fi
3255 fi
3256fi
3257if test -n "$conf_utmp_location"; then
3258 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003259fi
andre2ff7b5d2000-06-03 14:57:40 +00003260
3261dnl wtmp detection
3262AC_MSG_CHECKING([if your system defines WTMP_FILE])
3263AC_TRY_COMPILE([
3264#include <sys/types.h>
3265#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003266#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003267# include <paths.h>
3268#endif
3269 ],
3270 [ char *wtmp = WTMP_FILE; ],
3271 [ AC_MSG_RESULT(yes) ],
3272 [ AC_MSG_RESULT(no)
3273 system_wtmp_path=no ]
3274)
3275if test -z "$conf_wtmp_location"; then
3276 if test x"$system_wtmp_path" = x"no" ; then
3277 for f in /usr/adm/wtmp /var/log/wtmp; do
3278 if test -f $f ; then
3279 conf_wtmp_location=$f
3280 fi
3281 done
3282 if test -z "$conf_wtmp_location"; then
3283 AC_DEFINE(DISABLE_WTMP)
3284 fi
3285 fi
3286fi
3287if test -n "$conf_wtmp_location"; then
3288 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003289fi
andre2ff7b5d2000-06-03 14:57:40 +00003290
3291
3292dnl utmpx detection - I don't know any system so perverse as to require
3293dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3294dnl there, though.
3295AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3296AC_TRY_COMPILE([
3297#include <sys/types.h>
3298#include <utmp.h>
3299#ifdef HAVE_UTMPX_H
3300#include <utmpx.h>
3301#endif
Damien Miller2994e082000-06-04 15:51:47 +10003302#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003303# include <paths.h>
3304#endif
3305 ],
3306 [ char *utmpx = UTMPX_FILE; ],
3307 [ AC_MSG_RESULT(yes) ],
3308 [ AC_MSG_RESULT(no)
3309 system_utmpx_path=no ]
3310)
3311if test -z "$conf_utmpx_location"; then
3312 if test x"$system_utmpx_path" = x"no" ; then
3313 AC_DEFINE(DISABLE_UTMPX)
3314 fi
3315else
3316 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003317fi
andre2ff7b5d2000-06-03 14:57:40 +00003318
3319dnl wtmpx detection
3320AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3321AC_TRY_COMPILE([
3322#include <sys/types.h>
3323#include <utmp.h>
3324#ifdef HAVE_UTMPX_H
3325#include <utmpx.h>
3326#endif
Damien Miller2994e082000-06-04 15:51:47 +10003327#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003328# include <paths.h>
3329#endif
3330 ],
3331 [ char *wtmpx = WTMPX_FILE; ],
3332 [ AC_MSG_RESULT(yes) ],
3333 [ AC_MSG_RESULT(no)
3334 system_wtmpx_path=no ]
3335)
3336if test -z "$conf_wtmpx_location"; then
3337 if test x"$system_wtmpx_path" = x"no" ; then
3338 AC_DEFINE(DISABLE_WTMPX)
3339 fi
3340else
3341 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
Tim Riceeae17cc2005-03-17 16:52:20 -08003342fi
andre2ff7b5d2000-06-03 14:57:40 +00003343
Damien Miller4018c192000-04-30 09:30:44 +10003344
Damien Miller29ea30d2000-03-17 10:54:15 +11003345if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003346 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3347 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003348fi
3349
Tim Rice4cec93f2002-02-26 08:40:48 -08003350dnl remove pam and dl because they are in $LIBPAM
3351if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003352 LIBS=`echo $LIBS | sed 's/-lpam //'`
3353fi
3354if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3355 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003356fi
3357
Damien Millerbac2d8a2000-09-05 16:13:06 +11003358AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003359AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3360 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003361AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003362
Damien Miller7b22d652000-06-18 14:07:04 +10003363# Print summary of options
3364
Damien Miller7b22d652000-06-18 14:07:04 +10003365# Someone please show me a better way :)
3366A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3367B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3368C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3369D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003370E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003371F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003372G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003373H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3374I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3375J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003376
3377echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003378echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003379echo " User binaries: $B"
3380echo " System binaries: $C"
3381echo " Configuration files: $D"
3382echo " Askpass program: $E"
3383echo " Manual pages: $F"
3384echo " PID file: $G"
3385echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003386if test "x$external_path_file" = "x/etc/login.conf" ; then
3387echo " At runtime, sshd will use the path defined in $external_path_file"
3388echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003389else
Damien Millerf58c6722002-05-13 13:15:42 +10003390echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003391 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003392echo " (If PATH is set in $external_path_file it will be used instead. If"
3393echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3394 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003395fi
Damien Millera18bbd32002-05-13 10:48:57 +10003396if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003397echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003398fi
Damien Millerf58c6722002-05-13 13:15:42 +10003399echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003400echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003401echo " KerberosV support: $KRB5_MSG"
3402echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003403echo " S/KEY support: $SKEY_MSG"
3404echo " TCP Wrappers support: $TCPW_MSG"
3405echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003406echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003407echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003408echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3409echo " BSD Auth support: $BSD_AUTH_MSG"
3410echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003411if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003412echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003413fi
3414
Damien Miller7b22d652000-06-18 14:07:04 +10003415echo ""
3416
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003417echo " Host: ${host}"
3418echo " Compiler: ${CC}"
3419echo " Compiler flags: ${CFLAGS}"
3420echo "Preprocessor flags: ${CPPFLAGS}"
3421echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003422echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003423
3424echo ""
3425
Tim Rice6f1f7582004-05-30 21:38:51 -07003426if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003427 echo "SVR4 style packages are supported with \"make package\""
3428 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003429fi
3430
Damien Miller82cf0ce2000-12-20 13:34:48 +11003431if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003432 echo "PAM is enabled. You may need to install a PAM control file "
3433 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003434 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003435 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003436 echo ""
3437fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003438
Damien Miller6c21c512002-01-22 21:57:53 +11003439if test ! -z "$RAND_HELPER_CMDHASH" ; then
3440 echo "WARNING: you are using the builtin random number collection "
3441 echo "service. Please read WARNING.RNG and request that your OS "
3442 echo "vendor includes kernel-based random number collection in "
3443 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003444 echo ""
3445fi
Damien Miller60396b02001-02-18 17:01:00 +11003446
Damien Millerb4097182004-05-23 14:09:40 +10003447if test ! -z "$NO_PEERCHECK" ; then
3448 echo "WARNING: the operating system that you are using does not "
3449 echo "appear to support either the getpeereid() API nor the "
3450 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3451 echo "enforce security checks to prevent unauthorised connections to "
3452 echo "ssh-agent. Their absence increases the risk that a malicious "
3453 echo "user can connect to your agent. "
3454 echo ""
3455fi
3456
Darren Tuckerd9f88912005-02-20 21:01:48 +11003457if test "$AUDIT_MODULE" = "bsm" ; then
3458 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3459 echo "See the Solaris section in README.platform for details."
3460fi