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