]> andersk Git - gssapi-openssh.git/blob - openssh/configure.ac
3c9da33491d9d6f8bd5128f96c1e8226fc784eeb
[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     AC_CHECK_FUNCS(globus_gss_assist_map_and_authorize)
1115         INSTALL_GSISSH="yes"
1116 else
1117         INSTALL_GSISSH=""
1118 fi
1119 AC_SUBST(INSTALL_GSISSH)
1120 # End Globus/GSI section
1121
1122 AC_MSG_CHECKING([for /proc/pid/fd directory])
1123 if test -d "/proc/$$/fd" ; then
1124         AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1125         AC_MSG_RESULT(yes)
1126 else
1127         AC_MSG_RESULT(no)
1128 fi
1129
1130 # Check whether user wants S/Key support
1131 SKEY_MSG="no"
1132 AC_ARG_WITH(skey,
1133         [  --with-skey[[=PATH]]      Enable S/Key support (optionally in PATH)],
1134         [
1135                 if test "x$withval" != "xno" ; then
1136
1137                         if test "x$withval" != "xyes" ; then
1138                                 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1139                                 LDFLAGS="$LDFLAGS -L${withval}/lib"
1140                         fi
1141
1142                         AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1143                         LIBS="-lskey $LIBS"
1144                         SKEY_MSG="yes"
1145
1146                         AC_MSG_CHECKING([for s/key support])
1147                         AC_LINK_IFELSE(
1148                                 [AC_LANG_SOURCE([[
1149 #include <stdio.h>
1150 #include <skey.h>
1151 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1152                                 ]])],
1153                                 [AC_MSG_RESULT(yes)],
1154                                 [
1155                                         AC_MSG_RESULT(no)
1156                                         AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1157                                 ])
1158                         AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1159                         AC_TRY_COMPILE(
1160                                 [#include <stdio.h>
1161                                  #include <skey.h>],
1162                                 [(void)skeychallenge(NULL,"name","",0);],
1163                                 [AC_MSG_RESULT(yes)
1164                                  AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1165                                         [Define if your skeychallenge()
1166                                         function takes 4 arguments (NetBSD)])],
1167                                 [AC_MSG_RESULT(no)]
1168                         )
1169                 fi
1170         ]
1171 )
1172
1173 # Check whether user wants TCP wrappers support
1174 TCPW_MSG="no"
1175 AC_ARG_WITH(tcp-wrappers,
1176         [  --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1177         [
1178                 if test "x$withval" != "xno" ; then
1179                         saved_LIBS="$LIBS"
1180                         saved_LDFLAGS="$LDFLAGS"
1181                         saved_CPPFLAGS="$CPPFLAGS"
1182                         if test -n "${withval}" && \
1183                             test "x${withval}" != "xyes"; then
1184                                 if test -d "${withval}/lib"; then
1185                                         if test -n "${need_dash_r}"; then
1186                                                 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1187                                         else
1188                                                 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1189                                         fi
1190                                 else
1191                                         if test -n "${need_dash_r}"; then
1192                                                 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1193                                         else
1194                                                 LDFLAGS="-L${withval} ${LDFLAGS}"
1195                                         fi
1196                                 fi
1197                                 if test -d "${withval}/include"; then
1198                                         CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1199                                 else
1200                                         CPPFLAGS="-I${withval} ${CPPFLAGS}"
1201                                 fi
1202                         fi
1203                         LIBWRAP="-lwrap"
1204                         LIBS="$LIBWRAP $LIBS"
1205                         AC_MSG_CHECKING(for libwrap)
1206                         AC_TRY_LINK(
1207                                 [
1208 #include <sys/types.h>
1209 #include <sys/socket.h>
1210 #include <netinet/in.h>
1211 #include <tcpd.h>
1212                                         int deny_severity = 0, allow_severity = 0;
1213                                 ],
1214                                 [hosts_access(0);],
1215                                 [
1216                                         AC_MSG_RESULT(yes)
1217                                         AC_DEFINE(LIBWRAP, 1,
1218                                                 [Define if you want
1219                                                 TCP Wrappers support])
1220                                         AC_SUBST(LIBWRAP)
1221                                         TCPW_MSG="yes"
1222                                 ],
1223                                 [
1224                                         AC_MSG_ERROR([*** libwrap missing])
1225                                 ]
1226                         )
1227                         LIBS="$saved_LIBS"
1228                 fi
1229         ]
1230 )
1231
1232 # Check whether user wants libedit support
1233 LIBEDIT_MSG="no"
1234 AC_ARG_WITH(libedit,
1235         [  --with-libedit[[=PATH]]   Enable libedit support for sftp],
1236         [ if test "x$withval" != "xno" ; then
1237                 if test "x$withval" != "xyes"; then
1238                         CPPFLAGS="$CPPFLAGS -I${withval}/include"
1239                         if test -n "${need_dash_r}"; then
1240                                 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1241                         else
1242                                 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1243                         fi
1244                 fi
1245                 AC_CHECK_LIB(edit, el_init,
1246                         [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1247                           LIBEDIT="-ledit -lcurses"
1248                           LIBEDIT_MSG="yes"
1249                           AC_SUBST(LIBEDIT)
1250                         ],
1251                         [ AC_MSG_ERROR(libedit not found) ],
1252                         [ -lcurses ]
1253                 )
1254                 AC_MSG_CHECKING(if libedit version is compatible)
1255                 AC_COMPILE_IFELSE(
1256                     [AC_LANG_SOURCE([[
1257 #include <histedit.h>
1258 int main(void)
1259 {
1260         int i = H_SETSIZE;
1261         el_init("", NULL, NULL, NULL);
1262         exit(0);
1263 }
1264                     ]])],
1265                     [ AC_MSG_RESULT(yes) ],
1266                     [ AC_MSG_RESULT(no)
1267                       AC_MSG_ERROR(libedit version is not compatible) ]
1268                 )
1269         fi ]
1270 )
1271
1272 AUDIT_MODULE=none
1273 AC_ARG_WITH(audit,
1274         [  --with-audit=module     Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1275         [
1276           AC_MSG_CHECKING(for supported audit module)
1277           case "$withval" in
1278           bsm)
1279                 AC_MSG_RESULT(bsm)
1280                 AUDIT_MODULE=bsm
1281                 dnl    Checks for headers, libs and functions
1282                 AC_CHECK_HEADERS(bsm/audit.h, [],
1283                     [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1284                 AC_CHECK_LIB(bsm, getaudit, [],
1285                     [AC_MSG_ERROR(BSM enabled and required library not found)])
1286                 AC_CHECK_FUNCS(getaudit, [],
1287                     [AC_MSG_ERROR(BSM enabled and required function not found)])
1288                 # These are optional
1289                 AC_CHECK_FUNCS(getaudit_addr)
1290                 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1291                 ;;
1292           debug)
1293                 AUDIT_MODULE=debug
1294                 AC_MSG_RESULT(debug)
1295                 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1296                 ;;
1297           no)
1298                 AC_MSG_RESULT(no)
1299                 ;;
1300           *)
1301                 AC_MSG_ERROR([Unknown audit module $withval])
1302                 ;;
1303         esac ]
1304 )
1305
1306 dnl    Checks for library functions. Please keep in alphabetical order
1307 AC_CHECK_FUNCS( \
1308         arc4random \
1309         asprintf \
1310         b64_ntop \
1311         __b64_ntop \
1312         b64_pton \
1313         __b64_pton \
1314         bcopy \
1315         bindresvport_sa \
1316         clock \
1317         closefrom \
1318         dirfd \
1319         fchmod \
1320         fchown \
1321         freeaddrinfo \
1322         futimes \
1323         getaddrinfo \
1324         getcwd \
1325         getgrouplist \
1326         getnameinfo \
1327         getopt \
1328         getpeereid \
1329         _getpty \
1330         getrlimit \
1331         getttyent \
1332         glob \
1333         inet_aton \
1334         inet_ntoa \
1335         inet_ntop \
1336         innetgr \
1337         login_getcapbool \
1338         md5_crypt \
1339         memmove \
1340         mkdtemp \
1341         mmap \
1342         ngetaddrinfo \
1343         nsleep \
1344         ogetaddrinfo \
1345         openlog_r \
1346         openpty \
1347         prctl \
1348         pstat \
1349         readpassphrase \
1350         realpath \
1351         recvmsg \
1352         rresvport_af \
1353         sendmsg \
1354         setdtablesize \
1355         setegid \
1356         setenv \
1357         seteuid \
1358         setgroups \
1359         setlogin \
1360         setpcred \
1361         setproctitle \
1362         setregid \
1363         setreuid \
1364         setrlimit \
1365         setsid \
1366         setvbuf \
1367         sigaction \
1368         sigvec \
1369         snprintf \
1370         socketpair \
1371         strdup \
1372         strerror \
1373         strlcat \
1374         strlcpy \
1375         strmode \
1376         strnvis \
1377         strtonum \
1378         strtoll \
1379         strtoul \
1380         sysconf \
1381         tcgetpgrp \
1382         truncate \
1383         unsetenv \
1384         updwtmpx \
1385         vasprintf \
1386         vhangup \
1387         vsnprintf \
1388         waitpid \
1389 )
1390
1391 # IRIX has a const char return value for gai_strerror()
1392 AC_CHECK_FUNCS(gai_strerror,[
1393         AC_DEFINE(HAVE_GAI_STRERROR)
1394         AC_TRY_COMPILE([
1395 #include <sys/types.h>
1396 #include <sys/socket.h>
1397 #include <netdb.h>
1398
1399 const char *gai_strerror(int);],[
1400 char *str;
1401
1402 str = gai_strerror(0);],[
1403                 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1404                 [Define if gai_strerror() returns const char *])])])
1405
1406 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1407         [Some systems put nanosleep outside of libc]))
1408
1409 dnl Make sure prototypes are defined for these before using them.
1410 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1411 AC_CHECK_DECL(strsep,
1412         [AC_CHECK_FUNCS(strsep)],
1413         [],
1414         [
1415 #ifdef HAVE_STRING_H
1416 # include <string.h>
1417 #endif
1418         ])
1419
1420 dnl tcsendbreak might be a macro
1421 AC_CHECK_DECL(tcsendbreak,
1422         [AC_DEFINE(HAVE_TCSENDBREAK)],
1423         [AC_CHECK_FUNCS(tcsendbreak)],
1424         [#include <termios.h>]
1425 )
1426
1427 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1428
1429 AC_CHECK_FUNCS(setresuid, [
1430         dnl Some platorms have setresuid that isn't implemented, test for this
1431         AC_MSG_CHECKING(if setresuid seems to work)
1432         AC_RUN_IFELSE(
1433                 [AC_LANG_SOURCE([[
1434 #include <stdlib.h>
1435 #include <errno.h>
1436 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1437                 ]])],
1438                 [AC_MSG_RESULT(yes)],
1439                 [AC_DEFINE(BROKEN_SETRESUID, 1,
1440                         [Define if your setresuid() is broken])
1441                  AC_MSG_RESULT(not implemented)],
1442                 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1443         )
1444 ])
1445
1446 AC_CHECK_FUNCS(setresgid, [
1447         dnl Some platorms have setresgid that isn't implemented, test for this
1448         AC_MSG_CHECKING(if setresgid seems to work)
1449         AC_RUN_IFELSE(
1450                 [AC_LANG_SOURCE([[
1451 #include <stdlib.h>
1452 #include <errno.h>
1453 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1454                 ]])],
1455                 [AC_MSG_RESULT(yes)],
1456                 [AC_DEFINE(BROKEN_SETRESGID, 1,
1457                         [Define if your setresgid() is broken])
1458                  AC_MSG_RESULT(not implemented)],
1459                 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1460         )
1461 ])
1462
1463 dnl    Checks for time functions
1464 AC_CHECK_FUNCS(gettimeofday time)
1465 dnl    Checks for utmp functions
1466 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1467 AC_CHECK_FUNCS(utmpname)
1468 dnl    Checks for utmpx functions
1469 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1470 AC_CHECK_FUNCS(setutxent utmpxname)
1471
1472 AC_CHECK_FUNC(daemon,
1473         [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1474         [AC_CHECK_LIB(bsd, daemon,
1475                 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1476 )
1477
1478 AC_CHECK_FUNC(getpagesize,
1479         [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1480                 [Define if your libraries define getpagesize()])],
1481         [AC_CHECK_LIB(ucb, getpagesize,
1482                 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1483 )
1484
1485 # Check for broken snprintf
1486 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1487         AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1488         AC_RUN_IFELSE(
1489                 [AC_LANG_SOURCE([[
1490 #include <stdio.h>
1491 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1492                 ]])],
1493                 [AC_MSG_RESULT(yes)],
1494                 [
1495                         AC_MSG_RESULT(no)
1496                         AC_DEFINE(BROKEN_SNPRINTF, 1,
1497                                 [Define if your snprintf is busted])
1498                         AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1499                 ],
1500                 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1501         )
1502 fi
1503
1504 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1505 # returning the right thing on overflow: the number of characters it tried to
1506 # create (as per SUSv3)
1507 if test "x$ac_cv_func_asprintf" != "xyes" && \
1508    test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1509         AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1510         AC_RUN_IFELSE(
1511                 [AC_LANG_SOURCE([[
1512 #include <sys/types.h>
1513 #include <stdio.h>
1514 #include <stdarg.h>
1515
1516 int x_snprintf(char *str,size_t count,const char *fmt,...)
1517 {
1518         size_t ret; va_list ap;
1519         va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1520         return ret;
1521 }
1522 int main(void)
1523 {
1524         char x[1];
1525         exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1526 } ]])],
1527                 [AC_MSG_RESULT(yes)],
1528                 [
1529                         AC_MSG_RESULT(no)
1530                         AC_DEFINE(BROKEN_SNPRINTF, 1,
1531                                 [Define if your snprintf is busted])
1532                         AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1533                 ],
1534                 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1535         )
1536 fi
1537
1538 # On systems where [v]snprintf is broken, but is declared in stdio,
1539 # check that the fmt argument is const char * or just char *.
1540 # This is only useful for when BROKEN_SNPRINTF
1541 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1542 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1543            int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1544            int main(void) { snprintf(0, 0, 0); } 
1545     ]])],
1546    [AC_MSG_RESULT(yes)
1547     AC_DEFINE(SNPRINTF_CONST, [const],
1548               [Define as const if snprintf() can declare const char *fmt])],
1549    [AC_MSG_RESULT(no)
1550     AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1551
1552 # Check for missing getpeereid (or equiv) support
1553 NO_PEERCHECK=""
1554 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1555         AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1556         AC_TRY_COMPILE(
1557                 [#include <sys/types.h>
1558                  #include <sys/socket.h>],
1559                 [int i = SO_PEERCRED;],
1560                 [ AC_MSG_RESULT(yes)
1561                   AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1562                 ],
1563                 [AC_MSG_RESULT(no)
1564                 NO_PEERCHECK=1]
1565         )
1566 fi
1567
1568 dnl see whether mkstemp() requires XXXXXX
1569 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1570 AC_MSG_CHECKING([for (overly) strict mkstemp])
1571 AC_RUN_IFELSE(
1572         [AC_LANG_SOURCE([[
1573 #include <stdlib.h>
1574 main() { char template[]="conftest.mkstemp-test";
1575 if (mkstemp(template) == -1)
1576         exit(1);
1577 unlink(template); exit(0);
1578 }
1579         ]])],
1580         [
1581                 AC_MSG_RESULT(no)
1582         ],
1583         [
1584                 AC_MSG_RESULT(yes)
1585                 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1586         ],
1587         [
1588                 AC_MSG_RESULT(yes)
1589                 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1590         ]
1591 )
1592 fi
1593
1594 dnl make sure that openpty does not reacquire controlling terminal
1595 if test ! -z "$check_for_openpty_ctty_bug"; then
1596         AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1597         AC_RUN_IFELSE(
1598                 [AC_LANG_SOURCE([[
1599 #include <stdio.h>
1600 #include <sys/fcntl.h>
1601 #include <sys/types.h>
1602 #include <sys/wait.h>
1603
1604 int
1605 main()
1606 {
1607         pid_t pid;
1608         int fd, ptyfd, ttyfd, status;
1609
1610         pid = fork();
1611         if (pid < 0) {          /* failed */
1612                 exit(1);
1613         } else if (pid > 0) {   /* parent */
1614                 waitpid(pid, &status, 0);
1615                 if (WIFEXITED(status))
1616                         exit(WEXITSTATUS(status));
1617                 else
1618                         exit(2);
1619         } else {                /* child */
1620                 close(0); close(1); close(2);
1621                 setsid();
1622                 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1623                 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1624                 if (fd >= 0)
1625                         exit(3);        /* Acquired ctty: broken */
1626                 else
1627                         exit(0);        /* Did not acquire ctty: OK */
1628         }
1629 }
1630                 ]])],
1631                 [
1632                         AC_MSG_RESULT(yes)
1633                 ],
1634                 [
1635                         AC_MSG_RESULT(no)
1636                         AC_DEFINE(SSHD_ACQUIRES_CTTY)
1637                 ],
1638                 [
1639                         AC_MSG_RESULT(cross-compiling, assuming yes)
1640                 ]
1641         )
1642 fi
1643
1644 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1645     test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1646         AC_MSG_CHECKING(if getaddrinfo seems to work)
1647         AC_RUN_IFELSE(
1648                 [AC_LANG_SOURCE([[
1649 #include <stdio.h>
1650 #include <sys/socket.h>
1651 #include <netdb.h>
1652 #include <errno.h>
1653 #include <netinet/in.h>
1654
1655 #define TEST_PORT "2222"
1656
1657 int
1658 main(void)
1659 {
1660         int err, sock;
1661         struct addrinfo *gai_ai, *ai, hints;
1662         char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1663
1664         memset(&hints, 0, sizeof(hints));
1665         hints.ai_family = PF_UNSPEC;
1666         hints.ai_socktype = SOCK_STREAM;
1667         hints.ai_flags = AI_PASSIVE;
1668
1669         err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1670         if (err != 0) {
1671                 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1672                 exit(1);
1673         }
1674
1675         for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1676                 if (ai->ai_family != AF_INET6)
1677                         continue;
1678
1679                 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1680                     sizeof(ntop), strport, sizeof(strport),
1681                     NI_NUMERICHOST|NI_NUMERICSERV);
1682
1683                 if (err != 0) {
1684                         if (err == EAI_SYSTEM)
1685                                 perror("getnameinfo EAI_SYSTEM");
1686                         else
1687                                 fprintf(stderr, "getnameinfo failed: %s\n",
1688                                     gai_strerror(err));
1689                         exit(2);
1690                 }
1691
1692                 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1693                 if (sock < 0)
1694                         perror("socket");
1695                 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1696                         if (errno == EBADF)
1697                                 exit(3);
1698                 }
1699         }
1700         exit(0);
1701 }
1702                 ]])],
1703                 [
1704                         AC_MSG_RESULT(yes)
1705                 ],
1706                 [
1707                         AC_MSG_RESULT(no)
1708                         AC_DEFINE(BROKEN_GETADDRINFO)
1709                 ],
1710                 [
1711                         AC_MSG_RESULT(cross-compiling, assuming yes)
1712                 ]
1713         )
1714 fi
1715
1716 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1717     test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1718         AC_MSG_CHECKING(if getaddrinfo seems to work)
1719         AC_RUN_IFELSE(
1720                 [AC_LANG_SOURCE([[
1721 #include <stdio.h>
1722 #include <sys/socket.h>
1723 #include <netdb.h>
1724 #include <errno.h>
1725 #include <netinet/in.h>
1726
1727 #define TEST_PORT "2222"
1728
1729 int
1730 main(void)
1731 {
1732         int err, sock;
1733         struct addrinfo *gai_ai, *ai, hints;
1734         char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1735
1736         memset(&hints, 0, sizeof(hints));
1737         hints.ai_family = PF_UNSPEC;
1738         hints.ai_socktype = SOCK_STREAM;
1739         hints.ai_flags = AI_PASSIVE;
1740
1741         err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1742         if (err != 0) {
1743                 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1744                 exit(1);
1745         }
1746
1747         for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1748                 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1749                         continue;
1750
1751                 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1752                     sizeof(ntop), strport, sizeof(strport),
1753                     NI_NUMERICHOST|NI_NUMERICSERV);
1754
1755                 if (ai->ai_family == AF_INET && err != 0) {
1756                         perror("getnameinfo");
1757                         exit(2);
1758                 }
1759         }
1760         exit(0);
1761 }
1762                 ]])],
1763                 [
1764                         AC_MSG_RESULT(yes)
1765                         AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1766                                 [Define if you have a getaddrinfo that fails
1767                                 for the all-zeros IPv6 address])
1768                 ],
1769                 [
1770                         AC_MSG_RESULT(no)
1771                         AC_DEFINE(BROKEN_GETADDRINFO)
1772                 ],
1773                         AC_MSG_RESULT(cross-compiling, assuming no)
1774                 ]
1775         )
1776 fi
1777
1778 if test "x$check_for_conflicting_getspnam" = "x1"; then
1779         AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1780         AC_COMPILE_IFELSE(
1781                 [
1782 #include <shadow.h>
1783 int main(void) {exit(0);}
1784                 ],
1785                 [
1786                         AC_MSG_RESULT(no)
1787                 ],
1788                 [
1789                         AC_MSG_RESULT(yes)
1790                         AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1791                             [Conflicting defs for getspnam])
1792                 ]
1793         )
1794 fi
1795
1796 AC_FUNC_GETPGRP
1797
1798 # Check for PAM libs
1799 PAM_MSG="no"
1800 AC_ARG_WITH(pam,
1801         [  --with-pam              Enable PAM support ],
1802         [
1803                 if test "x$withval" != "xno" ; then
1804                         if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1805                            test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1806                                 AC_MSG_ERROR([PAM headers not found])
1807                         fi
1808
1809                         AC_CHECK_LIB(dl, dlopen, , )
1810                         AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1811                         AC_CHECK_FUNCS(pam_getenvlist)
1812                         AC_CHECK_FUNCS(pam_putenv)
1813
1814                         PAM_MSG="yes"
1815
1816                         AC_DEFINE(USE_PAM, 1,
1817                                 [Define if you want to enable PAM support])
1818                         if test $ac_cv_lib_dl_dlopen = yes; then
1819                                 LIBPAM="-lpam -ldl"
1820                         else
1821                                 LIBPAM="-lpam"
1822                         fi
1823                         AC_SUBST(LIBPAM)
1824                 fi
1825         ]
1826 )
1827
1828 # Check for older PAM
1829 if test "x$PAM_MSG" = "xyes" ; then
1830         # Check PAM strerror arguments (old PAM)
1831         AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1832         AC_TRY_COMPILE(
1833                 [
1834 #include <stdlib.h>
1835 #if defined(HAVE_SECURITY_PAM_APPL_H)
1836 #include <security/pam_appl.h>
1837 #elif defined (HAVE_PAM_PAM_APPL_H)
1838 #include <pam/pam_appl.h>
1839 #endif
1840                 ],
1841                 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1842                 [AC_MSG_RESULT(no)],
1843                 [
1844                         AC_DEFINE(HAVE_OLD_PAM, 1,
1845                                 [Define if you have an old version of PAM
1846                                 which takes only one argument to pam_strerror])
1847                         AC_MSG_RESULT(yes)
1848                         PAM_MSG="yes (old library)"
1849                 ]
1850         )
1851 fi
1852
1853 # Search for OpenSSL
1854 saved_CPPFLAGS="$CPPFLAGS"
1855 saved_LDFLAGS="$LDFLAGS"
1856 AC_ARG_WITH(ssl-dir,
1857         [  --with-ssl-dir=PATH     Specify path to OpenSSL installation ],
1858         [
1859                 if test "x$withval" != "xno" ; then
1860                         case "$withval" in
1861                                 # Relative paths
1862                                 ./*|../*)       withval="`pwd`/$withval"
1863                         esac
1864                         if test -d "$withval/lib"; then
1865                                 if test -n "${need_dash_r}"; then
1866                                         LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1867                                 else
1868                                         LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1869                                 fi
1870                         else
1871                                 if test -n "${need_dash_r}"; then
1872                                         LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1873                                 else
1874                                         LDFLAGS="-L${withval} ${LDFLAGS}"
1875                                 fi
1876                         fi
1877                         if test -d "$withval/include"; then
1878                                 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1879                         else
1880                                 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1881                         fi
1882                 fi
1883         ]
1884 )
1885 if test -z "$GSI_LIBS" ; then
1886 LIBS="-lcrypto $LIBS"
1887 fi
1888 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1889         [Define if your ssl headers are included
1890         with #include <openssl/header.h>]),
1891         [
1892                 dnl Check default openssl install dir
1893                 if test -n "${need_dash_r}"; then
1894                         LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1895                 else
1896                         LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1897                 fi
1898                 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1899                 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1900                         [
1901                                 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1902                         ]
1903                 )
1904         ]
1905 )
1906
1907 # Determine OpenSSL header version
1908 AC_MSG_CHECKING([OpenSSL header version])
1909 AC_RUN_IFELSE(
1910         [AC_LANG_SOURCE([[
1911 #include <stdio.h>
1912 #include <string.h>
1913 #include <openssl/opensslv.h>
1914 #define DATA "conftest.sslincver"
1915 int main(void) {
1916         FILE *fd;
1917         int rc;
1918
1919         fd = fopen(DATA,"w");
1920         if(fd == NULL)
1921                 exit(1);
1922
1923         if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1924                 exit(1);
1925
1926         exit(0);
1927 }
1928         ]])],
1929         [
1930                 ssl_header_ver=`cat conftest.sslincver`
1931                 AC_MSG_RESULT($ssl_header_ver)
1932         ],
1933         [
1934                 AC_MSG_RESULT(not found)
1935                 AC_MSG_ERROR(OpenSSL version header not found.)
1936         ],
1937         [
1938                 AC_MSG_WARN([cross compiling: not checking])
1939         ]
1940 )
1941
1942 # Determine OpenSSL library version
1943 AC_MSG_CHECKING([OpenSSL library version])
1944 AC_RUN_IFELSE(
1945         [AC_LANG_SOURCE([[
1946 #include <stdio.h>
1947 #include <string.h>
1948 #include <openssl/opensslv.h>
1949 #include <openssl/crypto.h>
1950 #define DATA "conftest.ssllibver"
1951 int main(void) {
1952         FILE *fd;
1953         int rc;
1954
1955         fd = fopen(DATA,"w");
1956         if(fd == NULL)
1957                 exit(1);
1958
1959         if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1960                 exit(1);
1961
1962         exit(0);
1963 }
1964         ]])],
1965         [
1966                 ssl_library_ver=`cat conftest.ssllibver`
1967                 AC_MSG_RESULT($ssl_library_ver)
1968         ],
1969         [
1970                 AC_MSG_RESULT(not found)
1971                 AC_MSG_ERROR(OpenSSL library not found.)
1972         ],
1973         [
1974                 AC_MSG_WARN([cross compiling: not checking])
1975         ]
1976 )
1977
1978 # Sanity check OpenSSL headers
1979 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1980 AC_RUN_IFELSE(
1981         [AC_LANG_SOURCE([[
1982 #include <string.h>
1983 #include <openssl/opensslv.h>
1984 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1985         ]])],
1986         [
1987                 AC_MSG_RESULT(yes)
1988         ],
1989         [
1990                 AC_MSG_RESULT(no)
1991                 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1992 Check config.log for details.
1993 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1994         ],
1995         [
1996                 AC_MSG_WARN([cross compiling: not checking])
1997         ]
1998 )
1999
2000 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2001 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2002 AC_COMPILE_IFELSE(
2003         [AC_LANG_SOURCE([[
2004 #include <string.h>
2005 #include <openssl/evp.h>
2006 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2007         ]])],
2008         [
2009                 AC_MSG_RESULT(no)
2010         ],
2011         [
2012                 AC_MSG_RESULT(yes)
2013                 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2014                     [libcrypto is missing AES 192 and 256 bit functions])
2015         ]
2016 )
2017
2018 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2019 # because the system crypt() is more featureful.
2020 if test "x$check_for_libcrypt_before" = "x1"; then
2021         AC_CHECK_LIB(crypt, crypt)
2022 fi
2023
2024 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2025 # version in OpenSSL.
2026 if test "x$check_for_libcrypt_later" = "x1"; then
2027         AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2028 fi
2029
2030 AC_CHECK_LIB(iaf, ia_openinfo)
2031
2032 ### Configure cryptographic random number support
2033
2034 # Check wheter OpenSSL seeds itself
2035 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2036 AC_RUN_IFELSE(
2037         [AC_LANG_SOURCE([[
2038 #include <string.h>
2039 #include <openssl/rand.h>
2040 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2041         ]])],
2042         [
2043                 OPENSSL_SEEDS_ITSELF=yes
2044                 AC_MSG_RESULT(yes)
2045         ],
2046         [
2047                 AC_MSG_RESULT(no)
2048                 # Default to use of the rand helper if OpenSSL doesn't
2049                 # seed itself
2050                 USE_RAND_HELPER=yes
2051         ],
2052         [
2053                 AC_MSG_WARN([cross compiling: assuming yes])
2054                 # This is safe, since all recent OpenSSL versions will
2055                 # complain at runtime if not seeded correctly.
2056                 OPENSSL_SEEDS_ITSELF=yes
2057         ]
2058 )
2059
2060
2061 # Do we want to force the use of the rand helper?
2062 AC_ARG_WITH(rand-helper,
2063         [  --with-rand-helper      Use subprocess to gather strong randomness ],
2064         [
2065                 if test "x$withval" = "xno" ; then
2066                         # Force use of OpenSSL's internal RNG, even if
2067                         # the previous test showed it to be unseeded.
2068                         if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2069                                 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2070                                 OPENSSL_SEEDS_ITSELF=yes
2071                                 USE_RAND_HELPER=""
2072                         fi
2073                 else
2074                         USE_RAND_HELPER=yes
2075                 fi
2076         ],
2077 )
2078
2079 # Which randomness source do we use?
2080 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2081         # OpenSSL only
2082         AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2083                 [Define if you want OpenSSL's internally seeded PRNG only])
2084         RAND_MSG="OpenSSL internal ONLY"
2085         INSTALL_SSH_RAND_HELPER=""
2086 elif test ! -z "$USE_RAND_HELPER" ; then
2087         # install rand helper
2088         RAND_MSG="ssh-rand-helper"
2089         INSTALL_SSH_RAND_HELPER="yes"
2090 fi
2091 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2092
2093 ### Configuration of ssh-rand-helper
2094
2095 # PRNGD TCP socket
2096 AC_ARG_WITH(prngd-port,
2097         [  --with-prngd-port=PORT  read entropy from PRNGD/EGD TCP localhost:PORT],
2098         [
2099                 case "$withval" in
2100                 no)
2101                         withval=""
2102                         ;;
2103                 [[0-9]]*)
2104                         ;;
2105                 *)
2106                         AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2107                         ;;
2108                 esac
2109                 if test ! -z "$withval" ; then
2110                         PRNGD_PORT="$withval"
2111                         AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2112                                 [Port number of PRNGD/EGD random number socket])
2113                 fi
2114         ]
2115 )
2116
2117 # PRNGD Unix domain socket
2118 AC_ARG_WITH(prngd-socket,
2119         [  --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2120         [
2121                 case "$withval" in
2122                 yes)
2123                         withval="/var/run/egd-pool"
2124                         ;;
2125                 no)
2126                         withval=""
2127                         ;;
2128                 /*)
2129                         ;;
2130                 *)
2131                         AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2132                         ;;
2133                 esac
2134
2135                 if test ! -z "$withval" ; then
2136                         if test ! -z "$PRNGD_PORT" ; then
2137                                 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2138                         fi
2139                         if test ! -r "$withval" ; then
2140                                 AC_MSG_WARN(Entropy socket is not readable)
2141                         fi
2142                         PRNGD_SOCKET="$withval"
2143                         AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2144                                 [Location of PRNGD/EGD random number socket])
2145                 fi
2146         ],
2147         [
2148                 # Check for existing socket only if we don't have a random device already
2149                 if test "$USE_RAND_HELPER" = yes ; then
2150                         AC_MSG_CHECKING(for PRNGD/EGD socket)
2151                         # Insert other locations here
2152                         for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2153                                 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2154                                         PRNGD_SOCKET="$sock"
2155                                         AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2156                                         break;
2157                                 fi
2158                         done
2159                         if test ! -z "$PRNGD_SOCKET" ; then
2160                                 AC_MSG_RESULT($PRNGD_SOCKET)
2161                         else
2162                                 AC_MSG_RESULT(not found)
2163                         fi
2164                 fi
2165         ]
2166 )
2167
2168 # Change default command timeout for hashing entropy source
2169 entropy_timeout=200
2170 AC_ARG_WITH(entropy-timeout,
2171         [  --with-entropy-timeout  Specify entropy gathering command timeout (msec)],
2172         [
2173                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
2174                     test "x${withval}" != "xyes"; then
2175                         entropy_timeout=$withval
2176                 fi
2177         ]
2178 )
2179 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2180         [Builtin PRNG command timeout])
2181
2182 SSH_PRIVSEP_USER=sshd
2183 AC_ARG_WITH(privsep-user,
2184         [  --with-privsep-user=user Specify non-privileged user for privilege separation],
2185         [
2186                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
2187                     test "x${withval}" != "xyes"; then
2188                         SSH_PRIVSEP_USER=$withval
2189                 fi
2190         ]
2191 )
2192 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2193         [non-privileged user for privilege separation])
2194 AC_SUBST(SSH_PRIVSEP_USER)
2195
2196 # We do this little dance with the search path to insure
2197 # that programs that we select for use by installed programs
2198 # (which may be run by the super-user) come from trusted
2199 # locations before they come from the user's private area.
2200 # This should help avoid accidentally configuring some
2201 # random version of a program in someone's personal bin.
2202
2203 OPATH=$PATH
2204 PATH=/bin:/usr/bin
2205 test -h /bin 2> /dev/null && PATH=/usr/bin
2206 test -d /sbin && PATH=$PATH:/sbin
2207 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2208 PATH=$PATH:/etc:$OPATH
2209
2210 # These programs are used by the command hashing source to gather entropy
2211 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2212 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2213 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2214 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2215 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2216 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2217 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2218 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2219 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2220 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2221 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2222 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2223 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2224 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2225 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2226 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2227 # restore PATH
2228 PATH=$OPATH
2229
2230 # Where does ssh-rand-helper get its randomness from?
2231 INSTALL_SSH_PRNG_CMDS=""
2232 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2233         if test ! -z "$PRNGD_PORT" ; then
2234                 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2235         elif test ! -z "$PRNGD_SOCKET" ; then
2236                 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2237         else
2238                 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2239                 RAND_HELPER_CMDHASH=yes
2240                 INSTALL_SSH_PRNG_CMDS="yes"
2241         fi
2242 fi
2243 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2244
2245
2246 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2247 if test ! -z "$SONY" ; then
2248   LIBS="$LIBS -liberty";
2249 fi
2250
2251 # Check for  long long datatypes
2252 AC_CHECK_TYPES([long long, unsigned long long, long double])
2253
2254 # Check datatype sizes
2255 AC_CHECK_SIZEOF(char, 1)
2256 AC_CHECK_SIZEOF(short int, 2)
2257 AC_CHECK_SIZEOF(int, 4)
2258 AC_CHECK_SIZEOF(long int, 4)
2259 AC_CHECK_SIZEOF(long long int, 8)
2260
2261 # Sanity check long long for some platforms (AIX)
2262 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2263         ac_cv_sizeof_long_long_int=0
2264 fi
2265
2266 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2267 if test -z "$have_llong_max"; then
2268         AC_MSG_CHECKING([for max value of long long])
2269         AC_RUN_IFELSE(
2270                 [AC_LANG_SOURCE([[
2271 #include <stdio.h>
2272 /* Why is this so damn hard? */
2273 #ifdef __GNUC__
2274 # undef __GNUC__
2275 #endif
2276 #define __USE_ISOC99
2277 #include <limits.h>
2278 #define DATA "conftest.llminmax"
2279 int main(void) {
2280         FILE *f;
2281         long long i, llmin, llmax = 0;
2282
2283         if((f = fopen(DATA,"w")) == NULL)
2284                 exit(1);
2285
2286 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2287         fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2288         llmin = LLONG_MIN;
2289         llmax = LLONG_MAX;
2290 #else
2291         fprintf(stderr, "Calculating  LLONG_MIN and LLONG_MAX\n");
2292         /* This will work on one's complement and two's complement */
2293         for (i = 1; i > llmax; i <<= 1, i++)
2294                 llmax = i;
2295         llmin = llmax + 1LL;    /* wrap */
2296 #endif
2297
2298         /* Sanity check */
2299         if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2300             || llmax - 1 > llmax) {
2301                 fprintf(f, "unknown unknown\n");
2302                 exit(2);
2303         }
2304
2305         if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2306                 exit(3);
2307
2308         exit(0);
2309 }
2310                 ]])],
2311                 [
2312                         llong_min=`$AWK '{print $1}' conftest.llminmax`
2313                         llong_max=`$AWK '{print $2}' conftest.llminmax`
2314
2315                         # snprintf on some Tru64s doesn't understand "%lld"
2316                         case "$host" in
2317                         alpha-dec-osf*)
2318                                 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2319                                   test "x$llong_max" = "xld"; then
2320                                         llong_min="-9223372036854775808"
2321                                         llong_max="9223372036854775807"
2322                                 fi
2323                                 ;;
2324                         esac
2325
2326                         AC_MSG_RESULT($llong_max)
2327                         AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2328                             [max value of long long calculated by configure])
2329                         AC_MSG_CHECKING([for min value of long long])
2330                         AC_MSG_RESULT($llong_min)
2331                         AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2332                             [min value of long long calculated by configure])
2333                 ],
2334                 [
2335                         AC_MSG_RESULT(not found)
2336                 ],
2337                 [
2338                         AC_MSG_WARN([cross compiling: not checking])
2339                 ]
2340         )
2341 fi
2342
2343
2344 # More checks for data types
2345 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2346         AC_TRY_COMPILE(
2347                 [ #include <sys/types.h> ],
2348                 [ u_int a; a = 1;],
2349                 [ ac_cv_have_u_int="yes" ],
2350                 [ ac_cv_have_u_int="no" ]
2351         )
2352 ])
2353 if test "x$ac_cv_have_u_int" = "xyes" ; then
2354         AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2355         have_u_int=1
2356 fi
2357
2358 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2359         AC_TRY_COMPILE(
2360                 [ #include <sys/types.h> ],
2361                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2362                 [ ac_cv_have_intxx_t="yes" ],
2363                 [ ac_cv_have_intxx_t="no" ]
2364         )
2365 ])
2366 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2367         AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2368         have_intxx_t=1
2369 fi
2370
2371 if (test -z "$have_intxx_t" && \
2372            test "x$ac_cv_header_stdint_h" = "xyes")
2373 then
2374     AC_MSG_CHECKING([for intXX_t types in stdint.h])
2375         AC_TRY_COMPILE(
2376                 [ #include <stdint.h> ],
2377                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2378                 [
2379                         AC_DEFINE(HAVE_INTXX_T)
2380                         AC_MSG_RESULT(yes)
2381                 ],
2382                 [ AC_MSG_RESULT(no) ]
2383         )
2384 fi
2385
2386 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2387         AC_TRY_COMPILE(
2388                 [
2389 #include <sys/types.h>
2390 #ifdef HAVE_STDINT_H
2391 # include <stdint.h>
2392 #endif
2393 #include <sys/socket.h>
2394 #ifdef HAVE_SYS_BITYPES_H
2395 # include <sys/bitypes.h>
2396 #endif
2397                 ],
2398                 [ int64_t a; a = 1;],
2399                 [ ac_cv_have_int64_t="yes" ],
2400                 [ ac_cv_have_int64_t="no" ]
2401         )
2402 ])
2403 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2404         AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2405 fi
2406
2407 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2408         AC_TRY_COMPILE(
2409                 [ #include <sys/types.h> ],
2410                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2411                 [ ac_cv_have_u_intxx_t="yes" ],
2412                 [ ac_cv_have_u_intxx_t="no" ]
2413         )
2414 ])
2415 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2416         AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2417         have_u_intxx_t=1
2418 fi
2419
2420 if test -z "$have_u_intxx_t" ; then
2421     AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2422         AC_TRY_COMPILE(
2423                 [ #include <sys/socket.h> ],
2424                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2425                 [
2426                         AC_DEFINE(HAVE_U_INTXX_T)
2427                         AC_MSG_RESULT(yes)
2428                 ],
2429                 [ AC_MSG_RESULT(no) ]
2430         )
2431 fi
2432
2433 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2434         AC_TRY_COMPILE(
2435                 [ #include <sys/types.h> ],
2436                 [ u_int64_t a; a = 1;],
2437                 [ ac_cv_have_u_int64_t="yes" ],
2438                 [ ac_cv_have_u_int64_t="no" ]
2439         )
2440 ])
2441 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2442         AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2443         have_u_int64_t=1
2444 fi
2445
2446 if test -z "$have_u_int64_t" ; then
2447     AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2448         AC_TRY_COMPILE(
2449                 [ #include <sys/bitypes.h> ],
2450                 [ u_int64_t a; a = 1],
2451                 [
2452                         AC_DEFINE(HAVE_U_INT64_T)
2453                         AC_MSG_RESULT(yes)
2454                 ],
2455                 [ AC_MSG_RESULT(no) ]
2456         )
2457 fi
2458
2459 if test -z "$have_u_intxx_t" ; then
2460         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2461                 AC_TRY_COMPILE(
2462                         [
2463 #include <sys/types.h>
2464                         ],
2465                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2466                         [ ac_cv_have_uintxx_t="yes" ],
2467                         [ ac_cv_have_uintxx_t="no" ]
2468                 )
2469         ])
2470         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2471                 AC_DEFINE(HAVE_UINTXX_T, 1,
2472                         [define if you have uintxx_t data type])
2473         fi
2474 fi
2475
2476 if test -z "$have_uintxx_t" ; then
2477     AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2478         AC_TRY_COMPILE(
2479                 [ #include <stdint.h> ],
2480                 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2481                 [
2482                         AC_DEFINE(HAVE_UINTXX_T)
2483                         AC_MSG_RESULT(yes)
2484                 ],
2485                 [ AC_MSG_RESULT(no) ]
2486         )
2487 fi
2488
2489 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2490            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2491 then
2492         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2493         AC_TRY_COMPILE(
2494                 [
2495 #include <sys/bitypes.h>
2496                 ],
2497                 [
2498                         int8_t a; int16_t b; int32_t c;
2499                         u_int8_t e; u_int16_t f; u_int32_t g;
2500                         a = b = c = e = f = g = 1;
2501                 ],
2502                 [
2503                         AC_DEFINE(HAVE_U_INTXX_T)
2504                         AC_DEFINE(HAVE_INTXX_T)
2505                         AC_MSG_RESULT(yes)
2506                 ],
2507                 [AC_MSG_RESULT(no)]
2508         )
2509 fi
2510
2511
2512 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2513         AC_TRY_COMPILE(
2514                 [
2515 #include <sys/types.h>
2516                 ],
2517                 [ u_char foo; foo = 125; ],
2518                 [ ac_cv_have_u_char="yes" ],
2519                 [ ac_cv_have_u_char="no" ]
2520         )
2521 ])
2522 if test "x$ac_cv_have_u_char" = "xyes" ; then
2523         AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2524 fi
2525
2526 TYPE_SOCKLEN_T
2527
2528 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2529
2530 AC_CHECK_TYPES(in_addr_t,,,
2531 [#include <sys/types.h>
2532 #include <netinet/in.h>])
2533
2534 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2535         AC_TRY_COMPILE(
2536                 [
2537 #include <sys/types.h>
2538                 ],
2539                 [ size_t foo; foo = 1235; ],
2540                 [ ac_cv_have_size_t="yes" ],
2541                 [ ac_cv_have_size_t="no" ]
2542         )
2543 ])
2544 if test "x$ac_cv_have_size_t" = "xyes" ; then
2545         AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2546 fi
2547
2548 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2549         AC_TRY_COMPILE(
2550                 [
2551 #include <sys/types.h>
2552                 ],
2553                 [ ssize_t foo; foo = 1235; ],
2554                 [ ac_cv_have_ssize_t="yes" ],
2555                 [ ac_cv_have_ssize_t="no" ]
2556         )
2557 ])
2558 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2559         AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2560 fi
2561
2562 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2563         AC_TRY_COMPILE(
2564                 [
2565 #include <time.h>
2566                 ],
2567                 [ clock_t foo; foo = 1235; ],
2568                 [ ac_cv_have_clock_t="yes" ],
2569                 [ ac_cv_have_clock_t="no" ]
2570         )
2571 ])
2572 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2573         AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2574 fi
2575
2576 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2577         AC_TRY_COMPILE(
2578                 [
2579 #include <sys/types.h>
2580 #include <sys/socket.h>
2581                 ],
2582                 [ sa_family_t foo; foo = 1235; ],
2583                 [ ac_cv_have_sa_family_t="yes" ],
2584                 [ AC_TRY_COMPILE(
2585                   [
2586 #include <sys/types.h>
2587 #include <sys/socket.h>
2588 #include <netinet/in.h>
2589                 ],
2590                 [ sa_family_t foo; foo = 1235; ],
2591                 [ ac_cv_have_sa_family_t="yes" ],
2592
2593                 [ ac_cv_have_sa_family_t="no" ]
2594         )]
2595         )
2596 ])
2597 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2598         AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2599                 [define if you have sa_family_t data type])
2600 fi
2601
2602 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2603         AC_TRY_COMPILE(
2604                 [
2605 #include <sys/types.h>
2606                 ],
2607                 [ pid_t foo; foo = 1235; ],
2608                 [ ac_cv_have_pid_t="yes" ],
2609                 [ ac_cv_have_pid_t="no" ]
2610         )
2611 ])
2612 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2613         AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2614 fi
2615
2616 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2617         AC_TRY_COMPILE(
2618                 [
2619 #include <sys/types.h>
2620                 ],
2621                 [ mode_t foo; foo = 1235; ],
2622                 [ ac_cv_have_mode_t="yes" ],
2623                 [ ac_cv_have_mode_t="no" ]
2624         )
2625 ])
2626 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2627         AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2628 fi
2629
2630
2631 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2632         AC_TRY_COMPILE(
2633                 [
2634 #include <sys/types.h>
2635 #include <sys/socket.h>
2636                 ],
2637                 [ struct sockaddr_storage s; ],
2638                 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2639                 [ ac_cv_have_struct_sockaddr_storage="no" ]
2640         )
2641 ])
2642 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2643         AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2644                 [define if you have struct sockaddr_storage data type])
2645 fi
2646
2647 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2648         AC_TRY_COMPILE(
2649                 [
2650 #include <sys/types.h>
2651 #include <netinet/in.h>
2652                 ],
2653                 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2654                 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2655                 [ ac_cv_have_struct_sockaddr_in6="no" ]
2656         )
2657 ])
2658 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2659         AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2660                 [define if you have struct sockaddr_in6 data type])
2661 fi
2662
2663 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2664         AC_TRY_COMPILE(
2665                 [
2666 #include <sys/types.h>
2667 #include <netinet/in.h>
2668                 ],
2669                 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2670                 [ ac_cv_have_struct_in6_addr="yes" ],
2671                 [ ac_cv_have_struct_in6_addr="no" ]
2672         )
2673 ])
2674 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2675         AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2676                 [define if you have struct in6_addr data type])
2677 fi
2678
2679 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2680         AC_TRY_COMPILE(
2681                 [
2682 #include <sys/types.h>
2683 #include <sys/socket.h>
2684 #include <netdb.h>
2685                 ],
2686                 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2687                 [ ac_cv_have_struct_addrinfo="yes" ],
2688                 [ ac_cv_have_struct_addrinfo="no" ]
2689         )
2690 ])
2691 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2692         AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2693                 [define if you have struct addrinfo data type])
2694 fi
2695
2696 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2697         AC_TRY_COMPILE(
2698                 [ #include <sys/time.h> ],
2699                 [ struct timeval tv; tv.tv_sec = 1;],
2700                 [ ac_cv_have_struct_timeval="yes" ],
2701                 [ ac_cv_have_struct_timeval="no" ]
2702         )
2703 ])
2704 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2705         AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2706         have_struct_timeval=1
2707 fi
2708
2709 AC_CHECK_TYPES(struct timespec)
2710
2711 # We need int64_t or else certian parts of the compile will fail.
2712 if test "x$ac_cv_have_int64_t" = "xno" && \
2713         test "x$ac_cv_sizeof_long_int" != "x8" && \
2714         test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2715         echo "OpenSSH requires int64_t support.  Contact your vendor or install"
2716         echo "an alternative compiler (I.E., GCC) before continuing."
2717         echo ""
2718         exit 1;
2719 else
2720 dnl test snprintf (broken on SCO w/gcc)
2721         AC_RUN_IFELSE(
2722                 [AC_LANG_SOURCE([[
2723 #include <stdio.h>
2724 #include <string.h>
2725 #ifdef HAVE_SNPRINTF
2726 main()
2727 {
2728         char buf[50];
2729         char expected_out[50];
2730         int mazsize = 50 ;
2731 #if (SIZEOF_LONG_INT == 8)
2732         long int num = 0x7fffffffffffffff;
2733 #else
2734         long long num = 0x7fffffffffffffffll;
2735 #endif
2736         strcpy(expected_out, "9223372036854775807");
2737         snprintf(buf, mazsize, "%lld", num);
2738         if(strcmp(buf, expected_out) != 0)
2739                 exit(1);
2740         exit(0);
2741 }
2742 #else
2743 main() { exit(0); }
2744 #endif
2745                 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2746                 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2747         )
2748 fi
2749
2750 dnl Checks for structure members
2751 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2752 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2753 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2754 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2755 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2756 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2757 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2758 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2759 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2760 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2761 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2762 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2763 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2764 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2765 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2766 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2767 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2768
2769 AC_CHECK_MEMBERS([struct stat.st_blksize])
2770 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2771         [Define if we don't have struct __res_state in resolv.h])],
2772 [
2773 #include <stdio.h>
2774 #if HAVE_SYS_TYPES_H
2775 # include <sys/types.h>
2776 #endif
2777 #include <netinet/in.h>
2778 #include <arpa/nameser.h>
2779 #include <resolv.h>
2780 ])
2781
2782 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2783                 ac_cv_have_ss_family_in_struct_ss, [
2784         AC_TRY_COMPILE(
2785                 [
2786 #include <sys/types.h>
2787 #include <sys/socket.h>
2788                 ],
2789                 [ struct sockaddr_storage s; s.ss_family = 1; ],
2790                 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2791                 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2792         )
2793 ])
2794 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2795         AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2796 fi
2797
2798 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2799                 ac_cv_have___ss_family_in_struct_ss, [
2800         AC_TRY_COMPILE(
2801                 [
2802 #include <sys/types.h>
2803 #include <sys/socket.h>
2804                 ],
2805                 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2806                 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2807                 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2808         )
2809 ])
2810 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2811         AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2812                 [Fields in struct sockaddr_storage])
2813 fi
2814
2815 AC_CACHE_CHECK([for pw_class field in struct passwd],
2816                 ac_cv_have_pw_class_in_struct_passwd, [
2817         AC_TRY_COMPILE(
2818                 [
2819 #include <pwd.h>
2820                 ],
2821                 [ struct passwd p; p.pw_class = 0; ],
2822                 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2823                 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2824         )
2825 ])
2826 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2827         AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2828                 [Define if your password has a pw_class field])
2829 fi
2830
2831 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2832                 ac_cv_have_pw_expire_in_struct_passwd, [
2833         AC_TRY_COMPILE(
2834                 [
2835 #include <pwd.h>
2836                 ],
2837                 [ struct passwd p; p.pw_expire = 0; ],
2838                 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2839                 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2840         )
2841 ])
2842 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2843         AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2844                 [Define if your password has a pw_expire field])
2845 fi
2846
2847 AC_CACHE_CHECK([for pw_change field in struct passwd],
2848                 ac_cv_have_pw_change_in_struct_passwd, [
2849         AC_TRY_COMPILE(
2850                 [
2851 #include <pwd.h>
2852                 ],
2853                 [ struct passwd p; p.pw_change = 0; ],
2854                 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2855                 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2856         )
2857 ])
2858 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2859         AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2860                 [Define if your password has a pw_change field])
2861 fi
2862
2863 dnl make sure we're using the real structure members and not defines
2864 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2865                 ac_cv_have_accrights_in_msghdr, [
2866         AC_COMPILE_IFELSE(
2867                 [
2868 #include <sys/types.h>
2869 #include <sys/socket.h>
2870 #include <sys/uio.h>
2871 int main() {
2872 #ifdef msg_accrights
2873 #error "msg_accrights is a macro"
2874 exit(1);
2875 #endif
2876 struct msghdr m;
2877 m.msg_accrights = 0;
2878 exit(0);
2879 }
2880                 ],
2881                 [ ac_cv_have_accrights_in_msghdr="yes" ],
2882                 [ ac_cv_have_accrights_in_msghdr="no" ]
2883         )
2884 ])
2885 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2886         AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2887                 [Define if your system uses access rights style
2888                 file descriptor passing])
2889 fi
2890
2891 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2892                 ac_cv_have_control_in_msghdr, [
2893         AC_COMPILE_IFELSE(
2894                 [
2895 #include <sys/types.h>
2896 #include <sys/socket.h>
2897 #include <sys/uio.h>
2898 int main() {
2899 #ifdef msg_control
2900 #error "msg_control is a macro"
2901 exit(1);
2902 #endif
2903 struct msghdr m;
2904 m.msg_control = 0;
2905 exit(0);
2906 }
2907                 ],
2908                 [ ac_cv_have_control_in_msghdr="yes" ],
2909                 [ ac_cv_have_control_in_msghdr="no" ]
2910         )
2911 ])
2912 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2913         AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2914                 [Define if your system uses ancillary data style
2915                 file descriptor passing])
2916 fi
2917
2918 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2919         AC_TRY_LINK([],
2920                 [ extern char *__progname; printf("%s", __progname); ],
2921                 [ ac_cv_libc_defines___progname="yes" ],
2922                 [ ac_cv_libc_defines___progname="no" ]
2923         )
2924 ])
2925 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2926         AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2927 fi
2928
2929 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2930         AC_TRY_LINK([
2931 #include <stdio.h>
2932 ],
2933                 [ printf("%s", __FUNCTION__); ],
2934                 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2935                 [ ac_cv_cc_implements___FUNCTION__="no" ]
2936         )
2937 ])
2938 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2939         AC_DEFINE(HAVE___FUNCTION__, 1,
2940                 [Define if compiler implements __FUNCTION__])
2941 fi
2942
2943 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2944         AC_TRY_LINK([
2945 #include <stdio.h>
2946 ],
2947                 [ printf("%s", __func__); ],
2948                 [ ac_cv_cc_implements___func__="yes" ],
2949                 [ ac_cv_cc_implements___func__="no" ]
2950         )
2951 ])
2952 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2953         AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2954 fi
2955
2956 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2957         AC_TRY_LINK(
2958                 [#include <stdarg.h>
2959                  va_list x,y;],
2960                 [va_copy(x,y);],
2961                 [ ac_cv_have_va_copy="yes" ],
2962                 [ ac_cv_have_va_copy="no" ]
2963         )
2964 ])
2965 if test "x$ac_cv_have_va_copy" = "xyes" ; then
2966         AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2967 fi
2968
2969 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2970         AC_TRY_LINK(
2971                 [#include <stdarg.h>
2972                  va_list x,y;],
2973                 [__va_copy(x,y);],
2974                 [ ac_cv_have___va_copy="yes" ],
2975                 [ ac_cv_have___va_copy="no" ]
2976         )
2977 ])
2978 if test "x$ac_cv_have___va_copy" = "xyes" ; then
2979         AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2980 fi
2981
2982 AC_CACHE_CHECK([whether getopt has optreset support],
2983                 ac_cv_have_getopt_optreset, [
2984         AC_TRY_LINK(
2985                 [
2986 #include <getopt.h>
2987                 ],
2988                 [ extern int optreset; optreset = 0; ],
2989                 [ ac_cv_have_getopt_optreset="yes" ],
2990                 [ ac_cv_have_getopt_optreset="no" ]
2991         )
2992 ])
2993 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2994         AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2995                 [Define if your getopt(3) defines and uses optreset])
2996 fi
2997
2998 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2999         AC_TRY_LINK([],
3000                 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3001                 [ ac_cv_libc_defines_sys_errlist="yes" ],
3002                 [ ac_cv_libc_defines_sys_errlist="no" ]
3003         )
3004 ])
3005 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3006         AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3007                 [Define if your system defines sys_errlist[]])
3008 fi
3009
3010
3011 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3012         AC_TRY_LINK([],
3013                 [ extern int sys_nerr; printf("%i", sys_nerr);],
3014                 [ ac_cv_libc_defines_sys_nerr="yes" ],
3015                 [ ac_cv_libc_defines_sys_nerr="no" ]
3016         )
3017 ])
3018 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3019         AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3020 fi
3021
3022 SCARD_MSG="no"
3023 # Check whether user wants sectok support
3024 AC_ARG_WITH(sectok,
3025         [  --with-sectok           Enable smartcard support using libsectok],
3026         [
3027                 if test "x$withval" != "xno" ; then
3028                         if test "x$withval" != "xyes" ; then
3029                                 CPPFLAGS="$CPPFLAGS -I${withval}"
3030                                 LDFLAGS="$LDFLAGS -L${withval}"
3031                                 if test ! -z "$need_dash_r" ; then
3032                                         LDFLAGS="$LDFLAGS -R${withval}"
3033                                 fi
3034                                 if test ! -z "$blibpath" ; then
3035                                         blibpath="$blibpath:${withval}"
3036                                 fi
3037                         fi
3038                         AC_CHECK_HEADERS(sectok.h)
3039                         if test "$ac_cv_header_sectok_h" != yes; then
3040                                 AC_MSG_ERROR(Can't find sectok.h)
3041                         fi
3042                         AC_CHECK_LIB(sectok, sectok_open)
3043                         if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3044                                 AC_MSG_ERROR(Can't find libsectok)
3045                         fi
3046                         AC_DEFINE(SMARTCARD, 1,
3047                                 [Define if you want smartcard support])
3048                         AC_DEFINE(USE_SECTOK, 1,
3049                                 [Define if you want smartcard support
3050                                 using sectok])
3051                         SCARD_MSG="yes, using sectok"
3052                 fi
3053         ]
3054 )
3055
3056 # Check whether user wants OpenSC support
3057 OPENSC_CONFIG="no"
3058 AC_ARG_WITH(opensc,
3059         [  --with-opensc[[=PFX]]     Enable smartcard support using OpenSC (optionally in PATH)],
3060         [
3061             if test "x$withval" != "xno" ; then
3062                 if test "x$withval" != "xyes" ; then
3063                         OPENSC_CONFIG=$withval/bin/opensc-config
3064                 else
3065                         AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3066                 fi
3067                 if test "$OPENSC_CONFIG" != "no"; then
3068                         LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3069                         LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3070                         CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3071                         LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
3072                         AC_DEFINE(SMARTCARD)
3073                         AC_DEFINE(USE_OPENSC, 1,
3074                                 [Define if you want smartcard support
3075                                 using OpenSC])
3076                         SCARD_MSG="yes, using OpenSC"
3077                 fi
3078             fi
3079         ]
3080 )
3081
3082 # Check libraries needed by DNS fingerprint support
3083 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3084         [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3085                 [Define if getrrsetbyname() exists])],
3086         [
3087                 # Needed by our getrrsetbyname()
3088                 AC_SEARCH_LIBS(res_query, resolv)
3089                 AC_SEARCH_LIBS(dn_expand, resolv)
3090                 AC_MSG_CHECKING(if res_query will link)
3091                 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3092                    [AC_MSG_RESULT(no)
3093                     saved_LIBS="$LIBS"
3094                     LIBS="$LIBS -lresolv"
3095                     AC_MSG_CHECKING(for res_query in -lresolv)
3096                     AC_LINK_IFELSE([
3097 #include <resolv.h>
3098 int main()
3099 {
3100         res_query (0, 0, 0, 0, 0);
3101         return 0;
3102 }
3103                         ],
3104                         [LIBS="$LIBS -lresolv"
3105                          AC_MSG_RESULT(yes)],
3106                         [LIBS="$saved_LIBS"
3107                          AC_MSG_RESULT(no)])
3108                     ])
3109                 AC_CHECK_FUNCS(_getshort _getlong)
3110                 AC_CHECK_DECLS([_getshort, _getlong], , ,
3111                     [#include <sys/types.h>
3112                     #include <arpa/nameser.h>])
3113                 AC_CHECK_MEMBER(HEADER.ad,
3114                         [AC_DEFINE(HAVE_HEADER_AD, 1,
3115                             [Define if HEADER.ad exists in arpa/nameser.h])],,
3116                         [#include <arpa/nameser.h>])
3117         ])
3118
3119 # Check whether user wants Kerberos 5 support
3120 KRB5_MSG="no"
3121 AC_ARG_WITH(kerberos5,
3122         [  --with-kerberos5=PATH   Enable Kerberos 5 support],
3123         [ if test "x$withval" != "xno" ; then
3124                 if test "x$withval" = "xyes" ; then
3125                         KRB5ROOT="/usr/local"
3126                 else
3127                         KRB5ROOT=${withval}
3128                 fi
3129
3130                 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3131                 KRB5_MSG="yes"
3132
3133                 AC_MSG_CHECKING(for krb5-config)
3134                 if test -x  $KRB5ROOT/bin/krb5-config ; then
3135                         KRB5CONF=$KRB5ROOT/bin/krb5-config
3136                         AC_MSG_RESULT($KRB5CONF)
3137
3138                         AC_MSG_CHECKING(for gssapi support)
3139                         if $KRB5CONF | grep gssapi >/dev/null ; then
3140                                 AC_MSG_RESULT(yes)
3141                                 AC_DEFINE(GSSAPI, 1,
3142                                         [Define this if you want GSSAPI
3143                                         support in the version 2 protocol])
3144                                 k5confopts=gssapi
3145                         else
3146                                 AC_MSG_RESULT(no)
3147                                 k5confopts=""
3148                         fi
3149                         K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3150                         K5LIBS="`$KRB5CONF --libs $k5confopts`"
3151                         CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3152                         AC_MSG_CHECKING(whether we are using Heimdal)
3153                         AC_TRY_COMPILE([ #include <krb5.h> ],
3154                                        [ char *tmp = heimdal_version; ],
3155                                        [ AC_MSG_RESULT(yes)
3156                                          AC_DEFINE(HEIMDAL, 1,
3157                                         [Define this if you are using the
3158                                         Heimdal version of Kerberos V5]) ],
3159                                          AC_MSG_RESULT(no)
3160                         )
3161                 else
3162                         AC_MSG_RESULT(no)
3163                         CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3164                         LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3165                         AC_MSG_CHECKING(whether we are using Heimdal)
3166                         AC_TRY_COMPILE([ #include <krb5.h> ],
3167                                        [ char *tmp = heimdal_version; ],
3168                                        [ AC_MSG_RESULT(yes)
3169                                          AC_DEFINE(HEIMDAL)
3170                                          K5LIBS="-lkrb5 -ldes"
3171                                          K5LIBS="$K5LIBS -lcom_err -lasn1"
3172                                          AC_CHECK_LIB(roken, net_write,
3173                                            [K5LIBS="$K5LIBS -lroken"])
3174                                        ],
3175                                        [ AC_MSG_RESULT(no)
3176                                          K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3177                                        ]
3178                         )
3179                         AC_SEARCH_LIBS(dn_expand, resolv)
3180
3181                         AC_CHECK_LIB(gssapi,gss_init_sec_context,
3182                                 [ AC_DEFINE(GSSAPI)
3183                                   K5LIBS="-lgssapi $K5LIBS" ],
3184                                 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3185                                         [ AC_DEFINE(GSSAPI)
3186                                           K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3187                                         AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3188                                         $K5LIBS)
3189                                 ],
3190                                 $K5LIBS)
3191
3192                         AC_CHECK_HEADER(gssapi.h, ,
3193                                 [ unset ac_cv_header_gssapi_h
3194                                   CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3195                                   AC_CHECK_HEADERS(gssapi.h, ,
3196                                         AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3197                                   )
3198                                 ]
3199                         )
3200
3201                         oldCPP="$CPPFLAGS"
3202                         CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3203                         AC_CHECK_HEADER(gssapi_krb5.h, ,
3204                                         [ CPPFLAGS="$oldCPP" ])
3205
3206                         # If we're using some other GSSAPI
3207                         if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3208                                 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support.  Use mechglue instead.])
3209                         fi
3210
3211                         if test -z "$GSSAPI"; then
3212                                 GSSAPI="KRB5";
3213                         fi
3214
3215                         oldCPP="$CPPFLAGS"
3216                         CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3217                         AC_CHECK_HEADER(gssapi_krb5.h, ,
3218                                         [ CPPFLAGS="$oldCPP" ])
3219
3220                 fi
3221                 if test ! -z "$need_dash_r" ; then
3222                         LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3223                 fi
3224                 if test ! -z "$blibpath" ; then
3225                         blibpath="$blibpath:${KRB5ROOT}/lib"
3226                 fi
3227
3228                 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3229                 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3230                 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3231
3232                 LIBS="$LIBS $K5LIBS"
3233                 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3234                         [Define this if you want to use libkafs' AFS support]))
3235         fi
3236         ]
3237 )
3238
3239 # Check whether user wants AFS_KRB5 support
3240 AFS_KRB5_MSG="no"
3241 AC_ARG_WITH(afs-krb5,
3242         [  --with-afs-krb5[[=AKLOG_PATH]]  Enable aklog to get token (default=/usr/bin/aklog).],
3243         [
3244                 if test "x$withval" != "xno" ; then
3245
3246                         if test "x$withval" != "xyes" ; then
3247                                 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3248                                         [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3249                         else
3250                                 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3251                                         "/usr/bin/aklog",
3252                                         [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3253                         fi
3254
3255                         if test -z "$KRB5ROOT" ; then
3256                                 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3257                         fi
3258
3259                         LIBS="-lkrbafs -lkrb4 $LIBS"
3260                         if test ! -z "$AFS_LIBS" ; then
3261                                 LIBS="$LIBS $AFS_LIBS"
3262                         fi
3263                         AC_DEFINE(AFS_KRB5, 1,
3264                                 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3265                         AFS_KRB5_MSG="yes"
3266                 fi
3267         ]
3268 )
3269
3270 AC_ARG_WITH(session-hooks,
3271         [  --with-session-hooks    Enable hooks for executing external commands                                       before/after a session],
3272         [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
3273 )
3274
3275 # Looking for programs, paths and files
3276
3277 PRIVSEP_PATH=/var/empty
3278 AC_ARG_WITH(privsep-path,
3279         [  --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3280         [
3281                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3282                     test "x${withval}" != "xyes"; then
3283                         PRIVSEP_PATH=$withval
3284                 fi
3285         ]
3286 )
3287 AC_SUBST(PRIVSEP_PATH)
3288
3289 AC_ARG_WITH(xauth,
3290         [  --with-xauth=PATH       Specify path to xauth program ],
3291         [
3292                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3293                     test "x${withval}" != "xyes"; then
3294                         xauth_path=$withval
3295                 fi
3296         ],
3297         [
3298                 TestPath="$PATH"
3299                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3300                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3301                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3302                 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3303                 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3304                 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3305                         xauth_path="/usr/openwin/bin/xauth"
3306                 fi
3307         ]
3308 )
3309
3310 STRIP_OPT=-s
3311 AC_ARG_ENABLE(strip,
3312         [  --disable-strip         Disable calling strip(1) on install],
3313         [
3314                 if test "x$enableval" = "xno" ; then
3315                         STRIP_OPT=
3316                 fi
3317         ]
3318 )
3319 AC_SUBST(STRIP_OPT)
3320
3321 if test -z "$xauth_path" ; then
3322         XAUTH_PATH="undefined"
3323         AC_SUBST(XAUTH_PATH)
3324 else
3325         AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3326                 [Define if xauth is found in your path])
3327         XAUTH_PATH=$xauth_path
3328         AC_SUBST(XAUTH_PATH)
3329 fi
3330
3331 # Check for mail directory (last resort if we cannot get it from headers)
3332 if test ! -z "$MAIL" ; then
3333         maildir=`dirname $MAIL`
3334         AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3335                 [Set this to your mail directory if you don't have maillock.h])
3336 fi
3337
3338 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3339         AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3340         disable_ptmx_check=yes
3341 fi
3342 if test -z "$no_dev_ptmx" ; then
3343         if test "x$disable_ptmx_check" != "xyes" ; then
3344                 AC_CHECK_FILE("/dev/ptmx",
3345                         [
3346                                 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3347                                         [Define if you have /dev/ptmx])
3348                                 have_dev_ptmx=1
3349                         ]
3350                 )
3351         fi
3352 fi
3353
3354 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3355         AC_CHECK_FILE("/dev/ptc",
3356                 [
3357                         AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3358                                 [Define if you have /dev/ptc])
3359                         have_dev_ptc=1
3360                 ]
3361         )
3362 else
3363         AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3364 fi
3365
3366 # Options from here on. Some of these are preset by platform above
3367 AC_ARG_WITH(mantype,
3368         [  --with-mantype=man|cat|doc  Set man page type],
3369         [
3370                 case "$withval" in
3371                 man|cat|doc)
3372                         MANTYPE=$withval
3373                         ;;
3374                 *)
3375                         AC_MSG_ERROR(invalid man type: $withval)
3376                         ;;
3377                 esac
3378         ]
3379 )
3380 if test -z "$MANTYPE"; then
3381         TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3382         AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3383         if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3384                 MANTYPE=doc
3385         elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3386                 MANTYPE=man
3387         else
3388                 MANTYPE=cat
3389         fi
3390 fi
3391 AC_SUBST(MANTYPE)
3392 if test "$MANTYPE" = "doc"; then
3393         mansubdir=man;
3394 else
3395         mansubdir=$MANTYPE;
3396 fi
3397 AC_SUBST(mansubdir)
3398
3399 # Check whether to enable MD5 passwords
3400 MD5_MSG="no"
3401 AC_ARG_WITH(md5-passwords,
3402         [  --with-md5-passwords    Enable use of MD5 passwords],
3403         [
3404                 if test "x$withval" != "xno" ; then
3405                         AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3406                                 [Define if you want to allow MD5 passwords])
3407                         MD5_MSG="yes"
3408                 fi
3409         ]
3410 )
3411
3412 # Whether to disable shadow password support
3413 AC_ARG_WITH(shadow,
3414         [  --without-shadow        Disable shadow password support],
3415         [
3416                 if test "x$withval" = "xno" ; then
3417                         AC_DEFINE(DISABLE_SHADOW)
3418                         disable_shadow=yes
3419                 fi
3420         ]
3421 )
3422
3423 if test -z "$disable_shadow" ; then
3424         AC_MSG_CHECKING([if the systems has expire shadow information])
3425         AC_TRY_COMPILE(
3426         [
3427 #include <sys/types.h>
3428 #include <shadow.h>
3429         struct spwd sp;
3430         ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3431         [ sp_expire_available=yes ], []
3432         )
3433
3434         if test "x$sp_expire_available" = "xyes" ; then
3435                 AC_MSG_RESULT(yes)
3436                 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3437                     [Define if you want to use shadow password expire field])
3438         else
3439                 AC_MSG_RESULT(no)
3440         fi
3441 fi
3442
3443 # Use ip address instead of hostname in $DISPLAY
3444 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3445         DISPLAY_HACK_MSG="yes"
3446         AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3447                 [Define if you need to use IP address
3448                 instead of hostname in $DISPLAY])
3449 else
3450         DISPLAY_HACK_MSG="no"
3451         AC_ARG_WITH(ipaddr-display,
3452                 [  --with-ipaddr-display   Use ip address instead of hostname in \$DISPLAY],
3453                 [
3454                         if test "x$withval" != "xno" ; then
3455                                 AC_DEFINE(IPADDR_IN_DISPLAY)
3456                                 DISPLAY_HACK_MSG="yes"
3457                         fi
3458                 ]
3459         )
3460 fi
3461
3462 # check for /etc/default/login and use it if present.
3463 AC_ARG_ENABLE(etc-default-login,
3464         [  --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3465         [ if test "x$enableval" = "xno"; then
3466                 AC_MSG_NOTICE([/etc/default/login handling disabled])
3467                 etc_default_login=no
3468           else
3469                 etc_default_login=yes
3470           fi ],
3471         [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3472           then
3473                 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3474                 etc_default_login=no
3475           else
3476                 etc_default_login=yes
3477           fi ]
3478 )
3479
3480 if test "x$etc_default_login" != "xno"; then
3481         AC_CHECK_FILE("/etc/default/login",
3482             [ external_path_file=/etc/default/login ])
3483         if test "x$external_path_file" = "x/etc/default/login"; then
3484                 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3485                         [Define if your system has /etc/default/login])
3486         fi
3487 fi
3488
3489 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3490 if test $ac_cv_func_login_getcapbool = "yes" && \
3491         test $ac_cv_header_login_cap_h = "yes" ; then
3492         external_path_file=/etc/login.conf
3493 fi
3494
3495 # Whether to mess with the default path
3496 SERVER_PATH_MSG="(default)"
3497 AC_ARG_WITH(default-path,
3498         [  --with-default-path=    Specify default \$PATH environment for server],
3499         [
3500                 if test "x$external_path_file" = "x/etc/login.conf" ; then
3501                         AC_MSG_WARN([
3502 --with-default-path=PATH has no effect on this system.
3503 Edit /etc/login.conf instead.])
3504                 elif test "x$withval" != "xno" ; then
3505                         if test ! -z "$external_path_file" ; then
3506                                 AC_MSG_WARN([
3507 --with-default-path=PATH will only be used if PATH is not defined in
3508 $external_path_file .])
3509                         fi
3510                         user_path="$withval"
3511                         SERVER_PATH_MSG="$withval"
3512                 fi
3513         ],
3514         [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3515                 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3516         else
3517                 if test ! -z "$external_path_file" ; then
3518                         AC_MSG_WARN([
3519 If PATH is defined in $external_path_file, ensure the path to scp is included,
3520 otherwise scp will not work.])
3521                 fi
3522                 AC_RUN_IFELSE(
3523                         [AC_LANG_SOURCE([[
3524 /* find out what STDPATH is */
3525 #include <stdio.h>
3526 #ifdef HAVE_PATHS_H
3527 # include <paths.h>
3528 #endif
3529 #ifndef _PATH_STDPATH
3530 # ifdef _PATH_USERPATH  /* Irix */
3531 #  define _PATH_STDPATH _PATH_USERPATH
3532 # else
3533 #  define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3534 # endif
3535 #endif
3536 #include <sys/types.h>
3537 #include <sys/stat.h>
3538 #include <fcntl.h>
3539 #define DATA "conftest.stdpath"
3540
3541 main()
3542 {
3543         FILE *fd;
3544         int rc;
3545
3546         fd = fopen(DATA,"w");
3547         if(fd == NULL)
3548                 exit(1);
3549
3550         if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3551                 exit(1);
3552
3553         exit(0);
3554 }
3555                 ]])],
3556                 [ user_path=`cat conftest.stdpath` ],
3557                 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3558                 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3559         )
3560 # make sure $bindir is in USER_PATH so scp will work
3561                 t_bindir=`eval echo ${bindir}`
3562                 case $t_bindir in
3563                         NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3564                 esac
3565                 case $t_bindir in
3566                         NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3567                 esac
3568                 echo $user_path | grep ":$t_bindir"  > /dev/null 2>&1
3569                 if test $? -ne 0  ; then
3570                         echo $user_path | grep "^$t_bindir"  > /dev/null 2>&1
3571                         if test $? -ne 0  ; then
3572                                 user_path=$user_path:$t_bindir
3573                                 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3574                         fi
3575                 fi
3576         fi ]
3577 )
3578 if test "x$external_path_file" != "x/etc/login.conf" ; then
3579         AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3580         AC_SUBST(user_path)
3581 fi
3582
3583 # Set superuser path separately to user path
3584 AC_ARG_WITH(superuser-path,
3585         [  --with-superuser-path=  Specify different path for super-user],
3586         [
3587                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3588                     test "x${withval}" != "xyes"; then
3589                         AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3590                                 [Define if you want a different $PATH
3591                                 for the superuser])
3592                         superuser_path=$withval
3593                 fi
3594         ]
3595 )
3596
3597
3598 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3599 IPV4_IN6_HACK_MSG="no"
3600 AC_ARG_WITH(4in6,
3601         [  --with-4in6             Check for and convert IPv4 in IPv6 mapped addresses],
3602         [
3603                 if test "x$withval" != "xno" ; then
3604                         AC_MSG_RESULT(yes)
3605                         AC_DEFINE(IPV4_IN_IPV6, 1,
3606                                 [Detect IPv4 in IPv6 mapped addresses
3607                                 and treat as IPv4])
3608                         IPV4_IN6_HACK_MSG="yes"
3609                 else
3610                         AC_MSG_RESULT(no)
3611                 fi
3612         ],[
3613                 if test "x$inet6_default_4in6" = "xyes"; then
3614                         AC_MSG_RESULT([yes (default)])
3615                         AC_DEFINE(IPV4_IN_IPV6)
3616                         IPV4_IN6_HACK_MSG="yes"
3617                 else
3618                         AC_MSG_RESULT([no (default)])
3619                 fi
3620         ]
3621 )
3622
3623 # Whether to enable BSD auth support
3624 BSD_AUTH_MSG=no
3625 AC_ARG_WITH(bsd-auth,
3626         [  --with-bsd-auth         Enable BSD auth support],
3627         [
3628                 if test "x$withval" != "xno" ; then
3629                         AC_DEFINE(BSD_AUTH, 1,
3630                                 [Define if you have BSD auth support])
3631                         BSD_AUTH_MSG=yes
3632                 fi
3633         ]
3634 )
3635
3636 # Where to place sshd.pid
3637 piddir=/var/run
3638 # make sure the directory exists
3639 if test ! -d $piddir ; then
3640         piddir=`eval echo ${sysconfdir}`
3641         case $piddir in
3642                 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3643         esac
3644 fi
3645
3646 AC_ARG_WITH(pid-dir,
3647         [  --with-pid-dir=PATH     Specify location of ssh.pid file],
3648         [
3649                 if test -n "$withval"  &&  test "x$withval" != "xno"  &&  \
3650                     test "x${withval}" != "xyes"; then
3651                         piddir=$withval
3652                         if test ! -d $piddir ; then
3653                         AC_MSG_WARN([** no $piddir directory on this system **])
3654                         fi
3655                 fi
3656         ]
3657 )
3658
3659 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3660 AC_SUBST(piddir)
3661
3662 dnl allow user to disable some login recording features
3663 AC_ARG_ENABLE(lastlog,
3664         [  --disable-lastlog       disable use of lastlog even if detected [no]],
3665         [
3666                 if test "x$enableval" = "xno" ; then
3667                         AC_DEFINE(DISABLE_LASTLOG)
3668                 fi
3669         ]
3670 )
3671 AC_ARG_ENABLE(utmp,
3672         [  --disable-utmp          disable use of utmp even if detected [no]],
3673         [
3674                 if test "x$enableval" = "xno" ; then
3675                         AC_DEFINE(DISABLE_UTMP)
3676                 fi
3677         ]
3678 )
3679 AC_ARG_ENABLE(utmpx,
3680         [  --disable-utmpx         disable use of utmpx even if detected [no]],
3681         [
3682                 if test "x$enableval" = "xno" ; then
3683                         AC_DEFINE(DISABLE_UTMPX, 1,
3684                                 [Define if you don't want to use utmpx])
3685                 fi
3686         ]
3687 )
3688 AC_ARG_ENABLE(wtmp,
3689         [  --disable-wtmp          disable use of wtmp even if detected [no]],
3690         [
3691                 if test "x$enableval" = "xno" ; then
3692                         AC_DEFINE(DISABLE_WTMP)
3693                 fi
3694         ]
3695 )
3696 AC_ARG_ENABLE(wtmpx,
3697         [  --disable-wtmpx         disable use of wtmpx even if detected [no]],
3698         [
3699                 if test "x$enableval" = "xno" ; then
3700                         AC_DEFINE(DISABLE_WTMPX, 1,
3701                                 [Define if you don't want to use wtmpx])
3702                 fi
3703         ]
3704 )
3705 AC_ARG_ENABLE(libutil,
3706         [  --disable-libutil       disable use of libutil (login() etc.) [no]],
3707         [
3708                 if test "x$enableval" = "xno" ; then
3709                         AC_DEFINE(DISABLE_LOGIN)
3710                 fi
3711         ]
3712 )
3713 AC_ARG_ENABLE(pututline,
3714         [  --disable-pututline     disable use of pututline() etc. ([uw]tmp) [no]],
3715         [
3716                 if test "x$enableval" = "xno" ; then
3717                         AC_DEFINE(DISABLE_PUTUTLINE, 1,
3718                                 [Define if you don't want to use pututline()
3719                                 etc. to write [uw]tmp])
3720                 fi
3721         ]
3722 )
3723 AC_ARG_ENABLE(pututxline,
3724         [  --disable-pututxline    disable use of pututxline() etc. ([uw]tmpx) [no]],
3725         [
3726                 if test "x$enableval" = "xno" ; then
3727                         AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3728                                 [Define if you don't want to use pututxline()
3729                                 etc. to write [uw]tmpx])
3730                 fi
3731         ]
3732 )
3733 AC_ARG_WITH(lastlog,
3734   [  --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3735         [
3736                 if test "x$withval" = "xno" ; then
3737                         AC_DEFINE(DISABLE_LASTLOG)
3738                 elif test -n "$withval"  &&  test "x${withval}" != "xyes"; then
3739                         conf_lastlog_location=$withval
3740                 fi
3741         ]
3742 )
3743
3744 dnl lastlog, [uw]tmpx? detection
3745 dnl  NOTE: set the paths in the platform section to avoid the
3746 dnl   need for command-line parameters
3747 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3748
3749 dnl lastlog detection
3750 dnl  NOTE: the code itself will detect if lastlog is a directory
3751 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3752 AC_TRY_COMPILE([
3753 #include <sys/types.h>
3754 #include <utmp.h>
3755 #ifdef HAVE_LASTLOG_H
3756 #  include <lastlog.h>
3757 #endif
3758 #ifdef HAVE_PATHS_H
3759 #  include <paths.h>
3760 #endif
3761 #ifdef HAVE_LOGIN_H
3762 # include <login.h>
3763 #endif
3764         ],
3765         [ char *lastlog = LASTLOG_FILE; ],
3766         [ AC_MSG_RESULT(yes) ],
3767         [
3768                 AC_MSG_RESULT(no)
3769                 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3770                 AC_TRY_COMPILE([
3771 #include <sys/types.h>
3772 #include <utmp.h>
3773 #ifdef HAVE_LASTLOG_H
3774 #  include <lastlog.h>
3775 #endif
3776 #ifdef HAVE_PATHS_H
3777 #  include <paths.h>
3778 #endif
3779                 ],
3780                 [ char *lastlog = _PATH_LASTLOG; ],
3781                 [ AC_MSG_RESULT(yes) ],
3782                 [
3783                         AC_MSG_RESULT(no)
3784                         system_lastlog_path=no
3785                 ])
3786         ]
3787 )
3788
3789 if test -z "$conf_lastlog_location"; then
3790         if test x"$system_lastlog_path" = x"no" ; then
3791                 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3792                                 if (test -d "$f" || test -f "$f") ; then
3793                                         conf_lastlog_location=$f
3794                                 fi
3795                 done
3796                 if test -z "$conf_lastlog_location"; then
3797                         AC_MSG_WARN([** Cannot find lastlog **])
3798                         dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3799                 fi
3800         fi
3801 fi
3802
3803 if test -n "$conf_lastlog_location"; then
3804         AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3805                 [Define if you want to specify the path to your lastlog file])
3806 fi
3807
3808 dnl utmp detection
3809 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3810 AC_TRY_COMPILE([
3811 #include <sys/types.h>
3812 #include <utmp.h>
3813 #ifdef HAVE_PATHS_H
3814 #  include <paths.h>
3815 #endif
3816         ],
3817         [ char *utmp = UTMP_FILE; ],
3818         [ AC_MSG_RESULT(yes) ],
3819         [ AC_MSG_RESULT(no)
3820           system_utmp_path=no ]
3821 )
3822 if test -z "$conf_utmp_location"; then
3823         if test x"$system_utmp_path" = x"no" ; then
3824                 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3825                         if test -f $f ; then
3826                                 conf_utmp_location=$f
3827                         fi
3828                 done
3829                 if test -z "$conf_utmp_location"; then
3830                         AC_DEFINE(DISABLE_UTMP)
3831                 fi
3832         fi
3833 fi
3834 if test -n "$conf_utmp_location"; then
3835         AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3836                 [Define if you want to specify the path to your utmp file])
3837 fi
3838
3839 dnl wtmp detection
3840 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3841 AC_TRY_COMPILE([
3842 #include <sys/types.h>
3843 #include <utmp.h>
3844 #ifdef HAVE_PATHS_H
3845 #  include <paths.h>
3846 #endif
3847         ],
3848         [ char *wtmp = WTMP_FILE; ],
3849         [ AC_MSG_RESULT(yes) ],
3850         [ AC_MSG_RESULT(no)
3851           system_wtmp_path=no ]
3852 )
3853 if test -z "$conf_wtmp_location"; then
3854         if test x"$system_wtmp_path" = x"no" ; then
3855                 for f in /usr/adm/wtmp /var/log/wtmp; do
3856                         if test -f $f ; then
3857                                 conf_wtmp_location=$f
3858                         fi
3859                 done
3860                 if test -z "$conf_wtmp_location"; then
3861                         AC_DEFINE(DISABLE_WTMP)
3862                 fi
3863         fi
3864 fi
3865 if test -n "$conf_wtmp_location"; then
3866         AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3867                 [Define if you want to specify the path to your wtmp file])
3868 fi
3869
3870
3871 dnl utmpx detection - I don't know any system so perverse as to require
3872 dnl  utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3873 dnl  there, though.
3874 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3875 AC_TRY_COMPILE([
3876 #include <sys/types.h>
3877 #include <utmp.h>
3878 #ifdef HAVE_UTMPX_H
3879 #include <utmpx.h>
3880 #endif
3881 #ifdef HAVE_PATHS_H
3882 #  include <paths.h>
3883 #endif
3884         ],
3885         [ char *utmpx = UTMPX_FILE; ],
3886         [ AC_MSG_RESULT(yes) ],
3887         [ AC_MSG_RESULT(no)
3888           system_utmpx_path=no ]
3889 )
3890 if test -z "$conf_utmpx_location"; then
3891         if test x"$system_utmpx_path" = x"no" ; then
3892                 AC_DEFINE(DISABLE_UTMPX)
3893         fi
3894 else
3895         AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3896                 [Define if you want to specify the path to your utmpx file])
3897 fi
3898
3899 dnl wtmpx detection
3900 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3901 AC_TRY_COMPILE([
3902 #include <sys/types.h>
3903 #include <utmp.h>
3904 #ifdef HAVE_UTMPX_H
3905 #include <utmpx.h>
3906 #endif
3907 #ifdef HAVE_PATHS_H
3908 #  include <paths.h>
3909 #endif
3910         ],
3911         [ char *wtmpx = WTMPX_FILE; ],
3912         [ AC_MSG_RESULT(yes) ],
3913         [ AC_MSG_RESULT(no)
3914           system_wtmpx_path=no ]
3915 )
3916 if test -z "$conf_wtmpx_location"; then
3917         if test x"$system_wtmpx_path" = x"no" ; then
3918                 AC_DEFINE(DISABLE_WTMPX)
3919         fi
3920 else
3921         AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3922                 [Define if you want to specify the path to your wtmpx file])
3923 fi
3924
3925
3926 if test ! -z "$blibpath" ; then
3927         LDFLAGS="$LDFLAGS $blibflags$blibpath"
3928         AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3929 fi
3930
3931 dnl remove pam and dl because they are in $LIBPAM
3932 if test "$PAM_MSG" = yes ; then
3933         LIBS=`echo $LIBS | sed 's/-lpam //'`
3934 fi
3935 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3936         LIBS=`echo $LIBS | sed 's/-ldl //'`
3937 fi
3938
3939 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3940 dnl Add now.
3941 CFLAGS="$CFLAGS $werror_flags"
3942
3943 AC_EXEEXT
3944 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3945         scard/Makefile ssh_prng_cmds survey.sh])
3946 AC_OUTPUT
3947
3948 # Print summary of options
3949
3950 # Someone please show me a better way :)
3951 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3952 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3953 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3954 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3955 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3956 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3957 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3958 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3959 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3960 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3961
3962 echo ""
3963 echo "OpenSSH has been configured with the following options:"
3964 echo "                     User binaries: $B"
3965 echo "                   System binaries: $C"
3966 echo "               Configuration files: $D"
3967 echo "                   Askpass program: $E"
3968 echo "                      Manual pages: $F"
3969 echo "                          PID file: $G"
3970 echo "  Privilege separation chroot path: $H"
3971 if test "x$external_path_file" = "x/etc/login.conf" ; then
3972 echo "   At runtime, sshd will use the path defined in $external_path_file"
3973 echo "   Make sure the path to scp is present, otherwise scp will not work"
3974 else
3975 echo "            sshd default user PATH: $I"
3976         if test ! -z "$external_path_file"; then
3977 echo "   (If PATH is set in $external_path_file it will be used instead. If"
3978 echo "   used, ensure the path to scp is present, otherwise scp will not work.)"
3979         fi
3980 fi
3981 if test ! -z "$superuser_path" ; then
3982 echo "          sshd superuser user PATH: $J"
3983 fi
3984 echo "                    Manpage format: $MANTYPE"
3985 echo "                       PAM support: $PAM_MSG"
3986 echo "                 KerberosV support: $KRB5_MSG"
3987 echo "                 Smartcard support: $SCARD_MSG"
3988 echo "                     S/KEY support: $SKEY_MSG"
3989 echo "              TCP Wrappers support: $TCPW_MSG"
3990 echo "              MD5 password support: $MD5_MSG"
3991 echo "                   libedit support: $LIBEDIT_MSG"
3992 echo "       IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3993 echo "           Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3994 echo "                  BSD Auth support: $BSD_AUTH_MSG"
3995 echo "              Random number source: $RAND_MSG"
3996 if test ! -z "$USE_RAND_HELPER" ; then
3997 echo "     ssh-rand-helper collects from: $RAND_HELPER_MSG"
3998 fi
3999
4000 echo ""
4001
4002 echo "              Host: ${host}"
4003 echo "          Compiler: ${CC}"
4004 echo "    Compiler flags: ${CFLAGS}"
4005 echo "Preprocessor flags: ${CPPFLAGS}"
4006 echo "      Linker flags: ${LDFLAGS}"
4007 echo "         Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
4008
4009 echo ""
4010
4011 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4012         echo "SVR4 style packages are supported with \"make package\""
4013         echo ""
4014 fi
4015
4016 if test "x$PAM_MSG" = "xyes" ; then
4017         echo "PAM is enabled. You may need to install a PAM control file "
4018         echo "for sshd, otherwise password authentication may fail. "
4019         echo "Example PAM control files can be found in the contrib/ "
4020         echo "subdirectory"
4021         echo ""
4022 fi
4023
4024 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4025         echo "WARNING: you are using the builtin random number collection "
4026         echo "service. Please read WARNING.RNG and request that your OS "
4027         echo "vendor includes kernel-based random number collection in "
4028         echo "future versions of your OS."
4029         echo ""
4030 fi
4031
4032 if test ! -z "$NO_PEERCHECK" ; then
4033         echo "WARNING: the operating system that you are using does not "
4034         echo "appear to support either the getpeereid() API nor the "
4035         echo "SO_PEERCRED getsockopt() option. These facilities are used to "
4036         echo "enforce security checks to prevent unauthorised connections to "
4037         echo "ssh-agent. Their absence increases the risk that a malicious "
4038         echo "user can connect to your agent. "
4039         echo ""
4040 fi
4041
4042 if test "$AUDIT_MODULE" = "bsm" ; then
4043         echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4044         echo "See the Solaris section in README.platform for details."
4045 fi
This page took 0.357678 seconds and 3 git commands to generate.