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