blob: 6954fb47e6c26c918d067f8b60e92c4808f50658 [file] [log] [blame]
Damien Miller36f49652004-08-15 18:40:59 +10001# $Id: configure.ac,v 1.225 2004/08/15 08:40:59 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
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.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
78
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110080if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100081 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110082fi
83
Tim Rice88368a32003-12-08 12:35:59 -080084AC_ARG_WITH(rpath,
85 [ --without-rpath Disable auto-added -R linker paths],
86 [
87 if test "x$withval" = "xno" ; then
88 need_dash_r=""
89 fi
90 if test "x$withval" = "xyes" ; then
91 need_dash_r=1
92 fi
93 ]
94)
95
Damien Millera22ba012000-03-02 23:09:20 +110096# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110097case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110098*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110099 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000100 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800101 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100102 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
108 fi
109 done
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
113 else
114 AC_MSG_RESULT($blibflags)
115 fi
116 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700119 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700121 LIBS="$LIBS -ls"
122 ])
123 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000124 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
125 AC_CHECK_DECL(loginfailed,
126 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
127 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000128 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [(void)loginfailed("user","host","tty",0);],
130 [AC_MSG_RESULT(yes)
131 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000132 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000133 )],
134 [],
135 [#include <usersec.h>]
136 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000137 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100138 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000139 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000140 AC_DEFINE(SETEUID_BREAKS_SETUID)
141 AC_DEFINE(BROKEN_SETREUID)
142 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000143 dnl AIX handles lastlog as part of its login message
144 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000146 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100147 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100148*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100149 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800150 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000152 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100153 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100154 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000155 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000156 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700157 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000158 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100159 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000160*-*-dgux*)
161 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100162 AC_DEFINE(SETEUID_BREAKS_SETUID)
163 AC_DEFINE(BROKEN_SETREUID)
164 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000165 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000166*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000167 AC_MSG_CHECKING(if we have working getaddrinfo)
168 AC_TRY_RUN([#include <mach-o/dyld.h>
169main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
170 exit(0);
171 else
172 exit(1);
173}], [AC_MSG_RESULT(working)],
174 [AC_MSG_RESULT(buggy)
175 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700176 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000177 AC_DEFINE(SETEUID_BREAKS_SETUID)
178 AC_DEFINE(BROKEN_SETREUID)
179 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100180 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000181 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000182*-*-hpux10.26)
183 if test -z "$GCC"; then
184 CFLAGS="$CFLAGS -Ae"
185 fi
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(HAVE_SECUREWARE)
189 AC_DEFINE(USE_PIPES)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000192 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000193 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700194 LIBS="$LIBS -lsec -lsecpw"
195 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000196 disable_ptmx_check=yes
197 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100198*-*-hpux10*)
199 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000200 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100201 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000202 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100203 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000204 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000205 AC_DEFINE(LOGIN_NO_ENDOPT)
206 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000207 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000208 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700209 LIBS="$LIBS -lsec"
210 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100211 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000212*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100214 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100215 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100216 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000217 AC_DEFINE(LOGIN_NO_ENDOPT)
218 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100219 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000220 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000221 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000222 check_for_hpux_broken_getaddrinfo=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700223 LIBS="$LIBS -lsec"
224 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000225 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100226*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100227 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000228 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000229 AC_DEFINE(SETEUID_BREAKS_SETUID)
230 AC_DEFINE(BROKEN_SETREUID)
231 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000232 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000233 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100234 ;;
235*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100236 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000237 AC_DEFINE(WITH_IRIX_ARRAY)
238 AC_DEFINE(WITH_IRIX_PROJECT)
239 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000240 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000241 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000242 AC_DEFINE(SETEUID_BREAKS_SETUID)
243 AC_DEFINE(BROKEN_SETREUID)
244 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000245 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000246 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000247 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100248 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100249*-*-linux*)
250 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100251 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000252 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100253 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000254 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000255 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000256 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000257 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Damien Miller7bcb0892000-03-11 20:45:40 +1100258 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000259 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000260 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000261 AC_DEFINE(BROKEN_CMSG_TYPE)
262 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000263 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100264 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000265mips-sony-bsd|mips-sony-newsos4)
266 AC_DEFINE(HAVE_NEWS4)
267 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000268 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100269*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000270 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800271 if test "x$withval" != "xno" ; then
272 need_dash_r=1
273 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100274 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100275*-*-freebsd*)
276 check_for_libcrypt_later=1
277 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000278*-*-bsdi*)
279 AC_DEFINE(SETEUID_BREAKS_SETUID)
280 AC_DEFINE(BROKEN_SETREUID)
281 AC_DEFINE(BROKEN_SETREGID)
282 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000283*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000284 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100285 conf_utmp_location=/etc/utmp
286 conf_wtmp_location=/usr/adm/wtmp
287 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000288 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000289 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000290 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100291 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000292 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100293*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800294 if test "x$withval" != "xno" ; then
295 need_dash_r=1
296 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100297 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000298 AC_DEFINE(LOGIN_NEEDS_UTMPX)
299 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000300 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000301 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000302 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
303 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000304 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000305 # hardwire lastlog location (can't detect it on some versions)
306 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000307 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
308 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
309 if test "$sol2ver" -ge 8; then
310 AC_MSG_RESULT(yes)
311 AC_DEFINE(DISABLE_UTMP)
312 AC_DEFINE(DISABLE_WTMP)
313 else
314 AC_MSG_RESULT(no)
315 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100316 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000317*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000318 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000319 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100320 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000321 conf_utmp_location=/etc/utmp
322 conf_wtmp_location=/var/adm/wtmp
323 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000324 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000325 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000326*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700327 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000328 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000329 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000330 AC_DEFINE(SETEUID_BREAKS_SETUID)
331 AC_DEFINE(BROKEN_SETREUID)
332 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000333 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000334*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700335 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000336 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100337 IPADDR_IN_DISPLAY=yes
338 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000339 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000343 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000344 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700345 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
346 # Attention: always take care to bind libsocket and libnsl before libc,
347 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000348 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100349*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100350 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700351 AC_DEFINE(SETEUID_BREAKS_SETUID)
352 AC_DEFINE(BROKEN_SETREUID)
353 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100354 ;;
355*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100356 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100360 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100361*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100362 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100363*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800364 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800365 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100366 RANLIB=true
367 no_dev_ptmx=1
368 AC_DEFINE(BROKEN_SYS_TERMIO_H)
369 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000370 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000371 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100372 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700373 AC_DEFINE(SETEUID_BREAKS_SETUID)
374 AC_DEFINE(BROKEN_SETREUID)
375 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700376 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100377 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700378 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700379 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700380 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100381 ;;
382*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800383 if test -z "$GCC"; then
384 CFLAGS="$CFLAGS -belf"
385 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100386 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000387 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100388 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000389 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000390 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700391 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700392 AC_DEFINE(SETEUID_BREAKS_SETUID)
393 AC_DEFINE(BROKEN_SETREUID)
394 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700395 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700396 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Miller217f5672001-02-16 12:12:41 +1100397 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700398 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700399 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000400 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000401*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100402 AC_DEFINE(NO_SSH_LASTLOG)
403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000406 AC_DEFINE(USE_PIPES)
407 AC_DEFINE(DISABLE_FD_PASSING)
408 LDFLAGS="$LDFLAGS"
409 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
410 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000411 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000412*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100413 AC_DEFINE(SETEUID_BREAKS_SETUID)
414 AC_DEFINE(BROKEN_SETREUID)
415 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000416 AC_DEFINE(WITH_ABBREV_NO_TTY)
417 AC_DEFINE(USE_PIPES)
418 AC_DEFINE(DISABLE_FD_PASSING)
419 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100420 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000421 MANTYPE=cat
422 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000423*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000427 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700428 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700429 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000430 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
431 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
432 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700433 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000434*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000435 AC_MSG_CHECKING(for Digital Unix SIA)
436 no_osfsia=""
437 AC_ARG_WITH(osfsia,
438 [ --with-osfsia Enable Digital Unix SIA],
439 [
440 if test "x$withval" = "xno" ; then
441 AC_MSG_RESULT(disabled)
442 no_osfsia=1
443 fi
444 ],
445 )
446 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000447 if test -f /etc/sia/matrix.conf; then
448 AC_MSG_RESULT(yes)
449 AC_DEFINE(HAVE_OSF_SIA)
450 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000451 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000452 LIBS="$LIBS -lsecurity -ldb -lm -laud"
453 else
454 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100455 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000456 fi
457 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000458 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700459 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000460 AC_DEFINE(BROKEN_SETREUID)
461 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000462 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000463
464*-*-nto-qnx)
465 AC_DEFINE(USE_PIPES)
466 AC_DEFINE(NO_X11_UNIX_SOCKETS)
467 AC_DEFINE(MISSING_NFDBITS)
468 AC_DEFINE(MISSING_HOWMANY)
469 AC_DEFINE(MISSING_FD_MASK)
470 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100471esac
472
Damien Millere37bfc12000-06-05 09:37:43 +1000473# Allow user to specify flags
474AC_ARG_WITH(cflags,
475 [ --with-cflags Specify additional flags to pass to compiler],
476 [
477 if test "x$withval" != "xno" ; then
478 CFLAGS="$CFLAGS $withval"
479 fi
480 ]
481)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000482AC_ARG_WITH(cppflags,
483 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
484 [
485 if test "x$withval" != "xno"; then
486 CPPFLAGS="$CPPFLAGS $withval"
487 fi
488 ]
489)
Damien Millere37bfc12000-06-05 09:37:43 +1000490AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000491 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000492 [
493 if test "x$withval" != "xno" ; then
494 LDFLAGS="$LDFLAGS $withval"
495 fi
496 ]
497)
498AC_ARG_WITH(libs,
499 [ --with-libs Specify additional libraries to link with],
500 [
501 if test "x$withval" != "xno" ; then
502 LIBS="$LIBS $withval"
503 fi
504 ]
505)
506
Darren Tucker6eb93042003-06-29 21:30:41 +1000507AC_MSG_CHECKING(compiler and flags for sanity)
508AC_TRY_RUN([
509#include <stdio.h>
510int main(){exit(0);}
511 ],
512 [ AC_MSG_RESULT(yes) ],
513 [
514 AC_MSG_RESULT(no)
515 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
516 ]
517)
518
Tim Rice4cec93f2002-02-26 08:40:48 -0800519# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000520AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
521 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
522 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100523 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000524 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000525 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
526 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
527 sys/pstat.h sys/ptms.h sys/select.h sys/stat.h sys/stream.h \
528 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
529 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800530
Damien Millera22ba012000-03-02 23:09:20 +1100531# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700532AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
533AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000534
Damien Millerdf288022001-02-18 13:07:07 +1100535dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700536if test "x$with_tcp_wrappers" != "xno" ; then
537 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
538 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
539 fi
540fi
Damien Millerdf288022001-02-18 13:07:07 +1100541
Tim Rice1e1ef642003-09-11 22:19:31 -0700542dnl IRIX and Solaris 2.5.1 have dirname() in libgen
543AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
544 AC_CHECK_LIB(gen, dirname,[
545 AC_CACHE_CHECK([for broken dirname],
546 ac_cv_have_broken_dirname, [
547 save_LIBS="$LIBS"
548 LIBS="$LIBS -lgen"
549 AC_TRY_RUN(
550 [
551#include <libgen.h>
552#include <string.h>
553
554int main(int argc, char **argv) {
555 char *s, buf[32];
556
557 strncpy(buf,"/etc", 32);
558 s = dirname(buf);
559 if (!s || strncmp(s, "/", 32) != 0) {
560 exit(1);
561 } else {
562 exit(0);
563 }
564}
565 ],
566 [ ac_cv_have_broken_dirname="no" ],
567 [ ac_cv_have_broken_dirname="yes" ]
568 )
569 LIBS="$save_LIBS"
570 ])
571 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
572 LIBS="$LIBS -lgen"
573 AC_DEFINE(HAVE_DIRNAME)
574 AC_CHECK_HEADERS(libgen.h)
575 fi
576 ])
577])
578
579AC_CHECK_FUNC(getspnam, ,
580 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
581AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
582
Tim Rice13aae5e2001-10-21 17:53:58 -0700583dnl zlib is required
584AC_ARG_WITH(zlib,
585 [ --with-zlib=PATH Use zlib in PATH],
586 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000587 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100588 AC_MSG_ERROR([*** zlib is required ***])
589 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700590 if test -d "$withval/lib"; then
591 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700592 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700593 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700594 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700595 fi
596 else
597 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700598 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700599 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700600 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700601 fi
602 fi
603 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700604 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700605 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700606 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 fi
608 ]
609)
610
Tim Ricefcb62202004-01-23 18:35:16 -0800611AC_CHECK_LIB(z, deflate, ,
612 [
613 saved_CPPFLAGS="$CPPFLAGS"
614 saved_LDFLAGS="$LDFLAGS"
615 save_LIBS="$LIBS"
616 dnl Check default zlib install dir
617 if test -n "${need_dash_r}"; then
618 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
619 else
620 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
621 fi
622 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
623 LIBS="$LIBS -lz"
624 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
625 [
626 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
627 ]
628 )
629 ]
630)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100631AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100632
633AC_ARG_WITH(zlib-version-check,
634 [ --without-zlib-version-check Disable zlib version check],
635 [ if test "x$withval" = "xno" ; then
636 zlib_check_nonfatal=1
637 fi
638 ]
639)
640
Darren Tucker2dcd2392004-01-23 17:13:33 +1100641AC_MSG_CHECKING(for zlib 1.1.4 or greater)
642AC_TRY_RUN([
643#include <zlib.h>
644int main()
645{
646 int a, b, c, v;
647 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
648 exit(1);
649 v = a*1000000 + b*1000 + c;
650 if (v >= 1001004)
651 exit(0);
652 exit(2);
653}
654 ],
655 AC_MSG_RESULT(yes),
656 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100657 if test -z "$zlib_check_nonfatal" ; then
658 AC_MSG_ERROR([*** zlib too old - check config.log ***
659Your reported zlib version has known security problems. It's possible your
660vendor has fixed these problems without changing the version number. If you
661are sure this is the case, you can disable the check by running
662"./configure --without-zlib-version-check".
663If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
664 else
665 AC_MSG_WARN([zlib version may have security problems])
666 fi
667 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100668)
Damien Miller6f9c3372000-10-25 10:06:04 +1100669
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000670dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100671AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000672 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
673)
Damien Millera8e06ce2003-11-21 23:48:55 +1100674AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700675 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
676 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000677)
Damien Millerab18c411999-11-11 10:40:23 +1100678
Tim Ricee589a292001-11-03 11:09:32 -0800679dnl Checks for libutil functions
680AC_CHECK_HEADERS(libutil.h)
681AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
682AC_CHECK_FUNCS(logout updwtmp logwtmp)
683
Ben Lindstrom8697e082001-02-24 21:41:10 +0000684AC_FUNC_STRFTIME
685
Damien Miller3c027682001-03-14 11:39:45 +1100686# Check for ALTDIRFUNC glob() extension
687AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
688AC_EGREP_CPP(FOUNDIT,
689 [
690 #include <glob.h>
691 #ifdef GLOB_ALTDIRFUNC
692 FOUNDIT
693 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100694 ],
Damien Miller3c027682001-03-14 11:39:45 +1100695 [
696 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
697 AC_MSG_RESULT(yes)
698 ],
699 [
700 AC_MSG_RESULT(no)
701 ]
702)
Damien Millerab18c411999-11-11 10:40:23 +1100703
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000704# Check for g.gl_matchc glob() extension
705AC_MSG_CHECKING(for gl_matchc field in glob_t)
706AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100707 [
708 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000709 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100710 ],
711 [
712 AC_DEFINE(GLOB_HAS_GL_MATCHC)
713 AC_MSG_RESULT(yes)
714 ],
715 [
716 AC_MSG_RESULT(no)
717 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000718)
719
Damien Miller18bb4732001-03-28 14:35:30 +1000720AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
721AC_TRY_RUN(
722 [
723#include <sys/types.h>
724#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700725int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000726 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100727 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000728 [
729 AC_MSG_RESULT(no)
730 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
731 ]
732)
733
Damien Miller36f49652004-08-15 18:40:59 +1000734AC_MSG_CHECKING([for /proc/pid/fd directory])
735if test -d "/proc/$$/fd" ; then
736 AC_DEFINE(HAVE_PROC_PID)
737 AC_MSG_RESULT(yes)
738else
739 AC_MSG_RESULT(no)
740fi
741
Damien Millerc547bf12001-02-16 10:18:12 +1100742# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100743SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100744AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700745 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100746 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100747 [
748 if test "x$withval" != "xno" ; then
749
750 if test "x$withval" != "xyes" ; then
751 CPPFLAGS="$CPPFLAGS -I${withval}/include"
752 LDFLAGS="$LDFLAGS -L${withval}/lib"
753 fi
754
755 AC_DEFINE(SKEY)
756 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100757 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100758
Tim Rice4cec93f2002-02-26 08:40:48 -0800759 AC_MSG_CHECKING([for s/key support])
760 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100761 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800762#include <stdio.h>
763#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700764int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800765 ],
766 [AC_MSG_RESULT(yes)],
767 [
768 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100769 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
770 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000771 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
772 AC_TRY_COMPILE(
773 [#include <stdio.h>
774 #include <skey.h>],
775 [(void)skeychallenge(NULL,"name","",0);],
776 [AC_MSG_RESULT(yes)
777 AC_DEFINE(SKEYCHALLENGE_4ARG)],
778 [AC_MSG_RESULT(no)]
779 )
Damien Millerc547bf12001-02-16 10:18:12 +1100780 fi
781 ]
782)
783
784# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700785TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100786AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700787 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100788 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100789 [
790 if test "x$withval" != "xno" ; then
791 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700792 saved_LDFLAGS="$LDFLAGS"
793 saved_CPPFLAGS="$CPPFLAGS"
794 if test -n "${withval}" -a "${withval}" != "yes"; then
795 if test -d "${withval}/lib"; then
796 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700797 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700798 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700799 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700800 fi
801 else
802 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700803 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700804 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700805 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700806 fi
807 fi
808 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700809 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700810 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700811 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700812 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700813 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800814 LIBWRAP="-lwrap"
815 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100816 AC_MSG_CHECKING(for libwrap)
817 AC_TRY_LINK(
818 [
Damien Miller0ac45002004-04-14 20:14:26 +1000819#include <sys/types.h>
820#include <sys/socket.h>
821#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100822#include <tcpd.h>
823 int deny_severity = 0, allow_severity = 0;
824 ],
825 [hosts_access(0);],
826 [
827 AC_MSG_RESULT(yes)
828 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800829 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700830 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100831 ],
832 [
833 AC_MSG_ERROR([*** libwrap missing])
834 ]
835 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800836 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100837 fi
838 ]
839)
840
Damien Millerfe1f1432003-02-24 15:45:42 +1100841dnl Checks for library functions. Please keep in alphabetical order
842AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000843 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Damien Miller36f49652004-08-15 18:40:59 +1000844 bindresvport_sa clock closefrom dirfd fchmod fchown freeaddrinfo \
845 futimes getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000846 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100847 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000848 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100849 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000850 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100851 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000852 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000853 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100854 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100855)
Tim Rice13aae5e2001-10-21 17:53:58 -0700856
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000857# IRIX has a const char return value for gai_strerror()
858AC_CHECK_FUNCS(gai_strerror,[
859 AC_DEFINE(HAVE_GAI_STRERROR)
860 AC_TRY_COMPILE([
861#include <sys/types.h>
862#include <sys/socket.h>
863#include <netdb.h>
864
865const char *gai_strerror(int);],[
866char *str;
867
868str = gai_strerror(0);],[
869 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
870 [Define if gai_strerror() returns const char *])])])
871
Damien Millercd6853c2003-01-28 11:33:42 +1100872AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
873
Darren Tuckerf1159b52003-07-07 19:44:01 +1000874dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000875AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000876AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000877
Darren Tuckerb2427c82003-09-10 15:22:44 +1000878dnl tcsendbreak might be a macro
879AC_CHECK_DECL(tcsendbreak,
880 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100881 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000882 [#include <termios.h>]
883)
884
Darren Tucker5bb14002004-04-23 18:53:10 +1000885AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
886
Darren Tucker2a6b0292003-12-31 14:59:17 +1100887AC_CHECK_FUNCS(setresuid, [
888 dnl Some platorms have setresuid that isn't implemented, test for this
889 AC_MSG_CHECKING(if setresuid seems to work)
890 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100891#include <stdlib.h>
892#include <errno.h>
893int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100894 ],
895 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100896 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100897 AC_MSG_RESULT(not implemented)]
898 )
899])
Darren Tuckere937be32003-12-17 18:53:26 +1100900
Darren Tucker2a6b0292003-12-31 14:59:17 +1100901AC_CHECK_FUNCS(setresgid, [
902 dnl Some platorms have setresgid that isn't implemented, test for this
903 AC_MSG_CHECKING(if setresgid seems to work)
904 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100905#include <stdlib.h>
906#include <errno.h>
907int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100908 ],
909 [AC_MSG_RESULT(yes)],
910 [AC_DEFINE(BROKEN_SETRESGID)
911 AC_MSG_RESULT(not implemented)]
912 )
913])
Darren Tuckere937be32003-12-17 18:53:26 +1100914
Damien Millerad833b32000-08-23 10:46:23 +1000915dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000916AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000917dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000918AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000919AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000920dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000921AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000922AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100923
Damien Millera8e06ce2003-11-21 23:48:55 +1100924AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100925 [AC_DEFINE(HAVE_DAEMON)],
926 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
927)
928
Damien Millera8e06ce2003-11-21 23:48:55 +1100929AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100930 [AC_DEFINE(HAVE_GETPAGESIZE)],
931 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
932)
933
Damien Millercb170cb2000-07-01 16:52:55 +1000934# Check for broken snprintf
935if test "x$ac_cv_func_snprintf" = "xyes" ; then
936 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
937 AC_TRY_RUN(
938 [
939#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700940int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000941 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100942 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000943 [
944 AC_MSG_RESULT(no)
945 AC_DEFINE(BROKEN_SNPRINTF)
946 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
947 ]
948 )
949fi
950
Damien Millerb4097182004-05-23 14:09:40 +1000951# Check for missing getpeereid (or equiv) support
952NO_PEERCHECK=""
953if test "x$ac_cv_func_getpeereid" != "xyes" ; then
954 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
955 AC_TRY_COMPILE(
956 [#include <sys/types.h>
957 #include <sys/socket.h>],
958 [int i = SO_PEERCRED;],
959 [AC_MSG_RESULT(yes)],
960 [AC_MSG_RESULT(no)
961 NO_PEERCHECK=1]
962 )
963fi
964
Damien Millere8328192003-01-07 15:18:32 +1100965dnl see whether mkstemp() requires XXXXXX
966if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
967AC_MSG_CHECKING([for (overly) strict mkstemp])
968AC_TRY_RUN(
969 [
970#include <stdlib.h>
971main() { char template[]="conftest.mkstemp-test";
972if (mkstemp(template) == -1)
973 exit(1);
974unlink(template); exit(0);
975}
976 ],
977 [
978 AC_MSG_RESULT(no)
979 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100980 [
Damien Millere8328192003-01-07 15:18:32 +1100981 AC_MSG_RESULT(yes)
982 AC_DEFINE(HAVE_STRICT_MKSTEMP)
983 ],
984 [
985 AC_MSG_RESULT(yes)
986 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100987 ]
Damien Millere8328192003-01-07 15:18:32 +1100988)
989fi
990
Darren Tucker70a3d552003-08-21 17:58:29 +1000991dnl make sure that openpty does not reacquire controlling terminal
992if test ! -z "$check_for_openpty_ctty_bug"; then
993 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
994 AC_TRY_RUN(
995 [
996#include <stdio.h>
997#include <sys/fcntl.h>
998#include <sys/types.h>
999#include <sys/wait.h>
1000
1001int
1002main()
1003{
1004 pid_t pid;
1005 int fd, ptyfd, ttyfd, status;
1006
1007 pid = fork();
1008 if (pid < 0) { /* failed */
1009 exit(1);
1010 } else if (pid > 0) { /* parent */
1011 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001012 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001013 exit(WEXITSTATUS(status));
1014 else
1015 exit(2);
1016 } else { /* child */
1017 close(0); close(1); close(2);
1018 setsid();
1019 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1020 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1021 if (fd >= 0)
1022 exit(3); /* Acquired ctty: broken */
1023 else
1024 exit(0); /* Did not acquire ctty: OK */
1025 }
1026}
1027 ],
1028 [
1029 AC_MSG_RESULT(yes)
1030 ],
1031 [
1032 AC_MSG_RESULT(no)
1033 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1034 ]
1035 )
1036fi
1037
Darren Tucker4398cf52004-04-06 21:39:02 +10001038if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1039 AC_MSG_CHECKING(if getaddrinfo seems to work)
1040 AC_TRY_RUN(
1041 [
1042#include <stdio.h>
1043#include <sys/socket.h>
1044#include <netdb.h>
1045#include <errno.h>
1046#include <netinet/in.h>
1047
1048#define TEST_PORT "2222"
1049
1050int
1051main(void)
1052{
1053 int err, sock;
1054 struct addrinfo *gai_ai, *ai, hints;
1055 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1056
1057 memset(&hints, 0, sizeof(hints));
1058 hints.ai_family = PF_UNSPEC;
1059 hints.ai_socktype = SOCK_STREAM;
1060 hints.ai_flags = AI_PASSIVE;
1061
1062 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1063 if (err != 0) {
1064 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1065 exit(1);
1066 }
1067
1068 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1069 if (ai->ai_family != AF_INET6)
1070 continue;
1071
1072 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1073 sizeof(ntop), strport, sizeof(strport),
1074 NI_NUMERICHOST|NI_NUMERICSERV);
1075
1076 if (err != 0) {
1077 if (err == EAI_SYSTEM)
1078 perror("getnameinfo EAI_SYSTEM");
1079 else
1080 fprintf(stderr, "getnameinfo failed: %s\n",
1081 gai_strerror(err));
1082 exit(2);
1083 }
1084
1085 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1086 if (sock < 0)
1087 perror("socket");
1088 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1089 if (errno == EBADF)
1090 exit(3);
1091 }
1092 }
1093 exit(0);
1094}
1095 ],
1096 [
1097 AC_MSG_RESULT(yes)
1098 ],
1099 [
1100 AC_MSG_RESULT(no)
1101 AC_DEFINE(BROKEN_GETADDRINFO)
1102 ]
1103 )
1104fi
1105
Damien Miller606f8802000-09-16 15:39:56 +11001106AC_FUNC_GETPGRP
1107
Damien Millera64b57a2001-01-17 10:44:13 +11001108# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001109PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001110AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001111 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001112 [
Damien Millera64b57a2001-01-17 10:44:13 +11001113 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001114 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1115 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001116 AC_MSG_ERROR([PAM headers not found])
1117 fi
1118
1119 AC_CHECK_LIB(dl, dlopen, , )
1120 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1121 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001122 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001123
Damien Millera64b57a2001-01-17 10:44:13 +11001124 PAM_MSG="yes"
1125
1126 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001127 if test $ac_cv_lib_dl_dlopen = yes; then
1128 LIBPAM="-lpam -ldl"
1129 else
1130 LIBPAM="-lpam"
1131 fi
1132 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001133 fi
1134 ]
1135)
Damien Millera22ba012000-03-02 23:09:20 +11001136
Damien Millera64b57a2001-01-17 10:44:13 +11001137# Check for older PAM
1138if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001139 # Check PAM strerror arguments (old PAM)
1140 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1141 AC_TRY_COMPILE(
1142 [
Damien Miller81171112000-04-23 11:14:01 +10001143#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001144#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001145#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001146#elif defined (HAVE_PAM_PAM_APPL_H)
1147#include <pam/pam_appl.h>
1148#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001149 ],
1150 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001151 [AC_MSG_RESULT(no)],
1152 [
1153 AC_DEFINE(HAVE_OLD_PAM)
1154 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001155 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001156 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001157 )
Damien Millera22ba012000-03-02 23:09:20 +11001158fi
1159
Tim Riceaef73712002-05-11 13:17:42 -07001160# Search for OpenSSL
1161saved_CPPFLAGS="$CPPFLAGS"
1162saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001163AC_ARG_WITH(ssl-dir,
1164 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1165 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001166 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001167 if test -d "$withval/lib"; then
1168 if test -n "${need_dash_r}"; then
1169 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1170 else
1171 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1172 fi
1173 else
1174 if test -n "${need_dash_r}"; then
1175 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1176 else
1177 LDFLAGS="-L${withval} ${LDFLAGS}"
1178 fi
1179 fi
1180 if test -d "$withval/include"; then
1181 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1182 else
1183 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1184 fi
Damien Millera22ba012000-03-02 23:09:20 +11001185 fi
1186 ]
1187)
Tim Rice3d5352e2004-02-12 09:27:21 -08001188LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001189AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001190 [
Tim Riceaef73712002-05-11 13:17:42 -07001191 dnl Check default openssl install dir
1192 if test -n "${need_dash_r}"; then
1193 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001194 else
Tim Riceaef73712002-05-11 13:17:42 -07001195 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001196 fi
Tim Riceaef73712002-05-11 13:17:42 -07001197 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1198 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1199 [
1200 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1201 ]
1202 )
1203 ]
1204)
1205
Tim Riced730b782002-08-13 18:52:10 -07001206# Determine OpenSSL header version
1207AC_MSG_CHECKING([OpenSSL header version])
1208AC_TRY_RUN(
1209 [
1210#include <stdio.h>
1211#include <string.h>
1212#include <openssl/opensslv.h>
1213#define DATA "conftest.sslincver"
1214int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001215 FILE *fd;
1216 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001217
Damien Millera8e06ce2003-11-21 23:48:55 +11001218 fd = fopen(DATA,"w");
1219 if(fd == NULL)
1220 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001221
1222 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1223 exit(1);
1224
1225 exit(0);
1226}
1227 ],
1228 [
1229 ssl_header_ver=`cat conftest.sslincver`
1230 AC_MSG_RESULT($ssl_header_ver)
1231 ],
1232 [
1233 AC_MSG_RESULT(not found)
1234 AC_MSG_ERROR(OpenSSL version header not found.)
1235 ]
1236)
1237
1238# Determine OpenSSL library version
1239AC_MSG_CHECKING([OpenSSL library version])
1240AC_TRY_RUN(
1241 [
1242#include <stdio.h>
1243#include <string.h>
1244#include <openssl/opensslv.h>
1245#include <openssl/crypto.h>
1246#define DATA "conftest.ssllibver"
1247int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001248 FILE *fd;
1249 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001250
Damien Millera8e06ce2003-11-21 23:48:55 +11001251 fd = fopen(DATA,"w");
1252 if(fd == NULL)
1253 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001254
1255 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1256 exit(1);
1257
1258 exit(0);
1259}
1260 ],
1261 [
1262 ssl_library_ver=`cat conftest.ssllibver`
1263 AC_MSG_RESULT($ssl_library_ver)
1264 ],
1265 [
1266 AC_MSG_RESULT(not found)
1267 AC_MSG_ERROR(OpenSSL library not found.)
1268 ]
1269)
Damien Millera22ba012000-03-02 23:09:20 +11001270
Damien Millerec932372002-01-22 22:16:03 +11001271# Sanity check OpenSSL headers
1272AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1273AC_TRY_RUN(
1274 [
1275#include <string.h>
1276#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001277int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001278 ],
1279 [
1280 AC_MSG_RESULT(yes)
1281 ],
1282 [
1283 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001284 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1285Check config.log for details.
1286Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001287 ]
1288)
1289
Tim Rice3d5352e2004-02-12 09:27:21 -08001290# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1291# because the system crypt() is more featureful.
1292if test "x$check_for_libcrypt_before" = "x1"; then
1293 AC_CHECK_LIB(crypt, crypt)
1294fi
1295
Damien Millera8e06ce2003-11-21 23:48:55 +11001296# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001297# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001298if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001299 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001300fi
1301
Damien Miller6c21c512002-01-22 21:57:53 +11001302
1303### Configure cryptographic random number support
1304
1305# Check wheter OpenSSL seeds itself
1306AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1307AC_TRY_RUN(
1308 [
1309#include <string.h>
1310#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001311int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001312 ],
1313 [
1314 OPENSSL_SEEDS_ITSELF=yes
1315 AC_MSG_RESULT(yes)
1316 ],
1317 [
1318 AC_MSG_RESULT(no)
1319 # Default to use of the rand helper if OpenSSL doesn't
1320 # seed itself
1321 USE_RAND_HELPER=yes
1322 ]
1323)
1324
1325
1326# Do we want to force the use of the rand helper?
1327AC_ARG_WITH(rand-helper,
1328 [ --with-rand-helper Use subprocess to gather strong randomness ],
1329 [
1330 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001331 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001332 # the previous test showed it to be unseeded.
1333 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1334 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1335 OPENSSL_SEEDS_ITSELF=yes
1336 USE_RAND_HELPER=""
1337 fi
1338 else
1339 USE_RAND_HELPER=yes
1340 fi
1341 ],
1342)
1343
1344# Which randomness source do we use?
1345if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1346 # OpenSSL only
1347 AC_DEFINE(OPENSSL_PRNG_ONLY)
1348 RAND_MSG="OpenSSL internal ONLY"
1349 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001350elif test ! -z "$USE_RAND_HELPER" ; then
1351 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001352 RAND_MSG="ssh-rand-helper"
1353 INSTALL_SSH_RAND_HELPER="yes"
1354fi
1355AC_SUBST(INSTALL_SSH_RAND_HELPER)
1356
1357### Configuration of ssh-rand-helper
1358
1359# PRNGD TCP socket
1360AC_ARG_WITH(prngd-port,
1361 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1362 [
Damien Millere996d722002-01-23 11:20:59 +11001363 case "$withval" in
1364 no)
1365 withval=""
1366 ;;
1367 [[0-9]]*)
1368 ;;
1369 *)
1370 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1371 ;;
1372 esac
1373 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001374 PRNGD_PORT="$withval"
1375 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1376 fi
1377 ]
1378)
1379
1380# PRNGD Unix domain socket
1381AC_ARG_WITH(prngd-socket,
1382 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1383 [
Damien Millere996d722002-01-23 11:20:59 +11001384 case "$withval" in
1385 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001386 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001387 ;;
1388 no)
1389 withval=""
1390 ;;
1391 /*)
1392 ;;
1393 *)
1394 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1395 ;;
1396 esac
1397
1398 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001399 if test ! -z "$PRNGD_PORT" ; then
1400 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1401 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001402 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001403 AC_MSG_WARN(Entropy socket is not readable)
1404 fi
1405 PRNGD_SOCKET="$withval"
1406 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1407 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001408 ],
1409 [
1410 # Check for existing socket only if we don't have a random device already
1411 if test "$USE_RAND_HELPER" = yes ; then
1412 AC_MSG_CHECKING(for PRNGD/EGD socket)
1413 # Insert other locations here
1414 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1415 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1416 PRNGD_SOCKET="$sock"
1417 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1418 break;
1419 fi
1420 done
1421 if test ! -z "$PRNGD_SOCKET" ; then
1422 AC_MSG_RESULT($PRNGD_SOCKET)
1423 else
1424 AC_MSG_RESULT(not found)
1425 fi
1426 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001427 ]
1428)
1429
1430# Change default command timeout for hashing entropy source
1431entropy_timeout=200
1432AC_ARG_WITH(entropy-timeout,
1433 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1434 [
1435 if test "x$withval" != "xno" ; then
1436 entropy_timeout=$withval
1437 fi
1438 ]
1439)
Damien Miller6c21c512002-01-22 21:57:53 +11001440AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1441
Damien Millerd3f6ad22002-06-25 10:24:47 +10001442SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001443AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001444 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001445 [
1446 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001447 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001448 fi
1449 ]
1450)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001451AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1452AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001453
Tim Rice88f2ab52002-03-17 12:17:34 -08001454# We do this little dance with the search path to insure
1455# that programs that we select for use by installed programs
1456# (which may be run by the super-user) come from trusted
1457# locations before they come from the user's private area.
1458# This should help avoid accidentally configuring some
1459# random version of a program in someone's personal bin.
1460
1461OPATH=$PATH
1462PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001463test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001464test -d /sbin && PATH=$PATH:/sbin
1465test -d /usr/sbin && PATH=$PATH:/usr/sbin
1466PATH=$PATH:/etc:$OPATH
1467
Damien Millera8e06ce2003-11-21 23:48:55 +11001468# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001469OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1470OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1471OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1472OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1473OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1474OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1475OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1476OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1477OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1478OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1479OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1480OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1481OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1482OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1483OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1484OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001485# restore PATH
1486PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001487
1488# Where does ssh-rand-helper get its randomness from?
1489INSTALL_SSH_PRNG_CMDS=""
1490if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1491 if test ! -z "$PRNGD_PORT" ; then
1492 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1493 elif test ! -z "$PRNGD_SOCKET" ; then
1494 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1495 else
1496 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1497 RAND_HELPER_CMDHASH=yes
1498 INSTALL_SSH_PRNG_CMDS="yes"
1499 fi
1500fi
1501AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1502
1503
Ben Lindstromb5628642000-10-18 00:02:25 +00001504# Cheap hack to ensure NEWS-OS libraries are arranged right.
1505if test ! -z "$SONY" ; then
1506 LIBS="$LIBS -liberty";
1507fi
1508
Damien Millera22ba012000-03-02 23:09:20 +11001509# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001510AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001511AC_CHECK_SIZEOF(short int, 2)
1512AC_CHECK_SIZEOF(int, 4)
1513AC_CHECK_SIZEOF(long int, 4)
1514AC_CHECK_SIZEOF(long long int, 8)
1515
Damien Millerfa2bb692002-04-23 23:22:25 +10001516# Sanity check long long for some platforms (AIX)
1517if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1518 ac_cv_sizeof_long_long_int=0
1519fi
1520
Damien Millera22ba012000-03-02 23:09:20 +11001521# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001522AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1523 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001524 [ #include <sys/types.h> ],
1525 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001526 [ ac_cv_have_u_int="yes" ],
1527 [ ac_cv_have_u_int="no" ]
1528 )
1529])
1530if test "x$ac_cv_have_u_int" = "xyes" ; then
1531 AC_DEFINE(HAVE_U_INT)
1532 have_u_int=1
1533fi
1534
Damien Miller61e50f12000-05-08 20:49:37 +10001535AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1536 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001537 [ #include <sys/types.h> ],
1538 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001539 [ ac_cv_have_intxx_t="yes" ],
1540 [ ac_cv_have_intxx_t="no" ]
1541 )
1542])
1543if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1544 AC_DEFINE(HAVE_INTXX_T)
1545 have_intxx_t=1
1546fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001547
1548if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001549 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001550then
1551 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1552 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001553 [ #include <stdint.h> ],
1554 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001555 [
1556 AC_DEFINE(HAVE_INTXX_T)
1557 AC_MSG_RESULT(yes)
1558 ],
1559 [ AC_MSG_RESULT(no) ]
1560 )
1561fi
1562
Damien Miller578783e2000-09-23 14:12:24 +11001563AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1564 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001565 [
1566#include <sys/types.h>
1567#ifdef HAVE_STDINT_H
1568# include <stdint.h>
1569#endif
1570#include <sys/socket.h>
1571#ifdef HAVE_SYS_BITYPES_H
1572# include <sys/bitypes.h>
1573#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001574 ],
1575 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001576 [ ac_cv_have_int64_t="yes" ],
1577 [ ac_cv_have_int64_t="no" ]
1578 )
1579])
1580if test "x$ac_cv_have_int64_t" = "xyes" ; then
1581 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001582fi
1583
Damien Miller61e50f12000-05-08 20:49:37 +10001584AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1585 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001586 [ #include <sys/types.h> ],
1587 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001588 [ ac_cv_have_u_intxx_t="yes" ],
1589 [ ac_cv_have_u_intxx_t="no" ]
1590 )
1591])
1592if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1593 AC_DEFINE(HAVE_U_INTXX_T)
1594 have_u_intxx_t=1
1595fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001596
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001597if test -z "$have_u_intxx_t" ; then
1598 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1599 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001600 [ #include <sys/socket.h> ],
1601 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001602 [
1603 AC_DEFINE(HAVE_U_INTXX_T)
1604 AC_MSG_RESULT(yes)
1605 ],
1606 [ AC_MSG_RESULT(no) ]
1607 )
1608fi
1609
Damien Miller578783e2000-09-23 14:12:24 +11001610AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1611 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001612 [ #include <sys/types.h> ],
1613 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001614 [ ac_cv_have_u_int64_t="yes" ],
1615 [ ac_cv_have_u_int64_t="no" ]
1616 )
1617])
1618if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1619 AC_DEFINE(HAVE_U_INT64_T)
1620 have_u_int64_t=1
1621fi
1622
Tim Rice4cec93f2002-02-26 08:40:48 -08001623if test -z "$have_u_int64_t" ; then
1624 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1625 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001626 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001627 [ u_int64_t a; a = 1],
1628 [
1629 AC_DEFINE(HAVE_U_INT64_T)
1630 AC_MSG_RESULT(yes)
1631 ],
1632 [ AC_MSG_RESULT(no) ]
1633 )
1634fi
1635
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001636if test -z "$have_u_intxx_t" ; then
1637 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1638 AC_TRY_COMPILE(
1639 [
1640#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001641 ],
1642 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001643 [ ac_cv_have_uintxx_t="yes" ],
1644 [ ac_cv_have_uintxx_t="no" ]
1645 )
1646 ])
1647 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1648 AC_DEFINE(HAVE_UINTXX_T)
1649 fi
1650fi
1651
1652if test -z "$have_uintxx_t" ; then
1653 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1654 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001655 [ #include <stdint.h> ],
1656 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001657 [
1658 AC_DEFINE(HAVE_UINTXX_T)
1659 AC_MSG_RESULT(yes)
1660 ],
1661 [ AC_MSG_RESULT(no) ]
1662 )
1663fi
1664
Damien Milleredb82922000-06-20 13:25:52 +10001665if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001666 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001667then
1668 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1669 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001670 [
1671#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001672 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001673 [
Damien Miller70494d12000-04-03 15:57:06 +10001674 int8_t a; int16_t b; int32_t c;
1675 u_int8_t e; u_int16_t f; u_int32_t g;
1676 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001677 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001678 [
1679 AC_DEFINE(HAVE_U_INTXX_T)
1680 AC_DEFINE(HAVE_INTXX_T)
1681 AC_MSG_RESULT(yes)
1682 ],
1683 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001684 )
Damien Millerb29ea912000-01-15 14:12:03 +11001685fi
1686
Damien Miller58be7382001-09-15 21:31:54 +10001687
1688AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1689 AC_TRY_COMPILE(
1690 [
1691#include <sys/types.h>
1692 ],
1693 [ u_char foo; foo = 125; ],
1694 [ ac_cv_have_u_char="yes" ],
1695 [ ac_cv_have_u_char="no" ]
1696 )
1697])
1698if test "x$ac_cv_have_u_char" = "xyes" ; then
1699 AC_DEFINE(HAVE_U_CHAR)
1700fi
1701
Tim Rice13aae5e2001-10-21 17:53:58 -07001702TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001703
Tim Rice200a5c02002-02-26 22:12:34 -08001704AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001705
Damien Miller61e50f12000-05-08 20:49:37 +10001706AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1707 AC_TRY_COMPILE(
1708 [
1709#include <sys/types.h>
1710 ],
1711 [ size_t foo; foo = 1235; ],
1712 [ ac_cv_have_size_t="yes" ],
1713 [ ac_cv_have_size_t="no" ]
1714 )
1715])
1716if test "x$ac_cv_have_size_t" = "xyes" ; then
1717 AC_DEFINE(HAVE_SIZE_T)
1718fi
Damien Miller95058511999-12-29 10:36:45 +11001719
Damien Miller615f9392000-05-17 22:53:33 +10001720AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1721 AC_TRY_COMPILE(
1722 [
1723#include <sys/types.h>
1724 ],
1725 [ ssize_t foo; foo = 1235; ],
1726 [ ac_cv_have_ssize_t="yes" ],
1727 [ ac_cv_have_ssize_t="no" ]
1728 )
1729])
1730if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1731 AC_DEFINE(HAVE_SSIZE_T)
1732fi
1733
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001734AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1735 AC_TRY_COMPILE(
1736 [
1737#include <time.h>
1738 ],
1739 [ clock_t foo; foo = 1235; ],
1740 [ ac_cv_have_clock_t="yes" ],
1741 [ ac_cv_have_clock_t="no" ]
1742 )
1743])
1744if test "x$ac_cv_have_clock_t" = "xyes" ; then
1745 AC_DEFINE(HAVE_CLOCK_T)
1746fi
1747
Damien Millerb54b40e2000-06-23 08:23:34 +10001748AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1749 AC_TRY_COMPILE(
1750 [
1751#include <sys/types.h>
1752#include <sys/socket.h>
1753 ],
1754 [ sa_family_t foo; foo = 1235; ],
1755 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001756 [ AC_TRY_COMPILE(
1757 [
1758#include <sys/types.h>
1759#include <sys/socket.h>
1760#include <netinet/in.h>
1761 ],
1762 [ sa_family_t foo; foo = 1235; ],
1763 [ ac_cv_have_sa_family_t="yes" ],
1764
Damien Millerb54b40e2000-06-23 08:23:34 +10001765 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001766 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001767 )
1768])
1769if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1770 AC_DEFINE(HAVE_SA_FAMILY_T)
1771fi
1772
Damien Miller0f91b4e2000-06-18 15:43:25 +10001773AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1774 AC_TRY_COMPILE(
1775 [
1776#include <sys/types.h>
1777 ],
1778 [ pid_t foo; foo = 1235; ],
1779 [ ac_cv_have_pid_t="yes" ],
1780 [ ac_cv_have_pid_t="no" ]
1781 )
1782])
1783if test "x$ac_cv_have_pid_t" = "xyes" ; then
1784 AC_DEFINE(HAVE_PID_T)
1785fi
1786
1787AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1788 AC_TRY_COMPILE(
1789 [
1790#include <sys/types.h>
1791 ],
1792 [ mode_t foo; foo = 1235; ],
1793 [ ac_cv_have_mode_t="yes" ],
1794 [ ac_cv_have_mode_t="no" ]
1795 )
1796])
1797if test "x$ac_cv_have_mode_t" = "xyes" ; then
1798 AC_DEFINE(HAVE_MODE_T)
1799fi
1800
Damien Miller61e50f12000-05-08 20:49:37 +10001801
1802AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1803 AC_TRY_COMPILE(
1804 [
Damien Miller81171112000-04-23 11:14:01 +10001805#include <sys/types.h>
1806#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001807 ],
1808 [ struct sockaddr_storage s; ],
1809 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1810 [ ac_cv_have_struct_sockaddr_storage="no" ]
1811 )
1812])
1813if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1814 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1815fi
Damien Miller34132e52000-01-14 15:45:46 +11001816
Damien Miller61e50f12000-05-08 20:49:37 +10001817AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1818 AC_TRY_COMPILE(
1819 [
Damien Miller7b22d652000-06-18 14:07:04 +10001820#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001821#include <netinet/in.h>
1822 ],
1823 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1824 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1825 [ ac_cv_have_struct_sockaddr_in6="no" ]
1826 )
1827])
1828if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1829 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1830fi
Damien Miller34132e52000-01-14 15:45:46 +11001831
Damien Miller61e50f12000-05-08 20:49:37 +10001832AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1833 AC_TRY_COMPILE(
1834 [
Damien Miller7b22d652000-06-18 14:07:04 +10001835#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001836#include <netinet/in.h>
1837 ],
1838 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1839 [ ac_cv_have_struct_in6_addr="yes" ],
1840 [ ac_cv_have_struct_in6_addr="no" ]
1841 )
1842])
1843if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1844 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1845fi
Damien Miller34132e52000-01-14 15:45:46 +11001846
Damien Miller61e50f12000-05-08 20:49:37 +10001847AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1848 AC_TRY_COMPILE(
1849 [
Damien Miller81171112000-04-23 11:14:01 +10001850#include <sys/types.h>
1851#include <sys/socket.h>
1852#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001853 ],
1854 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1855 [ ac_cv_have_struct_addrinfo="yes" ],
1856 [ ac_cv_have_struct_addrinfo="no" ]
1857 )
1858])
1859if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1860 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1861fi
1862
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001863AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1864 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001865 [ #include <sys/time.h> ],
1866 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001867 [ ac_cv_have_struct_timeval="yes" ],
1868 [ ac_cv_have_struct_timeval="no" ]
1869 )
1870])
1871if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1872 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1873 have_struct_timeval=1
1874fi
1875
Tim Rice4e4dc562003-03-18 10:21:40 -08001876AC_CHECK_TYPES(struct timespec)
1877
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001878# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001879if test "x$ac_cv_have_int64_t" = "xno" -a \
1880 "x$ac_cv_sizeof_long_int" != "x8" -a \
1881 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001882 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1883 echo "an alternative compiler (I.E., GCC) before continuing."
1884 echo ""
1885 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001886else
1887dnl test snprintf (broken on SCO w/gcc)
1888 AC_TRY_RUN(
1889 [
1890#include <stdio.h>
1891#include <string.h>
1892#ifdef HAVE_SNPRINTF
1893main()
1894{
1895 char buf[50];
1896 char expected_out[50];
1897 int mazsize = 50 ;
1898#if (SIZEOF_LONG_INT == 8)
1899 long int num = 0x7fffffffffffffff;
1900#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001901 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001902#endif
1903 strcpy(expected_out, "9223372036854775807");
1904 snprintf(buf, mazsize, "%lld", num);
1905 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001906 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001907 exit(0);
1908}
1909#else
1910main() { exit(0); }
1911#endif
1912 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1913 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001914fi
1915
Damien Miller78315eb2000-09-29 23:01:36 +11001916dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001917OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1918OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1919OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1920OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1921OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001922OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001923OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1924OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001925OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001926OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1927OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1928OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1929OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001930OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1931OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1932OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1933OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001934
1935AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001936
Damien Miller61e50f12000-05-08 20:49:37 +10001937AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1938 ac_cv_have_ss_family_in_struct_ss, [
1939 AC_TRY_COMPILE(
1940 [
Damien Miller81171112000-04-23 11:14:01 +10001941#include <sys/types.h>
1942#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001943 ],
1944 [ struct sockaddr_storage s; s.ss_family = 1; ],
1945 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1946 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1947 )
1948])
1949if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1950 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1951fi
1952
Damien Miller61e50f12000-05-08 20:49:37 +10001953AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1954 ac_cv_have___ss_family_in_struct_ss, [
1955 AC_TRY_COMPILE(
1956 [
Damien Miller81171112000-04-23 11:14:01 +10001957#include <sys/types.h>
1958#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001959 ],
1960 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1961 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1962 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1963 )
1964])
1965if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1966 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1967fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001968
Damien Millerad833b32000-08-23 10:46:23 +10001969AC_CACHE_CHECK([for pw_class field in struct passwd],
1970 ac_cv_have_pw_class_in_struct_passwd, [
1971 AC_TRY_COMPILE(
1972 [
Damien Millerad833b32000-08-23 10:46:23 +10001973#include <pwd.h>
1974 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001975 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001976 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1977 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1978 )
1979])
1980if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1981 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1982fi
1983
Kevin Steves82456952001-06-22 21:14:18 +00001984AC_CACHE_CHECK([for pw_expire field in struct passwd],
1985 ac_cv_have_pw_expire_in_struct_passwd, [
1986 AC_TRY_COMPILE(
1987 [
1988#include <pwd.h>
1989 ],
1990 [ struct passwd p; p.pw_expire = 0; ],
1991 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1992 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1993 )
1994])
1995if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1996 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1997fi
1998
1999AC_CACHE_CHECK([for pw_change field in struct passwd],
2000 ac_cv_have_pw_change_in_struct_passwd, [
2001 AC_TRY_COMPILE(
2002 [
2003#include <pwd.h>
2004 ],
2005 [ struct passwd p; p.pw_change = 0; ],
2006 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2007 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2008 )
2009])
2010if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2011 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2012fi
Damien Miller61e50f12000-05-08 20:49:37 +10002013
Tim Rice28bbb0c2002-05-27 17:37:32 -07002014dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002015AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2016 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002017 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002018 [
Tim Riceae49fe62002-04-12 10:26:21 -07002019#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002020#include <sys/socket.h>
2021#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002022int main() {
2023#ifdef msg_accrights
2024exit(1);
2025#endif
2026struct msghdr m;
2027m.msg_accrights = 0;
2028exit(0);
2029}
Kevin Steves939c9db2002-03-22 17:23:25 +00002030 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002031 [ ac_cv_have_accrights_in_msghdr="yes" ],
2032 [ ac_cv_have_accrights_in_msghdr="no" ]
2033 )
2034])
2035if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2036 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2037fi
2038
Kevin Stevesa44e0352002-04-07 16:18:03 +00002039AC_CACHE_CHECK([for msg_control field in struct msghdr],
2040 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002041 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002042 [
Tim Riceae49fe62002-04-12 10:26:21 -07002043#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002044#include <sys/socket.h>
2045#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002046int main() {
2047#ifdef msg_control
2048exit(1);
2049#endif
2050struct msghdr m;
2051m.msg_control = 0;
2052exit(0);
2053}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002054 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002055 [ ac_cv_have_control_in_msghdr="yes" ],
2056 [ ac_cv_have_control_in_msghdr="no" ]
2057 )
2058])
2059if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2060 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2061fi
2062
Damien Miller61e50f12000-05-08 20:49:37 +10002063AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002064 AC_TRY_LINK([],
2065 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002066 [ ac_cv_libc_defines___progname="yes" ],
2067 [ ac_cv_libc_defines___progname="no" ]
2068 )
2069])
2070if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2071 AC_DEFINE(HAVE___PROGNAME)
2072fi
2073
Kevin Steves4846f4a2002-03-22 18:19:53 +00002074AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2075 AC_TRY_LINK([
2076#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002077],
2078 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002079 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2080 [ ac_cv_cc_implements___FUNCTION__="no" ]
2081 )
2082])
2083if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2084 AC_DEFINE(HAVE___FUNCTION__)
2085fi
2086
2087AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2088 AC_TRY_LINK([
2089#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002090],
2091 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002092 [ ac_cv_cc_implements___func__="yes" ],
2093 [ ac_cv_cc_implements___func__="no" ]
2094 )
2095])
2096if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2097 AC_DEFINE(HAVE___func__)
2098fi
2099
Damien Miller4f8e6692001-07-14 13:22:53 +10002100AC_CACHE_CHECK([whether getopt has optreset support],
2101 ac_cv_have_getopt_optreset, [
2102 AC_TRY_LINK(
2103 [
2104#include <getopt.h>
2105 ],
2106 [ extern int optreset; optreset = 0; ],
2107 [ ac_cv_have_getopt_optreset="yes" ],
2108 [ ac_cv_have_getopt_optreset="no" ]
2109 )
2110])
2111if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2112 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2113fi
Damien Millera22ba012000-03-02 23:09:20 +11002114
Damien Millerecbb26d2000-07-15 14:59:14 +10002115AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002116 AC_TRY_LINK([],
2117 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002118 [ ac_cv_libc_defines_sys_errlist="yes" ],
2119 [ ac_cv_libc_defines_sys_errlist="no" ]
2120 )
2121])
2122if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2123 AC_DEFINE(HAVE_SYS_ERRLIST)
2124fi
2125
2126
Damien Miller11fa2cc2000-08-16 10:35:58 +10002127AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002128 AC_TRY_LINK([],
2129 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002130 [ ac_cv_libc_defines_sys_nerr="yes" ],
2131 [ ac_cv_libc_defines_sys_nerr="no" ]
2132 )
2133])
2134if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2135 AC_DEFINE(HAVE_SYS_NERR)
2136fi
2137
Damien Millera8e06ce2003-11-21 23:48:55 +11002138SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002139# Check whether user wants sectok support
2140AC_ARG_WITH(sectok,
2141 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002142 [
2143 if test "x$withval" != "xno" ; then
2144 if test "x$withval" != "xyes" ; then
2145 CPPFLAGS="$CPPFLAGS -I${withval}"
2146 LDFLAGS="$LDFLAGS -L${withval}"
2147 if test ! -z "$need_dash_r" ; then
2148 LDFLAGS="$LDFLAGS -R${withval}"
2149 fi
2150 if test ! -z "$blibpath" ; then
2151 blibpath="$blibpath:${withval}"
2152 fi
2153 fi
2154 AC_CHECK_HEADERS(sectok.h)
2155 if test "$ac_cv_header_sectok_h" != yes; then
2156 AC_MSG_ERROR(Can't find sectok.h)
2157 fi
2158 AC_CHECK_LIB(sectok, sectok_open)
2159 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2160 AC_MSG_ERROR(Can't find libsectok)
2161 fi
2162 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002163 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002164 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002165 fi
2166 ]
2167)
2168
2169# Check whether user wants OpenSC support
2170AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002171 AC_HELP_STRING([--with-opensc=PFX],
2172 [Enable smartcard support using OpenSC]),
2173 opensc_config_prefix="$withval", opensc_config_prefix="")
2174if test x$opensc_config_prefix != x ; then
2175 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2176 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2177 if test "$OPENSC_CONFIG" != "no"; then
2178 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2179 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2180 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2181 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2182 AC_DEFINE(SMARTCARD)
2183 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002184 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002185 fi
2186fi
Damien Miller85de5802001-09-18 14:01:11 +10002187
Darren Tucker5f88d342003-10-15 16:57:57 +10002188# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002189AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002190 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002191 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002192 # Needed by our getrrsetbyname()
2193 AC_SEARCH_LIBS(res_query, resolv)
2194 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002195 AC_MSG_CHECKING(if res_query will link)
2196 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2197 [AC_MSG_RESULT(no)
2198 saved_LIBS="$LIBS"
2199 LIBS="$LIBS -lresolv"
2200 AC_MSG_CHECKING(for res_query in -lresolv)
2201 AC_LINK_IFELSE([
2202#include <resolv.h>
2203int main()
2204{
2205 res_query (0, 0, 0, 0, 0);
2206 return 0;
2207}
2208 ],
2209 [LIBS="$LIBS -lresolv"
2210 AC_MSG_RESULT(yes)],
2211 [LIBS="$saved_LIBS"
2212 AC_MSG_RESULT(no)])
2213 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002214 AC_CHECK_FUNCS(_getshort _getlong)
2215 AC_CHECK_MEMBER(HEADER.ad,
2216 [AC_DEFINE(HAVE_HEADER_AD)],,
2217 [#include <arpa/nameser.h>])
2218 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002219
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002220# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002221KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002222AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002223 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002224 [ if test "x$withval" != "xno" ; then
2225 if test "x$withval" = "xyes" ; then
2226 KRB5ROOT="/usr/local"
2227 else
2228 KRB5ROOT=${withval}
2229 fi
2230
2231 AC_DEFINE(KRB5)
2232 KRB5_MSG="yes"
2233
2234 AC_MSG_CHECKING(for krb5-config)
2235 if test -x $KRB5ROOT/bin/krb5-config ; then
2236 KRB5CONF=$KRB5ROOT/bin/krb5-config
2237 AC_MSG_RESULT($KRB5CONF)
2238
2239 AC_MSG_CHECKING(for gssapi support)
2240 if $KRB5CONF | grep gssapi >/dev/null ; then
2241 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002242 AC_DEFINE(GSSAPI)
2243 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002244 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002245 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002246 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002247 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002248 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2249 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002250 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002251 AC_MSG_CHECKING(whether we are using Heimdal)
2252 AC_TRY_COMPILE([ #include <krb5.h> ],
2253 [ char *tmp = heimdal_version; ],
2254 [ AC_MSG_RESULT(yes)
2255 AC_DEFINE(HEIMDAL) ],
2256 AC_MSG_RESULT(no)
2257 )
2258 else
2259 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002260 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002261 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002262 AC_MSG_CHECKING(whether we are using Heimdal)
2263 AC_TRY_COMPILE([ #include <krb5.h> ],
2264 [ char *tmp = heimdal_version; ],
2265 [ AC_MSG_RESULT(yes)
2266 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002267 K5LIBS="-lkrb5 -ldes"
2268 K5LIBS="$K5LIBS -lcom_err -lasn1"
2269 AC_CHECK_LIB(roken, net_write,
2270 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002271 ],
2272 [ AC_MSG_RESULT(no)
2273 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2274 ]
2275 )
Damien Miller200d0a72003-06-30 19:21:36 +10002276 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002277
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002278 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2279 [ AC_DEFINE(GSSAPI)
2280 K5LIBS="-lgssapi $K5LIBS" ],
2281 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2282 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002283 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002284 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2285 $K5LIBS)
2286 ],
2287 $K5LIBS)
2288
2289 AC_CHECK_HEADER(gssapi.h, ,
2290 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002291 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002292 AC_CHECK_HEADERS(gssapi.h, ,
2293 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002294 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002295 ]
2296 )
2297
2298 oldCPP="$CPPFLAGS"
2299 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2300 AC_CHECK_HEADER(gssapi_krb5.h, ,
2301 [ CPPFLAGS="$oldCPP" ])
2302
Damien Millera8e06ce2003-11-21 23:48:55 +11002303 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002304 if test ! -z "$need_dash_r" ; then
2305 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2306 fi
2307 if test ! -z "$blibpath" ; then
2308 blibpath="$blibpath:${KRB5ROOT}/lib"
2309 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002310 fi
2311
2312 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2313 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2314 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2315
2316 LIBS="$LIBS $K5LIBS"
2317 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002318 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002319 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002320)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002321
Damien Millera22ba012000-03-02 23:09:20 +11002322# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002323
Damien Millerf58c6722002-05-13 13:15:42 +10002324PRIVSEP_PATH=/var/empty
2325AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002326 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002327 [
2328 if test "x$withval" != "$no" ; then
2329 PRIVSEP_PATH=$withval
2330 fi
2331 ]
2332)
2333AC_SUBST(PRIVSEP_PATH)
2334
Damien Millera22ba012000-03-02 23:09:20 +11002335AC_ARG_WITH(xauth,
2336 [ --with-xauth=PATH Specify path to xauth program ],
2337 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002338 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002339 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002340 fi
2341 ],
2342 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002343 TestPath="$PATH"
2344 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2345 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2346 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2347 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2348 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002349 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002350 xauth_path="/usr/openwin/bin/xauth"
2351 fi
2352 ]
2353)
2354
Damien Miller7d901272003-01-13 16:55:22 +11002355STRIP_OPT=-s
2356AC_ARG_ENABLE(strip,
2357 [ --disable-strip Disable calling strip(1) on install],
2358 [
2359 if test "x$enableval" = "xno" ; then
2360 STRIP_OPT=
2361 fi
2362 ]
2363)
2364AC_SUBST(STRIP_OPT)
2365
Damien Millera19cf472000-11-29 13:28:50 +11002366if test -z "$xauth_path" ; then
2367 XAUTH_PATH="undefined"
2368 AC_SUBST(XAUTH_PATH)
2369else
Damien Millera22ba012000-03-02 23:09:20 +11002370 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002371 XAUTH_PATH=$xauth_path
2372 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002373fi
Damien Millera22ba012000-03-02 23:09:20 +11002374
2375# Check for mail directory (last resort if we cannot get it from headers)
2376if test ! -z "$MAIL" ; then
2377 maildir=`dirname $MAIL`
2378 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2379fi
2380
Damien Millera22ba012000-03-02 23:09:20 +11002381if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002382 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002383 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002384 [
2385 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2386 have_dev_ptmx=1
2387 ]
2388 )
2389 fi
Damien Millera22ba012000-03-02 23:09:20 +11002390fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002391AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002392 [
2393 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2394 have_dev_ptc=1
2395 ]
2396)
2397
Damien Millera22ba012000-03-02 23:09:20 +11002398# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002399AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002400 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002401 [
Damien Miller897741e2001-04-16 10:41:46 +10002402 case "$withval" in
2403 man|cat|doc)
2404 MANTYPE=$withval
2405 ;;
2406 *)
2407 AC_MSG_ERROR(invalid man type: $withval)
2408 ;;
2409 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002410 ]
2411)
Ben Lindstrombc709922001-04-18 18:04:21 +00002412if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002413 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2414 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002415 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2416 MANTYPE=doc
2417 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2418 MANTYPE=man
2419 else
2420 MANTYPE=cat
2421 fi
2422fi
Damien Miller670a4b82000-01-22 13:53:11 +11002423AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002424if test "$MANTYPE" = "doc"; then
2425 mansubdir=man;
2426else
2427 mansubdir=$MANTYPE;
2428fi
2429AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002430
Damien Millera22ba012000-03-02 23:09:20 +11002431# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002432MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002433AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002434 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002435 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002436 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002437 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002438 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002439 fi
2440 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002441)
2442
Damien Millera22ba012000-03-02 23:09:20 +11002443# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002444AC_ARG_WITH(shadow,
2445 [ --without-shadow Disable shadow password support],
2446 [
2447 if test "x$withval" = "xno" ; then
2448 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002449 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002450 fi
2451 ]
2452)
2453
Damien Miller1f335fb2000-06-26 11:31:33 +10002454if test -z "$disable_shadow" ; then
2455 AC_MSG_CHECKING([if the systems has expire shadow information])
2456 AC_TRY_COMPILE(
2457 [
2458#include <sys/types.h>
2459#include <shadow.h>
2460 struct spwd sp;
2461 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2462 [ sp_expire_available=yes ], []
2463 )
2464
2465 if test "x$sp_expire_available" = "xyes" ; then
2466 AC_MSG_RESULT(yes)
2467 AC_DEFINE(HAS_SHADOW_EXPIRE)
2468 else
2469 AC_MSG_RESULT(no)
2470 fi
2471fi
2472
Damien Millera22ba012000-03-02 23:09:20 +11002473# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002474if test ! -z "$IPADDR_IN_DISPLAY" ; then
2475 DISPLAY_HACK_MSG="yes"
2476 AC_DEFINE(IPADDR_IN_DISPLAY)
2477else
Damien Millera8e06ce2003-11-21 23:48:55 +11002478 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002479 AC_ARG_WITH(ipaddr-display,
2480 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2481 [
2482 if test "x$withval" != "xno" ; then
2483 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002484 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002485 fi
2486 ]
2487 )
2488fi
Damien Miller76112de1999-12-21 11:18:08 +11002489
Darren Tuckere1a790d2003-09-16 11:52:19 +10002490# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002491AC_ARG_ENABLE(etc-default-login,
2492 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2493[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002494AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2495
2496if test "x$external_path_file" = "x/etc/default/login"; then
2497 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2498fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002499])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002500
Tim Rice43a1c132002-04-17 21:19:14 -07002501dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2502if test $ac_cv_func_login_getcapbool = "yes" -a \
2503 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002504 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002505fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002506
Damien Millera22ba012000-03-02 23:09:20 +11002507# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002508SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002509AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002510 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002511 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002512 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002513 AC_MSG_WARN([
2514--with-default-path=PATH has no effect on this system.
2515Edit /etc/login.conf instead.])
2516 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002517 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002518 AC_MSG_WARN([
2519--with-default-path=PATH will only be used if PATH is not defined in
2520$external_path_file .])
2521 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002522 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002523 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002524 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002525 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002526 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2527 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002528 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002529 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002530 AC_MSG_WARN([
2531If PATH is defined in $external_path_file, ensure the path to scp is included,
2532otherwise scp will not work.])
2533 fi
2534 AC_TRY_RUN(
2535 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002536/* find out what STDPATH is */
2537#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002538#ifdef HAVE_PATHS_H
2539# include <paths.h>
2540#endif
2541#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002542# ifdef _PATH_USERPATH /* Irix */
2543# define _PATH_STDPATH _PATH_USERPATH
2544# else
2545# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2546# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002547#endif
2548#include <sys/types.h>
2549#include <sys/stat.h>
2550#include <fcntl.h>
2551#define DATA "conftest.stdpath"
2552
2553main()
2554{
2555 FILE *fd;
2556 int rc;
2557
2558 fd = fopen(DATA,"w");
2559 if(fd == NULL)
2560 exit(1);
2561
2562 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2563 exit(1);
2564
2565 exit(0);
2566}
2567 ], [ user_path=`cat conftest.stdpath` ],
2568 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2569 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2570 )
2571# make sure $bindir is in USER_PATH so scp will work
2572 t_bindir=`eval echo ${bindir}`
2573 case $t_bindir in
2574 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2575 esac
2576 case $t_bindir in
2577 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2578 esac
2579 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2580 if test $? -ne 0 ; then
2581 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2582 if test $? -ne 0 ; then
2583 user_path=$user_path:$t_bindir
2584 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2585 fi
2586 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002587 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002588)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002589if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002590 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2591 AC_SUBST(user_path)
2592fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002593
Damien Millera18bbd32002-05-13 10:48:57 +10002594# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002595AC_ARG_WITH(superuser-path,
2596 [ --with-superuser-path= Specify different path for super-user],
2597 [
2598 if test "x$withval" != "xno" ; then
2599 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2600 superuser_path=$withval
2601 fi
2602 ]
2603)
2604
2605
Damien Miller61e50f12000-05-08 20:49:37 +10002606AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002607IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002608AC_ARG_WITH(4in6,
2609 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2610 [
2611 if test "x$withval" != "xno" ; then
2612 AC_MSG_RESULT(yes)
2613 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002614 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002615 else
2616 AC_MSG_RESULT(no)
2617 fi
2618 ],[
2619 if test "x$inet6_default_4in6" = "xyes"; then
2620 AC_MSG_RESULT([yes (default)])
2621 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002622 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002623 else
2624 AC_MSG_RESULT([no (default)])
2625 fi
2626 ]
2627)
2628
Damien Miller60396b02001-02-18 17:01:00 +11002629# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002630BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002631AC_ARG_WITH(bsd-auth,
2632 [ --with-bsd-auth Enable BSD auth support],
2633 [
2634 if test "x$withval" != "xno" ; then
2635 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002636 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002637 fi
2638 ]
2639)
2640
Damien Millera22ba012000-03-02 23:09:20 +11002641# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002642piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002643# make sure the directory exists
2644if test ! -d $piddir ; then
2645 piddir=`eval echo ${sysconfdir}`
2646 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002647 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002648 esac
2649fi
2650
Tim Rice88f2ab52002-03-17 12:17:34 -08002651AC_ARG_WITH(pid-dir,
2652 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2653 [
2654 if test "x$withval" != "xno" ; then
2655 piddir=$withval
2656 if test ! -d $piddir ; then
2657 AC_MSG_WARN([** no $piddir directory on this system **])
2658 fi
2659 fi
2660 ]
2661)
2662
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002663AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002664AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002665
andre2ff7b5d2000-06-03 14:57:40 +00002666dnl allow user to disable some login recording features
2667AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002668 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002669 [
2670 if test "x$enableval" = "xno" ; then
2671 AC_DEFINE(DISABLE_LASTLOG)
2672 fi
2673 ]
andre2ff7b5d2000-06-03 14:57:40 +00002674)
2675AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002676 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002677 [
2678 if test "x$enableval" = "xno" ; then
2679 AC_DEFINE(DISABLE_UTMP)
2680 fi
2681 ]
andre2ff7b5d2000-06-03 14:57:40 +00002682)
2683AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002684 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002685 [
2686 if test "x$enableval" = "xno" ; then
2687 AC_DEFINE(DISABLE_UTMPX)
2688 fi
2689 ]
andre2ff7b5d2000-06-03 14:57:40 +00002690)
2691AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002692 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002693 [
2694 if test "x$enableval" = "xno" ; then
2695 AC_DEFINE(DISABLE_WTMP)
2696 fi
2697 ]
andre2ff7b5d2000-06-03 14:57:40 +00002698)
2699AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002700 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002701 [
2702 if test "x$enableval" = "xno" ; then
2703 AC_DEFINE(DISABLE_WTMPX)
2704 fi
2705 ]
andre2ff7b5d2000-06-03 14:57:40 +00002706)
2707AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002708 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002709 [
2710 if test "x$enableval" = "xno" ; then
2711 AC_DEFINE(DISABLE_LOGIN)
2712 fi
2713 ]
andre2ff7b5d2000-06-03 14:57:40 +00002714)
2715AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002716 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002717 [
2718 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002719 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002720 fi
2721 ]
andre2ff7b5d2000-06-03 14:57:40 +00002722)
2723AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002724 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002725 [
2726 if test "x$enableval" = "xno" ; then
2727 AC_DEFINE(DISABLE_PUTUTXLINE)
2728 fi
2729 ]
andre2ff7b5d2000-06-03 14:57:40 +00002730)
2731AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002732 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002733 [
2734 if test "x$withval" = "xno" ; then
2735 AC_DEFINE(DISABLE_LASTLOG)
2736 else
2737 conf_lastlog_location=$withval
2738 fi
2739 ]
2740)
andre2ff7b5d2000-06-03 14:57:40 +00002741
2742dnl lastlog, [uw]tmpx? detection
2743dnl NOTE: set the paths in the platform section to avoid the
2744dnl need for command-line parameters
2745dnl lastlog and [uw]tmp are subject to a file search if all else fails
2746
2747dnl lastlog detection
2748dnl NOTE: the code itself will detect if lastlog is a directory
2749AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2750AC_TRY_COMPILE([
2751#include <sys/types.h>
2752#include <utmp.h>
2753#ifdef HAVE_LASTLOG_H
2754# include <lastlog.h>
2755#endif
Damien Miller2994e082000-06-04 15:51:47 +10002756#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002757# include <paths.h>
2758#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002759#ifdef HAVE_LOGIN_H
2760# include <login.h>
2761#endif
andre2ff7b5d2000-06-03 14:57:40 +00002762 ],
2763 [ char *lastlog = LASTLOG_FILE; ],
2764 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002765 [
2766 AC_MSG_RESULT(no)
2767 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2768 AC_TRY_COMPILE([
2769#include <sys/types.h>
2770#include <utmp.h>
2771#ifdef HAVE_LASTLOG_H
2772# include <lastlog.h>
2773#endif
2774#ifdef HAVE_PATHS_H
2775# include <paths.h>
2776#endif
2777 ],
2778 [ char *lastlog = _PATH_LASTLOG; ],
2779 [ AC_MSG_RESULT(yes) ],
2780 [
andree441aa32000-06-12 22:34:38 +00002781 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002782 system_lastlog_path=no
2783 ])
2784 ]
andre2ff7b5d2000-06-03 14:57:40 +00002785)
Damien Miller2994e082000-06-04 15:51:47 +10002786
andre2ff7b5d2000-06-03 14:57:40 +00002787if test -z "$conf_lastlog_location"; then
2788 if test x"$system_lastlog_path" = x"no" ; then
2789 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002790 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002791 conf_lastlog_location=$f
2792 fi
2793 done
2794 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002795 AC_MSG_WARN([** Cannot find lastlog **])
2796 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002797 fi
2798 fi
2799fi
2800
2801if test -n "$conf_lastlog_location"; then
2802 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2803fi
2804
2805dnl utmp detection
2806AC_MSG_CHECKING([if your system defines UTMP_FILE])
2807AC_TRY_COMPILE([
2808#include <sys/types.h>
2809#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002810#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002811# include <paths.h>
2812#endif
2813 ],
2814 [ char *utmp = UTMP_FILE; ],
2815 [ AC_MSG_RESULT(yes) ],
2816 [ AC_MSG_RESULT(no)
2817 system_utmp_path=no ]
2818)
2819if test -z "$conf_utmp_location"; then
2820 if test x"$system_utmp_path" = x"no" ; then
2821 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2822 if test -f $f ; then
2823 conf_utmp_location=$f
2824 fi
2825 done
2826 if test -z "$conf_utmp_location"; then
2827 AC_DEFINE(DISABLE_UTMP)
2828 fi
2829 fi
2830fi
2831if test -n "$conf_utmp_location"; then
2832 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2833fi
2834
2835dnl wtmp detection
2836AC_MSG_CHECKING([if your system defines WTMP_FILE])
2837AC_TRY_COMPILE([
2838#include <sys/types.h>
2839#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002840#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002841# include <paths.h>
2842#endif
2843 ],
2844 [ char *wtmp = WTMP_FILE; ],
2845 [ AC_MSG_RESULT(yes) ],
2846 [ AC_MSG_RESULT(no)
2847 system_wtmp_path=no ]
2848)
2849if test -z "$conf_wtmp_location"; then
2850 if test x"$system_wtmp_path" = x"no" ; then
2851 for f in /usr/adm/wtmp /var/log/wtmp; do
2852 if test -f $f ; then
2853 conf_wtmp_location=$f
2854 fi
2855 done
2856 if test -z "$conf_wtmp_location"; then
2857 AC_DEFINE(DISABLE_WTMP)
2858 fi
2859 fi
2860fi
2861if test -n "$conf_wtmp_location"; then
2862 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2863fi
2864
2865
2866dnl utmpx detection - I don't know any system so perverse as to require
2867dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2868dnl there, though.
2869AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2870AC_TRY_COMPILE([
2871#include <sys/types.h>
2872#include <utmp.h>
2873#ifdef HAVE_UTMPX_H
2874#include <utmpx.h>
2875#endif
Damien Miller2994e082000-06-04 15:51:47 +10002876#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002877# include <paths.h>
2878#endif
2879 ],
2880 [ char *utmpx = UTMPX_FILE; ],
2881 [ AC_MSG_RESULT(yes) ],
2882 [ AC_MSG_RESULT(no)
2883 system_utmpx_path=no ]
2884)
2885if test -z "$conf_utmpx_location"; then
2886 if test x"$system_utmpx_path" = x"no" ; then
2887 AC_DEFINE(DISABLE_UTMPX)
2888 fi
2889else
2890 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2891fi
2892
2893dnl wtmpx detection
2894AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2895AC_TRY_COMPILE([
2896#include <sys/types.h>
2897#include <utmp.h>
2898#ifdef HAVE_UTMPX_H
2899#include <utmpx.h>
2900#endif
Damien Miller2994e082000-06-04 15:51:47 +10002901#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002902# include <paths.h>
2903#endif
2904 ],
2905 [ char *wtmpx = WTMPX_FILE; ],
2906 [ AC_MSG_RESULT(yes) ],
2907 [ AC_MSG_RESULT(no)
2908 system_wtmpx_path=no ]
2909)
2910if test -z "$conf_wtmpx_location"; then
2911 if test x"$system_wtmpx_path" = x"no" ; then
2912 AC_DEFINE(DISABLE_WTMPX)
2913 fi
2914else
2915 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2916fi
2917
Damien Miller4018c192000-04-30 09:30:44 +10002918
Damien Miller29ea30d2000-03-17 10:54:15 +11002919if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002920 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2921 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002922fi
2923
Tim Rice4cec93f2002-02-26 08:40:48 -08002924dnl remove pam and dl because they are in $LIBPAM
2925if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002926 LIBS=`echo $LIBS | sed 's/-lpam //'`
2927fi
2928if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2929 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002930fi
2931
Damien Millerbac2d8a2000-09-05 16:13:06 +11002932AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002933AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002934AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002935
Damien Miller7b22d652000-06-18 14:07:04 +10002936# Print summary of options
2937
Damien Miller7b22d652000-06-18 14:07:04 +10002938# Someone please show me a better way :)
2939A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2940B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2941C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2942D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002943E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002944F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002945G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002946H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2947I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2948J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002949
2950echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002951echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002952echo " User binaries: $B"
2953echo " System binaries: $C"
2954echo " Configuration files: $D"
2955echo " Askpass program: $E"
2956echo " Manual pages: $F"
2957echo " PID file: $G"
2958echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002959if test "x$external_path_file" = "x/etc/login.conf" ; then
2960echo " At runtime, sshd will use the path defined in $external_path_file"
2961echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002962else
Damien Millerf58c6722002-05-13 13:15:42 +10002963echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002964 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002965echo " (If PATH is set in $external_path_file it will be used instead. If"
2966echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2967 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002968fi
Damien Millera18bbd32002-05-13 10:48:57 +10002969if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002970echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002971fi
Damien Millerf58c6722002-05-13 13:15:42 +10002972echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002973echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002974echo " KerberosV support: $KRB5_MSG"
2975echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002976echo " S/KEY support: $SKEY_MSG"
2977echo " TCP Wrappers support: $TCPW_MSG"
2978echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002979echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002980echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2981echo " BSD Auth support: $BSD_AUTH_MSG"
2982echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002983if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002984echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002985fi
2986
Damien Miller7b22d652000-06-18 14:07:04 +10002987echo ""
2988
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002989echo " Host: ${host}"
2990echo " Compiler: ${CC}"
2991echo " Compiler flags: ${CFLAGS}"
2992echo "Preprocessor flags: ${CPPFLAGS}"
2993echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002994echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002995
2996echo ""
2997
Tim Rice6f1f7582004-05-30 21:38:51 -07002998if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
2999 echo "SVR4 style packages are supported with \"make package\"\n"
3000fi
3001
Damien Miller82cf0ce2000-12-20 13:34:48 +11003002if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003003 echo "PAM is enabled. You may need to install a PAM control file "
3004 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003005 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003006 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003007 echo ""
3008fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003009
Damien Miller6c21c512002-01-22 21:57:53 +11003010if test ! -z "$RAND_HELPER_CMDHASH" ; then
3011 echo "WARNING: you are using the builtin random number collection "
3012 echo "service. Please read WARNING.RNG and request that your OS "
3013 echo "vendor includes kernel-based random number collection in "
3014 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003015 echo ""
3016fi
Damien Miller60396b02001-02-18 17:01:00 +11003017
Damien Millerb4097182004-05-23 14:09:40 +10003018if test ! -z "$NO_PEERCHECK" ; then
3019 echo "WARNING: the operating system that you are using does not "
3020 echo "appear to support either the getpeereid() API nor the "
3021 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3022 echo "enforce security checks to prevent unauthorised connections to "
3023 echo "ssh-agent. Their absence increases the risk that a malicious "
3024 echo "user can connect to your agent. "
3025 echo ""
3026fi
3027