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