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