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