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