blob: 85d46f3857d655f9254a87f99d8cf474c6e4f040 [file] [log] [blame]
Darren Tuckercf59d312004-08-29 21:18:09 +10001# $Id: configure.ac,v 1.228 2004/08/29 11:18:09 dtucker 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 Tucker21dd0892004-08-16 23:12:05 +1000301 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000302 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000303 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
304 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000305 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000306 # hardwire lastlog location (can't detect it on some versions)
307 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000308 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
309 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
310 if test "$sol2ver" -ge 8; then
311 AC_MSG_RESULT(yes)
312 AC_DEFINE(DISABLE_UTMP)
313 AC_DEFINE(DISABLE_WTMP)
314 else
315 AC_MSG_RESULT(no)
316 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100317 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000318*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000319 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000320 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100321 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000322 conf_utmp_location=/etc/utmp
323 conf_wtmp_location=/var/adm/wtmp
324 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000325 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000326 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000327*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700328 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000329 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000330 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000331 AC_DEFINE(SETEUID_BREAKS_SETUID)
332 AC_DEFINE(BROKEN_SETREUID)
333 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000334 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000335*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700336 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000337 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100338 IPADDR_IN_DISPLAY=yes
339 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000340 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000341 AC_DEFINE(SETEUID_BREAKS_SETUID)
342 AC_DEFINE(BROKEN_SETREUID)
343 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000344 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000345 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700346 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
347 # Attention: always take care to bind libsocket and libnsl before libc,
348 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000349 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100350*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100351 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700352 AC_DEFINE(SETEUID_BREAKS_SETUID)
353 AC_DEFINE(BROKEN_SETREUID)
354 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100355 ;;
356*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100357 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700358 AC_DEFINE(SETEUID_BREAKS_SETUID)
359 AC_DEFINE(BROKEN_SETREUID)
360 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100361 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100362*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100363 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100364*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800365 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800366 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100367 RANLIB=true
368 no_dev_ptmx=1
369 AC_DEFINE(BROKEN_SYS_TERMIO_H)
370 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000371 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000372 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100373 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700374 AC_DEFINE(SETEUID_BREAKS_SETUID)
375 AC_DEFINE(BROKEN_SETREUID)
376 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700377 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100378 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700379 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700380 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700381 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100382 ;;
383*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800384 if test -z "$GCC"; then
385 CFLAGS="$CFLAGS -belf"
386 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100387 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000388 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100389 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000390 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000391 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700392 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700393 AC_DEFINE(SETEUID_BREAKS_SETUID)
394 AC_DEFINE(BROKEN_SETREUID)
395 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700396 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700397 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Miller217f5672001-02-16 12:12:41 +1100398 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700399 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700400 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000401 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000402*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100403 AC_DEFINE(NO_SSH_LASTLOG)
404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000407 AC_DEFINE(USE_PIPES)
408 AC_DEFINE(DISABLE_FD_PASSING)
409 LDFLAGS="$LDFLAGS"
410 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
411 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000412 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000413*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100414 AC_DEFINE(SETEUID_BREAKS_SETUID)
415 AC_DEFINE(BROKEN_SETREUID)
416 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000417 AC_DEFINE(WITH_ABBREV_NO_TTY)
418 AC_DEFINE(USE_PIPES)
419 AC_DEFINE(DISABLE_FD_PASSING)
420 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100421 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000422 MANTYPE=cat
423 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000424*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100425 AC_DEFINE(SETEUID_BREAKS_SETUID)
426 AC_DEFINE(BROKEN_SETREUID)
427 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000428 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700429 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700430 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000431 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
432 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
433 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700434 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000435*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000436 AC_MSG_CHECKING(for Digital Unix SIA)
437 no_osfsia=""
438 AC_ARG_WITH(osfsia,
439 [ --with-osfsia Enable Digital Unix SIA],
440 [
441 if test "x$withval" = "xno" ; then
442 AC_MSG_RESULT(disabled)
443 no_osfsia=1
444 fi
445 ],
446 )
447 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000448 if test -f /etc/sia/matrix.conf; then
449 AC_MSG_RESULT(yes)
450 AC_DEFINE(HAVE_OSF_SIA)
451 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000452 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000453 LIBS="$LIBS -lsecurity -ldb -lm -laud"
454 else
455 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100456 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000457 fi
458 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000459 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700460 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000461 AC_DEFINE(BROKEN_SETREUID)
462 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000463 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000464
465*-*-nto-qnx)
466 AC_DEFINE(USE_PIPES)
467 AC_DEFINE(NO_X11_UNIX_SOCKETS)
468 AC_DEFINE(MISSING_NFDBITS)
469 AC_DEFINE(MISSING_HOWMANY)
470 AC_DEFINE(MISSING_FD_MASK)
471 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100472esac
473
Damien Millere37bfc12000-06-05 09:37:43 +1000474# Allow user to specify flags
475AC_ARG_WITH(cflags,
476 [ --with-cflags Specify additional flags to pass to compiler],
477 [
478 if test "x$withval" != "xno" ; then
479 CFLAGS="$CFLAGS $withval"
480 fi
481 ]
482)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000483AC_ARG_WITH(cppflags,
484 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
485 [
486 if test "x$withval" != "xno"; then
487 CPPFLAGS="$CPPFLAGS $withval"
488 fi
489 ]
490)
Damien Millere37bfc12000-06-05 09:37:43 +1000491AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000492 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000493 [
494 if test "x$withval" != "xno" ; then
495 LDFLAGS="$LDFLAGS $withval"
496 fi
497 ]
498)
499AC_ARG_WITH(libs,
500 [ --with-libs Specify additional libraries to link with],
501 [
502 if test "x$withval" != "xno" ; then
503 LIBS="$LIBS $withval"
504 fi
505 ]
506)
507
Darren Tucker6eb93042003-06-29 21:30:41 +1000508AC_MSG_CHECKING(compiler and flags for sanity)
509AC_TRY_RUN([
510#include <stdio.h>
511int main(){exit(0);}
512 ],
513 [ AC_MSG_RESULT(yes) ],
514 [
515 AC_MSG_RESULT(no)
516 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
517 ]
518)
519
Tim Rice4cec93f2002-02-26 08:40:48 -0800520# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000521AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
522 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
523 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100524 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000525 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000526 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
527 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000528 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000529 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
530 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800531
Darren Tucker48d99d32004-08-29 17:04:50 +1000532# sys/ptms.h requires sys/stream.h to be included first on Solaris
533AC_CHECK_HEADERS(sys/ptms.h, [], [], [
534#ifdef HAVE_SYS_STREAM_H
535# include <sys/stream.h>
536#endif
537])
538
Damien Millera22ba012000-03-02 23:09:20 +1100539# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700540AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
541AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000542
Damien Millerdf288022001-02-18 13:07:07 +1100543dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700544if test "x$with_tcp_wrappers" != "xno" ; then
545 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
546 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
547 fi
548fi
Damien Millerdf288022001-02-18 13:07:07 +1100549
Tim Rice1e1ef642003-09-11 22:19:31 -0700550dnl IRIX and Solaris 2.5.1 have dirname() in libgen
551AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
552 AC_CHECK_LIB(gen, dirname,[
553 AC_CACHE_CHECK([for broken dirname],
554 ac_cv_have_broken_dirname, [
555 save_LIBS="$LIBS"
556 LIBS="$LIBS -lgen"
557 AC_TRY_RUN(
558 [
559#include <libgen.h>
560#include <string.h>
561
562int main(int argc, char **argv) {
563 char *s, buf[32];
564
565 strncpy(buf,"/etc", 32);
566 s = dirname(buf);
567 if (!s || strncmp(s, "/", 32) != 0) {
568 exit(1);
569 } else {
570 exit(0);
571 }
572}
573 ],
574 [ ac_cv_have_broken_dirname="no" ],
575 [ ac_cv_have_broken_dirname="yes" ]
576 )
577 LIBS="$save_LIBS"
578 ])
579 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
580 LIBS="$LIBS -lgen"
581 AC_DEFINE(HAVE_DIRNAME)
582 AC_CHECK_HEADERS(libgen.h)
583 fi
584 ])
585])
586
587AC_CHECK_FUNC(getspnam, ,
588 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
589AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
590
Tim Rice13aae5e2001-10-21 17:53:58 -0700591dnl zlib is required
592AC_ARG_WITH(zlib,
593 [ --with-zlib=PATH Use zlib in PATH],
594 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000595 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100596 AC_MSG_ERROR([*** zlib is required ***])
597 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700598 if test -d "$withval/lib"; then
599 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700600 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700601 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700602 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700603 fi
604 else
605 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700606 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700608 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700609 fi
610 fi
611 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700612 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700613 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700614 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700615 fi
616 ]
617)
618
Tim Ricefcb62202004-01-23 18:35:16 -0800619AC_CHECK_LIB(z, deflate, ,
620 [
621 saved_CPPFLAGS="$CPPFLAGS"
622 saved_LDFLAGS="$LDFLAGS"
623 save_LIBS="$LIBS"
624 dnl Check default zlib install dir
625 if test -n "${need_dash_r}"; then
626 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
627 else
628 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
629 fi
630 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
631 LIBS="$LIBS -lz"
632 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
633 [
634 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
635 ]
636 )
637 ]
638)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100639AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100640
641AC_ARG_WITH(zlib-version-check,
642 [ --without-zlib-version-check Disable zlib version check],
643 [ if test "x$withval" = "xno" ; then
644 zlib_check_nonfatal=1
645 fi
646 ]
647)
648
Darren Tucker2dcd2392004-01-23 17:13:33 +1100649AC_MSG_CHECKING(for zlib 1.1.4 or greater)
650AC_TRY_RUN([
651#include <zlib.h>
652int main()
653{
654 int a, b, c, v;
655 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
656 exit(1);
657 v = a*1000000 + b*1000 + c;
658 if (v >= 1001004)
659 exit(0);
660 exit(2);
661}
662 ],
663 AC_MSG_RESULT(yes),
664 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100665 if test -z "$zlib_check_nonfatal" ; then
666 AC_MSG_ERROR([*** zlib too old - check config.log ***
667Your reported zlib version has known security problems. It's possible your
668vendor has fixed these problems without changing the version number. If you
669are sure this is the case, you can disable the check by running
670"./configure --without-zlib-version-check".
671If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
672 else
673 AC_MSG_WARN([zlib version may have security problems])
674 fi
675 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100676)
Damien Miller6f9c3372000-10-25 10:06:04 +1100677
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000678dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100679AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000680 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
681)
Damien Millera8e06ce2003-11-21 23:48:55 +1100682AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700683 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
684 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000685)
Damien Millerab18c411999-11-11 10:40:23 +1100686
Tim Ricee589a292001-11-03 11:09:32 -0800687dnl Checks for libutil functions
688AC_CHECK_HEADERS(libutil.h)
689AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
690AC_CHECK_FUNCS(logout updwtmp logwtmp)
691
Ben Lindstrom8697e082001-02-24 21:41:10 +0000692AC_FUNC_STRFTIME
693
Damien Miller3c027682001-03-14 11:39:45 +1100694# Check for ALTDIRFUNC glob() extension
695AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
696AC_EGREP_CPP(FOUNDIT,
697 [
698 #include <glob.h>
699 #ifdef GLOB_ALTDIRFUNC
700 FOUNDIT
701 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100702 ],
Damien Miller3c027682001-03-14 11:39:45 +1100703 [
704 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
705 AC_MSG_RESULT(yes)
706 ],
707 [
708 AC_MSG_RESULT(no)
709 ]
710)
Damien Millerab18c411999-11-11 10:40:23 +1100711
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000712# Check for g.gl_matchc glob() extension
713AC_MSG_CHECKING(for gl_matchc field in glob_t)
714AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100715 [
716 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000717 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100718 ],
719 [
720 AC_DEFINE(GLOB_HAS_GL_MATCHC)
721 AC_MSG_RESULT(yes)
722 ],
723 [
724 AC_MSG_RESULT(no)
725 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000726)
727
Damien Miller18bb4732001-03-28 14:35:30 +1000728AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
729AC_TRY_RUN(
730 [
731#include <sys/types.h>
732#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700733int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000734 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100735 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000736 [
737 AC_MSG_RESULT(no)
738 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
739 ]
740)
741
Damien Miller36f49652004-08-15 18:40:59 +1000742AC_MSG_CHECKING([for /proc/pid/fd directory])
743if test -d "/proc/$$/fd" ; then
744 AC_DEFINE(HAVE_PROC_PID)
745 AC_MSG_RESULT(yes)
746else
747 AC_MSG_RESULT(no)
748fi
749
Damien Millerc547bf12001-02-16 10:18:12 +1100750# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100751SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100752AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700753 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100754 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100755 [
756 if test "x$withval" != "xno" ; then
757
758 if test "x$withval" != "xyes" ; then
759 CPPFLAGS="$CPPFLAGS -I${withval}/include"
760 LDFLAGS="$LDFLAGS -L${withval}/lib"
761 fi
762
763 AC_DEFINE(SKEY)
764 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100765 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100766
Tim Rice4cec93f2002-02-26 08:40:48 -0800767 AC_MSG_CHECKING([for s/key support])
768 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100769 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800770#include <stdio.h>
771#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700772int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800773 ],
774 [AC_MSG_RESULT(yes)],
775 [
776 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100777 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
778 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000779 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
780 AC_TRY_COMPILE(
781 [#include <stdio.h>
782 #include <skey.h>],
783 [(void)skeychallenge(NULL,"name","",0);],
784 [AC_MSG_RESULT(yes)
785 AC_DEFINE(SKEYCHALLENGE_4ARG)],
786 [AC_MSG_RESULT(no)]
787 )
Damien Millerc547bf12001-02-16 10:18:12 +1100788 fi
789 ]
790)
791
792# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700793TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100794AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700795 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100796 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100797 [
798 if test "x$withval" != "xno" ; then
799 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700800 saved_LDFLAGS="$LDFLAGS"
801 saved_CPPFLAGS="$CPPFLAGS"
802 if test -n "${withval}" -a "${withval}" != "yes"; then
803 if test -d "${withval}/lib"; then
804 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700805 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700806 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700807 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700808 fi
809 else
810 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700811 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700812 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700813 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700814 fi
815 fi
816 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700821 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800822 LIBWRAP="-lwrap"
823 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100824 AC_MSG_CHECKING(for libwrap)
825 AC_TRY_LINK(
826 [
Damien Miller0ac45002004-04-14 20:14:26 +1000827#include <sys/types.h>
828#include <sys/socket.h>
829#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100830#include <tcpd.h>
831 int deny_severity = 0, allow_severity = 0;
832 ],
833 [hosts_access(0);],
834 [
835 AC_MSG_RESULT(yes)
836 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800837 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700838 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100839 ],
840 [
841 AC_MSG_ERROR([*** libwrap missing])
842 ]
843 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800844 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100845 fi
846 ]
847)
848
Damien Millerfe1f1432003-02-24 15:45:42 +1100849dnl Checks for library functions. Please keep in alphabetical order
850AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000851 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Damien Miller36f49652004-08-15 18:40:59 +1000852 bindresvport_sa clock closefrom dirfd fchmod fchown freeaddrinfo \
853 futimes getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000854 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100855 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000856 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100857 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000858 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100859 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000860 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000861 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100862 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100863)
Tim Rice13aae5e2001-10-21 17:53:58 -0700864
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000865# IRIX has a const char return value for gai_strerror()
866AC_CHECK_FUNCS(gai_strerror,[
867 AC_DEFINE(HAVE_GAI_STRERROR)
868 AC_TRY_COMPILE([
869#include <sys/types.h>
870#include <sys/socket.h>
871#include <netdb.h>
872
873const char *gai_strerror(int);],[
874char *str;
875
876str = gai_strerror(0);],[
877 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
878 [Define if gai_strerror() returns const char *])])])
879
Damien Millercd6853c2003-01-28 11:33:42 +1100880AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
881
Darren Tuckerf1159b52003-07-07 19:44:01 +1000882dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000883AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000884AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000885
Darren Tuckerb2427c82003-09-10 15:22:44 +1000886dnl tcsendbreak might be a macro
887AC_CHECK_DECL(tcsendbreak,
888 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100889 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000890 [#include <termios.h>]
891)
892
Darren Tucker5bb14002004-04-23 18:53:10 +1000893AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
894
Darren Tucker2a6b0292003-12-31 14:59:17 +1100895AC_CHECK_FUNCS(setresuid, [
896 dnl Some platorms have setresuid that isn't implemented, test for this
897 AC_MSG_CHECKING(if setresuid seems to work)
898 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100899#include <stdlib.h>
900#include <errno.h>
901int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100902 ],
903 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100904 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100905 AC_MSG_RESULT(not implemented)]
906 )
907])
Darren Tuckere937be32003-12-17 18:53:26 +1100908
Darren Tucker2a6b0292003-12-31 14:59:17 +1100909AC_CHECK_FUNCS(setresgid, [
910 dnl Some platorms have setresgid that isn't implemented, test for this
911 AC_MSG_CHECKING(if setresgid seems to work)
912 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100913#include <stdlib.h>
914#include <errno.h>
915int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100916 ],
917 [AC_MSG_RESULT(yes)],
918 [AC_DEFINE(BROKEN_SETRESGID)
919 AC_MSG_RESULT(not implemented)]
920 )
921])
Darren Tuckere937be32003-12-17 18:53:26 +1100922
Damien Millerad833b32000-08-23 10:46:23 +1000923dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000924AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000925dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000926AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000927AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000928dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000929AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000930AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100931
Damien Millera8e06ce2003-11-21 23:48:55 +1100932AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100933 [AC_DEFINE(HAVE_DAEMON)],
934 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
935)
936
Damien Millera8e06ce2003-11-21 23:48:55 +1100937AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100938 [AC_DEFINE(HAVE_GETPAGESIZE)],
939 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
940)
941
Damien Millercb170cb2000-07-01 16:52:55 +1000942# Check for broken snprintf
943if test "x$ac_cv_func_snprintf" = "xyes" ; then
944 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
945 AC_TRY_RUN(
946 [
947#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700948int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000949 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100950 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000951 [
952 AC_MSG_RESULT(no)
953 AC_DEFINE(BROKEN_SNPRINTF)
954 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
955 ]
956 )
957fi
958
Damien Millerb4097182004-05-23 14:09:40 +1000959# Check for missing getpeereid (or equiv) support
960NO_PEERCHECK=""
961if test "x$ac_cv_func_getpeereid" != "xyes" ; then
962 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
963 AC_TRY_COMPILE(
964 [#include <sys/types.h>
965 #include <sys/socket.h>],
966 [int i = SO_PEERCRED;],
967 [AC_MSG_RESULT(yes)],
968 [AC_MSG_RESULT(no)
969 NO_PEERCHECK=1]
970 )
971fi
972
Damien Millere8328192003-01-07 15:18:32 +1100973dnl see whether mkstemp() requires XXXXXX
974if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
975AC_MSG_CHECKING([for (overly) strict mkstemp])
976AC_TRY_RUN(
977 [
978#include <stdlib.h>
979main() { char template[]="conftest.mkstemp-test";
980if (mkstemp(template) == -1)
981 exit(1);
982unlink(template); exit(0);
983}
984 ],
985 [
986 AC_MSG_RESULT(no)
987 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100988 [
Damien Millere8328192003-01-07 15:18:32 +1100989 AC_MSG_RESULT(yes)
990 AC_DEFINE(HAVE_STRICT_MKSTEMP)
991 ],
992 [
993 AC_MSG_RESULT(yes)
994 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100995 ]
Damien Millere8328192003-01-07 15:18:32 +1100996)
997fi
998
Darren Tucker70a3d552003-08-21 17:58:29 +1000999dnl make sure that openpty does not reacquire controlling terminal
1000if test ! -z "$check_for_openpty_ctty_bug"; then
1001 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1002 AC_TRY_RUN(
1003 [
1004#include <stdio.h>
1005#include <sys/fcntl.h>
1006#include <sys/types.h>
1007#include <sys/wait.h>
1008
1009int
1010main()
1011{
1012 pid_t pid;
1013 int fd, ptyfd, ttyfd, status;
1014
1015 pid = fork();
1016 if (pid < 0) { /* failed */
1017 exit(1);
1018 } else if (pid > 0) { /* parent */
1019 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001020 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001021 exit(WEXITSTATUS(status));
1022 else
1023 exit(2);
1024 } else { /* child */
1025 close(0); close(1); close(2);
1026 setsid();
1027 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1028 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1029 if (fd >= 0)
1030 exit(3); /* Acquired ctty: broken */
1031 else
1032 exit(0); /* Did not acquire ctty: OK */
1033 }
1034}
1035 ],
1036 [
1037 AC_MSG_RESULT(yes)
1038 ],
1039 [
1040 AC_MSG_RESULT(no)
1041 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1042 ]
1043 )
1044fi
1045
Darren Tucker4398cf52004-04-06 21:39:02 +10001046if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1047 AC_MSG_CHECKING(if getaddrinfo seems to work)
1048 AC_TRY_RUN(
1049 [
1050#include <stdio.h>
1051#include <sys/socket.h>
1052#include <netdb.h>
1053#include <errno.h>
1054#include <netinet/in.h>
1055
1056#define TEST_PORT "2222"
1057
1058int
1059main(void)
1060{
1061 int err, sock;
1062 struct addrinfo *gai_ai, *ai, hints;
1063 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1064
1065 memset(&hints, 0, sizeof(hints));
1066 hints.ai_family = PF_UNSPEC;
1067 hints.ai_socktype = SOCK_STREAM;
1068 hints.ai_flags = AI_PASSIVE;
1069
1070 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1071 if (err != 0) {
1072 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1073 exit(1);
1074 }
1075
1076 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1077 if (ai->ai_family != AF_INET6)
1078 continue;
1079
1080 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1081 sizeof(ntop), strport, sizeof(strport),
1082 NI_NUMERICHOST|NI_NUMERICSERV);
1083
1084 if (err != 0) {
1085 if (err == EAI_SYSTEM)
1086 perror("getnameinfo EAI_SYSTEM");
1087 else
1088 fprintf(stderr, "getnameinfo failed: %s\n",
1089 gai_strerror(err));
1090 exit(2);
1091 }
1092
1093 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1094 if (sock < 0)
1095 perror("socket");
1096 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1097 if (errno == EBADF)
1098 exit(3);
1099 }
1100 }
1101 exit(0);
1102}
1103 ],
1104 [
1105 AC_MSG_RESULT(yes)
1106 ],
1107 [
1108 AC_MSG_RESULT(no)
1109 AC_DEFINE(BROKEN_GETADDRINFO)
1110 ]
1111 )
1112fi
1113
Damien Miller606f8802000-09-16 15:39:56 +11001114AC_FUNC_GETPGRP
1115
Damien Millera64b57a2001-01-17 10:44:13 +11001116# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001117PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001118AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001119 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001120 [
Damien Millera64b57a2001-01-17 10:44:13 +11001121 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001122 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1123 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001124 AC_MSG_ERROR([PAM headers not found])
1125 fi
1126
1127 AC_CHECK_LIB(dl, dlopen, , )
1128 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1129 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001130 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001131
Damien Millera64b57a2001-01-17 10:44:13 +11001132 PAM_MSG="yes"
1133
1134 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001135 if test $ac_cv_lib_dl_dlopen = yes; then
1136 LIBPAM="-lpam -ldl"
1137 else
1138 LIBPAM="-lpam"
1139 fi
1140 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001141 fi
1142 ]
1143)
Damien Millera22ba012000-03-02 23:09:20 +11001144
Damien Millera64b57a2001-01-17 10:44:13 +11001145# Check for older PAM
1146if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001147 # Check PAM strerror arguments (old PAM)
1148 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1149 AC_TRY_COMPILE(
1150 [
Damien Miller81171112000-04-23 11:14:01 +10001151#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001152#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001153#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001154#elif defined (HAVE_PAM_PAM_APPL_H)
1155#include <pam/pam_appl.h>
1156#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001157 ],
1158 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001159 [AC_MSG_RESULT(no)],
1160 [
1161 AC_DEFINE(HAVE_OLD_PAM)
1162 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001163 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001164 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001165 )
Damien Millera22ba012000-03-02 23:09:20 +11001166fi
1167
Tim Riceaef73712002-05-11 13:17:42 -07001168# Search for OpenSSL
1169saved_CPPFLAGS="$CPPFLAGS"
1170saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001171AC_ARG_WITH(ssl-dir,
1172 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1173 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001174 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001175 if test -d "$withval/lib"; then
1176 if test -n "${need_dash_r}"; then
1177 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1178 else
1179 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1180 fi
1181 else
1182 if test -n "${need_dash_r}"; then
1183 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1184 else
1185 LDFLAGS="-L${withval} ${LDFLAGS}"
1186 fi
1187 fi
1188 if test -d "$withval/include"; then
1189 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1190 else
1191 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1192 fi
Damien Millera22ba012000-03-02 23:09:20 +11001193 fi
1194 ]
1195)
Tim Rice3d5352e2004-02-12 09:27:21 -08001196LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001197AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001198 [
Tim Riceaef73712002-05-11 13:17:42 -07001199 dnl Check default openssl install dir
1200 if test -n "${need_dash_r}"; then
1201 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001202 else
Tim Riceaef73712002-05-11 13:17:42 -07001203 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001204 fi
Tim Riceaef73712002-05-11 13:17:42 -07001205 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1206 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1207 [
1208 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1209 ]
1210 )
1211 ]
1212)
1213
Tim Riced730b782002-08-13 18:52:10 -07001214# Determine OpenSSL header version
1215AC_MSG_CHECKING([OpenSSL header version])
1216AC_TRY_RUN(
1217 [
1218#include <stdio.h>
1219#include <string.h>
1220#include <openssl/opensslv.h>
1221#define DATA "conftest.sslincver"
1222int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001223 FILE *fd;
1224 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001225
Damien Millera8e06ce2003-11-21 23:48:55 +11001226 fd = fopen(DATA,"w");
1227 if(fd == NULL)
1228 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001229
1230 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1231 exit(1);
1232
1233 exit(0);
1234}
1235 ],
1236 [
1237 ssl_header_ver=`cat conftest.sslincver`
1238 AC_MSG_RESULT($ssl_header_ver)
1239 ],
1240 [
1241 AC_MSG_RESULT(not found)
1242 AC_MSG_ERROR(OpenSSL version header not found.)
1243 ]
1244)
1245
1246# Determine OpenSSL library version
1247AC_MSG_CHECKING([OpenSSL library version])
1248AC_TRY_RUN(
1249 [
1250#include <stdio.h>
1251#include <string.h>
1252#include <openssl/opensslv.h>
1253#include <openssl/crypto.h>
1254#define DATA "conftest.ssllibver"
1255int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001256 FILE *fd;
1257 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001258
Damien Millera8e06ce2003-11-21 23:48:55 +11001259 fd = fopen(DATA,"w");
1260 if(fd == NULL)
1261 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001262
1263 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1264 exit(1);
1265
1266 exit(0);
1267}
1268 ],
1269 [
1270 ssl_library_ver=`cat conftest.ssllibver`
1271 AC_MSG_RESULT($ssl_library_ver)
1272 ],
1273 [
1274 AC_MSG_RESULT(not found)
1275 AC_MSG_ERROR(OpenSSL library not found.)
1276 ]
1277)
Damien Millera22ba012000-03-02 23:09:20 +11001278
Damien Millerec932372002-01-22 22:16:03 +11001279# Sanity check OpenSSL headers
1280AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1281AC_TRY_RUN(
1282 [
1283#include <string.h>
1284#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001285int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001286 ],
1287 [
1288 AC_MSG_RESULT(yes)
1289 ],
1290 [
1291 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001292 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1293Check config.log for details.
1294Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001295 ]
1296)
1297
Tim Rice3d5352e2004-02-12 09:27:21 -08001298# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1299# because the system crypt() is more featureful.
1300if test "x$check_for_libcrypt_before" = "x1"; then
1301 AC_CHECK_LIB(crypt, crypt)
1302fi
1303
Damien Millera8e06ce2003-11-21 23:48:55 +11001304# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001305# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001306if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001307 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001308fi
1309
Damien Miller6c21c512002-01-22 21:57:53 +11001310
1311### Configure cryptographic random number support
1312
1313# Check wheter OpenSSL seeds itself
1314AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1315AC_TRY_RUN(
1316 [
1317#include <string.h>
1318#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001319int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001320 ],
1321 [
1322 OPENSSL_SEEDS_ITSELF=yes
1323 AC_MSG_RESULT(yes)
1324 ],
1325 [
1326 AC_MSG_RESULT(no)
1327 # Default to use of the rand helper if OpenSSL doesn't
1328 # seed itself
1329 USE_RAND_HELPER=yes
1330 ]
1331)
1332
1333
1334# Do we want to force the use of the rand helper?
1335AC_ARG_WITH(rand-helper,
1336 [ --with-rand-helper Use subprocess to gather strong randomness ],
1337 [
1338 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001339 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001340 # the previous test showed it to be unseeded.
1341 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1342 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1343 OPENSSL_SEEDS_ITSELF=yes
1344 USE_RAND_HELPER=""
1345 fi
1346 else
1347 USE_RAND_HELPER=yes
1348 fi
1349 ],
1350)
1351
1352# Which randomness source do we use?
1353if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1354 # OpenSSL only
1355 AC_DEFINE(OPENSSL_PRNG_ONLY)
1356 RAND_MSG="OpenSSL internal ONLY"
1357 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001358elif test ! -z "$USE_RAND_HELPER" ; then
1359 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001360 RAND_MSG="ssh-rand-helper"
1361 INSTALL_SSH_RAND_HELPER="yes"
1362fi
1363AC_SUBST(INSTALL_SSH_RAND_HELPER)
1364
1365### Configuration of ssh-rand-helper
1366
1367# PRNGD TCP socket
1368AC_ARG_WITH(prngd-port,
1369 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1370 [
Damien Millere996d722002-01-23 11:20:59 +11001371 case "$withval" in
1372 no)
1373 withval=""
1374 ;;
1375 [[0-9]]*)
1376 ;;
1377 *)
1378 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1379 ;;
1380 esac
1381 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001382 PRNGD_PORT="$withval"
1383 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1384 fi
1385 ]
1386)
1387
1388# PRNGD Unix domain socket
1389AC_ARG_WITH(prngd-socket,
1390 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1391 [
Damien Millere996d722002-01-23 11:20:59 +11001392 case "$withval" in
1393 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001394 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001395 ;;
1396 no)
1397 withval=""
1398 ;;
1399 /*)
1400 ;;
1401 *)
1402 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1403 ;;
1404 esac
1405
1406 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001407 if test ! -z "$PRNGD_PORT" ; then
1408 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1409 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001410 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001411 AC_MSG_WARN(Entropy socket is not readable)
1412 fi
1413 PRNGD_SOCKET="$withval"
1414 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1415 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001416 ],
1417 [
1418 # Check for existing socket only if we don't have a random device already
1419 if test "$USE_RAND_HELPER" = yes ; then
1420 AC_MSG_CHECKING(for PRNGD/EGD socket)
1421 # Insert other locations here
1422 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1423 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1424 PRNGD_SOCKET="$sock"
1425 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1426 break;
1427 fi
1428 done
1429 if test ! -z "$PRNGD_SOCKET" ; then
1430 AC_MSG_RESULT($PRNGD_SOCKET)
1431 else
1432 AC_MSG_RESULT(not found)
1433 fi
1434 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001435 ]
1436)
1437
1438# Change default command timeout for hashing entropy source
1439entropy_timeout=200
1440AC_ARG_WITH(entropy-timeout,
1441 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1442 [
1443 if test "x$withval" != "xno" ; then
1444 entropy_timeout=$withval
1445 fi
1446 ]
1447)
Damien Miller6c21c512002-01-22 21:57:53 +11001448AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1449
Damien Millerd3f6ad22002-06-25 10:24:47 +10001450SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001451AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001452 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001453 [
1454 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001455 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001456 fi
1457 ]
1458)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001459AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1460AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001461
Tim Rice88f2ab52002-03-17 12:17:34 -08001462# We do this little dance with the search path to insure
1463# that programs that we select for use by installed programs
1464# (which may be run by the super-user) come from trusted
1465# locations before they come from the user's private area.
1466# This should help avoid accidentally configuring some
1467# random version of a program in someone's personal bin.
1468
1469OPATH=$PATH
1470PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001471test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001472test -d /sbin && PATH=$PATH:/sbin
1473test -d /usr/sbin && PATH=$PATH:/usr/sbin
1474PATH=$PATH:/etc:$OPATH
1475
Damien Millera8e06ce2003-11-21 23:48:55 +11001476# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001477OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1478OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1479OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1480OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1481OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1482OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1483OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1484OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1485OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1486OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1487OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1488OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1489OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1490OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1491OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1492OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001493# restore PATH
1494PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001495
1496# Where does ssh-rand-helper get its randomness from?
1497INSTALL_SSH_PRNG_CMDS=""
1498if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1499 if test ! -z "$PRNGD_PORT" ; then
1500 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1501 elif test ! -z "$PRNGD_SOCKET" ; then
1502 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1503 else
1504 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1505 RAND_HELPER_CMDHASH=yes
1506 INSTALL_SSH_PRNG_CMDS="yes"
1507 fi
1508fi
1509AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1510
1511
Ben Lindstromb5628642000-10-18 00:02:25 +00001512# Cheap hack to ensure NEWS-OS libraries are arranged right.
1513if test ! -z "$SONY" ; then
1514 LIBS="$LIBS -liberty";
1515fi
1516
Damien Millera22ba012000-03-02 23:09:20 +11001517# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001518AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001519AC_CHECK_SIZEOF(short int, 2)
1520AC_CHECK_SIZEOF(int, 4)
1521AC_CHECK_SIZEOF(long int, 4)
1522AC_CHECK_SIZEOF(long long int, 8)
1523
Damien Millerfa2bb692002-04-23 23:22:25 +10001524# Sanity check long long for some platforms (AIX)
1525if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1526 ac_cv_sizeof_long_long_int=0
1527fi
1528
Damien Millera22ba012000-03-02 23:09:20 +11001529# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001530AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1531 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001532 [ #include <sys/types.h> ],
1533 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001534 [ ac_cv_have_u_int="yes" ],
1535 [ ac_cv_have_u_int="no" ]
1536 )
1537])
1538if test "x$ac_cv_have_u_int" = "xyes" ; then
1539 AC_DEFINE(HAVE_U_INT)
1540 have_u_int=1
1541fi
1542
Damien Miller61e50f12000-05-08 20:49:37 +10001543AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1544 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001545 [ #include <sys/types.h> ],
1546 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001547 [ ac_cv_have_intxx_t="yes" ],
1548 [ ac_cv_have_intxx_t="no" ]
1549 )
1550])
1551if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1552 AC_DEFINE(HAVE_INTXX_T)
1553 have_intxx_t=1
1554fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001555
1556if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001557 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001558then
1559 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1560 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001561 [ #include <stdint.h> ],
1562 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001563 [
1564 AC_DEFINE(HAVE_INTXX_T)
1565 AC_MSG_RESULT(yes)
1566 ],
1567 [ AC_MSG_RESULT(no) ]
1568 )
1569fi
1570
Damien Miller578783e2000-09-23 14:12:24 +11001571AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1572 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001573 [
1574#include <sys/types.h>
1575#ifdef HAVE_STDINT_H
1576# include <stdint.h>
1577#endif
1578#include <sys/socket.h>
1579#ifdef HAVE_SYS_BITYPES_H
1580# include <sys/bitypes.h>
1581#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001582 ],
1583 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001584 [ ac_cv_have_int64_t="yes" ],
1585 [ ac_cv_have_int64_t="no" ]
1586 )
1587])
1588if test "x$ac_cv_have_int64_t" = "xyes" ; then
1589 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001590fi
1591
Damien Miller61e50f12000-05-08 20:49:37 +10001592AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1593 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001594 [ #include <sys/types.h> ],
1595 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001596 [ ac_cv_have_u_intxx_t="yes" ],
1597 [ ac_cv_have_u_intxx_t="no" ]
1598 )
1599])
1600if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1601 AC_DEFINE(HAVE_U_INTXX_T)
1602 have_u_intxx_t=1
1603fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001604
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001605if test -z "$have_u_intxx_t" ; then
1606 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1607 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001608 [ #include <sys/socket.h> ],
1609 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001610 [
1611 AC_DEFINE(HAVE_U_INTXX_T)
1612 AC_MSG_RESULT(yes)
1613 ],
1614 [ AC_MSG_RESULT(no) ]
1615 )
1616fi
1617
Damien Miller578783e2000-09-23 14:12:24 +11001618AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1619 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001620 [ #include <sys/types.h> ],
1621 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001622 [ ac_cv_have_u_int64_t="yes" ],
1623 [ ac_cv_have_u_int64_t="no" ]
1624 )
1625])
1626if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1627 AC_DEFINE(HAVE_U_INT64_T)
1628 have_u_int64_t=1
1629fi
1630
Tim Rice4cec93f2002-02-26 08:40:48 -08001631if test -z "$have_u_int64_t" ; then
1632 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1633 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001634 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001635 [ u_int64_t a; a = 1],
1636 [
1637 AC_DEFINE(HAVE_U_INT64_T)
1638 AC_MSG_RESULT(yes)
1639 ],
1640 [ AC_MSG_RESULT(no) ]
1641 )
1642fi
1643
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001644if test -z "$have_u_intxx_t" ; then
1645 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1646 AC_TRY_COMPILE(
1647 [
1648#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001649 ],
1650 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001651 [ ac_cv_have_uintxx_t="yes" ],
1652 [ ac_cv_have_uintxx_t="no" ]
1653 )
1654 ])
1655 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1656 AC_DEFINE(HAVE_UINTXX_T)
1657 fi
1658fi
1659
1660if test -z "$have_uintxx_t" ; then
1661 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1662 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001663 [ #include <stdint.h> ],
1664 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001665 [
1666 AC_DEFINE(HAVE_UINTXX_T)
1667 AC_MSG_RESULT(yes)
1668 ],
1669 [ AC_MSG_RESULT(no) ]
1670 )
1671fi
1672
Damien Milleredb82922000-06-20 13:25:52 +10001673if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001674 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001675then
1676 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1677 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001678 [
1679#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001680 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001681 [
Damien Miller70494d12000-04-03 15:57:06 +10001682 int8_t a; int16_t b; int32_t c;
1683 u_int8_t e; u_int16_t f; u_int32_t g;
1684 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001685 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001686 [
1687 AC_DEFINE(HAVE_U_INTXX_T)
1688 AC_DEFINE(HAVE_INTXX_T)
1689 AC_MSG_RESULT(yes)
1690 ],
1691 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001692 )
Damien Millerb29ea912000-01-15 14:12:03 +11001693fi
1694
Damien Miller58be7382001-09-15 21:31:54 +10001695
1696AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1697 AC_TRY_COMPILE(
1698 [
1699#include <sys/types.h>
1700 ],
1701 [ u_char foo; foo = 125; ],
1702 [ ac_cv_have_u_char="yes" ],
1703 [ ac_cv_have_u_char="no" ]
1704 )
1705])
1706if test "x$ac_cv_have_u_char" = "xyes" ; then
1707 AC_DEFINE(HAVE_U_CHAR)
1708fi
1709
Tim Rice13aae5e2001-10-21 17:53:58 -07001710TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001711
Tim Rice200a5c02002-02-26 22:12:34 -08001712AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001713
Damien Miller61e50f12000-05-08 20:49:37 +10001714AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1715 AC_TRY_COMPILE(
1716 [
1717#include <sys/types.h>
1718 ],
1719 [ size_t foo; foo = 1235; ],
1720 [ ac_cv_have_size_t="yes" ],
1721 [ ac_cv_have_size_t="no" ]
1722 )
1723])
1724if test "x$ac_cv_have_size_t" = "xyes" ; then
1725 AC_DEFINE(HAVE_SIZE_T)
1726fi
Damien Miller95058511999-12-29 10:36:45 +11001727
Damien Miller615f9392000-05-17 22:53:33 +10001728AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1729 AC_TRY_COMPILE(
1730 [
1731#include <sys/types.h>
1732 ],
1733 [ ssize_t foo; foo = 1235; ],
1734 [ ac_cv_have_ssize_t="yes" ],
1735 [ ac_cv_have_ssize_t="no" ]
1736 )
1737])
1738if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1739 AC_DEFINE(HAVE_SSIZE_T)
1740fi
1741
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001742AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1743 AC_TRY_COMPILE(
1744 [
1745#include <time.h>
1746 ],
1747 [ clock_t foo; foo = 1235; ],
1748 [ ac_cv_have_clock_t="yes" ],
1749 [ ac_cv_have_clock_t="no" ]
1750 )
1751])
1752if test "x$ac_cv_have_clock_t" = "xyes" ; then
1753 AC_DEFINE(HAVE_CLOCK_T)
1754fi
1755
Damien Millerb54b40e2000-06-23 08:23:34 +10001756AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1757 AC_TRY_COMPILE(
1758 [
1759#include <sys/types.h>
1760#include <sys/socket.h>
1761 ],
1762 [ sa_family_t foo; foo = 1235; ],
1763 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001764 [ AC_TRY_COMPILE(
1765 [
1766#include <sys/types.h>
1767#include <sys/socket.h>
1768#include <netinet/in.h>
1769 ],
1770 [ sa_family_t foo; foo = 1235; ],
1771 [ ac_cv_have_sa_family_t="yes" ],
1772
Damien Millerb54b40e2000-06-23 08:23:34 +10001773 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001774 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001775 )
1776])
1777if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1778 AC_DEFINE(HAVE_SA_FAMILY_T)
1779fi
1780
Damien Miller0f91b4e2000-06-18 15:43:25 +10001781AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1782 AC_TRY_COMPILE(
1783 [
1784#include <sys/types.h>
1785 ],
1786 [ pid_t foo; foo = 1235; ],
1787 [ ac_cv_have_pid_t="yes" ],
1788 [ ac_cv_have_pid_t="no" ]
1789 )
1790])
1791if test "x$ac_cv_have_pid_t" = "xyes" ; then
1792 AC_DEFINE(HAVE_PID_T)
1793fi
1794
1795AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1796 AC_TRY_COMPILE(
1797 [
1798#include <sys/types.h>
1799 ],
1800 [ mode_t foo; foo = 1235; ],
1801 [ ac_cv_have_mode_t="yes" ],
1802 [ ac_cv_have_mode_t="no" ]
1803 )
1804])
1805if test "x$ac_cv_have_mode_t" = "xyes" ; then
1806 AC_DEFINE(HAVE_MODE_T)
1807fi
1808
Damien Miller61e50f12000-05-08 20:49:37 +10001809
1810AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1811 AC_TRY_COMPILE(
1812 [
Damien Miller81171112000-04-23 11:14:01 +10001813#include <sys/types.h>
1814#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001815 ],
1816 [ struct sockaddr_storage s; ],
1817 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1818 [ ac_cv_have_struct_sockaddr_storage="no" ]
1819 )
1820])
1821if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1822 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1823fi
Damien Miller34132e52000-01-14 15:45:46 +11001824
Damien Miller61e50f12000-05-08 20:49:37 +10001825AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1826 AC_TRY_COMPILE(
1827 [
Damien Miller7b22d652000-06-18 14:07:04 +10001828#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001829#include <netinet/in.h>
1830 ],
1831 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1832 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1833 [ ac_cv_have_struct_sockaddr_in6="no" ]
1834 )
1835])
1836if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1837 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1838fi
Damien Miller34132e52000-01-14 15:45:46 +11001839
Damien Miller61e50f12000-05-08 20:49:37 +10001840AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1841 AC_TRY_COMPILE(
1842 [
Damien Miller7b22d652000-06-18 14:07:04 +10001843#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001844#include <netinet/in.h>
1845 ],
1846 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1847 [ ac_cv_have_struct_in6_addr="yes" ],
1848 [ ac_cv_have_struct_in6_addr="no" ]
1849 )
1850])
1851if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1852 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1853fi
Damien Miller34132e52000-01-14 15:45:46 +11001854
Damien Miller61e50f12000-05-08 20:49:37 +10001855AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1856 AC_TRY_COMPILE(
1857 [
Damien Miller81171112000-04-23 11:14:01 +10001858#include <sys/types.h>
1859#include <sys/socket.h>
1860#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001861 ],
1862 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1863 [ ac_cv_have_struct_addrinfo="yes" ],
1864 [ ac_cv_have_struct_addrinfo="no" ]
1865 )
1866])
1867if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1868 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1869fi
1870
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001871AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1872 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001873 [ #include <sys/time.h> ],
1874 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001875 [ ac_cv_have_struct_timeval="yes" ],
1876 [ ac_cv_have_struct_timeval="no" ]
1877 )
1878])
1879if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1880 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1881 have_struct_timeval=1
1882fi
1883
Tim Rice4e4dc562003-03-18 10:21:40 -08001884AC_CHECK_TYPES(struct timespec)
1885
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001886# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001887if test "x$ac_cv_have_int64_t" = "xno" -a \
1888 "x$ac_cv_sizeof_long_int" != "x8" -a \
1889 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001890 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1891 echo "an alternative compiler (I.E., GCC) before continuing."
1892 echo ""
1893 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001894else
1895dnl test snprintf (broken on SCO w/gcc)
1896 AC_TRY_RUN(
1897 [
1898#include <stdio.h>
1899#include <string.h>
1900#ifdef HAVE_SNPRINTF
1901main()
1902{
1903 char buf[50];
1904 char expected_out[50];
1905 int mazsize = 50 ;
1906#if (SIZEOF_LONG_INT == 8)
1907 long int num = 0x7fffffffffffffff;
1908#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001909 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001910#endif
1911 strcpy(expected_out, "9223372036854775807");
1912 snprintf(buf, mazsize, "%lld", num);
1913 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001914 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001915 exit(0);
1916}
1917#else
1918main() { exit(0); }
1919#endif
1920 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1921 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001922fi
1923
Damien Miller78315eb2000-09-29 23:01:36 +11001924dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001925OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1926OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1927OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1928OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1929OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001930OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001931OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1932OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001933OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001934OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1935OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1936OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1937OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001938OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1939OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1940OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1941OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001942
1943AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001944
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
1960
Damien Miller61e50f12000-05-08 20:49:37 +10001961AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1962 ac_cv_have___ss_family_in_struct_ss, [
1963 AC_TRY_COMPILE(
1964 [
Damien Miller81171112000-04-23 11:14:01 +10001965#include <sys/types.h>
1966#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001967 ],
1968 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1969 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1970 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1971 )
1972])
1973if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1974 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1975fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001976
Damien Millerad833b32000-08-23 10:46:23 +10001977AC_CACHE_CHECK([for pw_class field in struct passwd],
1978 ac_cv_have_pw_class_in_struct_passwd, [
1979 AC_TRY_COMPILE(
1980 [
Damien Millerad833b32000-08-23 10:46:23 +10001981#include <pwd.h>
1982 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001983 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001984 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1985 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1986 )
1987])
1988if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1989 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1990fi
1991
Kevin Steves82456952001-06-22 21:14:18 +00001992AC_CACHE_CHECK([for pw_expire field in struct passwd],
1993 ac_cv_have_pw_expire_in_struct_passwd, [
1994 AC_TRY_COMPILE(
1995 [
1996#include <pwd.h>
1997 ],
1998 [ struct passwd p; p.pw_expire = 0; ],
1999 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2000 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2001 )
2002])
2003if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2004 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2005fi
2006
2007AC_CACHE_CHECK([for pw_change field in struct passwd],
2008 ac_cv_have_pw_change_in_struct_passwd, [
2009 AC_TRY_COMPILE(
2010 [
2011#include <pwd.h>
2012 ],
2013 [ struct passwd p; p.pw_change = 0; ],
2014 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2015 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2016 )
2017])
2018if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2019 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2020fi
Damien Miller61e50f12000-05-08 20:49:37 +10002021
Tim Rice28bbb0c2002-05-27 17:37:32 -07002022dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002023AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2024 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002025 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002026 [
Tim Riceae49fe62002-04-12 10:26:21 -07002027#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002028#include <sys/socket.h>
2029#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002030int main() {
2031#ifdef msg_accrights
2032exit(1);
2033#endif
2034struct msghdr m;
2035m.msg_accrights = 0;
2036exit(0);
2037}
Kevin Steves939c9db2002-03-22 17:23:25 +00002038 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002039 [ ac_cv_have_accrights_in_msghdr="yes" ],
2040 [ ac_cv_have_accrights_in_msghdr="no" ]
2041 )
2042])
2043if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2044 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2045fi
2046
Kevin Stevesa44e0352002-04-07 16:18:03 +00002047AC_CACHE_CHECK([for msg_control field in struct msghdr],
2048 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002049 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002050 [
Tim Riceae49fe62002-04-12 10:26:21 -07002051#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002052#include <sys/socket.h>
2053#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002054int main() {
2055#ifdef msg_control
2056exit(1);
2057#endif
2058struct msghdr m;
2059m.msg_control = 0;
2060exit(0);
2061}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002062 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002063 [ ac_cv_have_control_in_msghdr="yes" ],
2064 [ ac_cv_have_control_in_msghdr="no" ]
2065 )
2066])
2067if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2068 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2069fi
2070
Damien Miller61e50f12000-05-08 20:49:37 +10002071AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002072 AC_TRY_LINK([],
2073 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002074 [ ac_cv_libc_defines___progname="yes" ],
2075 [ ac_cv_libc_defines___progname="no" ]
2076 )
2077])
2078if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2079 AC_DEFINE(HAVE___PROGNAME)
2080fi
2081
Kevin Steves4846f4a2002-03-22 18:19:53 +00002082AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2083 AC_TRY_LINK([
2084#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002085],
2086 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002087 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2088 [ ac_cv_cc_implements___FUNCTION__="no" ]
2089 )
2090])
2091if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2092 AC_DEFINE(HAVE___FUNCTION__)
2093fi
2094
2095AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2096 AC_TRY_LINK([
2097#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002098],
2099 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002100 [ ac_cv_cc_implements___func__="yes" ],
2101 [ ac_cv_cc_implements___func__="no" ]
2102 )
2103])
2104if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2105 AC_DEFINE(HAVE___func__)
2106fi
2107
Damien Miller4f8e6692001-07-14 13:22:53 +10002108AC_CACHE_CHECK([whether getopt has optreset support],
2109 ac_cv_have_getopt_optreset, [
2110 AC_TRY_LINK(
2111 [
2112#include <getopt.h>
2113 ],
2114 [ extern int optreset; optreset = 0; ],
2115 [ ac_cv_have_getopt_optreset="yes" ],
2116 [ ac_cv_have_getopt_optreset="no" ]
2117 )
2118])
2119if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2120 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2121fi
Damien Millera22ba012000-03-02 23:09:20 +11002122
Damien Millerecbb26d2000-07-15 14:59:14 +10002123AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002124 AC_TRY_LINK([],
2125 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002126 [ ac_cv_libc_defines_sys_errlist="yes" ],
2127 [ ac_cv_libc_defines_sys_errlist="no" ]
2128 )
2129])
2130if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2131 AC_DEFINE(HAVE_SYS_ERRLIST)
2132fi
2133
2134
Damien Miller11fa2cc2000-08-16 10:35:58 +10002135AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002136 AC_TRY_LINK([],
2137 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002138 [ ac_cv_libc_defines_sys_nerr="yes" ],
2139 [ ac_cv_libc_defines_sys_nerr="no" ]
2140 )
2141])
2142if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2143 AC_DEFINE(HAVE_SYS_NERR)
2144fi
2145
Damien Millera8e06ce2003-11-21 23:48:55 +11002146SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002147# Check whether user wants sectok support
2148AC_ARG_WITH(sectok,
2149 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002150 [
2151 if test "x$withval" != "xno" ; then
2152 if test "x$withval" != "xyes" ; then
2153 CPPFLAGS="$CPPFLAGS -I${withval}"
2154 LDFLAGS="$LDFLAGS -L${withval}"
2155 if test ! -z "$need_dash_r" ; then
2156 LDFLAGS="$LDFLAGS -R${withval}"
2157 fi
2158 if test ! -z "$blibpath" ; then
2159 blibpath="$blibpath:${withval}"
2160 fi
2161 fi
2162 AC_CHECK_HEADERS(sectok.h)
2163 if test "$ac_cv_header_sectok_h" != yes; then
2164 AC_MSG_ERROR(Can't find sectok.h)
2165 fi
2166 AC_CHECK_LIB(sectok, sectok_open)
2167 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2168 AC_MSG_ERROR(Can't find libsectok)
2169 fi
2170 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002171 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002172 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002173 fi
2174 ]
2175)
2176
2177# Check whether user wants OpenSC support
2178AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002179 AC_HELP_STRING([--with-opensc=PFX],
2180 [Enable smartcard support using OpenSC]),
2181 opensc_config_prefix="$withval", opensc_config_prefix="")
2182if test x$opensc_config_prefix != x ; then
2183 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2184 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2185 if test "$OPENSC_CONFIG" != "no"; then
2186 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2187 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2188 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2189 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2190 AC_DEFINE(SMARTCARD)
2191 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002192 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002193 fi
2194fi
Damien Miller85de5802001-09-18 14:01:11 +10002195
Darren Tucker5f88d342003-10-15 16:57:57 +10002196# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002197AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002198 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002199 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002200 # Needed by our getrrsetbyname()
2201 AC_SEARCH_LIBS(res_query, resolv)
2202 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002203 AC_MSG_CHECKING(if res_query will link)
2204 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2205 [AC_MSG_RESULT(no)
2206 saved_LIBS="$LIBS"
2207 LIBS="$LIBS -lresolv"
2208 AC_MSG_CHECKING(for res_query in -lresolv)
2209 AC_LINK_IFELSE([
2210#include <resolv.h>
2211int main()
2212{
2213 res_query (0, 0, 0, 0, 0);
2214 return 0;
2215}
2216 ],
2217 [LIBS="$LIBS -lresolv"
2218 AC_MSG_RESULT(yes)],
2219 [LIBS="$saved_LIBS"
2220 AC_MSG_RESULT(no)])
2221 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002222 AC_CHECK_FUNCS(_getshort _getlong)
2223 AC_CHECK_MEMBER(HEADER.ad,
2224 [AC_DEFINE(HAVE_HEADER_AD)],,
2225 [#include <arpa/nameser.h>])
2226 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002227
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002228# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002229KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002230AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002231 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002232 [ if test "x$withval" != "xno" ; then
2233 if test "x$withval" = "xyes" ; then
2234 KRB5ROOT="/usr/local"
2235 else
2236 KRB5ROOT=${withval}
2237 fi
2238
2239 AC_DEFINE(KRB5)
2240 KRB5_MSG="yes"
2241
2242 AC_MSG_CHECKING(for krb5-config)
2243 if test -x $KRB5ROOT/bin/krb5-config ; then
2244 KRB5CONF=$KRB5ROOT/bin/krb5-config
2245 AC_MSG_RESULT($KRB5CONF)
2246
2247 AC_MSG_CHECKING(for gssapi support)
2248 if $KRB5CONF | grep gssapi >/dev/null ; then
2249 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002250 AC_DEFINE(GSSAPI)
2251 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002252 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002253 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002254 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002255 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002256 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2257 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002258 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002259 AC_MSG_CHECKING(whether we are using Heimdal)
2260 AC_TRY_COMPILE([ #include <krb5.h> ],
2261 [ char *tmp = heimdal_version; ],
2262 [ AC_MSG_RESULT(yes)
2263 AC_DEFINE(HEIMDAL) ],
2264 AC_MSG_RESULT(no)
2265 )
2266 else
2267 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002268 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002269 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002270 AC_MSG_CHECKING(whether we are using Heimdal)
2271 AC_TRY_COMPILE([ #include <krb5.h> ],
2272 [ char *tmp = heimdal_version; ],
2273 [ AC_MSG_RESULT(yes)
2274 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002275 K5LIBS="-lkrb5 -ldes"
2276 K5LIBS="$K5LIBS -lcom_err -lasn1"
2277 AC_CHECK_LIB(roken, net_write,
2278 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002279 ],
2280 [ AC_MSG_RESULT(no)
2281 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2282 ]
2283 )
Damien Miller200d0a72003-06-30 19:21:36 +10002284 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002285
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002286 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2287 [ AC_DEFINE(GSSAPI)
2288 K5LIBS="-lgssapi $K5LIBS" ],
2289 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2290 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002291 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002292 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2293 $K5LIBS)
2294 ],
2295 $K5LIBS)
2296
2297 AC_CHECK_HEADER(gssapi.h, ,
2298 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002299 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002300 AC_CHECK_HEADERS(gssapi.h, ,
2301 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002302 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002303 ]
2304 )
2305
2306 oldCPP="$CPPFLAGS"
2307 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2308 AC_CHECK_HEADER(gssapi_krb5.h, ,
2309 [ CPPFLAGS="$oldCPP" ])
2310
Damien Millera8e06ce2003-11-21 23:48:55 +11002311 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002312 if test ! -z "$need_dash_r" ; then
2313 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2314 fi
2315 if test ! -z "$blibpath" ; then
2316 blibpath="$blibpath:${KRB5ROOT}/lib"
2317 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002318 fi
2319
2320 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2321 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2322 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2323
2324 LIBS="$LIBS $K5LIBS"
2325 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002326 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002327 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002328)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002329
Damien Millera22ba012000-03-02 23:09:20 +11002330# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002331
Damien Millerf58c6722002-05-13 13:15:42 +10002332PRIVSEP_PATH=/var/empty
2333AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002334 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002335 [
2336 if test "x$withval" != "$no" ; then
2337 PRIVSEP_PATH=$withval
2338 fi
2339 ]
2340)
2341AC_SUBST(PRIVSEP_PATH)
2342
Damien Millera22ba012000-03-02 23:09:20 +11002343AC_ARG_WITH(xauth,
2344 [ --with-xauth=PATH Specify path to xauth program ],
2345 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002346 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002347 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002348 fi
2349 ],
2350 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002351 TestPath="$PATH"
2352 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2353 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2354 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2355 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2356 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002357 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002358 xauth_path="/usr/openwin/bin/xauth"
2359 fi
2360 ]
2361)
2362
Damien Miller7d901272003-01-13 16:55:22 +11002363STRIP_OPT=-s
2364AC_ARG_ENABLE(strip,
2365 [ --disable-strip Disable calling strip(1) on install],
2366 [
2367 if test "x$enableval" = "xno" ; then
2368 STRIP_OPT=
2369 fi
2370 ]
2371)
2372AC_SUBST(STRIP_OPT)
2373
Damien Millera19cf472000-11-29 13:28:50 +11002374if test -z "$xauth_path" ; then
2375 XAUTH_PATH="undefined"
2376 AC_SUBST(XAUTH_PATH)
2377else
Damien Millera22ba012000-03-02 23:09:20 +11002378 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002379 XAUTH_PATH=$xauth_path
2380 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002381fi
Damien Millera22ba012000-03-02 23:09:20 +11002382
2383# Check for mail directory (last resort if we cannot get it from headers)
2384if test ! -z "$MAIL" ; then
2385 maildir=`dirname $MAIL`
2386 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2387fi
2388
Damien Millera22ba012000-03-02 23:09:20 +11002389if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002390 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002391 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002392 [
2393 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2394 have_dev_ptmx=1
2395 ]
2396 )
2397 fi
Damien Millera22ba012000-03-02 23:09:20 +11002398fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002399AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002400 [
2401 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2402 have_dev_ptc=1
2403 ]
2404)
2405
Damien Millera22ba012000-03-02 23:09:20 +11002406# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002407AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002408 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002409 [
Damien Miller897741e2001-04-16 10:41:46 +10002410 case "$withval" in
2411 man|cat|doc)
2412 MANTYPE=$withval
2413 ;;
2414 *)
2415 AC_MSG_ERROR(invalid man type: $withval)
2416 ;;
2417 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002418 ]
2419)
Ben Lindstrombc709922001-04-18 18:04:21 +00002420if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002421 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2422 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002423 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2424 MANTYPE=doc
2425 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2426 MANTYPE=man
2427 else
2428 MANTYPE=cat
2429 fi
2430fi
Damien Miller670a4b82000-01-22 13:53:11 +11002431AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002432if test "$MANTYPE" = "doc"; then
2433 mansubdir=man;
2434else
2435 mansubdir=$MANTYPE;
2436fi
2437AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002438
Damien Millera22ba012000-03-02 23:09:20 +11002439# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002440MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002441AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002442 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002443 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002444 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002445 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002446 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002447 fi
2448 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002449)
2450
Damien Millera22ba012000-03-02 23:09:20 +11002451# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002452AC_ARG_WITH(shadow,
2453 [ --without-shadow Disable shadow password support],
2454 [
2455 if test "x$withval" = "xno" ; then
2456 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002457 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002458 fi
2459 ]
2460)
2461
Damien Miller1f335fb2000-06-26 11:31:33 +10002462if test -z "$disable_shadow" ; then
2463 AC_MSG_CHECKING([if the systems has expire shadow information])
2464 AC_TRY_COMPILE(
2465 [
2466#include <sys/types.h>
2467#include <shadow.h>
2468 struct spwd sp;
2469 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2470 [ sp_expire_available=yes ], []
2471 )
2472
2473 if test "x$sp_expire_available" = "xyes" ; then
2474 AC_MSG_RESULT(yes)
2475 AC_DEFINE(HAS_SHADOW_EXPIRE)
2476 else
2477 AC_MSG_RESULT(no)
2478 fi
2479fi
2480
Damien Millera22ba012000-03-02 23:09:20 +11002481# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002482if test ! -z "$IPADDR_IN_DISPLAY" ; then
2483 DISPLAY_HACK_MSG="yes"
2484 AC_DEFINE(IPADDR_IN_DISPLAY)
2485else
Damien Millera8e06ce2003-11-21 23:48:55 +11002486 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002487 AC_ARG_WITH(ipaddr-display,
2488 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2489 [
2490 if test "x$withval" != "xno" ; then
2491 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002492 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002493 fi
2494 ]
2495 )
2496fi
Damien Miller76112de1999-12-21 11:18:08 +11002497
Darren Tuckere1a790d2003-09-16 11:52:19 +10002498# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002499AC_ARG_ENABLE(etc-default-login,
2500 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2501[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002502AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2503
2504if test "x$external_path_file" = "x/etc/default/login"; then
2505 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2506fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002507])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002508
Tim Rice43a1c132002-04-17 21:19:14 -07002509dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2510if test $ac_cv_func_login_getcapbool = "yes" -a \
2511 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002512 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002513fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002514
Damien Millera22ba012000-03-02 23:09:20 +11002515# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002516SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002517AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002518 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002519 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002520 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002521 AC_MSG_WARN([
2522--with-default-path=PATH has no effect on this system.
2523Edit /etc/login.conf instead.])
2524 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002525 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002526 AC_MSG_WARN([
2527--with-default-path=PATH will only be used if PATH is not defined in
2528$external_path_file .])
2529 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002530 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002531 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002532 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002533 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002534 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2535 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002536 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002537 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002538 AC_MSG_WARN([
2539If PATH is defined in $external_path_file, ensure the path to scp is included,
2540otherwise scp will not work.])
2541 fi
2542 AC_TRY_RUN(
2543 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002544/* find out what STDPATH is */
2545#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002546#ifdef HAVE_PATHS_H
2547# include <paths.h>
2548#endif
2549#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002550# ifdef _PATH_USERPATH /* Irix */
2551# define _PATH_STDPATH _PATH_USERPATH
2552# else
2553# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2554# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002555#endif
2556#include <sys/types.h>
2557#include <sys/stat.h>
2558#include <fcntl.h>
2559#define DATA "conftest.stdpath"
2560
2561main()
2562{
2563 FILE *fd;
2564 int rc;
2565
2566 fd = fopen(DATA,"w");
2567 if(fd == NULL)
2568 exit(1);
2569
2570 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2571 exit(1);
2572
2573 exit(0);
2574}
2575 ], [ user_path=`cat conftest.stdpath` ],
2576 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2577 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2578 )
2579# make sure $bindir is in USER_PATH so scp will work
2580 t_bindir=`eval echo ${bindir}`
2581 case $t_bindir in
2582 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2583 esac
2584 case $t_bindir in
2585 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2586 esac
2587 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2588 if test $? -ne 0 ; then
2589 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2590 if test $? -ne 0 ; then
2591 user_path=$user_path:$t_bindir
2592 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2593 fi
2594 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002595 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002596)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002597if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002598 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2599 AC_SUBST(user_path)
2600fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002601
Damien Millera18bbd32002-05-13 10:48:57 +10002602# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002603AC_ARG_WITH(superuser-path,
2604 [ --with-superuser-path= Specify different path for super-user],
2605 [
2606 if test "x$withval" != "xno" ; then
2607 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2608 superuser_path=$withval
2609 fi
2610 ]
2611)
2612
2613
Damien Miller61e50f12000-05-08 20:49:37 +10002614AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002615IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002616AC_ARG_WITH(4in6,
2617 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2618 [
2619 if test "x$withval" != "xno" ; then
2620 AC_MSG_RESULT(yes)
2621 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002622 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002623 else
2624 AC_MSG_RESULT(no)
2625 fi
2626 ],[
2627 if test "x$inet6_default_4in6" = "xyes"; then
2628 AC_MSG_RESULT([yes (default)])
2629 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002630 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002631 else
2632 AC_MSG_RESULT([no (default)])
2633 fi
2634 ]
2635)
2636
Damien Miller60396b02001-02-18 17:01:00 +11002637# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002638BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002639AC_ARG_WITH(bsd-auth,
2640 [ --with-bsd-auth Enable BSD auth support],
2641 [
2642 if test "x$withval" != "xno" ; then
2643 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002644 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002645 fi
2646 ]
2647)
2648
Damien Millera22ba012000-03-02 23:09:20 +11002649# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002650piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002651# make sure the directory exists
2652if test ! -d $piddir ; then
2653 piddir=`eval echo ${sysconfdir}`
2654 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002655 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002656 esac
2657fi
2658
Tim Rice88f2ab52002-03-17 12:17:34 -08002659AC_ARG_WITH(pid-dir,
2660 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2661 [
2662 if test "x$withval" != "xno" ; then
2663 piddir=$withval
2664 if test ! -d $piddir ; then
2665 AC_MSG_WARN([** no $piddir directory on this system **])
2666 fi
2667 fi
2668 ]
2669)
2670
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002671AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002672AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002673
andre2ff7b5d2000-06-03 14:57:40 +00002674dnl allow user to disable some login recording features
2675AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002676 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002677 [
2678 if test "x$enableval" = "xno" ; then
2679 AC_DEFINE(DISABLE_LASTLOG)
2680 fi
2681 ]
andre2ff7b5d2000-06-03 14:57:40 +00002682)
2683AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002684 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002685 [
2686 if test "x$enableval" = "xno" ; then
2687 AC_DEFINE(DISABLE_UTMP)
2688 fi
2689 ]
andre2ff7b5d2000-06-03 14:57:40 +00002690)
2691AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002692 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002693 [
2694 if test "x$enableval" = "xno" ; then
2695 AC_DEFINE(DISABLE_UTMPX)
2696 fi
2697 ]
andre2ff7b5d2000-06-03 14:57:40 +00002698)
2699AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002700 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002701 [
2702 if test "x$enableval" = "xno" ; then
2703 AC_DEFINE(DISABLE_WTMP)
2704 fi
2705 ]
andre2ff7b5d2000-06-03 14:57:40 +00002706)
2707AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002708 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002709 [
2710 if test "x$enableval" = "xno" ; then
2711 AC_DEFINE(DISABLE_WTMPX)
2712 fi
2713 ]
andre2ff7b5d2000-06-03 14:57:40 +00002714)
2715AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002716 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002717 [
2718 if test "x$enableval" = "xno" ; then
2719 AC_DEFINE(DISABLE_LOGIN)
2720 fi
2721 ]
andre2ff7b5d2000-06-03 14:57:40 +00002722)
2723AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002724 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002725 [
2726 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002727 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002728 fi
2729 ]
andre2ff7b5d2000-06-03 14:57:40 +00002730)
2731AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002732 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002733 [
2734 if test "x$enableval" = "xno" ; then
2735 AC_DEFINE(DISABLE_PUTUTXLINE)
2736 fi
2737 ]
andre2ff7b5d2000-06-03 14:57:40 +00002738)
2739AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002740 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002741 [
2742 if test "x$withval" = "xno" ; then
2743 AC_DEFINE(DISABLE_LASTLOG)
2744 else
2745 conf_lastlog_location=$withval
2746 fi
2747 ]
2748)
andre2ff7b5d2000-06-03 14:57:40 +00002749
2750dnl lastlog, [uw]tmpx? detection
2751dnl NOTE: set the paths in the platform section to avoid the
2752dnl need for command-line parameters
2753dnl lastlog and [uw]tmp are subject to a file search if all else fails
2754
2755dnl lastlog detection
2756dnl NOTE: the code itself will detect if lastlog is a directory
2757AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2758AC_TRY_COMPILE([
2759#include <sys/types.h>
2760#include <utmp.h>
2761#ifdef HAVE_LASTLOG_H
2762# include <lastlog.h>
2763#endif
Damien Miller2994e082000-06-04 15:51:47 +10002764#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002765# include <paths.h>
2766#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002767#ifdef HAVE_LOGIN_H
2768# include <login.h>
2769#endif
andre2ff7b5d2000-06-03 14:57:40 +00002770 ],
2771 [ char *lastlog = LASTLOG_FILE; ],
2772 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002773 [
2774 AC_MSG_RESULT(no)
2775 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2776 AC_TRY_COMPILE([
2777#include <sys/types.h>
2778#include <utmp.h>
2779#ifdef HAVE_LASTLOG_H
2780# include <lastlog.h>
2781#endif
2782#ifdef HAVE_PATHS_H
2783# include <paths.h>
2784#endif
2785 ],
2786 [ char *lastlog = _PATH_LASTLOG; ],
2787 [ AC_MSG_RESULT(yes) ],
2788 [
andree441aa32000-06-12 22:34:38 +00002789 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002790 system_lastlog_path=no
2791 ])
2792 ]
andre2ff7b5d2000-06-03 14:57:40 +00002793)
Damien Miller2994e082000-06-04 15:51:47 +10002794
andre2ff7b5d2000-06-03 14:57:40 +00002795if test -z "$conf_lastlog_location"; then
2796 if test x"$system_lastlog_path" = x"no" ; then
2797 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002798 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002799 conf_lastlog_location=$f
2800 fi
2801 done
2802 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002803 AC_MSG_WARN([** Cannot find lastlog **])
2804 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002805 fi
2806 fi
2807fi
2808
2809if test -n "$conf_lastlog_location"; then
2810 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2811fi
2812
2813dnl utmp detection
2814AC_MSG_CHECKING([if your system defines UTMP_FILE])
2815AC_TRY_COMPILE([
2816#include <sys/types.h>
2817#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002818#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002819# include <paths.h>
2820#endif
2821 ],
2822 [ char *utmp = UTMP_FILE; ],
2823 [ AC_MSG_RESULT(yes) ],
2824 [ AC_MSG_RESULT(no)
2825 system_utmp_path=no ]
2826)
2827if test -z "$conf_utmp_location"; then
2828 if test x"$system_utmp_path" = x"no" ; then
2829 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2830 if test -f $f ; then
2831 conf_utmp_location=$f
2832 fi
2833 done
2834 if test -z "$conf_utmp_location"; then
2835 AC_DEFINE(DISABLE_UTMP)
2836 fi
2837 fi
2838fi
2839if test -n "$conf_utmp_location"; then
2840 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2841fi
2842
2843dnl wtmp detection
2844AC_MSG_CHECKING([if your system defines WTMP_FILE])
2845AC_TRY_COMPILE([
2846#include <sys/types.h>
2847#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002848#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002849# include <paths.h>
2850#endif
2851 ],
2852 [ char *wtmp = WTMP_FILE; ],
2853 [ AC_MSG_RESULT(yes) ],
2854 [ AC_MSG_RESULT(no)
2855 system_wtmp_path=no ]
2856)
2857if test -z "$conf_wtmp_location"; then
2858 if test x"$system_wtmp_path" = x"no" ; then
2859 for f in /usr/adm/wtmp /var/log/wtmp; do
2860 if test -f $f ; then
2861 conf_wtmp_location=$f
2862 fi
2863 done
2864 if test -z "$conf_wtmp_location"; then
2865 AC_DEFINE(DISABLE_WTMP)
2866 fi
2867 fi
2868fi
2869if test -n "$conf_wtmp_location"; then
2870 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2871fi
2872
2873
2874dnl utmpx detection - I don't know any system so perverse as to require
2875dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2876dnl there, though.
2877AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2878AC_TRY_COMPILE([
2879#include <sys/types.h>
2880#include <utmp.h>
2881#ifdef HAVE_UTMPX_H
2882#include <utmpx.h>
2883#endif
Damien Miller2994e082000-06-04 15:51:47 +10002884#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002885# include <paths.h>
2886#endif
2887 ],
2888 [ char *utmpx = UTMPX_FILE; ],
2889 [ AC_MSG_RESULT(yes) ],
2890 [ AC_MSG_RESULT(no)
2891 system_utmpx_path=no ]
2892)
2893if test -z "$conf_utmpx_location"; then
2894 if test x"$system_utmpx_path" = x"no" ; then
2895 AC_DEFINE(DISABLE_UTMPX)
2896 fi
2897else
2898 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2899fi
2900
2901dnl wtmpx detection
2902AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2903AC_TRY_COMPILE([
2904#include <sys/types.h>
2905#include <utmp.h>
2906#ifdef HAVE_UTMPX_H
2907#include <utmpx.h>
2908#endif
Damien Miller2994e082000-06-04 15:51:47 +10002909#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002910# include <paths.h>
2911#endif
2912 ],
2913 [ char *wtmpx = WTMPX_FILE; ],
2914 [ AC_MSG_RESULT(yes) ],
2915 [ AC_MSG_RESULT(no)
2916 system_wtmpx_path=no ]
2917)
2918if test -z "$conf_wtmpx_location"; then
2919 if test x"$system_wtmpx_path" = x"no" ; then
2920 AC_DEFINE(DISABLE_WTMPX)
2921 fi
2922else
2923 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2924fi
2925
Damien Miller4018c192000-04-30 09:30:44 +10002926
Damien Miller29ea30d2000-03-17 10:54:15 +11002927if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002928 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2929 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002930fi
2931
Tim Rice4cec93f2002-02-26 08:40:48 -08002932dnl remove pam and dl because they are in $LIBPAM
2933if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002934 LIBS=`echo $LIBS | sed 's/-lpam //'`
2935fi
2936if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2937 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002938fi
2939
Damien Millerbac2d8a2000-09-05 16:13:06 +11002940AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002941AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002942AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002943
Damien Miller7b22d652000-06-18 14:07:04 +10002944# Print summary of options
2945
Damien Miller7b22d652000-06-18 14:07:04 +10002946# Someone please show me a better way :)
2947A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2948B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2949C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2950D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002951E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002952F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002953G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002954H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2955I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2956J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002957
2958echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002959echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002960echo " User binaries: $B"
2961echo " System binaries: $C"
2962echo " Configuration files: $D"
2963echo " Askpass program: $E"
2964echo " Manual pages: $F"
2965echo " PID file: $G"
2966echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002967if test "x$external_path_file" = "x/etc/login.conf" ; then
2968echo " At runtime, sshd will use the path defined in $external_path_file"
2969echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002970else
Damien Millerf58c6722002-05-13 13:15:42 +10002971echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002972 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002973echo " (If PATH is set in $external_path_file it will be used instead. If"
2974echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2975 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002976fi
Damien Millera18bbd32002-05-13 10:48:57 +10002977if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002978echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002979fi
Damien Millerf58c6722002-05-13 13:15:42 +10002980echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002981echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002982echo " KerberosV support: $KRB5_MSG"
2983echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002984echo " S/KEY support: $SKEY_MSG"
2985echo " TCP Wrappers support: $TCPW_MSG"
2986echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002987echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002988echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2989echo " BSD Auth support: $BSD_AUTH_MSG"
2990echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002991if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002992echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002993fi
2994
Damien Miller7b22d652000-06-18 14:07:04 +10002995echo ""
2996
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002997echo " Host: ${host}"
2998echo " Compiler: ${CC}"
2999echo " Compiler flags: ${CFLAGS}"
3000echo "Preprocessor flags: ${CPPFLAGS}"
3001echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003002echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003003
3004echo ""
3005
Tim Rice6f1f7582004-05-30 21:38:51 -07003006if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003007 echo "SVR4 style packages are supported with \"make package\""
3008 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003009fi
3010
Damien Miller82cf0ce2000-12-20 13:34:48 +11003011if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003012 echo "PAM is enabled. You may need to install a PAM control file "
3013 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003014 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003015 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003016 echo ""
3017fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003018
Damien Miller6c21c512002-01-22 21:57:53 +11003019if test ! -z "$RAND_HELPER_CMDHASH" ; then
3020 echo "WARNING: you are using the builtin random number collection "
3021 echo "service. Please read WARNING.RNG and request that your OS "
3022 echo "vendor includes kernel-based random number collection in "
3023 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003024 echo ""
3025fi
Damien Miller60396b02001-02-18 17:01:00 +11003026
Damien Millerb4097182004-05-23 14:09:40 +10003027if test ! -z "$NO_PEERCHECK" ; then
3028 echo "WARNING: the operating system that you are using does not "
3029 echo "appear to support either the getpeereid() API nor the "
3030 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3031 echo "enforce security checks to prevent unauthorised connections to "
3032 echo "ssh-agent. Their absence increases the risk that a malicious "
3033 echo "user can connect to your agent. "
3034 echo ""
3035fi
3036