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