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