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