blob: d29091e9ec2bbf71f1d4d140c00d92557222e06f [file] [log] [blame]
Damien Millerd3f6ad22002-06-25 10:24:47 +10001# $Id: configure.ac,v 1.70 2002/06/25 00:24:48 djm 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 Miller78315eb2000-09-29 23:01:36 +110020AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110021AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070024AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110025
Damien Millere8bb4502001-09-25 16:39:35 +100026# System features
27AC_SYS_LARGEFILE
28
Damien Miller3f62aba2000-11-29 11:56:35 +110029if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
31fi
32
Damien Millerad833b32000-08-23 10:46:23 +100033# Use LOGIN_PROGRAM from environment if possible
34if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
36else
37 # Search for login
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
41 fi
42fi
43
Damien Miller166bd442000-03-16 10:48:25 +110044if test -z "$LD" ; then
45 LD=$CC
46fi
47AC_SUBST(LD)
48
Damien Miller166bd442000-03-16 10:48:25 +110049AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100050if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110052fi
53
Damien Millera22ba012000-03-02 23:09:20 +110054# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110055case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110056*-*-aix*)
57 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000058 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110059 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100060 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100061 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
62 saved_LDFLAGS="$LDFLAGS"
63 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
64 AC_TRY_LINK([],
65 [],
66 [
67 AC_MSG_RESULT(yes)
68 blibpath="/usr/lib:/lib:/usr/local/lib"
69 ],
70 [ AC_MSG_RESULT(no) ]
71 )
72 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110073 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100074 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110075 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100076 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000077 dnl AIX handles lastlog as part of its login message
78 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +000079 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller75b1d102000-01-07 14:01:41 +110080 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110081*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080082 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110083 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000084 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110085 AC_DEFINE(DISABLE_SHADOW)
86 AC_DEFINE(IPV4_DEFAULT)
87 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000088 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom837461b2002-06-12 16:57:14 +000089 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +110090 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000091*-*-dgux*)
92 AC_DEFINE(IP_TOS_IS_BROKEN)
93 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000094*-*-darwin*)
95 AC_DEFINE(BROKEN_GETADDRINFO)
96 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +000097*-*-hpux10.26)
98 if test -z "$GCC"; then
99 CFLAGS="$CFLAGS -Ae"
100 fi
101 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
102 IPADDR_IN_DISPLAY=yes
103 AC_DEFINE(HAVE_SECUREWARE)
104 AC_DEFINE(USE_PIPES)
105 AC_DEFINE(LOGIN_NO_ENDOPT)
106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
107 AC_DEFINE(DISABLE_SHADOW)
108 AC_DEFINE(DISABLE_UTMP)
109 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
110 LIBS="$LIBS -lxnet -lsec -lsecpw"
111 disable_ptmx_check=yes
112 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100113*-*-hpux10*)
114 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000115 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100116 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000117 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100118 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000119 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000120 AC_DEFINE(LOGIN_NO_ENDOPT)
121 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100122 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100123 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000124 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +0000125 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +1100126 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000127*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000128 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100129 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100130 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100131 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000132 AC_DEFINE(LOGIN_NO_ENDOPT)
133 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100134 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100135 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000136 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000137 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000138 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100139*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000140 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000141 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100142 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000143 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000144 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100145 ;;
146*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000147 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000148 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100149 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000150 AC_DEFINE(WITH_IRIX_ARRAY)
151 AC_DEFINE(WITH_IRIX_PROJECT)
152 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000153 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000154 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000155 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100156 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100157*-*-linux*)
158 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100159 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100160 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000161 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100162 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100163 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000164mips-sony-bsd|mips-sony-newsos4)
165 AC_DEFINE(HAVE_NEWS4)
166 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000167 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100168*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100169 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100170 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100171*-*-freebsd*)
172 check_for_libcrypt_later=1
173 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000174*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000175 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100176 conf_utmp_location=/etc/utmp
177 conf_wtmp_location=/usr/adm/wtmp
178 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000179 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000180 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000181 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100182 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000183 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000184 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000185 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100186*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000187 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000188 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100189 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100190 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
192 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000193 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000194 # hardwire lastlog location (can't detect it on some versions)
195 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000196 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
197 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
198 if test "$sol2ver" -ge 8; then
199 AC_MSG_RESULT(yes)
200 AC_DEFINE(DISABLE_UTMP)
201 AC_DEFINE(DISABLE_WTMP)
202 else
203 AC_MSG_RESULT(no)
204 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100205 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000206*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000207 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000208 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100209 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000210 conf_utmp_location=/etc/utmp
211 conf_wtmp_location=/var/adm/wtmp
212 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000213 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000214 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000215*-ncr-sysv*)
216 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
217 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700218 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000219 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000220 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000221*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000222 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700223 # /usr/ucblib MUST NOT be searched on ReliantUNIX
224 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100225 IPADDR_IN_DISPLAY=yes
226 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000227 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700228 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
229 # Attention: always take care to bind libsocket and libnsl before libc,
230 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000231 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100232*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000233 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100234 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100235 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100236 ;;
237*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000238 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100239 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100240 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100241 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100242*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000243 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100244 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100245 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100246*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000247 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100248 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700249 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100250 RANLIB=true
251 no_dev_ptmx=1
252 AC_DEFINE(BROKEN_SYS_TERMIO_H)
253 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000254 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000255 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100256 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100257 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700258 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700259 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100260 ;;
261*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000262 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000263 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100264 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000265 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100266 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000267 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000268 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100269 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700270 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000271 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000272*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700273 no_libsocket=1
274 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000275 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700276 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
277 LIBS="$LIBS -lgen -lrsc"
278 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000279*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000280 AC_MSG_CHECKING(for Digital Unix SIA)
281 no_osfsia=""
282 AC_ARG_WITH(osfsia,
283 [ --with-osfsia Enable Digital Unix SIA],
284 [
285 if test "x$withval" = "xno" ; then
286 AC_MSG_RESULT(disabled)
287 no_osfsia=1
288 fi
289 ],
290 )
291 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000292 if test -f /etc/sia/matrix.conf; then
293 AC_MSG_RESULT(yes)
294 AC_DEFINE(HAVE_OSF_SIA)
295 AC_DEFINE(DISABLE_LOGIN)
296 LIBS="$LIBS -lsecurity -ldb -lm -laud"
297 else
298 AC_MSG_RESULT(no)
299 fi
300 fi
301 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000302
303*-*-nto-qnx)
304 AC_DEFINE(USE_PIPES)
305 AC_DEFINE(NO_X11_UNIX_SOCKETS)
306 AC_DEFINE(MISSING_NFDBITS)
307 AC_DEFINE(MISSING_HOWMANY)
308 AC_DEFINE(MISSING_FD_MASK)
309 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100310esac
311
Damien Millere37bfc12000-06-05 09:37:43 +1000312# Allow user to specify flags
313AC_ARG_WITH(cflags,
314 [ --with-cflags Specify additional flags to pass to compiler],
315 [
316 if test "x$withval" != "xno" ; then
317 CFLAGS="$CFLAGS $withval"
318 fi
319 ]
320)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000321AC_ARG_WITH(cppflags,
322 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
323 [
324 if test "x$withval" != "xno"; then
325 CPPFLAGS="$CPPFLAGS $withval"
326 fi
327 ]
328)
Damien Millere37bfc12000-06-05 09:37:43 +1000329AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000330 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000331 [
332 if test "x$withval" != "xno" ; then
333 LDFLAGS="$LDFLAGS $withval"
334 fi
335 ]
336)
337AC_ARG_WITH(libs,
338 [ --with-libs Specify additional libraries to link with],
339 [
340 if test "x$withval" != "xno" ; then
341 LIBS="$LIBS $withval"
342 fi
343 ]
344)
345
Tim Rice4cec93f2002-02-26 08:40:48 -0800346# Checks for header files.
347AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
348 getopt.h glob.h lastlog.h limits.h login.h \
349 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000350 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000351 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800352 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000353 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800354 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000355 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800356 util.h utime.h utmp.h utmpx.h)
357
Damien Millera22ba012000-03-02 23:09:20 +1100358# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700359AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
360AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000361
Damien Millerdf288022001-02-18 13:07:07 +1100362dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700363if test "x$with_tcp_wrappers" != "xno" ; then
364 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
365 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
366 fi
367fi
Damien Millerdf288022001-02-18 13:07:07 +1100368
Tim Rice13aae5e2001-10-21 17:53:58 -0700369AC_CHECK_FUNC(getspnam, ,
370 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700371
Damien Miller150c8b52002-02-13 23:06:56 +1100372AC_ARG_WITH(rpath,
373 [ --without-rpath Disable auto-added -R linker paths],
374 [
375 if test "x$withval" = "xno" ; then
376 need_dash_r=""
377 fi
378 if test "x$withval" = "xyes" ; then
379 need_dash_r=1
380 fi
381 ]
382)
383
Tim Rice13aae5e2001-10-21 17:53:58 -0700384dnl zlib is required
385AC_ARG_WITH(zlib,
386 [ --with-zlib=PATH Use zlib in PATH],
387 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000388 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100389 AC_MSG_ERROR([*** zlib is required ***])
390 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700391 if test -d "$withval/lib"; then
392 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700393 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700394 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700395 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700396 fi
397 else
398 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700399 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700400 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700401 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700402 fi
403 fi
404 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700405 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700406 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700407 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700408 fi
409 ]
410)
411
Tim Rice17b93e52001-10-23 22:36:54 -0700412AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100413
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000414dnl UnixWare 2.x
415AC_CHECK_FUNC(strcasecmp,
416 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
417)
418AC_CHECK_FUNC(utimes,
419 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
420)
Damien Millerab18c411999-11-11 10:40:23 +1100421
Tim Ricee589a292001-11-03 11:09:32 -0800422dnl Checks for libutil functions
423AC_CHECK_HEADERS(libutil.h)
424AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
425AC_CHECK_FUNCS(logout updwtmp logwtmp)
426
Ben Lindstrom8697e082001-02-24 21:41:10 +0000427AC_FUNC_STRFTIME
428
Damien Miller3c027682001-03-14 11:39:45 +1100429# Check for ALTDIRFUNC glob() extension
430AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
431AC_EGREP_CPP(FOUNDIT,
432 [
433 #include <glob.h>
434 #ifdef GLOB_ALTDIRFUNC
435 FOUNDIT
436 #endif
437 ],
438 [
439 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
440 AC_MSG_RESULT(yes)
441 ],
442 [
443 AC_MSG_RESULT(no)
444 ]
445)
Damien Millerab18c411999-11-11 10:40:23 +1100446
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000447# Check for g.gl_matchc glob() extension
448AC_MSG_CHECKING(for gl_matchc field in glob_t)
449AC_EGREP_CPP(FOUNDIT,
450 [
451 #include <glob.h>
452 int main(void){glob_t g; g.gl_matchc = 1;}
453 ],
454 [
455 AC_DEFINE(GLOB_HAS_GL_MATCHC)
456 AC_MSG_RESULT(yes)
457 ],
458 [
459 AC_MSG_RESULT(no)
460 ]
461)
462
Damien Miller18bb4732001-03-28 14:35:30 +1000463AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
464AC_TRY_RUN(
465 [
466#include <sys/types.h>
467#include <dirent.h>
468int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
469 ],
470 [AC_MSG_RESULT(yes)],
471 [
472 AC_MSG_RESULT(no)
473 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
474 ]
475)
476
Damien Millerc547bf12001-02-16 10:18:12 +1100477# Check whether user wants S/Key support
478SKEY_MSG="no"
479AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700480 [ --with-skey[[=PATH]] Enable S/Key support
481 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100482 [
483 if test "x$withval" != "xno" ; then
484
485 if test "x$withval" != "xyes" ; then
486 CPPFLAGS="$CPPFLAGS -I${withval}/include"
487 LDFLAGS="$LDFLAGS -L${withval}/lib"
488 fi
489
490 AC_DEFINE(SKEY)
491 LIBS="-lskey $LIBS"
492 SKEY_MSG="yes"
493
Tim Rice4cec93f2002-02-26 08:40:48 -0800494 AC_MSG_CHECKING([for s/key support])
495 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100496 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800497#include <stdio.h>
498#include <skey.h>
499int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
500 ],
501 [AC_MSG_RESULT(yes)],
502 [
503 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100504 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
505 ])
506 fi
507 ]
508)
509
510# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700511TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100512AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700513 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
514 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100515 [
516 if test "x$withval" != "xno" ; then
517 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700518 saved_LDFLAGS="$LDFLAGS"
519 saved_CPPFLAGS="$CPPFLAGS"
520 if test -n "${withval}" -a "${withval}" != "yes"; then
521 if test -d "${withval}/lib"; then
522 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700523 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700524 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700525 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700526 fi
527 else
528 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700529 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700530 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700531 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700532 fi
533 fi
534 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700535 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700536 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700537 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700538 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700539 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800540 LIBWRAP="-lwrap"
541 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100542 AC_MSG_CHECKING(for libwrap)
543 AC_TRY_LINK(
544 [
545#include <tcpd.h>
546 int deny_severity = 0, allow_severity = 0;
547 ],
548 [hosts_access(0);],
549 [
550 AC_MSG_RESULT(yes)
551 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800552 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700553 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100554 ],
555 [
556 AC_MSG_ERROR([*** libwrap missing])
557 ]
558 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800559 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100560 fi
561 ]
562)
563
Damien Millerad833b32000-08-23 10:46:23 +1000564dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000565AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700566 clock fchmod fchown freeaddrinfo futimes gai_strerror \
567 getaddrinfo getcwd getgrouplist getnameinfo getopt \
568 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
569 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000570 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
571 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000572 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000573 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
574 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
575 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700576
577dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700578AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700579 AC_CHECK_LIB(gen, dirname,[
580 AC_CACHE_CHECK([for broken dirname],
581 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700582 save_LIBS="$LIBS"
583 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700584 AC_TRY_RUN(
585 [
586#include <libgen.h>
587#include <string.h>
588
589int main(int argc, char **argv) {
590 char *s, buf[32];
591
592 strncpy(buf,"/etc", 32);
593 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700594 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700595 exit(1);
596 } else {
597 exit(0);
598 }
599}
600 ],
601 [ ac_cv_have_broken_dirname="no" ],
602 [ ac_cv_have_broken_dirname="yes" ]
603 )
Tim Rice17b93e52001-10-23 22:36:54 -0700604 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700605 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700606 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 LIBS="$LIBS -lgen"
608 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700609 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 fi
611 ])
612])
613
Damien Millerad833b32000-08-23 10:46:23 +1000614dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000615AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000616dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000617AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000618AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000619dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000620AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000621AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100622
Damien Miller04f80141999-11-19 15:32:34 +1100623AC_CHECK_FUNC(daemon,
624 [AC_DEFINE(HAVE_DAEMON)],
625 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
626)
627
Damien Miller9fb07e42000-03-05 16:22:59 +1100628AC_CHECK_FUNC(getpagesize,
629 [AC_DEFINE(HAVE_GETPAGESIZE)],
630 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
631)
632
Damien Millercb170cb2000-07-01 16:52:55 +1000633# Check for broken snprintf
634if test "x$ac_cv_func_snprintf" = "xyes" ; then
635 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
636 AC_TRY_RUN(
637 [
638#include <stdio.h>
639int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
640 ],
641 [AC_MSG_RESULT(yes)],
642 [
643 AC_MSG_RESULT(no)
644 AC_DEFINE(BROKEN_SNPRINTF)
645 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
646 ]
647 )
648fi
649
Damien Miller606f8802000-09-16 15:39:56 +1100650AC_FUNC_GETPGRP
651
Damien Millera64b57a2001-01-17 10:44:13 +1100652# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000653PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100654AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100655 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100656 [
Damien Millera64b57a2001-01-17 10:44:13 +1100657 if test "x$withval" != "xno" ; then
658 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
659 AC_MSG_ERROR([PAM headers not found])
660 fi
661
662 AC_CHECK_LIB(dl, dlopen, , )
663 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
664 AC_CHECK_FUNCS(pam_getenvlist)
665
666 disable_shadow=yes
667 PAM_MSG="yes"
668
669 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800670 if test $ac_cv_lib_dl_dlopen = yes; then
671 LIBPAM="-lpam -ldl"
672 else
673 LIBPAM="-lpam"
674 fi
675 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100676 fi
677 ]
678)
Damien Millera22ba012000-03-02 23:09:20 +1100679
Damien Millera64b57a2001-01-17 10:44:13 +1100680# Check for older PAM
681if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100682 # Check PAM strerror arguments (old PAM)
683 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
684 AC_TRY_COMPILE(
685 [
Damien Miller81171112000-04-23 11:14:01 +1000686#include <stdlib.h>
687#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100688 ],
689 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
690 [AC_MSG_RESULT(no)],
691 [
692 AC_DEFINE(HAVE_OLD_PAM)
693 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000694 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100695 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100696 )
Damien Millera22ba012000-03-02 23:09:20 +1100697fi
698
Tim Riceaef73712002-05-11 13:17:42 -0700699# Search for OpenSSL
700saved_CPPFLAGS="$CPPFLAGS"
701saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100702AC_ARG_WITH(ssl-dir,
703 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
704 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000705 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700706 if test -d "$withval/lib"; then
707 if test -n "${need_dash_r}"; then
708 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
709 else
710 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
711 fi
712 else
713 if test -n "${need_dash_r}"; then
714 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
715 else
716 LDFLAGS="-L${withval} ${LDFLAGS}"
717 fi
718 fi
719 if test -d "$withval/include"; then
720 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
721 else
722 CPPFLAGS="-I${withval} ${CPPFLAGS}"
723 fi
Damien Millera22ba012000-03-02 23:09:20 +1100724 fi
725 ]
726)
Tim Riceaef73712002-05-11 13:17:42 -0700727LIBS="$LIBS -lcrypto"
728AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000729 [
Tim Riceaef73712002-05-11 13:17:42 -0700730 dnl Check default openssl install dir
731 if test -n "${need_dash_r}"; then
732 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000733 else
Tim Riceaef73712002-05-11 13:17:42 -0700734 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000735 fi
Tim Riceaef73712002-05-11 13:17:42 -0700736 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
737 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
738 [
739 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
740 ]
741 )
742 ]
743)
744
Damien Millera22ba012000-03-02 23:09:20 +1100745
Damien Millerec932372002-01-22 22:16:03 +1100746# Sanity check OpenSSL headers
747AC_MSG_CHECKING([whether OpenSSL's headers match the library])
748AC_TRY_RUN(
749 [
750#include <string.h>
751#include <openssl/opensslv.h>
752int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
753 ],
754 [
755 AC_MSG_RESULT(yes)
756 ],
757 [
758 AC_MSG_RESULT(no)
759 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
760 ]
761)
762
Damien Millera64b57a2001-01-17 10:44:13 +1100763# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
764# version in OpenSSL. Skip this for PAM
765if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100766 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100767fi
768
Damien Miller6c21c512002-01-22 21:57:53 +1100769
770### Configure cryptographic random number support
771
772# Check wheter OpenSSL seeds itself
773AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
774AC_TRY_RUN(
775 [
776#include <string.h>
777#include <openssl/rand.h>
778int main(void) { return(RAND_status() == 1 ? 0 : 1); }
779 ],
780 [
781 OPENSSL_SEEDS_ITSELF=yes
782 AC_MSG_RESULT(yes)
783 ],
784 [
785 AC_MSG_RESULT(no)
786 # Default to use of the rand helper if OpenSSL doesn't
787 # seed itself
788 USE_RAND_HELPER=yes
789 ]
790)
791
792
793# Do we want to force the use of the rand helper?
794AC_ARG_WITH(rand-helper,
795 [ --with-rand-helper Use subprocess to gather strong randomness ],
796 [
797 if test "x$withval" = "xno" ; then
798 # Force use of OpenSSL's internal RNG, even if
799 # the previous test showed it to be unseeded.
800 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
801 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
802 OPENSSL_SEEDS_ITSELF=yes
803 USE_RAND_HELPER=""
804 fi
805 else
806 USE_RAND_HELPER=yes
807 fi
808 ],
809)
810
811# Which randomness source do we use?
812if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
813 # OpenSSL only
814 AC_DEFINE(OPENSSL_PRNG_ONLY)
815 RAND_MSG="OpenSSL internal ONLY"
816 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800817elif test ! -z "$USE_RAND_HELPER" ; then
818 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100819 RAND_MSG="ssh-rand-helper"
820 INSTALL_SSH_RAND_HELPER="yes"
821fi
822AC_SUBST(INSTALL_SSH_RAND_HELPER)
823
824### Configuration of ssh-rand-helper
825
826# PRNGD TCP socket
827AC_ARG_WITH(prngd-port,
828 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
829 [
Damien Millere996d722002-01-23 11:20:59 +1100830 case "$withval" in
831 no)
832 withval=""
833 ;;
834 [[0-9]]*)
835 ;;
836 *)
837 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
838 ;;
839 esac
840 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100841 PRNGD_PORT="$withval"
842 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
843 fi
844 ]
845)
846
847# PRNGD Unix domain socket
848AC_ARG_WITH(prngd-socket,
849 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
850 [
Damien Millere996d722002-01-23 11:20:59 +1100851 case "$withval" in
852 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100853 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100854 ;;
855 no)
856 withval=""
857 ;;
858 /*)
859 ;;
860 *)
861 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
862 ;;
863 esac
864
865 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100866 if test ! -z "$PRNGD_PORT" ; then
867 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
868 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100869 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100870 AC_MSG_WARN(Entropy socket is not readable)
871 fi
872 PRNGD_SOCKET="$withval"
873 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
874 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800875 ],
876 [
877 # Check for existing socket only if we don't have a random device already
878 if test "$USE_RAND_HELPER" = yes ; then
879 AC_MSG_CHECKING(for PRNGD/EGD socket)
880 # Insert other locations here
881 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
882 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
883 PRNGD_SOCKET="$sock"
884 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
885 break;
886 fi
887 done
888 if test ! -z "$PRNGD_SOCKET" ; then
889 AC_MSG_RESULT($PRNGD_SOCKET)
890 else
891 AC_MSG_RESULT(not found)
892 fi
893 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100894 ]
895)
896
897# Change default command timeout for hashing entropy source
898entropy_timeout=200
899AC_ARG_WITH(entropy-timeout,
900 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
901 [
902 if test "x$withval" != "xno" ; then
903 entropy_timeout=$withval
904 fi
905 ]
906)
Damien Miller6c21c512002-01-22 21:57:53 +1100907AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
908
Damien Millerd3f6ad22002-06-25 10:24:47 +1000909SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000910AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000911 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000912 [
913 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000914 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000915 fi
916 ]
917)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000918AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
919AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000920
Tim Rice88f2ab52002-03-17 12:17:34 -0800921# We do this little dance with the search path to insure
922# that programs that we select for use by installed programs
923# (which may be run by the super-user) come from trusted
924# locations before they come from the user's private area.
925# This should help avoid accidentally configuring some
926# random version of a program in someone's personal bin.
927
928OPATH=$PATH
929PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700930test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800931test -d /sbin && PATH=$PATH:/sbin
932test -d /usr/sbin && PATH=$PATH:/usr/sbin
933PATH=$PATH:/etc:$OPATH
934
Damien Miller6c21c512002-01-22 21:57:53 +1100935# These programs are used by the command hashing source to gather entropy
936OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
937OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
938OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
939OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
940OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
941OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
942OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
943OSSH_PATH_ENTROPY_PROG(PROG_W, w)
944OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
945OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
946OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
947OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
948OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
949OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
950OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
951OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800952# restore PATH
953PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100954
955# Where does ssh-rand-helper get its randomness from?
956INSTALL_SSH_PRNG_CMDS=""
957if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
958 if test ! -z "$PRNGD_PORT" ; then
959 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
960 elif test ! -z "$PRNGD_SOCKET" ; then
961 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
962 else
963 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
964 RAND_HELPER_CMDHASH=yes
965 INSTALL_SSH_PRNG_CMDS="yes"
966 fi
967fi
968AC_SUBST(INSTALL_SSH_PRNG_CMDS)
969
970
Ben Lindstromb5628642000-10-18 00:02:25 +0000971# Cheap hack to ensure NEWS-OS libraries are arranged right.
972if test ! -z "$SONY" ; then
973 LIBS="$LIBS -liberty";
974fi
975
Damien Millera22ba012000-03-02 23:09:20 +1100976# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100977AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100978AC_CHECK_SIZEOF(short int, 2)
979AC_CHECK_SIZEOF(int, 4)
980AC_CHECK_SIZEOF(long int, 4)
981AC_CHECK_SIZEOF(long long int, 8)
982
Damien Millerfa2bb692002-04-23 23:22:25 +1000983# Sanity check long long for some platforms (AIX)
984if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
985 ac_cv_sizeof_long_long_int=0
986fi
987
Damien Millera22ba012000-03-02 23:09:20 +1100988# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100989AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
990 AC_TRY_COMPILE(
991 [ #include <sys/types.h> ],
992 [ u_int a; a = 1;],
993 [ ac_cv_have_u_int="yes" ],
994 [ ac_cv_have_u_int="no" ]
995 )
996])
997if test "x$ac_cv_have_u_int" = "xyes" ; then
998 AC_DEFINE(HAVE_U_INT)
999 have_u_int=1
1000fi
1001
Damien Miller61e50f12000-05-08 20:49:37 +10001002AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1003 AC_TRY_COMPILE(
1004 [ #include <sys/types.h> ],
1005 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1006 [ ac_cv_have_intxx_t="yes" ],
1007 [ ac_cv_have_intxx_t="no" ]
1008 )
1009])
1010if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1011 AC_DEFINE(HAVE_INTXX_T)
1012 have_intxx_t=1
1013fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001014
1015if (test -z "$have_intxx_t" && \
1016 test "x$ac_cv_header_stdint_h" = "xyes")
1017then
1018 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1019 AC_TRY_COMPILE(
1020 [ #include <stdint.h> ],
1021 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1022 [
1023 AC_DEFINE(HAVE_INTXX_T)
1024 AC_MSG_RESULT(yes)
1025 ],
1026 [ AC_MSG_RESULT(no) ]
1027 )
1028fi
1029
Damien Miller578783e2000-09-23 14:12:24 +11001030AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1031 AC_TRY_COMPILE(
1032 [ #include <sys/types.h> ],
1033 [ int64_t a; a = 1;],
1034 [ ac_cv_have_int64_t="yes" ],
1035 [ ac_cv_have_int64_t="no" ]
1036 )
1037])
1038if test "x$ac_cv_have_int64_t" = "xyes" ; then
1039 AC_DEFINE(HAVE_INT64_T)
1040 have_int64_t=1
1041fi
1042
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001043if test -z "$have_int64_t" ; then
1044 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1045 AC_TRY_COMPILE(
1046 [ #include <sys/socket.h> ],
1047 [ int64_t a; a = 1],
1048 [
1049 AC_DEFINE(HAVE_INT64_T)
1050 AC_MSG_RESULT(yes)
1051 ],
1052 [ AC_MSG_RESULT(no) ]
1053 )
1054fi
1055
Tim Rice4cec93f2002-02-26 08:40:48 -08001056if test -z "$have_int64_t" ; then
1057 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1058 AC_TRY_COMPILE(
1059 [ #include <sys/bitypes.h> ],
1060 [ int64_t a; a = 1],
1061 [
1062 AC_DEFINE(HAVE_INT64_T)
1063 AC_MSG_RESULT(yes)
1064 ],
1065 [ AC_MSG_RESULT(no) ]
1066 )
1067fi
1068
Damien Miller61e50f12000-05-08 20:49:37 +10001069AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1070 AC_TRY_COMPILE(
1071 [ #include <sys/types.h> ],
1072 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1073 [ ac_cv_have_u_intxx_t="yes" ],
1074 [ ac_cv_have_u_intxx_t="no" ]
1075 )
1076])
1077if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1078 AC_DEFINE(HAVE_U_INTXX_T)
1079 have_u_intxx_t=1
1080fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001081
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001082if test -z "$have_u_intxx_t" ; then
1083 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1084 AC_TRY_COMPILE(
1085 [ #include <sys/socket.h> ],
1086 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1087 [
1088 AC_DEFINE(HAVE_U_INTXX_T)
1089 AC_MSG_RESULT(yes)
1090 ],
1091 [ AC_MSG_RESULT(no) ]
1092 )
1093fi
1094
Damien Miller578783e2000-09-23 14:12:24 +11001095AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1096 AC_TRY_COMPILE(
1097 [ #include <sys/types.h> ],
1098 [ u_int64_t a; a = 1;],
1099 [ ac_cv_have_u_int64_t="yes" ],
1100 [ ac_cv_have_u_int64_t="no" ]
1101 )
1102])
1103if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1104 AC_DEFINE(HAVE_U_INT64_T)
1105 have_u_int64_t=1
1106fi
1107
Tim Rice4cec93f2002-02-26 08:40:48 -08001108if test -z "$have_u_int64_t" ; then
1109 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1110 AC_TRY_COMPILE(
1111 [ #include <sys/bitypes.h> ],
1112 [ u_int64_t a; a = 1],
1113 [
1114 AC_DEFINE(HAVE_U_INT64_T)
1115 AC_MSG_RESULT(yes)
1116 ],
1117 [ AC_MSG_RESULT(no) ]
1118 )
1119fi
1120
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001121if test -z "$have_u_intxx_t" ; then
1122 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1123 AC_TRY_COMPILE(
1124 [
1125#include <sys/types.h>
1126 ],
1127 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1128 [ ac_cv_have_uintxx_t="yes" ],
1129 [ ac_cv_have_uintxx_t="no" ]
1130 )
1131 ])
1132 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1133 AC_DEFINE(HAVE_UINTXX_T)
1134 fi
1135fi
1136
1137if test -z "$have_uintxx_t" ; then
1138 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1139 AC_TRY_COMPILE(
1140 [ #include <stdint.h> ],
1141 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1142 [
1143 AC_DEFINE(HAVE_UINTXX_T)
1144 AC_MSG_RESULT(yes)
1145 ],
1146 [ AC_MSG_RESULT(no) ]
1147 )
1148fi
1149
Damien Milleredb82922000-06-20 13:25:52 +10001150if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1151 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001152then
1153 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1154 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001155 [
1156#include <sys/bitypes.h>
1157 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001158 [
Damien Miller70494d12000-04-03 15:57:06 +10001159 int8_t a; int16_t b; int32_t c;
1160 u_int8_t e; u_int16_t f; u_int32_t g;
1161 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001162 ],
1163 [
1164 AC_DEFINE(HAVE_U_INTXX_T)
1165 AC_DEFINE(HAVE_INTXX_T)
1166 AC_MSG_RESULT(yes)
1167 ],
1168 [AC_MSG_RESULT(no)]
1169 )
1170fi
1171
Damien Miller58be7382001-09-15 21:31:54 +10001172
1173AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1174 AC_TRY_COMPILE(
1175 [
1176#include <sys/types.h>
1177 ],
1178 [ u_char foo; foo = 125; ],
1179 [ ac_cv_have_u_char="yes" ],
1180 [ ac_cv_have_u_char="no" ]
1181 )
1182])
1183if test "x$ac_cv_have_u_char" = "xyes" ; then
1184 AC_DEFINE(HAVE_U_CHAR)
1185fi
1186
Tim Rice13aae5e2001-10-21 17:53:58 -07001187TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001188
Tim Rice200a5c02002-02-26 22:12:34 -08001189AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001190
Damien Miller61e50f12000-05-08 20:49:37 +10001191AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1192 AC_TRY_COMPILE(
1193 [
1194#include <sys/types.h>
1195 ],
1196 [ size_t foo; foo = 1235; ],
1197 [ ac_cv_have_size_t="yes" ],
1198 [ ac_cv_have_size_t="no" ]
1199 )
1200])
1201if test "x$ac_cv_have_size_t" = "xyes" ; then
1202 AC_DEFINE(HAVE_SIZE_T)
1203fi
Damien Miller95058511999-12-29 10:36:45 +11001204
Damien Miller615f9392000-05-17 22:53:33 +10001205AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1206 AC_TRY_COMPILE(
1207 [
1208#include <sys/types.h>
1209 ],
1210 [ ssize_t foo; foo = 1235; ],
1211 [ ac_cv_have_ssize_t="yes" ],
1212 [ ac_cv_have_ssize_t="no" ]
1213 )
1214])
1215if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1216 AC_DEFINE(HAVE_SSIZE_T)
1217fi
1218
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001219AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1220 AC_TRY_COMPILE(
1221 [
1222#include <time.h>
1223 ],
1224 [ clock_t foo; foo = 1235; ],
1225 [ ac_cv_have_clock_t="yes" ],
1226 [ ac_cv_have_clock_t="no" ]
1227 )
1228])
1229if test "x$ac_cv_have_clock_t" = "xyes" ; then
1230 AC_DEFINE(HAVE_CLOCK_T)
1231fi
1232
Damien Millerb54b40e2000-06-23 08:23:34 +10001233AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1234 AC_TRY_COMPILE(
1235 [
1236#include <sys/types.h>
1237#include <sys/socket.h>
1238 ],
1239 [ sa_family_t foo; foo = 1235; ],
1240 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001241 [ AC_TRY_COMPILE(
1242 [
1243#include <sys/types.h>
1244#include <sys/socket.h>
1245#include <netinet/in.h>
1246 ],
1247 [ sa_family_t foo; foo = 1235; ],
1248 [ ac_cv_have_sa_family_t="yes" ],
1249
Damien Millerb54b40e2000-06-23 08:23:34 +10001250 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001251 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001252 )
1253])
1254if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1255 AC_DEFINE(HAVE_SA_FAMILY_T)
1256fi
1257
Damien Miller0f91b4e2000-06-18 15:43:25 +10001258AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1259 AC_TRY_COMPILE(
1260 [
1261#include <sys/types.h>
1262 ],
1263 [ pid_t foo; foo = 1235; ],
1264 [ ac_cv_have_pid_t="yes" ],
1265 [ ac_cv_have_pid_t="no" ]
1266 )
1267])
1268if test "x$ac_cv_have_pid_t" = "xyes" ; then
1269 AC_DEFINE(HAVE_PID_T)
1270fi
1271
1272AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1273 AC_TRY_COMPILE(
1274 [
1275#include <sys/types.h>
1276 ],
1277 [ mode_t foo; foo = 1235; ],
1278 [ ac_cv_have_mode_t="yes" ],
1279 [ ac_cv_have_mode_t="no" ]
1280 )
1281])
1282if test "x$ac_cv_have_mode_t" = "xyes" ; then
1283 AC_DEFINE(HAVE_MODE_T)
1284fi
1285
Damien Miller61e50f12000-05-08 20:49:37 +10001286
1287AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1288 AC_TRY_COMPILE(
1289 [
Damien Miller81171112000-04-23 11:14:01 +10001290#include <sys/types.h>
1291#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001292 ],
1293 [ struct sockaddr_storage s; ],
1294 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1295 [ ac_cv_have_struct_sockaddr_storage="no" ]
1296 )
1297])
1298if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1299 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1300fi
Damien Miller34132e52000-01-14 15:45:46 +11001301
Damien Miller61e50f12000-05-08 20:49:37 +10001302AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1303 AC_TRY_COMPILE(
1304 [
Damien Miller7b22d652000-06-18 14:07:04 +10001305#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001306#include <netinet/in.h>
1307 ],
1308 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1309 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1310 [ ac_cv_have_struct_sockaddr_in6="no" ]
1311 )
1312])
1313if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1314 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1315fi
Damien Miller34132e52000-01-14 15:45:46 +11001316
Damien Miller61e50f12000-05-08 20:49:37 +10001317AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1318 AC_TRY_COMPILE(
1319 [
Damien Miller7b22d652000-06-18 14:07:04 +10001320#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001321#include <netinet/in.h>
1322 ],
1323 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1324 [ ac_cv_have_struct_in6_addr="yes" ],
1325 [ ac_cv_have_struct_in6_addr="no" ]
1326 )
1327])
1328if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1329 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1330fi
Damien Miller34132e52000-01-14 15:45:46 +11001331
Damien Miller61e50f12000-05-08 20:49:37 +10001332AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1333 AC_TRY_COMPILE(
1334 [
Damien Miller81171112000-04-23 11:14:01 +10001335#include <sys/types.h>
1336#include <sys/socket.h>
1337#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001338 ],
1339 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1340 [ ac_cv_have_struct_addrinfo="yes" ],
1341 [ ac_cv_have_struct_addrinfo="no" ]
1342 )
1343])
1344if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1345 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1346fi
1347
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001348AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1349 AC_TRY_COMPILE(
1350 [ #include <sys/time.h> ],
1351 [ struct timeval tv; tv.tv_sec = 1;],
1352 [ ac_cv_have_struct_timeval="yes" ],
1353 [ ac_cv_have_struct_timeval="no" ]
1354 )
1355])
1356if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1357 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1358 have_struct_timeval=1
1359fi
1360
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001361# If we don't have int64_t then we can't compile sftp-server. So don't
1362# even attempt to do it.
1363if test "x$ac_cv_have_int64_t" = "xno" -a \
1364 "x$ac_cv_sizeof_long_int" != "x8" -a \
1365 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1366 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001367else
1368dnl test snprintf (broken on SCO w/gcc)
1369 AC_TRY_RUN(
1370 [
1371#include <stdio.h>
1372#include <string.h>
1373#ifdef HAVE_SNPRINTF
1374main()
1375{
1376 char buf[50];
1377 char expected_out[50];
1378 int mazsize = 50 ;
1379#if (SIZEOF_LONG_INT == 8)
1380 long int num = 0x7fffffffffffffff;
1381#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001382 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001383#endif
1384 strcpy(expected_out, "9223372036854775807");
1385 snprintf(buf, mazsize, "%lld", num);
1386 if(strcmp(buf, expected_out) != 0)
1387 exit(1);
1388 exit(0);
1389}
1390#else
1391main() { exit(0); }
1392#endif
1393 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1394 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001395fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001396AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001397
Damien Miller78315eb2000-09-29 23:01:36 +11001398dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001399OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1400OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1401OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1402OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1403OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001404OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001405OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1406OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001407OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001408OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1409OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1410OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1411OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001412OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1413OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1414OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1415OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001416
1417AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001418
Damien Miller61e50f12000-05-08 20:49:37 +10001419AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1420 ac_cv_have_ss_family_in_struct_ss, [
1421 AC_TRY_COMPILE(
1422 [
Damien Miller81171112000-04-23 11:14:01 +10001423#include <sys/types.h>
1424#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001425 ],
1426 [ struct sockaddr_storage s; s.ss_family = 1; ],
1427 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1428 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1429 )
1430])
1431if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1432 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1433fi
1434
Damien Miller61e50f12000-05-08 20:49:37 +10001435AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1436 ac_cv_have___ss_family_in_struct_ss, [
1437 AC_TRY_COMPILE(
1438 [
Damien Miller81171112000-04-23 11:14:01 +10001439#include <sys/types.h>
1440#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001441 ],
1442 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1443 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1444 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1445 )
1446])
1447if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1448 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1449fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001450
Damien Millerad833b32000-08-23 10:46:23 +10001451AC_CACHE_CHECK([for pw_class field in struct passwd],
1452 ac_cv_have_pw_class_in_struct_passwd, [
1453 AC_TRY_COMPILE(
1454 [
Damien Millerad833b32000-08-23 10:46:23 +10001455#include <pwd.h>
1456 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001457 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001458 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1459 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1460 )
1461])
1462if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1463 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1464fi
1465
Kevin Steves82456952001-06-22 21:14:18 +00001466AC_CACHE_CHECK([for pw_expire field in struct passwd],
1467 ac_cv_have_pw_expire_in_struct_passwd, [
1468 AC_TRY_COMPILE(
1469 [
1470#include <pwd.h>
1471 ],
1472 [ struct passwd p; p.pw_expire = 0; ],
1473 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1474 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1475 )
1476])
1477if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1478 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1479fi
1480
1481AC_CACHE_CHECK([for pw_change field in struct passwd],
1482 ac_cv_have_pw_change_in_struct_passwd, [
1483 AC_TRY_COMPILE(
1484 [
1485#include <pwd.h>
1486 ],
1487 [ struct passwd p; p.pw_change = 0; ],
1488 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1489 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1490 )
1491])
1492if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1493 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1494fi
Damien Miller61e50f12000-05-08 20:49:37 +10001495
Tim Rice28bbb0c2002-05-27 17:37:32 -07001496dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001497AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1498 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001499 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001500 [
Tim Riceae49fe62002-04-12 10:26:21 -07001501#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001502#include <sys/socket.h>
1503#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001504int main() {
1505#ifdef msg_accrights
1506exit(1);
1507#endif
1508struct msghdr m;
1509m.msg_accrights = 0;
1510exit(0);
1511}
Kevin Steves939c9db2002-03-22 17:23:25 +00001512 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001513 [ ac_cv_have_accrights_in_msghdr="yes" ],
1514 [ ac_cv_have_accrights_in_msghdr="no" ]
1515 )
1516])
1517if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1518 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1519fi
1520
Kevin Stevesa44e0352002-04-07 16:18:03 +00001521AC_CACHE_CHECK([for msg_control field in struct msghdr],
1522 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001523 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001524 [
Tim Riceae49fe62002-04-12 10:26:21 -07001525#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001526#include <sys/socket.h>
1527#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001528int main() {
1529#ifdef msg_control
1530exit(1);
1531#endif
1532struct msghdr m;
1533m.msg_control = 0;
1534exit(0);
1535}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001536 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001537 [ ac_cv_have_control_in_msghdr="yes" ],
1538 [ ac_cv_have_control_in_msghdr="no" ]
1539 )
1540])
1541if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1542 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1543fi
1544
Damien Miller61e50f12000-05-08 20:49:37 +10001545AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1546 AC_TRY_LINK([],
1547 [ extern char *__progname; printf("%s", __progname); ],
1548 [ ac_cv_libc_defines___progname="yes" ],
1549 [ ac_cv_libc_defines___progname="no" ]
1550 )
1551])
1552if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1553 AC_DEFINE(HAVE___PROGNAME)
1554fi
1555
Kevin Steves4846f4a2002-03-22 18:19:53 +00001556AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1557 AC_TRY_LINK([
1558#include <stdio.h>
1559],
1560 [ printf("%s", __FUNCTION__); ],
1561 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1562 [ ac_cv_cc_implements___FUNCTION__="no" ]
1563 )
1564])
1565if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1566 AC_DEFINE(HAVE___FUNCTION__)
1567fi
1568
1569AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1570 AC_TRY_LINK([
1571#include <stdio.h>
1572],
1573 [ printf("%s", __func__); ],
1574 [ ac_cv_cc_implements___func__="yes" ],
1575 [ ac_cv_cc_implements___func__="no" ]
1576 )
1577])
1578if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1579 AC_DEFINE(HAVE___func__)
1580fi
1581
Damien Miller4f8e6692001-07-14 13:22:53 +10001582AC_CACHE_CHECK([whether getopt has optreset support],
1583 ac_cv_have_getopt_optreset, [
1584 AC_TRY_LINK(
1585 [
1586#include <getopt.h>
1587 ],
1588 [ extern int optreset; optreset = 0; ],
1589 [ ac_cv_have_getopt_optreset="yes" ],
1590 [ ac_cv_have_getopt_optreset="no" ]
1591 )
1592])
1593if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1594 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1595fi
Damien Millera22ba012000-03-02 23:09:20 +11001596
Damien Millerecbb26d2000-07-15 14:59:14 +10001597AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1598 AC_TRY_LINK([],
1599 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1600 [ ac_cv_libc_defines_sys_errlist="yes" ],
1601 [ ac_cv_libc_defines_sys_errlist="no" ]
1602 )
1603])
1604if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1605 AC_DEFINE(HAVE_SYS_ERRLIST)
1606fi
1607
1608
Damien Miller11fa2cc2000-08-16 10:35:58 +10001609AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1610 AC_TRY_LINK([],
1611 [ extern int sys_nerr; printf("%i", sys_nerr);],
1612 [ ac_cv_libc_defines_sys_nerr="yes" ],
1613 [ ac_cv_libc_defines_sys_nerr="no" ]
1614 )
1615])
1616if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1617 AC_DEFINE(HAVE_SYS_NERR)
1618fi
1619
Damien Miller85de5802001-09-18 14:01:11 +10001620SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001621
1622# Check whether user wants sectok support
1623AC_ARG_WITH(sectok,
1624 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001625 [
1626 if test "x$withval" != "xno" ; then
1627 if test "x$withval" != "xyes" ; then
1628 CPPFLAGS="$CPPFLAGS -I${withval}"
1629 LDFLAGS="$LDFLAGS -L${withval}"
1630 if test ! -z "$need_dash_r" ; then
1631 LDFLAGS="$LDFLAGS -R${withval}"
1632 fi
1633 if test ! -z "$blibpath" ; then
1634 blibpath="$blibpath:${withval}"
1635 fi
1636 fi
1637 AC_CHECK_HEADERS(sectok.h)
1638 if test "$ac_cv_header_sectok_h" != yes; then
1639 AC_MSG_ERROR(Can't find sectok.h)
1640 fi
1641 AC_CHECK_LIB(sectok, sectok_open)
1642 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1643 AC_MSG_ERROR(Can't find libsectok)
1644 fi
1645 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001646 AC_DEFINE(USE_SECTOK)
1647 SCARD_MSG="yes, using sectok"
1648 fi
1649 ]
1650)
1651
1652# Check whether user wants OpenSC support
1653AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001654 AC_HELP_STRING([--with-opensc=PFX],
1655 [Enable smartcard support using OpenSC]),
1656 opensc_config_prefix="$withval", opensc_config_prefix="")
1657if test x$opensc_config_prefix != x ; then
1658 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1659 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1660 if test "$OPENSC_CONFIG" != "no"; then
1661 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1662 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1663 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1664 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1665 AC_DEFINE(SMARTCARD)
1666 AC_DEFINE(USE_OPENSC)
1667 SCARD_MSG="yes, using OpenSC"
1668 fi
1669fi
Damien Miller85de5802001-09-18 14:01:11 +10001670
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001671# Check whether user wants Kerberos 5 support
1672KRB5_MSG="no"
1673AC_ARG_WITH(kerberos5,
1674 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1675 [
1676 if test "x$withval" != "xno" ; then
1677 if test "x$withval" = "xyes" ; then
1678 KRB5ROOT="/usr/local"
1679 else
1680 KRB5ROOT=${withval}
1681 fi
1682 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1683 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1684 AC_DEFINE(KRB5)
1685 KRB5_MSG="yes"
1686 AC_MSG_CHECKING(whether we are using Heimdal)
1687 AC_TRY_COMPILE([ #include <krb5.h> ],
1688 [ char *tmp = heimdal_version; ],
1689 [ AC_MSG_RESULT(yes)
1690 AC_DEFINE(HEIMDAL)
1691 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1692 ],
1693 [ AC_MSG_RESULT(no)
1694 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1695 ]
1696 )
1697 if test ! -z "$need_dash_r" ; then
1698 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1699 fi
1700 if test ! -z "$blibpath" ; then
1701 blibpath="$blibpath:${KRB5ROOT}/lib"
1702 fi
1703 AC_CHECK_LIB(resolv, dn_expand, , )
1704
1705 KRB5=yes
1706 fi
1707 ]
1708)
1709# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001710KRB4_MSG="no"
1711AC_ARG_WITH(kerberos4,
1712 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1713 [
1714 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001715 if test "x$withval" != "xyes" ; then
1716 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1717 LDFLAGS="$LDFLAGS -L${withval}/lib"
1718 if test ! -z "$need_dash_r" ; then
1719 LDFLAGS="$LDFLAGS -R${withval}/lib"
1720 fi
1721 if test ! -z "$blibpath" ; then
1722 blibpath="$blibpath:${withval}/lib"
1723 fi
1724 else
1725 if test -d /usr/include/kerberosIV ; then
1726 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1727 fi
1728 fi
1729
1730 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001731 if test "$ac_cv_header_krb_h" != yes; then
1732 AC_MSG_WARN([Cannot find krb.h, build may fail])
1733 fi
Damien Miller98344742001-03-28 14:37:06 +10001734 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001735 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001736 AC_CHECK_LIB(krb4, main)
1737 if test "$ac_cv_lib_krb4_main" != yes; then
1738 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1739 else
1740 KLIBS="-lkrb4"
1741 fi
1742 else
1743 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001744 fi
Damien Miller98344742001-03-28 14:37:06 +10001745 AC_CHECK_LIB(des, des_cbc_encrypt)
1746 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1747 AC_CHECK_LIB(des425, des_cbc_encrypt)
1748 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1749 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1750 else
1751 KLIBS="-ldes425"
1752 fi
1753 else
1754 KLIBS="-ldes"
1755 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001756 AC_CHECK_LIB(resolv, dn_expand, , )
1757 KRB4=yes
1758 KRB4_MSG="yes"
1759 AC_DEFINE(KRB4)
1760 fi
1761 ]
1762)
1763
1764# Check whether user wants AFS support
1765AFS_MSG="no"
1766AC_ARG_WITH(afs,
1767 [ --with-afs=PATH Enable AFS support],
1768 [
1769 if test "x$withval" != "xno" ; then
1770
1771 if test "x$withval" != "xyes" ; then
1772 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1773 LDFLAGS="$LDFLAGS -L${withval}/lib"
1774 fi
1775
1776 if test -z "$KRB4" ; then
1777 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1778 fi
1779
1780 LIBS="-lkafs $LIBS"
1781 if test ! -z "$AFS_LIBS" ; then
1782 LIBS="$LIBS $AFS_LIBS"
1783 fi
1784 AC_DEFINE(AFS)
1785 AFS_MSG="yes"
1786 fi
1787 ]
1788)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001789LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001790
Damien Millera22ba012000-03-02 23:09:20 +11001791# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001792
Damien Millerf58c6722002-05-13 13:15:42 +10001793PRIVSEP_PATH=/var/empty
1794AC_ARG_WITH(privsep-path,
Damien Miller74cc5bb2002-05-22 11:02:15 +10001795 [ --with-privsep-path=xxx Path for privilege separation chroot ],
Damien Millerf58c6722002-05-13 13:15:42 +10001796 [
1797 if test "x$withval" != "$no" ; then
1798 PRIVSEP_PATH=$withval
1799 fi
1800 ]
1801)
1802AC_SUBST(PRIVSEP_PATH)
1803
Damien Millera22ba012000-03-02 23:09:20 +11001804AC_ARG_WITH(xauth,
1805 [ --with-xauth=PATH Specify path to xauth program ],
1806 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001807 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001808 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001809 fi
1810 ],
1811 [
Damien Miller78315eb2000-09-29 23:01:36 +11001812 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
Damien Milleredb82922000-06-20 13:25:52 +10001813 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001814 xauth_path="/usr/openwin/bin/xauth"
1815 fi
1816 ]
1817)
1818
Damien Millera19cf472000-11-29 13:28:50 +11001819if test -z "$xauth_path" ; then
1820 XAUTH_PATH="undefined"
1821 AC_SUBST(XAUTH_PATH)
1822else
Damien Millera22ba012000-03-02 23:09:20 +11001823 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001824 XAUTH_PATH=$xauth_path
1825 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001826fi
Damien Millera22ba012000-03-02 23:09:20 +11001827
1828# Check for mail directory (last resort if we cannot get it from headers)
1829if test ! -z "$MAIL" ; then
1830 maildir=`dirname $MAIL`
1831 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1832fi
1833
Damien Millera22ba012000-03-02 23:09:20 +11001834if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001835 if test "x$disable_ptmx_check" != "xyes" ; then
1836 AC_CHECK_FILE("/dev/ptmx",
1837 [
1838 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1839 have_dev_ptmx=1
1840 ]
1841 )
1842 fi
Damien Millera22ba012000-03-02 23:09:20 +11001843fi
Damien Miller204ad072000-03-02 23:56:12 +11001844AC_CHECK_FILE("/dev/ptc",
1845 [
1846 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1847 have_dev_ptc=1
1848 ]
1849)
1850
Damien Millera22ba012000-03-02 23:09:20 +11001851# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001852AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001853 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001854 [
Damien Miller897741e2001-04-16 10:41:46 +10001855 case "$withval" in
1856 man|cat|doc)
1857 MANTYPE=$withval
1858 ;;
1859 *)
1860 AC_MSG_ERROR(invalid man type: $withval)
1861 ;;
1862 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001863 ]
1864)
Ben Lindstrombc709922001-04-18 18:04:21 +00001865if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001866 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001867 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1868 MANTYPE=doc
1869 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1870 MANTYPE=man
1871 else
1872 MANTYPE=cat
1873 fi
1874fi
Damien Miller670a4b82000-01-22 13:53:11 +11001875AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001876if test "$MANTYPE" = "doc"; then
1877 mansubdir=man;
1878else
1879 mansubdir=$MANTYPE;
1880fi
1881AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001882
Damien Millera22ba012000-03-02 23:09:20 +11001883# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001884MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001885AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001886 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001887 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001888 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001889 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001890 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001891 fi
1892 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001893)
1894
Damien Millera22ba012000-03-02 23:09:20 +11001895# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001896AC_ARG_WITH(shadow,
1897 [ --without-shadow Disable shadow password support],
1898 [
1899 if test "x$withval" = "xno" ; then
1900 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001901 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001902 fi
1903 ]
1904)
1905
Damien Miller1f335fb2000-06-26 11:31:33 +10001906if test -z "$disable_shadow" ; then
1907 AC_MSG_CHECKING([if the systems has expire shadow information])
1908 AC_TRY_COMPILE(
1909 [
1910#include <sys/types.h>
1911#include <shadow.h>
1912 struct spwd sp;
1913 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1914 [ sp_expire_available=yes ], []
1915 )
1916
1917 if test "x$sp_expire_available" = "xyes" ; then
1918 AC_MSG_RESULT(yes)
1919 AC_DEFINE(HAS_SHADOW_EXPIRE)
1920 else
1921 AC_MSG_RESULT(no)
1922 fi
1923fi
1924
Damien Millera22ba012000-03-02 23:09:20 +11001925# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001926if test ! -z "$IPADDR_IN_DISPLAY" ; then
1927 DISPLAY_HACK_MSG="yes"
1928 AC_DEFINE(IPADDR_IN_DISPLAY)
1929else
1930 DISPLAY_HACK_MSG="no"
1931 AC_ARG_WITH(ipaddr-display,
1932 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1933 [
1934 if test "x$withval" != "xno" ; then
1935 AC_DEFINE(IPADDR_IN_DISPLAY)
1936 DISPLAY_HACK_MSG="yes"
1937 fi
1938 ]
1939 )
1940fi
Damien Miller76112de1999-12-21 11:18:08 +11001941
Tim Rice43a1c132002-04-17 21:19:14 -07001942dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1943if test $ac_cv_func_login_getcapbool = "yes" -a \
1944 $ac_cv_header_login_cap_h = "yes" ; then
1945 USES_LOGIN_CONF=yes
1946fi
Damien Millera22ba012000-03-02 23:09:20 +11001947# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001948SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001949AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001950 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001951 [
Tim Rice43a1c132002-04-17 21:19:14 -07001952 if test "$USES_LOGIN_CONF" = "yes" ; then
1953 AC_MSG_WARN([
1954--with-default-path=PATH has no effect on this system.
1955Edit /etc/login.conf instead.])
1956 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001957 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001958 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001959 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001960 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001961 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1962 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1963 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001964 AC_TRY_RUN(
1965 [
1966/* find out what STDPATH is */
1967#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001968#ifdef HAVE_PATHS_H
1969# include <paths.h>
1970#endif
1971#ifndef _PATH_STDPATH
1972# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1973#endif
1974#include <sys/types.h>
1975#include <sys/stat.h>
1976#include <fcntl.h>
1977#define DATA "conftest.stdpath"
1978
1979main()
1980{
1981 FILE *fd;
1982 int rc;
1983
1984 fd = fopen(DATA,"w");
1985 if(fd == NULL)
1986 exit(1);
1987
1988 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1989 exit(1);
1990
1991 exit(0);
1992}
1993 ], [ user_path=`cat conftest.stdpath` ],
1994 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1995 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1996 )
1997# make sure $bindir is in USER_PATH so scp will work
1998 t_bindir=`eval echo ${bindir}`
1999 case $t_bindir in
2000 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2001 esac
2002 case $t_bindir in
2003 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2004 esac
2005 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2006 if test $? -ne 0 ; then
2007 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2008 if test $? -ne 0 ; then
2009 user_path=$user_path:$t_bindir
2010 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2011 fi
2012 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002013 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002014)
Tim Rice43a1c132002-04-17 21:19:14 -07002015if test "$USES_LOGIN_CONF" != "yes" ; then
2016 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2017 AC_SUBST(user_path)
2018fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002019
Damien Millera18bbd32002-05-13 10:48:57 +10002020# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002021AC_ARG_WITH(superuser-path,
2022 [ --with-superuser-path= Specify different path for super-user],
2023 [
2024 if test "x$withval" != "xno" ; then
2025 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2026 superuser_path=$withval
2027 fi
2028 ]
2029)
2030
2031
Damien Millera22ba012000-03-02 23:09:20 +11002032# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002033IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002034AC_ARG_WITH(ipv4-default,
2035 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2036 [
2037 if test "x$withval" != "xno" ; then
2038 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002039 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002040 fi
2041 ]
2042)
2043
Damien Miller61e50f12000-05-08 20:49:37 +10002044AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002045IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002046AC_ARG_WITH(4in6,
2047 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2048 [
2049 if test "x$withval" != "xno" ; then
2050 AC_MSG_RESULT(yes)
2051 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002052 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002053 else
2054 AC_MSG_RESULT(no)
2055 fi
2056 ],[
2057 if test "x$inet6_default_4in6" = "xyes"; then
2058 AC_MSG_RESULT([yes (default)])
2059 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002060 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002061 else
2062 AC_MSG_RESULT([no (default)])
2063 fi
2064 ]
2065)
2066
Damien Miller60396b02001-02-18 17:01:00 +11002067# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002068BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002069AC_ARG_WITH(bsd-auth,
2070 [ --with-bsd-auth Enable BSD auth support],
2071 [
2072 if test "x$withval" != "xno" ; then
2073 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002074 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002075 fi
2076 ]
2077)
2078
Damien Millera22ba012000-03-02 23:09:20 +11002079# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002080piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002081# make sure the directory exists
2082if test ! -d $piddir ; then
2083 piddir=`eval echo ${sysconfdir}`
2084 case $piddir in
2085 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2086 esac
2087fi
2088
Tim Rice88f2ab52002-03-17 12:17:34 -08002089AC_ARG_WITH(pid-dir,
2090 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2091 [
2092 if test "x$withval" != "xno" ; then
2093 piddir=$withval
2094 if test ! -d $piddir ; then
2095 AC_MSG_WARN([** no $piddir directory on this system **])
2096 fi
2097 fi
2098 ]
2099)
2100
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002101AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002102AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002103
andre2ff7b5d2000-06-03 14:57:40 +00002104dnl allow user to disable some login recording features
2105AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002106 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002107 [ AC_DEFINE(DISABLE_LASTLOG) ]
2108)
2109AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002110 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002111 [ AC_DEFINE(DISABLE_UTMP) ]
2112)
2113AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002114 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002115 [ AC_DEFINE(DISABLE_UTMPX) ]
2116)
2117AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002118 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002119 [ AC_DEFINE(DISABLE_WTMP) ]
2120)
2121AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002122 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002123 [ AC_DEFINE(DISABLE_WTMPX) ]
2124)
2125AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002126 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002127 [ AC_DEFINE(DISABLE_LOGIN) ]
2128)
2129AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002130 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002131 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2132)
2133AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002134 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002135 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2136)
2137AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002138 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002139 [
2140 if test "x$withval" = "xno" ; then
2141 AC_DEFINE(DISABLE_LASTLOG)
2142 else
2143 conf_lastlog_location=$withval
2144 fi
2145 ]
2146)
andre2ff7b5d2000-06-03 14:57:40 +00002147
2148dnl lastlog, [uw]tmpx? detection
2149dnl NOTE: set the paths in the platform section to avoid the
2150dnl need for command-line parameters
2151dnl lastlog and [uw]tmp are subject to a file search if all else fails
2152
2153dnl lastlog detection
2154dnl NOTE: the code itself will detect if lastlog is a directory
2155AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2156AC_TRY_COMPILE([
2157#include <sys/types.h>
2158#include <utmp.h>
2159#ifdef HAVE_LASTLOG_H
2160# include <lastlog.h>
2161#endif
Damien Miller2994e082000-06-04 15:51:47 +10002162#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002163# include <paths.h>
2164#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002165#ifdef HAVE_LOGIN_H
2166# include <login.h>
2167#endif
andre2ff7b5d2000-06-03 14:57:40 +00002168 ],
2169 [ char *lastlog = LASTLOG_FILE; ],
2170 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002171 [
2172 AC_MSG_RESULT(no)
2173 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2174 AC_TRY_COMPILE([
2175#include <sys/types.h>
2176#include <utmp.h>
2177#ifdef HAVE_LASTLOG_H
2178# include <lastlog.h>
2179#endif
2180#ifdef HAVE_PATHS_H
2181# include <paths.h>
2182#endif
2183 ],
2184 [ char *lastlog = _PATH_LASTLOG; ],
2185 [ AC_MSG_RESULT(yes) ],
2186 [
andree441aa32000-06-12 22:34:38 +00002187 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002188 system_lastlog_path=no
2189 ])
2190 ]
andre2ff7b5d2000-06-03 14:57:40 +00002191)
Damien Miller2994e082000-06-04 15:51:47 +10002192
andre2ff7b5d2000-06-03 14:57:40 +00002193if test -z "$conf_lastlog_location"; then
2194 if test x"$system_lastlog_path" = x"no" ; then
2195 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002196 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002197 conf_lastlog_location=$f
2198 fi
2199 done
2200 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002201 AC_MSG_WARN([** Cannot find lastlog **])
2202 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002203 fi
2204 fi
2205fi
2206
2207if test -n "$conf_lastlog_location"; then
2208 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2209fi
2210
2211dnl utmp detection
2212AC_MSG_CHECKING([if your system defines UTMP_FILE])
2213AC_TRY_COMPILE([
2214#include <sys/types.h>
2215#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002216#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002217# include <paths.h>
2218#endif
2219 ],
2220 [ char *utmp = UTMP_FILE; ],
2221 [ AC_MSG_RESULT(yes) ],
2222 [ AC_MSG_RESULT(no)
2223 system_utmp_path=no ]
2224)
2225if test -z "$conf_utmp_location"; then
2226 if test x"$system_utmp_path" = x"no" ; then
2227 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2228 if test -f $f ; then
2229 conf_utmp_location=$f
2230 fi
2231 done
2232 if test -z "$conf_utmp_location"; then
2233 AC_DEFINE(DISABLE_UTMP)
2234 fi
2235 fi
2236fi
2237if test -n "$conf_utmp_location"; then
2238 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2239fi
2240
2241dnl wtmp detection
2242AC_MSG_CHECKING([if your system defines WTMP_FILE])
2243AC_TRY_COMPILE([
2244#include <sys/types.h>
2245#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002246#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002247# include <paths.h>
2248#endif
2249 ],
2250 [ char *wtmp = WTMP_FILE; ],
2251 [ AC_MSG_RESULT(yes) ],
2252 [ AC_MSG_RESULT(no)
2253 system_wtmp_path=no ]
2254)
2255if test -z "$conf_wtmp_location"; then
2256 if test x"$system_wtmp_path" = x"no" ; then
2257 for f in /usr/adm/wtmp /var/log/wtmp; do
2258 if test -f $f ; then
2259 conf_wtmp_location=$f
2260 fi
2261 done
2262 if test -z "$conf_wtmp_location"; then
2263 AC_DEFINE(DISABLE_WTMP)
2264 fi
2265 fi
2266fi
2267if test -n "$conf_wtmp_location"; then
2268 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2269fi
2270
2271
2272dnl utmpx detection - I don't know any system so perverse as to require
2273dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2274dnl there, though.
2275AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2276AC_TRY_COMPILE([
2277#include <sys/types.h>
2278#include <utmp.h>
2279#ifdef HAVE_UTMPX_H
2280#include <utmpx.h>
2281#endif
Damien Miller2994e082000-06-04 15:51:47 +10002282#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002283# include <paths.h>
2284#endif
2285 ],
2286 [ char *utmpx = UTMPX_FILE; ],
2287 [ AC_MSG_RESULT(yes) ],
2288 [ AC_MSG_RESULT(no)
2289 system_utmpx_path=no ]
2290)
2291if test -z "$conf_utmpx_location"; then
2292 if test x"$system_utmpx_path" = x"no" ; then
2293 AC_DEFINE(DISABLE_UTMPX)
2294 fi
2295else
2296 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2297fi
2298
2299dnl wtmpx detection
2300AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2301AC_TRY_COMPILE([
2302#include <sys/types.h>
2303#include <utmp.h>
2304#ifdef HAVE_UTMPX_H
2305#include <utmpx.h>
2306#endif
Damien Miller2994e082000-06-04 15:51:47 +10002307#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002308# include <paths.h>
2309#endif
2310 ],
2311 [ char *wtmpx = WTMPX_FILE; ],
2312 [ AC_MSG_RESULT(yes) ],
2313 [ AC_MSG_RESULT(no)
2314 system_wtmpx_path=no ]
2315)
2316if test -z "$conf_wtmpx_location"; then
2317 if test x"$system_wtmpx_path" = x"no" ; then
2318 AC_DEFINE(DISABLE_WTMPX)
2319 fi
2320else
2321 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2322fi
2323
Damien Miller4018c192000-04-30 09:30:44 +10002324
Damien Miller29ea30d2000-03-17 10:54:15 +11002325if test ! -z "$blibpath" ; then
2326 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2327 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2328fi
2329
Tim Rice4cec93f2002-02-26 08:40:48 -08002330dnl remove pam and dl because they are in $LIBPAM
2331if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002332 LIBS=`echo $LIBS | sed 's/-lpam //'`
2333fi
2334if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2335 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002336fi
2337
Damien Millerbac2d8a2000-09-05 16:13:06 +11002338AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002339AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2340AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002341
Damien Miller7b22d652000-06-18 14:07:04 +10002342# Print summary of options
2343
Damien Miller7b22d652000-06-18 14:07:04 +10002344# Someone please show me a better way :)
2345A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2346B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2347C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2348D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002349E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002350F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002351G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002352H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2353I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2354J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002355
2356echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002357echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002358echo " User binaries: $B"
2359echo " System binaries: $C"
2360echo " Configuration files: $D"
2361echo " Askpass program: $E"
2362echo " Manual pages: $F"
2363echo " PID file: $G"
2364echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002365if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002366echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002367else
Damien Millerf58c6722002-05-13 13:15:42 +10002368echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002369fi
Damien Millera18bbd32002-05-13 10:48:57 +10002370if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002371echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002372fi
Damien Millerf58c6722002-05-13 13:15:42 +10002373echo " Manpage format: $MANTYPE"
2374echo " PAM support: ${PAM_MSG}"
2375echo " KerberosIV support: $KRB4_MSG"
2376echo " KerberosV support: $KRB5_MSG"
2377echo " Smartcard support: $SCARD_MSG"
2378echo " AFS support: $AFS_MSG"
2379echo " S/KEY support: $SKEY_MSG"
2380echo " TCP Wrappers support: $TCPW_MSG"
2381echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002382echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002383echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2384echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2385echo " BSD Auth support: $BSD_AUTH_MSG"
2386echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002387if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002388echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002389fi
2390
Damien Miller7b22d652000-06-18 14:07:04 +10002391echo ""
2392
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002393echo " Host: ${host}"
2394echo " Compiler: ${CC}"
2395echo " Compiler flags: ${CFLAGS}"
2396echo "Preprocessor flags: ${CPPFLAGS}"
2397echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002398echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002399
2400echo ""
2401
Damien Miller82cf0ce2000-12-20 13:34:48 +11002402if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002403 echo "PAM is enabled. You may need to install a PAM control file "
2404 echo "for sshd, otherwise password authentication may fail. "
2405 echo "Example PAM control files can be found in the contrib/ "
2406 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002407 echo ""
2408fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002409
2410if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002411 echo "sftp-server will be disabled. Your compiler does not "
2412 echo "support 64bit integers."
2413 echo ""
2414fi
2415
2416if test ! -z "$RAND_HELPER_CMDHASH" ; then
2417 echo "WARNING: you are using the builtin random number collection "
2418 echo "service. Please read WARNING.RNG and request that your OS "
2419 echo "vendor includes kernel-based random number collection in "
2420 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002421 echo ""
2422fi
Damien Miller60396b02001-02-18 17:01:00 +11002423