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