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