blob: 1579c8dd3a32a61e5465bf43f9f219175537a636 [file] [log] [blame]
Tim Rice816bd0d2004-07-19 10:19:26 -07001# $Id: configure.ac,v 1.224 2004/07/19 17:19:27 tim 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 Miller5fe46a42003-06-05 09:53:31 +1000520AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000521 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800522 login_cap.h maillock.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 \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000525 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100526 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
527 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
528 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
529 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 Millerc547bf12001-02-16 10:18:12 +1100734# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100735SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100736AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700737 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100738 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100739 [
740 if test "x$withval" != "xno" ; then
741
742 if test "x$withval" != "xyes" ; then
743 CPPFLAGS="$CPPFLAGS -I${withval}/include"
744 LDFLAGS="$LDFLAGS -L${withval}/lib"
745 fi
746
747 AC_DEFINE(SKEY)
748 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100749 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100750
Tim Rice4cec93f2002-02-26 08:40:48 -0800751 AC_MSG_CHECKING([for s/key support])
752 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100753 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800754#include <stdio.h>
755#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700756int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800757 ],
758 [AC_MSG_RESULT(yes)],
759 [
760 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100761 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
762 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000763 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
764 AC_TRY_COMPILE(
765 [#include <stdio.h>
766 #include <skey.h>],
767 [(void)skeychallenge(NULL,"name","",0);],
768 [AC_MSG_RESULT(yes)
769 AC_DEFINE(SKEYCHALLENGE_4ARG)],
770 [AC_MSG_RESULT(no)]
771 )
Damien Millerc547bf12001-02-16 10:18:12 +1100772 fi
773 ]
774)
775
776# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700777TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100778AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700779 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100780 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100781 [
782 if test "x$withval" != "xno" ; then
783 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700784 saved_LDFLAGS="$LDFLAGS"
785 saved_CPPFLAGS="$CPPFLAGS"
786 if test -n "${withval}" -a "${withval}" != "yes"; then
787 if test -d "${withval}/lib"; then
788 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700789 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700790 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700791 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700792 fi
793 else
794 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700795 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700796 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700797 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700798 fi
799 fi
800 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700801 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700802 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700803 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700804 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700805 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800806 LIBWRAP="-lwrap"
807 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100808 AC_MSG_CHECKING(for libwrap)
809 AC_TRY_LINK(
810 [
Damien Miller0ac45002004-04-14 20:14:26 +1000811#include <sys/types.h>
812#include <sys/socket.h>
813#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100814#include <tcpd.h>
815 int deny_severity = 0, allow_severity = 0;
816 ],
817 [hosts_access(0);],
818 [
819 AC_MSG_RESULT(yes)
820 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800821 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700822 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100823 ],
824 [
825 AC_MSG_ERROR([*** libwrap missing])
826 ]
827 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800828 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100829 fi
830 ]
831)
832
Damien Millerfe1f1432003-02-24 15:45:42 +1100833dnl Checks for library functions. Please keep in alphabetical order
834AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000835 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
836 bindresvport_sa clock closefrom fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000837 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000838 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100839 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000840 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100841 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000842 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100843 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000844 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000845 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100846 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100847)
Tim Rice13aae5e2001-10-21 17:53:58 -0700848
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000849# IRIX has a const char return value for gai_strerror()
850AC_CHECK_FUNCS(gai_strerror,[
851 AC_DEFINE(HAVE_GAI_STRERROR)
852 AC_TRY_COMPILE([
853#include <sys/types.h>
854#include <sys/socket.h>
855#include <netdb.h>
856
857const char *gai_strerror(int);],[
858char *str;
859
860str = gai_strerror(0);],[
861 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
862 [Define if gai_strerror() returns const char *])])])
863
Damien Millercd6853c2003-01-28 11:33:42 +1100864AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
865
Darren Tuckerf1159b52003-07-07 19:44:01 +1000866dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000867AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000868AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000869
Darren Tuckerb2427c82003-09-10 15:22:44 +1000870dnl tcsendbreak might be a macro
871AC_CHECK_DECL(tcsendbreak,
872 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100873 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000874 [#include <termios.h>]
875)
876
Darren Tucker5bb14002004-04-23 18:53:10 +1000877AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
878
Darren Tucker2a6b0292003-12-31 14:59:17 +1100879AC_CHECK_FUNCS(setresuid, [
880 dnl Some platorms have setresuid that isn't implemented, test for this
881 AC_MSG_CHECKING(if setresuid seems to work)
882 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100883#include <stdlib.h>
884#include <errno.h>
885int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100886 ],
887 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100888 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100889 AC_MSG_RESULT(not implemented)]
890 )
891])
Darren Tuckere937be32003-12-17 18:53:26 +1100892
Darren Tucker2a6b0292003-12-31 14:59:17 +1100893AC_CHECK_FUNCS(setresgid, [
894 dnl Some platorms have setresgid that isn't implemented, test for this
895 AC_MSG_CHECKING(if setresgid seems to work)
896 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100897#include <stdlib.h>
898#include <errno.h>
899int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100900 ],
901 [AC_MSG_RESULT(yes)],
902 [AC_DEFINE(BROKEN_SETRESGID)
903 AC_MSG_RESULT(not implemented)]
904 )
905])
Darren Tuckere937be32003-12-17 18:53:26 +1100906
Damien Millerad833b32000-08-23 10:46:23 +1000907dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000908AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000909dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000910AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000911AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000912dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000913AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000914AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100915
Damien Millera8e06ce2003-11-21 23:48:55 +1100916AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100917 [AC_DEFINE(HAVE_DAEMON)],
918 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
919)
920
Damien Millera8e06ce2003-11-21 23:48:55 +1100921AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100922 [AC_DEFINE(HAVE_GETPAGESIZE)],
923 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
924)
925
Damien Millercb170cb2000-07-01 16:52:55 +1000926# Check for broken snprintf
927if test "x$ac_cv_func_snprintf" = "xyes" ; then
928 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
929 AC_TRY_RUN(
930 [
931#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700932int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000933 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100934 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000935 [
936 AC_MSG_RESULT(no)
937 AC_DEFINE(BROKEN_SNPRINTF)
938 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
939 ]
940 )
941fi
942
Damien Millerb4097182004-05-23 14:09:40 +1000943# Check for missing getpeereid (or equiv) support
944NO_PEERCHECK=""
945if test "x$ac_cv_func_getpeereid" != "xyes" ; then
946 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
947 AC_TRY_COMPILE(
948 [#include <sys/types.h>
949 #include <sys/socket.h>],
950 [int i = SO_PEERCRED;],
951 [AC_MSG_RESULT(yes)],
952 [AC_MSG_RESULT(no)
953 NO_PEERCHECK=1]
954 )
955fi
956
Damien Millere8328192003-01-07 15:18:32 +1100957dnl see whether mkstemp() requires XXXXXX
958if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
959AC_MSG_CHECKING([for (overly) strict mkstemp])
960AC_TRY_RUN(
961 [
962#include <stdlib.h>
963main() { char template[]="conftest.mkstemp-test";
964if (mkstemp(template) == -1)
965 exit(1);
966unlink(template); exit(0);
967}
968 ],
969 [
970 AC_MSG_RESULT(no)
971 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100972 [
Damien Millere8328192003-01-07 15:18:32 +1100973 AC_MSG_RESULT(yes)
974 AC_DEFINE(HAVE_STRICT_MKSTEMP)
975 ],
976 [
977 AC_MSG_RESULT(yes)
978 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100979 ]
Damien Millere8328192003-01-07 15:18:32 +1100980)
981fi
982
Darren Tucker70a3d552003-08-21 17:58:29 +1000983dnl make sure that openpty does not reacquire controlling terminal
984if test ! -z "$check_for_openpty_ctty_bug"; then
985 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
986 AC_TRY_RUN(
987 [
988#include <stdio.h>
989#include <sys/fcntl.h>
990#include <sys/types.h>
991#include <sys/wait.h>
992
993int
994main()
995{
996 pid_t pid;
997 int fd, ptyfd, ttyfd, status;
998
999 pid = fork();
1000 if (pid < 0) { /* failed */
1001 exit(1);
1002 } else if (pid > 0) { /* parent */
1003 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001004 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001005 exit(WEXITSTATUS(status));
1006 else
1007 exit(2);
1008 } else { /* child */
1009 close(0); close(1); close(2);
1010 setsid();
1011 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1012 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1013 if (fd >= 0)
1014 exit(3); /* Acquired ctty: broken */
1015 else
1016 exit(0); /* Did not acquire ctty: OK */
1017 }
1018}
1019 ],
1020 [
1021 AC_MSG_RESULT(yes)
1022 ],
1023 [
1024 AC_MSG_RESULT(no)
1025 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1026 ]
1027 )
1028fi
1029
Darren Tucker4398cf52004-04-06 21:39:02 +10001030if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1031 AC_MSG_CHECKING(if getaddrinfo seems to work)
1032 AC_TRY_RUN(
1033 [
1034#include <stdio.h>
1035#include <sys/socket.h>
1036#include <netdb.h>
1037#include <errno.h>
1038#include <netinet/in.h>
1039
1040#define TEST_PORT "2222"
1041
1042int
1043main(void)
1044{
1045 int err, sock;
1046 struct addrinfo *gai_ai, *ai, hints;
1047 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1048
1049 memset(&hints, 0, sizeof(hints));
1050 hints.ai_family = PF_UNSPEC;
1051 hints.ai_socktype = SOCK_STREAM;
1052 hints.ai_flags = AI_PASSIVE;
1053
1054 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1055 if (err != 0) {
1056 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1057 exit(1);
1058 }
1059
1060 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1061 if (ai->ai_family != AF_INET6)
1062 continue;
1063
1064 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1065 sizeof(ntop), strport, sizeof(strport),
1066 NI_NUMERICHOST|NI_NUMERICSERV);
1067
1068 if (err != 0) {
1069 if (err == EAI_SYSTEM)
1070 perror("getnameinfo EAI_SYSTEM");
1071 else
1072 fprintf(stderr, "getnameinfo failed: %s\n",
1073 gai_strerror(err));
1074 exit(2);
1075 }
1076
1077 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1078 if (sock < 0)
1079 perror("socket");
1080 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1081 if (errno == EBADF)
1082 exit(3);
1083 }
1084 }
1085 exit(0);
1086}
1087 ],
1088 [
1089 AC_MSG_RESULT(yes)
1090 ],
1091 [
1092 AC_MSG_RESULT(no)
1093 AC_DEFINE(BROKEN_GETADDRINFO)
1094 ]
1095 )
1096fi
1097
Damien Miller606f8802000-09-16 15:39:56 +11001098AC_FUNC_GETPGRP
1099
Damien Millera64b57a2001-01-17 10:44:13 +11001100# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001101PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001102AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001103 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001104 [
Damien Millera64b57a2001-01-17 10:44:13 +11001105 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001106 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1107 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001108 AC_MSG_ERROR([PAM headers not found])
1109 fi
1110
1111 AC_CHECK_LIB(dl, dlopen, , )
1112 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1113 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001114 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001115
Damien Millera64b57a2001-01-17 10:44:13 +11001116 PAM_MSG="yes"
1117
1118 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001119 if test $ac_cv_lib_dl_dlopen = yes; then
1120 LIBPAM="-lpam -ldl"
1121 else
1122 LIBPAM="-lpam"
1123 fi
1124 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001125 fi
1126 ]
1127)
Damien Millera22ba012000-03-02 23:09:20 +11001128
Damien Millera64b57a2001-01-17 10:44:13 +11001129# Check for older PAM
1130if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001131 # Check PAM strerror arguments (old PAM)
1132 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1133 AC_TRY_COMPILE(
1134 [
Damien Miller81171112000-04-23 11:14:01 +10001135#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001136#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001137#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001138#elif defined (HAVE_PAM_PAM_APPL_H)
1139#include <pam/pam_appl.h>
1140#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001141 ],
1142 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001143 [AC_MSG_RESULT(no)],
1144 [
1145 AC_DEFINE(HAVE_OLD_PAM)
1146 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001147 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001148 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001149 )
Damien Millera22ba012000-03-02 23:09:20 +11001150fi
1151
Tim Riceaef73712002-05-11 13:17:42 -07001152# Search for OpenSSL
1153saved_CPPFLAGS="$CPPFLAGS"
1154saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001155AC_ARG_WITH(ssl-dir,
1156 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1157 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001158 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001159 if test -d "$withval/lib"; then
1160 if test -n "${need_dash_r}"; then
1161 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1162 else
1163 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1164 fi
1165 else
1166 if test -n "${need_dash_r}"; then
1167 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1168 else
1169 LDFLAGS="-L${withval} ${LDFLAGS}"
1170 fi
1171 fi
1172 if test -d "$withval/include"; then
1173 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1174 else
1175 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1176 fi
Damien Millera22ba012000-03-02 23:09:20 +11001177 fi
1178 ]
1179)
Tim Rice3d5352e2004-02-12 09:27:21 -08001180LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001181AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001182 [
Tim Riceaef73712002-05-11 13:17:42 -07001183 dnl Check default openssl install dir
1184 if test -n "${need_dash_r}"; then
1185 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001186 else
Tim Riceaef73712002-05-11 13:17:42 -07001187 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001188 fi
Tim Riceaef73712002-05-11 13:17:42 -07001189 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1190 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1191 [
1192 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1193 ]
1194 )
1195 ]
1196)
1197
Tim Riced730b782002-08-13 18:52:10 -07001198# Determine OpenSSL header version
1199AC_MSG_CHECKING([OpenSSL header version])
1200AC_TRY_RUN(
1201 [
1202#include <stdio.h>
1203#include <string.h>
1204#include <openssl/opensslv.h>
1205#define DATA "conftest.sslincver"
1206int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001207 FILE *fd;
1208 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001209
Damien Millera8e06ce2003-11-21 23:48:55 +11001210 fd = fopen(DATA,"w");
1211 if(fd == NULL)
1212 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001213
1214 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1215 exit(1);
1216
1217 exit(0);
1218}
1219 ],
1220 [
1221 ssl_header_ver=`cat conftest.sslincver`
1222 AC_MSG_RESULT($ssl_header_ver)
1223 ],
1224 [
1225 AC_MSG_RESULT(not found)
1226 AC_MSG_ERROR(OpenSSL version header not found.)
1227 ]
1228)
1229
1230# Determine OpenSSL library version
1231AC_MSG_CHECKING([OpenSSL library version])
1232AC_TRY_RUN(
1233 [
1234#include <stdio.h>
1235#include <string.h>
1236#include <openssl/opensslv.h>
1237#include <openssl/crypto.h>
1238#define DATA "conftest.ssllibver"
1239int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001240 FILE *fd;
1241 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001242
Damien Millera8e06ce2003-11-21 23:48:55 +11001243 fd = fopen(DATA,"w");
1244 if(fd == NULL)
1245 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001246
1247 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1248 exit(1);
1249
1250 exit(0);
1251}
1252 ],
1253 [
1254 ssl_library_ver=`cat conftest.ssllibver`
1255 AC_MSG_RESULT($ssl_library_ver)
1256 ],
1257 [
1258 AC_MSG_RESULT(not found)
1259 AC_MSG_ERROR(OpenSSL library not found.)
1260 ]
1261)
Damien Millera22ba012000-03-02 23:09:20 +11001262
Damien Millerec932372002-01-22 22:16:03 +11001263# Sanity check OpenSSL headers
1264AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1265AC_TRY_RUN(
1266 [
1267#include <string.h>
1268#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001269int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001270 ],
1271 [
1272 AC_MSG_RESULT(yes)
1273 ],
1274 [
1275 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001276 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1277Check config.log for details.
1278Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001279 ]
1280)
1281
Tim Rice3d5352e2004-02-12 09:27:21 -08001282# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1283# because the system crypt() is more featureful.
1284if test "x$check_for_libcrypt_before" = "x1"; then
1285 AC_CHECK_LIB(crypt, crypt)
1286fi
1287
Damien Millera8e06ce2003-11-21 23:48:55 +11001288# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001289# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001290if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001291 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001292fi
1293
Damien Miller6c21c512002-01-22 21:57:53 +11001294
1295### Configure cryptographic random number support
1296
1297# Check wheter OpenSSL seeds itself
1298AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1299AC_TRY_RUN(
1300 [
1301#include <string.h>
1302#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001303int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001304 ],
1305 [
1306 OPENSSL_SEEDS_ITSELF=yes
1307 AC_MSG_RESULT(yes)
1308 ],
1309 [
1310 AC_MSG_RESULT(no)
1311 # Default to use of the rand helper if OpenSSL doesn't
1312 # seed itself
1313 USE_RAND_HELPER=yes
1314 ]
1315)
1316
1317
1318# Do we want to force the use of the rand helper?
1319AC_ARG_WITH(rand-helper,
1320 [ --with-rand-helper Use subprocess to gather strong randomness ],
1321 [
1322 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001323 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001324 # the previous test showed it to be unseeded.
1325 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1326 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1327 OPENSSL_SEEDS_ITSELF=yes
1328 USE_RAND_HELPER=""
1329 fi
1330 else
1331 USE_RAND_HELPER=yes
1332 fi
1333 ],
1334)
1335
1336# Which randomness source do we use?
1337if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1338 # OpenSSL only
1339 AC_DEFINE(OPENSSL_PRNG_ONLY)
1340 RAND_MSG="OpenSSL internal ONLY"
1341 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001342elif test ! -z "$USE_RAND_HELPER" ; then
1343 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001344 RAND_MSG="ssh-rand-helper"
1345 INSTALL_SSH_RAND_HELPER="yes"
1346fi
1347AC_SUBST(INSTALL_SSH_RAND_HELPER)
1348
1349### Configuration of ssh-rand-helper
1350
1351# PRNGD TCP socket
1352AC_ARG_WITH(prngd-port,
1353 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1354 [
Damien Millere996d722002-01-23 11:20:59 +11001355 case "$withval" in
1356 no)
1357 withval=""
1358 ;;
1359 [[0-9]]*)
1360 ;;
1361 *)
1362 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1363 ;;
1364 esac
1365 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001366 PRNGD_PORT="$withval"
1367 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1368 fi
1369 ]
1370)
1371
1372# PRNGD Unix domain socket
1373AC_ARG_WITH(prngd-socket,
1374 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1375 [
Damien Millere996d722002-01-23 11:20:59 +11001376 case "$withval" in
1377 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001378 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001379 ;;
1380 no)
1381 withval=""
1382 ;;
1383 /*)
1384 ;;
1385 *)
1386 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1387 ;;
1388 esac
1389
1390 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001391 if test ! -z "$PRNGD_PORT" ; then
1392 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1393 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001394 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001395 AC_MSG_WARN(Entropy socket is not readable)
1396 fi
1397 PRNGD_SOCKET="$withval"
1398 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1399 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001400 ],
1401 [
1402 # Check for existing socket only if we don't have a random device already
1403 if test "$USE_RAND_HELPER" = yes ; then
1404 AC_MSG_CHECKING(for PRNGD/EGD socket)
1405 # Insert other locations here
1406 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1407 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1408 PRNGD_SOCKET="$sock"
1409 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1410 break;
1411 fi
1412 done
1413 if test ! -z "$PRNGD_SOCKET" ; then
1414 AC_MSG_RESULT($PRNGD_SOCKET)
1415 else
1416 AC_MSG_RESULT(not found)
1417 fi
1418 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001419 ]
1420)
1421
1422# Change default command timeout for hashing entropy source
1423entropy_timeout=200
1424AC_ARG_WITH(entropy-timeout,
1425 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1426 [
1427 if test "x$withval" != "xno" ; then
1428 entropy_timeout=$withval
1429 fi
1430 ]
1431)
Damien Miller6c21c512002-01-22 21:57:53 +11001432AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1433
Damien Millerd3f6ad22002-06-25 10:24:47 +10001434SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001435AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001436 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001437 [
1438 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001439 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001440 fi
1441 ]
1442)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001443AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1444AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001445
Tim Rice88f2ab52002-03-17 12:17:34 -08001446# We do this little dance with the search path to insure
1447# that programs that we select for use by installed programs
1448# (which may be run by the super-user) come from trusted
1449# locations before they come from the user's private area.
1450# This should help avoid accidentally configuring some
1451# random version of a program in someone's personal bin.
1452
1453OPATH=$PATH
1454PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001455test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001456test -d /sbin && PATH=$PATH:/sbin
1457test -d /usr/sbin && PATH=$PATH:/usr/sbin
1458PATH=$PATH:/etc:$OPATH
1459
Damien Millera8e06ce2003-11-21 23:48:55 +11001460# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001461OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1462OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1463OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1464OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1465OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1466OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1467OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1468OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1469OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1470OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1471OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1472OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1473OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1474OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1475OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1476OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001477# restore PATH
1478PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001479
1480# Where does ssh-rand-helper get its randomness from?
1481INSTALL_SSH_PRNG_CMDS=""
1482if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1483 if test ! -z "$PRNGD_PORT" ; then
1484 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1485 elif test ! -z "$PRNGD_SOCKET" ; then
1486 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1487 else
1488 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1489 RAND_HELPER_CMDHASH=yes
1490 INSTALL_SSH_PRNG_CMDS="yes"
1491 fi
1492fi
1493AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1494
1495
Ben Lindstromb5628642000-10-18 00:02:25 +00001496# Cheap hack to ensure NEWS-OS libraries are arranged right.
1497if test ! -z "$SONY" ; then
1498 LIBS="$LIBS -liberty";
1499fi
1500
Damien Millera22ba012000-03-02 23:09:20 +11001501# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001502AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001503AC_CHECK_SIZEOF(short int, 2)
1504AC_CHECK_SIZEOF(int, 4)
1505AC_CHECK_SIZEOF(long int, 4)
1506AC_CHECK_SIZEOF(long long int, 8)
1507
Damien Millerfa2bb692002-04-23 23:22:25 +10001508# Sanity check long long for some platforms (AIX)
1509if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1510 ac_cv_sizeof_long_long_int=0
1511fi
1512
Damien Millera22ba012000-03-02 23:09:20 +11001513# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001514AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1515 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001516 [ #include <sys/types.h> ],
1517 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001518 [ ac_cv_have_u_int="yes" ],
1519 [ ac_cv_have_u_int="no" ]
1520 )
1521])
1522if test "x$ac_cv_have_u_int" = "xyes" ; then
1523 AC_DEFINE(HAVE_U_INT)
1524 have_u_int=1
1525fi
1526
Damien Miller61e50f12000-05-08 20:49:37 +10001527AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1528 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001529 [ #include <sys/types.h> ],
1530 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001531 [ ac_cv_have_intxx_t="yes" ],
1532 [ ac_cv_have_intxx_t="no" ]
1533 )
1534])
1535if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1536 AC_DEFINE(HAVE_INTXX_T)
1537 have_intxx_t=1
1538fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001539
1540if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001541 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001542then
1543 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1544 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001545 [ #include <stdint.h> ],
1546 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001547 [
1548 AC_DEFINE(HAVE_INTXX_T)
1549 AC_MSG_RESULT(yes)
1550 ],
1551 [ AC_MSG_RESULT(no) ]
1552 )
1553fi
1554
Damien Miller578783e2000-09-23 14:12:24 +11001555AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1556 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001557 [
1558#include <sys/types.h>
1559#ifdef HAVE_STDINT_H
1560# include <stdint.h>
1561#endif
1562#include <sys/socket.h>
1563#ifdef HAVE_SYS_BITYPES_H
1564# include <sys/bitypes.h>
1565#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001566 ],
1567 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001568 [ ac_cv_have_int64_t="yes" ],
1569 [ ac_cv_have_int64_t="no" ]
1570 )
1571])
1572if test "x$ac_cv_have_int64_t" = "xyes" ; then
1573 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001574fi
1575
Damien Miller61e50f12000-05-08 20:49:37 +10001576AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1577 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001578 [ #include <sys/types.h> ],
1579 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001580 [ ac_cv_have_u_intxx_t="yes" ],
1581 [ ac_cv_have_u_intxx_t="no" ]
1582 )
1583])
1584if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1585 AC_DEFINE(HAVE_U_INTXX_T)
1586 have_u_intxx_t=1
1587fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001588
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001589if test -z "$have_u_intxx_t" ; then
1590 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1591 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001592 [ #include <sys/socket.h> ],
1593 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001594 [
1595 AC_DEFINE(HAVE_U_INTXX_T)
1596 AC_MSG_RESULT(yes)
1597 ],
1598 [ AC_MSG_RESULT(no) ]
1599 )
1600fi
1601
Damien Miller578783e2000-09-23 14:12:24 +11001602AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1603 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001604 [ #include <sys/types.h> ],
1605 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001606 [ ac_cv_have_u_int64_t="yes" ],
1607 [ ac_cv_have_u_int64_t="no" ]
1608 )
1609])
1610if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1611 AC_DEFINE(HAVE_U_INT64_T)
1612 have_u_int64_t=1
1613fi
1614
Tim Rice4cec93f2002-02-26 08:40:48 -08001615if test -z "$have_u_int64_t" ; then
1616 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1617 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001618 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001619 [ u_int64_t a; a = 1],
1620 [
1621 AC_DEFINE(HAVE_U_INT64_T)
1622 AC_MSG_RESULT(yes)
1623 ],
1624 [ AC_MSG_RESULT(no) ]
1625 )
1626fi
1627
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001628if test -z "$have_u_intxx_t" ; then
1629 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1630 AC_TRY_COMPILE(
1631 [
1632#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001633 ],
1634 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001635 [ ac_cv_have_uintxx_t="yes" ],
1636 [ ac_cv_have_uintxx_t="no" ]
1637 )
1638 ])
1639 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1640 AC_DEFINE(HAVE_UINTXX_T)
1641 fi
1642fi
1643
1644if test -z "$have_uintxx_t" ; then
1645 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1646 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001647 [ #include <stdint.h> ],
1648 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001649 [
1650 AC_DEFINE(HAVE_UINTXX_T)
1651 AC_MSG_RESULT(yes)
1652 ],
1653 [ AC_MSG_RESULT(no) ]
1654 )
1655fi
1656
Damien Milleredb82922000-06-20 13:25:52 +10001657if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001658 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001659then
1660 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1661 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001662 [
1663#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001664 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001665 [
Damien Miller70494d12000-04-03 15:57:06 +10001666 int8_t a; int16_t b; int32_t c;
1667 u_int8_t e; u_int16_t f; u_int32_t g;
1668 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001669 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001670 [
1671 AC_DEFINE(HAVE_U_INTXX_T)
1672 AC_DEFINE(HAVE_INTXX_T)
1673 AC_MSG_RESULT(yes)
1674 ],
1675 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001676 )
Damien Millerb29ea912000-01-15 14:12:03 +11001677fi
1678
Damien Miller58be7382001-09-15 21:31:54 +10001679
1680AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1681 AC_TRY_COMPILE(
1682 [
1683#include <sys/types.h>
1684 ],
1685 [ u_char foo; foo = 125; ],
1686 [ ac_cv_have_u_char="yes" ],
1687 [ ac_cv_have_u_char="no" ]
1688 )
1689])
1690if test "x$ac_cv_have_u_char" = "xyes" ; then
1691 AC_DEFINE(HAVE_U_CHAR)
1692fi
1693
Tim Rice13aae5e2001-10-21 17:53:58 -07001694TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001695
Tim Rice200a5c02002-02-26 22:12:34 -08001696AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001697
Damien Miller61e50f12000-05-08 20:49:37 +10001698AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1699 AC_TRY_COMPILE(
1700 [
1701#include <sys/types.h>
1702 ],
1703 [ size_t foo; foo = 1235; ],
1704 [ ac_cv_have_size_t="yes" ],
1705 [ ac_cv_have_size_t="no" ]
1706 )
1707])
1708if test "x$ac_cv_have_size_t" = "xyes" ; then
1709 AC_DEFINE(HAVE_SIZE_T)
1710fi
Damien Miller95058511999-12-29 10:36:45 +11001711
Damien Miller615f9392000-05-17 22:53:33 +10001712AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1713 AC_TRY_COMPILE(
1714 [
1715#include <sys/types.h>
1716 ],
1717 [ ssize_t foo; foo = 1235; ],
1718 [ ac_cv_have_ssize_t="yes" ],
1719 [ ac_cv_have_ssize_t="no" ]
1720 )
1721])
1722if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1723 AC_DEFINE(HAVE_SSIZE_T)
1724fi
1725
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001726AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1727 AC_TRY_COMPILE(
1728 [
1729#include <time.h>
1730 ],
1731 [ clock_t foo; foo = 1235; ],
1732 [ ac_cv_have_clock_t="yes" ],
1733 [ ac_cv_have_clock_t="no" ]
1734 )
1735])
1736if test "x$ac_cv_have_clock_t" = "xyes" ; then
1737 AC_DEFINE(HAVE_CLOCK_T)
1738fi
1739
Damien Millerb54b40e2000-06-23 08:23:34 +10001740AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1741 AC_TRY_COMPILE(
1742 [
1743#include <sys/types.h>
1744#include <sys/socket.h>
1745 ],
1746 [ sa_family_t foo; foo = 1235; ],
1747 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001748 [ AC_TRY_COMPILE(
1749 [
1750#include <sys/types.h>
1751#include <sys/socket.h>
1752#include <netinet/in.h>
1753 ],
1754 [ sa_family_t foo; foo = 1235; ],
1755 [ ac_cv_have_sa_family_t="yes" ],
1756
Damien Millerb54b40e2000-06-23 08:23:34 +10001757 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001758 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001759 )
1760])
1761if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1762 AC_DEFINE(HAVE_SA_FAMILY_T)
1763fi
1764
Damien Miller0f91b4e2000-06-18 15:43:25 +10001765AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1766 AC_TRY_COMPILE(
1767 [
1768#include <sys/types.h>
1769 ],
1770 [ pid_t foo; foo = 1235; ],
1771 [ ac_cv_have_pid_t="yes" ],
1772 [ ac_cv_have_pid_t="no" ]
1773 )
1774])
1775if test "x$ac_cv_have_pid_t" = "xyes" ; then
1776 AC_DEFINE(HAVE_PID_T)
1777fi
1778
1779AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1780 AC_TRY_COMPILE(
1781 [
1782#include <sys/types.h>
1783 ],
1784 [ mode_t foo; foo = 1235; ],
1785 [ ac_cv_have_mode_t="yes" ],
1786 [ ac_cv_have_mode_t="no" ]
1787 )
1788])
1789if test "x$ac_cv_have_mode_t" = "xyes" ; then
1790 AC_DEFINE(HAVE_MODE_T)
1791fi
1792
Damien Miller61e50f12000-05-08 20:49:37 +10001793
1794AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1795 AC_TRY_COMPILE(
1796 [
Damien Miller81171112000-04-23 11:14:01 +10001797#include <sys/types.h>
1798#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001799 ],
1800 [ struct sockaddr_storage s; ],
1801 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1802 [ ac_cv_have_struct_sockaddr_storage="no" ]
1803 )
1804])
1805if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1806 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1807fi
Damien Miller34132e52000-01-14 15:45:46 +11001808
Damien Miller61e50f12000-05-08 20:49:37 +10001809AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1810 AC_TRY_COMPILE(
1811 [
Damien Miller7b22d652000-06-18 14:07:04 +10001812#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001813#include <netinet/in.h>
1814 ],
1815 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1816 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1817 [ ac_cv_have_struct_sockaddr_in6="no" ]
1818 )
1819])
1820if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1821 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1822fi
Damien Miller34132e52000-01-14 15:45:46 +11001823
Damien Miller61e50f12000-05-08 20:49:37 +10001824AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1825 AC_TRY_COMPILE(
1826 [
Damien Miller7b22d652000-06-18 14:07:04 +10001827#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001828#include <netinet/in.h>
1829 ],
1830 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1831 [ ac_cv_have_struct_in6_addr="yes" ],
1832 [ ac_cv_have_struct_in6_addr="no" ]
1833 )
1834])
1835if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1836 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1837fi
Damien Miller34132e52000-01-14 15:45:46 +11001838
Damien Miller61e50f12000-05-08 20:49:37 +10001839AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1840 AC_TRY_COMPILE(
1841 [
Damien Miller81171112000-04-23 11:14:01 +10001842#include <sys/types.h>
1843#include <sys/socket.h>
1844#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001845 ],
1846 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1847 [ ac_cv_have_struct_addrinfo="yes" ],
1848 [ ac_cv_have_struct_addrinfo="no" ]
1849 )
1850])
1851if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1852 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1853fi
1854
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001855AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1856 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001857 [ #include <sys/time.h> ],
1858 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001859 [ ac_cv_have_struct_timeval="yes" ],
1860 [ ac_cv_have_struct_timeval="no" ]
1861 )
1862])
1863if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1864 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1865 have_struct_timeval=1
1866fi
1867
Tim Rice4e4dc562003-03-18 10:21:40 -08001868AC_CHECK_TYPES(struct timespec)
1869
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001870# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001871if test "x$ac_cv_have_int64_t" = "xno" -a \
1872 "x$ac_cv_sizeof_long_int" != "x8" -a \
1873 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001874 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1875 echo "an alternative compiler (I.E., GCC) before continuing."
1876 echo ""
1877 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001878else
1879dnl test snprintf (broken on SCO w/gcc)
1880 AC_TRY_RUN(
1881 [
1882#include <stdio.h>
1883#include <string.h>
1884#ifdef HAVE_SNPRINTF
1885main()
1886{
1887 char buf[50];
1888 char expected_out[50];
1889 int mazsize = 50 ;
1890#if (SIZEOF_LONG_INT == 8)
1891 long int num = 0x7fffffffffffffff;
1892#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001893 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001894#endif
1895 strcpy(expected_out, "9223372036854775807");
1896 snprintf(buf, mazsize, "%lld", num);
1897 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001898 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001899 exit(0);
1900}
1901#else
1902main() { exit(0); }
1903#endif
1904 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1905 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001906fi
1907
Damien Miller78315eb2000-09-29 23:01:36 +11001908dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001909OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1910OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1911OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1912OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1913OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001914OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001915OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1916OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001917OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001918OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1919OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1920OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1921OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001922OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1923OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1924OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1925OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001926
1927AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001928
Damien Miller61e50f12000-05-08 20:49:37 +10001929AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1930 ac_cv_have_ss_family_in_struct_ss, [
1931 AC_TRY_COMPILE(
1932 [
Damien Miller81171112000-04-23 11:14:01 +10001933#include <sys/types.h>
1934#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001935 ],
1936 [ struct sockaddr_storage s; s.ss_family = 1; ],
1937 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1938 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1939 )
1940])
1941if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1942 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1943fi
1944
Damien Miller61e50f12000-05-08 20:49:37 +10001945AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1946 ac_cv_have___ss_family_in_struct_ss, [
1947 AC_TRY_COMPILE(
1948 [
Damien Miller81171112000-04-23 11:14:01 +10001949#include <sys/types.h>
1950#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001951 ],
1952 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1953 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1954 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1955 )
1956])
1957if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1958 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1959fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001960
Damien Millerad833b32000-08-23 10:46:23 +10001961AC_CACHE_CHECK([for pw_class field in struct passwd],
1962 ac_cv_have_pw_class_in_struct_passwd, [
1963 AC_TRY_COMPILE(
1964 [
Damien Millerad833b32000-08-23 10:46:23 +10001965#include <pwd.h>
1966 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001967 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001968 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1969 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1970 )
1971])
1972if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1973 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1974fi
1975
Kevin Steves82456952001-06-22 21:14:18 +00001976AC_CACHE_CHECK([for pw_expire field in struct passwd],
1977 ac_cv_have_pw_expire_in_struct_passwd, [
1978 AC_TRY_COMPILE(
1979 [
1980#include <pwd.h>
1981 ],
1982 [ struct passwd p; p.pw_expire = 0; ],
1983 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1984 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1985 )
1986])
1987if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1988 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1989fi
1990
1991AC_CACHE_CHECK([for pw_change field in struct passwd],
1992 ac_cv_have_pw_change_in_struct_passwd, [
1993 AC_TRY_COMPILE(
1994 [
1995#include <pwd.h>
1996 ],
1997 [ struct passwd p; p.pw_change = 0; ],
1998 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1999 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2000 )
2001])
2002if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2003 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2004fi
Damien Miller61e50f12000-05-08 20:49:37 +10002005
Tim Rice28bbb0c2002-05-27 17:37:32 -07002006dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002007AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2008 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002009 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002010 [
Tim Riceae49fe62002-04-12 10:26:21 -07002011#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002012#include <sys/socket.h>
2013#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002014int main() {
2015#ifdef msg_accrights
2016exit(1);
2017#endif
2018struct msghdr m;
2019m.msg_accrights = 0;
2020exit(0);
2021}
Kevin Steves939c9db2002-03-22 17:23:25 +00002022 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002023 [ ac_cv_have_accrights_in_msghdr="yes" ],
2024 [ ac_cv_have_accrights_in_msghdr="no" ]
2025 )
2026])
2027if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2028 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2029fi
2030
Kevin Stevesa44e0352002-04-07 16:18:03 +00002031AC_CACHE_CHECK([for msg_control field in struct msghdr],
2032 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002033 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002034 [
Tim Riceae49fe62002-04-12 10:26:21 -07002035#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002036#include <sys/socket.h>
2037#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002038int main() {
2039#ifdef msg_control
2040exit(1);
2041#endif
2042struct msghdr m;
2043m.msg_control = 0;
2044exit(0);
2045}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002046 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002047 [ ac_cv_have_control_in_msghdr="yes" ],
2048 [ ac_cv_have_control_in_msghdr="no" ]
2049 )
2050])
2051if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2052 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2053fi
2054
Damien Miller61e50f12000-05-08 20:49:37 +10002055AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002056 AC_TRY_LINK([],
2057 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002058 [ ac_cv_libc_defines___progname="yes" ],
2059 [ ac_cv_libc_defines___progname="no" ]
2060 )
2061])
2062if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2063 AC_DEFINE(HAVE___PROGNAME)
2064fi
2065
Kevin Steves4846f4a2002-03-22 18:19:53 +00002066AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2067 AC_TRY_LINK([
2068#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002069],
2070 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002071 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2072 [ ac_cv_cc_implements___FUNCTION__="no" ]
2073 )
2074])
2075if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2076 AC_DEFINE(HAVE___FUNCTION__)
2077fi
2078
2079AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2080 AC_TRY_LINK([
2081#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002082],
2083 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002084 [ ac_cv_cc_implements___func__="yes" ],
2085 [ ac_cv_cc_implements___func__="no" ]
2086 )
2087])
2088if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2089 AC_DEFINE(HAVE___func__)
2090fi
2091
Damien Miller4f8e6692001-07-14 13:22:53 +10002092AC_CACHE_CHECK([whether getopt has optreset support],
2093 ac_cv_have_getopt_optreset, [
2094 AC_TRY_LINK(
2095 [
2096#include <getopt.h>
2097 ],
2098 [ extern int optreset; optreset = 0; ],
2099 [ ac_cv_have_getopt_optreset="yes" ],
2100 [ ac_cv_have_getopt_optreset="no" ]
2101 )
2102])
2103if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2104 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2105fi
Damien Millera22ba012000-03-02 23:09:20 +11002106
Damien Millerecbb26d2000-07-15 14:59:14 +10002107AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002108 AC_TRY_LINK([],
2109 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002110 [ ac_cv_libc_defines_sys_errlist="yes" ],
2111 [ ac_cv_libc_defines_sys_errlist="no" ]
2112 )
2113])
2114if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2115 AC_DEFINE(HAVE_SYS_ERRLIST)
2116fi
2117
2118
Damien Miller11fa2cc2000-08-16 10:35:58 +10002119AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002120 AC_TRY_LINK([],
2121 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002122 [ ac_cv_libc_defines_sys_nerr="yes" ],
2123 [ ac_cv_libc_defines_sys_nerr="no" ]
2124 )
2125])
2126if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2127 AC_DEFINE(HAVE_SYS_NERR)
2128fi
2129
Damien Millera8e06ce2003-11-21 23:48:55 +11002130SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002131# Check whether user wants sectok support
2132AC_ARG_WITH(sectok,
2133 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002134 [
2135 if test "x$withval" != "xno" ; then
2136 if test "x$withval" != "xyes" ; then
2137 CPPFLAGS="$CPPFLAGS -I${withval}"
2138 LDFLAGS="$LDFLAGS -L${withval}"
2139 if test ! -z "$need_dash_r" ; then
2140 LDFLAGS="$LDFLAGS -R${withval}"
2141 fi
2142 if test ! -z "$blibpath" ; then
2143 blibpath="$blibpath:${withval}"
2144 fi
2145 fi
2146 AC_CHECK_HEADERS(sectok.h)
2147 if test "$ac_cv_header_sectok_h" != yes; then
2148 AC_MSG_ERROR(Can't find sectok.h)
2149 fi
2150 AC_CHECK_LIB(sectok, sectok_open)
2151 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2152 AC_MSG_ERROR(Can't find libsectok)
2153 fi
2154 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002155 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002156 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002157 fi
2158 ]
2159)
2160
2161# Check whether user wants OpenSC support
2162AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002163 AC_HELP_STRING([--with-opensc=PFX],
2164 [Enable smartcard support using OpenSC]),
2165 opensc_config_prefix="$withval", opensc_config_prefix="")
2166if test x$opensc_config_prefix != x ; then
2167 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2168 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2169 if test "$OPENSC_CONFIG" != "no"; then
2170 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2171 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2172 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2173 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2174 AC_DEFINE(SMARTCARD)
2175 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002177 fi
2178fi
Damien Miller85de5802001-09-18 14:01:11 +10002179
Darren Tucker5f88d342003-10-15 16:57:57 +10002180# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002181AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002182 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002183 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002184 # Needed by our getrrsetbyname()
2185 AC_SEARCH_LIBS(res_query, resolv)
2186 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002187 AC_MSG_CHECKING(if res_query will link)
2188 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2189 [AC_MSG_RESULT(no)
2190 saved_LIBS="$LIBS"
2191 LIBS="$LIBS -lresolv"
2192 AC_MSG_CHECKING(for res_query in -lresolv)
2193 AC_LINK_IFELSE([
2194#include <resolv.h>
2195int main()
2196{
2197 res_query (0, 0, 0, 0, 0);
2198 return 0;
2199}
2200 ],
2201 [LIBS="$LIBS -lresolv"
2202 AC_MSG_RESULT(yes)],
2203 [LIBS="$saved_LIBS"
2204 AC_MSG_RESULT(no)])
2205 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002206 AC_CHECK_FUNCS(_getshort _getlong)
2207 AC_CHECK_MEMBER(HEADER.ad,
2208 [AC_DEFINE(HAVE_HEADER_AD)],,
2209 [#include <arpa/nameser.h>])
2210 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002211
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002212# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002213KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002214AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002215 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002216 [ if test "x$withval" != "xno" ; then
2217 if test "x$withval" = "xyes" ; then
2218 KRB5ROOT="/usr/local"
2219 else
2220 KRB5ROOT=${withval}
2221 fi
2222
2223 AC_DEFINE(KRB5)
2224 KRB5_MSG="yes"
2225
2226 AC_MSG_CHECKING(for krb5-config)
2227 if test -x $KRB5ROOT/bin/krb5-config ; then
2228 KRB5CONF=$KRB5ROOT/bin/krb5-config
2229 AC_MSG_RESULT($KRB5CONF)
2230
2231 AC_MSG_CHECKING(for gssapi support)
2232 if $KRB5CONF | grep gssapi >/dev/null ; then
2233 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002234 AC_DEFINE(GSSAPI)
2235 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002236 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002237 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002238 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002239 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002240 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2241 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002242 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002243 AC_MSG_CHECKING(whether we are using Heimdal)
2244 AC_TRY_COMPILE([ #include <krb5.h> ],
2245 [ char *tmp = heimdal_version; ],
2246 [ AC_MSG_RESULT(yes)
2247 AC_DEFINE(HEIMDAL) ],
2248 AC_MSG_RESULT(no)
2249 )
2250 else
2251 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002252 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002253 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002254 AC_MSG_CHECKING(whether we are using Heimdal)
2255 AC_TRY_COMPILE([ #include <krb5.h> ],
2256 [ char *tmp = heimdal_version; ],
2257 [ AC_MSG_RESULT(yes)
2258 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002259 K5LIBS="-lkrb5 -ldes"
2260 K5LIBS="$K5LIBS -lcom_err -lasn1"
2261 AC_CHECK_LIB(roken, net_write,
2262 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002263 ],
2264 [ AC_MSG_RESULT(no)
2265 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2266 ]
2267 )
Damien Miller200d0a72003-06-30 19:21:36 +10002268 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002269
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002270 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2271 [ AC_DEFINE(GSSAPI)
2272 K5LIBS="-lgssapi $K5LIBS" ],
2273 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2274 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002275 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002276 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2277 $K5LIBS)
2278 ],
2279 $K5LIBS)
2280
2281 AC_CHECK_HEADER(gssapi.h, ,
2282 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002283 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002284 AC_CHECK_HEADERS(gssapi.h, ,
2285 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002286 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002287 ]
2288 )
2289
2290 oldCPP="$CPPFLAGS"
2291 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2292 AC_CHECK_HEADER(gssapi_krb5.h, ,
2293 [ CPPFLAGS="$oldCPP" ])
2294
Damien Millera8e06ce2003-11-21 23:48:55 +11002295 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002296 if test ! -z "$need_dash_r" ; then
2297 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2298 fi
2299 if test ! -z "$blibpath" ; then
2300 blibpath="$blibpath:${KRB5ROOT}/lib"
2301 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002302 fi
2303
2304 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2305 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2306 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2307
2308 LIBS="$LIBS $K5LIBS"
2309 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002310 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002311 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002312)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002313
Damien Millera22ba012000-03-02 23:09:20 +11002314# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002315
Damien Millerf58c6722002-05-13 13:15:42 +10002316PRIVSEP_PATH=/var/empty
2317AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002318 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002319 [
2320 if test "x$withval" != "$no" ; then
2321 PRIVSEP_PATH=$withval
2322 fi
2323 ]
2324)
2325AC_SUBST(PRIVSEP_PATH)
2326
Damien Millera22ba012000-03-02 23:09:20 +11002327AC_ARG_WITH(xauth,
2328 [ --with-xauth=PATH Specify path to xauth program ],
2329 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002330 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002331 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002332 fi
2333 ],
2334 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002335 TestPath="$PATH"
2336 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2337 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2338 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2339 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2340 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002341 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002342 xauth_path="/usr/openwin/bin/xauth"
2343 fi
2344 ]
2345)
2346
Damien Miller7d901272003-01-13 16:55:22 +11002347STRIP_OPT=-s
2348AC_ARG_ENABLE(strip,
2349 [ --disable-strip Disable calling strip(1) on install],
2350 [
2351 if test "x$enableval" = "xno" ; then
2352 STRIP_OPT=
2353 fi
2354 ]
2355)
2356AC_SUBST(STRIP_OPT)
2357
Damien Millera19cf472000-11-29 13:28:50 +11002358if test -z "$xauth_path" ; then
2359 XAUTH_PATH="undefined"
2360 AC_SUBST(XAUTH_PATH)
2361else
Damien Millera22ba012000-03-02 23:09:20 +11002362 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002363 XAUTH_PATH=$xauth_path
2364 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002365fi
Damien Millera22ba012000-03-02 23:09:20 +11002366
2367# Check for mail directory (last resort if we cannot get it from headers)
2368if test ! -z "$MAIL" ; then
2369 maildir=`dirname $MAIL`
2370 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2371fi
2372
Damien Millera22ba012000-03-02 23:09:20 +11002373if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002374 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002375 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002376 [
2377 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2378 have_dev_ptmx=1
2379 ]
2380 )
2381 fi
Damien Millera22ba012000-03-02 23:09:20 +11002382fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002383AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002384 [
2385 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2386 have_dev_ptc=1
2387 ]
2388)
2389
Damien Millera22ba012000-03-02 23:09:20 +11002390# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002391AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002392 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002393 [
Damien Miller897741e2001-04-16 10:41:46 +10002394 case "$withval" in
2395 man|cat|doc)
2396 MANTYPE=$withval
2397 ;;
2398 *)
2399 AC_MSG_ERROR(invalid man type: $withval)
2400 ;;
2401 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002402 ]
2403)
Ben Lindstrombc709922001-04-18 18:04:21 +00002404if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002405 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2406 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002407 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2408 MANTYPE=doc
2409 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2410 MANTYPE=man
2411 else
2412 MANTYPE=cat
2413 fi
2414fi
Damien Miller670a4b82000-01-22 13:53:11 +11002415AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002416if test "$MANTYPE" = "doc"; then
2417 mansubdir=man;
2418else
2419 mansubdir=$MANTYPE;
2420fi
2421AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002422
Damien Millera22ba012000-03-02 23:09:20 +11002423# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002424MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002425AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002426 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002427 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002428 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002429 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002430 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002431 fi
2432 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002433)
2434
Damien Millera22ba012000-03-02 23:09:20 +11002435# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002436AC_ARG_WITH(shadow,
2437 [ --without-shadow Disable shadow password support],
2438 [
2439 if test "x$withval" = "xno" ; then
2440 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002441 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002442 fi
2443 ]
2444)
2445
Damien Miller1f335fb2000-06-26 11:31:33 +10002446if test -z "$disable_shadow" ; then
2447 AC_MSG_CHECKING([if the systems has expire shadow information])
2448 AC_TRY_COMPILE(
2449 [
2450#include <sys/types.h>
2451#include <shadow.h>
2452 struct spwd sp;
2453 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2454 [ sp_expire_available=yes ], []
2455 )
2456
2457 if test "x$sp_expire_available" = "xyes" ; then
2458 AC_MSG_RESULT(yes)
2459 AC_DEFINE(HAS_SHADOW_EXPIRE)
2460 else
2461 AC_MSG_RESULT(no)
2462 fi
2463fi
2464
Damien Millera22ba012000-03-02 23:09:20 +11002465# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002466if test ! -z "$IPADDR_IN_DISPLAY" ; then
2467 DISPLAY_HACK_MSG="yes"
2468 AC_DEFINE(IPADDR_IN_DISPLAY)
2469else
Damien Millera8e06ce2003-11-21 23:48:55 +11002470 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002471 AC_ARG_WITH(ipaddr-display,
2472 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2473 [
2474 if test "x$withval" != "xno" ; then
2475 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002476 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002477 fi
2478 ]
2479 )
2480fi
Damien Miller76112de1999-12-21 11:18:08 +11002481
Darren Tuckere1a790d2003-09-16 11:52:19 +10002482# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002483AC_ARG_ENABLE(etc-default-login,
2484 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2485[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002486AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2487
2488if test "x$external_path_file" = "x/etc/default/login"; then
2489 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2490fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002491])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002492
Tim Rice43a1c132002-04-17 21:19:14 -07002493dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2494if test $ac_cv_func_login_getcapbool = "yes" -a \
2495 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002496 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002497fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002498
Damien Millera22ba012000-03-02 23:09:20 +11002499# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002500SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002501AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002502 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002503 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002504 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002505 AC_MSG_WARN([
2506--with-default-path=PATH has no effect on this system.
2507Edit /etc/login.conf instead.])
2508 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002509 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002510 AC_MSG_WARN([
2511--with-default-path=PATH will only be used if PATH is not defined in
2512$external_path_file .])
2513 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002514 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002515 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002516 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002517 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002518 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2519 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002520 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002521 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002522 AC_MSG_WARN([
2523If PATH is defined in $external_path_file, ensure the path to scp is included,
2524otherwise scp will not work.])
2525 fi
2526 AC_TRY_RUN(
2527 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002528/* find out what STDPATH is */
2529#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002530#ifdef HAVE_PATHS_H
2531# include <paths.h>
2532#endif
2533#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002534# ifdef _PATH_USERPATH /* Irix */
2535# define _PATH_STDPATH _PATH_USERPATH
2536# else
2537# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2538# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002539#endif
2540#include <sys/types.h>
2541#include <sys/stat.h>
2542#include <fcntl.h>
2543#define DATA "conftest.stdpath"
2544
2545main()
2546{
2547 FILE *fd;
2548 int rc;
2549
2550 fd = fopen(DATA,"w");
2551 if(fd == NULL)
2552 exit(1);
2553
2554 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2555 exit(1);
2556
2557 exit(0);
2558}
2559 ], [ user_path=`cat conftest.stdpath` ],
2560 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2561 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2562 )
2563# make sure $bindir is in USER_PATH so scp will work
2564 t_bindir=`eval echo ${bindir}`
2565 case $t_bindir in
2566 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2567 esac
2568 case $t_bindir in
2569 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2570 esac
2571 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2572 if test $? -ne 0 ; then
2573 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2574 if test $? -ne 0 ; then
2575 user_path=$user_path:$t_bindir
2576 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2577 fi
2578 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002579 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002580)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002581if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002582 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2583 AC_SUBST(user_path)
2584fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002585
Damien Millera18bbd32002-05-13 10:48:57 +10002586# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002587AC_ARG_WITH(superuser-path,
2588 [ --with-superuser-path= Specify different path for super-user],
2589 [
2590 if test "x$withval" != "xno" ; then
2591 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2592 superuser_path=$withval
2593 fi
2594 ]
2595)
2596
2597
Damien Miller61e50f12000-05-08 20:49:37 +10002598AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002599IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002600AC_ARG_WITH(4in6,
2601 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2602 [
2603 if test "x$withval" != "xno" ; then
2604 AC_MSG_RESULT(yes)
2605 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002606 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002607 else
2608 AC_MSG_RESULT(no)
2609 fi
2610 ],[
2611 if test "x$inet6_default_4in6" = "xyes"; then
2612 AC_MSG_RESULT([yes (default)])
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 (default)])
2617 fi
2618 ]
2619)
2620
Damien Miller60396b02001-02-18 17:01:00 +11002621# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002622BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002623AC_ARG_WITH(bsd-auth,
2624 [ --with-bsd-auth Enable BSD auth support],
2625 [
2626 if test "x$withval" != "xno" ; then
2627 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002628 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002629 fi
2630 ]
2631)
2632
Damien Millera22ba012000-03-02 23:09:20 +11002633# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002634piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002635# make sure the directory exists
2636if test ! -d $piddir ; then
2637 piddir=`eval echo ${sysconfdir}`
2638 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002639 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002640 esac
2641fi
2642
Tim Rice88f2ab52002-03-17 12:17:34 -08002643AC_ARG_WITH(pid-dir,
2644 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2645 [
2646 if test "x$withval" != "xno" ; then
2647 piddir=$withval
2648 if test ! -d $piddir ; then
2649 AC_MSG_WARN([** no $piddir directory on this system **])
2650 fi
2651 fi
2652 ]
2653)
2654
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002655AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002656AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002657
andre2ff7b5d2000-06-03 14:57:40 +00002658dnl allow user to disable some login recording features
2659AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002660 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002661 [
2662 if test "x$enableval" = "xno" ; then
2663 AC_DEFINE(DISABLE_LASTLOG)
2664 fi
2665 ]
andre2ff7b5d2000-06-03 14:57:40 +00002666)
2667AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002668 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002669 [
2670 if test "x$enableval" = "xno" ; then
2671 AC_DEFINE(DISABLE_UTMP)
2672 fi
2673 ]
andre2ff7b5d2000-06-03 14:57:40 +00002674)
2675AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002676 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002677 [
2678 if test "x$enableval" = "xno" ; then
2679 AC_DEFINE(DISABLE_UTMPX)
2680 fi
2681 ]
andre2ff7b5d2000-06-03 14:57:40 +00002682)
2683AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002684 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002685 [
2686 if test "x$enableval" = "xno" ; then
2687 AC_DEFINE(DISABLE_WTMP)
2688 fi
2689 ]
andre2ff7b5d2000-06-03 14:57:40 +00002690)
2691AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002692 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002693 [
2694 if test "x$enableval" = "xno" ; then
2695 AC_DEFINE(DISABLE_WTMPX)
2696 fi
2697 ]
andre2ff7b5d2000-06-03 14:57:40 +00002698)
2699AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002700 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002701 [
2702 if test "x$enableval" = "xno" ; then
2703 AC_DEFINE(DISABLE_LOGIN)
2704 fi
2705 ]
andre2ff7b5d2000-06-03 14:57:40 +00002706)
2707AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002708 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002709 [
2710 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002711 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002712 fi
2713 ]
andre2ff7b5d2000-06-03 14:57:40 +00002714)
2715AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002716 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002717 [
2718 if test "x$enableval" = "xno" ; then
2719 AC_DEFINE(DISABLE_PUTUTXLINE)
2720 fi
2721 ]
andre2ff7b5d2000-06-03 14:57:40 +00002722)
2723AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002724 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002725 [
2726 if test "x$withval" = "xno" ; then
2727 AC_DEFINE(DISABLE_LASTLOG)
2728 else
2729 conf_lastlog_location=$withval
2730 fi
2731 ]
2732)
andre2ff7b5d2000-06-03 14:57:40 +00002733
2734dnl lastlog, [uw]tmpx? detection
2735dnl NOTE: set the paths in the platform section to avoid the
2736dnl need for command-line parameters
2737dnl lastlog and [uw]tmp are subject to a file search if all else fails
2738
2739dnl lastlog detection
2740dnl NOTE: the code itself will detect if lastlog is a directory
2741AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2742AC_TRY_COMPILE([
2743#include <sys/types.h>
2744#include <utmp.h>
2745#ifdef HAVE_LASTLOG_H
2746# include <lastlog.h>
2747#endif
Damien Miller2994e082000-06-04 15:51:47 +10002748#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002749# include <paths.h>
2750#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002751#ifdef HAVE_LOGIN_H
2752# include <login.h>
2753#endif
andre2ff7b5d2000-06-03 14:57:40 +00002754 ],
2755 [ char *lastlog = LASTLOG_FILE; ],
2756 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002757 [
2758 AC_MSG_RESULT(no)
2759 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2760 AC_TRY_COMPILE([
2761#include <sys/types.h>
2762#include <utmp.h>
2763#ifdef HAVE_LASTLOG_H
2764# include <lastlog.h>
2765#endif
2766#ifdef HAVE_PATHS_H
2767# include <paths.h>
2768#endif
2769 ],
2770 [ char *lastlog = _PATH_LASTLOG; ],
2771 [ AC_MSG_RESULT(yes) ],
2772 [
andree441aa32000-06-12 22:34:38 +00002773 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002774 system_lastlog_path=no
2775 ])
2776 ]
andre2ff7b5d2000-06-03 14:57:40 +00002777)
Damien Miller2994e082000-06-04 15:51:47 +10002778
andre2ff7b5d2000-06-03 14:57:40 +00002779if test -z "$conf_lastlog_location"; then
2780 if test x"$system_lastlog_path" = x"no" ; then
2781 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002782 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002783 conf_lastlog_location=$f
2784 fi
2785 done
2786 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002787 AC_MSG_WARN([** Cannot find lastlog **])
2788 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002789 fi
2790 fi
2791fi
2792
2793if test -n "$conf_lastlog_location"; then
2794 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2795fi
2796
2797dnl utmp detection
2798AC_MSG_CHECKING([if your system defines UTMP_FILE])
2799AC_TRY_COMPILE([
2800#include <sys/types.h>
2801#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002802#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002803# include <paths.h>
2804#endif
2805 ],
2806 [ char *utmp = UTMP_FILE; ],
2807 [ AC_MSG_RESULT(yes) ],
2808 [ AC_MSG_RESULT(no)
2809 system_utmp_path=no ]
2810)
2811if test -z "$conf_utmp_location"; then
2812 if test x"$system_utmp_path" = x"no" ; then
2813 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2814 if test -f $f ; then
2815 conf_utmp_location=$f
2816 fi
2817 done
2818 if test -z "$conf_utmp_location"; then
2819 AC_DEFINE(DISABLE_UTMP)
2820 fi
2821 fi
2822fi
2823if test -n "$conf_utmp_location"; then
2824 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2825fi
2826
2827dnl wtmp detection
2828AC_MSG_CHECKING([if your system defines WTMP_FILE])
2829AC_TRY_COMPILE([
2830#include <sys/types.h>
2831#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002832#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002833# include <paths.h>
2834#endif
2835 ],
2836 [ char *wtmp = WTMP_FILE; ],
2837 [ AC_MSG_RESULT(yes) ],
2838 [ AC_MSG_RESULT(no)
2839 system_wtmp_path=no ]
2840)
2841if test -z "$conf_wtmp_location"; then
2842 if test x"$system_wtmp_path" = x"no" ; then
2843 for f in /usr/adm/wtmp /var/log/wtmp; do
2844 if test -f $f ; then
2845 conf_wtmp_location=$f
2846 fi
2847 done
2848 if test -z "$conf_wtmp_location"; then
2849 AC_DEFINE(DISABLE_WTMP)
2850 fi
2851 fi
2852fi
2853if test -n "$conf_wtmp_location"; then
2854 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2855fi
2856
2857
2858dnl utmpx detection - I don't know any system so perverse as to require
2859dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2860dnl there, though.
2861AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2862AC_TRY_COMPILE([
2863#include <sys/types.h>
2864#include <utmp.h>
2865#ifdef HAVE_UTMPX_H
2866#include <utmpx.h>
2867#endif
Damien Miller2994e082000-06-04 15:51:47 +10002868#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002869# include <paths.h>
2870#endif
2871 ],
2872 [ char *utmpx = UTMPX_FILE; ],
2873 [ AC_MSG_RESULT(yes) ],
2874 [ AC_MSG_RESULT(no)
2875 system_utmpx_path=no ]
2876)
2877if test -z "$conf_utmpx_location"; then
2878 if test x"$system_utmpx_path" = x"no" ; then
2879 AC_DEFINE(DISABLE_UTMPX)
2880 fi
2881else
2882 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2883fi
2884
2885dnl wtmpx detection
2886AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2887AC_TRY_COMPILE([
2888#include <sys/types.h>
2889#include <utmp.h>
2890#ifdef HAVE_UTMPX_H
2891#include <utmpx.h>
2892#endif
Damien Miller2994e082000-06-04 15:51:47 +10002893#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002894# include <paths.h>
2895#endif
2896 ],
2897 [ char *wtmpx = WTMPX_FILE; ],
2898 [ AC_MSG_RESULT(yes) ],
2899 [ AC_MSG_RESULT(no)
2900 system_wtmpx_path=no ]
2901)
2902if test -z "$conf_wtmpx_location"; then
2903 if test x"$system_wtmpx_path" = x"no" ; then
2904 AC_DEFINE(DISABLE_WTMPX)
2905 fi
2906else
2907 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2908fi
2909
Damien Miller4018c192000-04-30 09:30:44 +10002910
Damien Miller29ea30d2000-03-17 10:54:15 +11002911if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002912 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2913 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002914fi
2915
Tim Rice4cec93f2002-02-26 08:40:48 -08002916dnl remove pam and dl because they are in $LIBPAM
2917if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002918 LIBS=`echo $LIBS | sed 's/-lpam //'`
2919fi
2920if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2921 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002922fi
2923
Damien Millerbac2d8a2000-09-05 16:13:06 +11002924AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002925AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002926AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002927
Damien Miller7b22d652000-06-18 14:07:04 +10002928# Print summary of options
2929
Damien Miller7b22d652000-06-18 14:07:04 +10002930# Someone please show me a better way :)
2931A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2932B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2933C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2934D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002935E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002936F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002937G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002938H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2939I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2940J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002941
2942echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002943echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002944echo " User binaries: $B"
2945echo " System binaries: $C"
2946echo " Configuration files: $D"
2947echo " Askpass program: $E"
2948echo " Manual pages: $F"
2949echo " PID file: $G"
2950echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002951if test "x$external_path_file" = "x/etc/login.conf" ; then
2952echo " At runtime, sshd will use the path defined in $external_path_file"
2953echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002954else
Damien Millerf58c6722002-05-13 13:15:42 +10002955echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002956 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002957echo " (If PATH is set in $external_path_file it will be used instead. If"
2958echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2959 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002960fi
Damien Millera18bbd32002-05-13 10:48:57 +10002961if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002962echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002963fi
Damien Millerf58c6722002-05-13 13:15:42 +10002964echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002965echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002966echo " KerberosV support: $KRB5_MSG"
2967echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002968echo " S/KEY support: $SKEY_MSG"
2969echo " TCP Wrappers support: $TCPW_MSG"
2970echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002971echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002972echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2973echo " BSD Auth support: $BSD_AUTH_MSG"
2974echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002975if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002976echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002977fi
2978
Damien Miller7b22d652000-06-18 14:07:04 +10002979echo ""
2980
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002981echo " Host: ${host}"
2982echo " Compiler: ${CC}"
2983echo " Compiler flags: ${CFLAGS}"
2984echo "Preprocessor flags: ${CPPFLAGS}"
2985echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002986echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002987
2988echo ""
2989
Tim Rice6f1f7582004-05-30 21:38:51 -07002990if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
2991 echo "SVR4 style packages are supported with \"make package\"\n"
2992fi
2993
Damien Miller82cf0ce2000-12-20 13:34:48 +11002994if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002995 echo "PAM is enabled. You may need to install a PAM control file "
2996 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002997 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002998 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002999 echo ""
3000fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003001
Damien Miller6c21c512002-01-22 21:57:53 +11003002if test ! -z "$RAND_HELPER_CMDHASH" ; then
3003 echo "WARNING: you are using the builtin random number collection "
3004 echo "service. Please read WARNING.RNG and request that your OS "
3005 echo "vendor includes kernel-based random number collection in "
3006 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003007 echo ""
3008fi
Damien Miller60396b02001-02-18 17:01:00 +11003009
Damien Millerb4097182004-05-23 14:09:40 +10003010if test ! -z "$NO_PEERCHECK" ; then
3011 echo "WARNING: the operating system that you are using does not "
3012 echo "appear to support either the getpeereid() API nor the "
3013 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3014 echo "enforce security checks to prevent unauthorised connections to "
3015 echo "ssh-agent. Their absence increases the risk that a malicious "
3016 echo "user can connect to your agent. "
3017 echo ""
3018fi
3019