blob: f88d993e695955986956c74b2d60008a45c26be7 [file] [log] [blame]
Tim Rice2c961ce2002-09-23 16:54:10 -07001# $Id: configure.ac,v 1.88 2002/09/23 23:54:12 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110020AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070023AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110024
Damien Millere8bb4502001-09-25 16:39:35 +100025# System features
26AC_SYS_LARGEFILE
27
Damien Miller3f62aba2000-11-29 11:56:35 +110028if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
30fi
31
Damien Millerad833b32000-08-23 10:46:23 +100032# Use LOGIN_PROGRAM from environment if possible
33if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
35else
36 # Search for login
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
40 fi
41fi
42
Damien Miller166bd442000-03-16 10:48:25 +110043if test -z "$LD" ; then
44 LD=$CC
45fi
46AC_SUBST(LD)
47
Damien Miller166bd442000-03-16 10:48:25 +110048AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100049if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110051fi
52
Damien Millera22ba012000-03-02 23:09:20 +110053# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110054case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110055*-*-aix*)
56 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000057 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110058 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100059 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100060 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
61 saved_LDFLAGS="$LDFLAGS"
62 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
63 AC_TRY_LINK([],
64 [],
65 [
66 AC_MSG_RESULT(yes)
67 blibpath="/usr/lib:/lib:/usr/local/lib"
68 ],
69 [ AC_MSG_RESULT(no) ]
70 )
71 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110072 fi
Tim Ricee958ed32002-07-05 07:12:33 -070073 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
74 [AC_CHECK_LIB(s,authenticate,
75 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
76 LIBS="$LIBS -ls"
77 ])
78 ])
Damien Millereca71f82000-01-20 22:38:27 +110079 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100080 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000081 dnl AIX handles lastlog as part of its login message
82 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +000083 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller75b1d102000-01-07 14:01:41 +110084 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110085*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080086 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110087 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000088 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110089 AC_DEFINE(DISABLE_SHADOW)
90 AC_DEFINE(IPV4_DEFAULT)
91 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000092 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +000093 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -070094 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +000095 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +110096 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000097*-*-dgux*)
98 AC_DEFINE(IP_TOS_IS_BROKEN)
99 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000100*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000101 AC_MSG_CHECKING(if we have working getaddrinfo)
102 AC_TRY_RUN([#include <mach-o/dyld.h>
103main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
104 exit(0);
105 else
106 exit(1);
107}], [AC_MSG_RESULT(working)],
108 [AC_MSG_RESULT(buggy)
109 AC_DEFINE(BROKEN_GETADDRINFO)],
110 [AC_MSG_RESULT(assume it is working)])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000111 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000112*-*-hpux10.26)
113 if test -z "$GCC"; then
114 CFLAGS="$CFLAGS -Ae"
115 fi
116 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
117 IPADDR_IN_DISPLAY=yes
118 AC_DEFINE(HAVE_SECUREWARE)
119 AC_DEFINE(USE_PIPES)
120 AC_DEFINE(LOGIN_NO_ENDOPT)
121 AC_DEFINE(LOGIN_NEEDS_UTMPX)
122 AC_DEFINE(DISABLE_SHADOW)
123 AC_DEFINE(DISABLE_UTMP)
124 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700125 LIBS="$LIBS -lsec -lsecpw"
126 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000127 disable_ptmx_check=yes
128 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100129*-*-hpux10*)
130 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000131 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100132 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000133 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100134 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000135 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000136 AC_DEFINE(LOGIN_NO_ENDOPT)
137 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100138 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100139 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000140 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700141 LIBS="$LIBS -lsec"
142 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100143 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000144*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000145 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100146 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100147 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100148 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000149 AC_DEFINE(LOGIN_NO_ENDOPT)
150 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100151 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100152 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000153 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700154 LIBS="$LIBS -lsec"
155 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000156 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100157*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000158 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000159 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100160 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000161 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000162 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100163 ;;
164*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000165 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000166 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100167 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000168 AC_DEFINE(WITH_IRIX_ARRAY)
169 AC_DEFINE(WITH_IRIX_PROJECT)
170 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000171 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000172 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000173 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100174 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100175*-*-linux*)
176 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100177 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100178 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000179 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100180 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100181 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000182mips-sony-bsd|mips-sony-newsos4)
183 AC_DEFINE(HAVE_NEWS4)
184 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000185 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100186*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000187 check_for_libcrypt_before=1
Damien Millera22ba012000-03-02 23:09:20 +1100188 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100189 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100190*-*-freebsd*)
191 check_for_libcrypt_later=1
192 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000193*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000194 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100195 conf_utmp_location=/etc/utmp
196 conf_wtmp_location=/usr/adm/wtmp
197 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000198 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000199 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000200 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100201 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000202 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000203 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000204 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100205*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000206 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000207 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100208 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100209 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000210 AC_DEFINE(LOGIN_NEEDS_UTMPX)
211 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000212 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000213 # hardwire lastlog location (can't detect it on some versions)
214 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000215 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
216 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
217 if test "$sol2ver" -ge 8; then
218 AC_MSG_RESULT(yes)
219 AC_DEFINE(DISABLE_UTMP)
220 AC_DEFINE(DISABLE_WTMP)
221 else
222 AC_MSG_RESULT(no)
223 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100224 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000225*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000226 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000227 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100228 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000229 conf_utmp_location=/etc/utmp
230 conf_wtmp_location=/var/adm/wtmp
231 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000232 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000233 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000234*-ncr-sysv*)
235 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
236 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700237 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000238 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000239 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000240*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000241 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700242 # /usr/ucblib MUST NOT be searched on ReliantUNIX
243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100244 IPADDR_IN_DISPLAY=yes
245 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000246 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700247 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
248 # Attention: always take care to bind libsocket and libnsl before libc,
249 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000250 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100251*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000252 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100253 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100254 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100255 ;;
256*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000257 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100258 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100259 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100260 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100261*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000262 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100263 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100264 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100265*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000266 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100267 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700268 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100269 RANLIB=true
270 no_dev_ptmx=1
271 AC_DEFINE(BROKEN_SYS_TERMIO_H)
272 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000273 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000274 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100275 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100276 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700277 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700278 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100279 ;;
280*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000281 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000282 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100283 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000284 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100285 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000286 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000287 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700288 AC_DEFINE(DISABLE_FD_PASSING)
Damien Miller217f5672001-02-16 12:12:41 +1100289 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700290 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000291 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000292*-*-unicosmk*)
293 no_libsocket=1
294 no_libnsl=1
295 AC_DEFINE(USE_PIPES)
296 AC_DEFINE(DISABLE_FD_PASSING)
297 LDFLAGS="$LDFLAGS"
298 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
299 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000300 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000301*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700302 no_libsocket=1
303 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000304 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700305 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000306 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
307 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
308 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700309 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000310*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000311 AC_MSG_CHECKING(for Digital Unix SIA)
312 no_osfsia=""
313 AC_ARG_WITH(osfsia,
314 [ --with-osfsia Enable Digital Unix SIA],
315 [
316 if test "x$withval" = "xno" ; then
317 AC_MSG_RESULT(disabled)
318 no_osfsia=1
319 fi
320 ],
321 )
322 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000323 if test -f /etc/sia/matrix.conf; then
324 AC_MSG_RESULT(yes)
325 AC_DEFINE(HAVE_OSF_SIA)
326 AC_DEFINE(DISABLE_LOGIN)
327 LIBS="$LIBS -lsecurity -ldb -lm -laud"
328 else
329 AC_MSG_RESULT(no)
330 fi
331 fi
332 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000333
334*-*-nto-qnx)
335 AC_DEFINE(USE_PIPES)
336 AC_DEFINE(NO_X11_UNIX_SOCKETS)
337 AC_DEFINE(MISSING_NFDBITS)
338 AC_DEFINE(MISSING_HOWMANY)
339 AC_DEFINE(MISSING_FD_MASK)
340 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100341esac
342
Damien Millere37bfc12000-06-05 09:37:43 +1000343# Allow user to specify flags
344AC_ARG_WITH(cflags,
345 [ --with-cflags Specify additional flags to pass to compiler],
346 [
347 if test "x$withval" != "xno" ; then
348 CFLAGS="$CFLAGS $withval"
349 fi
350 ]
351)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000352AC_ARG_WITH(cppflags,
353 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
354 [
355 if test "x$withval" != "xno"; then
356 CPPFLAGS="$CPPFLAGS $withval"
357 fi
358 ]
359)
Damien Millere37bfc12000-06-05 09:37:43 +1000360AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000361 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000362 [
363 if test "x$withval" != "xno" ; then
364 LDFLAGS="$LDFLAGS $withval"
365 fi
366 ]
367)
368AC_ARG_WITH(libs,
369 [ --with-libs Specify additional libraries to link with],
370 [
371 if test "x$withval" != "xno" ; then
372 LIBS="$LIBS $withval"
373 fi
374 ]
375)
376
Tim Rice4cec93f2002-02-26 08:40:48 -0800377# Checks for header files.
378AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
379 getopt.h glob.h lastlog.h limits.h login.h \
380 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000381 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000382 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800383 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000384 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800385 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000386 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800387 util.h utime.h utmp.h utmpx.h)
388
Damien Millera22ba012000-03-02 23:09:20 +1100389# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700390AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
391AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000392
Damien Millerdf288022001-02-18 13:07:07 +1100393dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700394if test "x$with_tcp_wrappers" != "xno" ; then
395 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
396 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
397 fi
398fi
Damien Millerdf288022001-02-18 13:07:07 +1100399
Tim Rice13aae5e2001-10-21 17:53:58 -0700400AC_CHECK_FUNC(getspnam, ,
401 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700402
Damien Miller150c8b52002-02-13 23:06:56 +1100403AC_ARG_WITH(rpath,
404 [ --without-rpath Disable auto-added -R linker paths],
405 [
406 if test "x$withval" = "xno" ; then
407 need_dash_r=""
408 fi
409 if test "x$withval" = "xyes" ; then
410 need_dash_r=1
411 fi
412 ]
413)
414
Tim Rice13aae5e2001-10-21 17:53:58 -0700415dnl zlib is required
416AC_ARG_WITH(zlib,
417 [ --with-zlib=PATH Use zlib in PATH],
418 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000419 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100420 AC_MSG_ERROR([*** zlib is required ***])
421 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700422 if test -d "$withval/lib"; then
423 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700424 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700425 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700426 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700427 fi
428 else
429 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700430 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700431 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700432 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700433 fi
434 fi
435 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700436 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700437 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700438 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700439 fi
440 ]
441)
442
Tim Rice17b93e52001-10-23 22:36:54 -0700443AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100444
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000445dnl UnixWare 2.x
446AC_CHECK_FUNC(strcasecmp,
447 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
448)
449AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700450 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
451 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000452)
Damien Millerab18c411999-11-11 10:40:23 +1100453
Tim Ricee589a292001-11-03 11:09:32 -0800454dnl Checks for libutil functions
455AC_CHECK_HEADERS(libutil.h)
456AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
457AC_CHECK_FUNCS(logout updwtmp logwtmp)
458
Ben Lindstrom8697e082001-02-24 21:41:10 +0000459AC_FUNC_STRFTIME
460
Damien Miller3c027682001-03-14 11:39:45 +1100461# Check for ALTDIRFUNC glob() extension
462AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
463AC_EGREP_CPP(FOUNDIT,
464 [
465 #include <glob.h>
466 #ifdef GLOB_ALTDIRFUNC
467 FOUNDIT
468 #endif
469 ],
470 [
471 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
472 AC_MSG_RESULT(yes)
473 ],
474 [
475 AC_MSG_RESULT(no)
476 ]
477)
Damien Millerab18c411999-11-11 10:40:23 +1100478
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000479# Check for g.gl_matchc glob() extension
480AC_MSG_CHECKING(for gl_matchc field in glob_t)
481AC_EGREP_CPP(FOUNDIT,
482 [
483 #include <glob.h>
484 int main(void){glob_t g; g.gl_matchc = 1;}
485 ],
486 [
487 AC_DEFINE(GLOB_HAS_GL_MATCHC)
488 AC_MSG_RESULT(yes)
489 ],
490 [
491 AC_MSG_RESULT(no)
492 ]
493)
494
Damien Miller18bb4732001-03-28 14:35:30 +1000495AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
496AC_TRY_RUN(
497 [
498#include <sys/types.h>
499#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700500int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000501 ],
502 [AC_MSG_RESULT(yes)],
503 [
504 AC_MSG_RESULT(no)
505 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
506 ]
507)
508
Damien Millerc547bf12001-02-16 10:18:12 +1100509# Check whether user wants S/Key support
510SKEY_MSG="no"
511AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700512 [ --with-skey[[=PATH]] Enable S/Key support
513 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100514 [
515 if test "x$withval" != "xno" ; then
516
517 if test "x$withval" != "xyes" ; then
518 CPPFLAGS="$CPPFLAGS -I${withval}/include"
519 LDFLAGS="$LDFLAGS -L${withval}/lib"
520 fi
521
522 AC_DEFINE(SKEY)
523 LIBS="-lskey $LIBS"
524 SKEY_MSG="yes"
525
Tim Rice4cec93f2002-02-26 08:40:48 -0800526 AC_MSG_CHECKING([for s/key support])
527 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100528 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800529#include <stdio.h>
530#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700531int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800532 ],
533 [AC_MSG_RESULT(yes)],
534 [
535 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100536 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
537 ])
538 fi
539 ]
540)
541
542# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700543TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100544AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700545 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
546 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100547 [
548 if test "x$withval" != "xno" ; then
549 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700550 saved_LDFLAGS="$LDFLAGS"
551 saved_CPPFLAGS="$CPPFLAGS"
552 if test -n "${withval}" -a "${withval}" != "yes"; then
553 if test -d "${withval}/lib"; then
554 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700555 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700557 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700558 fi
559 else
560 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700561 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700562 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700563 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700564 fi
565 fi
566 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700567 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700568 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700569 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700570 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700571 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800572 LIBWRAP="-lwrap"
573 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100574 AC_MSG_CHECKING(for libwrap)
575 AC_TRY_LINK(
576 [
577#include <tcpd.h>
578 int deny_severity = 0, allow_severity = 0;
579 ],
580 [hosts_access(0);],
581 [
582 AC_MSG_RESULT(yes)
583 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800584 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700585 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100586 ],
587 [
588 AC_MSG_ERROR([*** libwrap missing])
589 ]
590 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800591 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100592 fi
593 ]
594)
595
Damien Millerad833b32000-08-23 10:46:23 +1000596dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000597AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700598 clock fchmod fchown freeaddrinfo futimes gai_strerror \
Damien Miller771721f2002-09-12 10:32:59 +1000599 getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\
Tim Rice13aae5e2001-10-21 17:53:58 -0700600 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
601 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000602 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
603 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000604 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000605 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
606 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
607 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700608
609dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700610AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700611 AC_CHECK_LIB(gen, dirname,[
612 AC_CACHE_CHECK([for broken dirname],
613 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700614 save_LIBS="$LIBS"
615 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 AC_TRY_RUN(
617 [
618#include <libgen.h>
619#include <string.h>
620
621int main(int argc, char **argv) {
622 char *s, buf[32];
623
624 strncpy(buf,"/etc", 32);
625 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700626 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700627 exit(1);
628 } else {
629 exit(0);
630 }
631}
632 ],
633 [ ac_cv_have_broken_dirname="no" ],
634 [ ac_cv_have_broken_dirname="yes" ]
635 )
Tim Rice17b93e52001-10-23 22:36:54 -0700636 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700637 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700638 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700639 LIBS="$LIBS -lgen"
640 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700641 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700642 fi
643 ])
644])
645
Damien Millerad833b32000-08-23 10:46:23 +1000646dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000647AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000648dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000649AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000650AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000651dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000652AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000653AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100654
Damien Miller04f80141999-11-19 15:32:34 +1100655AC_CHECK_FUNC(daemon,
656 [AC_DEFINE(HAVE_DAEMON)],
657 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
658)
659
Damien Miller9fb07e42000-03-05 16:22:59 +1100660AC_CHECK_FUNC(getpagesize,
661 [AC_DEFINE(HAVE_GETPAGESIZE)],
662 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
663)
664
Damien Millercb170cb2000-07-01 16:52:55 +1000665# Check for broken snprintf
666if test "x$ac_cv_func_snprintf" = "xyes" ; then
667 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
668 AC_TRY_RUN(
669 [
670#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700671int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000672 ],
673 [AC_MSG_RESULT(yes)],
674 [
675 AC_MSG_RESULT(no)
676 AC_DEFINE(BROKEN_SNPRINTF)
677 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
678 ]
679 )
680fi
681
Damien Miller606f8802000-09-16 15:39:56 +1100682AC_FUNC_GETPGRP
683
Damien Millera64b57a2001-01-17 10:44:13 +1100684# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000685PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100686AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100687 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100688 [
Damien Millera64b57a2001-01-17 10:44:13 +1100689 if test "x$withval" != "xno" ; then
690 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
691 AC_MSG_ERROR([PAM headers not found])
692 fi
693
694 AC_CHECK_LIB(dl, dlopen, , )
695 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
696 AC_CHECK_FUNCS(pam_getenvlist)
697
698 disable_shadow=yes
699 PAM_MSG="yes"
700
701 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800702 if test $ac_cv_lib_dl_dlopen = yes; then
703 LIBPAM="-lpam -ldl"
704 else
705 LIBPAM="-lpam"
706 fi
707 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100708 fi
709 ]
710)
Damien Millera22ba012000-03-02 23:09:20 +1100711
Damien Millera64b57a2001-01-17 10:44:13 +1100712# Check for older PAM
713if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100714 # Check PAM strerror arguments (old PAM)
715 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
716 AC_TRY_COMPILE(
717 [
Damien Miller81171112000-04-23 11:14:01 +1000718#include <stdlib.h>
719#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100720 ],
721 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
722 [AC_MSG_RESULT(no)],
723 [
724 AC_DEFINE(HAVE_OLD_PAM)
725 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000726 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100727 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100728 )
Damien Millera22ba012000-03-02 23:09:20 +1100729fi
730
Damien Millerfc93d4b2002-09-04 23:26:29 +1000731# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
732# because the system crypt() is more featureful.
733if test "x$check_for_libcrypt_before" = "x1"; then
734 AC_CHECK_LIB(crypt, crypt)
735fi
736
Tim Riceaef73712002-05-11 13:17:42 -0700737# Search for OpenSSL
738saved_CPPFLAGS="$CPPFLAGS"
739saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100740AC_ARG_WITH(ssl-dir,
741 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
742 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000743 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700744 if test -d "$withval/lib"; then
745 if test -n "${need_dash_r}"; then
746 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
747 else
748 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
749 fi
750 else
751 if test -n "${need_dash_r}"; then
752 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
753 else
754 LDFLAGS="-L${withval} ${LDFLAGS}"
755 fi
756 fi
757 if test -d "$withval/include"; then
758 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
759 else
760 CPPFLAGS="-I${withval} ${CPPFLAGS}"
761 fi
Damien Millera22ba012000-03-02 23:09:20 +1100762 fi
763 ]
764)
Tim Riceaef73712002-05-11 13:17:42 -0700765LIBS="$LIBS -lcrypto"
766AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000767 [
Tim Riceaef73712002-05-11 13:17:42 -0700768 dnl Check default openssl install dir
769 if test -n "${need_dash_r}"; then
770 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000771 else
Tim Riceaef73712002-05-11 13:17:42 -0700772 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000773 fi
Tim Riceaef73712002-05-11 13:17:42 -0700774 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
775 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
776 [
777 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
778 ]
779 )
780 ]
781)
782
Tim Riced730b782002-08-13 18:52:10 -0700783# Determine OpenSSL header version
784AC_MSG_CHECKING([OpenSSL header version])
785AC_TRY_RUN(
786 [
787#include <stdio.h>
788#include <string.h>
789#include <openssl/opensslv.h>
790#define DATA "conftest.sslincver"
791int main(void) {
792 FILE *fd;
793 int rc;
794
795 fd = fopen(DATA,"w");
796 if(fd == NULL)
797 exit(1);
798
799 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
800 exit(1);
801
802 exit(0);
803}
804 ],
805 [
806 ssl_header_ver=`cat conftest.sslincver`
807 AC_MSG_RESULT($ssl_header_ver)
808 ],
809 [
810 AC_MSG_RESULT(not found)
811 AC_MSG_ERROR(OpenSSL version header not found.)
812 ]
813)
814
815# Determine OpenSSL library version
816AC_MSG_CHECKING([OpenSSL library version])
817AC_TRY_RUN(
818 [
819#include <stdio.h>
820#include <string.h>
821#include <openssl/opensslv.h>
822#include <openssl/crypto.h>
823#define DATA "conftest.ssllibver"
824int main(void) {
825 FILE *fd;
826 int rc;
827
828 fd = fopen(DATA,"w");
829 if(fd == NULL)
830 exit(1);
831
832 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
833 exit(1);
834
835 exit(0);
836}
837 ],
838 [
839 ssl_library_ver=`cat conftest.ssllibver`
840 AC_MSG_RESULT($ssl_library_ver)
841 ],
842 [
843 AC_MSG_RESULT(not found)
844 AC_MSG_ERROR(OpenSSL library not found.)
845 ]
846)
Damien Millera22ba012000-03-02 23:09:20 +1100847
Damien Millerec932372002-01-22 22:16:03 +1100848# Sanity check OpenSSL headers
849AC_MSG_CHECKING([whether OpenSSL's headers match the library])
850AC_TRY_RUN(
851 [
852#include <string.h>
853#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700854int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +1100855 ],
856 [
857 AC_MSG_RESULT(yes)
858 ],
859 [
860 AC_MSG_RESULT(no)
861 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
862 ]
863)
864
Damien Millera64b57a2001-01-17 10:44:13 +1100865# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
866# version in OpenSSL. Skip this for PAM
867if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100868 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100869fi
870
Damien Miller6c21c512002-01-22 21:57:53 +1100871
872### Configure cryptographic random number support
873
874# Check wheter OpenSSL seeds itself
875AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
876AC_TRY_RUN(
877 [
878#include <string.h>
879#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700880int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +1100881 ],
882 [
883 OPENSSL_SEEDS_ITSELF=yes
884 AC_MSG_RESULT(yes)
885 ],
886 [
887 AC_MSG_RESULT(no)
888 # Default to use of the rand helper if OpenSSL doesn't
889 # seed itself
890 USE_RAND_HELPER=yes
891 ]
892)
893
894
895# Do we want to force the use of the rand helper?
896AC_ARG_WITH(rand-helper,
897 [ --with-rand-helper Use subprocess to gather strong randomness ],
898 [
899 if test "x$withval" = "xno" ; then
900 # Force use of OpenSSL's internal RNG, even if
901 # the previous test showed it to be unseeded.
902 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
903 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
904 OPENSSL_SEEDS_ITSELF=yes
905 USE_RAND_HELPER=""
906 fi
907 else
908 USE_RAND_HELPER=yes
909 fi
910 ],
911)
912
913# Which randomness source do we use?
914if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
915 # OpenSSL only
916 AC_DEFINE(OPENSSL_PRNG_ONLY)
917 RAND_MSG="OpenSSL internal ONLY"
918 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800919elif test ! -z "$USE_RAND_HELPER" ; then
920 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100921 RAND_MSG="ssh-rand-helper"
922 INSTALL_SSH_RAND_HELPER="yes"
923fi
924AC_SUBST(INSTALL_SSH_RAND_HELPER)
925
926### Configuration of ssh-rand-helper
927
928# PRNGD TCP socket
929AC_ARG_WITH(prngd-port,
930 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
931 [
Damien Millere996d722002-01-23 11:20:59 +1100932 case "$withval" in
933 no)
934 withval=""
935 ;;
936 [[0-9]]*)
937 ;;
938 *)
939 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
940 ;;
941 esac
942 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100943 PRNGD_PORT="$withval"
944 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
945 fi
946 ]
947)
948
949# PRNGD Unix domain socket
950AC_ARG_WITH(prngd-socket,
951 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
952 [
Damien Millere996d722002-01-23 11:20:59 +1100953 case "$withval" in
954 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100955 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100956 ;;
957 no)
958 withval=""
959 ;;
960 /*)
961 ;;
962 *)
963 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
964 ;;
965 esac
966
967 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100968 if test ! -z "$PRNGD_PORT" ; then
969 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
970 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100971 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100972 AC_MSG_WARN(Entropy socket is not readable)
973 fi
974 PRNGD_SOCKET="$withval"
975 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
976 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800977 ],
978 [
979 # Check for existing socket only if we don't have a random device already
980 if test "$USE_RAND_HELPER" = yes ; then
981 AC_MSG_CHECKING(for PRNGD/EGD socket)
982 # Insert other locations here
983 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
984 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
985 PRNGD_SOCKET="$sock"
986 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
987 break;
988 fi
989 done
990 if test ! -z "$PRNGD_SOCKET" ; then
991 AC_MSG_RESULT($PRNGD_SOCKET)
992 else
993 AC_MSG_RESULT(not found)
994 fi
995 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100996 ]
997)
998
999# Change default command timeout for hashing entropy source
1000entropy_timeout=200
1001AC_ARG_WITH(entropy-timeout,
1002 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1003 [
1004 if test "x$withval" != "xno" ; then
1005 entropy_timeout=$withval
1006 fi
1007 ]
1008)
Damien Miller6c21c512002-01-22 21:57:53 +11001009AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1010
Damien Millerd3f6ad22002-06-25 10:24:47 +10001011SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001012AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001013 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001014 [
1015 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001016 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001017 fi
1018 ]
1019)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001020AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1021AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001022
Tim Rice88f2ab52002-03-17 12:17:34 -08001023# We do this little dance with the search path to insure
1024# that programs that we select for use by installed programs
1025# (which may be run by the super-user) come from trusted
1026# locations before they come from the user's private area.
1027# This should help avoid accidentally configuring some
1028# random version of a program in someone's personal bin.
1029
1030OPATH=$PATH
1031PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001032test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001033test -d /sbin && PATH=$PATH:/sbin
1034test -d /usr/sbin && PATH=$PATH:/usr/sbin
1035PATH=$PATH:/etc:$OPATH
1036
Damien Miller6c21c512002-01-22 21:57:53 +11001037# These programs are used by the command hashing source to gather entropy
1038OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1039OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1040OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1041OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1042OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1043OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1044OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1045OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1046OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1047OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1048OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1049OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1050OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1051OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1052OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1053OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001054# restore PATH
1055PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001056
1057# Where does ssh-rand-helper get its randomness from?
1058INSTALL_SSH_PRNG_CMDS=""
1059if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1060 if test ! -z "$PRNGD_PORT" ; then
1061 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1062 elif test ! -z "$PRNGD_SOCKET" ; then
1063 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1064 else
1065 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1066 RAND_HELPER_CMDHASH=yes
1067 INSTALL_SSH_PRNG_CMDS="yes"
1068 fi
1069fi
1070AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1071
1072
Ben Lindstromb5628642000-10-18 00:02:25 +00001073# Cheap hack to ensure NEWS-OS libraries are arranged right.
1074if test ! -z "$SONY" ; then
1075 LIBS="$LIBS -liberty";
1076fi
1077
Damien Millera22ba012000-03-02 23:09:20 +11001078# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001079AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001080AC_CHECK_SIZEOF(short int, 2)
1081AC_CHECK_SIZEOF(int, 4)
1082AC_CHECK_SIZEOF(long int, 4)
1083AC_CHECK_SIZEOF(long long int, 8)
1084
Damien Millerfa2bb692002-04-23 23:22:25 +10001085# Sanity check long long for some platforms (AIX)
1086if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1087 ac_cv_sizeof_long_long_int=0
1088fi
1089
Damien Millera22ba012000-03-02 23:09:20 +11001090# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001091AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1092 AC_TRY_COMPILE(
1093 [ #include <sys/types.h> ],
1094 [ u_int a; a = 1;],
1095 [ ac_cv_have_u_int="yes" ],
1096 [ ac_cv_have_u_int="no" ]
1097 )
1098])
1099if test "x$ac_cv_have_u_int" = "xyes" ; then
1100 AC_DEFINE(HAVE_U_INT)
1101 have_u_int=1
1102fi
1103
Damien Miller61e50f12000-05-08 20:49:37 +10001104AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1105 AC_TRY_COMPILE(
1106 [ #include <sys/types.h> ],
1107 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1108 [ ac_cv_have_intxx_t="yes" ],
1109 [ ac_cv_have_intxx_t="no" ]
1110 )
1111])
1112if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1113 AC_DEFINE(HAVE_INTXX_T)
1114 have_intxx_t=1
1115fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001116
1117if (test -z "$have_intxx_t" && \
1118 test "x$ac_cv_header_stdint_h" = "xyes")
1119then
1120 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1121 AC_TRY_COMPILE(
1122 [ #include <stdint.h> ],
1123 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1124 [
1125 AC_DEFINE(HAVE_INTXX_T)
1126 AC_MSG_RESULT(yes)
1127 ],
1128 [ AC_MSG_RESULT(no) ]
1129 )
1130fi
1131
Damien Miller578783e2000-09-23 14:12:24 +11001132AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1133 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001134 [
1135#include <sys/types.h>
1136#ifdef HAVE_STDINT_H
1137# include <stdint.h>
1138#endif
1139#include <sys/socket.h>
1140#ifdef HAVE_SYS_BITYPES_H
1141# include <sys/bitypes.h>
1142#endif
1143 ],
Damien Miller578783e2000-09-23 14:12:24 +11001144 [ int64_t a; a = 1;],
1145 [ ac_cv_have_int64_t="yes" ],
1146 [ ac_cv_have_int64_t="no" ]
1147 )
1148])
1149if test "x$ac_cv_have_int64_t" = "xyes" ; then
1150 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001151fi
1152
Damien Miller61e50f12000-05-08 20:49:37 +10001153AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1154 AC_TRY_COMPILE(
1155 [ #include <sys/types.h> ],
1156 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1157 [ ac_cv_have_u_intxx_t="yes" ],
1158 [ ac_cv_have_u_intxx_t="no" ]
1159 )
1160])
1161if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1162 AC_DEFINE(HAVE_U_INTXX_T)
1163 have_u_intxx_t=1
1164fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001165
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001166if test -z "$have_u_intxx_t" ; then
1167 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1168 AC_TRY_COMPILE(
1169 [ #include <sys/socket.h> ],
1170 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1171 [
1172 AC_DEFINE(HAVE_U_INTXX_T)
1173 AC_MSG_RESULT(yes)
1174 ],
1175 [ AC_MSG_RESULT(no) ]
1176 )
1177fi
1178
Damien Miller578783e2000-09-23 14:12:24 +11001179AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1180 AC_TRY_COMPILE(
1181 [ #include <sys/types.h> ],
1182 [ u_int64_t a; a = 1;],
1183 [ ac_cv_have_u_int64_t="yes" ],
1184 [ ac_cv_have_u_int64_t="no" ]
1185 )
1186])
1187if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1188 AC_DEFINE(HAVE_U_INT64_T)
1189 have_u_int64_t=1
1190fi
1191
Tim Rice4cec93f2002-02-26 08:40:48 -08001192if test -z "$have_u_int64_t" ; then
1193 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1194 AC_TRY_COMPILE(
1195 [ #include <sys/bitypes.h> ],
1196 [ u_int64_t a; a = 1],
1197 [
1198 AC_DEFINE(HAVE_U_INT64_T)
1199 AC_MSG_RESULT(yes)
1200 ],
1201 [ AC_MSG_RESULT(no) ]
1202 )
1203fi
1204
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001205if test -z "$have_u_intxx_t" ; then
1206 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1207 AC_TRY_COMPILE(
1208 [
1209#include <sys/types.h>
1210 ],
1211 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1212 [ ac_cv_have_uintxx_t="yes" ],
1213 [ ac_cv_have_uintxx_t="no" ]
1214 )
1215 ])
1216 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1217 AC_DEFINE(HAVE_UINTXX_T)
1218 fi
1219fi
1220
1221if test -z "$have_uintxx_t" ; then
1222 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1223 AC_TRY_COMPILE(
1224 [ #include <stdint.h> ],
1225 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1226 [
1227 AC_DEFINE(HAVE_UINTXX_T)
1228 AC_MSG_RESULT(yes)
1229 ],
1230 [ AC_MSG_RESULT(no) ]
1231 )
1232fi
1233
Damien Milleredb82922000-06-20 13:25:52 +10001234if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1235 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001236then
1237 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1238 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001239 [
1240#include <sys/bitypes.h>
1241 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001242 [
Damien Miller70494d12000-04-03 15:57:06 +10001243 int8_t a; int16_t b; int32_t c;
1244 u_int8_t e; u_int16_t f; u_int32_t g;
1245 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001246 ],
1247 [
1248 AC_DEFINE(HAVE_U_INTXX_T)
1249 AC_DEFINE(HAVE_INTXX_T)
1250 AC_MSG_RESULT(yes)
1251 ],
1252 [AC_MSG_RESULT(no)]
1253 )
1254fi
1255
Damien Miller58be7382001-09-15 21:31:54 +10001256
1257AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1258 AC_TRY_COMPILE(
1259 [
1260#include <sys/types.h>
1261 ],
1262 [ u_char foo; foo = 125; ],
1263 [ ac_cv_have_u_char="yes" ],
1264 [ ac_cv_have_u_char="no" ]
1265 )
1266])
1267if test "x$ac_cv_have_u_char" = "xyes" ; then
1268 AC_DEFINE(HAVE_U_CHAR)
1269fi
1270
Tim Rice13aae5e2001-10-21 17:53:58 -07001271TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001272
Tim Rice200a5c02002-02-26 22:12:34 -08001273AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001274
Damien Miller61e50f12000-05-08 20:49:37 +10001275AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1276 AC_TRY_COMPILE(
1277 [
1278#include <sys/types.h>
1279 ],
1280 [ size_t foo; foo = 1235; ],
1281 [ ac_cv_have_size_t="yes" ],
1282 [ ac_cv_have_size_t="no" ]
1283 )
1284])
1285if test "x$ac_cv_have_size_t" = "xyes" ; then
1286 AC_DEFINE(HAVE_SIZE_T)
1287fi
Damien Miller95058511999-12-29 10:36:45 +11001288
Damien Miller615f9392000-05-17 22:53:33 +10001289AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1290 AC_TRY_COMPILE(
1291 [
1292#include <sys/types.h>
1293 ],
1294 [ ssize_t foo; foo = 1235; ],
1295 [ ac_cv_have_ssize_t="yes" ],
1296 [ ac_cv_have_ssize_t="no" ]
1297 )
1298])
1299if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1300 AC_DEFINE(HAVE_SSIZE_T)
1301fi
1302
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001303AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1304 AC_TRY_COMPILE(
1305 [
1306#include <time.h>
1307 ],
1308 [ clock_t foo; foo = 1235; ],
1309 [ ac_cv_have_clock_t="yes" ],
1310 [ ac_cv_have_clock_t="no" ]
1311 )
1312])
1313if test "x$ac_cv_have_clock_t" = "xyes" ; then
1314 AC_DEFINE(HAVE_CLOCK_T)
1315fi
1316
Damien Millerb54b40e2000-06-23 08:23:34 +10001317AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1318 AC_TRY_COMPILE(
1319 [
1320#include <sys/types.h>
1321#include <sys/socket.h>
1322 ],
1323 [ sa_family_t foo; foo = 1235; ],
1324 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001325 [ AC_TRY_COMPILE(
1326 [
1327#include <sys/types.h>
1328#include <sys/socket.h>
1329#include <netinet/in.h>
1330 ],
1331 [ sa_family_t foo; foo = 1235; ],
1332 [ ac_cv_have_sa_family_t="yes" ],
1333
Damien Millerb54b40e2000-06-23 08:23:34 +10001334 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001335 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001336 )
1337])
1338if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1339 AC_DEFINE(HAVE_SA_FAMILY_T)
1340fi
1341
Damien Miller0f91b4e2000-06-18 15:43:25 +10001342AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1343 AC_TRY_COMPILE(
1344 [
1345#include <sys/types.h>
1346 ],
1347 [ pid_t foo; foo = 1235; ],
1348 [ ac_cv_have_pid_t="yes" ],
1349 [ ac_cv_have_pid_t="no" ]
1350 )
1351])
1352if test "x$ac_cv_have_pid_t" = "xyes" ; then
1353 AC_DEFINE(HAVE_PID_T)
1354fi
1355
1356AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1357 AC_TRY_COMPILE(
1358 [
1359#include <sys/types.h>
1360 ],
1361 [ mode_t foo; foo = 1235; ],
1362 [ ac_cv_have_mode_t="yes" ],
1363 [ ac_cv_have_mode_t="no" ]
1364 )
1365])
1366if test "x$ac_cv_have_mode_t" = "xyes" ; then
1367 AC_DEFINE(HAVE_MODE_T)
1368fi
1369
Damien Miller61e50f12000-05-08 20:49:37 +10001370
1371AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1372 AC_TRY_COMPILE(
1373 [
Damien Miller81171112000-04-23 11:14:01 +10001374#include <sys/types.h>
1375#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001376 ],
1377 [ struct sockaddr_storage s; ],
1378 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1379 [ ac_cv_have_struct_sockaddr_storage="no" ]
1380 )
1381])
1382if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1383 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1384fi
Damien Miller34132e52000-01-14 15:45:46 +11001385
Damien Miller61e50f12000-05-08 20:49:37 +10001386AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1387 AC_TRY_COMPILE(
1388 [
Damien Miller7b22d652000-06-18 14:07:04 +10001389#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001390#include <netinet/in.h>
1391 ],
1392 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1393 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1394 [ ac_cv_have_struct_sockaddr_in6="no" ]
1395 )
1396])
1397if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1398 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1399fi
Damien Miller34132e52000-01-14 15:45:46 +11001400
Damien Miller61e50f12000-05-08 20:49:37 +10001401AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1402 AC_TRY_COMPILE(
1403 [
Damien Miller7b22d652000-06-18 14:07:04 +10001404#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001405#include <netinet/in.h>
1406 ],
1407 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1408 [ ac_cv_have_struct_in6_addr="yes" ],
1409 [ ac_cv_have_struct_in6_addr="no" ]
1410 )
1411])
1412if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1413 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1414fi
Damien Miller34132e52000-01-14 15:45:46 +11001415
Damien Miller61e50f12000-05-08 20:49:37 +10001416AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1417 AC_TRY_COMPILE(
1418 [
Damien Miller81171112000-04-23 11:14:01 +10001419#include <sys/types.h>
1420#include <sys/socket.h>
1421#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001422 ],
1423 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1424 [ ac_cv_have_struct_addrinfo="yes" ],
1425 [ ac_cv_have_struct_addrinfo="no" ]
1426 )
1427])
1428if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1429 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1430fi
1431
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001432AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1433 AC_TRY_COMPILE(
1434 [ #include <sys/time.h> ],
1435 [ struct timeval tv; tv.tv_sec = 1;],
1436 [ ac_cv_have_struct_timeval="yes" ],
1437 [ ac_cv_have_struct_timeval="no" ]
1438 )
1439])
1440if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1441 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1442 have_struct_timeval=1
1443fi
1444
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001445# If we don't have int64_t then we can't compile sftp-server. So don't
1446# even attempt to do it.
1447if test "x$ac_cv_have_int64_t" = "xno" -a \
1448 "x$ac_cv_sizeof_long_int" != "x8" -a \
1449 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1450 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001451else
1452dnl test snprintf (broken on SCO w/gcc)
1453 AC_TRY_RUN(
1454 [
1455#include <stdio.h>
1456#include <string.h>
1457#ifdef HAVE_SNPRINTF
1458main()
1459{
1460 char buf[50];
1461 char expected_out[50];
1462 int mazsize = 50 ;
1463#if (SIZEOF_LONG_INT == 8)
1464 long int num = 0x7fffffffffffffff;
1465#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001466 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001467#endif
1468 strcpy(expected_out, "9223372036854775807");
1469 snprintf(buf, mazsize, "%lld", num);
1470 if(strcmp(buf, expected_out) != 0)
1471 exit(1);
1472 exit(0);
1473}
1474#else
1475main() { exit(0); }
1476#endif
1477 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1478 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001479fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001480AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001481
Damien Miller78315eb2000-09-29 23:01:36 +11001482dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001483OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1484OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1485OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1486OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1487OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001488OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001489OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1490OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001491OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001492OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1493OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1494OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1495OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001496OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1497OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1498OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1499OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001500
1501AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001502
Damien Miller61e50f12000-05-08 20:49:37 +10001503AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1504 ac_cv_have_ss_family_in_struct_ss, [
1505 AC_TRY_COMPILE(
1506 [
Damien Miller81171112000-04-23 11:14:01 +10001507#include <sys/types.h>
1508#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001509 ],
1510 [ struct sockaddr_storage s; s.ss_family = 1; ],
1511 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1512 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1513 )
1514])
1515if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1516 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1517fi
1518
Damien Miller61e50f12000-05-08 20:49:37 +10001519AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1520 ac_cv_have___ss_family_in_struct_ss, [
1521 AC_TRY_COMPILE(
1522 [
Damien Miller81171112000-04-23 11:14:01 +10001523#include <sys/types.h>
1524#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001525 ],
1526 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1527 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1528 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1529 )
1530])
1531if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1532 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1533fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001534
Damien Millerad833b32000-08-23 10:46:23 +10001535AC_CACHE_CHECK([for pw_class field in struct passwd],
1536 ac_cv_have_pw_class_in_struct_passwd, [
1537 AC_TRY_COMPILE(
1538 [
Damien Millerad833b32000-08-23 10:46:23 +10001539#include <pwd.h>
1540 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001541 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001542 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1543 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1544 )
1545])
1546if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1547 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1548fi
1549
Kevin Steves82456952001-06-22 21:14:18 +00001550AC_CACHE_CHECK([for pw_expire field in struct passwd],
1551 ac_cv_have_pw_expire_in_struct_passwd, [
1552 AC_TRY_COMPILE(
1553 [
1554#include <pwd.h>
1555 ],
1556 [ struct passwd p; p.pw_expire = 0; ],
1557 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1558 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1559 )
1560])
1561if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1562 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1563fi
1564
1565AC_CACHE_CHECK([for pw_change field in struct passwd],
1566 ac_cv_have_pw_change_in_struct_passwd, [
1567 AC_TRY_COMPILE(
1568 [
1569#include <pwd.h>
1570 ],
1571 [ struct passwd p; p.pw_change = 0; ],
1572 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1573 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1574 )
1575])
1576if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1577 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1578fi
Damien Miller61e50f12000-05-08 20:49:37 +10001579
Tim Rice28bbb0c2002-05-27 17:37:32 -07001580dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001581AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1582 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001583 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001584 [
Tim Riceae49fe62002-04-12 10:26:21 -07001585#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001586#include <sys/socket.h>
1587#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001588int main() {
1589#ifdef msg_accrights
1590exit(1);
1591#endif
1592struct msghdr m;
1593m.msg_accrights = 0;
1594exit(0);
1595}
Kevin Steves939c9db2002-03-22 17:23:25 +00001596 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001597 [ ac_cv_have_accrights_in_msghdr="yes" ],
1598 [ ac_cv_have_accrights_in_msghdr="no" ]
1599 )
1600])
1601if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1602 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1603fi
1604
Kevin Stevesa44e0352002-04-07 16:18:03 +00001605AC_CACHE_CHECK([for msg_control field in struct msghdr],
1606 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001607 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001608 [
Tim Riceae49fe62002-04-12 10:26:21 -07001609#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001610#include <sys/socket.h>
1611#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001612int main() {
1613#ifdef msg_control
1614exit(1);
1615#endif
1616struct msghdr m;
1617m.msg_control = 0;
1618exit(0);
1619}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001620 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001621 [ ac_cv_have_control_in_msghdr="yes" ],
1622 [ ac_cv_have_control_in_msghdr="no" ]
1623 )
1624])
1625if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1626 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1627fi
1628
Damien Miller61e50f12000-05-08 20:49:37 +10001629AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1630 AC_TRY_LINK([],
1631 [ extern char *__progname; printf("%s", __progname); ],
1632 [ ac_cv_libc_defines___progname="yes" ],
1633 [ ac_cv_libc_defines___progname="no" ]
1634 )
1635])
1636if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1637 AC_DEFINE(HAVE___PROGNAME)
1638fi
1639
Kevin Steves4846f4a2002-03-22 18:19:53 +00001640AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1641 AC_TRY_LINK([
1642#include <stdio.h>
1643],
1644 [ printf("%s", __FUNCTION__); ],
1645 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1646 [ ac_cv_cc_implements___FUNCTION__="no" ]
1647 )
1648])
1649if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1650 AC_DEFINE(HAVE___FUNCTION__)
1651fi
1652
1653AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1654 AC_TRY_LINK([
1655#include <stdio.h>
1656],
1657 [ printf("%s", __func__); ],
1658 [ ac_cv_cc_implements___func__="yes" ],
1659 [ ac_cv_cc_implements___func__="no" ]
1660 )
1661])
1662if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1663 AC_DEFINE(HAVE___func__)
1664fi
1665
Damien Miller4f8e6692001-07-14 13:22:53 +10001666AC_CACHE_CHECK([whether getopt has optreset support],
1667 ac_cv_have_getopt_optreset, [
1668 AC_TRY_LINK(
1669 [
1670#include <getopt.h>
1671 ],
1672 [ extern int optreset; optreset = 0; ],
1673 [ ac_cv_have_getopt_optreset="yes" ],
1674 [ ac_cv_have_getopt_optreset="no" ]
1675 )
1676])
1677if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1678 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1679fi
Damien Millera22ba012000-03-02 23:09:20 +11001680
Damien Millerecbb26d2000-07-15 14:59:14 +10001681AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1682 AC_TRY_LINK([],
1683 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1684 [ ac_cv_libc_defines_sys_errlist="yes" ],
1685 [ ac_cv_libc_defines_sys_errlist="no" ]
1686 )
1687])
1688if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1689 AC_DEFINE(HAVE_SYS_ERRLIST)
1690fi
1691
1692
Damien Miller11fa2cc2000-08-16 10:35:58 +10001693AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1694 AC_TRY_LINK([],
1695 [ extern int sys_nerr; printf("%i", sys_nerr);],
1696 [ ac_cv_libc_defines_sys_nerr="yes" ],
1697 [ ac_cv_libc_defines_sys_nerr="no" ]
1698 )
1699])
1700if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1701 AC_DEFINE(HAVE_SYS_NERR)
1702fi
1703
Damien Miller85de5802001-09-18 14:01:11 +10001704SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001705
1706# Check whether user wants sectok support
1707AC_ARG_WITH(sectok,
1708 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001709 [
1710 if test "x$withval" != "xno" ; then
1711 if test "x$withval" != "xyes" ; then
1712 CPPFLAGS="$CPPFLAGS -I${withval}"
1713 LDFLAGS="$LDFLAGS -L${withval}"
1714 if test ! -z "$need_dash_r" ; then
1715 LDFLAGS="$LDFLAGS -R${withval}"
1716 fi
1717 if test ! -z "$blibpath" ; then
1718 blibpath="$blibpath:${withval}"
1719 fi
1720 fi
1721 AC_CHECK_HEADERS(sectok.h)
1722 if test "$ac_cv_header_sectok_h" != yes; then
1723 AC_MSG_ERROR(Can't find sectok.h)
1724 fi
1725 AC_CHECK_LIB(sectok, sectok_open)
1726 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1727 AC_MSG_ERROR(Can't find libsectok)
1728 fi
1729 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001730 AC_DEFINE(USE_SECTOK)
1731 SCARD_MSG="yes, using sectok"
1732 fi
1733 ]
1734)
1735
1736# Check whether user wants OpenSC support
1737AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001738 AC_HELP_STRING([--with-opensc=PFX],
1739 [Enable smartcard support using OpenSC]),
1740 opensc_config_prefix="$withval", opensc_config_prefix="")
1741if test x$opensc_config_prefix != x ; then
1742 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1743 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1744 if test "$OPENSC_CONFIG" != "no"; then
1745 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1746 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1747 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1748 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1749 AC_DEFINE(SMARTCARD)
1750 AC_DEFINE(USE_OPENSC)
1751 SCARD_MSG="yes, using OpenSC"
1752 fi
1753fi
Damien Miller85de5802001-09-18 14:01:11 +10001754
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001755# Check whether user wants Kerberos 5 support
1756KRB5_MSG="no"
1757AC_ARG_WITH(kerberos5,
1758 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1759 [
1760 if test "x$withval" != "xno" ; then
1761 if test "x$withval" = "xyes" ; then
1762 KRB5ROOT="/usr/local"
1763 else
1764 KRB5ROOT=${withval}
1765 fi
1766 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1767 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1768 AC_DEFINE(KRB5)
1769 KRB5_MSG="yes"
1770 AC_MSG_CHECKING(whether we are using Heimdal)
1771 AC_TRY_COMPILE([ #include <krb5.h> ],
1772 [ char *tmp = heimdal_version; ],
1773 [ AC_MSG_RESULT(yes)
1774 AC_DEFINE(HEIMDAL)
1775 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1776 ],
1777 [ AC_MSG_RESULT(no)
1778 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1779 ]
1780 )
1781 if test ! -z "$need_dash_r" ; then
1782 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1783 fi
1784 if test ! -z "$blibpath" ; then
1785 blibpath="$blibpath:${KRB5ROOT}/lib"
1786 fi
1787 AC_CHECK_LIB(resolv, dn_expand, , )
1788
1789 KRB5=yes
1790 fi
1791 ]
1792)
1793# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001794KRB4_MSG="no"
1795AC_ARG_WITH(kerberos4,
1796 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1797 [
1798 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001799 if test "x$withval" != "xyes" ; then
1800 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1801 LDFLAGS="$LDFLAGS -L${withval}/lib"
1802 if test ! -z "$need_dash_r" ; then
1803 LDFLAGS="$LDFLAGS -R${withval}/lib"
1804 fi
1805 if test ! -z "$blibpath" ; then
1806 blibpath="$blibpath:${withval}/lib"
1807 fi
1808 else
1809 if test -d /usr/include/kerberosIV ; then
1810 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1811 fi
1812 fi
1813
1814 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001815 if test "$ac_cv_header_krb_h" != yes; then
1816 AC_MSG_WARN([Cannot find krb.h, build may fail])
1817 fi
Damien Miller98344742001-03-28 14:37:06 +10001818 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001819 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001820 AC_CHECK_LIB(krb4, main)
1821 if test "$ac_cv_lib_krb4_main" != yes; then
1822 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1823 else
1824 KLIBS="-lkrb4"
1825 fi
1826 else
1827 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001828 fi
Damien Miller98344742001-03-28 14:37:06 +10001829 AC_CHECK_LIB(des, des_cbc_encrypt)
1830 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1831 AC_CHECK_LIB(des425, des_cbc_encrypt)
1832 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1833 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1834 else
1835 KLIBS="-ldes425"
1836 fi
1837 else
1838 KLIBS="-ldes"
1839 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001840 AC_CHECK_LIB(resolv, dn_expand, , )
1841 KRB4=yes
1842 KRB4_MSG="yes"
1843 AC_DEFINE(KRB4)
1844 fi
1845 ]
1846)
1847
1848# Check whether user wants AFS support
1849AFS_MSG="no"
1850AC_ARG_WITH(afs,
1851 [ --with-afs=PATH Enable AFS support],
1852 [
1853 if test "x$withval" != "xno" ; then
1854
1855 if test "x$withval" != "xyes" ; then
1856 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1857 LDFLAGS="$LDFLAGS -L${withval}/lib"
1858 fi
1859
1860 if test -z "$KRB4" ; then
1861 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1862 fi
1863
1864 LIBS="-lkafs $LIBS"
1865 if test ! -z "$AFS_LIBS" ; then
1866 LIBS="$LIBS $AFS_LIBS"
1867 fi
1868 AC_DEFINE(AFS)
1869 AFS_MSG="yes"
1870 fi
1871 ]
1872)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001873LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001874
Damien Millera22ba012000-03-02 23:09:20 +11001875# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001876
Damien Millerf58c6722002-05-13 13:15:42 +10001877PRIVSEP_PATH=/var/empty
1878AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07001879 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10001880 [
1881 if test "x$withval" != "$no" ; then
1882 PRIVSEP_PATH=$withval
1883 fi
1884 ]
1885)
1886AC_SUBST(PRIVSEP_PATH)
1887
Damien Millera22ba012000-03-02 23:09:20 +11001888AC_ARG_WITH(xauth,
1889 [ --with-xauth=PATH Specify path to xauth program ],
1890 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001891 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001892 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001893 fi
1894 ],
1895 [
Tim Ricee22be3b2002-07-17 19:20:07 -07001896 TestPath="$PATH"
1897 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1898 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1899 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1900 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1901 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10001902 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001903 xauth_path="/usr/openwin/bin/xauth"
1904 fi
1905 ]
1906)
1907
Damien Millera19cf472000-11-29 13:28:50 +11001908if test -z "$xauth_path" ; then
1909 XAUTH_PATH="undefined"
1910 AC_SUBST(XAUTH_PATH)
1911else
Damien Millera22ba012000-03-02 23:09:20 +11001912 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001913 XAUTH_PATH=$xauth_path
1914 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001915fi
Damien Millera22ba012000-03-02 23:09:20 +11001916
1917# Check for mail directory (last resort if we cannot get it from headers)
1918if test ! -z "$MAIL" ; then
1919 maildir=`dirname $MAIL`
1920 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1921fi
1922
Damien Millera22ba012000-03-02 23:09:20 +11001923if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001924 if test "x$disable_ptmx_check" != "xyes" ; then
1925 AC_CHECK_FILE("/dev/ptmx",
1926 [
1927 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1928 have_dev_ptmx=1
1929 ]
1930 )
1931 fi
Damien Millera22ba012000-03-02 23:09:20 +11001932fi
Damien Miller204ad072000-03-02 23:56:12 +11001933AC_CHECK_FILE("/dev/ptc",
1934 [
1935 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1936 have_dev_ptc=1
1937 ]
1938)
1939
Damien Millera22ba012000-03-02 23:09:20 +11001940# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001941AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001942 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001943 [
Damien Miller897741e2001-04-16 10:41:46 +10001944 case "$withval" in
1945 man|cat|doc)
1946 MANTYPE=$withval
1947 ;;
1948 *)
1949 AC_MSG_ERROR(invalid man type: $withval)
1950 ;;
1951 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001952 ]
1953)
Ben Lindstrombc709922001-04-18 18:04:21 +00001954if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07001955 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
1956 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00001957 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1958 MANTYPE=doc
1959 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1960 MANTYPE=man
1961 else
1962 MANTYPE=cat
1963 fi
1964fi
Damien Miller670a4b82000-01-22 13:53:11 +11001965AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001966if test "$MANTYPE" = "doc"; then
1967 mansubdir=man;
1968else
1969 mansubdir=$MANTYPE;
1970fi
1971AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001972
Damien Millera22ba012000-03-02 23:09:20 +11001973# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001974MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001975AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001976 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001977 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001978 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001979 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001980 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001981 fi
1982 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001983)
1984
Damien Millera22ba012000-03-02 23:09:20 +11001985# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001986AC_ARG_WITH(shadow,
1987 [ --without-shadow Disable shadow password support],
1988 [
1989 if test "x$withval" = "xno" ; then
1990 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001991 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001992 fi
1993 ]
1994)
1995
Damien Miller1f335fb2000-06-26 11:31:33 +10001996if test -z "$disable_shadow" ; then
1997 AC_MSG_CHECKING([if the systems has expire shadow information])
1998 AC_TRY_COMPILE(
1999 [
2000#include <sys/types.h>
2001#include <shadow.h>
2002 struct spwd sp;
2003 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2004 [ sp_expire_available=yes ], []
2005 )
2006
2007 if test "x$sp_expire_available" = "xyes" ; then
2008 AC_MSG_RESULT(yes)
2009 AC_DEFINE(HAS_SHADOW_EXPIRE)
2010 else
2011 AC_MSG_RESULT(no)
2012 fi
2013fi
2014
Damien Millera22ba012000-03-02 23:09:20 +11002015# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002016if test ! -z "$IPADDR_IN_DISPLAY" ; then
2017 DISPLAY_HACK_MSG="yes"
2018 AC_DEFINE(IPADDR_IN_DISPLAY)
2019else
2020 DISPLAY_HACK_MSG="no"
2021 AC_ARG_WITH(ipaddr-display,
2022 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2023 [
2024 if test "x$withval" != "xno" ; then
2025 AC_DEFINE(IPADDR_IN_DISPLAY)
2026 DISPLAY_HACK_MSG="yes"
2027 fi
2028 ]
2029 )
2030fi
Damien Miller76112de1999-12-21 11:18:08 +11002031
Tim Rice43a1c132002-04-17 21:19:14 -07002032dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2033if test $ac_cv_func_login_getcapbool = "yes" -a \
2034 $ac_cv_header_login_cap_h = "yes" ; then
2035 USES_LOGIN_CONF=yes
2036fi
Damien Millera22ba012000-03-02 23:09:20 +11002037# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10002038SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002039AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002040 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002041 [
Tim Rice43a1c132002-04-17 21:19:14 -07002042 if test "$USES_LOGIN_CONF" = "yes" ; then
2043 AC_MSG_WARN([
2044--with-default-path=PATH has no effect on this system.
2045Edit /etc/login.conf instead.])
2046 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08002047 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10002048 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002049 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002050 ],
Tim Rice43a1c132002-04-17 21:19:14 -07002051 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2052 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2053 else
Tim Rice59ea0a02001-03-10 13:50:45 -08002054 AC_TRY_RUN(
2055 [
2056/* find out what STDPATH is */
2057#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002058#ifdef HAVE_PATHS_H
2059# include <paths.h>
2060#endif
2061#ifndef _PATH_STDPATH
2062# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2063#endif
2064#include <sys/types.h>
2065#include <sys/stat.h>
2066#include <fcntl.h>
2067#define DATA "conftest.stdpath"
2068
2069main()
2070{
2071 FILE *fd;
2072 int rc;
2073
2074 fd = fopen(DATA,"w");
2075 if(fd == NULL)
2076 exit(1);
2077
2078 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2079 exit(1);
2080
2081 exit(0);
2082}
2083 ], [ user_path=`cat conftest.stdpath` ],
2084 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2085 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2086 )
2087# make sure $bindir is in USER_PATH so scp will work
2088 t_bindir=`eval echo ${bindir}`
2089 case $t_bindir in
2090 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2091 esac
2092 case $t_bindir in
2093 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2094 esac
2095 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2096 if test $? -ne 0 ; then
2097 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2098 if test $? -ne 0 ; then
2099 user_path=$user_path:$t_bindir
2100 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2101 fi
2102 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002103 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002104)
Tim Rice43a1c132002-04-17 21:19:14 -07002105if test "$USES_LOGIN_CONF" != "yes" ; then
2106 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2107 AC_SUBST(user_path)
2108fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002109
Damien Millera18bbd32002-05-13 10:48:57 +10002110# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002111AC_ARG_WITH(superuser-path,
2112 [ --with-superuser-path= Specify different path for super-user],
2113 [
2114 if test "x$withval" != "xno" ; then
2115 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2116 superuser_path=$withval
2117 fi
2118 ]
2119)
2120
2121
Damien Millera22ba012000-03-02 23:09:20 +11002122# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002123IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002124AC_ARG_WITH(ipv4-default,
2125 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2126 [
2127 if test "x$withval" != "xno" ; then
2128 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002129 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002130 fi
2131 ]
2132)
2133
Damien Miller61e50f12000-05-08 20:49:37 +10002134AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002135IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002136AC_ARG_WITH(4in6,
2137 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2138 [
2139 if test "x$withval" != "xno" ; then
2140 AC_MSG_RESULT(yes)
2141 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002142 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002143 else
2144 AC_MSG_RESULT(no)
2145 fi
2146 ],[
2147 if test "x$inet6_default_4in6" = "xyes"; then
2148 AC_MSG_RESULT([yes (default)])
2149 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002150 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002151 else
2152 AC_MSG_RESULT([no (default)])
2153 fi
2154 ]
2155)
2156
Damien Miller60396b02001-02-18 17:01:00 +11002157# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002158BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002159AC_ARG_WITH(bsd-auth,
2160 [ --with-bsd-auth Enable BSD auth support],
2161 [
2162 if test "x$withval" != "xno" ; then
2163 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002164 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002165 fi
2166 ]
2167)
2168
Damien Millera22ba012000-03-02 23:09:20 +11002169# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002170piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002171# make sure the directory exists
2172if test ! -d $piddir ; then
2173 piddir=`eval echo ${sysconfdir}`
2174 case $piddir in
2175 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2176 esac
2177fi
2178
Tim Rice88f2ab52002-03-17 12:17:34 -08002179AC_ARG_WITH(pid-dir,
2180 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2181 [
2182 if test "x$withval" != "xno" ; then
2183 piddir=$withval
2184 if test ! -d $piddir ; then
2185 AC_MSG_WARN([** no $piddir directory on this system **])
2186 fi
2187 fi
2188 ]
2189)
2190
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002191AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002192AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002193
andre2ff7b5d2000-06-03 14:57:40 +00002194dnl allow user to disable some login recording features
2195AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002196 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002197 [ AC_DEFINE(DISABLE_LASTLOG) ]
2198)
2199AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002200 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002201 [ AC_DEFINE(DISABLE_UTMP) ]
2202)
2203AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002204 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002205 [ AC_DEFINE(DISABLE_UTMPX) ]
2206)
2207AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002208 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002209 [ AC_DEFINE(DISABLE_WTMP) ]
2210)
2211AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002212 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002213 [ AC_DEFINE(DISABLE_WTMPX) ]
2214)
2215AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002216 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002217 [ AC_DEFINE(DISABLE_LOGIN) ]
2218)
2219AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002220 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002221 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2222)
2223AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002224 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002225 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2226)
2227AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002228 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002229 [
2230 if test "x$withval" = "xno" ; then
2231 AC_DEFINE(DISABLE_LASTLOG)
2232 else
2233 conf_lastlog_location=$withval
2234 fi
2235 ]
2236)
andre2ff7b5d2000-06-03 14:57:40 +00002237
2238dnl lastlog, [uw]tmpx? detection
2239dnl NOTE: set the paths in the platform section to avoid the
2240dnl need for command-line parameters
2241dnl lastlog and [uw]tmp are subject to a file search if all else fails
2242
2243dnl lastlog detection
2244dnl NOTE: the code itself will detect if lastlog is a directory
2245AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2246AC_TRY_COMPILE([
2247#include <sys/types.h>
2248#include <utmp.h>
2249#ifdef HAVE_LASTLOG_H
2250# include <lastlog.h>
2251#endif
Damien Miller2994e082000-06-04 15:51:47 +10002252#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002253# include <paths.h>
2254#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002255#ifdef HAVE_LOGIN_H
2256# include <login.h>
2257#endif
andre2ff7b5d2000-06-03 14:57:40 +00002258 ],
2259 [ char *lastlog = LASTLOG_FILE; ],
2260 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002261 [
2262 AC_MSG_RESULT(no)
2263 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2264 AC_TRY_COMPILE([
2265#include <sys/types.h>
2266#include <utmp.h>
2267#ifdef HAVE_LASTLOG_H
2268# include <lastlog.h>
2269#endif
2270#ifdef HAVE_PATHS_H
2271# include <paths.h>
2272#endif
2273 ],
2274 [ char *lastlog = _PATH_LASTLOG; ],
2275 [ AC_MSG_RESULT(yes) ],
2276 [
andree441aa32000-06-12 22:34:38 +00002277 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002278 system_lastlog_path=no
2279 ])
2280 ]
andre2ff7b5d2000-06-03 14:57:40 +00002281)
Damien Miller2994e082000-06-04 15:51:47 +10002282
andre2ff7b5d2000-06-03 14:57:40 +00002283if test -z "$conf_lastlog_location"; then
2284 if test x"$system_lastlog_path" = x"no" ; then
2285 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002286 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002287 conf_lastlog_location=$f
2288 fi
2289 done
2290 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002291 AC_MSG_WARN([** Cannot find lastlog **])
2292 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002293 fi
2294 fi
2295fi
2296
2297if test -n "$conf_lastlog_location"; then
2298 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2299fi
2300
2301dnl utmp detection
2302AC_MSG_CHECKING([if your system defines UTMP_FILE])
2303AC_TRY_COMPILE([
2304#include <sys/types.h>
2305#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002306#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002307# include <paths.h>
2308#endif
2309 ],
2310 [ char *utmp = UTMP_FILE; ],
2311 [ AC_MSG_RESULT(yes) ],
2312 [ AC_MSG_RESULT(no)
2313 system_utmp_path=no ]
2314)
2315if test -z "$conf_utmp_location"; then
2316 if test x"$system_utmp_path" = x"no" ; then
2317 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2318 if test -f $f ; then
2319 conf_utmp_location=$f
2320 fi
2321 done
2322 if test -z "$conf_utmp_location"; then
2323 AC_DEFINE(DISABLE_UTMP)
2324 fi
2325 fi
2326fi
2327if test -n "$conf_utmp_location"; then
2328 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2329fi
2330
2331dnl wtmp detection
2332AC_MSG_CHECKING([if your system defines WTMP_FILE])
2333AC_TRY_COMPILE([
2334#include <sys/types.h>
2335#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002336#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002337# include <paths.h>
2338#endif
2339 ],
2340 [ char *wtmp = WTMP_FILE; ],
2341 [ AC_MSG_RESULT(yes) ],
2342 [ AC_MSG_RESULT(no)
2343 system_wtmp_path=no ]
2344)
2345if test -z "$conf_wtmp_location"; then
2346 if test x"$system_wtmp_path" = x"no" ; then
2347 for f in /usr/adm/wtmp /var/log/wtmp; do
2348 if test -f $f ; then
2349 conf_wtmp_location=$f
2350 fi
2351 done
2352 if test -z "$conf_wtmp_location"; then
2353 AC_DEFINE(DISABLE_WTMP)
2354 fi
2355 fi
2356fi
2357if test -n "$conf_wtmp_location"; then
2358 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2359fi
2360
2361
2362dnl utmpx detection - I don't know any system so perverse as to require
2363dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2364dnl there, though.
2365AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2366AC_TRY_COMPILE([
2367#include <sys/types.h>
2368#include <utmp.h>
2369#ifdef HAVE_UTMPX_H
2370#include <utmpx.h>
2371#endif
Damien Miller2994e082000-06-04 15:51:47 +10002372#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002373# include <paths.h>
2374#endif
2375 ],
2376 [ char *utmpx = UTMPX_FILE; ],
2377 [ AC_MSG_RESULT(yes) ],
2378 [ AC_MSG_RESULT(no)
2379 system_utmpx_path=no ]
2380)
2381if test -z "$conf_utmpx_location"; then
2382 if test x"$system_utmpx_path" = x"no" ; then
2383 AC_DEFINE(DISABLE_UTMPX)
2384 fi
2385else
2386 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2387fi
2388
2389dnl wtmpx detection
2390AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2391AC_TRY_COMPILE([
2392#include <sys/types.h>
2393#include <utmp.h>
2394#ifdef HAVE_UTMPX_H
2395#include <utmpx.h>
2396#endif
Damien Miller2994e082000-06-04 15:51:47 +10002397#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002398# include <paths.h>
2399#endif
2400 ],
2401 [ char *wtmpx = WTMPX_FILE; ],
2402 [ AC_MSG_RESULT(yes) ],
2403 [ AC_MSG_RESULT(no)
2404 system_wtmpx_path=no ]
2405)
2406if test -z "$conf_wtmpx_location"; then
2407 if test x"$system_wtmpx_path" = x"no" ; then
2408 AC_DEFINE(DISABLE_WTMPX)
2409 fi
2410else
2411 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2412fi
2413
Damien Miller4018c192000-04-30 09:30:44 +10002414
Damien Miller29ea30d2000-03-17 10:54:15 +11002415if test ! -z "$blibpath" ; then
2416 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2417 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2418fi
2419
Tim Rice4cec93f2002-02-26 08:40:48 -08002420dnl remove pam and dl because they are in $LIBPAM
2421if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002422 LIBS=`echo $LIBS | sed 's/-lpam //'`
2423fi
2424if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2425 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002426fi
2427
Damien Millerbac2d8a2000-09-05 16:13:06 +11002428AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002429AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2430AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002431
Damien Miller7b22d652000-06-18 14:07:04 +10002432# Print summary of options
2433
Damien Miller7b22d652000-06-18 14:07:04 +10002434# Someone please show me a better way :)
2435A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2436B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2437C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2438D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002439E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002440F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002441G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002442H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2443I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2444J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002445
2446echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002447echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002448echo " User binaries: $B"
2449echo " System binaries: $C"
2450echo " Configuration files: $D"
2451echo " Askpass program: $E"
2452echo " Manual pages: $F"
2453echo " PID file: $G"
2454echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002455if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002456echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002457else
Damien Millerf58c6722002-05-13 13:15:42 +10002458echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002459fi
Damien Millera18bbd32002-05-13 10:48:57 +10002460if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002461echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002462fi
Damien Millerf58c6722002-05-13 13:15:42 +10002463echo " Manpage format: $MANTYPE"
2464echo " PAM support: ${PAM_MSG}"
2465echo " KerberosIV support: $KRB4_MSG"
2466echo " KerberosV support: $KRB5_MSG"
2467echo " Smartcard support: $SCARD_MSG"
2468echo " AFS support: $AFS_MSG"
2469echo " S/KEY support: $SKEY_MSG"
2470echo " TCP Wrappers support: $TCPW_MSG"
2471echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002472echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002473echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2474echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2475echo " BSD Auth support: $BSD_AUTH_MSG"
2476echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002477if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002478echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002479fi
2480
Damien Miller7b22d652000-06-18 14:07:04 +10002481echo ""
2482
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002483echo " Host: ${host}"
2484echo " Compiler: ${CC}"
2485echo " Compiler flags: ${CFLAGS}"
2486echo "Preprocessor flags: ${CPPFLAGS}"
2487echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002488echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002489
2490echo ""
2491
Damien Miller82cf0ce2000-12-20 13:34:48 +11002492if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002493 echo "PAM is enabled. You may need to install a PAM control file "
2494 echo "for sshd, otherwise password authentication may fail. "
2495 echo "Example PAM control files can be found in the contrib/ "
2496 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002497 echo ""
2498fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002499
2500if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002501 echo "sftp-server will be disabled. Your compiler does not "
2502 echo "support 64bit integers."
2503 echo ""
2504fi
2505
2506if test ! -z "$RAND_HELPER_CMDHASH" ; then
2507 echo "WARNING: you are using the builtin random number collection "
2508 echo "service. Please read WARNING.RNG and request that your OS "
2509 echo "vendor includes kernel-based random number collection in "
2510 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002511 echo ""
2512fi
Damien Miller60396b02001-02-18 17:01:00 +11002513