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