]> andersk Git - gssapi-openssh.git/blob - openssh/configure.ac
update from Simon's openssh-4.3p2-gsskex-20060223.patch
[gssapi-openssh.git] / openssh / configure.ac
1 # $Id$
2 #
3 # Copyright (c) 1999-2004 Damien Miller
4 #
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
17 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18 AC_REVISION($Revision$)
19 AC_CONFIG_SRCDIR([ssh.c])
20
21 AC_CONFIG_HEADER(config.h)
22 AC_PROG_CC
23 AC_CANONICAL_HOST
24 AC_C_BIGENDIAN
25
26 # Checks for programs.
27 AC_PROG_AWK
28 AC_PROG_CPP
29 AC_PROG_RANLIB
30 AC_PROG_INSTALL
31 AC_PROG_EGREP
32 AC_PATH_PROG(AR, ar)
33 AC_PATH_PROG(CAT, cat)
34 AC_PATH_PROG(KILL, kill)
35 AC_PATH_PROGS(PERL, perl5 perl)
36 AC_PATH_PROG(SED, sed)
37 AC_SUBST(PERL)
38 AC_PATH_PROG(ENT, ent)
39 AC_SUBST(ENT)
40 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
43 AC_PATH_PROG(SH, sh)
44 AC_SUBST(TEST_SHELL,sh)
45
46 dnl for buildpkg.sh
47 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48         [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50         [/usr/sbin${PATH_SEPARATOR}/etc])
51 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
52 if test -x /sbin/sh; then
53         AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54 else
55         AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56 fi
57
58 # System features
59 AC_SYS_LARGEFILE
60
61 if test -z "$AR" ; then
62         AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63 fi
64
65 # Use LOGIN_PROGRAM from environment if possible
66 if test ! -z "$LOGIN_PROGRAM" ; then
67         AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68                 [If your header files don't define LOGIN_PROGRAM,
69                 then use this (detected) from environment and PATH])
70 else
71         # Search for login
72         AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73         if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74                 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75         fi
76 fi
77
78 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79 if test ! -z "$PATH_PASSWD_PROG" ; then
80         AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81                 [Full path of your "passwd" program])
82 fi
83
84 if test -z "$LD" ; then
85         LD=$CC
86 fi
87 AC_SUBST(LD)
88
89 AC_C_INLINE
90
91 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
93 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
94         CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
95         GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
96         case $GCC_VER in
97                 1.*) ;;
98                 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
99                 2.*) ;;
100                 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
101                 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
102                 *) ;;
103         esac
104
105         if test -z "$have_llong_max"; then
106                 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
107                 unset ac_cv_have_decl_LLONG_MAX
108                 saved_CFLAGS="$CFLAGS"
109                 CFLAGS="$CFLAGS -std=gnu99"
110                 AC_CHECK_DECL(LLONG_MAX,
111                     [have_llong_max=1],
112                     [CFLAGS="$saved_CFLAGS"],
113                     [#include <limits.h>]
114                 )
115         fi
116 fi
117
118 AC_ARG_WITH(rpath,
119         [  --without-rpath         Disable auto-added -R linker paths],
120         [
121                 if test "x$withval" = "xno" ; then
122                         need_dash_r=""
123                 fi
124                 if test "x$withval" = "xyes" ; then
125                         need_dash_r=1
126                 fi
127         ]
128 )
129
130 # Check for some target-specific stuff
131 case "$host" in
132 *-*-aix*)
133         AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
134         if (test -z "$blibpath"); then
135                 blibpath="/usr/lib:/lib"
136         fi
137         saved_LDFLAGS="$LDFLAGS"
138         for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
139                 if (test -z "$blibflags"); then
140                         LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
141                         AC_TRY_LINK([], [], [blibflags=$tryflags])
142                 fi
143         done
144         if (test -z "$blibflags"); then
145                 AC_MSG_RESULT(not found)
146                 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
147         else
148                 AC_MSG_RESULT($blibflags)
149         fi
150         LDFLAGS="$saved_LDFLAGS"
151         dnl Check for authenticate.  Might be in libs.a on older AIXes
152         AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
153                 [Define if you want to enable AIX4's authenticate function])],
154                 [AC_CHECK_LIB(s,authenticate,
155                         [ AC_DEFINE(WITH_AIXAUTHENTICATE)
156                                 LIBS="$LIBS -ls"
157                         ])
158                 ])
159         dnl Check for various auth function declarations in headers.
160         AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
161             passwdexpired, setauthdb], , , [#include <usersec.h>])
162         dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
163         AC_CHECK_DECLS(loginfailed,
164                  [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
165                   AC_TRY_COMPILE(
166                         [#include <usersec.h>],
167                         [(void)loginfailed("user","host","tty",0);],
168                         [AC_MSG_RESULT(yes)
169                          AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
170                                 [Define if your AIX loginfailed() function
171                                 takes 4 arguments (AIX >= 5.2)])],
172                         [AC_MSG_RESULT(no)]
173                 )],
174                 [],
175                 [#include <usersec.h>]
176         )
177         AC_CHECK_FUNCS(setauthdb)
178         check_for_aix_broken_getaddrinfo=1
179         AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
180         AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
181             [Define if your platform breaks doing a seteuid before a setuid])
182         AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
183         AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
184         dnl AIX handles lastlog as part of its login message
185         AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
186         AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
187                 [Some systems need a utmpx entry for /bin/login to work])
188         AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
189                 [Define to a Set Process Title type if your system is
190                 supported by bsd-setproctitle.c])
191         AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
192             [AIX 5.2 and 5.3 (and presumably newer) require this])
193         ;;
194 *-*-cygwin*)
195         check_for_libcrypt_later=1
196         LIBS="$LIBS /usr/lib/textmode.o"
197         AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
198         AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
199         AC_DEFINE(DISABLE_SHADOW, 1,
200                 [Define if you want to disable shadow passwords])
201         AC_DEFINE(IP_TOS_IS_BROKEN, 1,
202                 [Define if your system choked on IP TOS setting])
203         AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
204                 [Define if X11 doesn't support AF_UNIX sockets on that system])
205         AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
206                 [Define if the concept of ports only accessible to
207                 superusers isn't known])
208         AC_DEFINE(DISABLE_FD_PASSING, 1,
209                 [Define if your platform needs to skip post auth
210                 file descriptor passing])
211         ;;
212 *-*-dgux*)
213         AC_DEFINE(IP_TOS_IS_BROKEN)
214         AC_DEFINE(SETEUID_BREAKS_SETUID)
215         AC_DEFINE(BROKEN_SETREUID)
216         AC_DEFINE(BROKEN_SETREGID)
217         ;;
218 *-*-darwin*)
219         AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
220         AC_DEFINE(SETEUID_BREAKS_SETUID)
221         AC_DEFINE(BROKEN_SETREUID)
222         AC_DEFINE(BROKEN_SETREGID)
223         AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
224                 [Define if your resolver libs need this for getrrsetbyname])
225         AC_MSG_CHECKING(if we have the Security Authorization Session API)
226         AC_TRY_COMPILE([#include <Security/AuthSession.h>],
227                 [SessionCreate(0, 0);],
228                 [ac_cv_use_security_session_api="yes"
229                  AC_DEFINE(USE_SECURITY_SESSION_API, 1, 
230                         [platform has the Security Authorization Session API])
231                  LIBS="$LIBS -framework Security"
232                  AC_MSG_RESULT(yes)],
233                 [ac_cv_use_security_session_api="no"
234                  AC_MSG_RESULT(no)])
235         AC_MSG_CHECKING(if we have an in-memory credentials cache)
236         AC_TRY_COMPILE(
237                 [#include <Kerberos/Kerberos.h>],
238                 [cc_context_t c;
239                  (void) cc_initialize (&c, 0, NULL, NULL);],
240                 [AC_DEFINE(USE_CCAPI, 1, 
241                         [platform uses an in-memory credentials cache])
242                  LIBS="$LIBS -framework Security"
243                  AC_MSG_RESULT(yes)
244                  if test "x$ac_cv_use_security_session_api" = "xno"; then
245                         AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***)
246                 fi],
247                 [AC_MSG_RESULT(no)]
248         )
249         ;;
250 *-*-hpux*)
251         # first we define all of the options common to all HP-UX releases
252         CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
253         IPADDR_IN_DISPLAY=yes
254         AC_DEFINE(USE_PIPES)
255         AC_DEFINE(LOGIN_NO_ENDOPT, 1,
256             [Define if your login program cannot handle end of options ("--")])
257         AC_DEFINE(LOGIN_NEEDS_UTMPX)
258         AC_DEFINE(LOCKED_PASSWD_STRING, "*",
259                 [String used in /etc/passwd to denote locked account])
260         AC_DEFINE(SPT_TYPE,SPT_PSTAT)
261         MAIL="/var/mail/username"
262         LIBS="$LIBS -lsec"
263         AC_CHECK_LIB(xnet, t_error, ,
264             AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
265
266         # next, we define all of the options specific to major releases
267         case "$host" in
268         *-*-hpux10*)
269                 if test -z "$GCC"; then
270                         CFLAGS="$CFLAGS -Ae"
271                 fi
272                 ;;
273         *-*-hpux11*)
274                 AC_DEFINE(PAM_SUN_CODEBASE, 1,
275                         [Define if you are using Solaris-derived PAM which
276                         passes pam_messages to the conversation function
277                         with an extra level of indirection])
278                 AC_DEFINE(DISABLE_UTMP, 1,
279                         [Define if you don't want to use utmp])
280                 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
281                 check_for_hpux_broken_getaddrinfo=1
282                 check_for_conflicting_getspnam=1
283                 ;;
284         esac
285
286         # lastly, we define options specific to minor releases
287         case "$host" in
288         *-*-hpux10.26)
289                 AC_DEFINE(HAVE_SECUREWARE, 1,
290                         [Define if you have SecureWare-based
291                         protected password database])
292                 disable_ptmx_check=yes
293                 LIBS="$LIBS -lsecpw"
294                 ;;
295         esac
296         ;;
297 *-*-irix5*)
298         PATH="$PATH:/usr/etc"
299         AC_DEFINE(BROKEN_INET_NTOA, 1,
300                 [Define if you system's inet_ntoa is busted
301                 (e.g. Irix gcc issue)])
302         AC_DEFINE(SETEUID_BREAKS_SETUID)
303         AC_DEFINE(BROKEN_SETREUID)
304         AC_DEFINE(BROKEN_SETREGID)
305         AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
306                 [Define if you shouldn't strip 'tty' from your
307                 ttyname in [uw]tmp])
308         AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
309         ;;
310 *-*-irix6*)
311         PATH="$PATH:/usr/etc"
312         AC_DEFINE(WITH_IRIX_ARRAY, 1,
313                 [Define if you have/want arrays
314                 (cluster-wide session managment, not C arrays)])
315         AC_DEFINE(WITH_IRIX_PROJECT, 1,
316                 [Define if you want IRIX project management])
317         AC_DEFINE(WITH_IRIX_AUDIT, 1,
318                 [Define if you want IRIX audit trails])
319         AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
320                 [Define if you want IRIX kernel jobs])])
321         AC_DEFINE(BROKEN_INET_NTOA)
322         AC_DEFINE(SETEUID_BREAKS_SETUID)
323         AC_DEFINE(BROKEN_SETREUID)
324         AC_DEFINE(BROKEN_SETREGID)
325         AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
326         AC_DEFINE(WITH_ABBREV_NO_TTY)
327         AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
328         ;;
329 *-*-linux*)
330         no_dev_ptmx=1
331         check_for_libcrypt_later=1
332         check_for_openpty_ctty_bug=1
333         AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
334         AC_DEFINE(PAM_TTY_KLUDGE, 1,
335                 [Work around problematic Linux PAM modules handling of PAM_TTY])
336         AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
337                 [String used in /etc/passwd to denote locked account])
338         AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
339         AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
340                 [Define to whatever link() returns for "not supported"
341                 if it doesn't return EOPNOTSUPP.])
342         AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
343         AC_DEFINE(USE_BTMP)
344         inet6_default_4in6=yes
345         case `uname -r` in
346         1.*|2.0.*)
347                 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
348                         [Define if cmsg_type is not passed correctly])
349                 ;;
350         esac
351         # tun(4) forwarding compat code
352         AC_CHECK_HEADERS(linux/if_tun.h)
353         if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
354                 AC_DEFINE(SSH_TUN_LINUX, 1,
355                     [Open tunnel devices the Linux tun/tap way])
356                 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
357                     [Use tunnel device compatibility to OpenBSD])
358                 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
359                     [Prepend the address family to IP tunnel traffic])
360         fi
361         ;;
362 mips-sony-bsd|mips-sony-newsos4)
363         AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
364         SONY=1
365         ;;
366 *-*-netbsd*)
367         check_for_libcrypt_before=1
368         if test "x$withval" != "xno" ; then
369                 need_dash_r=1
370         fi
371         AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
372         AC_CHECK_HEADER([net/if_tap.h], ,
373             AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
374         AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
375             [Prepend the address family to IP tunnel traffic])
376         ;;
377 *-*-freebsd*)
378         check_for_libcrypt_later=1
379         AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
380         AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
381         AC_CHECK_HEADER([net/if_tap.h], ,
382             AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
383         ;;
384 *-*-bsdi*)
385         AC_DEFINE(SETEUID_BREAKS_SETUID)
386         AC_DEFINE(BROKEN_SETREUID)
387         AC_DEFINE(BROKEN_SETREGID)
388         ;;
389 *-next-*)
390         conf_lastlog_location="/usr/adm/lastlog"
391         conf_utmp_location=/etc/utmp
392         conf_wtmp_location=/usr/adm/wtmp
393         MAIL=/usr/spool/mail
394         AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
395         AC_DEFINE(BROKEN_REALPATH)
396         AC_DEFINE(USE_PIPES)
397         AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
398         ;;
399 *-*-openbsd*)
400         AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
401         AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
402         AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
403         ;;
404 *-*-solaris*)
405         if test "x$withval" != "xno" ; then
406                 need_dash_r=1
407         fi
408         AC_DEFINE(PAM_SUN_CODEBASE)
409         AC_DEFINE(LOGIN_NEEDS_UTMPX)
410         AC_DEFINE(LOGIN_NEEDS_TERM, 1,
411                 [Some versions of /bin/login need the TERM supplied
412                 on the commandline])
413         AC_DEFINE(PAM_TTY_KLUDGE)
414         AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
415                 [Define if pam_chauthtok wants real uid set
416                 to the unpriv'ed user])
417         AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
418         # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
419         AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
420                 [Define if sshd somehow reacquires a controlling TTY
421                 after setsid()])
422         external_path_file=/etc/default/login
423         # hardwire lastlog location (can't detect it on some versions)
424         conf_lastlog_location="/var/adm/lastlog"
425         AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
426         sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
427         if test "$sol2ver" -ge 8; then
428                 AC_MSG_RESULT(yes)
429                 AC_DEFINE(DISABLE_UTMP)
430                 AC_DEFINE(DISABLE_WTMP, 1,
431                         [Define if you don't want to use wtmp])
432         else
433                 AC_MSG_RESULT(no)
434         fi
435         ;;
436 *-*-sunos4*)
437         CPPFLAGS="$CPPFLAGS -DSUNOS4"
438         AC_CHECK_FUNCS(getpwanam)
439         AC_DEFINE(PAM_SUN_CODEBASE)
440         conf_utmp_location=/etc/utmp
441         conf_wtmp_location=/var/adm/wtmp
442         conf_lastlog_location=/var/adm/lastlog
443         AC_DEFINE(USE_PIPES)
444         ;;
445 *-ncr-sysv*)
446         LIBS="$LIBS -lc89"
447         AC_DEFINE(USE_PIPES)
448         AC_DEFINE(SSHD_ACQUIRES_CTTY)
449         AC_DEFINE(SETEUID_BREAKS_SETUID)
450         AC_DEFINE(BROKEN_SETREUID)
451         AC_DEFINE(BROKEN_SETREGID)
452         ;;
453 *-sni-sysv*)
454         # /usr/ucblib MUST NOT be searched on ReliantUNIX
455         AC_CHECK_LIB(dl, dlsym, ,)
456         # -lresolv needs to be at the end of LIBS or DNS lookups break
457         AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
458         IPADDR_IN_DISPLAY=yes
459         AC_DEFINE(USE_PIPES)
460         AC_DEFINE(IP_TOS_IS_BROKEN)
461         AC_DEFINE(SETEUID_BREAKS_SETUID)
462         AC_DEFINE(BROKEN_SETREUID)
463         AC_DEFINE(BROKEN_SETREGID)
464         AC_DEFINE(SSHD_ACQUIRES_CTTY)
465         external_path_file=/etc/default/login
466         # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
467         # Attention: always take care to bind libsocket and libnsl before libc,
468         # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
469         ;;
470 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
471 *-*-sysv4.2*)
472         CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
473         AC_DEFINE(USE_PIPES)
474         AC_DEFINE(SETEUID_BREAKS_SETUID)
475         AC_DEFINE(BROKEN_SETREUID)
476         AC_DEFINE(BROKEN_SETREGID)
477         AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
478         AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
479         ;;
480 # UnixWare 7.x, OpenUNIX 8
481 *-*-sysv5*)
482         check_for_libcrypt_later=1
483         AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
484         AC_DEFINE(USE_PIPES)
485         AC_DEFINE(SETEUID_BREAKS_SETUID)
486         AC_DEFINE(BROKEN_SETREUID)
487         AC_DEFINE(BROKEN_SETREGID)
488         AC_DEFINE(PASSWD_NEEDS_USERNAME)
489         case "$host" in
490         *-*-sysv5SCO_SV*)       # SCO OpenServer 6.x
491                 TEST_SHELL=/u95/bin/sh
492                 AC_DEFINE(BROKEN_LIBIAF, 1,
493                         [ia_uinfo routines not supported by OS yet])
494                 ;;
495         *)      AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
496                 ;;
497         esac
498         ;;
499 *-*-sysv*)
500         ;;
501 # SCO UNIX and OEM versions of SCO UNIX
502 *-*-sco3.2v4*)
503         AC_MSG_ERROR("This Platform is no longer supported.")
504         ;;
505 # SCO OpenServer 5.x
506 *-*-sco3.2v5*)
507         if test -z "$GCC"; then
508                 CFLAGS="$CFLAGS -belf"
509         fi
510         LIBS="$LIBS -lprot -lx -ltinfo -lm"
511         no_dev_ptmx=1
512         AC_DEFINE(USE_PIPES)
513         AC_DEFINE(HAVE_SECUREWARE)
514         AC_DEFINE(DISABLE_SHADOW)
515         AC_DEFINE(DISABLE_FD_PASSING)
516         AC_DEFINE(SETEUID_BREAKS_SETUID)
517         AC_DEFINE(BROKEN_SETREUID)
518         AC_DEFINE(BROKEN_SETREGID)
519         AC_DEFINE(WITH_ABBREV_NO_TTY)
520         AC_DEFINE(BROKEN_UPDWTMPX)
521         AC_DEFINE(PASSWD_NEEDS_USERNAME)
522         AC_CHECK_FUNCS(getluid setluid)
523         MANTYPE=man
524         TEST_SHELL=ksh
525         ;;
526 *-*-unicosmk*)
527         AC_DEFINE(NO_SSH_LASTLOG, 1,
528                 [Define if you don't want to use lastlog in session.c])
529         AC_DEFINE(SETEUID_BREAKS_SETUID)
530         AC_DEFINE(BROKEN_SETREUID)
531         AC_DEFINE(BROKEN_SETREGID)
532         AC_DEFINE(USE_PIPES)
533         AC_DEFINE(DISABLE_FD_PASSING)
534         LDFLAGS="$LDFLAGS"
535         LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
536         MANTYPE=cat
537         ;;
538 *-*-unicosmp*)
539         AC_DEFINE(SETEUID_BREAKS_SETUID)
540         AC_DEFINE(BROKEN_SETREUID)
541         AC_DEFINE(BROKEN_SETREGID)
542         AC_DEFINE(WITH_ABBREV_NO_TTY)
543         AC_DEFINE(USE_PIPES)
544         AC_DEFINE(DISABLE_FD_PASSING)
545         LDFLAGS="$LDFLAGS"
546         LIBS="$LIBS -lgen -lacid -ldb"
547         MANTYPE=cat
548         ;;
549 *-*-unicos*)
550         AC_DEFINE(SETEUID_BREAKS_SETUID)
551         AC_DEFINE(BROKEN_SETREUID)
552         AC_DEFINE(BROKEN_SETREGID)
553         AC_DEFINE(USE_PIPES)
554         AC_DEFINE(DISABLE_FD_PASSING)
555         AC_DEFINE(NO_SSH_LASTLOG)
556         LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
557         LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
558         MANTYPE=cat
559         ;;
560 *-dec-osf*)
561         AC_MSG_CHECKING(for Digital Unix SIA)
562         no_osfsia=""
563         AC_ARG_WITH(osfsia,
564                 [  --with-osfsia           Enable Digital Unix SIA],
565                 [
566                         if test "x$withval" = "xno" ; then
567                                 AC_MSG_RESULT(disabled)
568                                 no_osfsia=1
569                         fi
570                 ],
571         )
572         if test -z "$no_osfsia" ; then
573                 if test -f /etc/sia/matrix.conf; then
574                         AC_MSG_RESULT(yes)
575                         AC_DEFINE(HAVE_OSF_SIA, 1,
576                                 [Define if you have Digital Unix Security
577                                 Integration Architecture])
578                         AC_DEFINE(DISABLE_LOGIN, 1,
579                                 [Define if you don't want to use your
580                                 system's login() call])
581                         AC_DEFINE(DISABLE_FD_PASSING)
582                         LIBS="$LIBS -lsecurity -ldb -lm -laud"
583                 else
584                         AC_MSG_RESULT(no)
585                         AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
586                           [String used in /etc/passwd to denote locked account])
587                 fi
588         fi
589         AC_DEFINE(BROKEN_GETADDRINFO)
590         AC_DEFINE(SETEUID_BREAKS_SETUID)
591         AC_DEFINE(BROKEN_SETREUID)
592         AC_DEFINE(BROKEN_SETREGID)
593         ;;
594
595 *-*-nto-qnx*)
596         AC_DEFINE(USE_PIPES)
597         AC_DEFINE(NO_X11_UNIX_SOCKETS)
598         AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
599         AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
600         AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
601         AC_DEFINE(DISABLE_LASTLOG)
602         ;;
603
604 *-*-ultrix*)
605         AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
606         AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
607         AC_DEFINE(NEED_SETPGRP)
608         AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
609         ;;
610
611 *-*-lynxos)
612         CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
613         AC_DEFINE(MISSING_HOWMANY)
614         AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
615         ;;
616 esac
617
618 # Allow user to specify flags
619 AC_ARG_WITH(cflags,
620         [  --with-cflags           Specify additional flags to pass to compiler],
621         [
622                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
623                     test "x${withval}" != "xyes"; then
624                         CFLAGS="$CFLAGS $withval"
625                 fi
626         ]
627 )
628 AC_ARG_WITH(cppflags,
629         [  --with-cppflags         Specify additional flags to pass to preprocessor] ,
630         [
631                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
632                     test "x${withval}" != "xyes"; then
633                         CPPFLAGS="$CPPFLAGS $withval"
634                 fi
635         ]
636 )
637 AC_ARG_WITH(ldflags,
638         [  --with-ldflags          Specify additional flags to pass to linker],
639         [
640                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
641                     test "x${withval}" != "xyes"; then
642                         LDFLAGS="$LDFLAGS $withval"
643                 fi
644         ]
645 )
646 AC_ARG_WITH(libs,
647         [  --with-libs             Specify additional libraries to link with],
648         [
649                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
650                     test "x${withval}" != "xyes"; then
651                         LIBS="$LIBS $withval"
652                 fi
653         ]
654 )
655 AC_ARG_WITH(Werror,
656         [  --with-Werror           Build main code with -Werror],
657         [
658                 if test -n "$withval"  &&  test "x$withval" != "xno"; then
659                         werror_flags="-Werror"
660                         if test "x${withval}" != "xyes"; then
661                                 werror_flags="$withval"
662                         fi
663                 fi
664         ]
665 )
666
667 AC_MSG_CHECKING(compiler and flags for sanity)
668 AC_RUN_IFELSE(
669         [AC_LANG_SOURCE([
670 #include <stdio.h>
671 int main(){exit(0);}
672         ])],
673         [       AC_MSG_RESULT(yes) ],
674         [
675                 AC_MSG_RESULT(no)
676                 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
677         ],
678         [       AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
679 )
680
681 dnl Checks for header files.
682 AC_CHECK_HEADERS( \
683         bstring.h \
684         crypt.h \
685         dirent.h \
686         endian.h \
687         features.h \
688         floatingpoint.h \
689         getopt.h \
690         glob.h \
691         ia.h \
692         iaf.h \
693         limits.h \
694         login.h \
695         login_cap.h \
696         maillock.h \
697         ndir.h \
698         netdb.h \
699         netgroup.h \
700         pam/pam_appl.h \
701         paths.h \
702         pty.h \
703         readpassphrase.h \
704         rpc/types.h \
705         security/pam_appl.h \
706         shadow.h \
707         stddef.h \
708         stdint.h \
709         string.h \
710         strings.h \
711         sys/audit.h \
712         sys/bitypes.h \
713         sys/bsdtty.h \
714         sys/cdefs.h \
715         sys/dir.h \
716         sys/mman.h \
717         sys/ndir.h \
718         sys/prctl.h \
719         sys/pstat.h \
720         sys/select.h \
721         sys/stat.h \
722         sys/stream.h \
723         sys/stropts.h \
724         sys/strtio.h \
725         sys/sysmacros.h \
726         sys/time.h \
727         sys/timers.h \
728         sys/un.h \
729         time.h \
730         tmpdir.h \
731         ttyent.h \
732         unistd.h \
733         usersec.h \
734         util.h \
735         utime.h \
736         utmp.h \
737         utmpx.h \
738         vis.h \
739 )
740
741 # lastlog.h requires sys/time.h to be included first on Solaris
742 AC_CHECK_HEADERS(lastlog.h, [], [], [
743 #ifdef HAVE_SYS_TIME_H
744 # include <sys/time.h>
745 #endif
746 ])
747
748 # sys/ptms.h requires sys/stream.h to be included first on Solaris
749 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
750 #ifdef HAVE_SYS_STREAM_H
751 # include <sys/stream.h>
752 #endif
753 ])
754
755 # Checks for libraries.
756 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
757 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
758
759 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
760 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
761         AC_CHECK_LIB(gen, dirname,[
762                 AC_CACHE_CHECK([for broken dirname],
763                         ac_cv_have_broken_dirname, [
764                         save_LIBS="$LIBS"
765                         LIBS="$LIBS -lgen"
766                         AC_RUN_IFELSE(
767                                 [AC_LANG_SOURCE([[
768 #include <libgen.h>
769 #include <string.h>
770
771 int main(int argc, char **argv) {
772     char *s, buf[32];
773
774     strncpy(buf,"/etc", 32);
775     s = dirname(buf);
776     if (!s || strncmp(s, "/", 32) != 0) {
777         exit(1);
778     } else {
779         exit(0);
780     }
781 }
782                                 ]])],
783                                 [ ac_cv_have_broken_dirname="no" ],
784                                 [ ac_cv_have_broken_dirname="yes" ],
785                                 [ ac_cv_have_broken_dirname="no" ],
786                         )
787                         LIBS="$save_LIBS"
788                 ])
789                 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
790                         LIBS="$LIBS -lgen"
791                         AC_DEFINE(HAVE_DIRNAME)
792                         AC_CHECK_HEADERS(libgen.h)
793                 fi
794         ])
795 ])
796
797 AC_CHECK_FUNC(getspnam, ,
798         AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
799 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
800         [Define if you have the basename function.]))
801
802 dnl zlib is required
803 AC_ARG_WITH(zlib,
804         [  --with-zlib=PATH        Use zlib in PATH],
805         [ if test "x$withval" = "xno" ; then
806                 AC_MSG_ERROR([*** zlib is required ***])
807           elif test "x$withval" != "xyes"; then
808                 if test -d "$withval/lib"; then
809                         if test -n "${need_dash_r}"; then
810                                 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
811                         else
812                                 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
813                         fi
814                 else
815                         if test -n "${need_dash_r}"; then
816                                 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
817                         else
818                                 LDFLAGS="-L${withval} ${LDFLAGS}"
819                         fi
820                 fi
821                 if test -d "$withval/include"; then
822                         CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
823                 else
824                         CPPFLAGS="-I${withval} ${CPPFLAGS}"
825                 fi
826         fi ]
827 )
828
829 AC_CHECK_LIB(z, deflate, ,
830         [
831                 saved_CPPFLAGS="$CPPFLAGS"
832                 saved_LDFLAGS="$LDFLAGS"
833                 save_LIBS="$LIBS"
834                 dnl Check default zlib install dir
835                 if test -n "${need_dash_r}"; then
836                         LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
837                 else
838                         LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
839                 fi
840                 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
841                 LIBS="$LIBS -lz"
842                 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
843                         [
844                                 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
845                         ]
846                 )
847         ]
848 )
849 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
850
851 AC_ARG_WITH(zlib-version-check,
852         [  --without-zlib-version-check Disable zlib version check],
853         [  if test "x$withval" = "xno" ; then
854                 zlib_check_nonfatal=1
855            fi
856         ]
857 )
858
859 AC_MSG_CHECKING(for possibly buggy zlib)
860 AC_RUN_IFELSE([AC_LANG_SOURCE([[
861 #include <stdio.h>
862 #include <zlib.h>
863 int main()
864 {
865         int a=0, b=0, c=0, d=0, n, v;
866         n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
867         if (n != 3 && n != 4)
868                 exit(1);
869         v = a*1000000 + b*10000 + c*100 + d;
870         fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
871
872         /* 1.1.4 is OK */
873         if (a == 1 && b == 1 && c >= 4)
874                 exit(0);
875
876         /* 1.2.3 and up are OK */
877         if (v >= 1020300)
878                 exit(0);
879
880         exit(2);
881 }
882         ]])],
883         AC_MSG_RESULT(no),
884         [ AC_MSG_RESULT(yes)
885           if test -z "$zlib_check_nonfatal" ; then
886                 AC_MSG_ERROR([*** zlib too old - check config.log ***
887 Your reported zlib version has known security problems.  It's possible your
888 vendor has fixed these problems without changing the version number.  If you
889 are sure this is the case, you can disable the check by running
890 "./configure --without-zlib-version-check".
891 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
892 See http://www.gzip.org/zlib/ for details.])
893           else
894                 AC_MSG_WARN([zlib version may have security problems])
895           fi
896         ],
897         [       AC_MSG_WARN([cross compiling: not checking zlib version]) ]
898 )
899
900 dnl UnixWare 2.x
901 AC_CHECK_FUNC(strcasecmp,
902         [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
903 )
904 AC_CHECK_FUNCS(utimes,
905         [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
906                                         LIBS="$LIBS -lc89"]) ]
907 )
908
909 dnl    Checks for libutil functions
910 AC_CHECK_HEADERS(libutil.h)
911 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
912         [Define if your libraries define login()])])
913 AC_CHECK_FUNCS(logout updwtmp logwtmp)
914
915 AC_FUNC_STRFTIME
916
917 # Check for ALTDIRFUNC glob() extension
918 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
919 AC_EGREP_CPP(FOUNDIT,
920         [
921                 #include <glob.h>
922                 #ifdef GLOB_ALTDIRFUNC
923                 FOUNDIT
924                 #endif
925         ],
926         [
927                 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
928                         [Define if your system glob() function has
929                         the GLOB_ALTDIRFUNC extension])
930                 AC_MSG_RESULT(yes)
931         ],
932         [
933                 AC_MSG_RESULT(no)
934         ]
935 )
936
937 # Check for g.gl_matchc glob() extension
938 AC_MSG_CHECKING(for gl_matchc field in glob_t)
939 AC_EGREP_CPP(FOUNDIT,
940         [
941                 #include <glob.h>
942                 int main(void){glob_t g; g.gl_matchc = 1;}
943         ],
944         [
945                 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
946                         [Define if your system glob() function has
947                         gl_matchc options in glob_t])
948                 AC_MSG_RESULT(yes)
949         ],
950         [
951                 AC_MSG_RESULT(no)
952         ]
953 )
954
955 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
956 AC_RUN_IFELSE(
957         [AC_LANG_SOURCE([[
958 #include <sys/types.h>
959 #include <dirent.h>
960 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
961         ]])],
962         [AC_MSG_RESULT(yes)],
963         [
964                 AC_MSG_RESULT(no)
965                 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
966                         [Define if your struct dirent expects you to
967                         allocate extra space for d_name])
968         ],
969         [
970                 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
971                 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
972         ]
973 )
974
975 # Check whether the user wants GSSAPI mechglue support
976 AC_ARG_WITH(mechglue,
977         [  --with-mechglue=PATH    Build with GSSAPI mechglue library],
978         [
979                 AC_MSG_CHECKING(for mechglue library)
980
981                 if test -e ${withval}/libgssapi.a ; then
982                     mechglue_lib=${withval}/libgssapi.a
983                 elif test -e ${withval}/lib/libgssapi.a ; then
984                     mechglue_lib=${withval}/lib/libgssapi.a
985                 else
986                     AC_MSG_ERROR("Can't find libgssapi in ${withval}");
987                 fi
988                 LIBS="$LIBS ${mechglue_lib}"
989                 AC_MSG_RESULT(${mechglue_lib})
990
991                 AC_CHECK_LIB(dl, dlopen, , )
992                 if test $ac_cv_lib_dl_dlopen = yes; then
993                    LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
994                 fi
995
996                 AC_DEFINE(GSSAPI)
997                 AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.])
998                 GSSAPI="mechglue"
999
1000         ]
1001 )
1002
1003
1004 # Check whether the user wants GSI (Globus) support
1005 gsi_path="no"
1006 AC_ARG_WITH(gsi,
1007         [  --with-gsi              Enable Globus GSI authentication support],
1008         [
1009                 gsi_path="$withval"
1010         ]
1011 )
1012
1013 AC_ARG_WITH(globus,
1014         [  --with-globus           Enable Globus GSI authentication support],
1015         [
1016                 gsi_path="$withval"
1017         ]
1018 )
1019
1020 AC_ARG_WITH(globus-static,
1021         [  --with-globus-static    Link statically with Globus GSI libraries],
1022         [
1023                 gsi_static="-static"
1024                 if test "x$gsi_path" = "xno" ; then
1025                         gsi_path="$withval"
1026                 fi
1027         ]
1028 )
1029
1030 # Check whether the user has a Globus flavor type
1031 globus_flavor_type="no"
1032 AC_ARG_WITH(globus-flavor,
1033         [  --with-globus-flavor=TYPE  Specify Globus flavor type (ex: gcc32dbg)],
1034         [
1035                 globus_flavor_type="$withval"
1036                 if test "x$gsi_path" = "xno" ; then
1037                         gsi_path="yes"
1038                 fi
1039         ]
1040 )
1041
1042 if test "x$gsi_path" != "xno" ; then
1043         # Globus GSSAPI configuration
1044         AC_MSG_CHECKING(for Globus GSI)
1045         AC_DEFINE(GSI, 1, [Define if you want GSI/Globus authentication support.])
1046
1047         if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
1048                 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus GSI.])
1049         fi
1050         if test -z "$GSSAPI"; then
1051                 AC_DEFINE(GSSAPI)
1052                 GSSAPI="GSI"
1053         fi
1054
1055         if test "x$gsi_path" = "xyes" ; then
1056                 if test -z "$GLOBUS_LOCATION" ; then
1057                         AC_MSG_ERROR(GLOBUS_LOCATION environment variable must be set.)
1058                 else
1059                         gsi_path="$GLOBUS_LOCATION"
1060                 fi
1061         fi
1062         GLOBUS_LOCATION="$gsi_path"
1063         export GLOBUS_LOCATION
1064         if test ! -d "$GLOBUS_LOCATION" ; then
1065                 AC_MSG_ERROR(Cannot find Globus installation.  Set GLOBUS_LOCATION environment variable.)
1066         fi
1067
1068         if test "x$globus_flavor_type" = "xno" ; then
1069                 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
1070         fi
1071         if test "x$globus_flavor_type" = "xyes" ; then
1072                 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
1073         fi
1074
1075         GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
1076         if test ! -d "$GLOBUS_INCLUDE" ; then
1077                 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
1078         fi
1079         GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
1080         
1081         if test -x ${gsi_path}/bin/globus-makefile-header ; then
1082                 GSI_LIBS=`${gsi_path}/bin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
1083         elif test -x ${gsi_path}/sbin/globus-makefile-header ; then
1084                 GSI_LIBS=`${gsi_path}/sbin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
1085         else
1086                 AC_MSG_ERROR(Cannot find globus-makefile-header: Globus installation is incomplete)
1087         fi
1088         if test -n "${need_dash_r}"; then
1089                 GSI_LDFLAGS="-L${gsi_path}/lib -R{gsi_path}/lib"
1090         else
1091                 GSI_LDFLAGS="-L${gsi_path}/lib"
1092         fi
1093         if test -z "$GSI_LIBS" ; then
1094                 AC_MSG_ERROR(globus-makefile-header failed)
1095         fi
1096
1097         AC_DEFINE(HAVE_GSSAPI_H)
1098
1099         LIBS="$LIBS $GSI_LIBS"
1100         LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
1101         CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
1102
1103         # test that we got the libraries OK
1104         AC_TRY_LINK(
1105                 [],
1106                 [],
1107                 [
1108                         AC_MSG_RESULT(yes)
1109                 ],
1110                 [
1111                         AC_MSG_ERROR(link with Globus libraries failed)
1112                 ]
1113         )
1114         INSTALL_GSISSH="yes"
1115 else
1116         INSTALL_GSISSH=""
1117 fi
1118 AC_SUBST(INSTALL_GSISSH)
1119 # End Globus/GSI section
1120
1121 AC_MSG_CHECKING([for /proc/pid/fd directory])
1122 if test -d "/proc/$$/fd" ; then
1123         AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1124         AC_MSG_RESULT(yes)
1125 else
1126         AC_MSG_RESULT(no)
1127 fi
1128
1129 # Check whether user wants S/Key support
1130 SKEY_MSG="no"
1131 AC_ARG_WITH(skey,
1132         [  --with-skey[[=PATH]]      Enable S/Key support (optionally in PATH)],
1133         [
1134                 if test "x$withval" != "xno" ; then
1135
1136                         if test "x$withval" != "xyes" ; then
1137                                 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1138                                 LDFLAGS="$LDFLAGS -L${withval}/lib"
1139                         fi
1140
1141                         AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1142                         LIBS="-lskey $LIBS"
1143                         SKEY_MSG="yes"
1144
1145                         AC_MSG_CHECKING([for s/key support])
1146                         AC_LINK_IFELSE(
1147                                 [AC_LANG_SOURCE([[
1148 #include <stdio.h>
1149 #include <skey.h>
1150 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1151                                 ]])],
1152                                 [AC_MSG_RESULT(yes)],
1153                                 [
1154                                         AC_MSG_RESULT(no)
1155                                         AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1156                                 ])
1157                         AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1158                         AC_TRY_COMPILE(
1159                                 [#include <stdio.h>
1160                                  #include <skey.h>],
1161                                 [(void)skeychallenge(NULL,"name","",0);],
1162                                 [AC_MSG_RESULT(yes)
1163                                  AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1164                                         [Define if your skeychallenge()
1165                                         function takes 4 arguments (NetBSD)])],
1166                                 [AC_MSG_RESULT(no)]
1167                         )
1168                 fi
1169         ]
1170 )
1171
1172 # Check whether user wants TCP wrappers support
1173 TCPW_MSG="no"
1174 AC_ARG_WITH(tcp-wrappers,
1175         [  --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1176         [
1177                 if test "x$withval" != "xno" ; then
1178                         saved_LIBS="$LIBS"
1179                         saved_LDFLAGS="$LDFLAGS"
1180                         saved_CPPFLAGS="$CPPFLAGS"
1181                         if test -n "${withval}" && \
1182                             test "x${withval}" != "xyes"; then
1183                                 if test -d "${withval}/lib"; then
1184                                         if test -n "${need_dash_r}"; then
1185                                                 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1186                                         else
1187                                                 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1188                                         fi
1189                                 else
1190                                         if test -n "${need_dash_r}"; then
1191                                                 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1192                                         else
1193                                                 LDFLAGS="-L${withval} ${LDFLAGS}"
1194                                         fi
1195                                 fi
1196                                 if test -d "${withval}/include"; then
1197                                         CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1198                                 else
1199                                         CPPFLAGS="-I${withval} ${CPPFLAGS}"
1200                                 fi
1201                         fi
1202                         LIBWRAP="-lwrap"
1203                         LIBS="$LIBWRAP $LIBS"
1204                         AC_MSG_CHECKING(for libwrap)
1205                         AC_TRY_LINK(
1206                                 [
1207 #include <sys/types.h>
1208 #include <sys/socket.h>
1209 #include <netinet/in.h>
1210 #include <tcpd.h>
1211                                         int deny_severity = 0, allow_severity = 0;
1212                                 ],
1213                                 [hosts_access(0);],
1214                                 [
1215                                         AC_MSG_RESULT(yes)
1216                                         AC_DEFINE(LIBWRAP, 1,
1217                                                 [Define if you want
1218                                                 TCP Wrappers support])
1219                                         AC_SUBST(LIBWRAP)
1220                                         TCPW_MSG="yes"
1221                                 ],
1222                                 [
1223                                         AC_MSG_ERROR([*** libwrap missing])
1224                                 ]
1225                         )
1226                         LIBS="$saved_LIBS"
1227                 fi
1228         ]
1229 )
1230
1231 # Check whether user wants libedit support
1232 LIBEDIT_MSG="no"
1233 AC_ARG_WITH(libedit,
1234         [  --with-libedit[[=PATH]]   Enable libedit support for sftp],
1235         [ if test "x$withval" != "xno" ; then
1236                 if test "x$withval" != "xyes"; then
1237                         CPPFLAGS="$CPPFLAGS -I${withval}/include"
1238                         if test -n "${need_dash_r}"; then
1239                                 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1240                         else
1241                                 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1242                         fi
1243                 fi
1244                 AC_CHECK_LIB(edit, el_init,
1245                         [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1246                           LIBEDIT="-ledit -lcurses"
1247                           LIBEDIT_MSG="yes"
1248                           AC_SUBST(LIBEDIT)
1249                         ],
1250                         [ AC_MSG_ERROR(libedit not found) ],
1251                         [ -lcurses ]
1252                 )
1253                 AC_MSG_CHECKING(if libedit version is compatible)
1254                 AC_COMPILE_IFELSE(
1255                     [AC_LANG_SOURCE([[
1256 #include <histedit.h>
1257 int main(void)
1258 {
1259         int i = H_SETSIZE;
1260         el_init("", NULL, NULL, NULL);
1261         exit(0);
1262 }
1263                     ]])],
1264                     [ AC_MSG_RESULT(yes) ],
1265                     [ AC_MSG_RESULT(no)
1266                       AC_MSG_ERROR(libedit version is not compatible) ]
1267                 )
1268         fi ]
1269 )
1270
1271 AUDIT_MODULE=none
1272 AC_ARG_WITH(audit,
1273         [  --with-audit=module     Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1274         [
1275           AC_MSG_CHECKING(for supported audit module)
1276           case "$withval" in
1277           bsm)
1278                 AC_MSG_RESULT(bsm)
1279                 AUDIT_MODULE=bsm
1280                 dnl    Checks for headers, libs and functions
1281                 AC_CHECK_HEADERS(bsm/audit.h, [],
1282                     [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1283                 AC_CHECK_LIB(bsm, getaudit, [],
1284                     [AC_MSG_ERROR(BSM enabled and required library not found)])
1285                 AC_CHECK_FUNCS(getaudit, [],
1286                     [AC_MSG_ERROR(BSM enabled and required function not found)])
1287                 # These are optional
1288                 AC_CHECK_FUNCS(getaudit_addr)
1289                 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1290                 ;;
1291           debug)
1292                 AUDIT_MODULE=debug
1293                 AC_MSG_RESULT(debug)
1294                 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1295                 ;;
1296           no)
1297                 AC_MSG_RESULT(no)
1298                 ;;
1299           *)
1300                 AC_MSG_ERROR([Unknown audit module $withval])
1301                 ;;
1302         esac ]
1303 )
1304
1305 dnl    Checks for library functions. Please keep in alphabetical order
1306 AC_CHECK_FUNCS( \
1307         arc4random \
1308         asprintf \
1309         b64_ntop \
1310         __b64_ntop \
1311         b64_pton \
1312         __b64_pton \
1313         bcopy \
1314         bindresvport_sa \
1315         clock \
1316         closefrom \
1317         dirfd \
1318         fchmod \
1319         fchown \
1320         freeaddrinfo \
1321         futimes \
1322         getaddrinfo \
1323         getcwd \
1324         getgrouplist \
1325         getnameinfo \
1326         getopt \
1327         getpeereid \
1328         _getpty \
1329         getrlimit \
1330         getttyent \
1331         glob \
1332         inet_aton \
1333         inet_ntoa \
1334         inet_ntop \
1335         innetgr \
1336         login_getcapbool \
1337         md5_crypt \
1338         memmove \
1339         mkdtemp \
1340         mmap \
1341         ngetaddrinfo \
1342         nsleep \
1343         ogetaddrinfo \
1344         openlog_r \
1345         openpty \
1346         prctl \
1347         pstat \
1348         readpassphrase \
1349         realpath \
1350         recvmsg \
1351         rresvport_af \
1352         sendmsg \
1353         setdtablesize \
1354         setegid \
1355         setenv \
1356         seteuid \
1357         setgroups \
1358         setlogin \
1359         setpcred \
1360         setproctitle \
1361         setregid \
1362         setreuid \
1363         setrlimit \
1364         setsid \
1365         setvbuf \
1366         sigaction \
1367         sigvec \
1368         snprintf \
1369         socketpair \
1370         strdup \
1371         strerror \
1372         strlcat \
1373         strlcpy \
1374         strmode \
1375         strnvis \
1376         strtonum \
1377         strtoll \
1378         strtoul \
1379         sysconf \
1380         tcgetpgrp \
1381         truncate \
1382         unsetenv \
1383         updwtmpx \
1384         vasprintf \
1385         vhangup \
1386         vsnprintf \
1387         waitpid \
1388 )
1389
1390 # IRIX has a const char return value for gai_strerror()
1391 AC_CHECK_FUNCS(gai_strerror,[
1392         AC_DEFINE(HAVE_GAI_STRERROR)
1393         AC_TRY_COMPILE([
1394 #include <sys/types.h>
1395 #include <sys/socket.h>
1396 #include <netdb.h>
1397
1398 const char *gai_strerror(int);],[
1399 char *str;
1400
1401 str = gai_strerror(0);],[
1402                 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1403                 [Define if gai_strerror() returns const char *])])])
1404
1405 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1406         [Some systems put nanosleep outside of libc]))
1407
1408 dnl Make sure prototypes are defined for these before using them.
1409 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1410 AC_CHECK_DECL(strsep,
1411         [AC_CHECK_FUNCS(strsep)],
1412         [],
1413         [
1414 #ifdef HAVE_STRING_H
1415 # include <string.h>
1416 #endif
1417         ])
1418
1419 dnl tcsendbreak might be a macro
1420 AC_CHECK_DECL(tcsendbreak,
1421         [AC_DEFINE(HAVE_TCSENDBREAK)],
1422         [AC_CHECK_FUNCS(tcsendbreak)],
1423         [#include <termios.h>]
1424 )
1425
1426 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1427
1428 AC_CHECK_FUNCS(setresuid, [
1429         dnl Some platorms have setresuid that isn't implemented, test for this
1430         AC_MSG_CHECKING(if setresuid seems to work)
1431         AC_RUN_IFELSE(
1432                 [AC_LANG_SOURCE([[
1433 #include <stdlib.h>
1434 #include <errno.h>
1435 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1436                 ]])],
1437                 [AC_MSG_RESULT(yes)],
1438                 [AC_DEFINE(BROKEN_SETRESUID, 1,
1439                         [Define if your setresuid() is broken])
1440                  AC_MSG_RESULT(not implemented)],
1441                 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1442         )
1443 ])
1444
1445 AC_CHECK_FUNCS(setresgid, [
1446         dnl Some platorms have setresgid that isn't implemented, test for this
1447         AC_MSG_CHECKING(if setresgid seems to work)
1448         AC_RUN_IFELSE(
1449                 [AC_LANG_SOURCE([[
1450 #include <stdlib.h>
1451 #include <errno.h>
1452 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1453                 ]])],
1454                 [AC_MSG_RESULT(yes)],
1455                 [AC_DEFINE(BROKEN_SETRESGID, 1,
1456                         [Define if your setresgid() is broken])
1457                  AC_MSG_RESULT(not implemented)],
1458                 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1459         )
1460 ])
1461
1462 dnl    Checks for time functions
1463 AC_CHECK_FUNCS(gettimeofday time)
1464 dnl    Checks for utmp functions
1465 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1466 AC_CHECK_FUNCS(utmpname)
1467 dnl    Checks for utmpx functions
1468 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1469 AC_CHECK_FUNCS(setutxent utmpxname)
1470
1471 AC_CHECK_FUNC(daemon,
1472         [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1473         [AC_CHECK_LIB(bsd, daemon,
1474                 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1475 )
1476
1477 AC_CHECK_FUNC(getpagesize,
1478         [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1479                 [Define if your libraries define getpagesize()])],
1480         [AC_CHECK_LIB(ucb, getpagesize,
1481                 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1482 )
1483
1484 # Check for broken snprintf
1485 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1486         AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1487         AC_RUN_IFELSE(
1488                 [AC_LANG_SOURCE([[
1489 #include <stdio.h>
1490 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1491                 ]])],
1492                 [AC_MSG_RESULT(yes)],
1493                 [
1494                         AC_MSG_RESULT(no)
1495                         AC_DEFINE(BROKEN_SNPRINTF, 1,
1496                                 [Define if your snprintf is busted])
1497                         AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1498                 ],
1499                 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1500         )
1501 fi
1502
1503 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1504 # returning the right thing on overflow: the number of characters it tried to
1505 # create (as per SUSv3)
1506 if test "x$ac_cv_func_asprintf" != "xyes" && \
1507    test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1508         AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1509         AC_RUN_IFELSE(
1510                 [AC_LANG_SOURCE([[
1511 #include <sys/types.h>
1512 #include <stdio.h>
1513 #include <stdarg.h>
1514
1515 int x_snprintf(char *str,size_t count,const char *fmt,...)
1516 {
1517         size_t ret; va_list ap;
1518         va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1519         return ret;
1520 }
1521 int main(void)
1522 {
1523         char x[1];
1524         exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1525 } ]])],
1526                 [AC_MSG_RESULT(yes)],
1527                 [
1528                         AC_MSG_RESULT(no)
1529                         AC_DEFINE(BROKEN_SNPRINTF, 1,
1530                                 [Define if your snprintf is busted])
1531                         AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1532                 ],
1533                 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1534         )
1535 fi
1536
1537 # On systems where [v]snprintf is broken, but is declared in stdio,
1538 # check that the fmt argument is const char * or just char *.
1539 # This is only useful for when BROKEN_SNPRINTF
1540 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1541 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1542            int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1543            int main(void) { snprintf(0, 0, 0); } 
1544     ]])],
1545    [AC_MSG_RESULT(yes)
1546     AC_DEFINE(SNPRINTF_CONST, [const],
1547               [Define as const if snprintf() can declare const char *fmt])],
1548    [AC_MSG_RESULT(no)
1549     AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1550
1551 # Check for missing getpeereid (or equiv) support
1552 NO_PEERCHECK=""
1553 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1554         AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1555         AC_TRY_COMPILE(
1556                 [#include <sys/types.h>
1557                  #include <sys/socket.h>],
1558                 [int i = SO_PEERCRED;],
1559                 [ AC_MSG_RESULT(yes)
1560                   AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1561                 ],
1562                 [AC_MSG_RESULT(no)
1563                 NO_PEERCHECK=1]
1564         )
1565 fi
1566
1567 dnl see whether mkstemp() requires XXXXXX
1568 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1569 AC_MSG_CHECKING([for (overly) strict mkstemp])
1570 AC_RUN_IFELSE(
1571         [AC_LANG_SOURCE([[
1572 #include <stdlib.h>
1573 main() { char template[]="conftest.mkstemp-test";
1574 if (mkstemp(template) == -1)
1575         exit(1);
1576 unlink(template); exit(0);
1577 }
1578         ]])],
1579         [
1580                 AC_MSG_RESULT(no)
1581         ],
1582         [
1583                 AC_MSG_RESULT(yes)
1584                 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1585         ],
1586         [
1587                 AC_MSG_RESULT(yes)
1588                 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1589         ]
1590 )
1591 fi
1592
1593 dnl make sure that openpty does not reacquire controlling terminal
1594 if test ! -z "$check_for_openpty_ctty_bug"; then
1595         AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1596         AC_RUN_IFELSE(
1597                 [AC_LANG_SOURCE([[
1598 #include <stdio.h>
1599 #include <sys/fcntl.h>
1600 #include <sys/types.h>
1601 #include <sys/wait.h>
1602
1603 int
1604 main()
1605 {
1606         pid_t pid;
1607         int fd, ptyfd, ttyfd, status;
1608
1609         pid = fork();
1610         if (pid < 0) {          /* failed */
1611                 exit(1);
1612         } else if (pid > 0) {   /* parent */
1613                 waitpid(pid, &status, 0);
1614                 if (WIFEXITED(status))
1615                         exit(WEXITSTATUS(status));
1616                 else
1617                         exit(2);
1618         } else {                /* child */
1619                 close(0); close(1); close(2);
1620                 setsid();
1621                 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1622                 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1623                 if (fd >= 0)
1624                         exit(3);        /* Acquired ctty: broken */
1625                 else
1626                         exit(0);        /* Did not acquire ctty: OK */
1627         }
1628 }
1629                 ]])],
1630                 [
1631                         AC_MSG_RESULT(yes)
1632                 ],
1633                 [
1634                         AC_MSG_RESULT(no)
1635                         AC_DEFINE(SSHD_ACQUIRES_CTTY)
1636                 ],
1637                 [
1638                         AC_MSG_RESULT(cross-compiling, assuming yes)
1639                 ]
1640         )
1641 fi
1642
1643 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1644     test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1645         AC_MSG_CHECKING(if getaddrinfo seems to work)
1646         AC_RUN_IFELSE(
1647                 [AC_LANG_SOURCE([[
1648 #include <stdio.h>
1649 #include <sys/socket.h>
1650 #include <netdb.h>
1651 #include <errno.h>
1652 #include <netinet/in.h>
1653
1654 #define TEST_PORT "2222"
1655
1656 int
1657 main(void)
1658 {
1659         int err, sock;
1660         struct addrinfo *gai_ai, *ai, hints;
1661         char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1662
1663         memset(&hints, 0, sizeof(hints));
1664         hints.ai_family = PF_UNSPEC;
1665         hints.ai_socktype = SOCK_STREAM;
1666         hints.ai_flags = AI_PASSIVE;
1667
1668         err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1669         if (err != 0) {
1670                 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1671                 exit(1);
1672         }
1673
1674         for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1675                 if (ai->ai_family != AF_INET6)
1676                         continue;
1677
1678                 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1679                     sizeof(ntop), strport, sizeof(strport),
1680                     NI_NUMERICHOST|NI_NUMERICSERV);
1681
1682                 if (err != 0) {
1683                         if (err == EAI_SYSTEM)
1684                                 perror("getnameinfo EAI_SYSTEM");
1685                         else
1686                                 fprintf(stderr, "getnameinfo failed: %s\n",
1687                                     gai_strerror(err));
1688                         exit(2);
1689                 }
1690
1691                 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1692                 if (sock < 0)
1693                         perror("socket");
1694                 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1695                         if (errno == EBADF)
1696                                 exit(3);
1697                 }
1698         }
1699         exit(0);
1700 }
1701                 ]])],
1702                 [
1703                         AC_MSG_RESULT(yes)
1704                 ],
1705                 [
1706                         AC_MSG_RESULT(no)
1707                         AC_DEFINE(BROKEN_GETADDRINFO)
1708                 ],
1709                 [
1710                         AC_MSG_RESULT(cross-compiling, assuming yes)
1711                 ]
1712         )
1713 fi
1714
1715 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1716     test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1717         AC_MSG_CHECKING(if getaddrinfo seems to work)
1718         AC_RUN_IFELSE(
1719                 [AC_LANG_SOURCE([[
1720 #include <stdio.h>
1721 #include <sys/socket.h>
1722 #include <netdb.h>
1723 #include <errno.h>
1724 #include <netinet/in.h>
1725
1726 #define TEST_PORT "2222"
1727
1728 int
1729 main(void)
1730 {
1731         int err, sock;
1732         struct addrinfo *gai_ai, *ai, hints;
1733         char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1734
1735         memset(&hints, 0, sizeof(hints));
1736         hints.ai_family = PF_UNSPEC;
1737         hints.ai_socktype = SOCK_STREAM;
1738         hints.ai_flags = AI_PASSIVE;
1739
1740         err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1741         if (err != 0) {
1742                 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1743                 exit(1);
1744         }
1745
1746         for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1747                 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1748                         continue;
1749
1750                 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1751                     sizeof(ntop), strport, sizeof(strport),
1752                     NI_NUMERICHOST|NI_NUMERICSERV);
1753
1754                 if (ai->ai_family == AF_INET && err != 0) {
1755                         perror("getnameinfo");
1756                         exit(2);
1757                 }
1758         }
1759         exit(0);
1760 }
1761                 ]])],
1762                 [
1763                         AC_MSG_RESULT(yes)
1764                         AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1765                                 [Define if you have a getaddrinfo that fails
1766                                 for the all-zeros IPv6 address])
1767                 ],
1768                 [
1769                         AC_MSG_RESULT(no)
1770                         AC_DEFINE(BROKEN_GETADDRINFO)
1771                 ],
1772                         AC_MSG_RESULT(cross-compiling, assuming no)
1773                 ]
1774         )
1775 fi
1776
1777 if test "x$check_for_conflicting_getspnam" = "x1"; then
1778         AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1779         AC_COMPILE_IFELSE(
1780                 [
1781 #include <shadow.h>
1782 int main(void) {exit(0);}
1783                 ],
1784                 [
1785                         AC_MSG_RESULT(no)
1786                 ],
1787                 [
1788                         AC_MSG_RESULT(yes)
1789                         AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1790                             [Conflicting defs for getspnam])
1791                 ]
1792         )
1793 fi
1794
1795 AC_FUNC_GETPGRP
1796
1797 # Check for PAM libs
1798 PAM_MSG="no"
1799 AC_ARG_WITH(pam,
1800         [  --with-pam              Enable PAM support ],
1801         [
1802                 if test "x$withval" != "xno" ; then
1803                         if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1804                            test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1805                                 AC_MSG_ERROR([PAM headers not found])
1806                         fi
1807
1808                         AC_CHECK_LIB(dl, dlopen, , )
1809                         AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1810                         AC_CHECK_FUNCS(pam_getenvlist)
1811                         AC_CHECK_FUNCS(pam_putenv)
1812
1813                         PAM_MSG="yes"
1814
1815                         AC_DEFINE(USE_PAM, 1,
1816                                 [Define if you want to enable PAM support])
1817                         if test $ac_cv_lib_dl_dlopen = yes; then
1818                                 LIBPAM="-lpam -ldl"
1819                         else
1820                                 LIBPAM="-lpam"
1821                         fi
1822                         AC_SUBST(LIBPAM)
1823                 fi
1824         ]
1825 )
1826
1827 # Check for older PAM
1828 if test "x$PAM_MSG" = "xyes" ; then
1829         # Check PAM strerror arguments (old PAM)
1830         AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1831         AC_TRY_COMPILE(
1832                 [
1833 #include <stdlib.h>
1834 #if defined(HAVE_SECURITY_PAM_APPL_H)
1835 #include <security/pam_appl.h>
1836 #elif defined (HAVE_PAM_PAM_APPL_H)
1837 #include <pam/pam_appl.h>
1838 #endif
1839                 ],
1840                 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1841                 [AC_MSG_RESULT(no)],
1842                 [
1843                         AC_DEFINE(HAVE_OLD_PAM, 1,
1844                                 [Define if you have an old version of PAM
1845                                 which takes only one argument to pam_strerror])
1846                         AC_MSG_RESULT(yes)
1847                         PAM_MSG="yes (old library)"
1848                 ]
1849         )
1850 fi
1851
1852 # Search for OpenSSL
1853 saved_CPPFLAGS="$CPPFLAGS"
1854 saved_LDFLAGS="$LDFLAGS"
1855 AC_ARG_WITH(ssl-dir,
1856         [  --with-ssl-dir=PATH     Specify path to OpenSSL installation ],
1857         [
1858                 if test "x$withval" != "xno" ; then
1859                         case "$withval" in
1860                                 # Relative paths
1861                                 ./*|../*)       withval="`pwd`/$withval"
1862                         esac
1863                         if test -d "$withval/lib"; then
1864                                 if test -n "${need_dash_r}"; then
1865                                         LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1866                                 else
1867                                         LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1868                                 fi
1869                         else
1870                                 if test -n "${need_dash_r}"; then
1871                                         LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1872                                 else
1873                                         LDFLAGS="-L${withval} ${LDFLAGS}"
1874                                 fi
1875                         fi
1876                         if test -d "$withval/include"; then
1877                                 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1878                         else
1879                                 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1880                         fi
1881                 fi
1882         ]
1883 )
1884 if test -z "$GSI_LIBS" ; then
1885 LIBS="-lcrypto $LIBS"
1886 fi
1887 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1888         [Define if your ssl headers are included
1889         with #include <openssl/header.h>]),
1890         [
1891                 dnl Check default openssl install dir
1892                 if test -n "${need_dash_r}"; then
1893                         LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1894                 else
1895                         LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1896                 fi
1897                 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1898                 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1899                         [
1900                                 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1901                         ]
1902                 )
1903         ]
1904 )
1905
1906 # Determine OpenSSL header version
1907 AC_MSG_CHECKING([OpenSSL header version])
1908 AC_RUN_IFELSE(
1909         [AC_LANG_SOURCE([[
1910 #include <stdio.h>
1911 #include <string.h>
1912 #include <openssl/opensslv.h>
1913 #define DATA "conftest.sslincver"
1914 int main(void) {
1915         FILE *fd;
1916         int rc;
1917
1918         fd = fopen(DATA,"w");
1919         if(fd == NULL)
1920                 exit(1);
1921
1922         if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1923                 exit(1);
1924
1925         exit(0);
1926 }
1927         ]])],
1928         [
1929                 ssl_header_ver=`cat conftest.sslincver`
1930                 AC_MSG_RESULT($ssl_header_ver)
1931         ],
1932         [
1933                 AC_MSG_RESULT(not found)
1934                 AC_MSG_ERROR(OpenSSL version header not found.)
1935         ],
1936         [
1937                 AC_MSG_WARN([cross compiling: not checking])
1938         ]
1939 )
1940
1941 # Determine OpenSSL library version
1942 AC_MSG_CHECKING([OpenSSL library version])
1943 AC_RUN_IFELSE(
1944         [AC_LANG_SOURCE([[
1945 #include <stdio.h>
1946 #include <string.h>
1947 #include <openssl/opensslv.h>
1948 #include <openssl/crypto.h>
1949 #define DATA "conftest.ssllibver"
1950 int main(void) {
1951         FILE *fd;
1952         int rc;
1953
1954         fd = fopen(DATA,"w");
1955         if(fd == NULL)
1956                 exit(1);
1957
1958         if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1959                 exit(1);
1960
1961         exit(0);
1962 }
1963         ]])],
1964         [
1965                 ssl_library_ver=`cat conftest.ssllibver`
1966                 AC_MSG_RESULT($ssl_library_ver)
1967         ],
1968         [
1969                 AC_MSG_RESULT(not found)
1970                 AC_MSG_ERROR(OpenSSL library not found.)
1971         ],
1972         [
1973                 AC_MSG_WARN([cross compiling: not checking])
1974         ]
1975 )
1976
1977 # Sanity check OpenSSL headers
1978 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1979 AC_RUN_IFELSE(
1980         [AC_LANG_SOURCE([[
1981 #include <string.h>
1982 #include <openssl/opensslv.h>
1983 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1984         ]])],
1985         [
1986                 AC_MSG_RESULT(yes)
1987         ],
1988         [
1989                 AC_MSG_RESULT(no)
1990                 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1991 Check config.log for details.
1992 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1993         ],
1994         [
1995                 AC_MSG_WARN([cross compiling: not checking])
1996         ]
1997 )
1998
1999 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2000 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2001 AC_COMPILE_IFELSE(
2002         [AC_LANG_SOURCE([[
2003 #include <string.h>
2004 #include <openssl/evp.h>
2005 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2006         ]])],
2007         [
2008                 AC_MSG_RESULT(no)
2009         ],
2010         [
2011                 AC_MSG_RESULT(yes)
2012                 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2013                     [libcrypto is missing AES 192 and 256 bit functions])
2014         ]
2015 )
2016
2017 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2018 # because the system crypt() is more featureful.
2019 if test "x$check_for_libcrypt_before" = "x1"; then
2020         AC_CHECK_LIB(crypt, crypt)
2021 fi
2022
2023 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2024 # version in OpenSSL.
2025 if test "x$check_for_libcrypt_later" = "x1"; then
2026         AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2027 fi
2028
2029 AC_CHECK_LIB(iaf, ia_openinfo)
2030
2031 ### Configure cryptographic random number support
2032
2033 # Check wheter OpenSSL seeds itself
2034 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2035 AC_RUN_IFELSE(
2036         [AC_LANG_SOURCE([[
2037 #include <string.h>
2038 #include <openssl/rand.h>
2039 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2040         ]])],
2041         [
2042                 OPENSSL_SEEDS_ITSELF=yes
2043                 AC_MSG_RESULT(yes)
2044         ],
2045         [
2046                 AC_MSG_RESULT(no)
2047                 # Default to use of the rand helper if OpenSSL doesn't
2048                 # seed itself
2049                 USE_RAND_HELPER=yes
2050         ],
2051         [
2052                 AC_MSG_WARN([cross compiling: assuming yes])
2053                 # This is safe, since all recent OpenSSL versions will
2054                 # complain at runtime if not seeded correctly.
2055                 OPENSSL_SEEDS_ITSELF=yes
2056         ]
2057 )
2058
2059
2060 # Do we want to force the use of the rand helper?
2061 AC_ARG_WITH(rand-helper,
2062         [  --with-rand-helper      Use subprocess to gather strong randomness ],
2063         [
2064                 if test "x$withval" = "xno" ; then
2065                         # Force use of OpenSSL's internal RNG, even if
2066                         # the previous test showed it to be unseeded.
2067                         if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2068                                 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2069                                 OPENSSL_SEEDS_ITSELF=yes
2070                                 USE_RAND_HELPER=""
2071                         fi
2072                 else
2073                         USE_RAND_HELPER=yes
2074                 fi
2075         ],
2076 )
2077
2078 # Which randomness source do we use?
2079 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2080         # OpenSSL only
2081         AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2082                 [Define if you want OpenSSL's internally seeded PRNG only])
2083         RAND_MSG="OpenSSL internal ONLY"
2084         INSTALL_SSH_RAND_HELPER=""
2085 elif test ! -z "$USE_RAND_HELPER" ; then
2086         # install rand helper
2087         RAND_MSG="ssh-rand-helper"
2088         INSTALL_SSH_RAND_HELPER="yes"
2089 fi
2090 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2091
2092 ### Configuration of ssh-rand-helper
2093
2094 # PRNGD TCP socket
2095 AC_ARG_WITH(prngd-port,
2096         [  --with-prngd-port=PORT  read entropy from PRNGD/EGD TCP localhost:PORT],
2097         [
2098                 case "$withval" in
2099                 no)
2100                         withval=""
2101                         ;;
2102                 [[0-9]]*)
2103                         ;;
2104                 *)
2105                         AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2106                         ;;
2107                 esac
2108                 if test ! -z "$withval" ; then
2109                         PRNGD_PORT="$withval"
2110                         AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2111                                 [Port number of PRNGD/EGD random number socket])
2112                 fi
2113         ]
2114 )
2115
2116 # PRNGD Unix domain socket
2117 AC_ARG_WITH(prngd-socket,
2118         [  --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2119         [
2120                 case "$withval" in
2121                 yes)
2122                         withval="/var/run/egd-pool"
2123                         ;;
2124                 no)
2125                         withval=""
2126                         ;;
2127                 /*)
2128                         ;;
2129                 *)
2130                         AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2131                         ;;
2132                 esac
2133
2134                 if test ! -z "$withval" ; then
2135                         if test ! -z "$PRNGD_PORT" ; then
2136                                 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2137                         fi
2138                         if test ! -r "$withval" ; then
2139                                 AC_MSG_WARN(Entropy socket is not readable)
2140                         fi
2141                         PRNGD_SOCKET="$withval"
2142                         AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2143                                 [Location of PRNGD/EGD random number socket])
2144                 fi
2145         ],
2146         [
2147                 # Check for existing socket only if we don't have a random device already
2148                 if test "$USE_RAND_HELPER" = yes ; then
2149                         AC_MSG_CHECKING(for PRNGD/EGD socket)
2150                         # Insert other locations here
2151                         for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2152                                 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2153                                         PRNGD_SOCKET="$sock"
2154                                         AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2155                                         break;
2156                                 fi
2157                         done
2158                         if test ! -z "$PRNGD_SOCKET" ; then
2159                                 AC_MSG_RESULT($PRNGD_SOCKET)
2160                         else
2161                                 AC_MSG_RESULT(not found)
2162                         fi
2163                 fi
2164         ]
2165 )
2166
2167 # Change default command timeout for hashing entropy source
2168 entropy_timeout=200
2169 AC_ARG_WITH(entropy-timeout,
2170         [  --with-entropy-timeout  Specify entropy gathering command timeout (msec)],
2171         [
2172                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
2173                     test "x${withval}" != "xyes"; then
2174                         entropy_timeout=$withval
2175                 fi
2176         ]
2177 )
2178 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2179         [Builtin PRNG command timeout])
2180
2181 SSH_PRIVSEP_USER=sshd
2182 AC_ARG_WITH(privsep-user,
2183         [  --with-privsep-user=user Specify non-privileged user for privilege separation],
2184         [
2185                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
2186                     test "x${withval}" != "xyes"; then
2187                         SSH_PRIVSEP_USER=$withval
2188                 fi
2189         ]
2190 )
2191 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2192         [non-privileged user for privilege separation])
2193 AC_SUBST(SSH_PRIVSEP_USER)
2194
2195 # We do this little dance with the search path to insure
2196 # that programs that we select for use by installed programs
2197 # (which may be run by the super-user) come from trusted
2198 # locations before they come from the user's private area.
2199 # This should help avoid accidentally configuring some
2200 # random version of a program in someone's personal bin.
2201
2202 OPATH=$PATH
2203 PATH=/bin:/usr/bin
2204 test -h /bin 2> /dev/null && PATH=/usr/bin
2205 test -d /sbin && PATH=$PATH:/sbin
2206 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2207 PATH=$PATH:/etc:$OPATH
2208
2209 # These programs are used by the command hashing source to gather entropy
2210 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2211 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2212 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2213 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2214 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2215 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2216 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2217 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2218 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2219 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2220 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2221 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2222 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2223 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2224 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2225 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2226 # restore PATH
2227 PATH=$OPATH
2228
2229 # Where does ssh-rand-helper get its randomness from?
2230 INSTALL_SSH_PRNG_CMDS=""
2231 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2232         if test ! -z "$PRNGD_PORT" ; then
2233                 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2234         elif test ! -z "$PRNGD_SOCKET" ; then
2235                 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2236         else
2237                 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2238                 RAND_HELPER_CMDHASH=yes
2239                 INSTALL_SSH_PRNG_CMDS="yes"
2240         fi
2241 fi
2242 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2243
2244
2245 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2246 if test ! -z "$SONY" ; then
2247   LIBS="$LIBS -liberty";
2248 fi
2249
2250 # Check for  long long datatypes
2251 AC_CHECK_TYPES([long long, unsigned long long, long double])
2252
2253 # Check datatype sizes
2254 AC_CHECK_SIZEOF(char, 1)
2255 AC_CHECK_SIZEOF(short int, 2)
2256 AC_CHECK_SIZEOF(int, 4)
2257 AC_CHECK_SIZEOF(long int, 4)
2258 AC_CHECK_SIZEOF(long long int, 8)
2259
2260 # Sanity check long long for some platforms (AIX)
2261 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2262         ac_cv_sizeof_long_long_int=0
2263 fi
2264
2265 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2266 if test -z "$have_llong_max"; then
2267         AC_MSG_CHECKING([for max value of long long])
2268         AC_RUN_IFELSE(
2269                 [AC_LANG_SOURCE([[
2270 #include <stdio.h>
2271 /* Why is this so damn hard? */
2272 #ifdef __GNUC__
2273 # undef __GNUC__
2274 #endif
2275 #define __USE_ISOC99
2276 #include <limits.h>
2277 #define DATA "conftest.llminmax"
2278 int main(void) {
2279         FILE *f;
2280         long long i, llmin, llmax = 0;
2281
2282         if((f = fopen(DATA,"w")) == NULL)
2283                 exit(1);
2284
2285 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2286         fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2287         llmin = LLONG_MIN;
2288         llmax = LLONG_MAX;
2289 #else
2290         fprintf(stderr, "Calculating  LLONG_MIN and LLONG_MAX\n");
2291         /* This will work on one's complement and two's complement */
2292         for (i = 1; i > llmax; i <<= 1, i++)
2293                 llmax = i;
2294         llmin = llmax + 1LL;    /* wrap */
2295 #endif
2296
2297         /* Sanity check */
2298         if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2299             || llmax - 1 > llmax) {
2300                 fprintf(f, "unknown unknown\n");
2301                 exit(2);
2302         }
2303
2304         if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2305                 exit(3);
2306
2307         exit(0);
2308 }
2309                 ]])],
2310                 [
2311                         llong_min=`$AWK '{print $1}' conftest.llminmax`
2312                         llong_max=`$AWK '{print $2}' conftest.llminmax`
2313
2314                         # snprintf on some Tru64s doesn't understand "%lld"
2315                         case "$host" in
2316                         alpha-dec-osf*)
2317                                 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2318                                   test "x$llong_max" = "xld"; then
2319                                         llong_min="-9223372036854775808"
2320                                         llong_max="9223372036854775807"
2321                                 fi
2322                                 ;;
2323                         esac
2324
2325                         AC_MSG_RESULT($llong_max)
2326                         AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2327                             [max value of long long calculated by configure])
2328                         AC_MSG_CHECKING([for min value of long long])
2329                         AC_MSG_RESULT($llong_min)
2330                         AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2331                             [min value of long long calculated by configure])
2332                 ],
2333                 [
2334                         AC_MSG_RESULT(not found)
2335                 ],
2336                 [
2337                         AC_MSG_WARN([cross compiling: not checking])
2338                 ]
2339         )
2340 fi
2341
2342
2343 # More checks for data types
2344 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2345         AC_TRY_COMPILE(
2346                 [ #include <sys/types.h> ],
2347                 [ u_int a; a = 1;],
2348                 [ ac_cv_have_u_int="yes" ],
2349                 [ ac_cv_have_u_int="no" ]
2350         )
2351 ])
2352 if test "x$ac_cv_have_u_int" = "xyes" ; then
2353         AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2354         have_u_int=1
2355 fi
2356
2357 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2358         AC_TRY_COMPILE(
2359                 [ #include <sys/types.h> ],
2360                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2361                 [ ac_cv_have_intxx_t="yes" ],
2362                 [ ac_cv_have_intxx_t="no" ]
2363         )
2364 ])
2365 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2366         AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2367         have_intxx_t=1
2368 fi
2369
2370 if (test -z "$have_intxx_t" && \
2371            test "x$ac_cv_header_stdint_h" = "xyes")
2372 then
2373     AC_MSG_CHECKING([for intXX_t types in stdint.h])
2374         AC_TRY_COMPILE(
2375                 [ #include <stdint.h> ],
2376                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2377                 [
2378                         AC_DEFINE(HAVE_INTXX_T)
2379                         AC_MSG_RESULT(yes)
2380                 ],
2381                 [ AC_MSG_RESULT(no) ]
2382         )
2383 fi
2384
2385 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2386         AC_TRY_COMPILE(
2387                 [
2388 #include <sys/types.h>
2389 #ifdef HAVE_STDINT_H
2390 # include <stdint.h>
2391 #endif
2392 #include <sys/socket.h>
2393 #ifdef HAVE_SYS_BITYPES_H
2394 # include <sys/bitypes.h>
2395 #endif
2396                 ],
2397                 [ int64_t a; a = 1;],
2398                 [ ac_cv_have_int64_t="yes" ],
2399                 [ ac_cv_have_int64_t="no" ]
2400         )
2401 ])
2402 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2403         AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2404 fi
2405
2406 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2407         AC_TRY_COMPILE(
2408                 [ #include <sys/types.h> ],
2409                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2410                 [ ac_cv_have_u_intxx_t="yes" ],
2411                 [ ac_cv_have_u_intxx_t="no" ]
2412         )
2413 ])
2414 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2415         AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2416         have_u_intxx_t=1
2417 fi
2418
2419 if test -z "$have_u_intxx_t" ; then
2420     AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2421         AC_TRY_COMPILE(
2422                 [ #include <sys/socket.h> ],
2423                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2424                 [
2425                         AC_DEFINE(HAVE_U_INTXX_T)
2426                         AC_MSG_RESULT(yes)
2427                 ],
2428                 [ AC_MSG_RESULT(no) ]
2429         )
2430 fi
2431
2432 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2433         AC_TRY_COMPILE(
2434                 [ #include <sys/types.h> ],
2435                 [ u_int64_t a; a = 1;],
2436                 [ ac_cv_have_u_int64_t="yes" ],
2437                 [ ac_cv_have_u_int64_t="no" ]
2438         )
2439 ])
2440 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2441         AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2442         have_u_int64_t=1
2443 fi
2444
2445 if test -z "$have_u_int64_t" ; then
2446     AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2447         AC_TRY_COMPILE(
2448                 [ #include <sys/bitypes.h> ],
2449                 [ u_int64_t a; a = 1],
2450                 [
2451                         AC_DEFINE(HAVE_U_INT64_T)
2452                         AC_MSG_RESULT(yes)
2453                 ],
2454                 [ AC_MSG_RESULT(no) ]
2455         )
2456 fi
2457
2458 if test -z "$have_u_intxx_t" ; then
2459         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2460                 AC_TRY_COMPILE(
2461                         [
2462 #include <sys/types.h>
2463                         ],
2464                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2465                         [ ac_cv_have_uintxx_t="yes" ],
2466                         [ ac_cv_have_uintxx_t="no" ]
2467                 )
2468         ])
2469         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2470                 AC_DEFINE(HAVE_UINTXX_T, 1,
2471                         [define if you have uintxx_t data type])
2472         fi
2473 fi
2474
2475 if test -z "$have_uintxx_t" ; then
2476     AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2477         AC_TRY_COMPILE(
2478                 [ #include <stdint.h> ],
2479                 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2480                 [
2481                         AC_DEFINE(HAVE_UINTXX_T)
2482                         AC_MSG_RESULT(yes)
2483                 ],
2484                 [ AC_MSG_RESULT(no) ]
2485         )
2486 fi
2487
2488 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2489            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2490 then
2491         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2492         AC_TRY_COMPILE(
2493                 [
2494 #include <sys/bitypes.h>
2495                 ],
2496                 [
2497                         int8_t a; int16_t b; int32_t c;
2498                         u_int8_t e; u_int16_t f; u_int32_t g;
2499                         a = b = c = e = f = g = 1;
2500                 ],
2501                 [
2502                         AC_DEFINE(HAVE_U_INTXX_T)
2503                         AC_DEFINE(HAVE_INTXX_T)
2504                         AC_MSG_RESULT(yes)
2505                 ],
2506                 [AC_MSG_RESULT(no)]
2507         )
2508 fi
2509
2510
2511 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2512         AC_TRY_COMPILE(
2513                 [
2514 #include <sys/types.h>
2515                 ],
2516                 [ u_char foo; foo = 125; ],
2517                 [ ac_cv_have_u_char="yes" ],
2518                 [ ac_cv_have_u_char="no" ]
2519         )
2520 ])
2521 if test "x$ac_cv_have_u_char" = "xyes" ; then
2522         AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2523 fi
2524
2525 TYPE_SOCKLEN_T
2526
2527 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2528
2529 AC_CHECK_TYPES(in_addr_t,,,
2530 [#include <sys/types.h>
2531 #include <netinet/in.h>])
2532
2533 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2534         AC_TRY_COMPILE(
2535                 [
2536 #include <sys/types.h>
2537                 ],
2538                 [ size_t foo; foo = 1235; ],
2539                 [ ac_cv_have_size_t="yes" ],
2540                 [ ac_cv_have_size_t="no" ]
2541         )
2542 ])
2543 if test "x$ac_cv_have_size_t" = "xyes" ; then
2544         AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2545 fi
2546
2547 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2548         AC_TRY_COMPILE(
2549                 [
2550 #include <sys/types.h>
2551                 ],
2552                 [ ssize_t foo; foo = 1235; ],
2553                 [ ac_cv_have_ssize_t="yes" ],
2554                 [ ac_cv_have_ssize_t="no" ]
2555         )
2556 ])
2557 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2558         AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2559 fi
2560
2561 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2562         AC_TRY_COMPILE(
2563                 [
2564 #include <time.h>
2565                 ],
2566                 [ clock_t foo; foo = 1235; ],
2567                 [ ac_cv_have_clock_t="yes" ],
2568                 [ ac_cv_have_clock_t="no" ]
2569         )
2570 ])
2571 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2572         AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2573 fi
2574
2575 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2576         AC_TRY_COMPILE(
2577                 [
2578 #include <sys/types.h>
2579 #include <sys/socket.h>
2580                 ],
2581                 [ sa_family_t foo; foo = 1235; ],
2582                 [ ac_cv_have_sa_family_t="yes" ],
2583                 [ AC_TRY_COMPILE(
2584                   [
2585 #include <sys/types.h>
2586 #include <sys/socket.h>
2587 #include <netinet/in.h>
2588                 ],
2589                 [ sa_family_t foo; foo = 1235; ],
2590                 [ ac_cv_have_sa_family_t="yes" ],
2591
2592                 [ ac_cv_have_sa_family_t="no" ]
2593         )]
2594         )
2595 ])
2596 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2597         AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2598                 [define if you have sa_family_t data type])
2599 fi
2600
2601 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2602         AC_TRY_COMPILE(
2603                 [
2604 #include <sys/types.h>
2605                 ],
2606                 [ pid_t foo; foo = 1235; ],
2607                 [ ac_cv_have_pid_t="yes" ],
2608                 [ ac_cv_have_pid_t="no" ]
2609         )
2610 ])
2611 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2612         AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2613 fi
2614
2615 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2616         AC_TRY_COMPILE(
2617                 [
2618 #include <sys/types.h>
2619                 ],
2620                 [ mode_t foo; foo = 1235; ],
2621                 [ ac_cv_have_mode_t="yes" ],
2622                 [ ac_cv_have_mode_t="no" ]
2623         )
2624 ])
2625 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2626         AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2627 fi
2628
2629
2630 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2631         AC_TRY_COMPILE(
2632                 [
2633 #include <sys/types.h>
2634 #include <sys/socket.h>
2635                 ],
2636                 [ struct sockaddr_storage s; ],
2637                 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2638                 [ ac_cv_have_struct_sockaddr_storage="no" ]
2639         )
2640 ])
2641 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2642         AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2643                 [define if you have struct sockaddr_storage data type])
2644 fi
2645
2646 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2647         AC_TRY_COMPILE(
2648                 [
2649 #include <sys/types.h>
2650 #include <netinet/in.h>
2651                 ],
2652                 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2653                 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2654                 [ ac_cv_have_struct_sockaddr_in6="no" ]
2655         )
2656 ])
2657 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2658         AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2659                 [define if you have struct sockaddr_in6 data type])
2660 fi
2661
2662 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2663         AC_TRY_COMPILE(
2664                 [
2665 #include <sys/types.h>
2666 #include <netinet/in.h>
2667                 ],
2668                 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2669                 [ ac_cv_have_struct_in6_addr="yes" ],
2670                 [ ac_cv_have_struct_in6_addr="no" ]
2671         )
2672 ])
2673 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2674         AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2675                 [define if you have struct in6_addr data type])
2676 fi
2677
2678 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2679         AC_TRY_COMPILE(
2680                 [
2681 #include <sys/types.h>
2682 #include <sys/socket.h>
2683 #include <netdb.h>
2684                 ],
2685                 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2686                 [ ac_cv_have_struct_addrinfo="yes" ],
2687                 [ ac_cv_have_struct_addrinfo="no" ]
2688         )
2689 ])
2690 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2691         AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2692                 [define if you have struct addrinfo data type])
2693 fi
2694
2695 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2696         AC_TRY_COMPILE(
2697                 [ #include <sys/time.h> ],
2698                 [ struct timeval tv; tv.tv_sec = 1;],
2699                 [ ac_cv_have_struct_timeval="yes" ],
2700                 [ ac_cv_have_struct_timeval="no" ]
2701         )
2702 ])
2703 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2704         AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2705         have_struct_timeval=1
2706 fi
2707
2708 AC_CHECK_TYPES(struct timespec)
2709
2710 # We need int64_t or else certian parts of the compile will fail.
2711 if test "x$ac_cv_have_int64_t" = "xno" && \
2712         test "x$ac_cv_sizeof_long_int" != "x8" && \
2713         test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2714         echo "OpenSSH requires int64_t support.  Contact your vendor or install"
2715         echo "an alternative compiler (I.E., GCC) before continuing."
2716         echo ""
2717         exit 1;
2718 else
2719 dnl test snprintf (broken on SCO w/gcc)
2720         AC_RUN_IFELSE(
2721                 [AC_LANG_SOURCE([[
2722 #include <stdio.h>
2723 #include <string.h>
2724 #ifdef HAVE_SNPRINTF
2725 main()
2726 {
2727         char buf[50];
2728         char expected_out[50];
2729         int mazsize = 50 ;
2730 #if (SIZEOF_LONG_INT == 8)
2731         long int num = 0x7fffffffffffffff;
2732 #else
2733         long long num = 0x7fffffffffffffffll;
2734 #endif
2735         strcpy(expected_out, "9223372036854775807");
2736         snprintf(buf, mazsize, "%lld", num);
2737         if(strcmp(buf, expected_out) != 0)
2738                 exit(1);
2739         exit(0);
2740 }
2741 #else
2742 main() { exit(0); }
2743 #endif
2744                 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2745                 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2746         )
2747 fi
2748
2749 dnl Checks for structure members
2750 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2751 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2752 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2753 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2754 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2755 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2756 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2757 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2758 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2759 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2760 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2761 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2762 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2763 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2764 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2765 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2766 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2767
2768 AC_CHECK_MEMBERS([struct stat.st_blksize])
2769 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2770         [Define if we don't have struct __res_state in resolv.h])],
2771 [
2772 #include <stdio.h>
2773 #if HAVE_SYS_TYPES_H
2774 # include <sys/types.h>
2775 #endif
2776 #include <netinet/in.h>
2777 #include <arpa/nameser.h>
2778 #include <resolv.h>
2779 ])
2780
2781 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2782                 ac_cv_have_ss_family_in_struct_ss, [
2783         AC_TRY_COMPILE(
2784                 [
2785 #include <sys/types.h>
2786 #include <sys/socket.h>
2787                 ],
2788                 [ struct sockaddr_storage s; s.ss_family = 1; ],
2789                 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2790                 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2791         )
2792 ])
2793 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2794         AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2795 fi
2796
2797 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2798                 ac_cv_have___ss_family_in_struct_ss, [
2799         AC_TRY_COMPILE(
2800                 [
2801 #include <sys/types.h>
2802 #include <sys/socket.h>
2803                 ],
2804                 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2805                 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2806                 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2807         )
2808 ])
2809 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2810         AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2811                 [Fields in struct sockaddr_storage])
2812 fi
2813
2814 AC_CACHE_CHECK([for pw_class field in struct passwd],
2815                 ac_cv_have_pw_class_in_struct_passwd, [
2816         AC_TRY_COMPILE(
2817                 [
2818 #include <pwd.h>
2819                 ],
2820                 [ struct passwd p; p.pw_class = 0; ],
2821                 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2822                 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2823         )
2824 ])
2825 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2826         AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2827                 [Define if your password has a pw_class field])
2828 fi
2829
2830 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2831                 ac_cv_have_pw_expire_in_struct_passwd, [
2832         AC_TRY_COMPILE(
2833                 [
2834 #include <pwd.h>
2835                 ],
2836                 [ struct passwd p; p.pw_expire = 0; ],
2837                 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2838                 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2839         )
2840 ])
2841 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2842         AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2843                 [Define if your password has a pw_expire field])
2844 fi
2845
2846 AC_CACHE_CHECK([for pw_change field in struct passwd],
2847                 ac_cv_have_pw_change_in_struct_passwd, [
2848         AC_TRY_COMPILE(
2849                 [
2850 #include <pwd.h>
2851                 ],
2852                 [ struct passwd p; p.pw_change = 0; ],
2853                 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2854                 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2855         )
2856 ])
2857 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2858         AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2859                 [Define if your password has a pw_change field])
2860 fi
2861
2862 dnl make sure we're using the real structure members and not defines
2863 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2864                 ac_cv_have_accrights_in_msghdr, [
2865         AC_COMPILE_IFELSE(
2866                 [
2867 #include <sys/types.h>
2868 #include <sys/socket.h>
2869 #include <sys/uio.h>
2870 int main() {
2871 #ifdef msg_accrights
2872 #error "msg_accrights is a macro"
2873 exit(1);
2874 #endif
2875 struct msghdr m;
2876 m.msg_accrights = 0;
2877 exit(0);
2878 }
2879                 ],
2880                 [ ac_cv_have_accrights_in_msghdr="yes" ],
2881                 [ ac_cv_have_accrights_in_msghdr="no" ]
2882         )
2883 ])
2884 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2885         AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2886                 [Define if your system uses access rights style
2887                 file descriptor passing])
2888 fi
2889
2890 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2891                 ac_cv_have_control_in_msghdr, [
2892         AC_COMPILE_IFELSE(
2893                 [
2894 #include <sys/types.h>
2895 #include <sys/socket.h>
2896 #include <sys/uio.h>
2897 int main() {
2898 #ifdef msg_control
2899 #error "msg_control is a macro"
2900 exit(1);
2901 #endif
2902 struct msghdr m;
2903 m.msg_control = 0;
2904 exit(0);
2905 }
2906                 ],
2907                 [ ac_cv_have_control_in_msghdr="yes" ],
2908                 [ ac_cv_have_control_in_msghdr="no" ]
2909         )
2910 ])
2911 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2912         AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2913                 [Define if your system uses ancillary data style
2914                 file descriptor passing])
2915 fi
2916
2917 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2918         AC_TRY_LINK([],
2919                 [ extern char *__progname; printf("%s", __progname); ],
2920                 [ ac_cv_libc_defines___progname="yes" ],
2921                 [ ac_cv_libc_defines___progname="no" ]
2922         )
2923 ])
2924 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2925         AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2926 fi
2927
2928 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2929         AC_TRY_LINK([
2930 #include <stdio.h>
2931 ],
2932                 [ printf("%s", __FUNCTION__); ],
2933                 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2934                 [ ac_cv_cc_implements___FUNCTION__="no" ]
2935         )
2936 ])
2937 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2938         AC_DEFINE(HAVE___FUNCTION__, 1,
2939                 [Define if compiler implements __FUNCTION__])
2940 fi
2941
2942 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2943         AC_TRY_LINK([
2944 #include <stdio.h>
2945 ],
2946                 [ printf("%s", __func__); ],
2947                 [ ac_cv_cc_implements___func__="yes" ],
2948                 [ ac_cv_cc_implements___func__="no" ]
2949         )
2950 ])
2951 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2952         AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2953 fi
2954
2955 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2956         AC_TRY_LINK(
2957                 [#include <stdarg.h>
2958                  va_list x,y;],
2959                 [va_copy(x,y);],
2960                 [ ac_cv_have_va_copy="yes" ],
2961                 [ ac_cv_have_va_copy="no" ]
2962         )
2963 ])
2964 if test "x$ac_cv_have_va_copy" = "xyes" ; then
2965         AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2966 fi
2967
2968 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2969         AC_TRY_LINK(
2970                 [#include <stdarg.h>
2971                  va_list x,y;],
2972                 [__va_copy(x,y);],
2973                 [ ac_cv_have___va_copy="yes" ],
2974                 [ ac_cv_have___va_copy="no" ]
2975         )
2976 ])
2977 if test "x$ac_cv_have___va_copy" = "xyes" ; then
2978         AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2979 fi
2980
2981 AC_CACHE_CHECK([whether getopt has optreset support],
2982                 ac_cv_have_getopt_optreset, [
2983         AC_TRY_LINK(
2984                 [
2985 #include <getopt.h>
2986                 ],
2987                 [ extern int optreset; optreset = 0; ],
2988                 [ ac_cv_have_getopt_optreset="yes" ],
2989                 [ ac_cv_have_getopt_optreset="no" ]
2990         )
2991 ])
2992 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2993         AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2994                 [Define if your getopt(3) defines and uses optreset])
2995 fi
2996
2997 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2998         AC_TRY_LINK([],
2999                 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3000                 [ ac_cv_libc_defines_sys_errlist="yes" ],
3001                 [ ac_cv_libc_defines_sys_errlist="no" ]
3002         )
3003 ])
3004 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3005         AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3006                 [Define if your system defines sys_errlist[]])
3007 fi
3008
3009
3010 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3011         AC_TRY_LINK([],
3012                 [ extern int sys_nerr; printf("%i", sys_nerr);],
3013                 [ ac_cv_libc_defines_sys_nerr="yes" ],
3014                 [ ac_cv_libc_defines_sys_nerr="no" ]
3015         )
3016 ])
3017 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3018         AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3019 fi
3020
3021 SCARD_MSG="no"
3022 # Check whether user wants sectok support
3023 AC_ARG_WITH(sectok,
3024         [  --with-sectok           Enable smartcard support using libsectok],
3025         [
3026                 if test "x$withval" != "xno" ; then
3027                         if test "x$withval" != "xyes" ; then
3028                                 CPPFLAGS="$CPPFLAGS -I${withval}"
3029                                 LDFLAGS="$LDFLAGS -L${withval}"
3030                                 if test ! -z "$need_dash_r" ; then
3031                                         LDFLAGS="$LDFLAGS -R${withval}"
3032                                 fi
3033                                 if test ! -z "$blibpath" ; then
3034                                         blibpath="$blibpath:${withval}"
3035                                 fi
3036                         fi
3037                         AC_CHECK_HEADERS(sectok.h)
3038                         if test "$ac_cv_header_sectok_h" != yes; then
3039                                 AC_MSG_ERROR(Can't find sectok.h)
3040                         fi
3041                         AC_CHECK_LIB(sectok, sectok_open)
3042                         if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3043                                 AC_MSG_ERROR(Can't find libsectok)
3044                         fi
3045                         AC_DEFINE(SMARTCARD, 1,
3046                                 [Define if you want smartcard support])
3047                         AC_DEFINE(USE_SECTOK, 1,
3048                                 [Define if you want smartcard support
3049                                 using sectok])
3050                         SCARD_MSG="yes, using sectok"
3051                 fi
3052         ]
3053 )
3054
3055 # Check whether user wants OpenSC support
3056 OPENSC_CONFIG="no"
3057 AC_ARG_WITH(opensc,
3058         [  --with-opensc[[=PFX]]     Enable smartcard support using OpenSC (optionally in PATH)],
3059         [
3060             if test "x$withval" != "xno" ; then
3061                 if test "x$withval" != "xyes" ; then
3062                         OPENSC_CONFIG=$withval/bin/opensc-config
3063                 else
3064                         AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3065                 fi
3066                 if test "$OPENSC_CONFIG" != "no"; then
3067                         LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3068                         LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3069                         CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3070                         LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
3071                         AC_DEFINE(SMARTCARD)
3072                         AC_DEFINE(USE_OPENSC, 1,
3073                                 [Define if you want smartcard support
3074                                 using OpenSC])
3075                         SCARD_MSG="yes, using OpenSC"
3076                 fi
3077             fi
3078         ]
3079 )
3080
3081 # Check libraries needed by DNS fingerprint support
3082 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3083         [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3084                 [Define if getrrsetbyname() exists])],
3085         [
3086                 # Needed by our getrrsetbyname()
3087                 AC_SEARCH_LIBS(res_query, resolv)
3088                 AC_SEARCH_LIBS(dn_expand, resolv)
3089                 AC_MSG_CHECKING(if res_query will link)
3090                 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3091                    [AC_MSG_RESULT(no)
3092                     saved_LIBS="$LIBS"
3093                     LIBS="$LIBS -lresolv"
3094                     AC_MSG_CHECKING(for res_query in -lresolv)
3095                     AC_LINK_IFELSE([
3096 #include <resolv.h>
3097 int main()
3098 {
3099         res_query (0, 0, 0, 0, 0);
3100         return 0;
3101 }
3102                         ],
3103                         [LIBS="$LIBS -lresolv"
3104                          AC_MSG_RESULT(yes)],
3105                         [LIBS="$saved_LIBS"
3106                          AC_MSG_RESULT(no)])
3107                     ])
3108                 AC_CHECK_FUNCS(_getshort _getlong)
3109                 AC_CHECK_DECLS([_getshort, _getlong], , ,
3110                     [#include <sys/types.h>
3111                     #include <arpa/nameser.h>])
3112                 AC_CHECK_MEMBER(HEADER.ad,
3113                         [AC_DEFINE(HAVE_HEADER_AD, 1,
3114                             [Define if HEADER.ad exists in arpa/nameser.h])],,
3115                         [#include <arpa/nameser.h>])
3116         ])
3117
3118 # Check whether user wants Kerberos 5 support
3119 KRB5_MSG="no"
3120 AC_ARG_WITH(kerberos5,
3121         [  --with-kerberos5=PATH   Enable Kerberos 5 support],
3122         [ if test "x$withval" != "xno" ; then
3123                 if test "x$withval" = "xyes" ; then
3124                         KRB5ROOT="/usr/local"
3125                 else
3126                         KRB5ROOT=${withval}
3127                 fi
3128
3129                 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3130                 KRB5_MSG="yes"
3131
3132                 AC_MSG_CHECKING(for krb5-config)
3133                 if test -x  $KRB5ROOT/bin/krb5-config ; then
3134                         KRB5CONF=$KRB5ROOT/bin/krb5-config
3135                         AC_MSG_RESULT($KRB5CONF)
3136
3137                         AC_MSG_CHECKING(for gssapi support)
3138                         if $KRB5CONF | grep gssapi >/dev/null ; then
3139                                 AC_MSG_RESULT(yes)
3140                                 AC_DEFINE(GSSAPI, 1,
3141                                         [Define this if you want GSSAPI
3142                                         support in the version 2 protocol])
3143                                 k5confopts=gssapi
3144                         else
3145                                 AC_MSG_RESULT(no)
3146                                 k5confopts=""
3147                         fi
3148                         K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3149                         K5LIBS="`$KRB5CONF --libs $k5confopts`"
3150                         CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3151                         AC_MSG_CHECKING(whether we are using Heimdal)
3152                         AC_TRY_COMPILE([ #include <krb5.h> ],
3153                                        [ char *tmp = heimdal_version; ],
3154                                        [ AC_MSG_RESULT(yes)
3155                                          AC_DEFINE(HEIMDAL, 1,
3156                                         [Define this if you are using the
3157                                         Heimdal version of Kerberos V5]) ],
3158                                          AC_MSG_RESULT(no)
3159                         )
3160                 else
3161                         AC_MSG_RESULT(no)
3162                         CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3163                         LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3164                         AC_MSG_CHECKING(whether we are using Heimdal)
3165                         AC_TRY_COMPILE([ #include <krb5.h> ],
3166                                        [ char *tmp = heimdal_version; ],
3167                                        [ AC_MSG_RESULT(yes)
3168                                          AC_DEFINE(HEIMDAL)
3169                                          K5LIBS="-lkrb5 -ldes"
3170                                          K5LIBS="$K5LIBS -lcom_err -lasn1"
3171                                          AC_CHECK_LIB(roken, net_write,
3172                                            [K5LIBS="$K5LIBS -lroken"])
3173                                        ],
3174                                        [ AC_MSG_RESULT(no)
3175                                          K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3176                                        ]
3177                         )
3178                         AC_SEARCH_LIBS(dn_expand, resolv)
3179
3180                         AC_CHECK_LIB(gssapi,gss_init_sec_context,
3181                                 [ AC_DEFINE(GSSAPI)
3182                                   K5LIBS="-lgssapi $K5LIBS" ],
3183                                 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3184                                         [ AC_DEFINE(GSSAPI)
3185                                           K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3186                                         AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3187                                         $K5LIBS)
3188                                 ],
3189                                 $K5LIBS)
3190
3191                         AC_CHECK_HEADER(gssapi.h, ,
3192                                 [ unset ac_cv_header_gssapi_h
3193                                   CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3194                                   AC_CHECK_HEADERS(gssapi.h, ,
3195                                         AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3196                                   )
3197                                 ]
3198                         )
3199
3200                         oldCPP="$CPPFLAGS"
3201                         CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3202                         AC_CHECK_HEADER(gssapi_krb5.h, ,
3203                                         [ CPPFLAGS="$oldCPP" ])
3204
3205                         # If we're using some other GSSAPI
3206                         if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3207                                 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support.  Use mechglue instead.])
3208                         fi
3209
3210                         if test -z "$GSSAPI"; then
3211                                 GSSAPI="KRB5";
3212                         fi
3213
3214                         oldCPP="$CPPFLAGS"
3215                         CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3216                         AC_CHECK_HEADER(gssapi_krb5.h, ,
3217                                         [ CPPFLAGS="$oldCPP" ])
3218
3219                 fi
3220                 if test ! -z "$need_dash_r" ; then
3221                         LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3222                 fi
3223                 if test ! -z "$blibpath" ; then
3224                         blibpath="$blibpath:${KRB5ROOT}/lib"
3225                 fi
3226
3227                 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3228                 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3229                 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3230
3231                 LIBS="$LIBS $K5LIBS"
3232                 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3233                         [Define this if you want to use libkafs' AFS support]))
3234         fi
3235         ]
3236 )
3237
3238 # Check whether user wants AFS_KRB5 support
3239 AFS_KRB5_MSG="no"
3240 AC_ARG_WITH(afs-krb5,
3241         [  --with-afs-krb5[[=AKLOG_PATH]]  Enable aklog to get token (default=/usr/bin/aklog).],
3242         [
3243                 if test "x$withval" != "xno" ; then
3244
3245                         if test "x$withval" != "xyes" ; then
3246                                 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3247                                         [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3248                         else
3249                                 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3250                                         "/usr/bin/aklog",
3251                                         [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3252                         fi
3253
3254                         if test -z "$KRB5ROOT" ; then
3255                                 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3256                         fi
3257
3258                         LIBS="-lkrbafs -lkrb4 $LIBS"
3259                         if test ! -z "$AFS_LIBS" ; then
3260                                 LIBS="$LIBS $AFS_LIBS"
3261                         fi
3262                         AC_DEFINE(AFS_KRB5, 1,
3263                                 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3264                         AFS_KRB5_MSG="yes"
3265                 fi
3266         ]
3267 )
3268
3269 AC_ARG_WITH(session-hooks,
3270         [  --with-session-hooks    Enable hooks for executing external commands                                       before/after a session],
3271         [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
3272 )
3273
3274 # Looking for programs, paths and files
3275
3276 PRIVSEP_PATH=/var/empty
3277 AC_ARG_WITH(privsep-path,
3278         [  --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3279         [
3280                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3281                     test "x${withval}" != "xyes"; then
3282                         PRIVSEP_PATH=$withval
3283                 fi
3284         ]
3285 )
3286 AC_SUBST(PRIVSEP_PATH)
3287
3288 AC_ARG_WITH(xauth,
3289         [  --with-xauth=PATH       Specify path to xauth program ],
3290         [
3291                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3292                     test "x${withval}" != "xyes"; then
3293                         xauth_path=$withval
3294                 fi
3295         ],
3296         [
3297                 TestPath="$PATH"
3298                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3299                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3300                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3301                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3302                 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3303                 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3304                         xauth_path="/usr/openwin/bin/xauth"
3305                 fi
3306         ]
3307 )
3308
3309 STRIP_OPT=-s
3310 AC_ARG_ENABLE(strip,
3311         [  --disable-strip         Disable calling strip(1) on install],
3312         [
3313                 if test "x$enableval" = "xno" ; then
3314                         STRIP_OPT=
3315                 fi
3316         ]
3317 )
3318 AC_SUBST(STRIP_OPT)
3319
3320 if test -z "$xauth_path" ; then
3321         XAUTH_PATH="undefined"
3322         AC_SUBST(XAUTH_PATH)
3323 else
3324         AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3325                 [Define if xauth is found in your path])
3326         XAUTH_PATH=$xauth_path
3327         AC_SUBST(XAUTH_PATH)
3328 fi
3329
3330 # Check for mail directory (last resort if we cannot get it from headers)
3331 if test ! -z "$MAIL" ; then
3332         maildir=`dirname $MAIL`
3333         AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3334                 [Set this to your mail directory if you don't have maillock.h])
3335 fi
3336
3337 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3338         AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3339         disable_ptmx_check=yes
3340 fi
3341 if test -z "$no_dev_ptmx" ; then
3342         if test "x$disable_ptmx_check" != "xyes" ; then
3343                 AC_CHECK_FILE("/dev/ptmx",
3344                         [
3345                                 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3346                                         [Define if you have /dev/ptmx])
3347                                 have_dev_ptmx=1
3348                         ]
3349                 )
3350         fi
3351 fi
3352
3353 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3354         AC_CHECK_FILE("/dev/ptc",
3355                 [
3356                         AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3357                                 [Define if you have /dev/ptc])
3358                         have_dev_ptc=1
3359                 ]
3360         )
3361 else
3362         AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3363 fi
3364
3365 # Options from here on. Some of these are preset by platform above
3366 AC_ARG_WITH(mantype,
3367         [  --with-mantype=man|cat|doc  Set man page type],
3368         [
3369                 case "$withval" in
3370                 man|cat|doc)
3371                         MANTYPE=$withval
3372                         ;;
3373                 *)
3374                         AC_MSG_ERROR(invalid man type: $withval)
3375                         ;;
3376                 esac
3377         ]
3378 )
3379 if test -z "$MANTYPE"; then
3380         TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3381         AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3382         if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3383                 MANTYPE=doc
3384         elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3385                 MANTYPE=man
3386         else
3387                 MANTYPE=cat
3388         fi
3389 fi
3390 AC_SUBST(MANTYPE)
3391 if test "$MANTYPE" = "doc"; then
3392         mansubdir=man;
3393 else
3394         mansubdir=$MANTYPE;
3395 fi
3396 AC_SUBST(mansubdir)
3397
3398 # Check whether to enable MD5 passwords
3399 MD5_MSG="no"
3400 AC_ARG_WITH(md5-passwords,
3401         [  --with-md5-passwords    Enable use of MD5 passwords],
3402         [
3403                 if test "x$withval" != "xno" ; then
3404                         AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3405                                 [Define if you want to allow MD5 passwords])
3406                         MD5_MSG="yes"
3407                 fi
3408         ]
3409 )
3410
3411 # Whether to disable shadow password support
3412 AC_ARG_WITH(shadow,
3413         [  --without-shadow        Disable shadow password support],
3414         [
3415                 if test "x$withval" = "xno" ; then
3416                         AC_DEFINE(DISABLE_SHADOW)
3417                         disable_shadow=yes
3418                 fi
3419         ]
3420 )
3421
3422 if test -z "$disable_shadow" ; then
3423         AC_MSG_CHECKING([if the systems has expire shadow information])
3424         AC_TRY_COMPILE(
3425         [
3426 #include <sys/types.h>
3427 #include <shadow.h>
3428         struct spwd sp;
3429         ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3430         [ sp_expire_available=yes ], []
3431         )
3432
3433         if test "x$sp_expire_available" = "xyes" ; then
3434                 AC_MSG_RESULT(yes)
3435                 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3436                     [Define if you want to use shadow password expire field])
3437         else
3438                 AC_MSG_RESULT(no)
3439         fi
3440 fi
3441
3442 # Use ip address instead of hostname in $DISPLAY
3443 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3444         DISPLAY_HACK_MSG="yes"
3445         AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3446                 [Define if you need to use IP address
3447                 instead of hostname in $DISPLAY])
3448 else
3449         DISPLAY_HACK_MSG="no"
3450         AC_ARG_WITH(ipaddr-display,
3451                 [  --with-ipaddr-display   Use ip address instead of hostname in \$DISPLAY],
3452                 [
3453                         if test "x$withval" != "xno" ; then
3454                                 AC_DEFINE(IPADDR_IN_DISPLAY)
3455                                 DISPLAY_HACK_MSG="yes"
3456                         fi
3457                 ]
3458         )
3459 fi
3460
3461 # check for /etc/default/login and use it if present.
3462 AC_ARG_ENABLE(etc-default-login,
3463         [  --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3464         [ if test "x$enableval" = "xno"; then
3465                 AC_MSG_NOTICE([/etc/default/login handling disabled])
3466                 etc_default_login=no
3467           else
3468                 etc_default_login=yes
3469           fi ],
3470         [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3471           then
3472                 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3473                 etc_default_login=no
3474           else
3475                 etc_default_login=yes
3476           fi ]
3477 )
3478
3479 if test "x$etc_default_login" != "xno"; then
3480         AC_CHECK_FILE("/etc/default/login",
3481             [ external_path_file=/etc/default/login ])
3482         if test "x$external_path_file" = "x/etc/default/login"; then
3483                 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3484                         [Define if your system has /etc/default/login])
3485         fi
3486 fi
3487
3488 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3489 if test $ac_cv_func_login_getcapbool = "yes" && \
3490         test $ac_cv_header_login_cap_h = "yes" ; then
3491         external_path_file=/etc/login.conf
3492 fi
3493
3494 # Whether to mess with the default path
3495 SERVER_PATH_MSG="(default)"
3496 AC_ARG_WITH(default-path,
3497         [  --with-default-path=    Specify default \$PATH environment for server],
3498         [
3499                 if test "x$external_path_file" = "x/etc/login.conf" ; then
3500                         AC_MSG_WARN([
3501 --with-default-path=PATH has no effect on this system.
3502 Edit /etc/login.conf instead.])
3503                 elif test "x$withval" != "xno" ; then
3504                         if test ! -z "$external_path_file" ; then
3505                                 AC_MSG_WARN([
3506 --with-default-path=PATH will only be used if PATH is not defined in
3507 $external_path_file .])
3508                         fi
3509                         user_path="$withval"
3510                         SERVER_PATH_MSG="$withval"
3511                 fi
3512         ],
3513         [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3514                 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3515         else
3516                 if test ! -z "$external_path_file" ; then
3517                         AC_MSG_WARN([
3518 If PATH is defined in $external_path_file, ensure the path to scp is included,
3519 otherwise scp will not work.])
3520                 fi
3521                 AC_RUN_IFELSE(
3522                         [AC_LANG_SOURCE([[
3523 /* find out what STDPATH is */
3524 #include <stdio.h>
3525 #ifdef HAVE_PATHS_H
3526 # include <paths.h>
3527 #endif
3528 #ifndef _PATH_STDPATH
3529 # ifdef _PATH_USERPATH  /* Irix */
3530 #  define _PATH_STDPATH _PATH_USERPATH
3531 # else
3532 #  define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3533 # endif
3534 #endif
3535 #include <sys/types.h>
3536 #include <sys/stat.h>
3537 #include <fcntl.h>
3538 #define DATA "conftest.stdpath"
3539
3540 main()
3541 {
3542         FILE *fd;
3543         int rc;
3544
3545         fd = fopen(DATA,"w");
3546         if(fd == NULL)
3547                 exit(1);
3548
3549         if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3550                 exit(1);
3551
3552         exit(0);
3553 }
3554                 ]])],
3555                 [ user_path=`cat conftest.stdpath` ],
3556                 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3557                 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3558         )
3559 # make sure $bindir is in USER_PATH so scp will work
3560                 t_bindir=`eval echo ${bindir}`
3561                 case $t_bindir in
3562                         NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3563                 esac
3564                 case $t_bindir in
3565                         NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3566                 esac
3567                 echo $user_path | grep ":$t_bindir"  > /dev/null 2>&1
3568                 if test $? -ne 0  ; then
3569                         echo $user_path | grep "^$t_bindir"  > /dev/null 2>&1
3570                         if test $? -ne 0  ; then
3571                                 user_path=$user_path:$t_bindir
3572                                 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3573                         fi
3574                 fi
3575         fi ]
3576 )
3577 if test "x$external_path_file" != "x/etc/login.conf" ; then
3578         AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3579         AC_SUBST(user_path)
3580 fi
3581
3582 # Set superuser path separately to user path
3583 AC_ARG_WITH(superuser-path,
3584         [  --with-superuser-path=  Specify different path for super-user],
3585         [
3586                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3587                     test "x${withval}" != "xyes"; then
3588                         AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3589                                 [Define if you want a different $PATH
3590                                 for the superuser])
3591                         superuser_path=$withval
3592                 fi
3593         ]
3594 )
3595
3596
3597 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3598 IPV4_IN6_HACK_MSG="no"
3599 AC_ARG_WITH(4in6,
3600         [  --with-4in6             Check for and convert IPv4 in IPv6 mapped addresses],
3601         [
3602                 if test "x$withval" != "xno" ; then
3603                         AC_MSG_RESULT(yes)
3604                         AC_DEFINE(IPV4_IN_IPV6, 1,
3605                                 [Detect IPv4 in IPv6 mapped addresses
3606                                 and treat as IPv4])
3607                         IPV4_IN6_HACK_MSG="yes"
3608                 else
3609                         AC_MSG_RESULT(no)
3610                 fi
3611         ],[
3612                 if test "x$inet6_default_4in6" = "xyes"; then
3613                         AC_MSG_RESULT([yes (default)])
3614                         AC_DEFINE(IPV4_IN_IPV6)
3615                         IPV4_IN6_HACK_MSG="yes"
3616                 else
3617                         AC_MSG_RESULT([no (default)])
3618                 fi
3619         ]
3620 )
3621
3622 # Whether to enable BSD auth support
3623 BSD_AUTH_MSG=no
3624 AC_ARG_WITH(bsd-auth,
3625         [  --with-bsd-auth         Enable BSD auth support],
3626         [
3627                 if test "x$withval" != "xno" ; then
3628                         AC_DEFINE(BSD_AUTH, 1,
3629                                 [Define if you have BSD auth support])
3630                         BSD_AUTH_MSG=yes
3631                 fi
3632         ]
3633 )
3634
3635 # Where to place sshd.pid
3636 piddir=/var/run
3637 # make sure the directory exists
3638 if test ! -d $piddir ; then
3639         piddir=`eval echo ${sysconfdir}`
3640         case $piddir in
3641                 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3642         esac
3643 fi
3644
3645 AC_ARG_WITH(pid-dir,
3646         [  --with-pid-dir=PATH     Specify location of ssh.pid file],
3647         [
3648                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3649                     test "x${withval}" != "xyes"; then
3650                         piddir=$withval
3651                         if test ! -d $piddir ; then
3652                         AC_MSG_WARN([** no $piddir directory on this system **])
3653                         fi
3654                 fi
3655         ]
3656 )
3657
3658 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3659 AC_SUBST(piddir)
3660
3661 dnl allow user to disable some login recording features
3662 AC_ARG_ENABLE(lastlog,
3663         [  --disable-lastlog       disable use of lastlog even if detected [no]],
3664         [
3665                 if test "x$enableval" = "xno" ; then
3666                         AC_DEFINE(DISABLE_LASTLOG)
3667                 fi
3668         ]
3669 )
3670 AC_ARG_ENABLE(utmp,
3671         [  --disable-utmp          disable use of utmp even if detected [no]],
3672         [
3673                 if test "x$enableval" = "xno" ; then
3674                         AC_DEFINE(DISABLE_UTMP)
3675                 fi
3676         ]
3677 )
3678 AC_ARG_ENABLE(utmpx,
3679         [  --disable-utmpx         disable use of utmpx even if detected [no]],
3680         [
3681                 if test "x$enableval" = "xno" ; then
3682                         AC_DEFINE(DISABLE_UTMPX, 1,
3683                                 [Define if you don't want to use utmpx])
3684                 fi
3685         ]
3686 )
3687 AC_ARG_ENABLE(wtmp,
3688         [  --disable-wtmp          disable use of wtmp even if detected [no]],
3689         [
3690                 if test "x$enableval" = "xno" ; then
3691                         AC_DEFINE(DISABLE_WTMP)
3692                 fi
3693         ]
3694 )
3695 AC_ARG_ENABLE(wtmpx,
3696         [  --disable-wtmpx         disable use of wtmpx even if detected [no]],
3697         [
3698                 if test "x$enableval" = "xno" ; then
3699                         AC_DEFINE(DISABLE_WTMPX, 1,
3700                                 [Define if you don't want to use wtmpx])
3701                 fi
3702         ]
3703 )
3704 AC_ARG_ENABLE(libutil,
3705         [  --disable-libutil       disable use of libutil (login() etc.) [no]],
3706         [
3707                 if test "x$enableval" = "xno" ; then
3708                         AC_DEFINE(DISABLE_LOGIN)
3709                 fi
3710         ]
3711 )
3712 AC_ARG_ENABLE(pututline,
3713         [  --disable-pututline     disable use of pututline() etc. ([uw]tmp) [no]],
3714         [
3715                 if test "x$enableval" = "xno" ; then
3716                         AC_DEFINE(DISABLE_PUTUTLINE, 1,
3717                                 [Define if you don't want to use pututline()
3718                                 etc. to write [uw]tmp])
3719                 fi
3720         ]
3721 )
3722 AC_ARG_ENABLE(pututxline,
3723         [  --disable-pututxline    disable use of pututxline() etc. ([uw]tmpx) [no]],
3724         [
3725                 if test "x$enableval" = "xno" ; then
3726                         AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3727                                 [Define if you don't want to use pututxline()
3728                                 etc. to write [uw]tmpx])
3729                 fi
3730         ]
3731 )
3732 AC_ARG_WITH(lastlog,
3733   [  --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3734         [
3735                 if test "x$withval" = "xno" ; then
3736                         AC_DEFINE(DISABLE_LASTLOG)
3737                 elif test -n "$withval"  &&  test "x${withval}" != "xyes"; then
3738                         conf_lastlog_location=$withval
3739                 fi
3740         ]
3741 )
3742
3743 dnl lastlog, [uw]tmpx? detection
3744 dnl  NOTE: set the paths in the platform section to avoid the
3745 dnl   need for command-line parameters
3746 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3747
3748 dnl lastlog detection
3749 dnl  NOTE: the code itself will detect if lastlog is a directory
3750 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3751 AC_TRY_COMPILE([
3752 #include <sys/types.h>
3753 #include <utmp.h>
3754 #ifdef HAVE_LASTLOG_H
3755 #  include <lastlog.h>
3756 #endif
3757 #ifdef HAVE_PATHS_H
3758 #  include <paths.h>
3759 #endif
3760 #ifdef HAVE_LOGIN_H
3761 # include <login.h>
3762 #endif
3763         ],
3764         [ char *lastlog = LASTLOG_FILE; ],
3765         [ AC_MSG_RESULT(yes) ],
3766         [
3767                 AC_MSG_RESULT(no)
3768                 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3769                 AC_TRY_COMPILE([
3770 #include <sys/types.h>
3771 #include <utmp.h>
3772 #ifdef HAVE_LASTLOG_H
3773 #  include <lastlog.h>
3774 #endif
3775 #ifdef HAVE_PATHS_H
3776 #  include <paths.h>
3777 #endif
3778                 ],
3779                 [ char *lastlog = _PATH_LASTLOG; ],
3780                 [ AC_MSG_RESULT(yes) ],
3781                 [
3782                         AC_MSG_RESULT(no)
3783                         system_lastlog_path=no
3784                 ])
3785         ]
3786 )
3787
3788 if test -z "$conf_lastlog_location"; then
3789         if test x"$system_lastlog_path" = x"no" ; then
3790                 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3791                                 if (test -d "$f" || test -f "$f") ; then
3792                                         conf_lastlog_location=$f
3793                                 fi
3794                 done
3795                 if test -z "$conf_lastlog_location"; then
3796                         AC_MSG_WARN([** Cannot find lastlog **])
3797                         dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3798                 fi
3799         fi
3800 fi
3801
3802 if test -n "$conf_lastlog_location"; then
3803         AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3804                 [Define if you want to specify the path to your lastlog file])
3805 fi
3806
3807 dnl utmp detection
3808 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3809 AC_TRY_COMPILE([
3810 #include <sys/types.h>
3811 #include <utmp.h>
3812 #ifdef HAVE_PATHS_H
3813 #  include <paths.h>
3814 #endif
3815         ],
3816         [ char *utmp = UTMP_FILE; ],
3817         [ AC_MSG_RESULT(yes) ],
3818         [ AC_MSG_RESULT(no)
3819           system_utmp_path=no ]
3820 )
3821 if test -z "$conf_utmp_location"; then
3822         if test x"$system_utmp_path" = x"no" ; then
3823                 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3824                         if test -f $f ; then
3825                                 conf_utmp_location=$f
3826                         fi
3827                 done
3828                 if test -z "$conf_utmp_location"; then
3829                         AC_DEFINE(DISABLE_UTMP)
3830                 fi
3831         fi
3832 fi
3833 if test -n "$conf_utmp_location"; then
3834         AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3835                 [Define if you want to specify the path to your utmp file])
3836 fi
3837
3838 dnl wtmp detection
3839 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3840 AC_TRY_COMPILE([
3841 #include <sys/types.h>
3842 #include <utmp.h>
3843 #ifdef HAVE_PATHS_H
3844 #  include <paths.h>
3845 #endif
3846         ],
3847         [ char *wtmp = WTMP_FILE; ],
3848         [ AC_MSG_RESULT(yes) ],
3849         [ AC_MSG_RESULT(no)
3850           system_wtmp_path=no ]
3851 )
3852 if test -z "$conf_wtmp_location"; then
3853         if test x"$system_wtmp_path" = x"no" ; then
3854                 for f in /usr/adm/wtmp /var/log/wtmp; do
3855                         if test -f $f ; then
3856                                 conf_wtmp_location=$f
3857                         fi
3858                 done
3859                 if test -z "$conf_wtmp_location"; then
3860                         AC_DEFINE(DISABLE_WTMP)
3861                 fi
3862         fi
3863 fi
3864 if test -n "$conf_wtmp_location"; then
3865         AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3866                 [Define if you want to specify the path to your wtmp file])
3867 fi
3868
3869
3870 dnl utmpx detection - I don't know any system so perverse as to require
3871 dnl  utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3872 dnl  there, though.
3873 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3874 AC_TRY_COMPILE([
3875 #include <sys/types.h>
3876 #include <utmp.h>
3877 #ifdef HAVE_UTMPX_H
3878 #include <utmpx.h>
3879 #endif
3880 #ifdef HAVE_PATHS_H
3881 #  include <paths.h>
3882 #endif
3883         ],
3884         [ char *utmpx = UTMPX_FILE; ],
3885         [ AC_MSG_RESULT(yes) ],
3886         [ AC_MSG_RESULT(no)
3887           system_utmpx_path=no ]
3888 )
3889 if test -z "$conf_utmpx_location"; then
3890         if test x"$system_utmpx_path" = x"no" ; then
3891                 AC_DEFINE(DISABLE_UTMPX)
3892         fi
3893 else
3894         AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3895                 [Define if you want to specify the path to your utmpx file])
3896 fi
3897
3898 dnl wtmpx detection
3899 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3900 AC_TRY_COMPILE([
3901 #include <sys/types.h>
3902 #include <utmp.h>
3903 #ifdef HAVE_UTMPX_H
3904 #include <utmpx.h>
3905 #endif
3906 #ifdef HAVE_PATHS_H
3907 #  include <paths.h>
3908 #endif
3909         ],
3910         [ char *wtmpx = WTMPX_FILE; ],
3911         [ AC_MSG_RESULT(yes) ],
3912         [ AC_MSG_RESULT(no)
3913           system_wtmpx_path=no ]
3914 )
3915 if test -z "$conf_wtmpx_location"; then
3916         if test x"$system_wtmpx_path" = x"no" ; then
3917                 AC_DEFINE(DISABLE_WTMPX)
3918         fi
3919 else
3920         AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3921                 [Define if you want to specify the path to your wtmpx file])
3922 fi
3923
3924
3925 if test ! -z "$blibpath" ; then
3926         LDFLAGS="$LDFLAGS $blibflags$blibpath"
3927         AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3928 fi
3929
3930 dnl remove pam and dl because they are in $LIBPAM
3931 if test "$PAM_MSG" = yes ; then
3932         LIBS=`echo $LIBS | sed 's/-lpam //'`
3933 fi
3934 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3935         LIBS=`echo $LIBS | sed 's/-ldl //'`
3936 fi
3937
3938 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3939 dnl Add now.
3940 CFLAGS="$CFLAGS $werror_flags"
3941
3942 AC_EXEEXT
3943 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3944         scard/Makefile ssh_prng_cmds survey.sh])
3945 AC_OUTPUT
3946
3947 # Print summary of options
3948
3949 # Someone please show me a better way :)
3950 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3951 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3952 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3953 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3954 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3955 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3956 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3957 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3958 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3959 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3960
3961 echo ""
3962 echo "OpenSSH has been configured with the following options:"
3963 echo "                     User binaries: $B"
3964 echo "                   System binaries: $C"
3965 echo "               Configuration files: $D"
3966 echo "                   Askpass program: $E"
3967 echo "                      Manual pages: $F"
3968 echo "                          PID file: $G"
3969 echo "  Privilege separation chroot path: $H"
3970 if test "x$external_path_file" = "x/etc/login.conf" ; then
3971 echo "   At runtime, sshd will use the path defined in $external_path_file"
3972 echo "   Make sure the path to scp is present, otherwise scp will not work"
3973 else
3974 echo "            sshd default user PATH: $I"
3975         if test ! -z "$external_path_file"; then
3976 echo "   (If PATH is set in $external_path_file it will be used instead. If"
3977 echo "   used, ensure the path to scp is present, otherwise scp will not work.)"
3978         fi
3979 fi
3980 if test ! -z "$superuser_path" ; then
3981 echo "          sshd superuser user PATH: $J"
3982 fi
3983 echo "                    Manpage format: $MANTYPE"
3984 echo "                       PAM support: $PAM_MSG"
3985 echo "                 KerberosV support: $KRB5_MSG"
3986 echo "                 Smartcard support: $SCARD_MSG"
3987 echo "                     S/KEY support: $SKEY_MSG"
3988 echo "              TCP Wrappers support: $TCPW_MSG"
3989 echo "              MD5 password support: $MD5_MSG"
3990 echo "                   libedit support: $LIBEDIT_MSG"
3991 echo "       IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3992 echo "           Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3993 echo "                  BSD Auth support: $BSD_AUTH_MSG"
3994 echo "              Random number source: $RAND_MSG"
3995 if test ! -z "$USE_RAND_HELPER" ; then
3996 echo "     ssh-rand-helper collects from: $RAND_HELPER_MSG"
3997 fi
3998
3999 echo ""
4000
4001 echo "              Host: ${host}"
4002 echo "          Compiler: ${CC}"
4003 echo "    Compiler flags: ${CFLAGS}"
4004 echo "Preprocessor flags: ${CPPFLAGS}"
4005 echo "      Linker flags: ${LDFLAGS}"
4006 echo "         Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
4007
4008 echo ""
4009
4010 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4011         echo "SVR4 style packages are supported with \"make package\""
4012         echo ""
4013 fi
4014
4015 if test "x$PAM_MSG" = "xyes" ; then
4016         echo "PAM is enabled. You may need to install a PAM control file "
4017         echo "for sshd, otherwise password authentication may fail. "
4018         echo "Example PAM control files can be found in the contrib/ "
4019         echo "subdirectory"
4020         echo ""
4021 fi
4022
4023 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4024         echo "WARNING: you are using the builtin random number collection "
4025         echo "service. Please read WARNING.RNG and request that your OS "
4026         echo "vendor includes kernel-based random number collection in "
4027         echo "future versions of your OS."
4028         echo ""
4029 fi
4030
4031 if test ! -z "$NO_PEERCHECK" ; then
4032         echo "WARNING: the operating system that you are using does not "
4033         echo "appear to support either the getpeereid() API nor the "
4034         echo "SO_PEERCRED getsockopt() option. These facilities are used to "
4035         echo "enforce security checks to prevent unauthorised connections to "
4036         echo "ssh-agent. Their absence increases the risk that a malicious "
4037         echo "user can connect to your agent. "
4038         echo ""
4039 fi
4040
4041 if test "$AUDIT_MODULE" = "bsm" ; then
4042         echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4043         echo "See the Solaris section in README.platform for details."
4044 fi
This page took 0.524233 seconds and 5 git commands to generate.