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