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