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