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