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