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