blob: 88c0c46879e3ed9cc9f8488f5515b578c23402d9 [file] [log] [blame]
Tim Ricef7ba8f62004-06-20 10:37:32 -07001# $Id: configure.ac,v 1.221 2004/06/20 17:37:32 tim Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
78
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110080if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100081 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110082fi
83
Tim Rice88368a32003-12-08 12:35:59 -080084AC_ARG_WITH(rpath,
85 [ --without-rpath Disable auto-added -R linker paths],
86 [
87 if test "x$withval" = "xno" ; then
88 need_dash_r=""
89 fi
90 if test "x$withval" = "xyes" ; then
91 need_dash_r=1
92 fi
93 ]
94)
95
Damien Millera22ba012000-03-02 23:09:20 +110096# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110097case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110098*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110099 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000100 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800101 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100102 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
108 fi
109 done
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
113 else
114 AC_MSG_RESULT($blibflags)
115 fi
116 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700119 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700121 LIBS="$LIBS -ls"
122 ])
123 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000124 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
125 AC_CHECK_DECL(loginfailed,
126 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
127 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000128 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [(void)loginfailed("user","host","tty",0);],
130 [AC_MSG_RESULT(yes)
131 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000132 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000133 )],
134 [],
135 [#include <usersec.h>]
136 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000137 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100138 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000139 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000140 AC_DEFINE(SETEUID_BREAKS_SETUID)
141 AC_DEFINE(BROKEN_SETREUID)
142 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000143 dnl AIX handles lastlog as part of its login message
144 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000146 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100147 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100148*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100149 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800150 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000152 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100153 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100154 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000155 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000156 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700157 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000158 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100159 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000160*-*-dgux*)
161 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100162 AC_DEFINE(SETEUID_BREAKS_SETUID)
163 AC_DEFINE(BROKEN_SETREUID)
164 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000165 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000166*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000167 AC_MSG_CHECKING(if we have working getaddrinfo)
168 AC_TRY_RUN([#include <mach-o/dyld.h>
169main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
170 exit(0);
171 else
172 exit(1);
173}], [AC_MSG_RESULT(working)],
174 [AC_MSG_RESULT(buggy)
175 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700176 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000177 AC_DEFINE(SETEUID_BREAKS_SETUID)
178 AC_DEFINE(BROKEN_SETREUID)
179 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100180 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000181 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000182*-*-hpux10.26)
183 if test -z "$GCC"; then
184 CFLAGS="$CFLAGS -Ae"
185 fi
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(HAVE_SECUREWARE)
189 AC_DEFINE(USE_PIPES)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000192 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000193 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700194 LIBS="$LIBS -lsec -lsecpw"
195 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000196 disable_ptmx_check=yes
197 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100198*-*-hpux10*)
199 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000200 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100201 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000202 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100203 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000204 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000205 AC_DEFINE(LOGIN_NO_ENDOPT)
206 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000207 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000208 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700209 LIBS="$LIBS -lsec"
210 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100211 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000212*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100214 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100215 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100216 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000217 AC_DEFINE(LOGIN_NO_ENDOPT)
218 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100219 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000220 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000221 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000222 check_for_hpux_broken_getaddrinfo=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700223 LIBS="$LIBS -lsec"
224 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000225 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100226*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100227 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000228 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000229 AC_DEFINE(SETEUID_BREAKS_SETUID)
230 AC_DEFINE(BROKEN_SETREUID)
231 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000232 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000233 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100234 ;;
235*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100236 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000237 AC_DEFINE(WITH_IRIX_ARRAY)
238 AC_DEFINE(WITH_IRIX_PROJECT)
239 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000240 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000241 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000242 AC_DEFINE(SETEUID_BREAKS_SETUID)
243 AC_DEFINE(BROKEN_SETREUID)
244 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000245 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000246 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000247 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100248 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100249*-*-linux*)
250 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100251 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000252 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100253 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000254 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000255 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000256 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100257 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000258 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000259 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000260 AC_DEFINE(BROKEN_CMSG_TYPE)
261 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000262 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100263 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000264mips-sony-bsd|mips-sony-newsos4)
265 AC_DEFINE(HAVE_NEWS4)
266 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000267 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100268*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000269 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800270 if test "x$withval" != "xno" ; then
271 need_dash_r=1
272 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100273 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100274*-*-freebsd*)
275 check_for_libcrypt_later=1
276 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000277*-*-bsdi*)
278 AC_DEFINE(SETEUID_BREAKS_SETUID)
279 AC_DEFINE(BROKEN_SETREUID)
280 AC_DEFINE(BROKEN_SETREGID)
281 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000282*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000283 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100284 conf_utmp_location=/etc/utmp
285 conf_wtmp_location=/usr/adm/wtmp
286 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000287 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000288 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000289 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100290 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000291 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100292*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800293 if test "x$withval" != "xno" ; then
294 need_dash_r=1
295 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100296 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000297 AC_DEFINE(LOGIN_NEEDS_UTMPX)
298 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000299 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000300 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000301 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
302 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000303 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000304 # hardwire lastlog location (can't detect it on some versions)
305 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000306 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
307 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
308 if test "$sol2ver" -ge 8; then
309 AC_MSG_RESULT(yes)
310 AC_DEFINE(DISABLE_UTMP)
311 AC_DEFINE(DISABLE_WTMP)
312 else
313 AC_MSG_RESULT(no)
314 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100315 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000316*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000317 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000318 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100319 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000320 conf_utmp_location=/etc/utmp
321 conf_wtmp_location=/var/adm/wtmp
322 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000323 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000324 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000325*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700326 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000327 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000328 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000329 AC_DEFINE(SETEUID_BREAKS_SETUID)
330 AC_DEFINE(BROKEN_SETREUID)
331 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000332 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000333*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700334 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000335 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100336 IPADDR_IN_DISPLAY=yes
337 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000338 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000339 AC_DEFINE(SETEUID_BREAKS_SETUID)
340 AC_DEFINE(BROKEN_SETREUID)
341 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000342 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000343 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700344 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
345 # Attention: always take care to bind libsocket and libnsl before libc,
346 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000347 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100348*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100349 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700350 AC_DEFINE(SETEUID_BREAKS_SETUID)
351 AC_DEFINE(BROKEN_SETREUID)
352 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100353 ;;
354*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100355 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700356 AC_DEFINE(SETEUID_BREAKS_SETUID)
357 AC_DEFINE(BROKEN_SETREUID)
358 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100359 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100360*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100361 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100362*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800363 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800364 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100365 RANLIB=true
366 no_dev_ptmx=1
367 AC_DEFINE(BROKEN_SYS_TERMIO_H)
368 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000369 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000370 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100371 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700372 AC_DEFINE(SETEUID_BREAKS_SETUID)
373 AC_DEFINE(BROKEN_SETREUID)
374 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700375 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100376 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700377 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700378 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700379 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100380 ;;
381*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800382 if test -z "$GCC"; then
383 CFLAGS="$CFLAGS -belf"
384 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100385 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000386 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100387 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000388 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000389 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700390 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700391 AC_DEFINE(SETEUID_BREAKS_SETUID)
392 AC_DEFINE(BROKEN_SETREUID)
393 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700394 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100395 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700396 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700397 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000398 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000399*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100400 AC_DEFINE(NO_SSH_LASTLOG)
401 AC_DEFINE(SETEUID_BREAKS_SETUID)
402 AC_DEFINE(BROKEN_SETREUID)
403 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000404 AC_DEFINE(USE_PIPES)
405 AC_DEFINE(DISABLE_FD_PASSING)
406 LDFLAGS="$LDFLAGS"
407 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
408 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000409 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000410*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100411 AC_DEFINE(SETEUID_BREAKS_SETUID)
412 AC_DEFINE(BROKEN_SETREUID)
413 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000414 AC_DEFINE(WITH_ABBREV_NO_TTY)
415 AC_DEFINE(USE_PIPES)
416 AC_DEFINE(DISABLE_FD_PASSING)
417 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100418 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000419 MANTYPE=cat
420 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000421*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100422 AC_DEFINE(SETEUID_BREAKS_SETUID)
423 AC_DEFINE(BROKEN_SETREUID)
424 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000425 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700426 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700427 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000428 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
429 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
430 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700431 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000432*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000433 AC_MSG_CHECKING(for Digital Unix SIA)
434 no_osfsia=""
435 AC_ARG_WITH(osfsia,
436 [ --with-osfsia Enable Digital Unix SIA],
437 [
438 if test "x$withval" = "xno" ; then
439 AC_MSG_RESULT(disabled)
440 no_osfsia=1
441 fi
442 ],
443 )
444 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000445 if test -f /etc/sia/matrix.conf; then
446 AC_MSG_RESULT(yes)
447 AC_DEFINE(HAVE_OSF_SIA)
448 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000449 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000450 LIBS="$LIBS -lsecurity -ldb -lm -laud"
451 else
452 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100453 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000454 fi
455 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000456 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700457 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000458 AC_DEFINE(BROKEN_SETREUID)
459 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000460 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000461
462*-*-nto-qnx)
463 AC_DEFINE(USE_PIPES)
464 AC_DEFINE(NO_X11_UNIX_SOCKETS)
465 AC_DEFINE(MISSING_NFDBITS)
466 AC_DEFINE(MISSING_HOWMANY)
467 AC_DEFINE(MISSING_FD_MASK)
468 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100469esac
470
Damien Millere37bfc12000-06-05 09:37:43 +1000471# Allow user to specify flags
472AC_ARG_WITH(cflags,
473 [ --with-cflags Specify additional flags to pass to compiler],
474 [
475 if test "x$withval" != "xno" ; then
476 CFLAGS="$CFLAGS $withval"
477 fi
478 ]
479)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000480AC_ARG_WITH(cppflags,
481 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
482 [
483 if test "x$withval" != "xno"; then
484 CPPFLAGS="$CPPFLAGS $withval"
485 fi
486 ]
487)
Damien Millere37bfc12000-06-05 09:37:43 +1000488AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000489 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000490 [
491 if test "x$withval" != "xno" ; then
492 LDFLAGS="$LDFLAGS $withval"
493 fi
494 ]
495)
496AC_ARG_WITH(libs,
497 [ --with-libs Specify additional libraries to link with],
498 [
499 if test "x$withval" != "xno" ; then
500 LIBS="$LIBS $withval"
501 fi
502 ]
503)
504
Darren Tucker6eb93042003-06-29 21:30:41 +1000505AC_MSG_CHECKING(compiler and flags for sanity)
506AC_TRY_RUN([
507#include <stdio.h>
508int main(){exit(0);}
509 ],
510 [ AC_MSG_RESULT(yes) ],
511 [
512 AC_MSG_RESULT(no)
513 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
514 ]
515)
516
Tim Rice4cec93f2002-02-26 08:40:48 -0800517# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000518AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000519 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800520 login_cap.h maillock.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100521 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000522 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000523 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100524 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
525 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
526 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
527 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800528
Damien Millera22ba012000-03-02 23:09:20 +1100529# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700530AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
531AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000532
Damien Millerdf288022001-02-18 13:07:07 +1100533dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700534if test "x$with_tcp_wrappers" != "xno" ; then
535 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
536 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
537 fi
538fi
Damien Millerdf288022001-02-18 13:07:07 +1100539
Tim Rice1e1ef642003-09-11 22:19:31 -0700540dnl IRIX and Solaris 2.5.1 have dirname() in libgen
541AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
542 AC_CHECK_LIB(gen, dirname,[
543 AC_CACHE_CHECK([for broken dirname],
544 ac_cv_have_broken_dirname, [
545 save_LIBS="$LIBS"
546 LIBS="$LIBS -lgen"
547 AC_TRY_RUN(
548 [
549#include <libgen.h>
550#include <string.h>
551
552int main(int argc, char **argv) {
553 char *s, buf[32];
554
555 strncpy(buf,"/etc", 32);
556 s = dirname(buf);
557 if (!s || strncmp(s, "/", 32) != 0) {
558 exit(1);
559 } else {
560 exit(0);
561 }
562}
563 ],
564 [ ac_cv_have_broken_dirname="no" ],
565 [ ac_cv_have_broken_dirname="yes" ]
566 )
567 LIBS="$save_LIBS"
568 ])
569 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
570 LIBS="$LIBS -lgen"
571 AC_DEFINE(HAVE_DIRNAME)
572 AC_CHECK_HEADERS(libgen.h)
573 fi
574 ])
575])
576
577AC_CHECK_FUNC(getspnam, ,
578 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
579AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
580
Tim Rice13aae5e2001-10-21 17:53:58 -0700581dnl zlib is required
582AC_ARG_WITH(zlib,
583 [ --with-zlib=PATH Use zlib in PATH],
584 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000585 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100586 AC_MSG_ERROR([*** zlib is required ***])
587 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700588 if test -d "$withval/lib"; then
589 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700590 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700591 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700592 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700593 fi
594 else
595 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700596 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700597 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700598 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700599 fi
600 fi
601 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700602 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700603 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700604 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700605 fi
606 ]
607)
608
Tim Ricefcb62202004-01-23 18:35:16 -0800609AC_CHECK_LIB(z, deflate, ,
610 [
611 saved_CPPFLAGS="$CPPFLAGS"
612 saved_LDFLAGS="$LDFLAGS"
613 save_LIBS="$LIBS"
614 dnl Check default zlib install dir
615 if test -n "${need_dash_r}"; then
616 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
617 else
618 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
619 fi
620 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
621 LIBS="$LIBS -lz"
622 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
623 [
624 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
625 ]
626 )
627 ]
628)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100629AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100630
631AC_ARG_WITH(zlib-version-check,
632 [ --without-zlib-version-check Disable zlib version check],
633 [ if test "x$withval" = "xno" ; then
634 zlib_check_nonfatal=1
635 fi
636 ]
637)
638
Darren Tucker2dcd2392004-01-23 17:13:33 +1100639AC_MSG_CHECKING(for zlib 1.1.4 or greater)
640AC_TRY_RUN([
641#include <zlib.h>
642int main()
643{
644 int a, b, c, v;
645 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
646 exit(1);
647 v = a*1000000 + b*1000 + c;
648 if (v >= 1001004)
649 exit(0);
650 exit(2);
651}
652 ],
653 AC_MSG_RESULT(yes),
654 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100655 if test -z "$zlib_check_nonfatal" ; then
656 AC_MSG_ERROR([*** zlib too old - check config.log ***
657Your reported zlib version has known security problems. It's possible your
658vendor has fixed these problems without changing the version number. If you
659are sure this is the case, you can disable the check by running
660"./configure --without-zlib-version-check".
661If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
662 else
663 AC_MSG_WARN([zlib version may have security problems])
664 fi
665 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100666)
Damien Miller6f9c3372000-10-25 10:06:04 +1100667
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000668dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100669AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000670 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
671)
Damien Millera8e06ce2003-11-21 23:48:55 +1100672AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700673 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
674 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000675)
Damien Millerab18c411999-11-11 10:40:23 +1100676
Tim Ricee589a292001-11-03 11:09:32 -0800677dnl Checks for libutil functions
678AC_CHECK_HEADERS(libutil.h)
679AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
680AC_CHECK_FUNCS(logout updwtmp logwtmp)
681
Ben Lindstrom8697e082001-02-24 21:41:10 +0000682AC_FUNC_STRFTIME
683
Damien Miller3c027682001-03-14 11:39:45 +1100684# Check for ALTDIRFUNC glob() extension
685AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
686AC_EGREP_CPP(FOUNDIT,
687 [
688 #include <glob.h>
689 #ifdef GLOB_ALTDIRFUNC
690 FOUNDIT
691 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100692 ],
Damien Miller3c027682001-03-14 11:39:45 +1100693 [
694 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
695 AC_MSG_RESULT(yes)
696 ],
697 [
698 AC_MSG_RESULT(no)
699 ]
700)
Damien Millerab18c411999-11-11 10:40:23 +1100701
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000702# Check for g.gl_matchc glob() extension
703AC_MSG_CHECKING(for gl_matchc field in glob_t)
704AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100705 [
706 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000707 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100708 ],
709 [
710 AC_DEFINE(GLOB_HAS_GL_MATCHC)
711 AC_MSG_RESULT(yes)
712 ],
713 [
714 AC_MSG_RESULT(no)
715 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000716)
717
Damien Miller18bb4732001-03-28 14:35:30 +1000718AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
719AC_TRY_RUN(
720 [
721#include <sys/types.h>
722#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700723int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000724 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100725 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000726 [
727 AC_MSG_RESULT(no)
728 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
729 ]
730)
731
Damien Millerc547bf12001-02-16 10:18:12 +1100732# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100733SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100734AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700735 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100736 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100737 [
738 if test "x$withval" != "xno" ; then
739
740 if test "x$withval" != "xyes" ; then
741 CPPFLAGS="$CPPFLAGS -I${withval}/include"
742 LDFLAGS="$LDFLAGS -L${withval}/lib"
743 fi
744
745 AC_DEFINE(SKEY)
746 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100747 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100748
Tim Rice4cec93f2002-02-26 08:40:48 -0800749 AC_MSG_CHECKING([for s/key support])
750 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100751 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800752#include <stdio.h>
753#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700754int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800755 ],
756 [AC_MSG_RESULT(yes)],
757 [
758 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100759 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
760 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000761 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
762 AC_TRY_COMPILE(
763 [#include <stdio.h>
764 #include <skey.h>],
765 [(void)skeychallenge(NULL,"name","",0);],
766 [AC_MSG_RESULT(yes)
767 AC_DEFINE(SKEYCHALLENGE_4ARG)],
768 [AC_MSG_RESULT(no)]
769 )
Damien Millerc547bf12001-02-16 10:18:12 +1100770 fi
771 ]
772)
773
774# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700775TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100776AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700777 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100778 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100779 [
780 if test "x$withval" != "xno" ; then
781 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700782 saved_LDFLAGS="$LDFLAGS"
783 saved_CPPFLAGS="$CPPFLAGS"
784 if test -n "${withval}" -a "${withval}" != "yes"; then
785 if test -d "${withval}/lib"; then
786 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700787 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700788 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700789 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700790 fi
791 else
792 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700793 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700794 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700795 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700796 fi
797 fi
798 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700799 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700800 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700801 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700802 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700803 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800804 LIBWRAP="-lwrap"
805 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100806 AC_MSG_CHECKING(for libwrap)
807 AC_TRY_LINK(
808 [
Damien Miller0ac45002004-04-14 20:14:26 +1000809#include <sys/types.h>
810#include <sys/socket.h>
811#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100812#include <tcpd.h>
813 int deny_severity = 0, allow_severity = 0;
814 ],
815 [hosts_access(0);],
816 [
817 AC_MSG_RESULT(yes)
818 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800819 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100821 ],
822 [
823 AC_MSG_ERROR([*** libwrap missing])
824 ]
825 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800826 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100827 fi
828 ]
829)
830
Damien Millerfe1f1432003-02-24 15:45:42 +1100831dnl Checks for library functions. Please keep in alphabetical order
832AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000833 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000834 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000835 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000836 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100837 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000838 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100839 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000840 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100841 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000842 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000843 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100844 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100845)
Tim Rice13aae5e2001-10-21 17:53:58 -0700846
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000847# IRIX has a const char return value for gai_strerror()
848AC_CHECK_FUNCS(gai_strerror,[
849 AC_DEFINE(HAVE_GAI_STRERROR)
850 AC_TRY_COMPILE([
851#include <sys/types.h>
852#include <sys/socket.h>
853#include <netdb.h>
854
855const char *gai_strerror(int);],[
856char *str;
857
858str = gai_strerror(0);],[
859 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
860 [Define if gai_strerror() returns const char *])])])
861
Damien Millercd6853c2003-01-28 11:33:42 +1100862AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
863
Darren Tuckerf1159b52003-07-07 19:44:01 +1000864dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000865AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000866AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000867
Darren Tuckerb2427c82003-09-10 15:22:44 +1000868dnl tcsendbreak might be a macro
869AC_CHECK_DECL(tcsendbreak,
870 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100871 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000872 [#include <termios.h>]
873)
874
Darren Tucker5bb14002004-04-23 18:53:10 +1000875AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
876
Darren Tucker2a6b0292003-12-31 14:59:17 +1100877AC_CHECK_FUNCS(setresuid, [
878 dnl Some platorms have setresuid that isn't implemented, test for this
879 AC_MSG_CHECKING(if setresuid seems to work)
880 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100881#include <stdlib.h>
882#include <errno.h>
883int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100884 ],
885 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100886 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100887 AC_MSG_RESULT(not implemented)]
888 )
889])
Darren Tuckere937be32003-12-17 18:53:26 +1100890
Darren Tucker2a6b0292003-12-31 14:59:17 +1100891AC_CHECK_FUNCS(setresgid, [
892 dnl Some platorms have setresgid that isn't implemented, test for this
893 AC_MSG_CHECKING(if setresgid seems to work)
894 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100895#include <stdlib.h>
896#include <errno.h>
897int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100898 ],
899 [AC_MSG_RESULT(yes)],
900 [AC_DEFINE(BROKEN_SETRESGID)
901 AC_MSG_RESULT(not implemented)]
902 )
903])
Darren Tuckere937be32003-12-17 18:53:26 +1100904
Damien Millerad833b32000-08-23 10:46:23 +1000905dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000906AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000907dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000908AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000909AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000910dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000911AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000912AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100913
Damien Millera8e06ce2003-11-21 23:48:55 +1100914AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100915 [AC_DEFINE(HAVE_DAEMON)],
916 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
917)
918
Damien Millera8e06ce2003-11-21 23:48:55 +1100919AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100920 [AC_DEFINE(HAVE_GETPAGESIZE)],
921 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
922)
923
Damien Millercb170cb2000-07-01 16:52:55 +1000924# Check for broken snprintf
925if test "x$ac_cv_func_snprintf" = "xyes" ; then
926 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
927 AC_TRY_RUN(
928 [
929#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700930int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000931 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100932 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000933 [
934 AC_MSG_RESULT(no)
935 AC_DEFINE(BROKEN_SNPRINTF)
936 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
937 ]
938 )
939fi
940
Damien Millerb4097182004-05-23 14:09:40 +1000941# Check for missing getpeereid (or equiv) support
942NO_PEERCHECK=""
943if test "x$ac_cv_func_getpeereid" != "xyes" ; then
944 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
945 AC_TRY_COMPILE(
946 [#include <sys/types.h>
947 #include <sys/socket.h>],
948 [int i = SO_PEERCRED;],
949 [AC_MSG_RESULT(yes)],
950 [AC_MSG_RESULT(no)
951 NO_PEERCHECK=1]
952 )
953fi
954
Damien Millere8328192003-01-07 15:18:32 +1100955dnl see whether mkstemp() requires XXXXXX
956if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
957AC_MSG_CHECKING([for (overly) strict mkstemp])
958AC_TRY_RUN(
959 [
960#include <stdlib.h>
961main() { char template[]="conftest.mkstemp-test";
962if (mkstemp(template) == -1)
963 exit(1);
964unlink(template); exit(0);
965}
966 ],
967 [
968 AC_MSG_RESULT(no)
969 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100970 [
Damien Millere8328192003-01-07 15:18:32 +1100971 AC_MSG_RESULT(yes)
972 AC_DEFINE(HAVE_STRICT_MKSTEMP)
973 ],
974 [
975 AC_MSG_RESULT(yes)
976 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100977 ]
Damien Millere8328192003-01-07 15:18:32 +1100978)
979fi
980
Darren Tucker70a3d552003-08-21 17:58:29 +1000981dnl make sure that openpty does not reacquire controlling terminal
982if test ! -z "$check_for_openpty_ctty_bug"; then
983 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
984 AC_TRY_RUN(
985 [
986#include <stdio.h>
987#include <sys/fcntl.h>
988#include <sys/types.h>
989#include <sys/wait.h>
990
991int
992main()
993{
994 pid_t pid;
995 int fd, ptyfd, ttyfd, status;
996
997 pid = fork();
998 if (pid < 0) { /* failed */
999 exit(1);
1000 } else if (pid > 0) { /* parent */
1001 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001002 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001003 exit(WEXITSTATUS(status));
1004 else
1005 exit(2);
1006 } else { /* child */
1007 close(0); close(1); close(2);
1008 setsid();
1009 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1010 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1011 if (fd >= 0)
1012 exit(3); /* Acquired ctty: broken */
1013 else
1014 exit(0); /* Did not acquire ctty: OK */
1015 }
1016}
1017 ],
1018 [
1019 AC_MSG_RESULT(yes)
1020 ],
1021 [
1022 AC_MSG_RESULT(no)
1023 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1024 ]
1025 )
1026fi
1027
Darren Tucker4398cf52004-04-06 21:39:02 +10001028if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1029 AC_MSG_CHECKING(if getaddrinfo seems to work)
1030 AC_TRY_RUN(
1031 [
1032#include <stdio.h>
1033#include <sys/socket.h>
1034#include <netdb.h>
1035#include <errno.h>
1036#include <netinet/in.h>
1037
1038#define TEST_PORT "2222"
1039
1040int
1041main(void)
1042{
1043 int err, sock;
1044 struct addrinfo *gai_ai, *ai, hints;
1045 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1046
1047 memset(&hints, 0, sizeof(hints));
1048 hints.ai_family = PF_UNSPEC;
1049 hints.ai_socktype = SOCK_STREAM;
1050 hints.ai_flags = AI_PASSIVE;
1051
1052 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1053 if (err != 0) {
1054 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1055 exit(1);
1056 }
1057
1058 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1059 if (ai->ai_family != AF_INET6)
1060 continue;
1061
1062 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1063 sizeof(ntop), strport, sizeof(strport),
1064 NI_NUMERICHOST|NI_NUMERICSERV);
1065
1066 if (err != 0) {
1067 if (err == EAI_SYSTEM)
1068 perror("getnameinfo EAI_SYSTEM");
1069 else
1070 fprintf(stderr, "getnameinfo failed: %s\n",
1071 gai_strerror(err));
1072 exit(2);
1073 }
1074
1075 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1076 if (sock < 0)
1077 perror("socket");
1078 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1079 if (errno == EBADF)
1080 exit(3);
1081 }
1082 }
1083 exit(0);
1084}
1085 ],
1086 [
1087 AC_MSG_RESULT(yes)
1088 ],
1089 [
1090 AC_MSG_RESULT(no)
1091 AC_DEFINE(BROKEN_GETADDRINFO)
1092 ]
1093 )
1094fi
1095
Damien Miller606f8802000-09-16 15:39:56 +11001096AC_FUNC_GETPGRP
1097
Damien Millera64b57a2001-01-17 10:44:13 +11001098# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001099PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001100AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001101 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001102 [
Damien Millera64b57a2001-01-17 10:44:13 +11001103 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001104 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1105 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001106 AC_MSG_ERROR([PAM headers not found])
1107 fi
1108
1109 AC_CHECK_LIB(dl, dlopen, , )
1110 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1111 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001112 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001113
Damien Millera64b57a2001-01-17 10:44:13 +11001114 PAM_MSG="yes"
1115
1116 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001117 if test $ac_cv_lib_dl_dlopen = yes; then
1118 LIBPAM="-lpam -ldl"
1119 else
1120 LIBPAM="-lpam"
1121 fi
1122 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001123 fi
1124 ]
1125)
Damien Millera22ba012000-03-02 23:09:20 +11001126
Damien Millera64b57a2001-01-17 10:44:13 +11001127# Check for older PAM
1128if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001129 # Check PAM strerror arguments (old PAM)
1130 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1131 AC_TRY_COMPILE(
1132 [
Damien Miller81171112000-04-23 11:14:01 +10001133#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001134#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001135#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001136#elif defined (HAVE_PAM_PAM_APPL_H)
1137#include <pam/pam_appl.h>
1138#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001139 ],
1140 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001141 [AC_MSG_RESULT(no)],
1142 [
1143 AC_DEFINE(HAVE_OLD_PAM)
1144 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001145 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001146 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001147 )
Damien Millera22ba012000-03-02 23:09:20 +11001148fi
1149
Tim Riceaef73712002-05-11 13:17:42 -07001150# Search for OpenSSL
1151saved_CPPFLAGS="$CPPFLAGS"
1152saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001153AC_ARG_WITH(ssl-dir,
1154 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1155 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001156 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001157 if test -d "$withval/lib"; then
1158 if test -n "${need_dash_r}"; then
1159 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1160 else
1161 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1162 fi
1163 else
1164 if test -n "${need_dash_r}"; then
1165 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1166 else
1167 LDFLAGS="-L${withval} ${LDFLAGS}"
1168 fi
1169 fi
1170 if test -d "$withval/include"; then
1171 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1172 else
1173 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1174 fi
Damien Millera22ba012000-03-02 23:09:20 +11001175 fi
1176 ]
1177)
Tim Rice3d5352e2004-02-12 09:27:21 -08001178LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001179AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001180 [
Tim Riceaef73712002-05-11 13:17:42 -07001181 dnl Check default openssl install dir
1182 if test -n "${need_dash_r}"; then
1183 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001184 else
Tim Riceaef73712002-05-11 13:17:42 -07001185 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001186 fi
Tim Riceaef73712002-05-11 13:17:42 -07001187 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1188 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1189 [
1190 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1191 ]
1192 )
1193 ]
1194)
1195
Tim Riced730b782002-08-13 18:52:10 -07001196# Determine OpenSSL header version
1197AC_MSG_CHECKING([OpenSSL header version])
1198AC_TRY_RUN(
1199 [
1200#include <stdio.h>
1201#include <string.h>
1202#include <openssl/opensslv.h>
1203#define DATA "conftest.sslincver"
1204int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001205 FILE *fd;
1206 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001207
Damien Millera8e06ce2003-11-21 23:48:55 +11001208 fd = fopen(DATA,"w");
1209 if(fd == NULL)
1210 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001211
1212 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1213 exit(1);
1214
1215 exit(0);
1216}
1217 ],
1218 [
1219 ssl_header_ver=`cat conftest.sslincver`
1220 AC_MSG_RESULT($ssl_header_ver)
1221 ],
1222 [
1223 AC_MSG_RESULT(not found)
1224 AC_MSG_ERROR(OpenSSL version header not found.)
1225 ]
1226)
1227
1228# Determine OpenSSL library version
1229AC_MSG_CHECKING([OpenSSL library version])
1230AC_TRY_RUN(
1231 [
1232#include <stdio.h>
1233#include <string.h>
1234#include <openssl/opensslv.h>
1235#include <openssl/crypto.h>
1236#define DATA "conftest.ssllibver"
1237int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001238 FILE *fd;
1239 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001240
Damien Millera8e06ce2003-11-21 23:48:55 +11001241 fd = fopen(DATA,"w");
1242 if(fd == NULL)
1243 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001244
1245 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1246 exit(1);
1247
1248 exit(0);
1249}
1250 ],
1251 [
1252 ssl_library_ver=`cat conftest.ssllibver`
1253 AC_MSG_RESULT($ssl_library_ver)
1254 ],
1255 [
1256 AC_MSG_RESULT(not found)
1257 AC_MSG_ERROR(OpenSSL library not found.)
1258 ]
1259)
Damien Millera22ba012000-03-02 23:09:20 +11001260
Damien Millerec932372002-01-22 22:16:03 +11001261# Sanity check OpenSSL headers
1262AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1263AC_TRY_RUN(
1264 [
1265#include <string.h>
1266#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001267int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001268 ],
1269 [
1270 AC_MSG_RESULT(yes)
1271 ],
1272 [
1273 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001274 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1275Check config.log for details.
1276Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001277 ]
1278)
1279
Tim Rice3d5352e2004-02-12 09:27:21 -08001280# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1281# because the system crypt() is more featureful.
1282if test "x$check_for_libcrypt_before" = "x1"; then
1283 AC_CHECK_LIB(crypt, crypt)
1284fi
1285
Damien Millera8e06ce2003-11-21 23:48:55 +11001286# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001287# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001288if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001289 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001290fi
1291
Damien Miller6c21c512002-01-22 21:57:53 +11001292
1293### Configure cryptographic random number support
1294
1295# Check wheter OpenSSL seeds itself
1296AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1297AC_TRY_RUN(
1298 [
1299#include <string.h>
1300#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001301int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001302 ],
1303 [
1304 OPENSSL_SEEDS_ITSELF=yes
1305 AC_MSG_RESULT(yes)
1306 ],
1307 [
1308 AC_MSG_RESULT(no)
1309 # Default to use of the rand helper if OpenSSL doesn't
1310 # seed itself
1311 USE_RAND_HELPER=yes
1312 ]
1313)
1314
1315
1316# Do we want to force the use of the rand helper?
1317AC_ARG_WITH(rand-helper,
1318 [ --with-rand-helper Use subprocess to gather strong randomness ],
1319 [
1320 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001321 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001322 # the previous test showed it to be unseeded.
1323 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1324 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1325 OPENSSL_SEEDS_ITSELF=yes
1326 USE_RAND_HELPER=""
1327 fi
1328 else
1329 USE_RAND_HELPER=yes
1330 fi
1331 ],
1332)
1333
1334# Which randomness source do we use?
1335if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1336 # OpenSSL only
1337 AC_DEFINE(OPENSSL_PRNG_ONLY)
1338 RAND_MSG="OpenSSL internal ONLY"
1339 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001340elif test ! -z "$USE_RAND_HELPER" ; then
1341 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001342 RAND_MSG="ssh-rand-helper"
1343 INSTALL_SSH_RAND_HELPER="yes"
1344fi
1345AC_SUBST(INSTALL_SSH_RAND_HELPER)
1346
1347### Configuration of ssh-rand-helper
1348
1349# PRNGD TCP socket
1350AC_ARG_WITH(prngd-port,
1351 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1352 [
Damien Millere996d722002-01-23 11:20:59 +11001353 case "$withval" in
1354 no)
1355 withval=""
1356 ;;
1357 [[0-9]]*)
1358 ;;
1359 *)
1360 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1361 ;;
1362 esac
1363 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001364 PRNGD_PORT="$withval"
1365 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1366 fi
1367 ]
1368)
1369
1370# PRNGD Unix domain socket
1371AC_ARG_WITH(prngd-socket,
1372 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1373 [
Damien Millere996d722002-01-23 11:20:59 +11001374 case "$withval" in
1375 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001376 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001377 ;;
1378 no)
1379 withval=""
1380 ;;
1381 /*)
1382 ;;
1383 *)
1384 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1385 ;;
1386 esac
1387
1388 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001389 if test ! -z "$PRNGD_PORT" ; then
1390 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1391 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001392 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001393 AC_MSG_WARN(Entropy socket is not readable)
1394 fi
1395 PRNGD_SOCKET="$withval"
1396 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1397 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001398 ],
1399 [
1400 # Check for existing socket only if we don't have a random device already
1401 if test "$USE_RAND_HELPER" = yes ; then
1402 AC_MSG_CHECKING(for PRNGD/EGD socket)
1403 # Insert other locations here
1404 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1405 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1406 PRNGD_SOCKET="$sock"
1407 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1408 break;
1409 fi
1410 done
1411 if test ! -z "$PRNGD_SOCKET" ; then
1412 AC_MSG_RESULT($PRNGD_SOCKET)
1413 else
1414 AC_MSG_RESULT(not found)
1415 fi
1416 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001417 ]
1418)
1419
1420# Change default command timeout for hashing entropy source
1421entropy_timeout=200
1422AC_ARG_WITH(entropy-timeout,
1423 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1424 [
1425 if test "x$withval" != "xno" ; then
1426 entropy_timeout=$withval
1427 fi
1428 ]
1429)
Damien Miller6c21c512002-01-22 21:57:53 +11001430AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1431
Damien Millerd3f6ad22002-06-25 10:24:47 +10001432SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001433AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001434 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001435 [
1436 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001437 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001438 fi
1439 ]
1440)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001441AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1442AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001443
Tim Rice88f2ab52002-03-17 12:17:34 -08001444# We do this little dance with the search path to insure
1445# that programs that we select for use by installed programs
1446# (which may be run by the super-user) come from trusted
1447# locations before they come from the user's private area.
1448# This should help avoid accidentally configuring some
1449# random version of a program in someone's personal bin.
1450
1451OPATH=$PATH
1452PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001453test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001454test -d /sbin && PATH=$PATH:/sbin
1455test -d /usr/sbin && PATH=$PATH:/usr/sbin
1456PATH=$PATH:/etc:$OPATH
1457
Damien Millera8e06ce2003-11-21 23:48:55 +11001458# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001459OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1460OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1461OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1462OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1463OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1464OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1465OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1466OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1467OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1468OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1469OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1470OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1471OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1472OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1473OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1474OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001475# restore PATH
1476PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001477
1478# Where does ssh-rand-helper get its randomness from?
1479INSTALL_SSH_PRNG_CMDS=""
1480if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1481 if test ! -z "$PRNGD_PORT" ; then
1482 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1483 elif test ! -z "$PRNGD_SOCKET" ; then
1484 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1485 else
1486 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1487 RAND_HELPER_CMDHASH=yes
1488 INSTALL_SSH_PRNG_CMDS="yes"
1489 fi
1490fi
1491AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1492
1493
Ben Lindstromb5628642000-10-18 00:02:25 +00001494# Cheap hack to ensure NEWS-OS libraries are arranged right.
1495if test ! -z "$SONY" ; then
1496 LIBS="$LIBS -liberty";
1497fi
1498
Damien Millera22ba012000-03-02 23:09:20 +11001499# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001500AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001501AC_CHECK_SIZEOF(short int, 2)
1502AC_CHECK_SIZEOF(int, 4)
1503AC_CHECK_SIZEOF(long int, 4)
1504AC_CHECK_SIZEOF(long long int, 8)
1505
Damien Millerfa2bb692002-04-23 23:22:25 +10001506# Sanity check long long for some platforms (AIX)
1507if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1508 ac_cv_sizeof_long_long_int=0
1509fi
1510
Damien Millera22ba012000-03-02 23:09:20 +11001511# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001512AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1513 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001514 [ #include <sys/types.h> ],
1515 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001516 [ ac_cv_have_u_int="yes" ],
1517 [ ac_cv_have_u_int="no" ]
1518 )
1519])
1520if test "x$ac_cv_have_u_int" = "xyes" ; then
1521 AC_DEFINE(HAVE_U_INT)
1522 have_u_int=1
1523fi
1524
Damien Miller61e50f12000-05-08 20:49:37 +10001525AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1526 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001527 [ #include <sys/types.h> ],
1528 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001529 [ ac_cv_have_intxx_t="yes" ],
1530 [ ac_cv_have_intxx_t="no" ]
1531 )
1532])
1533if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1534 AC_DEFINE(HAVE_INTXX_T)
1535 have_intxx_t=1
1536fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001537
1538if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001539 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001540then
1541 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1542 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001543 [ #include <stdint.h> ],
1544 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001545 [
1546 AC_DEFINE(HAVE_INTXX_T)
1547 AC_MSG_RESULT(yes)
1548 ],
1549 [ AC_MSG_RESULT(no) ]
1550 )
1551fi
1552
Damien Miller578783e2000-09-23 14:12:24 +11001553AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1554 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001555 [
1556#include <sys/types.h>
1557#ifdef HAVE_STDINT_H
1558# include <stdint.h>
1559#endif
1560#include <sys/socket.h>
1561#ifdef HAVE_SYS_BITYPES_H
1562# include <sys/bitypes.h>
1563#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001564 ],
1565 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001566 [ ac_cv_have_int64_t="yes" ],
1567 [ ac_cv_have_int64_t="no" ]
1568 )
1569])
1570if test "x$ac_cv_have_int64_t" = "xyes" ; then
1571 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001572fi
1573
Damien Miller61e50f12000-05-08 20:49:37 +10001574AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1575 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001576 [ #include <sys/types.h> ],
1577 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001578 [ ac_cv_have_u_intxx_t="yes" ],
1579 [ ac_cv_have_u_intxx_t="no" ]
1580 )
1581])
1582if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1583 AC_DEFINE(HAVE_U_INTXX_T)
1584 have_u_intxx_t=1
1585fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001586
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001587if test -z "$have_u_intxx_t" ; then
1588 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1589 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001590 [ #include <sys/socket.h> ],
1591 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001592 [
1593 AC_DEFINE(HAVE_U_INTXX_T)
1594 AC_MSG_RESULT(yes)
1595 ],
1596 [ AC_MSG_RESULT(no) ]
1597 )
1598fi
1599
Damien Miller578783e2000-09-23 14:12:24 +11001600AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1601 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001602 [ #include <sys/types.h> ],
1603 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001604 [ ac_cv_have_u_int64_t="yes" ],
1605 [ ac_cv_have_u_int64_t="no" ]
1606 )
1607])
1608if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1609 AC_DEFINE(HAVE_U_INT64_T)
1610 have_u_int64_t=1
1611fi
1612
Tim Rice4cec93f2002-02-26 08:40:48 -08001613if test -z "$have_u_int64_t" ; then
1614 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1615 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001616 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001617 [ u_int64_t a; a = 1],
1618 [
1619 AC_DEFINE(HAVE_U_INT64_T)
1620 AC_MSG_RESULT(yes)
1621 ],
1622 [ AC_MSG_RESULT(no) ]
1623 )
1624fi
1625
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001626if test -z "$have_u_intxx_t" ; then
1627 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1628 AC_TRY_COMPILE(
1629 [
1630#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001631 ],
1632 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001633 [ ac_cv_have_uintxx_t="yes" ],
1634 [ ac_cv_have_uintxx_t="no" ]
1635 )
1636 ])
1637 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1638 AC_DEFINE(HAVE_UINTXX_T)
1639 fi
1640fi
1641
1642if test -z "$have_uintxx_t" ; then
1643 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1644 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001645 [ #include <stdint.h> ],
1646 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001647 [
1648 AC_DEFINE(HAVE_UINTXX_T)
1649 AC_MSG_RESULT(yes)
1650 ],
1651 [ AC_MSG_RESULT(no) ]
1652 )
1653fi
1654
Damien Milleredb82922000-06-20 13:25:52 +10001655if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001656 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001657then
1658 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1659 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001660 [
1661#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001662 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001663 [
Damien Miller70494d12000-04-03 15:57:06 +10001664 int8_t a; int16_t b; int32_t c;
1665 u_int8_t e; u_int16_t f; u_int32_t g;
1666 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001667 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001668 [
1669 AC_DEFINE(HAVE_U_INTXX_T)
1670 AC_DEFINE(HAVE_INTXX_T)
1671 AC_MSG_RESULT(yes)
1672 ],
1673 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001674 )
Damien Millerb29ea912000-01-15 14:12:03 +11001675fi
1676
Damien Miller58be7382001-09-15 21:31:54 +10001677
1678AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1679 AC_TRY_COMPILE(
1680 [
1681#include <sys/types.h>
1682 ],
1683 [ u_char foo; foo = 125; ],
1684 [ ac_cv_have_u_char="yes" ],
1685 [ ac_cv_have_u_char="no" ]
1686 )
1687])
1688if test "x$ac_cv_have_u_char" = "xyes" ; then
1689 AC_DEFINE(HAVE_U_CHAR)
1690fi
1691
Tim Rice13aae5e2001-10-21 17:53:58 -07001692TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001693
Tim Rice200a5c02002-02-26 22:12:34 -08001694AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001695
Damien Miller61e50f12000-05-08 20:49:37 +10001696AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1697 AC_TRY_COMPILE(
1698 [
1699#include <sys/types.h>
1700 ],
1701 [ size_t foo; foo = 1235; ],
1702 [ ac_cv_have_size_t="yes" ],
1703 [ ac_cv_have_size_t="no" ]
1704 )
1705])
1706if test "x$ac_cv_have_size_t" = "xyes" ; then
1707 AC_DEFINE(HAVE_SIZE_T)
1708fi
Damien Miller95058511999-12-29 10:36:45 +11001709
Damien Miller615f9392000-05-17 22:53:33 +10001710AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1711 AC_TRY_COMPILE(
1712 [
1713#include <sys/types.h>
1714 ],
1715 [ ssize_t foo; foo = 1235; ],
1716 [ ac_cv_have_ssize_t="yes" ],
1717 [ ac_cv_have_ssize_t="no" ]
1718 )
1719])
1720if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1721 AC_DEFINE(HAVE_SSIZE_T)
1722fi
1723
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001724AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1725 AC_TRY_COMPILE(
1726 [
1727#include <time.h>
1728 ],
1729 [ clock_t foo; foo = 1235; ],
1730 [ ac_cv_have_clock_t="yes" ],
1731 [ ac_cv_have_clock_t="no" ]
1732 )
1733])
1734if test "x$ac_cv_have_clock_t" = "xyes" ; then
1735 AC_DEFINE(HAVE_CLOCK_T)
1736fi
1737
Damien Millerb54b40e2000-06-23 08:23:34 +10001738AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1739 AC_TRY_COMPILE(
1740 [
1741#include <sys/types.h>
1742#include <sys/socket.h>
1743 ],
1744 [ sa_family_t foo; foo = 1235; ],
1745 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001746 [ AC_TRY_COMPILE(
1747 [
1748#include <sys/types.h>
1749#include <sys/socket.h>
1750#include <netinet/in.h>
1751 ],
1752 [ sa_family_t foo; foo = 1235; ],
1753 [ ac_cv_have_sa_family_t="yes" ],
1754
Damien Millerb54b40e2000-06-23 08:23:34 +10001755 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001756 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001757 )
1758])
1759if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1760 AC_DEFINE(HAVE_SA_FAMILY_T)
1761fi
1762
Damien Miller0f91b4e2000-06-18 15:43:25 +10001763AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1764 AC_TRY_COMPILE(
1765 [
1766#include <sys/types.h>
1767 ],
1768 [ pid_t foo; foo = 1235; ],
1769 [ ac_cv_have_pid_t="yes" ],
1770 [ ac_cv_have_pid_t="no" ]
1771 )
1772])
1773if test "x$ac_cv_have_pid_t" = "xyes" ; then
1774 AC_DEFINE(HAVE_PID_T)
1775fi
1776
1777AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1778 AC_TRY_COMPILE(
1779 [
1780#include <sys/types.h>
1781 ],
1782 [ mode_t foo; foo = 1235; ],
1783 [ ac_cv_have_mode_t="yes" ],
1784 [ ac_cv_have_mode_t="no" ]
1785 )
1786])
1787if test "x$ac_cv_have_mode_t" = "xyes" ; then
1788 AC_DEFINE(HAVE_MODE_T)
1789fi
1790
Damien Miller61e50f12000-05-08 20:49:37 +10001791
1792AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1793 AC_TRY_COMPILE(
1794 [
Damien Miller81171112000-04-23 11:14:01 +10001795#include <sys/types.h>
1796#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001797 ],
1798 [ struct sockaddr_storage s; ],
1799 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1800 [ ac_cv_have_struct_sockaddr_storage="no" ]
1801 )
1802])
1803if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1804 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1805fi
Damien Miller34132e52000-01-14 15:45:46 +11001806
Damien Miller61e50f12000-05-08 20:49:37 +10001807AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1808 AC_TRY_COMPILE(
1809 [
Damien Miller7b22d652000-06-18 14:07:04 +10001810#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001811#include <netinet/in.h>
1812 ],
1813 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1814 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1815 [ ac_cv_have_struct_sockaddr_in6="no" ]
1816 )
1817])
1818if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1819 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1820fi
Damien Miller34132e52000-01-14 15:45:46 +11001821
Damien Miller61e50f12000-05-08 20:49:37 +10001822AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1823 AC_TRY_COMPILE(
1824 [
Damien Miller7b22d652000-06-18 14:07:04 +10001825#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001826#include <netinet/in.h>
1827 ],
1828 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1829 [ ac_cv_have_struct_in6_addr="yes" ],
1830 [ ac_cv_have_struct_in6_addr="no" ]
1831 )
1832])
1833if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1834 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1835fi
Damien Miller34132e52000-01-14 15:45:46 +11001836
Damien Miller61e50f12000-05-08 20:49:37 +10001837AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1838 AC_TRY_COMPILE(
1839 [
Damien Miller81171112000-04-23 11:14:01 +10001840#include <sys/types.h>
1841#include <sys/socket.h>
1842#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001843 ],
1844 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1845 [ ac_cv_have_struct_addrinfo="yes" ],
1846 [ ac_cv_have_struct_addrinfo="no" ]
1847 )
1848])
1849if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1850 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1851fi
1852
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001853AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1854 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001855 [ #include <sys/time.h> ],
1856 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001857 [ ac_cv_have_struct_timeval="yes" ],
1858 [ ac_cv_have_struct_timeval="no" ]
1859 )
1860])
1861if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1862 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1863 have_struct_timeval=1
1864fi
1865
Tim Rice4e4dc562003-03-18 10:21:40 -08001866AC_CHECK_TYPES(struct timespec)
1867
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001868# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001869if test "x$ac_cv_have_int64_t" = "xno" -a \
1870 "x$ac_cv_sizeof_long_int" != "x8" -a \
1871 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001872 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1873 echo "an alternative compiler (I.E., GCC) before continuing."
1874 echo ""
1875 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001876else
1877dnl test snprintf (broken on SCO w/gcc)
1878 AC_TRY_RUN(
1879 [
1880#include <stdio.h>
1881#include <string.h>
1882#ifdef HAVE_SNPRINTF
1883main()
1884{
1885 char buf[50];
1886 char expected_out[50];
1887 int mazsize = 50 ;
1888#if (SIZEOF_LONG_INT == 8)
1889 long int num = 0x7fffffffffffffff;
1890#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001891 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001892#endif
1893 strcpy(expected_out, "9223372036854775807");
1894 snprintf(buf, mazsize, "%lld", num);
1895 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001896 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001897 exit(0);
1898}
1899#else
1900main() { exit(0); }
1901#endif
1902 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1903 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001904fi
1905
Damien Miller78315eb2000-09-29 23:01:36 +11001906dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001907OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1908OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1909OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1910OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1911OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001912OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001913OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1914OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001915OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001916OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1917OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1918OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1919OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001920OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1921OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1922OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1923OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001924
1925AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001926
Damien Miller61e50f12000-05-08 20:49:37 +10001927AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1928 ac_cv_have_ss_family_in_struct_ss, [
1929 AC_TRY_COMPILE(
1930 [
Damien Miller81171112000-04-23 11:14:01 +10001931#include <sys/types.h>
1932#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001933 ],
1934 [ struct sockaddr_storage s; s.ss_family = 1; ],
1935 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1936 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1937 )
1938])
1939if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1940 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1941fi
1942
Damien Miller61e50f12000-05-08 20:49:37 +10001943AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1944 ac_cv_have___ss_family_in_struct_ss, [
1945 AC_TRY_COMPILE(
1946 [
Damien Miller81171112000-04-23 11:14:01 +10001947#include <sys/types.h>
1948#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001949 ],
1950 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1951 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1952 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1953 )
1954])
1955if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1956 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1957fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001958
Damien Millerad833b32000-08-23 10:46:23 +10001959AC_CACHE_CHECK([for pw_class field in struct passwd],
1960 ac_cv_have_pw_class_in_struct_passwd, [
1961 AC_TRY_COMPILE(
1962 [
Damien Millerad833b32000-08-23 10:46:23 +10001963#include <pwd.h>
1964 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001965 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001966 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1967 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1968 )
1969])
1970if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1971 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1972fi
1973
Kevin Steves82456952001-06-22 21:14:18 +00001974AC_CACHE_CHECK([for pw_expire field in struct passwd],
1975 ac_cv_have_pw_expire_in_struct_passwd, [
1976 AC_TRY_COMPILE(
1977 [
1978#include <pwd.h>
1979 ],
1980 [ struct passwd p; p.pw_expire = 0; ],
1981 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1982 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1983 )
1984])
1985if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1986 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1987fi
1988
1989AC_CACHE_CHECK([for pw_change field in struct passwd],
1990 ac_cv_have_pw_change_in_struct_passwd, [
1991 AC_TRY_COMPILE(
1992 [
1993#include <pwd.h>
1994 ],
1995 [ struct passwd p; p.pw_change = 0; ],
1996 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1997 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1998 )
1999])
2000if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2001 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2002fi
Damien Miller61e50f12000-05-08 20:49:37 +10002003
Tim Rice28bbb0c2002-05-27 17:37:32 -07002004dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002005AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2006 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002007 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002008 [
Tim Riceae49fe62002-04-12 10:26:21 -07002009#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002010#include <sys/socket.h>
2011#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002012int main() {
2013#ifdef msg_accrights
2014exit(1);
2015#endif
2016struct msghdr m;
2017m.msg_accrights = 0;
2018exit(0);
2019}
Kevin Steves939c9db2002-03-22 17:23:25 +00002020 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002021 [ ac_cv_have_accrights_in_msghdr="yes" ],
2022 [ ac_cv_have_accrights_in_msghdr="no" ]
2023 )
2024])
2025if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2026 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2027fi
2028
Kevin Stevesa44e0352002-04-07 16:18:03 +00002029AC_CACHE_CHECK([for msg_control field in struct msghdr],
2030 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002031 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002032 [
Tim Riceae49fe62002-04-12 10:26:21 -07002033#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002034#include <sys/socket.h>
2035#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002036int main() {
2037#ifdef msg_control
2038exit(1);
2039#endif
2040struct msghdr m;
2041m.msg_control = 0;
2042exit(0);
2043}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002044 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002045 [ ac_cv_have_control_in_msghdr="yes" ],
2046 [ ac_cv_have_control_in_msghdr="no" ]
2047 )
2048])
2049if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2050 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2051fi
2052
Damien Miller61e50f12000-05-08 20:49:37 +10002053AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002054 AC_TRY_LINK([],
2055 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002056 [ ac_cv_libc_defines___progname="yes" ],
2057 [ ac_cv_libc_defines___progname="no" ]
2058 )
2059])
2060if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2061 AC_DEFINE(HAVE___PROGNAME)
2062fi
2063
Kevin Steves4846f4a2002-03-22 18:19:53 +00002064AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2065 AC_TRY_LINK([
2066#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002067],
2068 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002069 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2070 [ ac_cv_cc_implements___FUNCTION__="no" ]
2071 )
2072])
2073if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2074 AC_DEFINE(HAVE___FUNCTION__)
2075fi
2076
2077AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2078 AC_TRY_LINK([
2079#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002080],
2081 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002082 [ ac_cv_cc_implements___func__="yes" ],
2083 [ ac_cv_cc_implements___func__="no" ]
2084 )
2085])
2086if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2087 AC_DEFINE(HAVE___func__)
2088fi
2089
Damien Miller4f8e6692001-07-14 13:22:53 +10002090AC_CACHE_CHECK([whether getopt has optreset support],
2091 ac_cv_have_getopt_optreset, [
2092 AC_TRY_LINK(
2093 [
2094#include <getopt.h>
2095 ],
2096 [ extern int optreset; optreset = 0; ],
2097 [ ac_cv_have_getopt_optreset="yes" ],
2098 [ ac_cv_have_getopt_optreset="no" ]
2099 )
2100])
2101if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2102 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2103fi
Damien Millera22ba012000-03-02 23:09:20 +11002104
Damien Millerecbb26d2000-07-15 14:59:14 +10002105AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002106 AC_TRY_LINK([],
2107 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002108 [ ac_cv_libc_defines_sys_errlist="yes" ],
2109 [ ac_cv_libc_defines_sys_errlist="no" ]
2110 )
2111])
2112if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2113 AC_DEFINE(HAVE_SYS_ERRLIST)
2114fi
2115
2116
Damien Miller11fa2cc2000-08-16 10:35:58 +10002117AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002118 AC_TRY_LINK([],
2119 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002120 [ ac_cv_libc_defines_sys_nerr="yes" ],
2121 [ ac_cv_libc_defines_sys_nerr="no" ]
2122 )
2123])
2124if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2125 AC_DEFINE(HAVE_SYS_NERR)
2126fi
2127
Damien Millera8e06ce2003-11-21 23:48:55 +11002128SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002129# Check whether user wants sectok support
2130AC_ARG_WITH(sectok,
2131 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002132 [
2133 if test "x$withval" != "xno" ; then
2134 if test "x$withval" != "xyes" ; then
2135 CPPFLAGS="$CPPFLAGS -I${withval}"
2136 LDFLAGS="$LDFLAGS -L${withval}"
2137 if test ! -z "$need_dash_r" ; then
2138 LDFLAGS="$LDFLAGS -R${withval}"
2139 fi
2140 if test ! -z "$blibpath" ; then
2141 blibpath="$blibpath:${withval}"
2142 fi
2143 fi
2144 AC_CHECK_HEADERS(sectok.h)
2145 if test "$ac_cv_header_sectok_h" != yes; then
2146 AC_MSG_ERROR(Can't find sectok.h)
2147 fi
2148 AC_CHECK_LIB(sectok, sectok_open)
2149 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2150 AC_MSG_ERROR(Can't find libsectok)
2151 fi
2152 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002153 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002154 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002155 fi
2156 ]
2157)
2158
2159# Check whether user wants OpenSC support
2160AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002161 AC_HELP_STRING([--with-opensc=PFX],
2162 [Enable smartcard support using OpenSC]),
2163 opensc_config_prefix="$withval", opensc_config_prefix="")
2164if test x$opensc_config_prefix != x ; then
2165 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2166 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2167 if test "$OPENSC_CONFIG" != "no"; then
2168 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2169 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2170 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2171 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2172 AC_DEFINE(SMARTCARD)
2173 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002174 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002175 fi
2176fi
Damien Miller85de5802001-09-18 14:01:11 +10002177
Darren Tucker5f88d342003-10-15 16:57:57 +10002178# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002179AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002180 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002181 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002182 # Needed by our getrrsetbyname()
2183 AC_SEARCH_LIBS(res_query, resolv)
2184 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002185 AC_MSG_CHECKING(if res_query will link)
2186 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2187 [AC_MSG_RESULT(no)
2188 saved_LIBS="$LIBS"
2189 LIBS="$LIBS -lresolv"
2190 AC_MSG_CHECKING(for res_query in -lresolv)
2191 AC_LINK_IFELSE([
2192#include <resolv.h>
2193int main()
2194{
2195 res_query (0, 0, 0, 0, 0);
2196 return 0;
2197}
2198 ],
2199 [LIBS="$LIBS -lresolv"
2200 AC_MSG_RESULT(yes)],
2201 [LIBS="$saved_LIBS"
2202 AC_MSG_RESULT(no)])
2203 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002204 AC_CHECK_FUNCS(_getshort _getlong)
2205 AC_CHECK_MEMBER(HEADER.ad,
2206 [AC_DEFINE(HAVE_HEADER_AD)],,
2207 [#include <arpa/nameser.h>])
2208 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002209
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002210# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002211KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002212AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002213 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002214 [ if test "x$withval" != "xno" ; then
2215 if test "x$withval" = "xyes" ; then
2216 KRB5ROOT="/usr/local"
2217 else
2218 KRB5ROOT=${withval}
2219 fi
2220
2221 AC_DEFINE(KRB5)
2222 KRB5_MSG="yes"
2223
2224 AC_MSG_CHECKING(for krb5-config)
2225 if test -x $KRB5ROOT/bin/krb5-config ; then
2226 KRB5CONF=$KRB5ROOT/bin/krb5-config
2227 AC_MSG_RESULT($KRB5CONF)
2228
2229 AC_MSG_CHECKING(for gssapi support)
2230 if $KRB5CONF | grep gssapi >/dev/null ; then
2231 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002232 AC_DEFINE(GSSAPI)
2233 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002234 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002235 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002236 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002237 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002238 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2239 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002240 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002241 AC_MSG_CHECKING(whether we are using Heimdal)
2242 AC_TRY_COMPILE([ #include <krb5.h> ],
2243 [ char *tmp = heimdal_version; ],
2244 [ AC_MSG_RESULT(yes)
2245 AC_DEFINE(HEIMDAL) ],
2246 AC_MSG_RESULT(no)
2247 )
2248 else
2249 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002250 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002251 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002252 AC_MSG_CHECKING(whether we are using Heimdal)
2253 AC_TRY_COMPILE([ #include <krb5.h> ],
2254 [ char *tmp = heimdal_version; ],
2255 [ AC_MSG_RESULT(yes)
2256 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002257 K5LIBS="-lkrb5 -ldes"
2258 K5LIBS="$K5LIBS -lcom_err -lasn1"
2259 AC_CHECK_LIB(roken, net_write,
2260 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002261 ],
2262 [ AC_MSG_RESULT(no)
2263 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2264 ]
2265 )
Damien Miller200d0a72003-06-30 19:21:36 +10002266 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002267
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002268 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2269 [ AC_DEFINE(GSSAPI)
2270 K5LIBS="-lgssapi $K5LIBS" ],
2271 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2272 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002273 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002274 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2275 $K5LIBS)
2276 ],
2277 $K5LIBS)
2278
2279 AC_CHECK_HEADER(gssapi.h, ,
2280 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002281 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002282 AC_CHECK_HEADERS(gssapi.h, ,
2283 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002284 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002285 ]
2286 )
2287
2288 oldCPP="$CPPFLAGS"
2289 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2290 AC_CHECK_HEADER(gssapi_krb5.h, ,
2291 [ CPPFLAGS="$oldCPP" ])
2292
Damien Millera8e06ce2003-11-21 23:48:55 +11002293 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002294 if test ! -z "$need_dash_r" ; then
2295 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2296 fi
2297 if test ! -z "$blibpath" ; then
2298 blibpath="$blibpath:${KRB5ROOT}/lib"
2299 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002300 fi
2301
2302 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2303 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2304 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2305
2306 LIBS="$LIBS $K5LIBS"
2307 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002308 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002309 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002310)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002311
Damien Millera22ba012000-03-02 23:09:20 +11002312# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002313
Damien Millerf58c6722002-05-13 13:15:42 +10002314PRIVSEP_PATH=/var/empty
2315AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002316 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002317 [
2318 if test "x$withval" != "$no" ; then
2319 PRIVSEP_PATH=$withval
2320 fi
2321 ]
2322)
2323AC_SUBST(PRIVSEP_PATH)
2324
Damien Millera22ba012000-03-02 23:09:20 +11002325AC_ARG_WITH(xauth,
2326 [ --with-xauth=PATH Specify path to xauth program ],
2327 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002328 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002329 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002330 fi
2331 ],
2332 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002333 TestPath="$PATH"
2334 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2335 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2336 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2337 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2338 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002339 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002340 xauth_path="/usr/openwin/bin/xauth"
2341 fi
2342 ]
2343)
2344
Damien Miller7d901272003-01-13 16:55:22 +11002345STRIP_OPT=-s
2346AC_ARG_ENABLE(strip,
2347 [ --disable-strip Disable calling strip(1) on install],
2348 [
2349 if test "x$enableval" = "xno" ; then
2350 STRIP_OPT=
2351 fi
2352 ]
2353)
2354AC_SUBST(STRIP_OPT)
2355
Damien Millera19cf472000-11-29 13:28:50 +11002356if test -z "$xauth_path" ; then
2357 XAUTH_PATH="undefined"
2358 AC_SUBST(XAUTH_PATH)
2359else
Damien Millera22ba012000-03-02 23:09:20 +11002360 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002361 XAUTH_PATH=$xauth_path
2362 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002363fi
Damien Millera22ba012000-03-02 23:09:20 +11002364
2365# Check for mail directory (last resort if we cannot get it from headers)
2366if test ! -z "$MAIL" ; then
2367 maildir=`dirname $MAIL`
2368 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2369fi
2370
Damien Millera22ba012000-03-02 23:09:20 +11002371if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002372 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002373 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002374 [
2375 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2376 have_dev_ptmx=1
2377 ]
2378 )
2379 fi
Damien Millera22ba012000-03-02 23:09:20 +11002380fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002381AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002382 [
2383 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2384 have_dev_ptc=1
2385 ]
2386)
2387
Damien Millera22ba012000-03-02 23:09:20 +11002388# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002389AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002390 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002391 [
Damien Miller897741e2001-04-16 10:41:46 +10002392 case "$withval" in
2393 man|cat|doc)
2394 MANTYPE=$withval
2395 ;;
2396 *)
2397 AC_MSG_ERROR(invalid man type: $withval)
2398 ;;
2399 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002400 ]
2401)
Ben Lindstrombc709922001-04-18 18:04:21 +00002402if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002403 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2404 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002405 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2406 MANTYPE=doc
2407 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2408 MANTYPE=man
2409 else
2410 MANTYPE=cat
2411 fi
2412fi
Damien Miller670a4b82000-01-22 13:53:11 +11002413AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002414if test "$MANTYPE" = "doc"; then
2415 mansubdir=man;
2416else
2417 mansubdir=$MANTYPE;
2418fi
2419AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002420
Damien Millera22ba012000-03-02 23:09:20 +11002421# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002422MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002423AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002424 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002425 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002426 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002427 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002428 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002429 fi
2430 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002431)
2432
Damien Millera22ba012000-03-02 23:09:20 +11002433# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002434AC_ARG_WITH(shadow,
2435 [ --without-shadow Disable shadow password support],
2436 [
2437 if test "x$withval" = "xno" ; then
2438 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002439 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002440 fi
2441 ]
2442)
2443
Damien Miller1f335fb2000-06-26 11:31:33 +10002444if test -z "$disable_shadow" ; then
2445 AC_MSG_CHECKING([if the systems has expire shadow information])
2446 AC_TRY_COMPILE(
2447 [
2448#include <sys/types.h>
2449#include <shadow.h>
2450 struct spwd sp;
2451 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2452 [ sp_expire_available=yes ], []
2453 )
2454
2455 if test "x$sp_expire_available" = "xyes" ; then
2456 AC_MSG_RESULT(yes)
2457 AC_DEFINE(HAS_SHADOW_EXPIRE)
2458 else
2459 AC_MSG_RESULT(no)
2460 fi
2461fi
2462
Damien Millera22ba012000-03-02 23:09:20 +11002463# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002464if test ! -z "$IPADDR_IN_DISPLAY" ; then
2465 DISPLAY_HACK_MSG="yes"
2466 AC_DEFINE(IPADDR_IN_DISPLAY)
2467else
Damien Millera8e06ce2003-11-21 23:48:55 +11002468 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002469 AC_ARG_WITH(ipaddr-display,
2470 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2471 [
2472 if test "x$withval" != "xno" ; then
2473 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002474 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002475 fi
2476 ]
2477 )
2478fi
Damien Miller76112de1999-12-21 11:18:08 +11002479
Darren Tuckere1a790d2003-09-16 11:52:19 +10002480# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002481AC_ARG_ENABLE(etc-default-login,
2482 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2483[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002484AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2485
2486if test "x$external_path_file" = "x/etc/default/login"; then
2487 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2488fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002489])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002490
Tim Rice43a1c132002-04-17 21:19:14 -07002491dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2492if test $ac_cv_func_login_getcapbool = "yes" -a \
2493 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002494 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002495fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002496
Damien Millera22ba012000-03-02 23:09:20 +11002497# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002498SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002499AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002500 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002501 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002502 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002503 AC_MSG_WARN([
2504--with-default-path=PATH has no effect on this system.
2505Edit /etc/login.conf instead.])
2506 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002507 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002508 AC_MSG_WARN([
2509--with-default-path=PATH will only be used if PATH is not defined in
2510$external_path_file .])
2511 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002512 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002513 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002514 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002515 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002516 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2517 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002518 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002519 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002520 AC_MSG_WARN([
2521If PATH is defined in $external_path_file, ensure the path to scp is included,
2522otherwise scp will not work.])
2523 fi
2524 AC_TRY_RUN(
2525 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002526/* find out what STDPATH is */
2527#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002528#ifdef HAVE_PATHS_H
2529# include <paths.h>
2530#endif
2531#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002532# ifdef _PATH_USERPATH /* Irix */
2533# define _PATH_STDPATH _PATH_USERPATH
2534# else
2535# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2536# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002537#endif
2538#include <sys/types.h>
2539#include <sys/stat.h>
2540#include <fcntl.h>
2541#define DATA "conftest.stdpath"
2542
2543main()
2544{
2545 FILE *fd;
2546 int rc;
2547
2548 fd = fopen(DATA,"w");
2549 if(fd == NULL)
2550 exit(1);
2551
2552 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2553 exit(1);
2554
2555 exit(0);
2556}
2557 ], [ user_path=`cat conftest.stdpath` ],
2558 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2559 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2560 )
2561# make sure $bindir is in USER_PATH so scp will work
2562 t_bindir=`eval echo ${bindir}`
2563 case $t_bindir in
2564 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2565 esac
2566 case $t_bindir in
2567 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2568 esac
2569 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2570 if test $? -ne 0 ; then
2571 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2572 if test $? -ne 0 ; then
2573 user_path=$user_path:$t_bindir
2574 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2575 fi
2576 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002577 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002578)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002579if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002580 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2581 AC_SUBST(user_path)
2582fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002583
Damien Millera18bbd32002-05-13 10:48:57 +10002584# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002585AC_ARG_WITH(superuser-path,
2586 [ --with-superuser-path= Specify different path for super-user],
2587 [
2588 if test "x$withval" != "xno" ; then
2589 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2590 superuser_path=$withval
2591 fi
2592 ]
2593)
2594
2595
Damien Miller61e50f12000-05-08 20:49:37 +10002596AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002597IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002598AC_ARG_WITH(4in6,
2599 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2600 [
2601 if test "x$withval" != "xno" ; then
2602 AC_MSG_RESULT(yes)
2603 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002604 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002605 else
2606 AC_MSG_RESULT(no)
2607 fi
2608 ],[
2609 if test "x$inet6_default_4in6" = "xyes"; then
2610 AC_MSG_RESULT([yes (default)])
2611 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002612 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002613 else
2614 AC_MSG_RESULT([no (default)])
2615 fi
2616 ]
2617)
2618
Damien Miller60396b02001-02-18 17:01:00 +11002619# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002620BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002621AC_ARG_WITH(bsd-auth,
2622 [ --with-bsd-auth Enable BSD auth support],
2623 [
2624 if test "x$withval" != "xno" ; then
2625 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002626 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002627 fi
2628 ]
2629)
2630
Damien Millera22ba012000-03-02 23:09:20 +11002631# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002632piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002633# make sure the directory exists
2634if test ! -d $piddir ; then
2635 piddir=`eval echo ${sysconfdir}`
2636 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002637 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002638 esac
2639fi
2640
Tim Rice88f2ab52002-03-17 12:17:34 -08002641AC_ARG_WITH(pid-dir,
2642 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2643 [
2644 if test "x$withval" != "xno" ; then
2645 piddir=$withval
2646 if test ! -d $piddir ; then
2647 AC_MSG_WARN([** no $piddir directory on this system **])
2648 fi
2649 fi
2650 ]
2651)
2652
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002653AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002654AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002655
andre2ff7b5d2000-06-03 14:57:40 +00002656dnl allow user to disable some login recording features
2657AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002658 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002659 [
2660 if test "x$enableval" = "xno" ; then
2661 AC_DEFINE(DISABLE_LASTLOG)
2662 fi
2663 ]
andre2ff7b5d2000-06-03 14:57:40 +00002664)
2665AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002666 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002667 [
2668 if test "x$enableval" = "xno" ; then
2669 AC_DEFINE(DISABLE_UTMP)
2670 fi
2671 ]
andre2ff7b5d2000-06-03 14:57:40 +00002672)
2673AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002674 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002675 [
2676 if test "x$enableval" = "xno" ; then
2677 AC_DEFINE(DISABLE_UTMPX)
2678 fi
2679 ]
andre2ff7b5d2000-06-03 14:57:40 +00002680)
2681AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002682 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002683 [
2684 if test "x$enableval" = "xno" ; then
2685 AC_DEFINE(DISABLE_WTMP)
2686 fi
2687 ]
andre2ff7b5d2000-06-03 14:57:40 +00002688)
2689AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002690 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002691 [
2692 if test "x$enableval" = "xno" ; then
2693 AC_DEFINE(DISABLE_WTMPX)
2694 fi
2695 ]
andre2ff7b5d2000-06-03 14:57:40 +00002696)
2697AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002698 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002699 [
2700 if test "x$enableval" = "xno" ; then
2701 AC_DEFINE(DISABLE_LOGIN)
2702 fi
2703 ]
andre2ff7b5d2000-06-03 14:57:40 +00002704)
2705AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002706 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002707 [
2708 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002709 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002710 fi
2711 ]
andre2ff7b5d2000-06-03 14:57:40 +00002712)
2713AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002714 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002715 [
2716 if test "x$enableval" = "xno" ; then
2717 AC_DEFINE(DISABLE_PUTUTXLINE)
2718 fi
2719 ]
andre2ff7b5d2000-06-03 14:57:40 +00002720)
2721AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002722 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002723 [
2724 if test "x$withval" = "xno" ; then
2725 AC_DEFINE(DISABLE_LASTLOG)
2726 else
2727 conf_lastlog_location=$withval
2728 fi
2729 ]
2730)
andre2ff7b5d2000-06-03 14:57:40 +00002731
2732dnl lastlog, [uw]tmpx? detection
2733dnl NOTE: set the paths in the platform section to avoid the
2734dnl need for command-line parameters
2735dnl lastlog and [uw]tmp are subject to a file search if all else fails
2736
2737dnl lastlog detection
2738dnl NOTE: the code itself will detect if lastlog is a directory
2739AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2740AC_TRY_COMPILE([
2741#include <sys/types.h>
2742#include <utmp.h>
2743#ifdef HAVE_LASTLOG_H
2744# include <lastlog.h>
2745#endif
Damien Miller2994e082000-06-04 15:51:47 +10002746#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002747# include <paths.h>
2748#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002749#ifdef HAVE_LOGIN_H
2750# include <login.h>
2751#endif
andre2ff7b5d2000-06-03 14:57:40 +00002752 ],
2753 [ char *lastlog = LASTLOG_FILE; ],
2754 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002755 [
2756 AC_MSG_RESULT(no)
2757 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2758 AC_TRY_COMPILE([
2759#include <sys/types.h>
2760#include <utmp.h>
2761#ifdef HAVE_LASTLOG_H
2762# include <lastlog.h>
2763#endif
2764#ifdef HAVE_PATHS_H
2765# include <paths.h>
2766#endif
2767 ],
2768 [ char *lastlog = _PATH_LASTLOG; ],
2769 [ AC_MSG_RESULT(yes) ],
2770 [
andree441aa32000-06-12 22:34:38 +00002771 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002772 system_lastlog_path=no
2773 ])
2774 ]
andre2ff7b5d2000-06-03 14:57:40 +00002775)
Damien Miller2994e082000-06-04 15:51:47 +10002776
andre2ff7b5d2000-06-03 14:57:40 +00002777if test -z "$conf_lastlog_location"; then
2778 if test x"$system_lastlog_path" = x"no" ; then
2779 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002780 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002781 conf_lastlog_location=$f
2782 fi
2783 done
2784 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002785 AC_MSG_WARN([** Cannot find lastlog **])
2786 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002787 fi
2788 fi
2789fi
2790
2791if test -n "$conf_lastlog_location"; then
2792 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2793fi
2794
2795dnl utmp detection
2796AC_MSG_CHECKING([if your system defines UTMP_FILE])
2797AC_TRY_COMPILE([
2798#include <sys/types.h>
2799#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002800#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002801# include <paths.h>
2802#endif
2803 ],
2804 [ char *utmp = UTMP_FILE; ],
2805 [ AC_MSG_RESULT(yes) ],
2806 [ AC_MSG_RESULT(no)
2807 system_utmp_path=no ]
2808)
2809if test -z "$conf_utmp_location"; then
2810 if test x"$system_utmp_path" = x"no" ; then
2811 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2812 if test -f $f ; then
2813 conf_utmp_location=$f
2814 fi
2815 done
2816 if test -z "$conf_utmp_location"; then
2817 AC_DEFINE(DISABLE_UTMP)
2818 fi
2819 fi
2820fi
2821if test -n "$conf_utmp_location"; then
2822 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2823fi
2824
2825dnl wtmp detection
2826AC_MSG_CHECKING([if your system defines WTMP_FILE])
2827AC_TRY_COMPILE([
2828#include <sys/types.h>
2829#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002830#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002831# include <paths.h>
2832#endif
2833 ],
2834 [ char *wtmp = WTMP_FILE; ],
2835 [ AC_MSG_RESULT(yes) ],
2836 [ AC_MSG_RESULT(no)
2837 system_wtmp_path=no ]
2838)
2839if test -z "$conf_wtmp_location"; then
2840 if test x"$system_wtmp_path" = x"no" ; then
2841 for f in /usr/adm/wtmp /var/log/wtmp; do
2842 if test -f $f ; then
2843 conf_wtmp_location=$f
2844 fi
2845 done
2846 if test -z "$conf_wtmp_location"; then
2847 AC_DEFINE(DISABLE_WTMP)
2848 fi
2849 fi
2850fi
2851if test -n "$conf_wtmp_location"; then
2852 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2853fi
2854
2855
2856dnl utmpx detection - I don't know any system so perverse as to require
2857dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2858dnl there, though.
2859AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2860AC_TRY_COMPILE([
2861#include <sys/types.h>
2862#include <utmp.h>
2863#ifdef HAVE_UTMPX_H
2864#include <utmpx.h>
2865#endif
Damien Miller2994e082000-06-04 15:51:47 +10002866#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002867# include <paths.h>
2868#endif
2869 ],
2870 [ char *utmpx = UTMPX_FILE; ],
2871 [ AC_MSG_RESULT(yes) ],
2872 [ AC_MSG_RESULT(no)
2873 system_utmpx_path=no ]
2874)
2875if test -z "$conf_utmpx_location"; then
2876 if test x"$system_utmpx_path" = x"no" ; then
2877 AC_DEFINE(DISABLE_UTMPX)
2878 fi
2879else
2880 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2881fi
2882
2883dnl wtmpx detection
2884AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2885AC_TRY_COMPILE([
2886#include <sys/types.h>
2887#include <utmp.h>
2888#ifdef HAVE_UTMPX_H
2889#include <utmpx.h>
2890#endif
Damien Miller2994e082000-06-04 15:51:47 +10002891#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002892# include <paths.h>
2893#endif
2894 ],
2895 [ char *wtmpx = WTMPX_FILE; ],
2896 [ AC_MSG_RESULT(yes) ],
2897 [ AC_MSG_RESULT(no)
2898 system_wtmpx_path=no ]
2899)
2900if test -z "$conf_wtmpx_location"; then
2901 if test x"$system_wtmpx_path" = x"no" ; then
2902 AC_DEFINE(DISABLE_WTMPX)
2903 fi
2904else
2905 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2906fi
2907
Damien Miller4018c192000-04-30 09:30:44 +10002908
Damien Miller29ea30d2000-03-17 10:54:15 +11002909if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002910 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2911 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002912fi
2913
Tim Rice4cec93f2002-02-26 08:40:48 -08002914dnl remove pam and dl because they are in $LIBPAM
2915if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002916 LIBS=`echo $LIBS | sed 's/-lpam //'`
2917fi
2918if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2919 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002920fi
2921
Damien Millerbac2d8a2000-09-05 16:13:06 +11002922AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002923AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002924AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002925
Damien Miller7b22d652000-06-18 14:07:04 +10002926# Print summary of options
2927
Damien Miller7b22d652000-06-18 14:07:04 +10002928# Someone please show me a better way :)
2929A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2930B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2931C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2932D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002933E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002934F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002935G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002936H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2937I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2938J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002939
2940echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002941echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002942echo " User binaries: $B"
2943echo " System binaries: $C"
2944echo " Configuration files: $D"
2945echo " Askpass program: $E"
2946echo " Manual pages: $F"
2947echo " PID file: $G"
2948echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002949if test "x$external_path_file" = "x/etc/login.conf" ; then
2950echo " At runtime, sshd will use the path defined in $external_path_file"
2951echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002952else
Damien Millerf58c6722002-05-13 13:15:42 +10002953echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002954 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002955echo " (If PATH is set in $external_path_file it will be used instead. If"
2956echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2957 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002958fi
Damien Millera18bbd32002-05-13 10:48:57 +10002959if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002960echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002961fi
Damien Millerf58c6722002-05-13 13:15:42 +10002962echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002963echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002964echo " KerberosV support: $KRB5_MSG"
2965echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002966echo " S/KEY support: $SKEY_MSG"
2967echo " TCP Wrappers support: $TCPW_MSG"
2968echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002969echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002970echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2971echo " BSD Auth support: $BSD_AUTH_MSG"
2972echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002973if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002974echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002975fi
2976
Damien Miller7b22d652000-06-18 14:07:04 +10002977echo ""
2978
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002979echo " Host: ${host}"
2980echo " Compiler: ${CC}"
2981echo " Compiler flags: ${CFLAGS}"
2982echo "Preprocessor flags: ${CPPFLAGS}"
2983echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002984echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002985
2986echo ""
2987
Tim Rice6f1f7582004-05-30 21:38:51 -07002988if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
2989 echo "SVR4 style packages are supported with \"make package\"\n"
2990fi
2991
Damien Miller82cf0ce2000-12-20 13:34:48 +11002992if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002993 echo "PAM is enabled. You may need to install a PAM control file "
2994 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002995 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002996 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002997 echo ""
2998fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002999
Damien Miller6c21c512002-01-22 21:57:53 +11003000if test ! -z "$RAND_HELPER_CMDHASH" ; then
3001 echo "WARNING: you are using the builtin random number collection "
3002 echo "service. Please read WARNING.RNG and request that your OS "
3003 echo "vendor includes kernel-based random number collection in "
3004 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003005 echo ""
3006fi
Damien Miller60396b02001-02-18 17:01:00 +11003007
Damien Millerb4097182004-05-23 14:09:40 +10003008if test ! -z "$NO_PEERCHECK" ; then
3009 echo "WARNING: the operating system that you are using does not "
3010 echo "appear to support either the getpeereid() API nor the "
3011 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3012 echo "enforce security checks to prevent unauthorised connections to "
3013 echo "ssh-agent. Their absence increases the risk that a malicious "
3014 echo "user can connect to your agent. "
3015 echo ""
3016fi
3017