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