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