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