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