]> andersk Git - openssh.git/blame - configure.ac
- (tim) [configure.ac] test for egrep (AC_PROG_EGREP) before first
[openssh.git] / configure.ac
CommitLineData
eb5d7ff6 1# $Id$
2b983b95 2#
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.
0b202697 16
76e6410a 17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
98a7c37b 18AC_CONFIG_SRCDIR([ssh.c])
5881cd60 19
20AC_CONFIG_HEADER(config.h)
b14b2ae7 21AC_PROG_CC
a7effaac 22AC_CANONICAL_HOST
cf0c5df5 23AC_C_BIGENDIAN
5881cd60 24
a0391976 25# Checks for programs.
4bbf95fa 26AC_PROG_AWK
4cca272e 27AC_PROG_CPP
5881cd60 28AC_PROG_RANLIB
cf8dd513 29AC_PROG_INSTALL
c9ecc3c7 30AC_PROG_EGREP
bee0a37e 31AC_PATH_PROG(AR, ar)
ddd8c95b 32AC_PATH_PROG(CAT, cat)
33AC_PATH_PROG(KILL, kill)
13dd877b 34AC_PATH_PROGS(PERL, perl5 perl)
c3690df3 35AC_PATH_PROG(SED, sed)
a0f84251 36AC_SUBST(PERL)
ad85db64 37AC_PATH_PROG(ENT, ent)
38AC_SUBST(ENT)
6958bd37 39AC_PATH_PROG(TEST_MINUS_S_SH, bash)
40AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
41AC_PATH_PROG(TEST_MINUS_S_SH, sh)
6193497b 42AC_PATH_PROG(SH, sh)
a3245b92 43AC_SUBST(TEST_SHELL,sh)
f498ed15 44
9cefe228 45dnl for buildpkg.sh
46AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
47 [/usr/sbin${PATH_SEPARATOR}/etc])
48AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
49 [/usr/sbin${PATH_SEPARATOR}/etc])
50AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
eeb27c78 51if test -x /sbin/sh; then
52 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
53else
54 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
55fi
9cefe228 56
948fd8b9 57# System features
58AC_SYS_LARGEFILE
59
c193d002 60if test -z "$AR" ; then
61 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
62fi
63
2e73a022 64# Use LOGIN_PROGRAM from environment if possible
65if test ! -z "$LOGIN_PROGRAM" ; then
3466e002 66 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
67 [If your header files don't define LOGIN_PROGRAM,
68 then use this (detected) from environment and PATH])
2e73a022 69else
70 # Search for login
71 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
72 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
73 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
74 fi
75fi
76
37656beb 77AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
78if test ! -z "$PATH_PASSWD_PROG" ; then
3466e002 79 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
80 [Full path of your "passwd" program])
37656beb 81fi
82
d423d822 83if test -z "$LD" ; then
84 LD=$CC
85fi
86AC_SUBST(LD)
82f4e93d 87
d423d822 88AC_C_INLINE
dfafb2e1 89
90AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
91
aff51935 92if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
af40ca44 93 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
eeee8237 94 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
5fdabf45 95 case $GCC_VER in
96 1.*) ;;
97 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
98 2.*) ;;
dbf07ba2 99 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
cd595991 100 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
101 *) ;;
5fdabf45 102 esac
8a3ff1aa 103
dfafb2e1 104 if test -z "$have_llong_max"; then
105 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
106 unset ac_cv_have_decl_LLONG_MAX
107 saved_CFLAGS="$CFLAGS"
108 CFLAGS="$CFLAGS -std=gnu99"
109 AC_CHECK_DECL(LLONG_MAX,
110 [have_llong_max=1],
111 [CFLAGS="$saved_CFLAGS"],
112 [#include <limits.h>]
113 )
114 fi
d423d822 115fi
116
e6354014 117AC_ARG_WITH(rpath,
118 [ --without-rpath Disable auto-added -R linker paths],
119 [
82f4e93d 120 if test "x$withval" = "xno" ; then
e6354014 121 need_dash_r=""
122 fi
123 if test "x$withval" = "xyes" ; then
124 need_dash_r=1
125 fi
126 ]
127)
128
a0391976 129# Check for some target-specific stuff
a7effaac 130case "$host" in
9d6b1b96 131*-*-aix*)
aff51935 132 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
68ece370 133 if (test -z "$blibpath"); then
0a15d73b 134 blibpath="/usr/lib:/lib"
68ece370 135 fi
136 saved_LDFLAGS="$LDFLAGS"
137 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
138 if (test -z "$blibflags"); then
139 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
140 AC_TRY_LINK([], [], [blibflags=$tryflags])
141 fi
142 done
143 if (test -z "$blibflags"); then
144 AC_MSG_RESULT(not found)
145 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
146 else
147 AC_MSG_RESULT($blibflags)
bd499f9e 148 fi
68ece370 149 LDFLAGS="$saved_LDFLAGS"
e351e493 150 dnl Check for authenticate. Might be in libs.a on older AIXes
3466e002 151 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
152 [Define if you want to enable AIX4's authenticate function])],
0764e748 153 [AC_CHECK_LIB(s,authenticate,
e351e493 154 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
0764e748 155 LIBS="$LIBS -ls"
156 ])
157 ])
ba603e06 158 dnl Check for various auth function declarations in headers.
c85ed8e2 159 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
72ad335d 160 passwdexpired, setauthdb], , , [#include <usersec.h>])
e351e493 161 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
ba603e06 162 AC_CHECK_DECLS(loginfailed,
e351e493 163 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
164 AC_TRY_COMPILE(
f58c0e01 165 [#include <usersec.h>],
e351e493 166 [(void)loginfailed("user","host","tty",0);],
167 [AC_MSG_RESULT(yes)
3466e002 168 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
169 [Define if your AIX loginfailed() function
170 takes 4 arguments (AIX >= 5.2)])],
f58c0e01 171 [AC_MSG_RESULT(no)]
e351e493 172 )],
173 [],
174 [#include <usersec.h>]
175 )
2aa3a16c 176 AC_CHECK_FUNCS(setauthdb)
5ccf88cb 177 check_for_aix_broken_getaddrinfo=1
3466e002 178 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
179 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
180 [Define if your platform breaks doing a seteuid before a setuid])
181 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
182 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
a3cef3ca 183 dnl AIX handles lastlog as part of its login message
3466e002 184 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
185 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
186 [Some systems need a utmpx entry for /bin/login to work])
187 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
188 [Define to a Set Process Title type if your system is
189 supported by bsd-setproctitle.c])
961c2997 190 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
191 [AIX 5.2 and 5.3 (and presumably newer) require this])
9d6b1b96 192 ;;
3c62e7eb 193*-*-cygwin*)
a52997bd 194 check_for_libcrypt_later=1
ffb8d130 195 LIBS="$LIBS /usr/lib/textmode.o"
3466e002 196 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
197 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
198 AC_DEFINE(DISABLE_SHADOW, 1,
199 [Define if you want to disable shadow passwords])
200 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
201 [Define if your system choked on IP TOS setting])
202 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
203 [Define if X11 doesn't support AF_UNIX sockets on that system])
204 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
205 [Define if the concept of ports only accessible to
206 superusers isn't known])
207 AC_DEFINE(DISABLE_FD_PASSING, 1,
208 [Define if your platform needs to skip post auth
209 file descriptor passing])
3c62e7eb 210 ;;
d6fdb079 211*-*-dgux*)
212 AC_DEFINE(IP_TOS_IS_BROKEN)
0c6a72a5 213 AC_DEFINE(SETEUID_BREAKS_SETUID)
214 AC_DEFINE(BROKEN_SETREUID)
215 AC_DEFINE(BROKEN_SETREGID)
d6fdb079 216 ;;
39c98ef7 217*-*-darwin*)
33e2e066 218 AC_MSG_CHECKING(if we have working getaddrinfo)
219 AC_TRY_RUN([#include <mach-o/dyld.h>
220main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
221 exit(0);
222 else
223 exit(1);
224}], [AC_MSG_RESULT(working)],
225 [AC_MSG_RESULT(buggy)
3466e002 226 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
b27e573d 227 [AC_MSG_RESULT(assume it is working)])
635e0c42 228 AC_DEFINE(SETEUID_BREAKS_SETUID)
229 AC_DEFINE(BROKEN_SETREUID)
230 AC_DEFINE(BROKEN_SETREGID)
3466e002 231 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
232 [Define if your resolver libs need this for getrrsetbyname])
39c98ef7 233 ;;
7d458c86 234*-*-hpux*)
235 # first we define all of the options common to all HP-UX releases
b8fea62d 236 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
44839801 237 IPADDR_IN_DISPLAY=yes
2b10f47a 238 AC_DEFINE(USE_PIPES)
3466e002 239 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
240 [Define if your login program cannot handle end of options ("--")])
a2572aa7 241 AC_DEFINE(LOGIN_NEEDS_UTMPX)
3466e002 242 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
243 [String used in /etc/passwd to denote locked account])
3a2b2b44 244 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
83f987c3 245 MAIL="/var/mail/username"
f75ca46d 246 LIBS="$LIBS -lsec"
7d458c86 247 AC_CHECK_LIB(xnet, t_error, ,
248 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
249
250 # next, we define all of the options specific to major releases
251 case "$host" in
252 *-*-hpux10*)
253 if test -z "$GCC"; then
254 CFLAGS="$CFLAGS -Ae"
255 fi
256 ;;
257 *-*-hpux11*)
3466e002 258 AC_DEFINE(PAM_SUN_CODEBASE, 1,
259 [Define if you are using Solaris-derived PAM which
260 passes pam_messages to the conversation function
261 with an extra level of indirection])
262 AC_DEFINE(DISABLE_UTMP, 1,
263 [Define if you don't want to use utmp])
7d458c86 264 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
265 check_for_hpux_broken_getaddrinfo=1
266 check_for_conflicting_getspnam=1
267 ;;
268 esac
269
270 # lastly, we define options specific to minor releases
271 case "$host" in
272 *-*-hpux10.26)
3466e002 273 AC_DEFINE(HAVE_SECUREWARE, 1,
274 [Define if you have SecureWare-based
275 protected password database])
7d458c86 276 disable_ptmx_check=yes
277 LIBS="$LIBS -lsecpw"
278 ;;
279 esac
2b763e31 280 ;;
d94aa2ae 281*-*-irix5*)
6ac7829a 282 PATH="$PATH:/usr/etc"
3466e002 283 AC_DEFINE(BROKEN_INET_NTOA, 1,
284 [Define if you system's inet_ntoa is busted
285 (e.g. Irix gcc issue)])
cb433561 286 AC_DEFINE(SETEUID_BREAKS_SETUID)
287 AC_DEFINE(BROKEN_SETREUID)
288 AC_DEFINE(BROKEN_SETREGID)
3466e002 289 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
290 [Define if you shouldn't strip 'tty' from your
291 ttyname in [uw]tmp])
3e6e3da0 292 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
b9795b89 293 ;;
294*-*-irix6*)
6ac7829a 295 PATH="$PATH:/usr/etc"
3466e002 296 AC_DEFINE(WITH_IRIX_ARRAY, 1,
297 [Define if you have/want arrays
298 (cluster-wide session managment, not C arrays)])
299 AC_DEFINE(WITH_IRIX_PROJECT, 1,
300 [Define if you want IRIX project management])
301 AC_DEFINE(WITH_IRIX_AUDIT, 1,
302 [Define if you want IRIX audit trails])
303 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
304 [Define if you want IRIX kernel jobs])])
416ed5a7 305 AC_DEFINE(BROKEN_INET_NTOA)
412c0eaa 306 AC_DEFINE(SETEUID_BREAKS_SETUID)
307 AC_DEFINE(BROKEN_SETREUID)
308 AC_DEFINE(BROKEN_SETREGID)
3466e002 309 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
0e8f4eba 310 AC_DEFINE(WITH_ABBREV_NO_TTY)
3e6e3da0 311 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
d94aa2ae 312 ;;
5cdfe03f 313*-*-linux*)
314 no_dev_ptmx=1
717057b6 315 check_for_libcrypt_later=1
eacb954e 316 check_for_openpty_ctty_bug=1
3466e002 317 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
318 AC_DEFINE(PAM_TTY_KLUDGE, 1,
319 [Work around problematic Linux PAM modules handling of PAM_TTY])
320 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
321 [String used in /etc/passwd to denote locked account])
3a2b2b44 322 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
3466e002 323 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
324 [Define to whatever link() returns for "not supported"
325 if it doesn't return EOPNOTSUPP.])
b6610e8f 326 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
3466e002 327 AC_DEFINE(USE_BTMP)
80faa19f 328 inet6_default_4in6=yes
bf7c1e6c 329 case `uname -r` in
ad84c479 330 1.*|2.0.*)
3466e002 331 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
332 [Define if cmsg_type is not passed correctly])
bf7c1e6c 333 ;;
bf7c1e6c 334 esac
c40f09ca 335 # tun(4) forwarding compat code
d91775e1 336 AC_CHECK_HEADERS(linux/if_tun.h)
b5081213 337 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
c40f09ca 338 AC_DEFINE(SSH_TUN_LINUX, 1,
339 [Open tunnel devices the Linux tun/tap way])
340 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
341 [Use tunnel device compatibility to OpenBSD])
342 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
343 [Prepend the address family to IP tunnel traffic])
344 fi
5cdfe03f 345 ;;
66d6c27e 346mips-sony-bsd|mips-sony-newsos4)
3466e002 347 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
66d6c27e 348 SONY=1
66d6c27e 349 ;;
d468fc76 350*-*-netbsd*)
33e2e066 351 check_for_libcrypt_before=1
82f4e93d 352 if test "x$withval" != "xno" ; then
e6354014 353 need_dash_r=1
354 fi
0f6cb079 355 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
356 AC_CHECK_HEADER([net/if_tap.h], ,
357 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
358 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
359 [Prepend the address family to IP tunnel traffic])
d468fc76 360 ;;
86b416a7 361*-*-freebsd*)
362 check_for_libcrypt_later=1
988c5031 363 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
0f6cb079 364 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
365 AC_CHECK_HEADER([net/if_tap.h], ,
366 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
86b416a7 367 ;;
8707b7eb 368*-*-bsdi*)
369 AC_DEFINE(SETEUID_BREAKS_SETUID)
370 AC_DEFINE(BROKEN_SETREUID)
371 AC_DEFINE(BROKEN_SETREGID)
372 ;;
729bfe59 373*-next-*)
729bfe59 374 conf_lastlog_location="/usr/adm/lastlog"
698d107e 375 conf_utmp_location=/etc/utmp
376 conf_wtmp_location=/usr/adm/wtmp
377 MAIL=/usr/spool/mail
3466e002 378 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
443172c4 379 AC_DEFINE(BROKEN_REALPATH)
00937921 380 AC_DEFINE(USE_PIPES)
3466e002 381 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
729bfe59 382 ;;
5b7b5e23 383*-*-openbsd*)
384 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
8034a348 385 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
0f6cb079 386 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
5b7b5e23 387 ;;
9d6b1b96 388*-*-solaris*)
82f4e93d 389 if test "x$withval" != "xno" ; then
010e9d5b 390 need_dash_r=1
391 fi
adeebd37 392 AC_DEFINE(PAM_SUN_CODEBASE)
7e2d5fa4 393 AC_DEFINE(LOGIN_NEEDS_UTMPX)
3466e002 394 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
395 [Some versions of /bin/login need the TERM supplied
396 on the commandline])
7f0a4ff1 397 AC_DEFINE(PAM_TTY_KLUDGE)
3466e002 398 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
399 [Define if pam_chauthtok wants real uid set
400 to the unpriv'ed user])
3e6e3da0 401 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
ad84c479 402 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
3466e002 403 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
404 [Define if sshd somehow reacquires a controlling TTY
405 after setsid()])
95b99395 406 external_path_file=/etc/default/login
1d7b9b20 407 # hardwire lastlog location (can't detect it on some versions)
408 conf_lastlog_location="/var/adm/lastlog"
32c80420 409 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
410 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
411 if test "$sol2ver" -ge 8; then
412 AC_MSG_RESULT(yes)
413 AC_DEFINE(DISABLE_UTMP)
3466e002 414 AC_DEFINE(DISABLE_WTMP, 1,
415 [Define if you don't want to use wtmp])
32c80420 416 else
417 AC_MSG_RESULT(no)
418 fi
9d6b1b96 419 ;;
a423beaf 420*-*-sunos4*)
0c2fb82f 421 CPPFLAGS="$CPPFLAGS -DSUNOS4"
a423beaf 422 AC_CHECK_FUNCS(getpwanam)
adeebd37 423 AC_DEFINE(PAM_SUN_CODEBASE)
32eec038 424 conf_utmp_location=/etc/utmp
425 conf_wtmp_location=/var/adm/wtmp
426 conf_lastlog_location=/var/adm/lastlog
137d7b6c 427 AC_DEFINE(USE_PIPES)
a423beaf 428 ;;
6f68f28a 429*-ncr-sysv*)
98a7c37b 430 LIBS="$LIBS -lc89"
29525240 431 AC_DEFINE(USE_PIPES)
eabb99c6 432 AC_DEFINE(SSHD_ACQUIRES_CTTY)
6fb3618d 433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
6f68f28a 436 ;;
132dd316 437*-sni-sysv*)
c8c15bcb 438 # /usr/ucblib MUST NOT be searched on ReliantUNIX
e2798e96 439 AC_CHECK_LIB(dl, dlsym, ,)
d08db6d1 440 # -lresolv needs to be at the end of LIBS or DNS lookups break
441 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
9548d6c8 442 IPADDR_IN_DISPLAY=yes
443 AC_DEFINE(USE_PIPES)
132dd316 444 AC_DEFINE(IP_TOS_IS_BROKEN)
605369bb 445 AC_DEFINE(SETEUID_BREAKS_SETUID)
446 AC_DEFINE(BROKEN_SETREUID)
447 AC_DEFINE(BROKEN_SETREGID)
eabb99c6 448 AC_DEFINE(SSHD_ACQUIRES_CTTY)
95b99395 449 external_path_file=/etc/default/login
c8c15bcb 450 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
451 # Attention: always take care to bind libsocket and libnsl before libc,
452 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
132dd316 453 ;;
79a7ba96 454# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
77bb0bca 455*-*-sysv4.2*)
9a406e1e 456 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
ed6553e2 457 AC_DEFINE(USE_PIPES)
7ed101c0 458 AC_DEFINE(SETEUID_BREAKS_SETUID)
459 AC_DEFINE(BROKEN_SETREUID)
460 AC_DEFINE(BROKEN_SETREGID)
46f853b9 461 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
e45da4d6 462 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
77bb0bca 463 ;;
79a7ba96 464# UnixWare 7.x, OpenUNIX 8
77bb0bca 465*-*-sysv5*)
d7d2cc6e 466 check_for_libcrypt_later=1
467 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
ed6553e2 468 AC_DEFINE(USE_PIPES)
7ed101c0 469 AC_DEFINE(SETEUID_BREAKS_SETUID)
470 AC_DEFINE(BROKEN_SETREUID)
471 AC_DEFINE(BROKEN_SETREGID)
3466e002 472 AC_DEFINE(PASSWD_NEEDS_USERNAME)
822015dd 473 case "$host" in
474 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
475 TEST_SHELL=/u95/bin/sh
3466e002 476 AC_DEFINE(BROKEN_LIBIAF, 1,
477 [ia_uinfo routines not supported by OS yet])
822015dd 478 ;;
e45da4d6 479 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
480 ;;
822015dd 481 esac
77bb0bca 482 ;;
9d6b1b96 483*-*-sysv*)
9d6b1b96 484 ;;
79a7ba96 485# SCO UNIX and OEM versions of SCO UNIX
77bb0bca 486*-*-sco3.2v4*)
11cf4f1f 487 AC_MSG_ERROR("This Platform is no longer supported.")
77bb0bca 488 ;;
79a7ba96 489# SCO OpenServer 5.x
77bb0bca 490*-*-sco3.2v5*)
21710e39 491 if test -z "$GCC"; then
492 CFLAGS="$CFLAGS -belf"
493 fi
ed6553e2 494 LIBS="$LIBS -lprot -lx -ltinfo -lm"
509b1f88 495 no_dev_ptmx=1
ed6553e2 496 AC_DEFINE(USE_PIPES)
6e879cb4 497 AC_DEFINE(HAVE_SECUREWARE)
d287c664 498 AC_DEFINE(DISABLE_SHADOW)
94d8258b 499 AC_DEFINE(DISABLE_FD_PASSING)
7ed101c0 500 AC_DEFINE(SETEUID_BREAKS_SETUID)
501 AC_DEFINE(BROKEN_SETREUID)
502 AC_DEFINE(BROKEN_SETREGID)
bcebad47 503 AC_DEFINE(WITH_ABBREV_NO_TTY)
34f2baf0 504 AC_DEFINE(BROKEN_UPDWTMPX)
3466e002 505 AC_DEFINE(PASSWD_NEEDS_USERNAME)
aca75d94 506 AC_CHECK_FUNCS(getluid setluid)
533875af 507 MANTYPE=man
a3245b92 508 TEST_SHELL=ksh
509b1f88 509 ;;
ccbb983c 510*-*-unicosmk*)
3466e002 511 AC_DEFINE(NO_SSH_LASTLOG, 1,
512 [Define if you don't want to use lastlog in session.c])
c1ad5966 513 AC_DEFINE(SETEUID_BREAKS_SETUID)
514 AC_DEFINE(BROKEN_SETREUID)
515 AC_DEFINE(BROKEN_SETREGID)
ccbb983c 516 AC_DEFINE(USE_PIPES)
517 AC_DEFINE(DISABLE_FD_PASSING)
518 LDFLAGS="$LDFLAGS"
519 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
520 MANTYPE=cat
d262b7f2 521 ;;
7b9a8c6e 522*-*-unicosmp*)
c1ad5966 523 AC_DEFINE(SETEUID_BREAKS_SETUID)
524 AC_DEFINE(BROKEN_SETREUID)
525 AC_DEFINE(BROKEN_SETREGID)
7b9a8c6e 526 AC_DEFINE(WITH_ABBREV_NO_TTY)
527 AC_DEFINE(USE_PIPES)
528 AC_DEFINE(DISABLE_FD_PASSING)
529 LDFLAGS="$LDFLAGS"
c1ad5966 530 LIBS="$LIBS -lgen -lacid -ldb"
7b9a8c6e 531 MANTYPE=cat
532 ;;
ca5c7d6a 533*-*-unicos*)
c1ad5966 534 AC_DEFINE(SETEUID_BREAKS_SETUID)
535 AC_DEFINE(BROKEN_SETREUID)
536 AC_DEFINE(BROKEN_SETREGID)
ca5c7d6a 537 AC_DEFINE(USE_PIPES)
94d8258b 538 AC_DEFINE(DISABLE_FD_PASSING)
ef51930f 539 AC_DEFINE(NO_SSH_LASTLOG)
ccbb983c 540 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
541 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
542 MANTYPE=cat
a704dd54 543 ;;
4d33e531 544*-dec-osf*)
99c8ddac 545 AC_MSG_CHECKING(for Digital Unix SIA)
546 no_osfsia=""
547 AC_ARG_WITH(osfsia,
548 [ --with-osfsia Enable Digital Unix SIA],
549 [
550 if test "x$withval" = "xno" ; then
551 AC_MSG_RESULT(disabled)
552 no_osfsia=1
553 fi
554 ],
555 )
556 if test -z "$no_osfsia" ; then
4d33e531 557 if test -f /etc/sia/matrix.conf; then
558 AC_MSG_RESULT(yes)
3466e002 559 AC_DEFINE(HAVE_OSF_SIA, 1,
560 [Define if you have Digital Unix Security
561 Integration Architecture])
562 AC_DEFINE(DISABLE_LOGIN, 1,
563 [Define if you don't want to use your
564 system's login() call])
58d0df4e 565 AC_DEFINE(DISABLE_FD_PASSING)
4d33e531 566 LIBS="$LIBS -lsecurity -ldb -lm -laud"
567 else
568 AC_MSG_RESULT(no)
3466e002 569 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
570 [String used in /etc/passwd to denote locked account])
4d33e531 571 fi
572 fi
a6e67b60 573 AC_DEFINE(BROKEN_GETADDRINFO)
f4f2ff4f 574 AC_DEFINE(SETEUID_BREAKS_SETUID)
08da2d08 575 AC_DEFINE(BROKEN_SETREUID)
576 AC_DEFINE(BROKEN_SETREGID)
4d33e531 577 ;;
41cb4569 578
579*-*-nto-qnx)
580 AC_DEFINE(USE_PIPES)
581 AC_DEFINE(NO_X11_UNIX_SOCKETS)
3466e002 582 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
583 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
584 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
41cb4569 585 ;;
35fc74ed 586
587*-*-ultrix*)
3466e002 588 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
589 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
590 AC_DEFINE(NEED_SETPRGP)
b5765e1d 591 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
592 ;;
157b6700 593
594*-*-lynxos)
595 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
3466e002 596 AC_DEFINE(MISSING_HOWMANY)
157b6700 597 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
598 ;;
a7effaac 599esac
600
8e7b16f8 601# Allow user to specify flags
602AC_ARG_WITH(cflags,
603 [ --with-cflags Specify additional flags to pass to compiler],
604 [
6cf0200f 605 if test -n "$withval" && test "x$withval" != "xno" && \
606 test "x${withval}" != "xyes"; then
8e7b16f8 607 CFLAGS="$CFLAGS $withval"
608 fi
82f4e93d 609 ]
8e7b16f8 610)
0c2fb82f 611AC_ARG_WITH(cppflags,
612 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
613 [
6cf0200f 614 if test -n "$withval" && test "x$withval" != "xno" && \
615 test "x${withval}" != "xyes"; then
0c2fb82f 616 CPPFLAGS="$CPPFLAGS $withval"
617 fi
618 ]
619)
8e7b16f8 620AC_ARG_WITH(ldflags,
97b378bf 621 [ --with-ldflags Specify additional flags to pass to linker],
8e7b16f8 622 [
6cf0200f 623 if test -n "$withval" && test "x$withval" != "xno" && \
624 test "x${withval}" != "xyes"; then
8e7b16f8 625 LDFLAGS="$LDFLAGS $withval"
626 fi
82f4e93d 627 ]
8e7b16f8 628)
629AC_ARG_WITH(libs,
630 [ --with-libs Specify additional libraries to link with],
631 [
6cf0200f 632 if test -n "$withval" && test "x$withval" != "xno" && \
633 test "x${withval}" != "xyes"; then
8e7b16f8 634 LIBS="$LIBS $withval"
635 fi
82f4e93d 636 ]
8e7b16f8 637)
ed89c848 638AC_ARG_WITH(Werror,
639 [ --with-Werror Build main code with -Werror],
640 [
641 if test -n "$withval" && test "x$withval" != "xno"; then
642 werror_flags="-Werror"
1012885d 643 if test "x${withval}" != "xyes"; then
ed89c848 644 werror_flags="$withval"
645 fi
646 fi
647 ]
648)
8e7b16f8 649
c5829391 650AC_MSG_CHECKING(compiler and flags for sanity)
479cece8 651AC_RUN_IFELSE(
652 [AC_LANG_SOURCE([
c5829391 653#include <stdio.h>
654int main(){exit(0);}
479cece8 655 ])],
c5829391 656 [ AC_MSG_RESULT(yes) ],
657 [
658 AC_MSG_RESULT(no)
659 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
1a01a50c 660 ],
661 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
c5829391 662)
663
b04a9f8c 664dnl Checks for header files.
665AC_CHECK_HEADERS( \
666 bstring.h \
667 crypt.h \
668 dirent.h \
669 endian.h \
670 features.h \
671 floatingpoint.h \
672 getopt.h \
673 glob.h \
674 ia.h \
4c653d8e 675 iaf.h \
b04a9f8c 676 lastlog.h \
677 limits.h \
678 login.h \
679 login_cap.h \
680 maillock.h \
681 ndir.h \
a4f24bf8 682 net/if.h \
b04a9f8c 683 netdb.h \
684 netgroup.h \
685 netinet/in_systm.h \
686 pam/pam_appl.h \
687 paths.h \
688 pty.h \
689 readpassphrase.h \
690 rpc/types.h \
691 security/pam_appl.h \
692 shadow.h \
693 stddef.h \
694 stdint.h \
0957c2cf 695 string.h \
b04a9f8c 696 strings.h \
697 sys/audit.h \
698 sys/bitypes.h \
699 sys/bsdtty.h \
700 sys/cdefs.h \
701 sys/dir.h \
702 sys/mman.h \
703 sys/ndir.h \
704 sys/prctl.h \
705 sys/pstat.h \
706 sys/select.h \
707 sys/stat.h \
708 sys/stream.h \
709 sys/stropts.h \
710 sys/strtio.h \
711 sys/sysmacros.h \
712 sys/time.h \
713 sys/timers.h \
714 sys/un.h \
715 time.h \
716 tmpdir.h \
717 ttyent.h \
25dd2ce6 718 unistd.h \
b04a9f8c 719 usersec.h \
720 util.h \
721 utime.h \
722 utmp.h \
723 utmpx.h \
ea76f54c 724 vis.h \
b04a9f8c 725)
ddceb1c8 726
765a24cd 727# sys/ptms.h requires sys/stream.h to be included first on Solaris
728AC_CHECK_HEADERS(sys/ptms.h, [], [], [
729#ifdef HAVE_SYS_STREAM_H
730# include <sys/stream.h>
731#endif
732])
733
a0391976 734# Checks for libraries.
98a7c37b 735AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
736AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
2c523de9 737
446227d6 738dnl IRIX and Solaris 2.5.1 have dirname() in libgen
739AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
740 AC_CHECK_LIB(gen, dirname,[
741 AC_CACHE_CHECK([for broken dirname],
742 ac_cv_have_broken_dirname, [
743 save_LIBS="$LIBS"
744 LIBS="$LIBS -lgen"
b0e7249f 745 AC_RUN_IFELSE(
746 [AC_LANG_SOURCE([[
446227d6 747#include <libgen.h>
748#include <string.h>
749
750int main(int argc, char **argv) {
751 char *s, buf[32];
752
753 strncpy(buf,"/etc", 32);
754 s = dirname(buf);
755 if (!s || strncmp(s, "/", 32) != 0) {
756 exit(1);
757 } else {
758 exit(0);
759 }
760}
b0e7249f 761 ]])],
762 [ ac_cv_have_broken_dirname="no" ],
763 [ ac_cv_have_broken_dirname="yes" ],
446227d6 764 [ ac_cv_have_broken_dirname="no" ],
446227d6 765 )
766 LIBS="$save_LIBS"
767 ])
768 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
769 LIBS="$LIBS -lgen"
770 AC_DEFINE(HAVE_DIRNAME)
771 AC_CHECK_HEADERS(libgen.h)
772 fi
773 ])
774])
775
776AC_CHECK_FUNC(getspnam, ,
777 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
3466e002 778AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
779 [Define if you have the basename function.]))
446227d6 780
98a7c37b 781dnl zlib is required
782AC_ARG_WITH(zlib,
783 [ --with-zlib=PATH Use zlib in PATH],
6dd05556 784 [ if test "x$withval" = "xno" ; then
785 AC_MSG_ERROR([*** zlib is required ***])
786 elif test "x$withval" != "xyes"; then
98a7c37b 787 if test -d "$withval/lib"; then
788 if test -n "${need_dash_r}"; then
5a162955 789 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
98a7c37b 790 else
5a162955 791 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
98a7c37b 792 fi
793 else
794 if test -n "${need_dash_r}"; then
5a162955 795 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
98a7c37b 796 else
5a162955 797 LDFLAGS="-L${withval} ${LDFLAGS}"
98a7c37b 798 fi
799 fi
800 if test -d "$withval/include"; then
5a162955 801 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
98a7c37b 802 else
5a162955 803 CPPFLAGS="-I${withval} ${CPPFLAGS}"
98a7c37b 804 fi
6dd05556 805 fi ]
98a7c37b 806)
807
0a15d73b 808AC_CHECK_LIB(z, deflate, ,
809 [
810 saved_CPPFLAGS="$CPPFLAGS"
811 saved_LDFLAGS="$LDFLAGS"
812 save_LIBS="$LIBS"
813 dnl Check default zlib install dir
814 if test -n "${need_dash_r}"; then
815 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
816 else
817 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
818 fi
819 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
820 LIBS="$LIBS -lz"
821 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
822 [
823 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
824 ]
825 )
826 ]
827)
4ad65809 828AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
8068d564 829
830AC_ARG_WITH(zlib-version-check,
831 [ --without-zlib-version-check Disable zlib version check],
832 [ if test "x$withval" = "xno" ; then
833 zlib_check_nonfatal=1
834 fi
835 ]
836)
837
5c7fc85d 838AC_MSG_CHECKING(for possibly buggy zlib)
479cece8 839AC_RUN_IFELSE([AC_LANG_SOURCE([[
5c7fc85d 840#include <stdio.h>
4ad65809 841#include <zlib.h>
842int main()
843{
5c7fc85d 844 int a=0, b=0, c=0, d=0, n, v;
845 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
846 if (n != 3 && n != 4)
4ad65809 847 exit(1);
5c7fc85d 848 v = a*1000000 + b*10000 + c*100 + d;
849 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
850
851 /* 1.1.4 is OK */
852 if (a == 1 && b == 1 && c >= 4)
4ad65809 853 exit(0);
5c7fc85d 854
0072b59d 855 /* 1.2.3 and up are OK */
856 if (v >= 1020300)
5c7fc85d 857 exit(0);
858
4ad65809 859 exit(2);
860}
479cece8 861 ]])],
5c7fc85d 862 AC_MSG_RESULT(no),
863 [ AC_MSG_RESULT(yes)
8068d564 864 if test -z "$zlib_check_nonfatal" ; then
865 AC_MSG_ERROR([*** zlib too old - check config.log ***
866Your reported zlib version has known security problems. It's possible your
867vendor has fixed these problems without changing the version number. If you
868are sure this is the case, you can disable the check by running
869"./configure --without-zlib-version-check".
6090bcfe 870If you are in doubt, upgrade zlib to version 1.2.3 or greater.
5c7fc85d 871See http://www.gzip.org/zlib/ for details.])
8068d564 872 else
873 AC_MSG_WARN([zlib version may have security problems])
874 fi
1a01a50c 875 ],
876 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
4ad65809 877)
48e7916f 878
2c523de9 879dnl UnixWare 2.x
aff51935 880AC_CHECK_FUNC(strcasecmp,
2c523de9 881 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
882)
23361281 883AC_CHECK_FUNCS(utimes,
cda1ebcb 884 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
885 LIBS="$LIBS -lc89"]) ]
2c523de9 886)
4cca272e 887
7c6d759d 888dnl Checks for libutil functions
889AC_CHECK_HEADERS(libutil.h)
3466e002 890AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
891 [Define if your libraries define login()])])
7c6d759d 892AC_CHECK_FUNCS(logout updwtmp logwtmp)
893
a738c3b0 894AC_FUNC_STRFTIME
895
84ceda19 896# Check for ALTDIRFUNC glob() extension
897AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
898AC_EGREP_CPP(FOUNDIT,
899 [
900 #include <glob.h>
901 #ifdef GLOB_ALTDIRFUNC
902 FOUNDIT
903 #endif
aff51935 904 ],
84ceda19 905 [
3466e002 906 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
907 [Define if your system glob() function has
908 the GLOB_ALTDIRFUNC extension])
84ceda19 909 AC_MSG_RESULT(yes)
910 ],
911 [
912 AC_MSG_RESULT(no)
913 ]
914)
4cca272e 915
40849fdb 916# Check for g.gl_matchc glob() extension
917AC_MSG_CHECKING(for gl_matchc field in glob_t)
918AC_EGREP_CPP(FOUNDIT,
aff51935 919 [
920 #include <glob.h>
40849fdb 921 int main(void){glob_t g; g.gl_matchc = 1;}
aff51935 922 ],
923 [
3466e002 924 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
925 [Define if your system glob() function has
926 gl_matchc options in glob_t])
aff51935 927 AC_MSG_RESULT(yes)
928 ],
929 [
930 AC_MSG_RESULT(no)
931 ]
40849fdb 932)
933
edbe6722 934AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1a01a50c 935AC_RUN_IFELSE(
479cece8 936 [AC_LANG_SOURCE([[
edbe6722 937#include <sys/types.h>
938#include <dirent.h>
aec4cb4f 939int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
479cece8 940 ]])],
aff51935 941 [AC_MSG_RESULT(yes)],
edbe6722 942 [
943 AC_MSG_RESULT(no)
3466e002 944 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
d08db6d1 945 [Define if your struct dirent expects you to
3466e002 946 allocate extra space for d_name])
1a01a50c 947 ],
82f4e93d 948 [
1a01a50c 949 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
950 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
edbe6722 951 ]
952)
953
419e26e7 954AC_MSG_CHECKING([for /proc/pid/fd directory])
955if test -d "/proc/$$/fd" ; then
3466e002 956 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
419e26e7 957 AC_MSG_RESULT(yes)
958else
959 AC_MSG_RESULT(no)
960fi
961
278588d8 962# Check whether user wants S/Key support
aff51935 963SKEY_MSG="no"
278588d8 964AC_ARG_WITH(skey,
6ff3d0dc 965 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
278588d8 966 [
967 if test "x$withval" != "xno" ; then
968
969 if test "x$withval" != "xyes" ; then
970 CPPFLAGS="$CPPFLAGS -I${withval}/include"
971 LDFLAGS="$LDFLAGS -L${withval}/lib"
972 fi
973
3466e002 974 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
278588d8 975 LIBS="-lskey $LIBS"
aff51935 976 SKEY_MSG="yes"
82f4e93d 977
ddceb1c8 978 AC_MSG_CHECKING([for s/key support])
b0e7249f 979 AC_LINK_IFELSE(
980 [AC_LANG_SOURCE([[
ddceb1c8 981#include <stdio.h>
982#include <skey.h>
aec4cb4f 983int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
b0e7249f 984 ]])],
ddceb1c8 985 [AC_MSG_RESULT(yes)],
278588d8 986 [
ddceb1c8 987 AC_MSG_RESULT(no)
278588d8 988 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
989 ])
141fc639 990 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
991 AC_TRY_COMPILE(
992 [#include <stdio.h>
993 #include <skey.h>],
994 [(void)skeychallenge(NULL,"name","",0);],
995 [AC_MSG_RESULT(yes)
3466e002 996 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
997 [Define if your skeychallenge()
998 function takes 4 arguments (NetBSD)])],
141fc639 999 [AC_MSG_RESULT(no)]
1000 )
278588d8 1001 fi
1002 ]
1003)
1004
1005# Check whether user wants TCP wrappers support
98a7c37b 1006TCPW_MSG="no"
278588d8 1007AC_ARG_WITH(tcp-wrappers,
6ff3d0dc 1008 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
278588d8 1009 [
1010 if test "x$withval" != "xno" ; then
1011 saved_LIBS="$LIBS"
98a7c37b 1012 saved_LDFLAGS="$LDFLAGS"
1013 saved_CPPFLAGS="$CPPFLAGS"
4b492aab 1014 if test -n "${withval}" && \
6cf0200f 1015 test "x${withval}" != "xyes"; then
98a7c37b 1016 if test -d "${withval}/lib"; then
1017 if test -n "${need_dash_r}"; then
5a162955 1018 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
98a7c37b 1019 else
5a162955 1020 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
98a7c37b 1021 fi
1022 else
1023 if test -n "${need_dash_r}"; then
5a162955 1024 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
98a7c37b 1025 else
5a162955 1026 LDFLAGS="-L${withval} ${LDFLAGS}"
98a7c37b 1027 fi
1028 fi
1029 if test -d "${withval}/include"; then
5a162955 1030 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
98a7c37b 1031 else
5a162955 1032 CPPFLAGS="-I${withval} ${CPPFLAGS}"
98a7c37b 1033 fi
98a7c37b 1034 fi
ddceb1c8 1035 LIBWRAP="-lwrap"
1036 LIBS="$LIBWRAP $LIBS"
278588d8 1037 AC_MSG_CHECKING(for libwrap)
1038 AC_TRY_LINK(
1039 [
77f09220 1040#include <sys/types.h>
1041#include <sys/socket.h>
1042#include <netinet/in.h>
278588d8 1043#include <tcpd.h>
1044 int deny_severity = 0, allow_severity = 0;
1045 ],
1046 [hosts_access(0);],
1047 [
1048 AC_MSG_RESULT(yes)
3466e002 1049 AC_DEFINE(LIBWRAP, 1,
1050 [Define if you want
1051 TCP Wrappers support])
ddceb1c8 1052 AC_SUBST(LIBWRAP)
98a7c37b 1053 TCPW_MSG="yes"
278588d8 1054 ],
1055 [
1056 AC_MSG_ERROR([*** libwrap missing])
1057 ]
1058 )
ddceb1c8 1059 LIBS="$saved_LIBS"
278588d8 1060 fi
1061 ]
1062)
1063
59031773 1064# Check whether user wants libedit support
1065LIBEDIT_MSG="no"
1066AC_ARG_WITH(libedit,
6ff3d0dc 1067 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
59031773 1068 [ if test "x$withval" != "xno" ; then
737edf04 1069 if test "x$withval" != "xyes"; then
bb116c8e 1070 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1071 if test -n "${need_dash_r}"; then
1072 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1073 else
1074 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1075 fi
737edf04 1076 fi
59031773 1077 AC_CHECK_LIB(edit, el_init,
3466e002 1078 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
59031773 1079 LIBEDIT="-ledit -lcurses"
1080 LIBEDIT_MSG="yes"
1081 AC_SUBST(LIBEDIT)
1082 ],
737edf04 1083 [ AC_MSG_ERROR(libedit not found) ],
1084 [ -lcurses ]
59031773 1085 )
f47ddccb 1086 AC_MSG_CHECKING(if libedit version is compatible)
d92622f9 1087 AC_COMPILE_IFELSE(
1088 [AC_LANG_SOURCE([[
1089#include <histedit.h>
f47ddccb 1090int main(void)
1091{
1092 int i = H_SETSIZE;
1093 el_init("", NULL, NULL, NULL);
1094 exit(0);
1095}
d92622f9 1096 ]])],
f47ddccb 1097 [ AC_MSG_RESULT(yes) ],
1098 [ AC_MSG_RESULT(no)
1099 AC_MSG_ERROR(libedit version is not compatible) ]
1100 )
59031773 1101 fi ]
1102)
1103
7b578f7d 1104AUDIT_MODULE=none
1105AC_ARG_WITH(audit,
1106 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1107 [
1108 AC_MSG_CHECKING(for supported audit module)
1109 case "$withval" in
1110 bsm)
1111 AC_MSG_RESULT(bsm)
1112 AUDIT_MODULE=bsm
1113 dnl Checks for headers, libs and functions
1114 AC_CHECK_HEADERS(bsm/audit.h, [],
1115 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1116 AC_CHECK_LIB(bsm, getaudit, [],
1117 [AC_MSG_ERROR(BSM enabled and required library not found)])
1118 AC_CHECK_FUNCS(getaudit, [],
1119 [AC_MSG_ERROR(BSM enabled and required function not found)])
1120 # These are optional
7939c496 1121 AC_CHECK_FUNCS(getaudit_addr)
3466e002 1122 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
7b578f7d 1123 ;;
1124 debug)
1125 AUDIT_MODULE=debug
1126 AC_MSG_RESULT(debug)
3466e002 1127 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
7b578f7d 1128 ;;
a2b3321d 1129 no)
d92622f9 1130 AC_MSG_RESULT(no)
a2b3321d 1131 ;;
7b578f7d 1132 *)
1133 AC_MSG_ERROR([Unknown audit module $withval])
1134 ;;
1135 esac ]
1136)
1137
19160674 1138dnl Checks for library functions. Please keep in alphabetical order
b04a9f8c 1139AC_CHECK_FUNCS( \
1140 arc4random \
9a406e1e 1141 asprintf \
b04a9f8c 1142 b64_ntop \
1143 __b64_ntop \
1144 b64_pton \
1145 __b64_pton \
1146 bcopy \
1147 bindresvport_sa \
1148 clock \
1149 closefrom \
1150 dirfd \
b04a9f8c 1151 fchmod \
1152 fchown \
1153 freeaddrinfo \
1154 futimes \
1155 getaddrinfo \
1156 getcwd \
1157 getgrouplist \
1158 getnameinfo \
1159 getopt \
1160 getpeereid \
1161 _getpty \
1162 getrlimit \
1163 getttyent \
1164 glob \
1165 inet_aton \
1166 inet_ntoa \
1167 inet_ntop \
1168 innetgr \
1169 login_getcapbool \
1170 md5_crypt \
1171 memmove \
1172 mkdtemp \
1173 mmap \
1174 ngetaddrinfo \
1175 nsleep \
1176 ogetaddrinfo \
1177 openlog_r \
1178 openpty \
1179 prctl \
1180 pstat \
1181 readpassphrase \
1182 realpath \
1183 recvmsg \
1184 rresvport_af \
1185 sendmsg \
1186 setdtablesize \
1187 setegid \
1188 setenv \
1189 seteuid \
1190 setgroups \
1191 setlogin \
1192 setpcred \
1193 setproctitle \
1194 setregid \
1195 setreuid \
1196 setrlimit \
1197 setsid \
1198 setvbuf \
1199 sigaction \
1200 sigvec \
1201 snprintf \
1202 socketpair \
1203 strdup \
1204 strerror \
1205 strlcat \
1206 strlcpy \
1207 strmode \
1208 strnvis \
1209 strtonum \
1e29a0c8 1210 strtoll \
b04a9f8c 1211 strtoul \
1212 sysconf \
1213 tcgetpgrp \
1214 truncate \
1215 unsetenv \
1216 updwtmpx \
9a406e1e 1217 vasprintf \
b04a9f8c 1218 vhangup \
1219 vsnprintf \
1220 waitpid \
19160674 1221)
98a7c37b 1222
1a086f97 1223# IRIX has a const char return value for gai_strerror()
1224AC_CHECK_FUNCS(gai_strerror,[
1225 AC_DEFINE(HAVE_GAI_STRERROR)
1226 AC_TRY_COMPILE([
1227#include <sys/types.h>
1228#include <sys/socket.h>
1229#include <netdb.h>
1230
1231const char *gai_strerror(int);],[
1232char *str;
1233
1234str = gai_strerror(0);],[
1235 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1236 [Define if gai_strerror() returns const char *])])])
1237
3466e002 1238AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1239 [Some systems put nanosleep outside of libc]))
92b1decf 1240
309709db 1241dnl Make sure prototypes are defined for these before using them.
309709db 1242AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
0957c2cf 1243AC_CHECK_DECL(strsep,
1244 [AC_CHECK_FUNCS(strsep)],
1245 [],
1246 [
1247#ifdef HAVE_STRING_H
1248# include <string.h>
1249#endif
1250 ])
08412d26 1251
3490699c 1252dnl tcsendbreak might be a macro
1253AC_CHECK_DECL(tcsendbreak,
1254 [AC_DEFINE(HAVE_TCSENDBREAK)],
aff51935 1255 [AC_CHECK_FUNCS(tcsendbreak)],
3490699c 1256 [#include <termios.h>]
1257)
1258
41e0e158 1259AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1260
3f176010 1261AC_CHECK_FUNCS(setresuid, [
1262 dnl Some platorms have setresuid that isn't implemented, test for this
1263 AC_MSG_CHECKING(if setresuid seems to work)
479cece8 1264 AC_RUN_IFELSE(
1265 [AC_LANG_SOURCE([[
9a3fe0e2 1266#include <stdlib.h>
1267#include <errno.h>
1268int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
479cece8 1269 ]])],
3f176010 1270 [AC_MSG_RESULT(yes)],
3466e002 1271 [AC_DEFINE(BROKEN_SETRESUID, 1,
1272 [Define if your setresuid() is broken])
1a01a50c 1273 AC_MSG_RESULT(not implemented)],
1274 [AC_MSG_WARN([cross compiling: not checking setresuid])]
3f176010 1275 )
1276])
9a3fe0e2 1277
3f176010 1278AC_CHECK_FUNCS(setresgid, [
1279 dnl Some platorms have setresgid that isn't implemented, test for this
1280 AC_MSG_CHECKING(if setresgid seems to work)
479cece8 1281 AC_RUN_IFELSE(
1282 [AC_LANG_SOURCE([[
9a3fe0e2 1283#include <stdlib.h>
1284#include <errno.h>
1285int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
479cece8 1286 ]])],
3f176010 1287 [AC_MSG_RESULT(yes)],
3466e002 1288 [AC_DEFINE(BROKEN_SETRESGID, 1,
1289 [Define if your setresgid() is broken])
1a01a50c 1290 AC_MSG_RESULT(not implemented)],
1291 [AC_MSG_WARN([cross compiling: not checking setresuid])]
3f176010 1292 )
1293])
9a3fe0e2 1294
2e73a022 1295dnl Checks for time functions
1d7b9b20 1296AC_CHECK_FUNCS(gettimeofday time)
2e73a022 1297dnl Checks for utmp functions
b03bd394 1298AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1d7b9b20 1299AC_CHECK_FUNCS(utmpname)
2e73a022 1300dnl Checks for utmpx functions
b03bd394 1301AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1d7b9b20 1302AC_CHECK_FUNCS(setutxent utmpxname)
76cd7316 1303
aff51935 1304AC_CHECK_FUNC(daemon,
3466e002 1305 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1306 [AC_CHECK_LIB(bsd, daemon,
1307 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
beb43d31 1308)
1309
aff51935 1310AC_CHECK_FUNC(getpagesize,
3466e002 1311 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1312 [Define if your libraries define getpagesize()])],
1313 [AC_CHECK_LIB(ucb, getpagesize,
1314 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
aa6bd60a 1315)
1316
2647ae26 1317# Check for broken snprintf
1318if test "x$ac_cv_func_snprintf" = "xyes" ; then
1319 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1a01a50c 1320 AC_RUN_IFELSE(
479cece8 1321 [AC_LANG_SOURCE([[
2647ae26 1322#include <stdio.h>
aec4cb4f 1323int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
479cece8 1324 ]])],
aff51935 1325 [AC_MSG_RESULT(yes)],
2647ae26 1326 [
1327 AC_MSG_RESULT(no)
3466e002 1328 AC_DEFINE(BROKEN_SNPRINTF, 1,
1329 [Define if your snprintf is busted])
2647ae26 1330 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1a01a50c 1331 ],
1332 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
2647ae26 1333 )
1334fi
1335
9a406e1e 1336# If we don't have a working asprintf, then we strongly depend on vsnprintf
1337# returning the right thing on overflow: the number of characters it tried to
1338# create (as per SUSv3)
1339if test "x$ac_cv_func_asprintf" != "xyes" && \
1340 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1341 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1342 AC_RUN_IFELSE(
1343 [AC_LANG_SOURCE([[
1344#include <sys/types.h>
1345#include <stdio.h>
1346#include <stdarg.h>
1347
1348int x_snprintf(char *str,size_t count,const char *fmt,...)
1349{
1350 size_t ret; va_list ap;
1351 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1352 return ret;
1353}
1354int main(void)
1355{
1356 char x[1];
1357 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1358} ]])],
1359 [AC_MSG_RESULT(yes)],
1360 [
1361 AC_MSG_RESULT(no)
1362 AC_DEFINE(BROKEN_SNPRINTF, 1,
1363 [Define if your snprintf is busted])
1364 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1365 ],
1366 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1367 )
1368fi
1369
31b0732a 1370# On systems where [v]snprintf is broken, but is declared in stdio,
1371# check that the fmt argument is const char * or just char *.
1372# This is only useful for when BROKEN_SNPRINTF
1373AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1374AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1375 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1376 int main(void) { snprintf(0, 0, 0); }
1377 ]])],
1378 [AC_MSG_RESULT(yes)
1379 AC_DEFINE(SNPRINTF_CONST, [const],
1380 [Define as const if snprintf() can declare const char *fmt])],
1381 [AC_MSG_RESULT(no)
1382 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1383
2f6f9cff 1384# Check for missing getpeereid (or equiv) support
1385NO_PEERCHECK=""
1386if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1387 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1388 AC_TRY_COMPILE(
1389 [#include <sys/types.h>
1390 #include <sys/socket.h>],
1391 [int i = SO_PEERCRED;],
62eb7db4 1392 [ AC_MSG_RESULT(yes)
3466e002 1393 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
62eb7db4 1394 ],
2f6f9cff 1395 [AC_MSG_RESULT(no)
1396 NO_PEERCHECK=1]
1397 )
1398fi
1399
70e7d0b0 1400dnl see whether mkstemp() requires XXXXXX
1401if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1402AC_MSG_CHECKING([for (overly) strict mkstemp])
b0e7249f 1403AC_RUN_IFELSE(
1404 [AC_LANG_SOURCE([[
70e7d0b0 1405#include <stdlib.h>
1406main() { char template[]="conftest.mkstemp-test";
1407if (mkstemp(template) == -1)
1408 exit(1);
1409unlink(template); exit(0);
1410}
b0e7249f 1411 ]])],
70e7d0b0 1412 [
1413 AC_MSG_RESULT(no)
1414 ],
aff51935 1415 [
70e7d0b0 1416 AC_MSG_RESULT(yes)
3466e002 1417 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
70e7d0b0 1418 ],
1419 [
1420 AC_MSG_RESULT(yes)
1421 AC_DEFINE(HAVE_STRICT_MKSTEMP)
aff51935 1422 ]
70e7d0b0 1423)
1424fi
1425
eacb954e 1426dnl make sure that openpty does not reacquire controlling terminal
1427if test ! -z "$check_for_openpty_ctty_bug"; then
1428 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
b0e7249f 1429 AC_RUN_IFELSE(
1430 [AC_LANG_SOURCE([[
eacb954e 1431#include <stdio.h>
1432#include <sys/fcntl.h>
1433#include <sys/types.h>
1434#include <sys/wait.h>
1435
1436int
1437main()
1438{
1439 pid_t pid;
1440 int fd, ptyfd, ttyfd, status;
1441
1442 pid = fork();
1443 if (pid < 0) { /* failed */
1444 exit(1);
1445 } else if (pid > 0) { /* parent */
1446 waitpid(pid, &status, 0);
aff51935 1447 if (WIFEXITED(status))
eacb954e 1448 exit(WEXITSTATUS(status));
1449 else
1450 exit(2);
1451 } else { /* child */
1452 close(0); close(1); close(2);
1453 setsid();
1454 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1455 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1456 if (fd >= 0)
1457 exit(3); /* Acquired ctty: broken */
1458 else
1459 exit(0); /* Did not acquire ctty: OK */
1460 }
1461}
b0e7249f 1462 ]])],
eacb954e 1463 [
1464 AC_MSG_RESULT(yes)
1465 ],
1466 [
1467 AC_MSG_RESULT(no)
1468 AC_DEFINE(SSHD_ACQUIRES_CTTY)
b0e7249f 1469 ],
1470 [
1471 AC_MSG_RESULT(cross-compiling, assuming yes)
eacb954e 1472 ]
1473 )
1474fi
1475
4b492aab 1476if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1477 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
2fe51906 1478 AC_MSG_CHECKING(if getaddrinfo seems to work)
b0e7249f 1479 AC_RUN_IFELSE(
1480 [AC_LANG_SOURCE([[
2fe51906 1481#include <stdio.h>
1482#include <sys/socket.h>
1483#include <netdb.h>
1484#include <errno.h>
1485#include <netinet/in.h>
1486
1487#define TEST_PORT "2222"
1488
1489int
1490main(void)
1491{
1492 int err, sock;
1493 struct addrinfo *gai_ai, *ai, hints;
1494 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1495
1496 memset(&hints, 0, sizeof(hints));
1497 hints.ai_family = PF_UNSPEC;
1498 hints.ai_socktype = SOCK_STREAM;
1499 hints.ai_flags = AI_PASSIVE;
1500
1501 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1502 if (err != 0) {
1503 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1504 exit(1);
1505 }
1506
1507 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1508 if (ai->ai_family != AF_INET6)
1509 continue;
1510
1511 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1512 sizeof(ntop), strport, sizeof(strport),
1513 NI_NUMERICHOST|NI_NUMERICSERV);
1514
1515 if (err != 0) {
1516 if (err == EAI_SYSTEM)
1517 perror("getnameinfo EAI_SYSTEM");
1518 else
1519 fprintf(stderr, "getnameinfo failed: %s\n",
1520 gai_strerror(err));
1521 exit(2);
1522 }
1523
1524 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1525 if (sock < 0)
1526 perror("socket");
1527 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1528 if (errno == EBADF)
1529 exit(3);
1530 }
1531 }
1532 exit(0);
1533}
b0e7249f 1534 ]])],
2fe51906 1535 [
1536 AC_MSG_RESULT(yes)
1537 ],
1538 [
1539 AC_MSG_RESULT(no)
1540 AC_DEFINE(BROKEN_GETADDRINFO)
b0e7249f 1541 ],
1542 [
1543 AC_MSG_RESULT(cross-compiling, assuming yes)
2fe51906 1544 ]
1545 )
1546fi
1547
4b492aab 1548if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1549 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
5ccf88cb 1550 AC_MSG_CHECKING(if getaddrinfo seems to work)
b0e7249f 1551 AC_RUN_IFELSE(
1552 [AC_LANG_SOURCE([[
5ccf88cb 1553#include <stdio.h>
1554#include <sys/socket.h>
1555#include <netdb.h>
1556#include <errno.h>
1557#include <netinet/in.h>
1558
1559#define TEST_PORT "2222"
1560
1561int
1562main(void)
1563{
1564 int err, sock;
1565 struct addrinfo *gai_ai, *ai, hints;
1566 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1567
1568 memset(&hints, 0, sizeof(hints));
1569 hints.ai_family = PF_UNSPEC;
1570 hints.ai_socktype = SOCK_STREAM;
1571 hints.ai_flags = AI_PASSIVE;
1572
1573 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1574 if (err != 0) {
1575 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1576 exit(1);
1577 }
1578
1579 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1580 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1581 continue;
1582
1583 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1584 sizeof(ntop), strport, sizeof(strport),
1585 NI_NUMERICHOST|NI_NUMERICSERV);
1586
1587 if (ai->ai_family == AF_INET && err != 0) {
1588 perror("getnameinfo");
1589 exit(2);
1590 }
1591 }
1592 exit(0);
1593}
b0e7249f 1594 ]])],
5ccf88cb 1595 [
1596 AC_MSG_RESULT(yes)
3466e002 1597 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1598 [Define if you have a getaddrinfo that fails
1599 for the all-zeros IPv6 address])
5ccf88cb 1600 ],
1601 [
1602 AC_MSG_RESULT(no)
1603 AC_DEFINE(BROKEN_GETADDRINFO)
b0e7249f 1604 ],
1605 AC_MSG_RESULT(cross-compiling, assuming no)
5ccf88cb 1606 ]
1607 )
1608fi
1609
b29fd59f 1610if test "x$check_for_conflicting_getspnam" = "x1"; then
1611 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1612 AC_COMPILE_IFELSE(
1613 [
1614#include <shadow.h>
1615int main(void) {exit(0);}
1616 ],
1617 [
1618 AC_MSG_RESULT(no)
1619 ],
1620 [
1621 AC_MSG_RESULT(yes)
1622 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1623 [Conflicting defs for getspnam])
1624 ]
1625 )
1626fi
1627
7f8f5e00 1628AC_FUNC_GETPGRP
1629
717057b6 1630# Check for PAM libs
cbd7492e 1631PAM_MSG="no"
a0391976 1632AC_ARG_WITH(pam,
717057b6 1633 [ --with-pam Enable PAM support ],
a0391976 1634 [
717057b6 1635 if test "x$withval" != "xno" ; then
2511d104 1636 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1637 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
717057b6 1638 AC_MSG_ERROR([PAM headers not found])
1639 fi
a0391976 1640
717057b6 1641 AC_CHECK_LIB(dl, dlopen, , )
1642 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1643 AC_CHECK_FUNCS(pam_getenvlist)
749560dd 1644 AC_CHECK_FUNCS(pam_putenv)
2b763e31 1645
717057b6 1646 PAM_MSG="yes"
4cb5ffa0 1647
3466e002 1648 AC_DEFINE(USE_PAM, 1,
1649 [Define if you want to enable PAM support])
98f2d9d5 1650 if test $ac_cv_lib_dl_dlopen = yes; then
1651 LIBPAM="-lpam -ldl"
1652 else
1653 LIBPAM="-lpam"
1654 fi
1655 AC_SUBST(LIBPAM)
717057b6 1656 fi
1657 ]
1658)
cbd7492e 1659
717057b6 1660# Check for older PAM
1661if test "x$PAM_MSG" = "xyes" ; then
a0391976 1662 # Check PAM strerror arguments (old PAM)
1663 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1664 AC_TRY_COMPILE(
1665 [
18ba2aab 1666#include <stdlib.h>
2511d104 1667#if defined(HAVE_SECURITY_PAM_APPL_H)
18ba2aab 1668#include <security/pam_appl.h>
2511d104 1669#elif defined (HAVE_PAM_PAM_APPL_H)
1670#include <pam/pam_appl.h>
1671#endif
aff51935 1672 ],
1673 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
a0391976 1674 [AC_MSG_RESULT(no)],
1675 [
3466e002 1676 AC_DEFINE(HAVE_OLD_PAM, 1,
1677 [Define if you have an old version of PAM
1678 which takes only one argument to pam_strerror])
a0391976 1679 AC_MSG_RESULT(yes)
cbd7492e 1680 PAM_MSG="yes (old library)"
a0391976 1681 ]
717057b6 1682 )
a0391976 1683fi
1684
5b991353 1685# Search for OpenSSL
1686saved_CPPFLAGS="$CPPFLAGS"
1687saved_LDFLAGS="$LDFLAGS"
a0391976 1688AC_ARG_WITH(ssl-dir,
1689 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1690 [
e9e4a1c7 1691 if test "x$withval" != "xno" ; then
99eb0f64 1692 case "$withval" in
1693 # Relative paths
1694 ./*|../*) withval="`pwd`/$withval"
1695 esac
5b991353 1696 if test -d "$withval/lib"; then
1697 if test -n "${need_dash_r}"; then
1698 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1699 else
1700 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
d6f13fbb 1701 fi
1702 else
5b991353 1703 if test -n "${need_dash_r}"; then
1704 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1705 else
1706 LDFLAGS="-L${withval} ${LDFLAGS}"
d6f13fbb 1707 fi
1708 fi
5b991353 1709 if test -d "$withval/include"; then
1710 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
d6f13fbb 1711 else
5b991353 1712 CPPFLAGS="-I${withval} ${CPPFLAGS}"
58d100bf 1713 fi
a0391976 1714 fi
5b991353 1715 ]
1716)
5486a457 1717LIBS="-lcrypto $LIBS"
3466e002 1718AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1719 [Define if your ssl headers are included
1720 with #include <openssl/header.h>]),
d45e3d76 1721 [
5b991353 1722 dnl Check default openssl install dir
1723 if test -n "${need_dash_r}"; then
1724 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
d45e3d76 1725 else
5b991353 1726 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
d45e3d76 1727 fi
5b991353 1728 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1729 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1730 [
1731 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1732 ]
1733 )
1734 ]
1735)
1736
cd018561 1737# Determine OpenSSL header version
1738AC_MSG_CHECKING([OpenSSL header version])
1a01a50c 1739AC_RUN_IFELSE(
479cece8 1740 [AC_LANG_SOURCE([[
cd018561 1741#include <stdio.h>
1742#include <string.h>
1743#include <openssl/opensslv.h>
1744#define DATA "conftest.sslincver"
1745int main(void) {
aff51935 1746 FILE *fd;
1747 int rc;
cd018561 1748
aff51935 1749 fd = fopen(DATA,"w");
1750 if(fd == NULL)
1751 exit(1);
cd018561 1752
1753 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1754 exit(1);
1755
1756 exit(0);
1757}
479cece8 1758 ]])],
cd018561 1759 [
1760 ssl_header_ver=`cat conftest.sslincver`
1761 AC_MSG_RESULT($ssl_header_ver)
1762 ],
1763 [
1764 AC_MSG_RESULT(not found)
1765 AC_MSG_ERROR(OpenSSL version header not found.)
1a01a50c 1766 ],
1767 [
1768 AC_MSG_WARN([cross compiling: not checking])
cd018561 1769 ]
1770)
1771
1772# Determine OpenSSL library version
1773AC_MSG_CHECKING([OpenSSL library version])
1a01a50c 1774AC_RUN_IFELSE(
479cece8 1775 [AC_LANG_SOURCE([[
cd018561 1776#include <stdio.h>
1777#include <string.h>
1778#include <openssl/opensslv.h>
1779#include <openssl/crypto.h>
1780#define DATA "conftest.ssllibver"
1781int main(void) {
aff51935 1782 FILE *fd;
1783 int rc;
cd018561 1784
aff51935 1785 fd = fopen(DATA,"w");
1786 if(fd == NULL)
1787 exit(1);
cd018561 1788
1789 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1790 exit(1);
1791
1792 exit(0);
1793}
479cece8 1794 ]])],
cd018561 1795 [
1796 ssl_library_ver=`cat conftest.ssllibver`
1797 AC_MSG_RESULT($ssl_library_ver)
1798 ],
1799 [
1800 AC_MSG_RESULT(not found)
1801 AC_MSG_ERROR(OpenSSL library not found.)
1a01a50c 1802 ],
1803 [
1804 AC_MSG_WARN([cross compiling: not checking])
cd018561 1805 ]
1806)
58d100bf 1807
9780116c 1808# Sanity check OpenSSL headers
1809AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1a01a50c 1810AC_RUN_IFELSE(
479cece8 1811 [AC_LANG_SOURCE([[
9780116c 1812#include <string.h>
1813#include <openssl/opensslv.h>
aec4cb4f 1814int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
479cece8 1815 ]])],
9780116c 1816 [
1817 AC_MSG_RESULT(yes)
1818 ],
1819 [
1820 AC_MSG_RESULT(no)
e15ba28b 1821 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1822Check config.log for details.
1823Also see contrib/findssl.sh for help identifying header/library mismatches.])
1a01a50c 1824 ],
1825 [
1826 AC_MSG_WARN([cross compiling: not checking])
9780116c 1827 ]
1828)
1829
e5146707 1830# Check for OpenSSL without EVP_aes_{192,256}_cbc
1831AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1832AC_COMPILE_IFELSE(
1833 [AC_LANG_SOURCE([[
1834#include <string.h>
1835#include <openssl/evp.h>
300ea548 1836int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
e5146707 1837 ]])],
1838 [
1839 AC_MSG_RESULT(no)
1840 ],
1841 [
1842 AC_MSG_RESULT(yes)
1843 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1844 [libcrypto is missing AES 192 and 256 bit functions])
1845 ]
1846)
1847
5486a457 1848# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1849# because the system crypt() is more featureful.
1850if test "x$check_for_libcrypt_before" = "x1"; then
1851 AC_CHECK_LIB(crypt, crypt)
1852fi
1853
aff51935 1854# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
8087c5ee 1855# version in OpenSSL.
05114c74 1856if test "x$check_for_libcrypt_later" = "x1"; then
20cad736 1857 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
717057b6 1858fi
1859
4c653d8e 1860AC_CHECK_LIB(iaf, ia_openinfo)
f1b0ecc3 1861
1862### Configure cryptographic random number support
1863
1864# Check wheter OpenSSL seeds itself
1865AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1a01a50c 1866AC_RUN_IFELSE(
479cece8 1867 [AC_LANG_SOURCE([[
f1b0ecc3 1868#include <string.h>
1869#include <openssl/rand.h>
aec4cb4f 1870int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
479cece8 1871 ]])],
f1b0ecc3 1872 [
1873 OPENSSL_SEEDS_ITSELF=yes
1874 AC_MSG_RESULT(yes)
1875 ],
1876 [
1877 AC_MSG_RESULT(no)
1878 # Default to use of the rand helper if OpenSSL doesn't
1879 # seed itself
1880 USE_RAND_HELPER=yes
1a01a50c 1881 ],
1882 [
1883 AC_MSG_WARN([cross compiling: assuming yes])
1884 # This is safe, since all recent OpenSSL versions will
82f4e93d 1885 # complain at runtime if not seeded correctly.
1a01a50c 1886 OPENSSL_SEEDS_ITSELF=yes
f1b0ecc3 1887 ]
1888)
1889
1890
1891# Do we want to force the use of the rand helper?
1892AC_ARG_WITH(rand-helper,
1893 [ --with-rand-helper Use subprocess to gather strong randomness ],
1894 [
1895 if test "x$withval" = "xno" ; then
aff51935 1896 # Force use of OpenSSL's internal RNG, even if
f1b0ecc3 1897 # the previous test showed it to be unseeded.
1898 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1899 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1900 OPENSSL_SEEDS_ITSELF=yes
1901 USE_RAND_HELPER=""
1902 fi
1903 else
1904 USE_RAND_HELPER=yes
1905 fi
1906 ],
82f4e93d 1907)
f1b0ecc3 1908
1909# Which randomness source do we use?
4b492aab 1910if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
f1b0ecc3 1911 # OpenSSL only
3466e002 1912 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1913 [Define if you want OpenSSL's internally seeded PRNG only])
f1b0ecc3 1914 RAND_MSG="OpenSSL internal ONLY"
1915 INSTALL_SSH_RAND_HELPER=""
70e2f2f3 1916elif test ! -z "$USE_RAND_HELPER" ; then
1917 # install rand helper
f1b0ecc3 1918 RAND_MSG="ssh-rand-helper"
1919 INSTALL_SSH_RAND_HELPER="yes"
1920fi
1921AC_SUBST(INSTALL_SSH_RAND_HELPER)
1922
1923### Configuration of ssh-rand-helper
1924
1925# PRNGD TCP socket
1926AC_ARG_WITH(prngd-port,
1927 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1928 [
eb5d7ff6 1929 case "$withval" in
1930 no)
1931 withval=""
1932 ;;
1933 [[0-9]]*)
1934 ;;
1935 *)
1936 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1937 ;;
1938 esac
1939 if test ! -z "$withval" ; then
f1b0ecc3 1940 PRNGD_PORT="$withval"
3466e002 1941 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1942 [Port number of PRNGD/EGD random number socket])
f1b0ecc3 1943 fi
1944 ]
1945)
1946
1947# PRNGD Unix domain socket
1948AC_ARG_WITH(prngd-socket,
1949 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1950 [
eb5d7ff6 1951 case "$withval" in
1952 yes)
f1b0ecc3 1953 withval="/var/run/egd-pool"
eb5d7ff6 1954 ;;
1955 no)
1956 withval=""
1957 ;;
1958 /*)
1959 ;;
1960 *)
1961 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1962 ;;
1963 esac
1964
1965 if test ! -z "$withval" ; then
f1b0ecc3 1966 if test ! -z "$PRNGD_PORT" ; then
1967 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1968 fi
906e811b 1969 if test ! -r "$withval" ; then
f1b0ecc3 1970 AC_MSG_WARN(Entropy socket is not readable)
1971 fi
1972 PRNGD_SOCKET="$withval"
3466e002 1973 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1974 [Location of PRNGD/EGD random number socket])
f1b0ecc3 1975 fi
ddceb1c8 1976 ],
1977 [
1978 # Check for existing socket only if we don't have a random device already
1979 if test "$USE_RAND_HELPER" = yes ; then
1980 AC_MSG_CHECKING(for PRNGD/EGD socket)
1981 # Insert other locations here
1982 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1983 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1984 PRNGD_SOCKET="$sock"
1985 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1986 break;
1987 fi
1988 done
1989 if test ! -z "$PRNGD_SOCKET" ; then
1990 AC_MSG_RESULT($PRNGD_SOCKET)
1991 else
1992 AC_MSG_RESULT(not found)
1993 fi
1994 fi
f1b0ecc3 1995 ]
1996)
1997
1998# Change default command timeout for hashing entropy source
1999entropy_timeout=200
2000AC_ARG_WITH(entropy-timeout,
2001 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2002 [
6cf0200f 2003 if test -n "$withval" && test "x$withval" != "xno" && \
2004 test "x${withval}" != "xyes"; then
f1b0ecc3 2005 entropy_timeout=$withval
2006 fi
82f4e93d 2007 ]
f1b0ecc3 2008)
3466e002 2009AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2010 [Builtin PRNG command timeout])
f1b0ecc3 2011
fd3cbf67 2012SSH_PRIVSEP_USER=sshd
9a0fbcb3 2013AC_ARG_WITH(privsep-user,
5222e7ef 2014 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
9a0fbcb3 2015 [
6cf0200f 2016 if test -n "$withval" && test "x$withval" != "xno" && \
2017 test "x${withval}" != "xyes"; then
fd3cbf67 2018 SSH_PRIVSEP_USER=$withval
9a0fbcb3 2019 fi
82f4e93d 2020 ]
9a0fbcb3 2021)
3466e002 2022AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2023 [non-privileged user for privilege separation])
fd3cbf67 2024AC_SUBST(SSH_PRIVSEP_USER)
9a0fbcb3 2025
81dadca3 2026# We do this little dance with the search path to insure
2027# that programs that we select for use by installed programs
2028# (which may be run by the super-user) come from trusted
2029# locations before they come from the user's private area.
2030# This should help avoid accidentally configuring some
2031# random version of a program in someone's personal bin.
2032
2033OPATH=$PATH
2034PATH=/bin:/usr/bin
f95c8ce8 2035test -h /bin 2> /dev/null && PATH=/usr/bin
81dadca3 2036test -d /sbin && PATH=$PATH:/sbin
2037test -d /usr/sbin && PATH=$PATH:/usr/sbin
2038PATH=$PATH:/etc:$OPATH
2039
aff51935 2040# These programs are used by the command hashing source to gather entropy
f1b0ecc3 2041OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2042OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2043OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2044OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2045OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2046OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2047OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2048OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2049OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2050OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2051OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2052OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2053OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2054OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2055OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2056OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
81dadca3 2057# restore PATH
2058PATH=$OPATH
f1b0ecc3 2059
2060# Where does ssh-rand-helper get its randomness from?
2061INSTALL_SSH_PRNG_CMDS=""
2062if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2063 if test ! -z "$PRNGD_PORT" ; then
2064 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2065 elif test ! -z "$PRNGD_SOCKET" ; then
2066 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2067 else
2068 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2069 RAND_HELPER_CMDHASH=yes
2070 INSTALL_SSH_PRNG_CMDS="yes"
2071 fi
2072fi
2073AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2074
2075
66d6c27e 2076# Cheap hack to ensure NEWS-OS libraries are arranged right.
2077if test ! -z "$SONY" ; then
2078 LIBS="$LIBS -liberty";
2079fi
2080
9a406e1e 2081# Check for long long datatypes
2082AC_CHECK_TYPES([long long, unsigned long long, long double])
2083
2084# Check datatype sizes
976f7e19 2085AC_CHECK_SIZEOF(char, 1)
2b942fe0 2086AC_CHECK_SIZEOF(short int, 2)
2087AC_CHECK_SIZEOF(int, 4)
2088AC_CHECK_SIZEOF(long int, 4)
2089AC_CHECK_SIZEOF(long long int, 8)
2090
52f1ccb2 2091# Sanity check long long for some platforms (AIX)
2092if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2093 ac_cv_sizeof_long_long_int=0
2094fi
2095
90f15776 2096# compute LLONG_MIN and LLONG_MAX if we don't know them.
2097if test -z "$have_llong_max"; then
2098 AC_MSG_CHECKING([for max value of long long])
2099 AC_RUN_IFELSE(
2100 [AC_LANG_SOURCE([[
2101#include <stdio.h>
2102/* Why is this so damn hard? */
2103#ifdef __GNUC__
2104# undef __GNUC__
2105#endif
2106#define __USE_ISOC99
2107#include <limits.h>
2108#define DATA "conftest.llminmax"
2109int main(void) {
2110 FILE *f;
2111 long long i, llmin, llmax = 0;
2112
2113 if((f = fopen(DATA,"w")) == NULL)
2114 exit(1);
2115
2116#if defined(LLONG_MIN) && defined(LLONG_MAX)
2117 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2118 llmin = LLONG_MIN;
2119 llmax = LLONG_MAX;
2120#else
2121 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2122 /* This will work on one's complement and two's complement */
2123 for (i = 1; i > llmax; i <<= 1, i++)
2124 llmax = i;
2125 llmin = llmax + 1LL; /* wrap */
2126#endif
2127
2128 /* Sanity check */
2129 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2130 || llmax - 1 > llmax) {
2131 fprintf(f, "unknown unknown\n");
2132 exit(2);
2133 }
2134
2135 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2136 exit(3);
2137
2138 exit(0);
2139}
2140 ]])],
2141 [
2142 llong_min=`$AWK '{print $1}' conftest.llminmax`
2143 llong_max=`$AWK '{print $2}' conftest.llminmax`
2144
2145 # snprintf on some Tru64s doesn't understand "%lld"
2146 case "$host" in
2147 alpha-dec-osf*)
2148 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2149 test "x$llong_max" = "xld"; then
2150 llong_min="-9223372036854775808"
2151 llong_max="9223372036854775807"
2152 fi
2153 ;;
2154 esac
2155
2156 AC_MSG_RESULT($llong_max)
2157 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2158 [max value of long long calculated by configure])
2159 AC_MSG_CHECKING([for min value of long long])
2160 AC_MSG_RESULT($llong_min)
2161 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2162 [min value of long long calculated by configure])
2163 ],
2164 [
2165 AC_MSG_RESULT(not found)
2166 ],
2167 [
2168 AC_MSG_WARN([cross compiling: not checking])
2169 ]
2170 )
2171fi
2172
2173
a0391976 2174# More checks for data types
14a9a859 2175AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2176 AC_TRY_COMPILE(
aff51935 2177 [ #include <sys/types.h> ],
2178 [ u_int a; a = 1;],
14a9a859 2179 [ ac_cv_have_u_int="yes" ],
2180 [ ac_cv_have_u_int="no" ]
2181 )
2182])
2183if test "x$ac_cv_have_u_int" = "xyes" ; then
3466e002 2184 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
14a9a859 2185 have_u_int=1
2186fi
2187
58d100bf 2188AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2189 AC_TRY_COMPILE(
aff51935 2190 [ #include <sys/types.h> ],
2191 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
58d100bf 2192 [ ac_cv_have_intxx_t="yes" ],
2193 [ ac_cv_have_intxx_t="no" ]
2194 )
2195])
2196if test "x$ac_cv_have_intxx_t" = "xyes" ; then
3466e002 2197 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
58d100bf 2198 have_intxx_t=1
2199fi
41cb4569 2200
2201if (test -z "$have_intxx_t" && \
aff51935 2202 test "x$ac_cv_header_stdint_h" = "xyes")
41cb4569 2203then
2204 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2205 AC_TRY_COMPILE(
aff51935 2206 [ #include <stdint.h> ],
2207 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
41cb4569 2208 [
2209 AC_DEFINE(HAVE_INTXX_T)
2210 AC_MSG_RESULT(yes)
2211 ],
2212 [ AC_MSG_RESULT(no) ]
2213 )
2214fi
2215
bd590612 2216AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2217 AC_TRY_COMPILE(
1cbbe6c8 2218 [
2219#include <sys/types.h>
2220#ifdef HAVE_STDINT_H
2221# include <stdint.h>
2222#endif
2223#include <sys/socket.h>
2224#ifdef HAVE_SYS_BITYPES_H
2225# include <sys/bitypes.h>
2226#endif
aff51935 2227 ],
2228 [ int64_t a; a = 1;],
bd590612 2229 [ ac_cv_have_int64_t="yes" ],
2230 [ ac_cv_have_int64_t="no" ]
2231 )
2232])
2233if test "x$ac_cv_have_int64_t" = "xyes" ; then
3466e002 2234 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
ddceb1c8 2235fi
2236
58d100bf 2237AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2238 AC_TRY_COMPILE(
aff51935 2239 [ #include <sys/types.h> ],
2240 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
58d100bf 2241 [ ac_cv_have_u_intxx_t="yes" ],
2242 [ ac_cv_have_u_intxx_t="no" ]
2243 )
2244])
2245if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
3466e002 2246 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
58d100bf 2247 have_u_intxx_t=1
2248fi
2b942fe0 2249
41cb4569 2250if test -z "$have_u_intxx_t" ; then
2251 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2252 AC_TRY_COMPILE(
aff51935 2253 [ #include <sys/socket.h> ],
2254 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
41cb4569 2255 [
2256 AC_DEFINE(HAVE_U_INTXX_T)
2257 AC_MSG_RESULT(yes)
2258 ],
2259 [ AC_MSG_RESULT(no) ]
2260 )
2261fi
2262
bd590612 2263AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2264 AC_TRY_COMPILE(
aff51935 2265 [ #include <sys/types.h> ],
2266 [ u_int64_t a; a = 1;],
bd590612 2267 [ ac_cv_have_u_int64_t="yes" ],
2268 [ ac_cv_have_u_int64_t="no" ]
2269 )
2270])
2271if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
3466e002 2272 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
bd590612 2273 have_u_int64_t=1
2274fi
2275
ddceb1c8 2276if test -z "$have_u_int64_t" ; then
2277 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2278 AC_TRY_COMPILE(
aff51935 2279 [ #include <sys/bitypes.h> ],
ddceb1c8 2280 [ u_int64_t a; a = 1],
2281 [
2282 AC_DEFINE(HAVE_U_INT64_T)
2283 AC_MSG_RESULT(yes)
2284 ],
2285 [ AC_MSG_RESULT(no) ]
2286 )
2287fi
2288
41cb4569 2289if test -z "$have_u_intxx_t" ; then
2290 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2291 AC_TRY_COMPILE(
2292 [
2293#include <sys/types.h>
aff51935 2294 ],
2295 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
41cb4569 2296 [ ac_cv_have_uintxx_t="yes" ],
2297 [ ac_cv_have_uintxx_t="no" ]
2298 )
2299 ])
2300 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
3466e002 2301 AC_DEFINE(HAVE_UINTXX_T, 1,
2302 [define if you have uintxx_t data type])
41cb4569 2303 fi
2304fi
2305
2306if test -z "$have_uintxx_t" ; then
2307 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2308 AC_TRY_COMPILE(
aff51935 2309 [ #include <stdint.h> ],
2310 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
41cb4569 2311 [
2312 AC_DEFINE(HAVE_UINTXX_T)
2313 AC_MSG_RESULT(yes)
2314 ],
2315 [ AC_MSG_RESULT(no) ]
2316 )
2317fi
2318
e5fe9a1f 2319if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
aff51935 2320 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
5cdfe03f 2321then
2322 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2323 AC_TRY_COMPILE(
58d100bf 2324 [
2325#include <sys/bitypes.h>
aff51935 2326 ],
5cdfe03f 2327 [
837c30b8 2328 int8_t a; int16_t b; int32_t c;
2329 u_int8_t e; u_int16_t f; u_int32_t g;
2330 a = b = c = e = f = g = 1;
aff51935 2331 ],
5cdfe03f 2332 [
2333 AC_DEFINE(HAVE_U_INTXX_T)
2334 AC_DEFINE(HAVE_INTXX_T)
2335 AC_MSG_RESULT(yes)
2336 ],
2337 [AC_MSG_RESULT(no)]
aff51935 2338 )
5cdfe03f 2339fi
2340
0362750e 2341
2342AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2343 AC_TRY_COMPILE(
2344 [
2345#include <sys/types.h>
2346 ],
2347 [ u_char foo; foo = 125; ],
2348 [ ac_cv_have_u_char="yes" ],
2349 [ ac_cv_have_u_char="no" ]
2350 )
2351])
2352if test "x$ac_cv_have_u_char" = "xyes" ; then
3466e002 2353 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
0362750e 2354fi
2355
98a7c37b 2356TYPE_SOCKLEN_T
2b942fe0 2357
2d16d9a3 2358AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
ddceb1c8 2359
777ece68 2360AC_CHECK_TYPES(in_addr_t,,,
2361[#include <sys/types.h>
2362#include <netinet/in.h>])
7b578f7d 2363
58d100bf 2364AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2365 AC_TRY_COMPILE(
2366 [
18ba2aab 2367#include <sys/types.h>
58d100bf 2368 ],
2369 [ size_t foo; foo = 1235; ],
2370 [ ac_cv_have_size_t="yes" ],
2371 [ ac_cv_have_size_t="no" ]
2372 )
2373])
2374if test "x$ac_cv_have_size_t" = "xyes" ; then
3466e002 2375 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
58d100bf 2376fi
ea1970a3 2377
c04f75f1 2378AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2379 AC_TRY_COMPILE(
2380 [
2381#include <sys/types.h>
2382 ],
2383 [ ssize_t foo; foo = 1235; ],
2384 [ ac_cv_have_ssize_t="yes" ],
2385 [ ac_cv_have_ssize_t="no" ]
2386 )
2387])
2388if test "x$ac_cv_have_ssize_t" = "xyes" ; then
3466e002 2389 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
c04f75f1 2390fi
2391
f1c4659d 2392AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2393 AC_TRY_COMPILE(
2394 [
2395#include <time.h>
2396 ],
2397 [ clock_t foo; foo = 1235; ],
2398 [ ac_cv_have_clock_t="yes" ],
2399 [ ac_cv_have_clock_t="no" ]
2400 )
2401])
2402if test "x$ac_cv_have_clock_t" = "xyes" ; then
3466e002 2403 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
f1c4659d 2404fi
2405
1c04b088 2406AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2407 AC_TRY_COMPILE(
2408 [
2409#include <sys/types.h>
2410#include <sys/socket.h>
2411 ],
2412 [ sa_family_t foo; foo = 1235; ],
2413 [ ac_cv_have_sa_family_t="yes" ],
77bb0bca 2414 [ AC_TRY_COMPILE(
2415 [
2416#include <sys/types.h>
2417#include <sys/socket.h>
2418#include <netinet/in.h>
2419 ],
2420 [ sa_family_t foo; foo = 1235; ],
2421 [ ac_cv_have_sa_family_t="yes" ],
2422
1c04b088 2423 [ ac_cv_have_sa_family_t="no" ]
77bb0bca 2424 )]
1c04b088 2425 )
2426])
2427if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
3466e002 2428 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2429 [define if you have sa_family_t data type])
1c04b088 2430fi
2431
729bfe59 2432AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2433 AC_TRY_COMPILE(
2434 [
2435#include <sys/types.h>
2436 ],
2437 [ pid_t foo; foo = 1235; ],
2438 [ ac_cv_have_pid_t="yes" ],
2439 [ ac_cv_have_pid_t="no" ]
2440 )
2441])
2442if test "x$ac_cv_have_pid_t" = "xyes" ; then
3466e002 2443 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
729bfe59 2444fi
2445
2446AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2447 AC_TRY_COMPILE(
2448 [
2449#include <sys/types.h>
2450 ],
2451 [ mode_t foo; foo = 1235; ],
2452 [ ac_cv_have_mode_t="yes" ],
2453 [ ac_cv_have_mode_t="no" ]
2454 )
2455])
2456if test "x$ac_cv_have_mode_t" = "xyes" ; then
3466e002 2457 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
729bfe59 2458fi
2459
e3a93db0 2460
58d100bf 2461AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2462 AC_TRY_COMPILE(
2463 [
18ba2aab 2464#include <sys/types.h>
2465#include <sys/socket.h>
58d100bf 2466 ],
2467 [ struct sockaddr_storage s; ],
2468 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2469 [ ac_cv_have_struct_sockaddr_storage="no" ]
2470 )
2471])
2472if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
3466e002 2473 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2474 [define if you have struct sockaddr_storage data type])
58d100bf 2475fi
48e671d5 2476
58d100bf 2477AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2478 AC_TRY_COMPILE(
2479 [
cbd7492e 2480#include <sys/types.h>
58d100bf 2481#include <netinet/in.h>
2482 ],
2483 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2484 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2485 [ ac_cv_have_struct_sockaddr_in6="no" ]
2486 )
2487])
2488if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
3466e002 2489 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2490 [define if you have struct sockaddr_in6 data type])
58d100bf 2491fi
48e671d5 2492
58d100bf 2493AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2494 AC_TRY_COMPILE(
2495 [
cbd7492e 2496#include <sys/types.h>
58d100bf 2497#include <netinet/in.h>
2498 ],
2499 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2500 [ ac_cv_have_struct_in6_addr="yes" ],
2501 [ ac_cv_have_struct_in6_addr="no" ]
2502 )
2503])
2504if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
3466e002 2505 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2506 [define if you have struct in6_addr data type])
58d100bf 2507fi
48e671d5 2508
58d100bf 2509AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2510 AC_TRY_COMPILE(
2511 [
18ba2aab 2512#include <sys/types.h>
2513#include <sys/socket.h>
2514#include <netdb.h>
58d100bf 2515 ],
2516 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2517 [ ac_cv_have_struct_addrinfo="yes" ],
2518 [ ac_cv_have_struct_addrinfo="no" ]
2519 )
2520])
2521if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
3466e002 2522 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2523 [define if you have struct addrinfo data type])
58d100bf 2524fi
2525
89c7e31c 2526AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2527 AC_TRY_COMPILE(
aff51935 2528 [ #include <sys/time.h> ],
2529 [ struct timeval tv; tv.tv_sec = 1;],
89c7e31c 2530 [ ac_cv_have_struct_timeval="yes" ],
2531 [ ac_cv_have_struct_timeval="no" ]
2532 )
2533])
2534if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
3466e002 2535 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
89c7e31c 2536 have_struct_timeval=1
2537fi
2538
5271b55c 2539AC_CHECK_TYPES(struct timespec)
2540
85abc74b 2541# We need int64_t or else certian parts of the compile will fail.
4b492aab 2542if test "x$ac_cv_have_int64_t" = "xno" && \
2543 test "x$ac_cv_sizeof_long_int" != "x8" && \
2544 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
85abc74b 2545 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2546 echo "an alternative compiler (I.E., GCC) before continuing."
2547 echo ""
2548 exit 1;
733cf7f4 2549else
2550dnl test snprintf (broken on SCO w/gcc)
1a01a50c 2551 AC_RUN_IFELSE(
479cece8 2552 [AC_LANG_SOURCE([[
733cf7f4 2553#include <stdio.h>
2554#include <string.h>
2555#ifdef HAVE_SNPRINTF
2556main()
2557{
2558 char buf[50];
2559 char expected_out[50];
2560 int mazsize = 50 ;
2561#if (SIZEOF_LONG_INT == 8)
2562 long int num = 0x7fffffffffffffff;
2563#else
763a1a18 2564 long long num = 0x7fffffffffffffffll;
733cf7f4 2565#endif
2566 strcpy(expected_out, "9223372036854775807");
2567 snprintf(buf, mazsize, "%lld", num);
2568 if(strcmp(buf, expected_out) != 0)
aff51935 2569 exit(1);
733cf7f4 2570 exit(0);
2571}
2572#else
2573main() { exit(0); }
2574#endif
479cece8 2575 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
1a01a50c 2576 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
733cf7f4 2577 )
2c523de9 2578fi
2579
77bb0bca 2580dnl Checks for structure members
58d100bf 2581OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2582OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2583OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2584OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2585OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
25422c70 2586OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
58d100bf 2587OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2588OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
daaff4d5 2589OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
58d100bf 2590OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2591OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2592OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2593OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1d7b9b20 2594OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2595OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2596OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2597OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
98a7c37b 2598
2599AC_CHECK_MEMBERS([struct stat.st_blksize])
ccc45ee0 2600AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2601 [Define if we don't have struct __res_state in resolv.h])],
2602[
2603#include <stdio.h>
2604#if HAVE_SYS_TYPES_H
2605# include <sys/types.h>
2606#endif
2607#include <netinet/in.h>
2608#include <arpa/nameser.h>
2609#include <resolv.h>
2610])
1d7b9b20 2611
58d100bf 2612AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2613 ac_cv_have_ss_family_in_struct_ss, [
2614 AC_TRY_COMPILE(
2615 [
18ba2aab 2616#include <sys/types.h>
2617#include <sys/socket.h>
58d100bf 2618 ],
2619 [ struct sockaddr_storage s; s.ss_family = 1; ],
2620 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2621 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2622 )
2623])
2624if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
3466e002 2625 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
58d100bf 2626fi
2627
58d100bf 2628AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2629 ac_cv_have___ss_family_in_struct_ss, [
2630 AC_TRY_COMPILE(
2631 [
18ba2aab 2632#include <sys/types.h>
2633#include <sys/socket.h>
58d100bf 2634 ],
2635 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2636 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2637 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2638 )
2639])
2640if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3466e002 2641 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2642 [Fields in struct sockaddr_storage])
58d100bf 2643fi
2644
2e73a022 2645AC_CACHE_CHECK([for pw_class field in struct passwd],
2646 ac_cv_have_pw_class_in_struct_passwd, [
2647 AC_TRY_COMPILE(
2648 [
2e73a022 2649#include <pwd.h>
2650 ],
97994d32 2651 [ struct passwd p; p.pw_class = 0; ],
2e73a022 2652 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2653 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2654 )
2655])
2656if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3466e002 2657 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2658 [Define if your password has a pw_class field])
2e73a022 2659fi
2660
7751d4eb 2661AC_CACHE_CHECK([for pw_expire field in struct passwd],
2662 ac_cv_have_pw_expire_in_struct_passwd, [
2663 AC_TRY_COMPILE(
2664 [
2665#include <pwd.h>
2666 ],
2667 [ struct passwd p; p.pw_expire = 0; ],
2668 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2669 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2670 )
2671])
2672if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3466e002 2673 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2674 [Define if your password has a pw_expire field])
7751d4eb 2675fi
2676
2677AC_CACHE_CHECK([for pw_change field in struct passwd],
2678 ac_cv_have_pw_change_in_struct_passwd, [
2679 AC_TRY_COMPILE(
2680 [
2681#include <pwd.h>
2682 ],
2683 [ struct passwd p; p.pw_change = 0; ],
2684 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2685 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2686 )
2687])
2688if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3466e002 2689 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2690 [Define if your password has a pw_change field])
7751d4eb 2691fi
58d100bf 2692
637f9177 2693dnl make sure we're using the real structure members and not defines
6f34652e 2694AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2695 ac_cv_have_accrights_in_msghdr, [
1a01a50c 2696 AC_COMPILE_IFELSE(
6f34652e 2697 [
f95c8ce8 2698#include <sys/types.h>
6f34652e 2699#include <sys/socket.h>
2700#include <sys/uio.h>
637f9177 2701int main() {
2702#ifdef msg_accrights
1a01a50c 2703#error "msg_accrights is a macro"
637f9177 2704exit(1);
2705#endif
2706struct msghdr m;
2707m.msg_accrights = 0;
2708exit(0);
2709}
6f34652e 2710 ],
6f34652e 2711 [ ac_cv_have_accrights_in_msghdr="yes" ],
2712 [ ac_cv_have_accrights_in_msghdr="no" ]
2713 )
2714])
2715if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3466e002 2716 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2717 [Define if your system uses access rights style
2718 file descriptor passing])
6f34652e 2719fi
2720
7176df4f 2721AC_CACHE_CHECK([for msg_control field in struct msghdr],
2722 ac_cv_have_control_in_msghdr, [
1a01a50c 2723 AC_COMPILE_IFELSE(
7176df4f 2724 [
f95c8ce8 2725#include <sys/types.h>
7176df4f 2726#include <sys/socket.h>
2727#include <sys/uio.h>
637f9177 2728int main() {
2729#ifdef msg_control
1a01a50c 2730#error "msg_control is a macro"
637f9177 2731exit(1);
2732#endif
2733struct msghdr m;
2734m.msg_control = 0;
2735exit(0);
2736}
7176df4f 2737 ],
7176df4f 2738 [ ac_cv_have_control_in_msghdr="yes" ],
2739 [ ac_cv_have_control_in_msghdr="no" ]
2740 )
2741])
2742if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3466e002 2743 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2744 [Define if your system uses ancillary data style
2745 file descriptor passing])
7176df4f 2746fi
2747
58d100bf 2748AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
aff51935 2749 AC_TRY_LINK([],
2750 [ extern char *__progname; printf("%s", __progname); ],
58d100bf 2751 [ ac_cv_libc_defines___progname="yes" ],
2752 [ ac_cv_libc_defines___progname="no" ]
2753 )
2754])
2755if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3466e002 2756 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
58d100bf 2757fi
8946db53 2758
c921ee00 2759AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2760 AC_TRY_LINK([
2761#include <stdio.h>
aff51935 2762],
2763 [ printf("%s", __FUNCTION__); ],
c921ee00 2764 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2765 [ ac_cv_cc_implements___FUNCTION__="no" ]
2766 )
2767])
2768if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3466e002 2769 AC_DEFINE(HAVE___FUNCTION__, 1,
2770 [Define if compiler implements __FUNCTION__])
c921ee00 2771fi
2772
2773AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2774 AC_TRY_LINK([
2775#include <stdio.h>
aff51935 2776],
2777 [ printf("%s", __func__); ],
c921ee00 2778 [ ac_cv_cc_implements___func__="yes" ],
2779 [ ac_cv_cc_implements___func__="no" ]
2780 )
2781])
2782if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3466e002 2783 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
c921ee00 2784fi
2785
9a406e1e 2786AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2787 AC_TRY_LINK(
2788 [#include <stdarg.h>
2789 va_list x,y;],
2790 [va_copy(x,y);],
2791 [ ac_cv_have_va_copy="yes" ],
2792 [ ac_cv_have_va_copy="no" ]
2793 )
2794])
2795if test "x$ac_cv_have_va_copy" = "xyes" ; then
2796 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2797fi
2798
2799AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2800 AC_TRY_LINK(
2801 [#include <stdarg.h>
2802 va_list x,y;],
2803 [__va_copy(x,y);],
2804 [ ac_cv_have___va_copy="yes" ],
2805 [ ac_cv_have___va_copy="no" ]
2806 )
2807])
2808if test "x$ac_cv_have___va_copy" = "xyes" ; then
2809 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2810fi
2811
1812a662 2812AC_CACHE_CHECK([whether getopt has optreset support],
2813 ac_cv_have_getopt_optreset, [
2814 AC_TRY_LINK(
2815 [
2816#include <getopt.h>
2817 ],
2818 [ extern int optreset; optreset = 0; ],
2819 [ ac_cv_have_getopt_optreset="yes" ],
2820 [ ac_cv_have_getopt_optreset="no" ]
2821 )
2822])
2823if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3466e002 2824 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2825 [Define if your getopt(3) defines and uses optreset])
1812a662 2826fi
a0391976 2827
819b676f 2828AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
aff51935 2829 AC_TRY_LINK([],
2830 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
819b676f 2831 [ ac_cv_libc_defines_sys_errlist="yes" ],
2832 [ ac_cv_libc_defines_sys_errlist="no" ]
2833 )
2834])
2835if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3466e002 2836 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2837 [Define if your system defines sys_errlist[]])
819b676f 2838fi
2839
2840
416ed5a7 2841AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
aff51935 2842 AC_TRY_LINK([],
2843 [ extern int sys_nerr; printf("%i", sys_nerr);],
416ed5a7 2844 [ ac_cv_libc_defines_sys_nerr="yes" ],
2845 [ ac_cv_libc_defines_sys_nerr="no" ]
2846 )
2847])
2848if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3466e002 2849 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
416ed5a7 2850fi
2851
aff51935 2852SCARD_MSG="no"
295c8801 2853# Check whether user wants sectok support
2854AC_ARG_WITH(sectok,
2855 [ --with-sectok Enable smartcard support using libsectok],
d0b19c95 2856 [
2857 if test "x$withval" != "xno" ; then
2858 if test "x$withval" != "xyes" ; then
2859 CPPFLAGS="$CPPFLAGS -I${withval}"
2860 LDFLAGS="$LDFLAGS -L${withval}"
2861 if test ! -z "$need_dash_r" ; then
2862 LDFLAGS="$LDFLAGS -R${withval}"
2863 fi
2864 if test ! -z "$blibpath" ; then
2865 blibpath="$blibpath:${withval}"
2866 fi
2867 fi
2868 AC_CHECK_HEADERS(sectok.h)
2869 if test "$ac_cv_header_sectok_h" != yes; then
2870 AC_MSG_ERROR(Can't find sectok.h)
2871 fi
2872 AC_CHECK_LIB(sectok, sectok_open)
2873 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2874 AC_MSG_ERROR(Can't find libsectok)
2875 fi
3466e002 2876 AC_DEFINE(SMARTCARD, 1,
2877 [Define if you want smartcard support])
2878 AC_DEFINE(USE_SECTOK, 1,
2879 [Define if you want smartcard support
2880 using sectok])
aff51935 2881 SCARD_MSG="yes, using sectok"
295c8801 2882 fi
2883 ]
2884)
2885
2886# Check whether user wants OpenSC support
987b458f 2887OPENSC_CONFIG="no"
295c8801 2888AC_ARG_WITH(opensc,
e47fb473 2889 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
987b458f 2890 [
2891 if test "x$withval" != "xno" ; then
2892 if test "x$withval" != "xyes" ; then
2893 OPENSC_CONFIG=$withval/bin/opensc-config
2894 else
2895 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2896 fi
2897 if test "$OPENSC_CONFIG" != "no"; then
2898 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2899 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2900 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2901 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2902 AC_DEFINE(SMARTCARD)
3466e002 2903 AC_DEFINE(USE_OPENSC, 1,
2904 [Define if you want smartcard support
2905 using OpenSC])
987b458f 2906 SCARD_MSG="yes, using OpenSC"
2907 fi
2908 fi
2909 ]
2910)
d0b19c95 2911
c31dc31c 2912# Check libraries needed by DNS fingerprint support
aff51935 2913AC_SEARCH_LIBS(getrrsetbyname, resolv,
3466e002 2914 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2915 [Define if getrrsetbyname() exists])],
3e05e934 2916 [
c31dc31c 2917 # Needed by our getrrsetbyname()
2918 AC_SEARCH_LIBS(res_query, resolv)
2919 AC_SEARCH_LIBS(dn_expand, resolv)
dabb524a 2920 AC_MSG_CHECKING(if res_query will link)
2921 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2922 [AC_MSG_RESULT(no)
2923 saved_LIBS="$LIBS"
2924 LIBS="$LIBS -lresolv"
2925 AC_MSG_CHECKING(for res_query in -lresolv)
2926 AC_LINK_IFELSE([
2927#include <resolv.h>
2928int main()
2929{
2930 res_query (0, 0, 0, 0, 0);
2931 return 0;
2932}
2933 ],
2934 [LIBS="$LIBS -lresolv"
2935 AC_MSG_RESULT(yes)],
2936 [LIBS="$saved_LIBS"
2937 AC_MSG_RESULT(no)])
2938 ])
c31dc31c 2939 AC_CHECK_FUNCS(_getshort _getlong)
1c829da5 2940 AC_CHECK_DECLS([_getshort, _getlong], , ,
b5765e1d 2941 [#include <sys/types.h>
2942 #include <arpa/nameser.h>])
c31dc31c 2943 AC_CHECK_MEMBER(HEADER.ad,
3466e002 2944 [AC_DEFINE(HAVE_HEADER_AD, 1,
2945 [Define if HEADER.ad exists in arpa/nameser.h])],,
c31dc31c 2946 [#include <arpa/nameser.h>])
2947 ])
3e05e934 2948
12928e80 2949# Check whether user wants Kerberos 5 support
aff51935 2950KRB5_MSG="no"
12928e80 2951AC_ARG_WITH(kerberos5,
aff51935 2952 [ --with-kerberos5=PATH Enable Kerberos 5 support],
5585c441 2953 [ if test "x$withval" != "xno" ; then
2954 if test "x$withval" = "xyes" ; then
2955 KRB5ROOT="/usr/local"
2956 else
2957 KRB5ROOT=${withval}
2958 fi
2959
3466e002 2960 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
5585c441 2961 KRB5_MSG="yes"
2962
2963 AC_MSG_CHECKING(for krb5-config)
2964 if test -x $KRB5ROOT/bin/krb5-config ; then
2965 KRB5CONF=$KRB5ROOT/bin/krb5-config
2966 AC_MSG_RESULT($KRB5CONF)
2967
2968 AC_MSG_CHECKING(for gssapi support)
2969 if $KRB5CONF | grep gssapi >/dev/null ; then
2970 AC_MSG_RESULT(yes)
3466e002 2971 AC_DEFINE(GSSAPI, 1,
2972 [Define this if you want GSSAPI
2973 support in the version 2 protocol])
071970fb 2974 k5confopts=gssapi
aff51935 2975 else
5585c441 2976 AC_MSG_RESULT(no)
071970fb 2977 k5confopts=""
aff51935 2978 fi
071970fb 2979 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2980 K5LIBS="`$KRB5CONF --libs $k5confopts`"
5585c441 2981 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
5585c441 2982 AC_MSG_CHECKING(whether we are using Heimdal)
2983 AC_TRY_COMPILE([ #include <krb5.h> ],
2984 [ char *tmp = heimdal_version; ],
2985 [ AC_MSG_RESULT(yes)
3466e002 2986 AC_DEFINE(HEIMDAL, 1,
2987 [Define this if you are using the
2988 Heimdal version of Kerberos V5]) ],
5585c441 2989 AC_MSG_RESULT(no)
2990 )
2991 else
2992 AC_MSG_RESULT(no)
12928e80 2993 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
aff51935 2994 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
aff51935 2995 AC_MSG_CHECKING(whether we are using Heimdal)
2996 AC_TRY_COMPILE([ #include <krb5.h> ],
2997 [ char *tmp = heimdal_version; ],
2998 [ AC_MSG_RESULT(yes)
2999 AC_DEFINE(HEIMDAL)
41707f74 3000 K5LIBS="-lkrb5 -ldes"
3001 K5LIBS="$K5LIBS -lcom_err -lasn1"
82f4e93d 3002 AC_CHECK_LIB(roken, net_write,
41707f74 3003 [K5LIBS="$K5LIBS -lroken"])
aff51935 3004 ],
3005 [ AC_MSG_RESULT(no)
3006 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3007 ]
3008 )
4e00038c 3009 AC_SEARCH_LIBS(dn_expand, resolv)
12928e80 3010
749560dd 3011 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3012 [ AC_DEFINE(GSSAPI)
3013 K5LIBS="-lgssapi $K5LIBS" ],
3014 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3015 [ AC_DEFINE(GSSAPI)
aff51935 3016 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
749560dd 3017 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3018 $K5LIBS)
3019 ],
3020 $K5LIBS)
82f4e93d 3021
749560dd 3022 AC_CHECK_HEADER(gssapi.h, ,
3023 [ unset ac_cv_header_gssapi_h
aff51935 3024 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
749560dd 3025 AC_CHECK_HEADERS(gssapi.h, ,
3026 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
aff51935 3027 )
749560dd 3028 ]
3029 )
3030
3031 oldCPP="$CPPFLAGS"
3032 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3033 AC_CHECK_HEADER(gssapi_krb5.h, ,
3034 [ CPPFLAGS="$oldCPP" ])
3035
aff51935 3036 fi
5585c441 3037 if test ! -z "$need_dash_r" ; then
3038 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3039 fi
3040 if test ! -z "$blibpath" ; then
3041 blibpath="$blibpath:${KRB5ROOT}/lib"
3042 fi
071970fb 3043
f5555364 3044 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3045 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3046 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
071970fb 3047
f5555364 3048 LIBS="$LIBS $K5LIBS"
3466e002 3049 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3050 [Define this if you want to use libkafs' AFS support]))
f5555364 3051 fi
071970fb 3052 ]
12928e80 3053)
b5b68128 3054
a0391976 3055# Looking for programs, paths and files
a0391976 3056
ecac8ee5 3057PRIVSEP_PATH=/var/empty
3058AC_ARG_WITH(privsep-path,
cda1ebcb 3059 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
ecac8ee5 3060 [
6cf0200f 3061 if test -n "$withval" && test "x$withval" != "xno" && \
3062 test "x${withval}" != "xyes"; then
ecac8ee5 3063 PRIVSEP_PATH=$withval
3064 fi
3065 ]
3066)
3067AC_SUBST(PRIVSEP_PATH)
3068
a0391976 3069AC_ARG_WITH(xauth,
3070 [ --with-xauth=PATH Specify path to xauth program ],
3071 [
6cf0200f 3072 if test -n "$withval" && test "x$withval" != "xno" && \
3073 test "x${withval}" != "xyes"; then
cbd7492e 3074 xauth_path=$withval
a0391976 3075 fi
3076 ],
3077 [
2bf42e4a 3078 TestPath="$PATH"
3079 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3080 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3081 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3082 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3083 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
e5fe9a1f 3084 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
a0391976 3085 xauth_path="/usr/openwin/bin/xauth"
3086 fi
3087 ]
3088)
3089
65a4b4af 3090STRIP_OPT=-s
3091AC_ARG_ENABLE(strip,
3092 [ --disable-strip Disable calling strip(1) on install],
3093 [
3094 if test "x$enableval" = "xno" ; then
3095 STRIP_OPT=
3096 fi
3097 ]
3098)
3099AC_SUBST(STRIP_OPT)
3100
b3ec54b4 3101if test -z "$xauth_path" ; then
3102 XAUTH_PATH="undefined"
3103 AC_SUBST(XAUTH_PATH)
3104else
3466e002 3105 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3106 [Define if xauth is found in your path])
b3ec54b4 3107 XAUTH_PATH=$xauth_path
3108 AC_SUBST(XAUTH_PATH)
a0391976 3109fi
a0391976 3110
3111# Check for mail directory (last resort if we cannot get it from headers)
3112if test ! -z "$MAIL" ; then
3113 maildir=`dirname $MAIL`
3466e002 3114 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3115 [Set this to your mail directory if you don't have maillock.h])
a0391976 3116fi
3117
479cece8 3118if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
1a01a50c 3119 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3120 disable_ptmx_check=yes
3121fi
a0391976 3122if test -z "$no_dev_ptmx" ; then
6e879cb4 3123 if test "x$disable_ptmx_check" != "xyes" ; then
aff51935 3124 AC_CHECK_FILE("/dev/ptmx",
6e879cb4 3125 [
3466e002 3126 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3127 [Define if you have /dev/ptmx])
6e879cb4 3128 have_dev_ptmx=1
3129 ]
3130 )
3131 fi
3276571c 3132fi
1a01a50c 3133
479cece8 3134if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
1a01a50c 3135 AC_CHECK_FILE("/dev/ptc",
3136 [
3466e002 3137 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3138 [Define if you have /dev/ptc])
1a01a50c 3139 have_dev_ptc=1
3140 ]
3141 )
3142else
3143 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3144fi
3276571c 3145
a0391976 3146# Options from here on. Some of these are preset by platform above
fdf6b7aa 3147AC_ARG_WITH(mantype,
5d97cfbf 3148 [ --with-mantype=man|cat|doc Set man page type],
c54a6257 3149 [
5d97cfbf 3150 case "$withval" in
3151 man|cat|doc)
3152 MANTYPE=$withval
3153 ;;
3154 *)
3155 AC_MSG_ERROR(invalid man type: $withval)
3156 ;;
3157 esac
c54a6257 3158 ]
3159)
e0c4d3ac 3160if test -z "$MANTYPE"; then
2bf42e4a 3161 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3162 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
e0c4d3ac 3163 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3164 MANTYPE=doc
3165 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3166 MANTYPE=man
3167 else
3168 MANTYPE=cat
3169 fi
3170fi
c54a6257 3171AC_SUBST(MANTYPE)
e0c4d3ac 3172if test "$MANTYPE" = "doc"; then
3173 mansubdir=man;
3174else
3175 mansubdir=$MANTYPE;
3176fi
3177AC_SUBST(mansubdir)
0bc5b6fb 3178
a0391976 3179# Check whether to enable MD5 passwords
aff51935 3180MD5_MSG="no"
2ddcfdf3 3181AC_ARG_WITH(md5-passwords,
caf3bc51 3182 [ --with-md5-passwords Enable use of MD5 passwords],
0bc5b6fb 3183 [
bcf36c78 3184 if test "x$withval" != "xno" ; then
3466e002 3185 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3186 [Define if you want to allow MD5 passwords])
aff51935 3187 MD5_MSG="yes"
0bc5b6fb 3188 fi
3189 ]
caf3bc51 3190)
3191
a0391976 3192# Whether to disable shadow password support
a7effaac 3193AC_ARG_WITH(shadow,
3194 [ --without-shadow Disable shadow password support],
3195 [
82f4e93d 3196 if test "x$withval" = "xno" ; then
a7effaac 3197 AC_DEFINE(DISABLE_SHADOW)
4cb5ffa0 3198 disable_shadow=yes
a7effaac 3199 fi
3200 ]
3201)
3202
4cb5ffa0 3203if test -z "$disable_shadow" ; then
3204 AC_MSG_CHECKING([if the systems has expire shadow information])
3205 AC_TRY_COMPILE(
3206 [
3207#include <sys/types.h>
3208#include <shadow.h>
3209 struct spwd sp;
3210 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3211 [ sp_expire_available=yes ], []
3212 )
3213
3214 if test "x$sp_expire_available" = "xyes" ; then
3215 AC_MSG_RESULT(yes)
3466e002 3216 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3217 [Define if you want to use shadow password expire field])
4cb5ffa0 3218 else
3219 AC_MSG_RESULT(no)
3220 fi
3221fi
3222
a0391976 3223# Use ip address instead of hostname in $DISPLAY
44839801 3224if test ! -z "$IPADDR_IN_DISPLAY" ; then
3225 DISPLAY_HACK_MSG="yes"
3466e002 3226 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3227 [Define if you need to use IP address
3228 instead of hostname in $DISPLAY])
44839801 3229else
aff51935 3230 DISPLAY_HACK_MSG="no"
44839801 3231 AC_ARG_WITH(ipaddr-display,
3232 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3233 [
82f4e93d 3234 if test "x$withval" != "xno" ; then
44839801 3235 AC_DEFINE(IPADDR_IN_DISPLAY)
aff51935 3236 DISPLAY_HACK_MSG="yes"
44839801 3237 fi
3238 ]
3239 )
3240fi
a7effaac 3241
95b99395 3242# check for /etc/default/login and use it if present.
daa41e62 3243AC_ARG_ENABLE(etc-default-login,
6ff3d0dc 3244 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
694d0cef 3245 [ if test "x$enableval" = "xno"; then
3246 AC_MSG_NOTICE([/etc/default/login handling disabled])
3247 etc_default_login=no
3248 else
3249 etc_default_login=yes
3250 fi ],
b0e7249f 3251 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3252 then
3253 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3254 etc_default_login=no
3255 else
3256 etc_default_login=yes
3257 fi ]
694d0cef 3258)
95b99395 3259
694d0cef 3260if test "x$etc_default_login" != "xno"; then
3261 AC_CHECK_FILE("/etc/default/login",
3262 [ external_path_file=/etc/default/login ])
b0e7249f 3263 if test "x$external_path_file" = "x/etc/default/login"; then
3466e002 3264 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3265 [Define if your system has /etc/default/login])
1a01a50c 3266 fi
694d0cef 3267fi
95b99395 3268
8d184c09 3269dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
4b492aab 3270if test $ac_cv_func_login_getcapbool = "yes" && \
3271 test $ac_cv_header_login_cap_h = "yes" ; then
95b99395 3272 external_path_file=/etc/login.conf
8d184c09 3273fi
95b99395 3274
a0391976 3275# Whether to mess with the default path
aff51935 3276SERVER_PATH_MSG="(default)"
c43d69a9 3277AC_ARG_WITH(default-path,
75817f90 3278 [ --with-default-path= Specify default \$PATH environment for server],
cb807f40 3279 [
95b99395 3280 if test "x$external_path_file" = "x/etc/login.conf" ; then
8d184c09 3281 AC_MSG_WARN([
3282--with-default-path=PATH has no effect on this system.
3283Edit /etc/login.conf instead.])
82f4e93d 3284 elif test "x$withval" != "xno" ; then
89bbd457 3285 if test ! -z "$external_path_file" ; then
95b99395 3286 AC_MSG_WARN([
3287--with-default-path=PATH will only be used if PATH is not defined in
3288$external_path_file .])
3289 fi
b2d818e6 3290 user_path="$withval"
aff51935 3291 SERVER_PATH_MSG="$withval"
cb807f40 3292 fi
b2d818e6 3293 ],
95b99395 3294 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3295 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
8d184c09 3296 else
89bbd457 3297 if test ! -z "$external_path_file" ; then
95b99395 3298 AC_MSG_WARN([
3299If PATH is defined in $external_path_file, ensure the path to scp is included,
3300otherwise scp will not work.])
3301 fi
b0e7249f 3302 AC_RUN_IFELSE(
3303 [AC_LANG_SOURCE([[
b2d818e6 3304/* find out what STDPATH is */
3305#include <stdio.h>
b2d818e6 3306#ifdef HAVE_PATHS_H
3307# include <paths.h>
3308#endif
3309#ifndef _PATH_STDPATH
d9a4e55b 3310# ifdef _PATH_USERPATH /* Irix */
3311# define _PATH_STDPATH _PATH_USERPATH
3312# else
3313# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3314# endif
b2d818e6 3315#endif
3316#include <sys/types.h>
3317#include <sys/stat.h>
3318#include <fcntl.h>
3319#define DATA "conftest.stdpath"
3320
3321main()
3322{
3323 FILE *fd;
3324 int rc;
82f4e93d 3325
b2d818e6 3326 fd = fopen(DATA,"w");
3327 if(fd == NULL)
3328 exit(1);
82f4e93d 3329
b2d818e6 3330 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3331 exit(1);
3332
3333 exit(0);
3334}
b0e7249f 3335 ]])],
3336 [ user_path=`cat conftest.stdpath` ],
b2d818e6 3337 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3338 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3339 )
3340# make sure $bindir is in USER_PATH so scp will work
3341 t_bindir=`eval echo ${bindir}`
3342 case $t_bindir in
3343 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3344 esac
3345 case $t_bindir in
3346 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3347 esac
3348 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3349 if test $? -ne 0 ; then
3350 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3351 if test $? -ne 0 ; then
3352 user_path=$user_path:$t_bindir
3353 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3354 fi
3355 fi
8d184c09 3356 fi ]
cb807f40 3357)
95b99395 3358if test "x$external_path_file" != "x/etc/login.conf" ; then
3466e002 3359 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
8d184c09 3360 AC_SUBST(user_path)
3361fi
cb807f40 3362
06617857 3363# Set superuser path separately to user path
06617857 3364AC_ARG_WITH(superuser-path,
3365 [ --with-superuser-path= Specify different path for super-user],
3366 [
6cf0200f 3367 if test -n "$withval" && test "x$withval" != "xno" && \
3368 test "x${withval}" != "xyes"; then
3466e002 3369 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3370 [Define if you want a different $PATH
3371 for the superuser])
06617857 3372 superuser_path=$withval
3373 fi
3374 ]
3375)
3376
3377
58d100bf 3378AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
aff51935 3379IPV4_IN6_HACK_MSG="no"
80faa19f 3380AC_ARG_WITH(4in6,
3381 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3382 [
3383 if test "x$withval" != "xno" ; then
3384 AC_MSG_RESULT(yes)
3466e002 3385 AC_DEFINE(IPV4_IN_IPV6, 1,
3386 [Detect IPv4 in IPv6 mapped addresses
3387 and treat as IPv4])
aff51935 3388 IPV4_IN6_HACK_MSG="yes"
80faa19f 3389 else
3390 AC_MSG_RESULT(no)
3391 fi
3392 ],[
3393 if test "x$inet6_default_4in6" = "xyes"; then
3394 AC_MSG_RESULT([yes (default)])
3395 AC_DEFINE(IPV4_IN_IPV6)
aff51935 3396 IPV4_IN6_HACK_MSG="yes"
80faa19f 3397 else
3398 AC_MSG_RESULT([no (default)])
3399 fi
3400 ]
3401)
3402
af774732 3403# Whether to enable BSD auth support
f1b0ecc3 3404BSD_AUTH_MSG=no
af774732 3405AC_ARG_WITH(bsd-auth,
3406 [ --with-bsd-auth Enable BSD auth support],
3407 [
82f4e93d 3408 if test "x$withval" != "xno" ; then
3466e002 3409 AC_DEFINE(BSD_AUTH, 1,
3410 [Define if you have BSD auth support])
f1b0ecc3 3411 BSD_AUTH_MSG=yes
af774732 3412 fi
3413 ]
3414)
3415
a0391976 3416# Where to place sshd.pid
19d9ac2a 3417piddir=/var/run
81dadca3 3418# make sure the directory exists
82f4e93d 3419if test ! -d $piddir ; then
81dadca3 3420 piddir=`eval echo ${sysconfdir}`
3421 case $piddir in
aff51935 3422 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
81dadca3 3423 esac
3424fi
3425
47e45e44 3426AC_ARG_WITH(pid-dir,
3427 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3428 [
6cf0200f 3429 if test -n "$withval" && test "x$withval" != "xno" && \
3430 test "x${withval}" != "xyes"; then
19d9ac2a 3431 piddir=$withval
82f4e93d 3432 if test ! -d $piddir ; then
81dadca3 3433 AC_MSG_WARN([** no $piddir directory on this system **])
3434 fi
47e45e44 3435 fi
3436 ]
3437)
b7a87eea 3438
3466e002 3439AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
19d9ac2a 3440AC_SUBST(piddir)
47e45e44 3441
1d7b9b20 3442dnl allow user to disable some login recording features
3443AC_ARG_ENABLE(lastlog,
bfd550a2 3444 [ --disable-lastlog disable use of lastlog even if detected [no]],
ddb154b3 3445 [
3446 if test "x$enableval" = "xno" ; then
3447 AC_DEFINE(DISABLE_LASTLOG)
3448 fi
3449 ]
1d7b9b20 3450)
3451AC_ARG_ENABLE(utmp,
bfd550a2 3452 [ --disable-utmp disable use of utmp even if detected [no]],
ddb154b3 3453 [
3454 if test "x$enableval" = "xno" ; then
3455 AC_DEFINE(DISABLE_UTMP)
3456 fi
3457 ]
1d7b9b20 3458)
3459AC_ARG_ENABLE(utmpx,
bfd550a2 3460 [ --disable-utmpx disable use of utmpx even if detected [no]],
ddb154b3 3461 [
3462 if test "x$enableval" = "xno" ; then
3466e002 3463 AC_DEFINE(DISABLE_UTMPX, 1,
3464 [Define if you don't want to use utmpx])
ddb154b3 3465 fi
3466 ]
1d7b9b20 3467)
3468AC_ARG_ENABLE(wtmp,
bfd550a2 3469 [ --disable-wtmp disable use of wtmp even if detected [no]],
ddb154b3 3470 [
3471 if test "x$enableval" = "xno" ; then
3472 AC_DEFINE(DISABLE_WTMP)
3473 fi
3474 ]
1d7b9b20 3475)
3476AC_ARG_ENABLE(wtmpx,
bfd550a2 3477 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
ddb154b3 3478 [
3479 if test "x$enableval" = "xno" ; then
3466e002 3480 AC_DEFINE(DISABLE_WTMPX, 1,
3481 [Define if you don't want to use wtmpx])
ddb154b3 3482 fi
3483 ]
1d7b9b20 3484)
3485AC_ARG_ENABLE(libutil,
bfd550a2 3486 [ --disable-libutil disable use of libutil (login() etc.) [no]],
ddb154b3 3487 [
3488 if test "x$enableval" = "xno" ; then
3489 AC_DEFINE(DISABLE_LOGIN)
3490 fi
3491 ]
1d7b9b20 3492)
3493AC_ARG_ENABLE(pututline,
bfd550a2 3494 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
ddb154b3 3495 [
3496 if test "x$enableval" = "xno" ; then
3466e002 3497 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3498 [Define if you don't want to use pututline()
3499 etc. to write [uw]tmp])
ddb154b3 3500 fi
3501 ]
1d7b9b20 3502)
3503AC_ARG_ENABLE(pututxline,
bfd550a2 3504 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
ddb154b3 3505 [
3506 if test "x$enableval" = "xno" ; then
3466e002 3507 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3508 [Define if you don't want to use pututxline()
3509 etc. to write [uw]tmpx])
ddb154b3 3510 fi
3511 ]
1d7b9b20 3512)
3513AC_ARG_WITH(lastlog,
bfd550a2 3514 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
8c89dd2b 3515 [
82f4e93d 3516 if test "x$withval" = "xno" ; then
8c89dd2b 3517 AC_DEFINE(DISABLE_LASTLOG)
6cf0200f 3518 elif test -n "$withval" && test "x${withval}" != "xyes"; then
8c89dd2b 3519 conf_lastlog_location=$withval
3520 fi
3521 ]
3522)
1d7b9b20 3523
3524dnl lastlog, [uw]tmpx? detection
3525dnl NOTE: set the paths in the platform section to avoid the
3526dnl need for command-line parameters
3527dnl lastlog and [uw]tmp are subject to a file search if all else fails
3528
3529dnl lastlog detection
3530dnl NOTE: the code itself will detect if lastlog is a directory
3531AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3532AC_TRY_COMPILE([
3533#include <sys/types.h>
3534#include <utmp.h>
3535#ifdef HAVE_LASTLOG_H
3536# include <lastlog.h>
3537#endif
d7c0f3d5 3538#ifdef HAVE_PATHS_H
1d7b9b20 3539# include <paths.h>
41cb4569 3540#endif
3541#ifdef HAVE_LOGIN_H
3542# include <login.h>
1d7b9b20 3543#endif
3544 ],
3545 [ char *lastlog = LASTLOG_FILE; ],
3546 [ AC_MSG_RESULT(yes) ],
d7c0f3d5 3547 [
3548 AC_MSG_RESULT(no)
3549 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3550 AC_TRY_COMPILE([
3551#include <sys/types.h>
3552#include <utmp.h>
3553#ifdef HAVE_LASTLOG_H
3554# include <lastlog.h>
3555#endif
3556#ifdef HAVE_PATHS_H
3557# include <paths.h>
3558#endif
3559 ],
3560 [ char *lastlog = _PATH_LASTLOG; ],
3561 [ AC_MSG_RESULT(yes) ],
3562 [
f282b668 3563 AC_MSG_RESULT(no)
d7c0f3d5 3564 system_lastlog_path=no
3565 ])
3566 ]
1d7b9b20 3567)
d7c0f3d5 3568
1d7b9b20 3569if test -z "$conf_lastlog_location"; then
3570 if test x"$system_lastlog_path" = x"no" ; then
3571 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
e5fe9a1f 3572 if (test -d "$f" || test -f "$f") ; then
1d7b9b20 3573 conf_lastlog_location=$f
3574 fi
3575 done
3576 if test -z "$conf_lastlog_location"; then
f8119cef 3577 AC_MSG_WARN([** Cannot find lastlog **])
3578 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1d7b9b20 3579 fi
3580 fi
3581fi
3582
3583if test -n "$conf_lastlog_location"; then
3466e002 3584 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3585 [Define if you want to specify the path to your lastlog file])
82f4e93d 3586fi
1d7b9b20 3587
3588dnl utmp detection
3589AC_MSG_CHECKING([if your system defines UTMP_FILE])
3590AC_TRY_COMPILE([
3591#include <sys/types.h>
3592#include <utmp.h>
d7c0f3d5 3593#ifdef HAVE_PATHS_H
1d7b9b20 3594# include <paths.h>
3595#endif
3596 ],
3597 [ char *utmp = UTMP_FILE; ],
3598 [ AC_MSG_RESULT(yes) ],
3599 [ AC_MSG_RESULT(no)
3600 system_utmp_path=no ]
3601)
3602if test -z "$conf_utmp_location"; then
3603 if test x"$system_utmp_path" = x"no" ; then
3604 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3605 if test -f $f ; then
3606 conf_utmp_location=$f
3607 fi
3608 done
3609 if test -z "$conf_utmp_location"; then
3610 AC_DEFINE(DISABLE_UTMP)
3611 fi
3612 fi
3613fi
3614if test -n "$conf_utmp_location"; then
3466e002 3615 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3616 [Define if you want to specify the path to your utmp file])
82f4e93d 3617fi
1d7b9b20 3618
3619dnl wtmp detection
3620AC_MSG_CHECKING([if your system defines WTMP_FILE])
3621AC_TRY_COMPILE([
3622#include <sys/types.h>
3623#include <utmp.h>
d7c0f3d5 3624#ifdef HAVE_PATHS_H
1d7b9b20 3625# include <paths.h>
3626#endif
3627 ],
3628 [ char *wtmp = WTMP_FILE; ],
3629 [ AC_MSG_RESULT(yes) ],
3630 [ AC_MSG_RESULT(no)
3631 system_wtmp_path=no ]
3632)
3633if test -z "$conf_wtmp_location"; then
3634 if test x"$system_wtmp_path" = x"no" ; then
3635 for f in /usr/adm/wtmp /var/log/wtmp; do
3636 if test -f $f ; then
3637 conf_wtmp_location=$f
3638 fi
3639 done
3640 if test -z "$conf_wtmp_location"; then
3641 AC_DEFINE(DISABLE_WTMP)
3642 fi
3643 fi
3644fi
3645if test -n "$conf_wtmp_location"; then
3466e002 3646 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3647 [Define if you want to specify the path to your wtmp file])
82f4e93d 3648fi
1d7b9b20 3649
3650
3651dnl utmpx detection - I don't know any system so perverse as to require
3652dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3653dnl there, though.
3654AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3655AC_TRY_COMPILE([
3656#include <sys/types.h>
3657#include <utmp.h>
3658#ifdef HAVE_UTMPX_H
3659#include <utmpx.h>
3660#endif
d7c0f3d5 3661#ifdef HAVE_PATHS_H
1d7b9b20 3662# include <paths.h>
3663#endif
3664 ],
3665 [ char *utmpx = UTMPX_FILE; ],
3666 [ AC_MSG_RESULT(yes) ],
3667 [ AC_MSG_RESULT(no)
3668 system_utmpx_path=no ]
3669)
3670if test -z "$conf_utmpx_location"; then
3671 if test x"$system_utmpx_path" = x"no" ; then
3672 AC_DEFINE(DISABLE_UTMPX)
3673 fi
3674else
3466e002 3675 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3676 [Define if you want to specify the path to your utmpx file])
82f4e93d 3677fi
1d7b9b20 3678
3679dnl wtmpx detection
3680AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3681AC_TRY_COMPILE([
3682#include <sys/types.h>
3683#include <utmp.h>
3684#ifdef HAVE_UTMPX_H
3685#include <utmpx.h>
3686#endif
d7c0f3d5 3687#ifdef HAVE_PATHS_H
1d7b9b20 3688# include <paths.h>
3689#endif
3690 ],
3691 [ char *wtmpx = WTMPX_FILE; ],
3692 [ AC_MSG_RESULT(yes) ],
3693 [ AC_MSG_RESULT(no)
3694 system_wtmpx_path=no ]
3695)
3696if test -z "$conf_wtmpx_location"; then
3697 if test x"$system_wtmpx_path" = x"no" ; then
3698 AC_DEFINE(DISABLE_WTMPX)
3699 fi
3700else
3466e002 3701 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3702 [Define if you want to specify the path to your wtmpx file])
82f4e93d 3703fi
1d7b9b20 3704
b7a87eea 3705
bd499f9e 3706if test ! -z "$blibpath" ; then
68ece370 3707 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3708 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
bd499f9e 3709fi
3710
ddceb1c8 3711dnl remove pam and dl because they are in $LIBPAM
3712if test "$PAM_MSG" = yes ; then
98f2d9d5 3713 LIBS=`echo $LIBS | sed 's/-lpam //'`
3714fi
3715if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3716 LIBS=`echo $LIBS | sed 's/-ldl //'`
ddceb1c8 3717fi
3718
ed89c848 3719dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3720dnl Add now.
3721CFLAGS="$CFLAGS $werror_flags"
3722
3c62e7eb 3723AC_EXEEXT
d7cfdd7c 3724AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3725 scard/Makefile ssh_prng_cmds survey.sh])
98a7c37b 3726AC_OUTPUT
d3083fbd 3727
cbd7492e 3728# Print summary of options
3729
cbd7492e 3730# Someone please show me a better way :)
3731A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3732B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3733C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3734D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
f5665f6f 3735E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
e0c4d3ac 3736F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
cbd7492e 3737G=`eval echo ${piddir}` ; G=`eval echo ${G}`
ecac8ee5 3738H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3739I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3740J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
cbd7492e 3741
3742echo ""
26de7942 3743echo "OpenSSH has been configured with the following options:"
ecac8ee5 3744echo " User binaries: $B"
3745echo " System binaries: $C"
3746echo " Configuration files: $D"
3747echo " Askpass program: $E"
3748echo " Manual pages: $F"
3749echo " PID file: $G"
3750echo " Privilege separation chroot path: $H"
95b99395 3751if test "x$external_path_file" = "x/etc/login.conf" ; then
3752echo " At runtime, sshd will use the path defined in $external_path_file"
3753echo " Make sure the path to scp is present, otherwise scp will not work"
8d184c09 3754else
ecac8ee5 3755echo " sshd default user PATH: $I"
89bbd457 3756 if test ! -z "$external_path_file"; then
95b99395 3757echo " (If PATH is set in $external_path_file it will be used instead. If"
3758echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3759 fi
8d184c09 3760fi
06617857 3761if test ! -z "$superuser_path" ; then
ecac8ee5 3762echo " sshd superuser user PATH: $J"
3763fi
3764echo " Manpage format: $MANTYPE"
3e05e934 3765echo " PAM support: $PAM_MSG"
ecac8ee5 3766echo " KerberosV support: $KRB5_MSG"
3767echo " Smartcard support: $SCARD_MSG"
ecac8ee5 3768echo " S/KEY support: $SKEY_MSG"
3769echo " TCP Wrappers support: $TCPW_MSG"
3770echo " MD5 password support: $MD5_MSG"
59031773 3771echo " libedit support: $LIBEDIT_MSG"
3deb1408 3772echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
ecac8ee5 3773echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3774echo " BSD Auth support: $BSD_AUTH_MSG"
3775echo " Random number source: $RAND_MSG"
f1b0ecc3 3776if test ! -z "$USE_RAND_HELPER" ; then
ecac8ee5 3777echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
af774732 3778fi
3779
cbd7492e 3780echo ""
3781
0c2fb82f 3782echo " Host: ${host}"
3783echo " Compiler: ${CC}"
3784echo " Compiler flags: ${CFLAGS}"
3785echo "Preprocessor flags: ${CPPFLAGS}"
3786echo " Linker flags: ${LDFLAGS}"
ddceb1c8 3787echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
cbd7492e 3788
3789echo ""
3790
9cefe228 3791if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
b3146b5f 3792 echo "SVR4 style packages are supported with \"make package\""
3793 echo ""
9cefe228 3794fi
3795
adeebd37 3796if test "x$PAM_MSG" = "xyes" ; then
f1b0ecc3 3797 echo "PAM is enabled. You may need to install a PAM control file "
3798 echo "for sshd, otherwise password authentication may fail. "
aff51935 3799 echo "Example PAM control files can be found in the contrib/ "
f1b0ecc3 3800 echo "subdirectory"
adeebd37 3801 echo ""
3802fi
3803
f1b0ecc3 3804if test ! -z "$RAND_HELPER_CMDHASH" ; then
3805 echo "WARNING: you are using the builtin random number collection "
3806 echo "service. Please read WARNING.RNG and request that your OS "
3807 echo "vendor includes kernel-based random number collection in "
3808 echo "future versions of your OS."
2c523de9 3809 echo ""
3810fi
af774732 3811
2f6f9cff 3812if test ! -z "$NO_PEERCHECK" ; then
3813 echo "WARNING: the operating system that you are using does not "
3814 echo "appear to support either the getpeereid() API nor the "
3815 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3816 echo "enforce security checks to prevent unauthorised connections to "
3817 echo "ssh-agent. Their absence increases the risk that a malicious "
3818 echo "user can connect to your agent. "
3819 echo ""
3820fi
3821
7b578f7d 3822if test "$AUDIT_MODULE" = "bsm" ; then
3823 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3824 echo "See the Solaris section in README.platform for details."
3825fi
This page took 1.084922 seconds and 5 git commands to generate.