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