]> andersk Git - openssh.git/blame - configure.ac
- (djm) Explain consequences of UsePAM=yes a little better in sshd_config;
[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
41e0e158 863AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
864
3f176010 865AC_CHECK_FUNCS(setresuid, [
866 dnl Some platorms have setresuid that isn't implemented, test for this
867 AC_MSG_CHECKING(if setresuid seems to work)
868 AC_TRY_RUN([
9a3fe0e2 869#include <stdlib.h>
870#include <errno.h>
871int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
3f176010 872 ],
873 [AC_MSG_RESULT(yes)],
24a9171d 874 [AC_DEFINE(BROKEN_SETRESUID)
3f176010 875 AC_MSG_RESULT(not implemented)]
876 )
877])
9a3fe0e2 878
3f176010 879AC_CHECK_FUNCS(setresgid, [
880 dnl Some platorms have setresgid that isn't implemented, test for this
881 AC_MSG_CHECKING(if setresgid seems to work)
882 AC_TRY_RUN([
9a3fe0e2 883#include <stdlib.h>
884#include <errno.h>
885int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
3f176010 886 ],
887 [AC_MSG_RESULT(yes)],
888 [AC_DEFINE(BROKEN_SETRESGID)
889 AC_MSG_RESULT(not implemented)]
890 )
891])
9a3fe0e2 892
2e73a022 893dnl Checks for time functions
1d7b9b20 894AC_CHECK_FUNCS(gettimeofday time)
2e73a022 895dnl Checks for utmp functions
b03bd394 896AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1d7b9b20 897AC_CHECK_FUNCS(utmpname)
2e73a022 898dnl Checks for utmpx functions
b03bd394 899AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1d7b9b20 900AC_CHECK_FUNCS(setutxent utmpxname)
76cd7316 901
aff51935 902AC_CHECK_FUNC(daemon,
beb43d31 903 [AC_DEFINE(HAVE_DAEMON)],
904 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
905)
906
aff51935 907AC_CHECK_FUNC(getpagesize,
aa6bd60a 908 [AC_DEFINE(HAVE_GETPAGESIZE)],
909 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
910)
911
2647ae26 912# Check for broken snprintf
913if test "x$ac_cv_func_snprintf" = "xyes" ; then
914 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
915 AC_TRY_RUN(
916 [
917#include <stdio.h>
aec4cb4f 918int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
2647ae26 919 ],
aff51935 920 [AC_MSG_RESULT(yes)],
2647ae26 921 [
922 AC_MSG_RESULT(no)
923 AC_DEFINE(BROKEN_SNPRINTF)
924 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
925 ]
926 )
927fi
928
70e7d0b0 929dnl see whether mkstemp() requires XXXXXX
930if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
931AC_MSG_CHECKING([for (overly) strict mkstemp])
932AC_TRY_RUN(
933 [
934#include <stdlib.h>
935main() { char template[]="conftest.mkstemp-test";
936if (mkstemp(template) == -1)
937 exit(1);
938unlink(template); exit(0);
939}
940 ],
941 [
942 AC_MSG_RESULT(no)
943 ],
aff51935 944 [
70e7d0b0 945 AC_MSG_RESULT(yes)
946 AC_DEFINE(HAVE_STRICT_MKSTEMP)
947 ],
948 [
949 AC_MSG_RESULT(yes)
950 AC_DEFINE(HAVE_STRICT_MKSTEMP)
aff51935 951 ]
70e7d0b0 952)
953fi
954
eacb954e 955dnl make sure that openpty does not reacquire controlling terminal
956if test ! -z "$check_for_openpty_ctty_bug"; then
957 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
958 AC_TRY_RUN(
959 [
960#include <stdio.h>
961#include <sys/fcntl.h>
962#include <sys/types.h>
963#include <sys/wait.h>
964
965int
966main()
967{
968 pid_t pid;
969 int fd, ptyfd, ttyfd, status;
970
971 pid = fork();
972 if (pid < 0) { /* failed */
973 exit(1);
974 } else if (pid > 0) { /* parent */
975 waitpid(pid, &status, 0);
aff51935 976 if (WIFEXITED(status))
eacb954e 977 exit(WEXITSTATUS(status));
978 else
979 exit(2);
980 } else { /* child */
981 close(0); close(1); close(2);
982 setsid();
983 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
984 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
985 if (fd >= 0)
986 exit(3); /* Acquired ctty: broken */
987 else
988 exit(0); /* Did not acquire ctty: OK */
989 }
990}
991 ],
992 [
993 AC_MSG_RESULT(yes)
994 ],
995 [
996 AC_MSG_RESULT(no)
997 AC_DEFINE(SSHD_ACQUIRES_CTTY)
998 ]
999 )
1000fi
1001
2fe51906 1002if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1003 AC_MSG_CHECKING(if getaddrinfo seems to work)
1004 AC_TRY_RUN(
1005 [
1006#include <stdio.h>
1007#include <sys/socket.h>
1008#include <netdb.h>
1009#include <errno.h>
1010#include <netinet/in.h>
1011
1012#define TEST_PORT "2222"
1013
1014int
1015main(void)
1016{
1017 int err, sock;
1018 struct addrinfo *gai_ai, *ai, hints;
1019 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1020
1021 memset(&hints, 0, sizeof(hints));
1022 hints.ai_family = PF_UNSPEC;
1023 hints.ai_socktype = SOCK_STREAM;
1024 hints.ai_flags = AI_PASSIVE;
1025
1026 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1027 if (err != 0) {
1028 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1029 exit(1);
1030 }
1031
1032 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1033 if (ai->ai_family != AF_INET6)
1034 continue;
1035
1036 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1037 sizeof(ntop), strport, sizeof(strport),
1038 NI_NUMERICHOST|NI_NUMERICSERV);
1039
1040 if (err != 0) {
1041 if (err == EAI_SYSTEM)
1042 perror("getnameinfo EAI_SYSTEM");
1043 else
1044 fprintf(stderr, "getnameinfo failed: %s\n",
1045 gai_strerror(err));
1046 exit(2);
1047 }
1048
1049 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1050 if (sock < 0)
1051 perror("socket");
1052 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1053 if (errno == EBADF)
1054 exit(3);
1055 }
1056 }
1057 exit(0);
1058}
1059 ],
1060 [
1061 AC_MSG_RESULT(yes)
1062 ],
1063 [
1064 AC_MSG_RESULT(no)
1065 AC_DEFINE(BROKEN_GETADDRINFO)
1066 ]
1067 )
1068fi
1069
7f8f5e00 1070AC_FUNC_GETPGRP
1071
717057b6 1072# Check for PAM libs
cbd7492e 1073PAM_MSG="no"
a0391976 1074AC_ARG_WITH(pam,
717057b6 1075 [ --with-pam Enable PAM support ],
a0391976 1076 [
717057b6 1077 if test "x$withval" != "xno" ; then
2511d104 1078 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1079 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
717057b6 1080 AC_MSG_ERROR([PAM headers not found])
1081 fi
a0391976 1082
717057b6 1083 AC_CHECK_LIB(dl, dlopen, , )
1084 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1085 AC_CHECK_FUNCS(pam_getenvlist)
749560dd 1086 AC_CHECK_FUNCS(pam_putenv)
2b763e31 1087
717057b6 1088 PAM_MSG="yes"
4cb5ffa0 1089
717057b6 1090 AC_DEFINE(USE_PAM)
98f2d9d5 1091 if test $ac_cv_lib_dl_dlopen = yes; then
1092 LIBPAM="-lpam -ldl"
1093 else
1094 LIBPAM="-lpam"
1095 fi
1096 AC_SUBST(LIBPAM)
717057b6 1097 fi
1098 ]
1099)
cbd7492e 1100
717057b6 1101# Check for older PAM
1102if test "x$PAM_MSG" = "xyes" ; then
a0391976 1103 # Check PAM strerror arguments (old PAM)
1104 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1105 AC_TRY_COMPILE(
1106 [
18ba2aab 1107#include <stdlib.h>
2511d104 1108#if defined(HAVE_SECURITY_PAM_APPL_H)
18ba2aab 1109#include <security/pam_appl.h>
2511d104 1110#elif defined (HAVE_PAM_PAM_APPL_H)
1111#include <pam/pam_appl.h>
1112#endif
aff51935 1113 ],
1114 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
a0391976 1115 [AC_MSG_RESULT(no)],
1116 [
1117 AC_DEFINE(HAVE_OLD_PAM)
1118 AC_MSG_RESULT(yes)
cbd7492e 1119 PAM_MSG="yes (old library)"
a0391976 1120 ]
717057b6 1121 )
a0391976 1122fi
1123
5b991353 1124# Search for OpenSSL
1125saved_CPPFLAGS="$CPPFLAGS"
1126saved_LDFLAGS="$LDFLAGS"
a0391976 1127AC_ARG_WITH(ssl-dir,
1128 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1129 [
e9e4a1c7 1130 if test "x$withval" != "xno" ; then
5b991353 1131 if test -d "$withval/lib"; then
1132 if test -n "${need_dash_r}"; then
1133 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1134 else
1135 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
d6f13fbb 1136 fi
1137 else
5b991353 1138 if test -n "${need_dash_r}"; then
1139 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1140 else
1141 LDFLAGS="-L${withval} ${LDFLAGS}"
d6f13fbb 1142 fi
1143 fi
5b991353 1144 if test -d "$withval/include"; then
1145 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
d6f13fbb 1146 else
5b991353 1147 CPPFLAGS="-I${withval} ${CPPFLAGS}"
58d100bf 1148 fi
a0391976 1149 fi
5b991353 1150 ]
1151)
5486a457 1152LIBS="-lcrypto $LIBS"
5b991353 1153AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
d45e3d76 1154 [
5b991353 1155 dnl Check default openssl install dir
1156 if test -n "${need_dash_r}"; then
1157 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
d45e3d76 1158 else
5b991353 1159 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
d45e3d76 1160 fi
5b991353 1161 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1162 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1163 [
1164 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1165 ]
1166 )
1167 ]
1168)
1169
cd018561 1170# Determine OpenSSL header version
1171AC_MSG_CHECKING([OpenSSL header version])
1172AC_TRY_RUN(
1173 [
1174#include <stdio.h>
1175#include <string.h>
1176#include <openssl/opensslv.h>
1177#define DATA "conftest.sslincver"
1178int main(void) {
aff51935 1179 FILE *fd;
1180 int rc;
cd018561 1181
aff51935 1182 fd = fopen(DATA,"w");
1183 if(fd == NULL)
1184 exit(1);
cd018561 1185
1186 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1187 exit(1);
1188
1189 exit(0);
1190}
1191 ],
1192 [
1193 ssl_header_ver=`cat conftest.sslincver`
1194 AC_MSG_RESULT($ssl_header_ver)
1195 ],
1196 [
1197 AC_MSG_RESULT(not found)
1198 AC_MSG_ERROR(OpenSSL version header not found.)
1199 ]
1200)
1201
1202# Determine OpenSSL library version
1203AC_MSG_CHECKING([OpenSSL library version])
1204AC_TRY_RUN(
1205 [
1206#include <stdio.h>
1207#include <string.h>
1208#include <openssl/opensslv.h>
1209#include <openssl/crypto.h>
1210#define DATA "conftest.ssllibver"
1211int main(void) {
aff51935 1212 FILE *fd;
1213 int rc;
cd018561 1214
aff51935 1215 fd = fopen(DATA,"w");
1216 if(fd == NULL)
1217 exit(1);
cd018561 1218
1219 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1220 exit(1);
1221
1222 exit(0);
1223}
1224 ],
1225 [
1226 ssl_library_ver=`cat conftest.ssllibver`
1227 AC_MSG_RESULT($ssl_library_ver)
1228 ],
1229 [
1230 AC_MSG_RESULT(not found)
1231 AC_MSG_ERROR(OpenSSL library not found.)
1232 ]
1233)
58d100bf 1234
9780116c 1235# Sanity check OpenSSL headers
1236AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1237AC_TRY_RUN(
1238 [
1239#include <string.h>
1240#include <openssl/opensslv.h>
aec4cb4f 1241int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
9780116c 1242 ],
1243 [
1244 AC_MSG_RESULT(yes)
1245 ],
1246 [
1247 AC_MSG_RESULT(no)
e15ba28b 1248 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1249Check config.log for details.
1250Also see contrib/findssl.sh for help identifying header/library mismatches.])
9780116c 1251 ]
1252)
1253
5486a457 1254# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1255# because the system crypt() is more featureful.
1256if test "x$check_for_libcrypt_before" = "x1"; then
1257 AC_CHECK_LIB(crypt, crypt)
1258fi
1259
aff51935 1260# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
8087c5ee 1261# version in OpenSSL.
05114c74 1262if test "x$check_for_libcrypt_later" = "x1"; then
20cad736 1263 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
717057b6 1264fi
1265
f1b0ecc3 1266
1267### Configure cryptographic random number support
1268
1269# Check wheter OpenSSL seeds itself
1270AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1271AC_TRY_RUN(
1272 [
1273#include <string.h>
1274#include <openssl/rand.h>
aec4cb4f 1275int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
f1b0ecc3 1276 ],
1277 [
1278 OPENSSL_SEEDS_ITSELF=yes
1279 AC_MSG_RESULT(yes)
1280 ],
1281 [
1282 AC_MSG_RESULT(no)
1283 # Default to use of the rand helper if OpenSSL doesn't
1284 # seed itself
1285 USE_RAND_HELPER=yes
1286 ]
1287)
1288
1289
1290# Do we want to force the use of the rand helper?
1291AC_ARG_WITH(rand-helper,
1292 [ --with-rand-helper Use subprocess to gather strong randomness ],
1293 [
1294 if test "x$withval" = "xno" ; then
aff51935 1295 # Force use of OpenSSL's internal RNG, even if
f1b0ecc3 1296 # the previous test showed it to be unseeded.
1297 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1298 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1299 OPENSSL_SEEDS_ITSELF=yes
1300 USE_RAND_HELPER=""
1301 fi
1302 else
1303 USE_RAND_HELPER=yes
1304 fi
1305 ],
1306)
1307
1308# Which randomness source do we use?
1309if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1310 # OpenSSL only
1311 AC_DEFINE(OPENSSL_PRNG_ONLY)
1312 RAND_MSG="OpenSSL internal ONLY"
1313 INSTALL_SSH_RAND_HELPER=""
70e2f2f3 1314elif test ! -z "$USE_RAND_HELPER" ; then
1315 # install rand helper
f1b0ecc3 1316 RAND_MSG="ssh-rand-helper"
1317 INSTALL_SSH_RAND_HELPER="yes"
1318fi
1319AC_SUBST(INSTALL_SSH_RAND_HELPER)
1320
1321### Configuration of ssh-rand-helper
1322
1323# PRNGD TCP socket
1324AC_ARG_WITH(prngd-port,
1325 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1326 [
eb5d7ff6 1327 case "$withval" in
1328 no)
1329 withval=""
1330 ;;
1331 [[0-9]]*)
1332 ;;
1333 *)
1334 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1335 ;;
1336 esac
1337 if test ! -z "$withval" ; then
f1b0ecc3 1338 PRNGD_PORT="$withval"
1339 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1340 fi
1341 ]
1342)
1343
1344# PRNGD Unix domain socket
1345AC_ARG_WITH(prngd-socket,
1346 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1347 [
eb5d7ff6 1348 case "$withval" in
1349 yes)
f1b0ecc3 1350 withval="/var/run/egd-pool"
eb5d7ff6 1351 ;;
1352 no)
1353 withval=""
1354 ;;
1355 /*)
1356 ;;
1357 *)
1358 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1359 ;;
1360 esac
1361
1362 if test ! -z "$withval" ; then
f1b0ecc3 1363 if test ! -z "$PRNGD_PORT" ; then
1364 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1365 fi
906e811b 1366 if test ! -r "$withval" ; then
f1b0ecc3 1367 AC_MSG_WARN(Entropy socket is not readable)
1368 fi
1369 PRNGD_SOCKET="$withval"
1370 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1371 fi
ddceb1c8 1372 ],
1373 [
1374 # Check for existing socket only if we don't have a random device already
1375 if test "$USE_RAND_HELPER" = yes ; then
1376 AC_MSG_CHECKING(for PRNGD/EGD socket)
1377 # Insert other locations here
1378 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1379 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1380 PRNGD_SOCKET="$sock"
1381 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1382 break;
1383 fi
1384 done
1385 if test ! -z "$PRNGD_SOCKET" ; then
1386 AC_MSG_RESULT($PRNGD_SOCKET)
1387 else
1388 AC_MSG_RESULT(not found)
1389 fi
1390 fi
f1b0ecc3 1391 ]
1392)
1393
1394# Change default command timeout for hashing entropy source
1395entropy_timeout=200
1396AC_ARG_WITH(entropy-timeout,
1397 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1398 [
1399 if test "x$withval" != "xno" ; then
1400 entropy_timeout=$withval
1401 fi
1402 ]
1403)
f1b0ecc3 1404AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1405
fd3cbf67 1406SSH_PRIVSEP_USER=sshd
9a0fbcb3 1407AC_ARG_WITH(privsep-user,
5222e7ef 1408 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
9a0fbcb3 1409 [
1410 if test -n "$withval"; then
fd3cbf67 1411 SSH_PRIVSEP_USER=$withval
9a0fbcb3 1412 fi
1413 ]
1414)
fd3cbf67 1415AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1416AC_SUBST(SSH_PRIVSEP_USER)
9a0fbcb3 1417
81dadca3 1418# We do this little dance with the search path to insure
1419# that programs that we select for use by installed programs
1420# (which may be run by the super-user) come from trusted
1421# locations before they come from the user's private area.
1422# This should help avoid accidentally configuring some
1423# random version of a program in someone's personal bin.
1424
1425OPATH=$PATH
1426PATH=/bin:/usr/bin
f95c8ce8 1427test -h /bin 2> /dev/null && PATH=/usr/bin
81dadca3 1428test -d /sbin && PATH=$PATH:/sbin
1429test -d /usr/sbin && PATH=$PATH:/usr/sbin
1430PATH=$PATH:/etc:$OPATH
1431
aff51935 1432# These programs are used by the command hashing source to gather entropy
f1b0ecc3 1433OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1434OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1435OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1436OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1437OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1438OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1439OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1440OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1441OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1442OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1443OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1444OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1445OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1446OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1447OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1448OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
81dadca3 1449# restore PATH
1450PATH=$OPATH
f1b0ecc3 1451
1452# Where does ssh-rand-helper get its randomness from?
1453INSTALL_SSH_PRNG_CMDS=""
1454if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1455 if test ! -z "$PRNGD_PORT" ; then
1456 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1457 elif test ! -z "$PRNGD_SOCKET" ; then
1458 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1459 else
1460 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1461 RAND_HELPER_CMDHASH=yes
1462 INSTALL_SSH_PRNG_CMDS="yes"
1463 fi
1464fi
1465AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1466
1467
66d6c27e 1468# Cheap hack to ensure NEWS-OS libraries are arranged right.
1469if test ! -z "$SONY" ; then
1470 LIBS="$LIBS -liberty";
1471fi
1472
a0391976 1473# Checks for data types
976f7e19 1474AC_CHECK_SIZEOF(char, 1)
2b942fe0 1475AC_CHECK_SIZEOF(short int, 2)
1476AC_CHECK_SIZEOF(int, 4)
1477AC_CHECK_SIZEOF(long int, 4)
1478AC_CHECK_SIZEOF(long long int, 8)
1479
52f1ccb2 1480# Sanity check long long for some platforms (AIX)
1481if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1482 ac_cv_sizeof_long_long_int=0
1483fi
1484
a0391976 1485# More checks for data types
14a9a859 1486AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1487 AC_TRY_COMPILE(
aff51935 1488 [ #include <sys/types.h> ],
1489 [ u_int a; a = 1;],
14a9a859 1490 [ ac_cv_have_u_int="yes" ],
1491 [ ac_cv_have_u_int="no" ]
1492 )
1493])
1494if test "x$ac_cv_have_u_int" = "xyes" ; then
1495 AC_DEFINE(HAVE_U_INT)
1496 have_u_int=1
1497fi
1498
58d100bf 1499AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1500 AC_TRY_COMPILE(
aff51935 1501 [ #include <sys/types.h> ],
1502 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
58d100bf 1503 [ ac_cv_have_intxx_t="yes" ],
1504 [ ac_cv_have_intxx_t="no" ]
1505 )
1506])
1507if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1508 AC_DEFINE(HAVE_INTXX_T)
1509 have_intxx_t=1
1510fi
41cb4569 1511
1512if (test -z "$have_intxx_t" && \
aff51935 1513 test "x$ac_cv_header_stdint_h" = "xyes")
41cb4569 1514then
1515 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1516 AC_TRY_COMPILE(
aff51935 1517 [ #include <stdint.h> ],
1518 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
41cb4569 1519 [
1520 AC_DEFINE(HAVE_INTXX_T)
1521 AC_MSG_RESULT(yes)
1522 ],
1523 [ AC_MSG_RESULT(no) ]
1524 )
1525fi
1526
bd590612 1527AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1528 AC_TRY_COMPILE(
1cbbe6c8 1529 [
1530#include <sys/types.h>
1531#ifdef HAVE_STDINT_H
1532# include <stdint.h>
1533#endif
1534#include <sys/socket.h>
1535#ifdef HAVE_SYS_BITYPES_H
1536# include <sys/bitypes.h>
1537#endif
aff51935 1538 ],
1539 [ int64_t a; a = 1;],
bd590612 1540 [ ac_cv_have_int64_t="yes" ],
1541 [ ac_cv_have_int64_t="no" ]
1542 )
1543])
1544if test "x$ac_cv_have_int64_t" = "xyes" ; then
1545 AC_DEFINE(HAVE_INT64_T)
ddceb1c8 1546fi
1547
58d100bf 1548AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1549 AC_TRY_COMPILE(
aff51935 1550 [ #include <sys/types.h> ],
1551 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
58d100bf 1552 [ ac_cv_have_u_intxx_t="yes" ],
1553 [ ac_cv_have_u_intxx_t="no" ]
1554 )
1555])
1556if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1557 AC_DEFINE(HAVE_U_INTXX_T)
1558 have_u_intxx_t=1
1559fi
2b942fe0 1560
41cb4569 1561if test -z "$have_u_intxx_t" ; then
1562 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1563 AC_TRY_COMPILE(
aff51935 1564 [ #include <sys/socket.h> ],
1565 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
41cb4569 1566 [
1567 AC_DEFINE(HAVE_U_INTXX_T)
1568 AC_MSG_RESULT(yes)
1569 ],
1570 [ AC_MSG_RESULT(no) ]
1571 )
1572fi
1573
bd590612 1574AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1575 AC_TRY_COMPILE(
aff51935 1576 [ #include <sys/types.h> ],
1577 [ u_int64_t a; a = 1;],
bd590612 1578 [ ac_cv_have_u_int64_t="yes" ],
1579 [ ac_cv_have_u_int64_t="no" ]
1580 )
1581])
1582if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1583 AC_DEFINE(HAVE_U_INT64_T)
1584 have_u_int64_t=1
1585fi
1586
ddceb1c8 1587if test -z "$have_u_int64_t" ; then
1588 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1589 AC_TRY_COMPILE(
aff51935 1590 [ #include <sys/bitypes.h> ],
ddceb1c8 1591 [ u_int64_t a; a = 1],
1592 [
1593 AC_DEFINE(HAVE_U_INT64_T)
1594 AC_MSG_RESULT(yes)
1595 ],
1596 [ AC_MSG_RESULT(no) ]
1597 )
1598fi
1599
41cb4569 1600if test -z "$have_u_intxx_t" ; then
1601 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1602 AC_TRY_COMPILE(
1603 [
1604#include <sys/types.h>
aff51935 1605 ],
1606 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
41cb4569 1607 [ ac_cv_have_uintxx_t="yes" ],
1608 [ ac_cv_have_uintxx_t="no" ]
1609 )
1610 ])
1611 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1612 AC_DEFINE(HAVE_UINTXX_T)
1613 fi
1614fi
1615
1616if test -z "$have_uintxx_t" ; then
1617 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1618 AC_TRY_COMPILE(
aff51935 1619 [ #include <stdint.h> ],
1620 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
41cb4569 1621 [
1622 AC_DEFINE(HAVE_UINTXX_T)
1623 AC_MSG_RESULT(yes)
1624 ],
1625 [ AC_MSG_RESULT(no) ]
1626 )
1627fi
1628
e5fe9a1f 1629if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
aff51935 1630 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
5cdfe03f 1631then
1632 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1633 AC_TRY_COMPILE(
58d100bf 1634 [
1635#include <sys/bitypes.h>
aff51935 1636 ],
5cdfe03f 1637 [
837c30b8 1638 int8_t a; int16_t b; int32_t c;
1639 u_int8_t e; u_int16_t f; u_int32_t g;
1640 a = b = c = e = f = g = 1;
aff51935 1641 ],
5cdfe03f 1642 [
1643 AC_DEFINE(HAVE_U_INTXX_T)
1644 AC_DEFINE(HAVE_INTXX_T)
1645 AC_MSG_RESULT(yes)
1646 ],
1647 [AC_MSG_RESULT(no)]
aff51935 1648 )
5cdfe03f 1649fi
1650
0362750e 1651
1652AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1653 AC_TRY_COMPILE(
1654 [
1655#include <sys/types.h>
1656 ],
1657 [ u_char foo; foo = 125; ],
1658 [ ac_cv_have_u_char="yes" ],
1659 [ ac_cv_have_u_char="no" ]
1660 )
1661])
1662if test "x$ac_cv_have_u_char" = "xyes" ; then
1663 AC_DEFINE(HAVE_U_CHAR)
1664fi
1665
98a7c37b 1666TYPE_SOCKLEN_T
2b942fe0 1667
2d16d9a3 1668AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
ddceb1c8 1669
58d100bf 1670AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1671 AC_TRY_COMPILE(
1672 [
18ba2aab 1673#include <sys/types.h>
58d100bf 1674 ],
1675 [ size_t foo; foo = 1235; ],
1676 [ ac_cv_have_size_t="yes" ],
1677 [ ac_cv_have_size_t="no" ]
1678 )
1679])
1680if test "x$ac_cv_have_size_t" = "xyes" ; then
1681 AC_DEFINE(HAVE_SIZE_T)
1682fi
ea1970a3 1683
c04f75f1 1684AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1685 AC_TRY_COMPILE(
1686 [
1687#include <sys/types.h>
1688 ],
1689 [ ssize_t foo; foo = 1235; ],
1690 [ ac_cv_have_ssize_t="yes" ],
1691 [ ac_cv_have_ssize_t="no" ]
1692 )
1693])
1694if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1695 AC_DEFINE(HAVE_SSIZE_T)
1696fi
1697
f1c4659d 1698AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1699 AC_TRY_COMPILE(
1700 [
1701#include <time.h>
1702 ],
1703 [ clock_t foo; foo = 1235; ],
1704 [ ac_cv_have_clock_t="yes" ],
1705 [ ac_cv_have_clock_t="no" ]
1706 )
1707])
1708if test "x$ac_cv_have_clock_t" = "xyes" ; then
1709 AC_DEFINE(HAVE_CLOCK_T)
1710fi
1711
1c04b088 1712AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1713 AC_TRY_COMPILE(
1714 [
1715#include <sys/types.h>
1716#include <sys/socket.h>
1717 ],
1718 [ sa_family_t foo; foo = 1235; ],
1719 [ ac_cv_have_sa_family_t="yes" ],
77bb0bca 1720 [ AC_TRY_COMPILE(
1721 [
1722#include <sys/types.h>
1723#include <sys/socket.h>
1724#include <netinet/in.h>
1725 ],
1726 [ sa_family_t foo; foo = 1235; ],
1727 [ ac_cv_have_sa_family_t="yes" ],
1728
1c04b088 1729 [ ac_cv_have_sa_family_t="no" ]
77bb0bca 1730 )]
1c04b088 1731 )
1732])
1733if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1734 AC_DEFINE(HAVE_SA_FAMILY_T)
1735fi
1736
729bfe59 1737AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1738 AC_TRY_COMPILE(
1739 [
1740#include <sys/types.h>
1741 ],
1742 [ pid_t foo; foo = 1235; ],
1743 [ ac_cv_have_pid_t="yes" ],
1744 [ ac_cv_have_pid_t="no" ]
1745 )
1746])
1747if test "x$ac_cv_have_pid_t" = "xyes" ; then
1748 AC_DEFINE(HAVE_PID_T)
1749fi
1750
1751AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1752 AC_TRY_COMPILE(
1753 [
1754#include <sys/types.h>
1755 ],
1756 [ mode_t foo; foo = 1235; ],
1757 [ ac_cv_have_mode_t="yes" ],
1758 [ ac_cv_have_mode_t="no" ]
1759 )
1760])
1761if test "x$ac_cv_have_mode_t" = "xyes" ; then
1762 AC_DEFINE(HAVE_MODE_T)
1763fi
1764
e3a93db0 1765
58d100bf 1766AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1767 AC_TRY_COMPILE(
1768 [
18ba2aab 1769#include <sys/types.h>
1770#include <sys/socket.h>
58d100bf 1771 ],
1772 [ struct sockaddr_storage s; ],
1773 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1774 [ ac_cv_have_struct_sockaddr_storage="no" ]
1775 )
1776])
1777if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1778 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1779fi
48e671d5 1780
58d100bf 1781AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1782 AC_TRY_COMPILE(
1783 [
cbd7492e 1784#include <sys/types.h>
58d100bf 1785#include <netinet/in.h>
1786 ],
1787 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1788 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1789 [ ac_cv_have_struct_sockaddr_in6="no" ]
1790 )
1791])
1792if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1793 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1794fi
48e671d5 1795
58d100bf 1796AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1797 AC_TRY_COMPILE(
1798 [
cbd7492e 1799#include <sys/types.h>
58d100bf 1800#include <netinet/in.h>
1801 ],
1802 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1803 [ ac_cv_have_struct_in6_addr="yes" ],
1804 [ ac_cv_have_struct_in6_addr="no" ]
1805 )
1806])
1807if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1808 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1809fi
48e671d5 1810
58d100bf 1811AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1812 AC_TRY_COMPILE(
1813 [
18ba2aab 1814#include <sys/types.h>
1815#include <sys/socket.h>
1816#include <netdb.h>
58d100bf 1817 ],
1818 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1819 [ ac_cv_have_struct_addrinfo="yes" ],
1820 [ ac_cv_have_struct_addrinfo="no" ]
1821 )
1822])
1823if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1824 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1825fi
1826
89c7e31c 1827AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1828 AC_TRY_COMPILE(
aff51935 1829 [ #include <sys/time.h> ],
1830 [ struct timeval tv; tv.tv_sec = 1;],
89c7e31c 1831 [ ac_cv_have_struct_timeval="yes" ],
1832 [ ac_cv_have_struct_timeval="no" ]
1833 )
1834])
1835if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1836 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1837 have_struct_timeval=1
1838fi
1839
5271b55c 1840AC_CHECK_TYPES(struct timespec)
1841
85abc74b 1842# We need int64_t or else certian parts of the compile will fail.
2c523de9 1843if test "x$ac_cv_have_int64_t" = "xno" -a \
1844 "x$ac_cv_sizeof_long_int" != "x8" -a \
1845 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
85abc74b 1846 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1847 echo "an alternative compiler (I.E., GCC) before continuing."
1848 echo ""
1849 exit 1;
733cf7f4 1850else
1851dnl test snprintf (broken on SCO w/gcc)
1852 AC_TRY_RUN(
1853 [
1854#include <stdio.h>
1855#include <string.h>
1856#ifdef HAVE_SNPRINTF
1857main()
1858{
1859 char buf[50];
1860 char expected_out[50];
1861 int mazsize = 50 ;
1862#if (SIZEOF_LONG_INT == 8)
1863 long int num = 0x7fffffffffffffff;
1864#else
763a1a18 1865 long long num = 0x7fffffffffffffffll;
733cf7f4 1866#endif
1867 strcpy(expected_out, "9223372036854775807");
1868 snprintf(buf, mazsize, "%lld", num);
1869 if(strcmp(buf, expected_out) != 0)
aff51935 1870 exit(1);
733cf7f4 1871 exit(0);
1872}
1873#else
1874main() { exit(0); }
1875#endif
1876 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1877 )
2c523de9 1878fi
1879
77bb0bca 1880dnl Checks for structure members
58d100bf 1881OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1882OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1883OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1884OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1885OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
25422c70 1886OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
58d100bf 1887OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1888OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
daaff4d5 1889OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
58d100bf 1890OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1891OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1892OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1893OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1d7b9b20 1894OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1895OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1896OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1897OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
98a7c37b 1898
1899AC_CHECK_MEMBERS([struct stat.st_blksize])
1d7b9b20 1900
58d100bf 1901AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1902 ac_cv_have_ss_family_in_struct_ss, [
1903 AC_TRY_COMPILE(
1904 [
18ba2aab 1905#include <sys/types.h>
1906#include <sys/socket.h>
58d100bf 1907 ],
1908 [ struct sockaddr_storage s; s.ss_family = 1; ],
1909 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1910 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1911 )
1912])
1913if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1914 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1915fi
1916
58d100bf 1917AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1918 ac_cv_have___ss_family_in_struct_ss, [
1919 AC_TRY_COMPILE(
1920 [
18ba2aab 1921#include <sys/types.h>
1922#include <sys/socket.h>
58d100bf 1923 ],
1924 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1925 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1926 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1927 )
1928])
1929if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1930 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1931fi
1932
2e73a022 1933AC_CACHE_CHECK([for pw_class field in struct passwd],
1934 ac_cv_have_pw_class_in_struct_passwd, [
1935 AC_TRY_COMPILE(
1936 [
2e73a022 1937#include <pwd.h>
1938 ],
97994d32 1939 [ struct passwd p; p.pw_class = 0; ],
2e73a022 1940 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1941 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1942 )
1943])
1944if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1945 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1946fi
1947
7751d4eb 1948AC_CACHE_CHECK([for pw_expire field in struct passwd],
1949 ac_cv_have_pw_expire_in_struct_passwd, [
1950 AC_TRY_COMPILE(
1951 [
1952#include <pwd.h>
1953 ],
1954 [ struct passwd p; p.pw_expire = 0; ],
1955 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1956 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1957 )
1958])
1959if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1960 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1961fi
1962
1963AC_CACHE_CHECK([for pw_change field in struct passwd],
1964 ac_cv_have_pw_change_in_struct_passwd, [
1965 AC_TRY_COMPILE(
1966 [
1967#include <pwd.h>
1968 ],
1969 [ struct passwd p; p.pw_change = 0; ],
1970 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1971 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1972 )
1973])
1974if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1975 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1976fi
58d100bf 1977
637f9177 1978dnl make sure we're using the real structure members and not defines
6f34652e 1979AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1980 ac_cv_have_accrights_in_msghdr, [
637f9177 1981 AC_TRY_RUN(
6f34652e 1982 [
f95c8ce8 1983#include <sys/types.h>
6f34652e 1984#include <sys/socket.h>
1985#include <sys/uio.h>
637f9177 1986int main() {
1987#ifdef msg_accrights
1988exit(1);
1989#endif
1990struct msghdr m;
1991m.msg_accrights = 0;
1992exit(0);
1993}
6f34652e 1994 ],
6f34652e 1995 [ ac_cv_have_accrights_in_msghdr="yes" ],
1996 [ ac_cv_have_accrights_in_msghdr="no" ]
1997 )
1998])
1999if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2000 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2001fi
2002
7176df4f 2003AC_CACHE_CHECK([for msg_control field in struct msghdr],
2004 ac_cv_have_control_in_msghdr, [
637f9177 2005 AC_TRY_RUN(
7176df4f 2006 [
f95c8ce8 2007#include <sys/types.h>
7176df4f 2008#include <sys/socket.h>
2009#include <sys/uio.h>
637f9177 2010int main() {
2011#ifdef msg_control
2012exit(1);
2013#endif
2014struct msghdr m;
2015m.msg_control = 0;
2016exit(0);
2017}
7176df4f 2018 ],
7176df4f 2019 [ ac_cv_have_control_in_msghdr="yes" ],
2020 [ ac_cv_have_control_in_msghdr="no" ]
2021 )
2022])
2023if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2024 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2025fi
2026
58d100bf 2027AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
aff51935 2028 AC_TRY_LINK([],
2029 [ extern char *__progname; printf("%s", __progname); ],
58d100bf 2030 [ ac_cv_libc_defines___progname="yes" ],
2031 [ ac_cv_libc_defines___progname="no" ]
2032 )
2033])
2034if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2035 AC_DEFINE(HAVE___PROGNAME)
2036fi
8946db53 2037
c921ee00 2038AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2039 AC_TRY_LINK([
2040#include <stdio.h>
aff51935 2041],
2042 [ printf("%s", __FUNCTION__); ],
c921ee00 2043 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2044 [ ac_cv_cc_implements___FUNCTION__="no" ]
2045 )
2046])
2047if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2048 AC_DEFINE(HAVE___FUNCTION__)
2049fi
2050
2051AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2052 AC_TRY_LINK([
2053#include <stdio.h>
aff51935 2054],
2055 [ printf("%s", __func__); ],
c921ee00 2056 [ ac_cv_cc_implements___func__="yes" ],
2057 [ ac_cv_cc_implements___func__="no" ]
2058 )
2059])
2060if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2061 AC_DEFINE(HAVE___func__)
2062fi
2063
1812a662 2064AC_CACHE_CHECK([whether getopt has optreset support],
2065 ac_cv_have_getopt_optreset, [
2066 AC_TRY_LINK(
2067 [
2068#include <getopt.h>
2069 ],
2070 [ extern int optreset; optreset = 0; ],
2071 [ ac_cv_have_getopt_optreset="yes" ],
2072 [ ac_cv_have_getopt_optreset="no" ]
2073 )
2074])
2075if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2076 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2077fi
a0391976 2078
819b676f 2079AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
aff51935 2080 AC_TRY_LINK([],
2081 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
819b676f 2082 [ ac_cv_libc_defines_sys_errlist="yes" ],
2083 [ ac_cv_libc_defines_sys_errlist="no" ]
2084 )
2085])
2086if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2087 AC_DEFINE(HAVE_SYS_ERRLIST)
2088fi
2089
2090
416ed5a7 2091AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
aff51935 2092 AC_TRY_LINK([],
2093 [ extern int sys_nerr; printf("%i", sys_nerr);],
416ed5a7 2094 [ ac_cv_libc_defines_sys_nerr="yes" ],
2095 [ ac_cv_libc_defines_sys_nerr="no" ]
2096 )
2097])
2098if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2099 AC_DEFINE(HAVE_SYS_NERR)
2100fi
2101
aff51935 2102SCARD_MSG="no"
295c8801 2103# Check whether user wants sectok support
2104AC_ARG_WITH(sectok,
2105 [ --with-sectok Enable smartcard support using libsectok],
d0b19c95 2106 [
2107 if test "x$withval" != "xno" ; then
2108 if test "x$withval" != "xyes" ; then
2109 CPPFLAGS="$CPPFLAGS -I${withval}"
2110 LDFLAGS="$LDFLAGS -L${withval}"
2111 if test ! -z "$need_dash_r" ; then
2112 LDFLAGS="$LDFLAGS -R${withval}"
2113 fi
2114 if test ! -z "$blibpath" ; then
2115 blibpath="$blibpath:${withval}"
2116 fi
2117 fi
2118 AC_CHECK_HEADERS(sectok.h)
2119 if test "$ac_cv_header_sectok_h" != yes; then
2120 AC_MSG_ERROR(Can't find sectok.h)
2121 fi
2122 AC_CHECK_LIB(sectok, sectok_open)
2123 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2124 AC_MSG_ERROR(Can't find libsectok)
2125 fi
2126 AC_DEFINE(SMARTCARD)
295c8801 2127 AC_DEFINE(USE_SECTOK)
aff51935 2128 SCARD_MSG="yes, using sectok"
295c8801 2129 fi
2130 ]
2131)
2132
2133# Check whether user wants OpenSC support
2134AC_ARG_WITH(opensc,
49ef62db 2135 AC_HELP_STRING([--with-opensc=PFX],
2136 [Enable smartcard support using OpenSC]),
2137 opensc_config_prefix="$withval", opensc_config_prefix="")
2138if test x$opensc_config_prefix != x ; then
2139 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2140 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2141 if test "$OPENSC_CONFIG" != "no"; then
2142 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2143 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2144 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2145 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2146 AC_DEFINE(SMARTCARD)
2147 AC_DEFINE(USE_OPENSC)
aff51935 2148 SCARD_MSG="yes, using OpenSC"
49ef62db 2149 fi
2150fi
d0b19c95 2151
c31dc31c 2152# Check libraries needed by DNS fingerprint support
aff51935 2153AC_SEARCH_LIBS(getrrsetbyname, resolv,
c31dc31c 2154 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
3e05e934 2155 [
c31dc31c 2156 # Needed by our getrrsetbyname()
2157 AC_SEARCH_LIBS(res_query, resolv)
2158 AC_SEARCH_LIBS(dn_expand, resolv)
dabb524a 2159 AC_MSG_CHECKING(if res_query will link)
2160 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2161 [AC_MSG_RESULT(no)
2162 saved_LIBS="$LIBS"
2163 LIBS="$LIBS -lresolv"
2164 AC_MSG_CHECKING(for res_query in -lresolv)
2165 AC_LINK_IFELSE([
2166#include <resolv.h>
2167int main()
2168{
2169 res_query (0, 0, 0, 0, 0);
2170 return 0;
2171}
2172 ],
2173 [LIBS="$LIBS -lresolv"
2174 AC_MSG_RESULT(yes)],
2175 [LIBS="$saved_LIBS"
2176 AC_MSG_RESULT(no)])
2177 ])
c31dc31c 2178 AC_CHECK_FUNCS(_getshort _getlong)
2179 AC_CHECK_MEMBER(HEADER.ad,
2180 [AC_DEFINE(HAVE_HEADER_AD)],,
2181 [#include <arpa/nameser.h>])
2182 ])
3e05e934 2183
12928e80 2184# Check whether user wants Kerberos 5 support
aff51935 2185KRB5_MSG="no"
12928e80 2186AC_ARG_WITH(kerberos5,
aff51935 2187 [ --with-kerberos5=PATH Enable Kerberos 5 support],
5585c441 2188 [ if test "x$withval" != "xno" ; then
2189 if test "x$withval" = "xyes" ; then
2190 KRB5ROOT="/usr/local"
2191 else
2192 KRB5ROOT=${withval}
2193 fi
2194
2195 AC_DEFINE(KRB5)
2196 KRB5_MSG="yes"
2197
2198 AC_MSG_CHECKING(for krb5-config)
2199 if test -x $KRB5ROOT/bin/krb5-config ; then
2200 KRB5CONF=$KRB5ROOT/bin/krb5-config
2201 AC_MSG_RESULT($KRB5CONF)
2202
2203 AC_MSG_CHECKING(for gssapi support)
2204 if $KRB5CONF | grep gssapi >/dev/null ; then
2205 AC_MSG_RESULT(yes)
071970fb 2206 AC_DEFINE(GSSAPI)
2207 k5confopts=gssapi
aff51935 2208 else
5585c441 2209 AC_MSG_RESULT(no)
071970fb 2210 k5confopts=""
aff51935 2211 fi
071970fb 2212 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2213 K5LIBS="`$KRB5CONF --libs $k5confopts`"
5585c441 2214 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
5585c441 2215 AC_MSG_CHECKING(whether we are using Heimdal)
2216 AC_TRY_COMPILE([ #include <krb5.h> ],
2217 [ char *tmp = heimdal_version; ],
2218 [ AC_MSG_RESULT(yes)
2219 AC_DEFINE(HEIMDAL) ],
2220 AC_MSG_RESULT(no)
2221 )
2222 else
2223 AC_MSG_RESULT(no)
12928e80 2224 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
aff51935 2225 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
aff51935 2226 AC_MSG_CHECKING(whether we are using Heimdal)
2227 AC_TRY_COMPILE([ #include <krb5.h> ],
2228 [ char *tmp = heimdal_version; ],
2229 [ AC_MSG_RESULT(yes)
2230 AC_DEFINE(HEIMDAL)
41707f74 2231 K5LIBS="-lkrb5 -ldes"
2232 K5LIBS="$K5LIBS -lcom_err -lasn1"
2233 AC_CHECK_LIB(roken, net_write,
2234 [K5LIBS="$K5LIBS -lroken"])
aff51935 2235 ],
2236 [ AC_MSG_RESULT(no)
2237 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2238 ]
2239 )
4e00038c 2240 AC_SEARCH_LIBS(dn_expand, resolv)
12928e80 2241
749560dd 2242 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2243 [ AC_DEFINE(GSSAPI)
2244 K5LIBS="-lgssapi $K5LIBS" ],
2245 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2246 [ AC_DEFINE(GSSAPI)
aff51935 2247 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
749560dd 2248 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2249 $K5LIBS)
2250 ],
2251 $K5LIBS)
2252
2253 AC_CHECK_HEADER(gssapi.h, ,
2254 [ unset ac_cv_header_gssapi_h
aff51935 2255 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
749560dd 2256 AC_CHECK_HEADERS(gssapi.h, ,
2257 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
aff51935 2258 )
749560dd 2259 ]
2260 )
2261
2262 oldCPP="$CPPFLAGS"
2263 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2264 AC_CHECK_HEADER(gssapi_krb5.h, ,
2265 [ CPPFLAGS="$oldCPP" ])
2266
aff51935 2267 fi
5585c441 2268 if test ! -z "$need_dash_r" ; then
2269 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2270 fi
2271 if test ! -z "$blibpath" ; then
2272 blibpath="$blibpath:${KRB5ROOT}/lib"
2273 fi
071970fb 2274 fi
2275
2276 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2277 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2278 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2279
2280 LIBS="$LIBS $K5LIBS"
2281 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
79753592 2282 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
071970fb 2283 ]
12928e80 2284)
b5b68128 2285
a0391976 2286# Looking for programs, paths and files
a0391976 2287
ecac8ee5 2288PRIVSEP_PATH=/var/empty
2289AC_ARG_WITH(privsep-path,
cda1ebcb 2290 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
ecac8ee5 2291 [
2292 if test "x$withval" != "$no" ; then
2293 PRIVSEP_PATH=$withval
2294 fi
2295 ]
2296)
2297AC_SUBST(PRIVSEP_PATH)
2298
a0391976 2299AC_ARG_WITH(xauth,
2300 [ --with-xauth=PATH Specify path to xauth program ],
2301 [
00937921 2302 if test "x$withval" != "xno" ; then
cbd7492e 2303 xauth_path=$withval
a0391976 2304 fi
2305 ],
2306 [
2bf42e4a 2307 TestPath="$PATH"
2308 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2309 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2310 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2311 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2312 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
e5fe9a1f 2313 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
a0391976 2314 xauth_path="/usr/openwin/bin/xauth"
2315 fi
2316 ]
2317)
2318
65a4b4af 2319STRIP_OPT=-s
2320AC_ARG_ENABLE(strip,
2321 [ --disable-strip Disable calling strip(1) on install],
2322 [
2323 if test "x$enableval" = "xno" ; then
2324 STRIP_OPT=
2325 fi
2326 ]
2327)
2328AC_SUBST(STRIP_OPT)
2329
b3ec54b4 2330if test -z "$xauth_path" ; then
2331 XAUTH_PATH="undefined"
2332 AC_SUBST(XAUTH_PATH)
2333else
a0391976 2334 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
b3ec54b4 2335 XAUTH_PATH=$xauth_path
2336 AC_SUBST(XAUTH_PATH)
a0391976 2337fi
a0391976 2338
2339# Check for mail directory (last resort if we cannot get it from headers)
2340if test ! -z "$MAIL" ; then
2341 maildir=`dirname $MAIL`
2342 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2343fi
2344
a0391976 2345if test -z "$no_dev_ptmx" ; then
6e879cb4 2346 if test "x$disable_ptmx_check" != "xyes" ; then
aff51935 2347 AC_CHECK_FILE("/dev/ptmx",
6e879cb4 2348 [
2349 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2350 have_dev_ptmx=1
2351 ]
2352 )
2353 fi
3276571c 2354fi
aff51935 2355AC_CHECK_FILE("/dev/ptc",
3276571c 2356 [
2357 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2358 have_dev_ptc=1
2359 ]
2360)
2361
a0391976 2362# Options from here on. Some of these are preset by platform above
fdf6b7aa 2363AC_ARG_WITH(mantype,
5d97cfbf 2364 [ --with-mantype=man|cat|doc Set man page type],
c54a6257 2365 [
5d97cfbf 2366 case "$withval" in
2367 man|cat|doc)
2368 MANTYPE=$withval
2369 ;;
2370 *)
2371 AC_MSG_ERROR(invalid man type: $withval)
2372 ;;
2373 esac
c54a6257 2374 ]
2375)
e0c4d3ac 2376if test -z "$MANTYPE"; then
2bf42e4a 2377 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2378 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
e0c4d3ac 2379 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2380 MANTYPE=doc
2381 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2382 MANTYPE=man
2383 else
2384 MANTYPE=cat
2385 fi
2386fi
c54a6257 2387AC_SUBST(MANTYPE)
e0c4d3ac 2388if test "$MANTYPE" = "doc"; then
2389 mansubdir=man;
2390else
2391 mansubdir=$MANTYPE;
2392fi
2393AC_SUBST(mansubdir)
0bc5b6fb 2394
a0391976 2395# Check whether to enable MD5 passwords
aff51935 2396MD5_MSG="no"
2ddcfdf3 2397AC_ARG_WITH(md5-passwords,
caf3bc51 2398 [ --with-md5-passwords Enable use of MD5 passwords],
0bc5b6fb 2399 [
bcf36c78 2400 if test "x$withval" != "xno" ; then
0bc5b6fb 2401 AC_DEFINE(HAVE_MD5_PASSWORDS)
aff51935 2402 MD5_MSG="yes"
0bc5b6fb 2403 fi
2404 ]
caf3bc51 2405)
2406
a0391976 2407# Whether to disable shadow password support
a7effaac 2408AC_ARG_WITH(shadow,
2409 [ --without-shadow Disable shadow password support],
2410 [
2411 if test "x$withval" = "xno" ; then
2412 AC_DEFINE(DISABLE_SHADOW)
4cb5ffa0 2413 disable_shadow=yes
a7effaac 2414 fi
2415 ]
2416)
2417
4cb5ffa0 2418if test -z "$disable_shadow" ; then
2419 AC_MSG_CHECKING([if the systems has expire shadow information])
2420 AC_TRY_COMPILE(
2421 [
2422#include <sys/types.h>
2423#include <shadow.h>
2424 struct spwd sp;
2425 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2426 [ sp_expire_available=yes ], []
2427 )
2428
2429 if test "x$sp_expire_available" = "xyes" ; then
2430 AC_MSG_RESULT(yes)
2431 AC_DEFINE(HAS_SHADOW_EXPIRE)
2432 else
2433 AC_MSG_RESULT(no)
2434 fi
2435fi
2436
a0391976 2437# Use ip address instead of hostname in $DISPLAY
44839801 2438if test ! -z "$IPADDR_IN_DISPLAY" ; then
2439 DISPLAY_HACK_MSG="yes"
2440 AC_DEFINE(IPADDR_IN_DISPLAY)
2441else
aff51935 2442 DISPLAY_HACK_MSG="no"
44839801 2443 AC_ARG_WITH(ipaddr-display,
2444 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2445 [
2446 if test "x$withval" != "xno" ; then
2447 AC_DEFINE(IPADDR_IN_DISPLAY)
aff51935 2448 DISPLAY_HACK_MSG="yes"
44839801 2449 fi
2450 ]
2451 )
2452fi
a7effaac 2453
95b99395 2454# check for /etc/default/login and use it if present.
daa41e62 2455AC_ARG_ENABLE(etc-default-login,
2456 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2457[
95b99395 2458AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2459
2460if test "x$external_path_file" = "x/etc/default/login"; then
2461 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2462fi
daa41e62 2463])
95b99395 2464
8d184c09 2465dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2466if test $ac_cv_func_login_getcapbool = "yes" -a \
2467 $ac_cv_header_login_cap_h = "yes" ; then
95b99395 2468 external_path_file=/etc/login.conf
8d184c09 2469fi
95b99395 2470
a0391976 2471# Whether to mess with the default path
aff51935 2472SERVER_PATH_MSG="(default)"
c43d69a9 2473AC_ARG_WITH(default-path,
75817f90 2474 [ --with-default-path= Specify default \$PATH environment for server],
cb807f40 2475 [
95b99395 2476 if test "x$external_path_file" = "x/etc/login.conf" ; then
8d184c09 2477 AC_MSG_WARN([
2478--with-default-path=PATH has no effect on this system.
2479Edit /etc/login.conf instead.])
2480 elif test "x$withval" != "xno" ; then
89bbd457 2481 if test ! -z "$external_path_file" ; then
95b99395 2482 AC_MSG_WARN([
2483--with-default-path=PATH will only be used if PATH is not defined in
2484$external_path_file .])
2485 fi
b2d818e6 2486 user_path="$withval"
aff51935 2487 SERVER_PATH_MSG="$withval"
cb807f40 2488 fi
b2d818e6 2489 ],
95b99395 2490 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2491 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
8d184c09 2492 else
89bbd457 2493 if test ! -z "$external_path_file" ; then
95b99395 2494 AC_MSG_WARN([
2495If PATH is defined in $external_path_file, ensure the path to scp is included,
2496otherwise scp will not work.])
2497 fi
2498 AC_TRY_RUN(
2499 [
b2d818e6 2500/* find out what STDPATH is */
2501#include <stdio.h>
b2d818e6 2502#ifdef HAVE_PATHS_H
2503# include <paths.h>
2504#endif
2505#ifndef _PATH_STDPATH
d9a4e55b 2506# ifdef _PATH_USERPATH /* Irix */
2507# define _PATH_STDPATH _PATH_USERPATH
2508# else
2509# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2510# endif
b2d818e6 2511#endif
2512#include <sys/types.h>
2513#include <sys/stat.h>
2514#include <fcntl.h>
2515#define DATA "conftest.stdpath"
2516
2517main()
2518{
2519 FILE *fd;
2520 int rc;
2521
2522 fd = fopen(DATA,"w");
2523 if(fd == NULL)
2524 exit(1);
2525
2526 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2527 exit(1);
2528
2529 exit(0);
2530}
2531 ], [ user_path=`cat conftest.stdpath` ],
2532 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2533 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2534 )
2535# make sure $bindir is in USER_PATH so scp will work
2536 t_bindir=`eval echo ${bindir}`
2537 case $t_bindir in
2538 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2539 esac
2540 case $t_bindir in
2541 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2542 esac
2543 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2544 if test $? -ne 0 ; then
2545 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2546 if test $? -ne 0 ; then
2547 user_path=$user_path:$t_bindir
2548 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2549 fi
2550 fi
8d184c09 2551 fi ]
cb807f40 2552)
95b99395 2553if test "x$external_path_file" != "x/etc/login.conf" ; then
8d184c09 2554 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2555 AC_SUBST(user_path)
2556fi
cb807f40 2557
06617857 2558# Set superuser path separately to user path
06617857 2559AC_ARG_WITH(superuser-path,
2560 [ --with-superuser-path= Specify different path for super-user],
2561 [
2562 if test "x$withval" != "xno" ; then
2563 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2564 superuser_path=$withval
2565 fi
2566 ]
2567)
2568
2569
58d100bf 2570AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
aff51935 2571IPV4_IN6_HACK_MSG="no"
80faa19f 2572AC_ARG_WITH(4in6,
2573 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2574 [
2575 if test "x$withval" != "xno" ; then
2576 AC_MSG_RESULT(yes)
2577 AC_DEFINE(IPV4_IN_IPV6)
aff51935 2578 IPV4_IN6_HACK_MSG="yes"
80faa19f 2579 else
2580 AC_MSG_RESULT(no)
2581 fi
2582 ],[
2583 if test "x$inet6_default_4in6" = "xyes"; then
2584 AC_MSG_RESULT([yes (default)])
2585 AC_DEFINE(IPV4_IN_IPV6)
aff51935 2586 IPV4_IN6_HACK_MSG="yes"
80faa19f 2587 else
2588 AC_MSG_RESULT([no (default)])
2589 fi
2590 ]
2591)
2592
af774732 2593# Whether to enable BSD auth support
f1b0ecc3 2594BSD_AUTH_MSG=no
af774732 2595AC_ARG_WITH(bsd-auth,
2596 [ --with-bsd-auth Enable BSD auth support],
2597 [
2598 if test "x$withval" != "xno" ; then
2599 AC_DEFINE(BSD_AUTH)
f1b0ecc3 2600 BSD_AUTH_MSG=yes
af774732 2601 fi
2602 ]
2603)
2604
a0391976 2605# Where to place sshd.pid
19d9ac2a 2606piddir=/var/run
81dadca3 2607# make sure the directory exists
2608if test ! -d $piddir ; then
2609 piddir=`eval echo ${sysconfdir}`
2610 case $piddir in
aff51935 2611 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
81dadca3 2612 esac
2613fi
2614
47e45e44 2615AC_ARG_WITH(pid-dir,
2616 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2617 [
2618 if test "x$withval" != "xno" ; then
19d9ac2a 2619 piddir=$withval
81dadca3 2620 if test ! -d $piddir ; then
2621 AC_MSG_WARN([** no $piddir directory on this system **])
2622 fi
47e45e44 2623 fi
2624 ]
2625)
b7a87eea 2626
42f11eb2 2627AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
19d9ac2a 2628AC_SUBST(piddir)
47e45e44 2629
1d7b9b20 2630dnl allow user to disable some login recording features
2631AC_ARG_ENABLE(lastlog,
bfd550a2 2632 [ --disable-lastlog disable use of lastlog even if detected [no]],
ddb154b3 2633 [
2634 if test "x$enableval" = "xno" ; then
2635 AC_DEFINE(DISABLE_LASTLOG)
2636 fi
2637 ]
1d7b9b20 2638)
2639AC_ARG_ENABLE(utmp,
bfd550a2 2640 [ --disable-utmp disable use of utmp even if detected [no]],
ddb154b3 2641 [
2642 if test "x$enableval" = "xno" ; then
2643 AC_DEFINE(DISABLE_UTMP)
2644 fi
2645 ]
1d7b9b20 2646)
2647AC_ARG_ENABLE(utmpx,
bfd550a2 2648 [ --disable-utmpx disable use of utmpx even if detected [no]],
ddb154b3 2649 [
2650 if test "x$enableval" = "xno" ; then
2651 AC_DEFINE(DISABLE_UTMPX)
2652 fi
2653 ]
1d7b9b20 2654)
2655AC_ARG_ENABLE(wtmp,
bfd550a2 2656 [ --disable-wtmp disable use of wtmp even if detected [no]],
ddb154b3 2657 [
2658 if test "x$enableval" = "xno" ; then
2659 AC_DEFINE(DISABLE_WTMP)
2660 fi
2661 ]
1d7b9b20 2662)
2663AC_ARG_ENABLE(wtmpx,
bfd550a2 2664 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
ddb154b3 2665 [
2666 if test "x$enableval" = "xno" ; then
2667 AC_DEFINE(DISABLE_WTMPX)
2668 fi
2669 ]
1d7b9b20 2670)
2671AC_ARG_ENABLE(libutil,
bfd550a2 2672 [ --disable-libutil disable use of libutil (login() etc.) [no]],
ddb154b3 2673 [
2674 if test "x$enableval" = "xno" ; then
2675 AC_DEFINE(DISABLE_LOGIN)
2676 fi
2677 ]
1d7b9b20 2678)
2679AC_ARG_ENABLE(pututline,
bfd550a2 2680 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
ddb154b3 2681 [
2682 if test "x$enableval" = "xno" ; then
aff51935 2683 AC_DEFINE(DISABLE_PUTUTLINE)
ddb154b3 2684 fi
2685 ]
1d7b9b20 2686)
2687AC_ARG_ENABLE(pututxline,
bfd550a2 2688 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
ddb154b3 2689 [
2690 if test "x$enableval" = "xno" ; then
2691 AC_DEFINE(DISABLE_PUTUTXLINE)
2692 fi
2693 ]
1d7b9b20 2694)
2695AC_ARG_WITH(lastlog,
bfd550a2 2696 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
8c89dd2b 2697 [
2698 if test "x$withval" = "xno" ; then
2699 AC_DEFINE(DISABLE_LASTLOG)
2700 else
2701 conf_lastlog_location=$withval
2702 fi
2703 ]
2704)
1d7b9b20 2705
2706dnl lastlog, [uw]tmpx? detection
2707dnl NOTE: set the paths in the platform section to avoid the
2708dnl need for command-line parameters
2709dnl lastlog and [uw]tmp are subject to a file search if all else fails
2710
2711dnl lastlog detection
2712dnl NOTE: the code itself will detect if lastlog is a directory
2713AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2714AC_TRY_COMPILE([
2715#include <sys/types.h>
2716#include <utmp.h>
2717#ifdef HAVE_LASTLOG_H
2718# include <lastlog.h>
2719#endif
d7c0f3d5 2720#ifdef HAVE_PATHS_H
1d7b9b20 2721# include <paths.h>
41cb4569 2722#endif
2723#ifdef HAVE_LOGIN_H
2724# include <login.h>
1d7b9b20 2725#endif
2726 ],
2727 [ char *lastlog = LASTLOG_FILE; ],
2728 [ AC_MSG_RESULT(yes) ],
d7c0f3d5 2729 [
2730 AC_MSG_RESULT(no)
2731 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2732 AC_TRY_COMPILE([
2733#include <sys/types.h>
2734#include <utmp.h>
2735#ifdef HAVE_LASTLOG_H
2736# include <lastlog.h>
2737#endif
2738#ifdef HAVE_PATHS_H
2739# include <paths.h>
2740#endif
2741 ],
2742 [ char *lastlog = _PATH_LASTLOG; ],
2743 [ AC_MSG_RESULT(yes) ],
2744 [
f282b668 2745 AC_MSG_RESULT(no)
d7c0f3d5 2746 system_lastlog_path=no
2747 ])
2748 ]
1d7b9b20 2749)
d7c0f3d5 2750
1d7b9b20 2751if test -z "$conf_lastlog_location"; then
2752 if test x"$system_lastlog_path" = x"no" ; then
2753 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
e5fe9a1f 2754 if (test -d "$f" || test -f "$f") ; then
1d7b9b20 2755 conf_lastlog_location=$f
2756 fi
2757 done
2758 if test -z "$conf_lastlog_location"; then
f8119cef 2759 AC_MSG_WARN([** Cannot find lastlog **])
2760 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1d7b9b20 2761 fi
2762 fi
2763fi
2764
2765if test -n "$conf_lastlog_location"; then
2766 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2767fi
2768
2769dnl utmp detection
2770AC_MSG_CHECKING([if your system defines UTMP_FILE])
2771AC_TRY_COMPILE([
2772#include <sys/types.h>
2773#include <utmp.h>
d7c0f3d5 2774#ifdef HAVE_PATHS_H
1d7b9b20 2775# include <paths.h>
2776#endif
2777 ],
2778 [ char *utmp = UTMP_FILE; ],
2779 [ AC_MSG_RESULT(yes) ],
2780 [ AC_MSG_RESULT(no)
2781 system_utmp_path=no ]
2782)
2783if test -z "$conf_utmp_location"; then
2784 if test x"$system_utmp_path" = x"no" ; then
2785 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2786 if test -f $f ; then
2787 conf_utmp_location=$f
2788 fi
2789 done
2790 if test -z "$conf_utmp_location"; then
2791 AC_DEFINE(DISABLE_UTMP)
2792 fi
2793 fi
2794fi
2795if test -n "$conf_utmp_location"; then
2796 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2797fi
2798
2799dnl wtmp detection
2800AC_MSG_CHECKING([if your system defines WTMP_FILE])
2801AC_TRY_COMPILE([
2802#include <sys/types.h>
2803#include <utmp.h>
d7c0f3d5 2804#ifdef HAVE_PATHS_H
1d7b9b20 2805# include <paths.h>
2806#endif
2807 ],
2808 [ char *wtmp = WTMP_FILE; ],
2809 [ AC_MSG_RESULT(yes) ],
2810 [ AC_MSG_RESULT(no)
2811 system_wtmp_path=no ]
2812)
2813if test -z "$conf_wtmp_location"; then
2814 if test x"$system_wtmp_path" = x"no" ; then
2815 for f in /usr/adm/wtmp /var/log/wtmp; do
2816 if test -f $f ; then
2817 conf_wtmp_location=$f
2818 fi
2819 done
2820 if test -z "$conf_wtmp_location"; then
2821 AC_DEFINE(DISABLE_WTMP)
2822 fi
2823 fi
2824fi
2825if test -n "$conf_wtmp_location"; then
2826 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2827fi
2828
2829
2830dnl utmpx detection - I don't know any system so perverse as to require
2831dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2832dnl there, though.
2833AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2834AC_TRY_COMPILE([
2835#include <sys/types.h>
2836#include <utmp.h>
2837#ifdef HAVE_UTMPX_H
2838#include <utmpx.h>
2839#endif
d7c0f3d5 2840#ifdef HAVE_PATHS_H
1d7b9b20 2841# include <paths.h>
2842#endif
2843 ],
2844 [ char *utmpx = UTMPX_FILE; ],
2845 [ AC_MSG_RESULT(yes) ],
2846 [ AC_MSG_RESULT(no)
2847 system_utmpx_path=no ]
2848)
2849if test -z "$conf_utmpx_location"; then
2850 if test x"$system_utmpx_path" = x"no" ; then
2851 AC_DEFINE(DISABLE_UTMPX)
2852 fi
2853else
2854 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2855fi
2856
2857dnl wtmpx detection
2858AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2859AC_TRY_COMPILE([
2860#include <sys/types.h>
2861#include <utmp.h>
2862#ifdef HAVE_UTMPX_H
2863#include <utmpx.h>
2864#endif
d7c0f3d5 2865#ifdef HAVE_PATHS_H
1d7b9b20 2866# include <paths.h>
2867#endif
2868 ],
2869 [ char *wtmpx = WTMPX_FILE; ],
2870 [ AC_MSG_RESULT(yes) ],
2871 [ AC_MSG_RESULT(no)
2872 system_wtmpx_path=no ]
2873)
2874if test -z "$conf_wtmpx_location"; then
2875 if test x"$system_wtmpx_path" = x"no" ; then
2876 AC_DEFINE(DISABLE_WTMPX)
2877 fi
2878else
2879 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2880fi
2881
b7a87eea 2882
bd499f9e 2883if test ! -z "$blibpath" ; then
68ece370 2884 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2885 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
bd499f9e 2886fi
2887
ddceb1c8 2888dnl remove pam and dl because they are in $LIBPAM
2889if test "$PAM_MSG" = yes ; then
98f2d9d5 2890 LIBS=`echo $LIBS | sed 's/-lpam //'`
2891fi
2892if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2893 LIBS=`echo $LIBS | sed 's/-ldl //'`
ddceb1c8 2894fi
2895
3c62e7eb 2896AC_EXEEXT
98a7c37b 2897AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2898AC_OUTPUT
d3083fbd 2899
cbd7492e 2900# Print summary of options
2901
cbd7492e 2902# Someone please show me a better way :)
2903A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2904B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2905C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2906D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
f5665f6f 2907E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
e0c4d3ac 2908F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
cbd7492e 2909G=`eval echo ${piddir}` ; G=`eval echo ${G}`
ecac8ee5 2910H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2911I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2912J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
cbd7492e 2913
2914echo ""
26de7942 2915echo "OpenSSH has been configured with the following options:"
ecac8ee5 2916echo " User binaries: $B"
2917echo " System binaries: $C"
2918echo " Configuration files: $D"
2919echo " Askpass program: $E"
2920echo " Manual pages: $F"
2921echo " PID file: $G"
2922echo " Privilege separation chroot path: $H"
95b99395 2923if test "x$external_path_file" = "x/etc/login.conf" ; then
2924echo " At runtime, sshd will use the path defined in $external_path_file"
2925echo " Make sure the path to scp is present, otherwise scp will not work"
8d184c09 2926else
ecac8ee5 2927echo " sshd default user PATH: $I"
89bbd457 2928 if test ! -z "$external_path_file"; then
95b99395 2929echo " (If PATH is set in $external_path_file it will be used instead. If"
2930echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2931 fi
8d184c09 2932fi
06617857 2933if test ! -z "$superuser_path" ; then
ecac8ee5 2934echo " sshd superuser user PATH: $J"
2935fi
2936echo " Manpage format: $MANTYPE"
3e05e934 2937echo " PAM support: $PAM_MSG"
ecac8ee5 2938echo " KerberosV support: $KRB5_MSG"
2939echo " Smartcard support: $SCARD_MSG"
ecac8ee5 2940echo " S/KEY support: $SKEY_MSG"
2941echo " TCP Wrappers support: $TCPW_MSG"
2942echo " MD5 password support: $MD5_MSG"
3deb1408 2943echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
ecac8ee5 2944echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2945echo " BSD Auth support: $BSD_AUTH_MSG"
2946echo " Random number source: $RAND_MSG"
f1b0ecc3 2947if test ! -z "$USE_RAND_HELPER" ; then
ecac8ee5 2948echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
af774732 2949fi
2950
cbd7492e 2951echo ""
2952
0c2fb82f 2953echo " Host: ${host}"
2954echo " Compiler: ${CC}"
2955echo " Compiler flags: ${CFLAGS}"
2956echo "Preprocessor flags: ${CPPFLAGS}"
2957echo " Linker flags: ${LDFLAGS}"
ddceb1c8 2958echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
cbd7492e 2959
2960echo ""
2961
adeebd37 2962if test "x$PAM_MSG" = "xyes" ; then
f1b0ecc3 2963 echo "PAM is enabled. You may need to install a PAM control file "
2964 echo "for sshd, otherwise password authentication may fail. "
aff51935 2965 echo "Example PAM control files can be found in the contrib/ "
f1b0ecc3 2966 echo "subdirectory"
adeebd37 2967 echo ""
2968fi
2969
f1b0ecc3 2970if test ! -z "$RAND_HELPER_CMDHASH" ; then
2971 echo "WARNING: you are using the builtin random number collection "
2972 echo "service. Please read WARNING.RNG and request that your OS "
2973 echo "vendor includes kernel-based random number collection in "
2974 echo "future versions of your OS."
2c523de9 2975 echo ""
2976fi
af774732 2977
This page took 0.908887 seconds and 5 git commands to generate.