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