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