blob: 85fb0d9734e969dc96b54f33368226a3902e71d6 [file] [log] [blame]
Kevin Steves90d5de72002-06-22 18:51:48 +00001# $Id: configure.ac,v 1.68 2002/06/22 18:51:48 stevesk 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 Miller78315eb2000-09-29 23:01:36 +1100250 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100251 RANLIB=true
252 no_dev_ptmx=1
253 AC_DEFINE(BROKEN_SYS_TERMIO_H)
254 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000255 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000256 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100257 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100258 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700259 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700260 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100261 ;;
262*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000264 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100265 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000266 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100267 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100268 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000269 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000270 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100271 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700272 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000273 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000274*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700275 no_libsocket=1
276 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000277 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700278 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
279 LIBS="$LIBS -lgen -lrsc"
280 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000281*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000282 AC_MSG_CHECKING(for Digital Unix SIA)
283 no_osfsia=""
284 AC_ARG_WITH(osfsia,
285 [ --with-osfsia Enable Digital Unix SIA],
286 [
287 if test "x$withval" = "xno" ; then
288 AC_MSG_RESULT(disabled)
289 no_osfsia=1
290 fi
291 ],
292 )
293 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000294 if test -f /etc/sia/matrix.conf; then
295 AC_MSG_RESULT(yes)
296 AC_DEFINE(HAVE_OSF_SIA)
297 AC_DEFINE(DISABLE_LOGIN)
298 LIBS="$LIBS -lsecurity -ldb -lm -laud"
299 else
300 AC_MSG_RESULT(no)
301 fi
302 fi
303 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000304
305*-*-nto-qnx)
306 AC_DEFINE(USE_PIPES)
307 AC_DEFINE(NO_X11_UNIX_SOCKETS)
308 AC_DEFINE(MISSING_NFDBITS)
309 AC_DEFINE(MISSING_HOWMANY)
310 AC_DEFINE(MISSING_FD_MASK)
311 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100312esac
313
Damien Millere37bfc12000-06-05 09:37:43 +1000314# Allow user to specify flags
315AC_ARG_WITH(cflags,
316 [ --with-cflags Specify additional flags to pass to compiler],
317 [
318 if test "x$withval" != "xno" ; then
319 CFLAGS="$CFLAGS $withval"
320 fi
321 ]
322)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000323AC_ARG_WITH(cppflags,
324 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
325 [
326 if test "x$withval" != "xno"; then
327 CPPFLAGS="$CPPFLAGS $withval"
328 fi
329 ]
330)
Damien Millere37bfc12000-06-05 09:37:43 +1000331AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000332 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000333 [
334 if test "x$withval" != "xno" ; then
335 LDFLAGS="$LDFLAGS $withval"
336 fi
337 ]
338)
339AC_ARG_WITH(libs,
340 [ --with-libs Specify additional libraries to link with],
341 [
342 if test "x$withval" != "xno" ; then
343 LIBS="$LIBS $withval"
344 fi
345 ]
346)
347
Tim Rice4cec93f2002-02-26 08:40:48 -0800348# Checks for header files.
349AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
350 getopt.h glob.h lastlog.h limits.h login.h \
351 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000352 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000353 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800354 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000355 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800356 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000357 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800358 util.h utime.h utmp.h utmpx.h)
359
Damien Millera22ba012000-03-02 23:09:20 +1100360# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700361AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
362AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000363
Damien Millerdf288022001-02-18 13:07:07 +1100364dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700365if test "x$with_tcp_wrappers" != "xno" ; then
366 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
367 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
368 fi
369fi
Damien Millerdf288022001-02-18 13:07:07 +1100370
Tim Rice13aae5e2001-10-21 17:53:58 -0700371AC_CHECK_FUNC(getspnam, ,
372 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700373
Damien Miller150c8b52002-02-13 23:06:56 +1100374AC_ARG_WITH(rpath,
375 [ --without-rpath Disable auto-added -R linker paths],
376 [
377 if test "x$withval" = "xno" ; then
378 need_dash_r=""
379 fi
380 if test "x$withval" = "xyes" ; then
381 need_dash_r=1
382 fi
383 ]
384)
385
Tim Rice13aae5e2001-10-21 17:53:58 -0700386dnl zlib is required
387AC_ARG_WITH(zlib,
388 [ --with-zlib=PATH Use zlib in PATH],
389 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000390 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100391 AC_MSG_ERROR([*** zlib is required ***])
392 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700393 if test -d "$withval/lib"; then
394 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700395 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700396 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700397 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700398 fi
399 else
400 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700401 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700402 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700403 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700404 fi
405 fi
406 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700407 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700408 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700409 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700410 fi
411 ]
412)
413
Tim Rice17b93e52001-10-23 22:36:54 -0700414AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100415
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000416dnl UnixWare 2.x
417AC_CHECK_FUNC(strcasecmp,
418 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
419)
420AC_CHECK_FUNC(utimes,
421 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
422)
Damien Millerab18c411999-11-11 10:40:23 +1100423
Tim Ricee589a292001-11-03 11:09:32 -0800424dnl Checks for libutil functions
425AC_CHECK_HEADERS(libutil.h)
426AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
427AC_CHECK_FUNCS(logout updwtmp logwtmp)
428
Ben Lindstrom8697e082001-02-24 21:41:10 +0000429AC_FUNC_STRFTIME
430
Damien Miller3c027682001-03-14 11:39:45 +1100431# Check for ALTDIRFUNC glob() extension
432AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
433AC_EGREP_CPP(FOUNDIT,
434 [
435 #include <glob.h>
436 #ifdef GLOB_ALTDIRFUNC
437 FOUNDIT
438 #endif
439 ],
440 [
441 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
442 AC_MSG_RESULT(yes)
443 ],
444 [
445 AC_MSG_RESULT(no)
446 ]
447)
Damien Millerab18c411999-11-11 10:40:23 +1100448
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000449# Check for g.gl_matchc glob() extension
450AC_MSG_CHECKING(for gl_matchc field in glob_t)
451AC_EGREP_CPP(FOUNDIT,
452 [
453 #include <glob.h>
454 int main(void){glob_t g; g.gl_matchc = 1;}
455 ],
456 [
457 AC_DEFINE(GLOB_HAS_GL_MATCHC)
458 AC_MSG_RESULT(yes)
459 ],
460 [
461 AC_MSG_RESULT(no)
462 ]
463)
464
Damien Miller18bb4732001-03-28 14:35:30 +1000465AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
466AC_TRY_RUN(
467 [
468#include <sys/types.h>
469#include <dirent.h>
470int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
471 ],
472 [AC_MSG_RESULT(yes)],
473 [
474 AC_MSG_RESULT(no)
475 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
476 ]
477)
478
Damien Millerc547bf12001-02-16 10:18:12 +1100479# Check whether user wants S/Key support
480SKEY_MSG="no"
481AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700482 [ --with-skey[[=PATH]] Enable S/Key support
483 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100484 [
485 if test "x$withval" != "xno" ; then
486
487 if test "x$withval" != "xyes" ; then
488 CPPFLAGS="$CPPFLAGS -I${withval}/include"
489 LDFLAGS="$LDFLAGS -L${withval}/lib"
490 fi
491
492 AC_DEFINE(SKEY)
493 LIBS="-lskey $LIBS"
494 SKEY_MSG="yes"
495
Tim Rice4cec93f2002-02-26 08:40:48 -0800496 AC_MSG_CHECKING([for s/key support])
497 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100498 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800499#include <stdio.h>
500#include <skey.h>
501int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
502 ],
503 [AC_MSG_RESULT(yes)],
504 [
505 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100506 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
507 ])
508 fi
509 ]
510)
511
512# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700513TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100514AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700515 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
516 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100517 [
518 if test "x$withval" != "xno" ; then
519 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700520 saved_LDFLAGS="$LDFLAGS"
521 saved_CPPFLAGS="$CPPFLAGS"
522 if test -n "${withval}" -a "${withval}" != "yes"; then
523 if test -d "${withval}/lib"; then
524 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700525 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700526 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700527 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700528 fi
529 else
530 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700531 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700532 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700533 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700534 fi
535 fi
536 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700537 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700538 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700539 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700540 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700541 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800542 LIBWRAP="-lwrap"
543 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100544 AC_MSG_CHECKING(for libwrap)
545 AC_TRY_LINK(
546 [
547#include <tcpd.h>
548 int deny_severity = 0, allow_severity = 0;
549 ],
550 [hosts_access(0);],
551 [
552 AC_MSG_RESULT(yes)
553 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800554 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700555 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100556 ],
557 [
558 AC_MSG_ERROR([*** libwrap missing])
559 ]
560 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800561 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100562 fi
563 ]
564)
565
Damien Millerad833b32000-08-23 10:46:23 +1000566dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000567AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700568 clock fchmod fchown freeaddrinfo futimes gai_strerror \
569 getaddrinfo getcwd getgrouplist getnameinfo getopt \
570 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
571 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000572 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
573 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000574 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000575 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
576 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
577 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700578
579dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700580AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700581 AC_CHECK_LIB(gen, dirname,[
582 AC_CACHE_CHECK([for broken dirname],
583 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700584 save_LIBS="$LIBS"
585 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700586 AC_TRY_RUN(
587 [
588#include <libgen.h>
589#include <string.h>
590
591int main(int argc, char **argv) {
592 char *s, buf[32];
593
594 strncpy(buf,"/etc", 32);
595 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700596 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700597 exit(1);
598 } else {
599 exit(0);
600 }
601}
602 ],
603 [ ac_cv_have_broken_dirname="no" ],
604 [ ac_cv_have_broken_dirname="yes" ]
605 )
Tim Rice17b93e52001-10-23 22:36:54 -0700606 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700608 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700609 LIBS="$LIBS -lgen"
610 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700611 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700612 fi
613 ])
614])
615
Damien Millerad833b32000-08-23 10:46:23 +1000616dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000617AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000618dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000619AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000620AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000621dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000622AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000623AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100624
Damien Miller04f80141999-11-19 15:32:34 +1100625AC_CHECK_FUNC(daemon,
626 [AC_DEFINE(HAVE_DAEMON)],
627 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
628)
629
Damien Miller9fb07e42000-03-05 16:22:59 +1100630AC_CHECK_FUNC(getpagesize,
631 [AC_DEFINE(HAVE_GETPAGESIZE)],
632 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
633)
634
Damien Millercb170cb2000-07-01 16:52:55 +1000635# Check for broken snprintf
636if test "x$ac_cv_func_snprintf" = "xyes" ; then
637 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
638 AC_TRY_RUN(
639 [
640#include <stdio.h>
641int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
642 ],
643 [AC_MSG_RESULT(yes)],
644 [
645 AC_MSG_RESULT(no)
646 AC_DEFINE(BROKEN_SNPRINTF)
647 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
648 ]
649 )
650fi
651
Damien Miller606f8802000-09-16 15:39:56 +1100652AC_FUNC_GETPGRP
653
Damien Millera64b57a2001-01-17 10:44:13 +1100654# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000655PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100656AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100657 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100658 [
Damien Millera64b57a2001-01-17 10:44:13 +1100659 if test "x$withval" != "xno" ; then
660 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
661 AC_MSG_ERROR([PAM headers not found])
662 fi
663
664 AC_CHECK_LIB(dl, dlopen, , )
665 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
666 AC_CHECK_FUNCS(pam_getenvlist)
667
668 disable_shadow=yes
669 PAM_MSG="yes"
670
671 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800672 if test $ac_cv_lib_dl_dlopen = yes; then
673 LIBPAM="-lpam -ldl"
674 else
675 LIBPAM="-lpam"
676 fi
677 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100678 fi
679 ]
680)
Damien Millera22ba012000-03-02 23:09:20 +1100681
Damien Millera64b57a2001-01-17 10:44:13 +1100682# Check for older PAM
683if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100684 # Check PAM strerror arguments (old PAM)
685 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
686 AC_TRY_COMPILE(
687 [
Damien Miller81171112000-04-23 11:14:01 +1000688#include <stdlib.h>
689#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100690 ],
691 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
692 [AC_MSG_RESULT(no)],
693 [
694 AC_DEFINE(HAVE_OLD_PAM)
695 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000696 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100697 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100698 )
Damien Millera22ba012000-03-02 23:09:20 +1100699fi
700
Tim Riceaef73712002-05-11 13:17:42 -0700701# Search for OpenSSL
702saved_CPPFLAGS="$CPPFLAGS"
703saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100704AC_ARG_WITH(ssl-dir,
705 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
706 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000707 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700708 if test -d "$withval/lib"; then
709 if test -n "${need_dash_r}"; then
710 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
711 else
712 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
713 fi
714 else
715 if test -n "${need_dash_r}"; then
716 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
717 else
718 LDFLAGS="-L${withval} ${LDFLAGS}"
719 fi
720 fi
721 if test -d "$withval/include"; then
722 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
723 else
724 CPPFLAGS="-I${withval} ${CPPFLAGS}"
725 fi
Damien Millera22ba012000-03-02 23:09:20 +1100726 fi
727 ]
728)
Tim Riceaef73712002-05-11 13:17:42 -0700729LIBS="$LIBS -lcrypto"
730AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000731 [
Tim Riceaef73712002-05-11 13:17:42 -0700732 dnl Check default openssl install dir
733 if test -n "${need_dash_r}"; then
734 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000735 else
Tim Riceaef73712002-05-11 13:17:42 -0700736 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000737 fi
Tim Riceaef73712002-05-11 13:17:42 -0700738 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
739 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
740 [
741 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
742 ]
743 )
744 ]
745)
746
Damien Millera22ba012000-03-02 23:09:20 +1100747
Damien Millerec932372002-01-22 22:16:03 +1100748# Sanity check OpenSSL headers
749AC_MSG_CHECKING([whether OpenSSL's headers match the library])
750AC_TRY_RUN(
751 [
752#include <string.h>
753#include <openssl/opensslv.h>
754int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
755 ],
756 [
757 AC_MSG_RESULT(yes)
758 ],
759 [
760 AC_MSG_RESULT(no)
761 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
762 ]
763)
764
Damien Millera64b57a2001-01-17 10:44:13 +1100765# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
766# version in OpenSSL. Skip this for PAM
767if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100768 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100769fi
770
Damien Miller6c21c512002-01-22 21:57:53 +1100771
772### Configure cryptographic random number support
773
774# Check wheter OpenSSL seeds itself
775AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
776AC_TRY_RUN(
777 [
778#include <string.h>
779#include <openssl/rand.h>
780int main(void) { return(RAND_status() == 1 ? 0 : 1); }
781 ],
782 [
783 OPENSSL_SEEDS_ITSELF=yes
784 AC_MSG_RESULT(yes)
785 ],
786 [
787 AC_MSG_RESULT(no)
788 # Default to use of the rand helper if OpenSSL doesn't
789 # seed itself
790 USE_RAND_HELPER=yes
791 ]
792)
793
794
795# Do we want to force the use of the rand helper?
796AC_ARG_WITH(rand-helper,
797 [ --with-rand-helper Use subprocess to gather strong randomness ],
798 [
799 if test "x$withval" = "xno" ; then
800 # Force use of OpenSSL's internal RNG, even if
801 # the previous test showed it to be unseeded.
802 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
803 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
804 OPENSSL_SEEDS_ITSELF=yes
805 USE_RAND_HELPER=""
806 fi
807 else
808 USE_RAND_HELPER=yes
809 fi
810 ],
811)
812
813# Which randomness source do we use?
814if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
815 # OpenSSL only
816 AC_DEFINE(OPENSSL_PRNG_ONLY)
817 RAND_MSG="OpenSSL internal ONLY"
818 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800819elif test ! -z "$USE_RAND_HELPER" ; then
820 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100821 RAND_MSG="ssh-rand-helper"
822 INSTALL_SSH_RAND_HELPER="yes"
823fi
824AC_SUBST(INSTALL_SSH_RAND_HELPER)
825
826### Configuration of ssh-rand-helper
827
828# PRNGD TCP socket
829AC_ARG_WITH(prngd-port,
830 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
831 [
Damien Millere996d722002-01-23 11:20:59 +1100832 case "$withval" in
833 no)
834 withval=""
835 ;;
836 [[0-9]]*)
837 ;;
838 *)
839 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
840 ;;
841 esac
842 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100843 PRNGD_PORT="$withval"
844 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
845 fi
846 ]
847)
848
849# PRNGD Unix domain socket
850AC_ARG_WITH(prngd-socket,
851 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
852 [
Damien Millere996d722002-01-23 11:20:59 +1100853 case "$withval" in
854 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100855 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100856 ;;
857 no)
858 withval=""
859 ;;
860 /*)
861 ;;
862 *)
863 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
864 ;;
865 esac
866
867 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100868 if test ! -z "$PRNGD_PORT" ; then
869 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
870 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100871 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100872 AC_MSG_WARN(Entropy socket is not readable)
873 fi
874 PRNGD_SOCKET="$withval"
875 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
876 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800877 ],
878 [
879 # Check for existing socket only if we don't have a random device already
880 if test "$USE_RAND_HELPER" = yes ; then
881 AC_MSG_CHECKING(for PRNGD/EGD socket)
882 # Insert other locations here
883 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
884 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
885 PRNGD_SOCKET="$sock"
886 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
887 break;
888 fi
889 done
890 if test ! -z "$PRNGD_SOCKET" ; then
891 AC_MSG_RESULT($PRNGD_SOCKET)
892 else
893 AC_MSG_RESULT(not found)
894 fi
895 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100896 ]
897)
898
899# Change default command timeout for hashing entropy source
900entropy_timeout=200
901AC_ARG_WITH(entropy-timeout,
902 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
903 [
904 if test "x$withval" != "xno" ; then
905 entropy_timeout=$withval
906 fi
907 ]
908)
Damien Miller6c21c512002-01-22 21:57:53 +1100909AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
910
Kevin Steves7ff91122002-04-07 19:22:54 +0000911ssh_privsep_user=sshd
912AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000913 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000914 [
915 if test -n "$withval"; then
916 ssh_privsep_user=$withval
917 fi
918 ]
919)
Kevin Steves4e0bb522002-04-07 19:44:14 +0000920AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$ssh_privsep_user")
Kevin Steves7ff91122002-04-07 19:22:54 +0000921
Tim Rice88f2ab52002-03-17 12:17:34 -0800922# We do this little dance with the search path to insure
923# that programs that we select for use by installed programs
924# (which may be run by the super-user) come from trusted
925# locations before they come from the user's private area.
926# This should help avoid accidentally configuring some
927# random version of a program in someone's personal bin.
928
929OPATH=$PATH
930PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700931test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800932test -d /sbin && PATH=$PATH:/sbin
933test -d /usr/sbin && PATH=$PATH:/usr/sbin
934PATH=$PATH:/etc:$OPATH
935
Damien Miller6c21c512002-01-22 21:57:53 +1100936# These programs are used by the command hashing source to gather entropy
937OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
938OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
939OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
940OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
941OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
942OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
943OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
944OSSH_PATH_ENTROPY_PROG(PROG_W, w)
945OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
946OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
947OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
948OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
949OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
950OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
951OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
952OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800953# restore PATH
954PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100955
956# Where does ssh-rand-helper get its randomness from?
957INSTALL_SSH_PRNG_CMDS=""
958if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
959 if test ! -z "$PRNGD_PORT" ; then
960 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
961 elif test ! -z "$PRNGD_SOCKET" ; then
962 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
963 else
964 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
965 RAND_HELPER_CMDHASH=yes
966 INSTALL_SSH_PRNG_CMDS="yes"
967 fi
968fi
969AC_SUBST(INSTALL_SSH_PRNG_CMDS)
970
971
Ben Lindstromb5628642000-10-18 00:02:25 +0000972# Cheap hack to ensure NEWS-OS libraries are arranged right.
973if test ! -z "$SONY" ; then
974 LIBS="$LIBS -liberty";
975fi
976
Damien Millera22ba012000-03-02 23:09:20 +1100977# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100978AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100979AC_CHECK_SIZEOF(short int, 2)
980AC_CHECK_SIZEOF(int, 4)
981AC_CHECK_SIZEOF(long int, 4)
982AC_CHECK_SIZEOF(long long int, 8)
983
Damien Millerfa2bb692002-04-23 23:22:25 +1000984# Sanity check long long for some platforms (AIX)
985if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
986 ac_cv_sizeof_long_long_int=0
987fi
988
Damien Millera22ba012000-03-02 23:09:20 +1100989# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100990AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
991 AC_TRY_COMPILE(
992 [ #include <sys/types.h> ],
993 [ u_int a; a = 1;],
994 [ ac_cv_have_u_int="yes" ],
995 [ ac_cv_have_u_int="no" ]
996 )
997])
998if test "x$ac_cv_have_u_int" = "xyes" ; then
999 AC_DEFINE(HAVE_U_INT)
1000 have_u_int=1
1001fi
1002
Damien Miller61e50f12000-05-08 20:49:37 +10001003AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1004 AC_TRY_COMPILE(
1005 [ #include <sys/types.h> ],
1006 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1007 [ ac_cv_have_intxx_t="yes" ],
1008 [ ac_cv_have_intxx_t="no" ]
1009 )
1010])
1011if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1012 AC_DEFINE(HAVE_INTXX_T)
1013 have_intxx_t=1
1014fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001015
1016if (test -z "$have_intxx_t" && \
1017 test "x$ac_cv_header_stdint_h" = "xyes")
1018then
1019 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1020 AC_TRY_COMPILE(
1021 [ #include <stdint.h> ],
1022 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1023 [
1024 AC_DEFINE(HAVE_INTXX_T)
1025 AC_MSG_RESULT(yes)
1026 ],
1027 [ AC_MSG_RESULT(no) ]
1028 )
1029fi
1030
Damien Miller578783e2000-09-23 14:12:24 +11001031AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1032 AC_TRY_COMPILE(
1033 [ #include <sys/types.h> ],
1034 [ int64_t a; a = 1;],
1035 [ ac_cv_have_int64_t="yes" ],
1036 [ ac_cv_have_int64_t="no" ]
1037 )
1038])
1039if test "x$ac_cv_have_int64_t" = "xyes" ; then
1040 AC_DEFINE(HAVE_INT64_T)
1041 have_int64_t=1
1042fi
1043
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001044if test -z "$have_int64_t" ; then
1045 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1046 AC_TRY_COMPILE(
1047 [ #include <sys/socket.h> ],
1048 [ int64_t a; a = 1],
1049 [
1050 AC_DEFINE(HAVE_INT64_T)
1051 AC_MSG_RESULT(yes)
1052 ],
1053 [ AC_MSG_RESULT(no) ]
1054 )
1055fi
1056
Tim Rice4cec93f2002-02-26 08:40:48 -08001057if test -z "$have_int64_t" ; then
1058 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1059 AC_TRY_COMPILE(
1060 [ #include <sys/bitypes.h> ],
1061 [ int64_t a; a = 1],
1062 [
1063 AC_DEFINE(HAVE_INT64_T)
1064 AC_MSG_RESULT(yes)
1065 ],
1066 [ AC_MSG_RESULT(no) ]
1067 )
1068fi
1069
Damien Miller61e50f12000-05-08 20:49:37 +10001070AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1071 AC_TRY_COMPILE(
1072 [ #include <sys/types.h> ],
1073 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1074 [ ac_cv_have_u_intxx_t="yes" ],
1075 [ ac_cv_have_u_intxx_t="no" ]
1076 )
1077])
1078if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1079 AC_DEFINE(HAVE_U_INTXX_T)
1080 have_u_intxx_t=1
1081fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001082
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001083if test -z "$have_u_intxx_t" ; then
1084 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1085 AC_TRY_COMPILE(
1086 [ #include <sys/socket.h> ],
1087 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1088 [
1089 AC_DEFINE(HAVE_U_INTXX_T)
1090 AC_MSG_RESULT(yes)
1091 ],
1092 [ AC_MSG_RESULT(no) ]
1093 )
1094fi
1095
Damien Miller578783e2000-09-23 14:12:24 +11001096AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1097 AC_TRY_COMPILE(
1098 [ #include <sys/types.h> ],
1099 [ u_int64_t a; a = 1;],
1100 [ ac_cv_have_u_int64_t="yes" ],
1101 [ ac_cv_have_u_int64_t="no" ]
1102 )
1103])
1104if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1105 AC_DEFINE(HAVE_U_INT64_T)
1106 have_u_int64_t=1
1107fi
1108
Tim Rice4cec93f2002-02-26 08:40:48 -08001109if test -z "$have_u_int64_t" ; then
1110 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1111 AC_TRY_COMPILE(
1112 [ #include <sys/bitypes.h> ],
1113 [ u_int64_t a; a = 1],
1114 [
1115 AC_DEFINE(HAVE_U_INT64_T)
1116 AC_MSG_RESULT(yes)
1117 ],
1118 [ AC_MSG_RESULT(no) ]
1119 )
1120fi
1121
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001122if test -z "$have_u_intxx_t" ; then
1123 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1124 AC_TRY_COMPILE(
1125 [
1126#include <sys/types.h>
1127 ],
1128 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1129 [ ac_cv_have_uintxx_t="yes" ],
1130 [ ac_cv_have_uintxx_t="no" ]
1131 )
1132 ])
1133 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1134 AC_DEFINE(HAVE_UINTXX_T)
1135 fi
1136fi
1137
1138if test -z "$have_uintxx_t" ; then
1139 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1140 AC_TRY_COMPILE(
1141 [ #include <stdint.h> ],
1142 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1143 [
1144 AC_DEFINE(HAVE_UINTXX_T)
1145 AC_MSG_RESULT(yes)
1146 ],
1147 [ AC_MSG_RESULT(no) ]
1148 )
1149fi
1150
Damien Milleredb82922000-06-20 13:25:52 +10001151if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1152 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001153then
1154 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1155 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001156 [
1157#include <sys/bitypes.h>
1158 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001159 [
Damien Miller70494d12000-04-03 15:57:06 +10001160 int8_t a; int16_t b; int32_t c;
1161 u_int8_t e; u_int16_t f; u_int32_t g;
1162 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001163 ],
1164 [
1165 AC_DEFINE(HAVE_U_INTXX_T)
1166 AC_DEFINE(HAVE_INTXX_T)
1167 AC_MSG_RESULT(yes)
1168 ],
1169 [AC_MSG_RESULT(no)]
1170 )
1171fi
1172
Damien Miller58be7382001-09-15 21:31:54 +10001173
1174AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1175 AC_TRY_COMPILE(
1176 [
1177#include <sys/types.h>
1178 ],
1179 [ u_char foo; foo = 125; ],
1180 [ ac_cv_have_u_char="yes" ],
1181 [ ac_cv_have_u_char="no" ]
1182 )
1183])
1184if test "x$ac_cv_have_u_char" = "xyes" ; then
1185 AC_DEFINE(HAVE_U_CHAR)
1186fi
1187
Tim Rice13aae5e2001-10-21 17:53:58 -07001188TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001189
Tim Rice200a5c02002-02-26 22:12:34 -08001190AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001191
Damien Miller61e50f12000-05-08 20:49:37 +10001192AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1193 AC_TRY_COMPILE(
1194 [
1195#include <sys/types.h>
1196 ],
1197 [ size_t foo; foo = 1235; ],
1198 [ ac_cv_have_size_t="yes" ],
1199 [ ac_cv_have_size_t="no" ]
1200 )
1201])
1202if test "x$ac_cv_have_size_t" = "xyes" ; then
1203 AC_DEFINE(HAVE_SIZE_T)
1204fi
Damien Miller95058511999-12-29 10:36:45 +11001205
Damien Miller615f9392000-05-17 22:53:33 +10001206AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1207 AC_TRY_COMPILE(
1208 [
1209#include <sys/types.h>
1210 ],
1211 [ ssize_t foo; foo = 1235; ],
1212 [ ac_cv_have_ssize_t="yes" ],
1213 [ ac_cv_have_ssize_t="no" ]
1214 )
1215])
1216if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1217 AC_DEFINE(HAVE_SSIZE_T)
1218fi
1219
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001220AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1221 AC_TRY_COMPILE(
1222 [
1223#include <time.h>
1224 ],
1225 [ clock_t foo; foo = 1235; ],
1226 [ ac_cv_have_clock_t="yes" ],
1227 [ ac_cv_have_clock_t="no" ]
1228 )
1229])
1230if test "x$ac_cv_have_clock_t" = "xyes" ; then
1231 AC_DEFINE(HAVE_CLOCK_T)
1232fi
1233
Damien Millerb54b40e2000-06-23 08:23:34 +10001234AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1235 AC_TRY_COMPILE(
1236 [
1237#include <sys/types.h>
1238#include <sys/socket.h>
1239 ],
1240 [ sa_family_t foo; foo = 1235; ],
1241 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001242 [ AC_TRY_COMPILE(
1243 [
1244#include <sys/types.h>
1245#include <sys/socket.h>
1246#include <netinet/in.h>
1247 ],
1248 [ sa_family_t foo; foo = 1235; ],
1249 [ ac_cv_have_sa_family_t="yes" ],
1250
Damien Millerb54b40e2000-06-23 08:23:34 +10001251 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001252 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001253 )
1254])
1255if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1256 AC_DEFINE(HAVE_SA_FAMILY_T)
1257fi
1258
Damien Miller0f91b4e2000-06-18 15:43:25 +10001259AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1260 AC_TRY_COMPILE(
1261 [
1262#include <sys/types.h>
1263 ],
1264 [ pid_t foo; foo = 1235; ],
1265 [ ac_cv_have_pid_t="yes" ],
1266 [ ac_cv_have_pid_t="no" ]
1267 )
1268])
1269if test "x$ac_cv_have_pid_t" = "xyes" ; then
1270 AC_DEFINE(HAVE_PID_T)
1271fi
1272
1273AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1274 AC_TRY_COMPILE(
1275 [
1276#include <sys/types.h>
1277 ],
1278 [ mode_t foo; foo = 1235; ],
1279 [ ac_cv_have_mode_t="yes" ],
1280 [ ac_cv_have_mode_t="no" ]
1281 )
1282])
1283if test "x$ac_cv_have_mode_t" = "xyes" ; then
1284 AC_DEFINE(HAVE_MODE_T)
1285fi
1286
Damien Miller61e50f12000-05-08 20:49:37 +10001287
1288AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1289 AC_TRY_COMPILE(
1290 [
Damien Miller81171112000-04-23 11:14:01 +10001291#include <sys/types.h>
1292#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001293 ],
1294 [ struct sockaddr_storage s; ],
1295 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1296 [ ac_cv_have_struct_sockaddr_storage="no" ]
1297 )
1298])
1299if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1300 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1301fi
Damien Miller34132e52000-01-14 15:45:46 +11001302
Damien Miller61e50f12000-05-08 20:49:37 +10001303AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1304 AC_TRY_COMPILE(
1305 [
Damien Miller7b22d652000-06-18 14:07:04 +10001306#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001307#include <netinet/in.h>
1308 ],
1309 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1310 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1311 [ ac_cv_have_struct_sockaddr_in6="no" ]
1312 )
1313])
1314if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1315 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1316fi
Damien Miller34132e52000-01-14 15:45:46 +11001317
Damien Miller61e50f12000-05-08 20:49:37 +10001318AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1319 AC_TRY_COMPILE(
1320 [
Damien Miller7b22d652000-06-18 14:07:04 +10001321#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001322#include <netinet/in.h>
1323 ],
1324 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1325 [ ac_cv_have_struct_in6_addr="yes" ],
1326 [ ac_cv_have_struct_in6_addr="no" ]
1327 )
1328])
1329if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1330 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1331fi
Damien Miller34132e52000-01-14 15:45:46 +11001332
Damien Miller61e50f12000-05-08 20:49:37 +10001333AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1334 AC_TRY_COMPILE(
1335 [
Damien Miller81171112000-04-23 11:14:01 +10001336#include <sys/types.h>
1337#include <sys/socket.h>
1338#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001339 ],
1340 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1341 [ ac_cv_have_struct_addrinfo="yes" ],
1342 [ ac_cv_have_struct_addrinfo="no" ]
1343 )
1344])
1345if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1346 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1347fi
1348
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001349AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1350 AC_TRY_COMPILE(
1351 [ #include <sys/time.h> ],
1352 [ struct timeval tv; tv.tv_sec = 1;],
1353 [ ac_cv_have_struct_timeval="yes" ],
1354 [ ac_cv_have_struct_timeval="no" ]
1355 )
1356])
1357if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1358 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1359 have_struct_timeval=1
1360fi
1361
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001362# If we don't have int64_t then we can't compile sftp-server. So don't
1363# even attempt to do it.
1364if test "x$ac_cv_have_int64_t" = "xno" -a \
1365 "x$ac_cv_sizeof_long_int" != "x8" -a \
1366 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1367 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001368else
1369dnl test snprintf (broken on SCO w/gcc)
1370 AC_TRY_RUN(
1371 [
1372#include <stdio.h>
1373#include <string.h>
1374#ifdef HAVE_SNPRINTF
1375main()
1376{
1377 char buf[50];
1378 char expected_out[50];
1379 int mazsize = 50 ;
1380#if (SIZEOF_LONG_INT == 8)
1381 long int num = 0x7fffffffffffffff;
1382#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001383 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001384#endif
1385 strcpy(expected_out, "9223372036854775807");
1386 snprintf(buf, mazsize, "%lld", num);
1387 if(strcmp(buf, expected_out) != 0)
1388 exit(1);
1389 exit(0);
1390}
1391#else
1392main() { exit(0); }
1393#endif
1394 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1395 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001396fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001397AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001398
Damien Miller78315eb2000-09-29 23:01:36 +11001399dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001400OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1401OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1402OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1403OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1404OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001405OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001406OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1407OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001408OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001409OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1410OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1411OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1412OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001413OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1414OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1415OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1416OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001417
1418AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001419
Damien Miller61e50f12000-05-08 20:49:37 +10001420AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1421 ac_cv_have_ss_family_in_struct_ss, [
1422 AC_TRY_COMPILE(
1423 [
Damien Miller81171112000-04-23 11:14:01 +10001424#include <sys/types.h>
1425#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001426 ],
1427 [ struct sockaddr_storage s; s.ss_family = 1; ],
1428 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1429 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1430 )
1431])
1432if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1433 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1434fi
1435
Damien Miller61e50f12000-05-08 20:49:37 +10001436AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1437 ac_cv_have___ss_family_in_struct_ss, [
1438 AC_TRY_COMPILE(
1439 [
Damien Miller81171112000-04-23 11:14:01 +10001440#include <sys/types.h>
1441#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001442 ],
1443 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1444 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1445 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1446 )
1447])
1448if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1449 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1450fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001451
Damien Millerad833b32000-08-23 10:46:23 +10001452AC_CACHE_CHECK([for pw_class field in struct passwd],
1453 ac_cv_have_pw_class_in_struct_passwd, [
1454 AC_TRY_COMPILE(
1455 [
Damien Millerad833b32000-08-23 10:46:23 +10001456#include <pwd.h>
1457 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001458 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001459 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1460 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1461 )
1462])
1463if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1464 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1465fi
1466
Kevin Steves82456952001-06-22 21:14:18 +00001467AC_CACHE_CHECK([for pw_expire field in struct passwd],
1468 ac_cv_have_pw_expire_in_struct_passwd, [
1469 AC_TRY_COMPILE(
1470 [
1471#include <pwd.h>
1472 ],
1473 [ struct passwd p; p.pw_expire = 0; ],
1474 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1475 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1476 )
1477])
1478if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1479 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1480fi
1481
1482AC_CACHE_CHECK([for pw_change field in struct passwd],
1483 ac_cv_have_pw_change_in_struct_passwd, [
1484 AC_TRY_COMPILE(
1485 [
1486#include <pwd.h>
1487 ],
1488 [ struct passwd p; p.pw_change = 0; ],
1489 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1490 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1491 )
1492])
1493if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1494 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1495fi
Damien Miller61e50f12000-05-08 20:49:37 +10001496
Tim Rice28bbb0c2002-05-27 17:37:32 -07001497dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001498AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1499 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001500 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001501 [
Tim Riceae49fe62002-04-12 10:26:21 -07001502#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001503#include <sys/socket.h>
1504#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001505int main() {
1506#ifdef msg_accrights
1507exit(1);
1508#endif
1509struct msghdr m;
1510m.msg_accrights = 0;
1511exit(0);
1512}
Kevin Steves939c9db2002-03-22 17:23:25 +00001513 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001514 [ ac_cv_have_accrights_in_msghdr="yes" ],
1515 [ ac_cv_have_accrights_in_msghdr="no" ]
1516 )
1517])
1518if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1519 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1520fi
1521
Kevin Stevesa44e0352002-04-07 16:18:03 +00001522AC_CACHE_CHECK([for msg_control field in struct msghdr],
1523 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001524 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001525 [
Tim Riceae49fe62002-04-12 10:26:21 -07001526#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001527#include <sys/socket.h>
1528#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001529int main() {
1530#ifdef msg_control
1531exit(1);
1532#endif
1533struct msghdr m;
1534m.msg_control = 0;
1535exit(0);
1536}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001537 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001538 [ ac_cv_have_control_in_msghdr="yes" ],
1539 [ ac_cv_have_control_in_msghdr="no" ]
1540 )
1541])
1542if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1543 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1544fi
1545
Damien Miller61e50f12000-05-08 20:49:37 +10001546AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1547 AC_TRY_LINK([],
1548 [ extern char *__progname; printf("%s", __progname); ],
1549 [ ac_cv_libc_defines___progname="yes" ],
1550 [ ac_cv_libc_defines___progname="no" ]
1551 )
1552])
1553if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1554 AC_DEFINE(HAVE___PROGNAME)
1555fi
1556
Kevin Steves4846f4a2002-03-22 18:19:53 +00001557AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1558 AC_TRY_LINK([
1559#include <stdio.h>
1560],
1561 [ printf("%s", __FUNCTION__); ],
1562 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1563 [ ac_cv_cc_implements___FUNCTION__="no" ]
1564 )
1565])
1566if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1567 AC_DEFINE(HAVE___FUNCTION__)
1568fi
1569
1570AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1571 AC_TRY_LINK([
1572#include <stdio.h>
1573],
1574 [ printf("%s", __func__); ],
1575 [ ac_cv_cc_implements___func__="yes" ],
1576 [ ac_cv_cc_implements___func__="no" ]
1577 )
1578])
1579if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1580 AC_DEFINE(HAVE___func__)
1581fi
1582
Damien Miller4f8e6692001-07-14 13:22:53 +10001583AC_CACHE_CHECK([whether getopt has optreset support],
1584 ac_cv_have_getopt_optreset, [
1585 AC_TRY_LINK(
1586 [
1587#include <getopt.h>
1588 ],
1589 [ extern int optreset; optreset = 0; ],
1590 [ ac_cv_have_getopt_optreset="yes" ],
1591 [ ac_cv_have_getopt_optreset="no" ]
1592 )
1593])
1594if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1595 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1596fi
Damien Millera22ba012000-03-02 23:09:20 +11001597
Damien Millerecbb26d2000-07-15 14:59:14 +10001598AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1599 AC_TRY_LINK([],
1600 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1601 [ ac_cv_libc_defines_sys_errlist="yes" ],
1602 [ ac_cv_libc_defines_sys_errlist="no" ]
1603 )
1604])
1605if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1606 AC_DEFINE(HAVE_SYS_ERRLIST)
1607fi
1608
1609
Damien Miller11fa2cc2000-08-16 10:35:58 +10001610AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1611 AC_TRY_LINK([],
1612 [ extern int sys_nerr; printf("%i", sys_nerr);],
1613 [ ac_cv_libc_defines_sys_nerr="yes" ],
1614 [ ac_cv_libc_defines_sys_nerr="no" ]
1615 )
1616])
1617if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1618 AC_DEFINE(HAVE_SYS_NERR)
1619fi
1620
Damien Miller85de5802001-09-18 14:01:11 +10001621SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001622
1623# Check whether user wants sectok support
1624AC_ARG_WITH(sectok,
1625 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001626 [
1627 if test "x$withval" != "xno" ; then
1628 if test "x$withval" != "xyes" ; then
1629 CPPFLAGS="$CPPFLAGS -I${withval}"
1630 LDFLAGS="$LDFLAGS -L${withval}"
1631 if test ! -z "$need_dash_r" ; then
1632 LDFLAGS="$LDFLAGS -R${withval}"
1633 fi
1634 if test ! -z "$blibpath" ; then
1635 blibpath="$blibpath:${withval}"
1636 fi
1637 fi
1638 AC_CHECK_HEADERS(sectok.h)
1639 if test "$ac_cv_header_sectok_h" != yes; then
1640 AC_MSG_ERROR(Can't find sectok.h)
1641 fi
1642 AC_CHECK_LIB(sectok, sectok_open)
1643 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1644 AC_MSG_ERROR(Can't find libsectok)
1645 fi
1646 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001647 AC_DEFINE(USE_SECTOK)
1648 SCARD_MSG="yes, using sectok"
1649 fi
1650 ]
1651)
1652
1653# Check whether user wants OpenSC support
1654AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001655 AC_HELP_STRING([--with-opensc=PFX],
1656 [Enable smartcard support using OpenSC]),
1657 opensc_config_prefix="$withval", opensc_config_prefix="")
1658if test x$opensc_config_prefix != x ; then
1659 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1660 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1661 if test "$OPENSC_CONFIG" != "no"; then
1662 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1663 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1664 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1665 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1666 AC_DEFINE(SMARTCARD)
1667 AC_DEFINE(USE_OPENSC)
1668 SCARD_MSG="yes, using OpenSC"
1669 fi
1670fi
Damien Miller85de5802001-09-18 14:01:11 +10001671
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001672# Check whether user wants Kerberos 5 support
1673KRB5_MSG="no"
1674AC_ARG_WITH(kerberos5,
1675 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1676 [
1677 if test "x$withval" != "xno" ; then
1678 if test "x$withval" = "xyes" ; then
1679 KRB5ROOT="/usr/local"
1680 else
1681 KRB5ROOT=${withval}
1682 fi
1683 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1684 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1685 AC_DEFINE(KRB5)
1686 KRB5_MSG="yes"
1687 AC_MSG_CHECKING(whether we are using Heimdal)
1688 AC_TRY_COMPILE([ #include <krb5.h> ],
1689 [ char *tmp = heimdal_version; ],
1690 [ AC_MSG_RESULT(yes)
1691 AC_DEFINE(HEIMDAL)
1692 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1693 ],
1694 [ AC_MSG_RESULT(no)
1695 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1696 ]
1697 )
1698 if test ! -z "$need_dash_r" ; then
1699 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1700 fi
1701 if test ! -z "$blibpath" ; then
1702 blibpath="$blibpath:${KRB5ROOT}/lib"
1703 fi
1704 AC_CHECK_LIB(resolv, dn_expand, , )
1705
1706 KRB5=yes
1707 fi
1708 ]
1709)
1710# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001711KRB4_MSG="no"
1712AC_ARG_WITH(kerberos4,
1713 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1714 [
1715 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001716 if test "x$withval" != "xyes" ; then
1717 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1718 LDFLAGS="$LDFLAGS -L${withval}/lib"
1719 if test ! -z "$need_dash_r" ; then
1720 LDFLAGS="$LDFLAGS -R${withval}/lib"
1721 fi
1722 if test ! -z "$blibpath" ; then
1723 blibpath="$blibpath:${withval}/lib"
1724 fi
1725 else
1726 if test -d /usr/include/kerberosIV ; then
1727 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1728 fi
1729 fi
1730
1731 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001732 if test "$ac_cv_header_krb_h" != yes; then
1733 AC_MSG_WARN([Cannot find krb.h, build may fail])
1734 fi
Damien Miller98344742001-03-28 14:37:06 +10001735 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001736 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001737 AC_CHECK_LIB(krb4, main)
1738 if test "$ac_cv_lib_krb4_main" != yes; then
1739 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1740 else
1741 KLIBS="-lkrb4"
1742 fi
1743 else
1744 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001745 fi
Damien Miller98344742001-03-28 14:37:06 +10001746 AC_CHECK_LIB(des, des_cbc_encrypt)
1747 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1748 AC_CHECK_LIB(des425, des_cbc_encrypt)
1749 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1750 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1751 else
1752 KLIBS="-ldes425"
1753 fi
1754 else
1755 KLIBS="-ldes"
1756 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001757 AC_CHECK_LIB(resolv, dn_expand, , )
1758 KRB4=yes
1759 KRB4_MSG="yes"
1760 AC_DEFINE(KRB4)
1761 fi
1762 ]
1763)
1764
1765# Check whether user wants AFS support
1766AFS_MSG="no"
1767AC_ARG_WITH(afs,
1768 [ --with-afs=PATH Enable AFS support],
1769 [
1770 if test "x$withval" != "xno" ; then
1771
1772 if test "x$withval" != "xyes" ; then
1773 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1774 LDFLAGS="$LDFLAGS -L${withval}/lib"
1775 fi
1776
1777 if test -z "$KRB4" ; then
1778 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1779 fi
1780
1781 LIBS="-lkafs $LIBS"
1782 if test ! -z "$AFS_LIBS" ; then
1783 LIBS="$LIBS $AFS_LIBS"
1784 fi
1785 AC_DEFINE(AFS)
1786 AFS_MSG="yes"
1787 fi
1788 ]
1789)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001790LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001791
Damien Millera22ba012000-03-02 23:09:20 +11001792# Looking for programs, paths and files
1793AC_ARG_WITH(rsh,
1794 [ --with-rsh=PATH Specify path to remote shell program ],
1795 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001796 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001797 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001798 fi
1799 ],
1800 [
1801 AC_PATH_PROG(rsh_path, rsh)
1802 ]
1803)
1804
Damien Millerf58c6722002-05-13 13:15:42 +10001805PRIVSEP_PATH=/var/empty
1806AC_ARG_WITH(privsep-path,
Damien Miller74cc5bb2002-05-22 11:02:15 +10001807 [ --with-privsep-path=xxx Path for privilege separation chroot ],
Damien Millerf58c6722002-05-13 13:15:42 +10001808 [
1809 if test "x$withval" != "$no" ; then
1810 PRIVSEP_PATH=$withval
1811 fi
1812 ]
1813)
1814AC_SUBST(PRIVSEP_PATH)
1815
Damien Millera22ba012000-03-02 23:09:20 +11001816AC_ARG_WITH(xauth,
1817 [ --with-xauth=PATH Specify path to xauth program ],
1818 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001819 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001820 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001821 fi
1822 ],
1823 [
Damien Miller78315eb2000-09-29 23:01:36 +11001824 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 +10001825 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001826 xauth_path="/usr/openwin/bin/xauth"
1827 fi
1828 ]
1829)
1830
Damien Millera19cf472000-11-29 13:28:50 +11001831if test -z "$xauth_path" ; then
1832 XAUTH_PATH="undefined"
1833 AC_SUBST(XAUTH_PATH)
1834else
Damien Millera22ba012000-03-02 23:09:20 +11001835 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001836 XAUTH_PATH=$xauth_path
1837 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001838fi
1839if test ! -z "$rsh_path" ; then
1840 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1841fi
1842
1843# Check for mail directory (last resort if we cannot get it from headers)
1844if test ! -z "$MAIL" ; then
1845 maildir=`dirname $MAIL`
1846 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1847fi
1848
Damien Millera22ba012000-03-02 23:09:20 +11001849if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001850 if test "x$disable_ptmx_check" != "xyes" ; then
1851 AC_CHECK_FILE("/dev/ptmx",
1852 [
1853 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1854 have_dev_ptmx=1
1855 ]
1856 )
1857 fi
Damien Millera22ba012000-03-02 23:09:20 +11001858fi
Damien Miller204ad072000-03-02 23:56:12 +11001859AC_CHECK_FILE("/dev/ptc",
1860 [
1861 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1862 have_dev_ptc=1
1863 ]
1864)
1865
Damien Millera22ba012000-03-02 23:09:20 +11001866# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001867AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001868 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001869 [
Damien Miller897741e2001-04-16 10:41:46 +10001870 case "$withval" in
1871 man|cat|doc)
1872 MANTYPE=$withval
1873 ;;
1874 *)
1875 AC_MSG_ERROR(invalid man type: $withval)
1876 ;;
1877 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001878 ]
1879)
Ben Lindstrombc709922001-04-18 18:04:21 +00001880if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001881 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001882 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1883 MANTYPE=doc
1884 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1885 MANTYPE=man
1886 else
1887 MANTYPE=cat
1888 fi
1889fi
Damien Miller670a4b82000-01-22 13:53:11 +11001890AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001891if test "$MANTYPE" = "doc"; then
1892 mansubdir=man;
1893else
1894 mansubdir=$MANTYPE;
1895fi
1896AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001897
Damien Millera22ba012000-03-02 23:09:20 +11001898# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001899MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001900AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001901 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001902 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001903 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001904 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001905 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001906 fi
1907 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001908)
1909
Damien Millera22ba012000-03-02 23:09:20 +11001910# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001911AC_ARG_WITH(shadow,
1912 [ --without-shadow Disable shadow password support],
1913 [
1914 if test "x$withval" = "xno" ; then
1915 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001916 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001917 fi
1918 ]
1919)
1920
Damien Miller1f335fb2000-06-26 11:31:33 +10001921if test -z "$disable_shadow" ; then
1922 AC_MSG_CHECKING([if the systems has expire shadow information])
1923 AC_TRY_COMPILE(
1924 [
1925#include <sys/types.h>
1926#include <shadow.h>
1927 struct spwd sp;
1928 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1929 [ sp_expire_available=yes ], []
1930 )
1931
1932 if test "x$sp_expire_available" = "xyes" ; then
1933 AC_MSG_RESULT(yes)
1934 AC_DEFINE(HAS_SHADOW_EXPIRE)
1935 else
1936 AC_MSG_RESULT(no)
1937 fi
1938fi
1939
Damien Millera22ba012000-03-02 23:09:20 +11001940# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001941if test ! -z "$IPADDR_IN_DISPLAY" ; then
1942 DISPLAY_HACK_MSG="yes"
1943 AC_DEFINE(IPADDR_IN_DISPLAY)
1944else
1945 DISPLAY_HACK_MSG="no"
1946 AC_ARG_WITH(ipaddr-display,
1947 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1948 [
1949 if test "x$withval" != "xno" ; then
1950 AC_DEFINE(IPADDR_IN_DISPLAY)
1951 DISPLAY_HACK_MSG="yes"
1952 fi
1953 ]
1954 )
1955fi
Damien Miller76112de1999-12-21 11:18:08 +11001956
Tim Rice43a1c132002-04-17 21:19:14 -07001957dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1958if test $ac_cv_func_login_getcapbool = "yes" -a \
1959 $ac_cv_header_login_cap_h = "yes" ; then
1960 USES_LOGIN_CONF=yes
1961fi
Damien Millera22ba012000-03-02 23:09:20 +11001962# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001963SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001964AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001965 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001966 [
Tim Rice43a1c132002-04-17 21:19:14 -07001967 if test "$USES_LOGIN_CONF" = "yes" ; then
1968 AC_MSG_WARN([
1969--with-default-path=PATH has no effect on this system.
1970Edit /etc/login.conf instead.])
1971 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001972 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001973 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001974 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001975 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001976 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1977 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1978 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001979 AC_TRY_RUN(
1980 [
1981/* find out what STDPATH is */
1982#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001983#ifdef HAVE_PATHS_H
1984# include <paths.h>
1985#endif
1986#ifndef _PATH_STDPATH
1987# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1988#endif
1989#include <sys/types.h>
1990#include <sys/stat.h>
1991#include <fcntl.h>
1992#define DATA "conftest.stdpath"
1993
1994main()
1995{
1996 FILE *fd;
1997 int rc;
1998
1999 fd = fopen(DATA,"w");
2000 if(fd == NULL)
2001 exit(1);
2002
2003 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2004 exit(1);
2005
2006 exit(0);
2007}
2008 ], [ user_path=`cat conftest.stdpath` ],
2009 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2010 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2011 )
2012# make sure $bindir is in USER_PATH so scp will work
2013 t_bindir=`eval echo ${bindir}`
2014 case $t_bindir in
2015 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2016 esac
2017 case $t_bindir in
2018 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2019 esac
2020 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2021 if test $? -ne 0 ; then
2022 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2023 if test $? -ne 0 ; then
2024 user_path=$user_path:$t_bindir
2025 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2026 fi
2027 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002028 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002029)
Tim Rice43a1c132002-04-17 21:19:14 -07002030if test "$USES_LOGIN_CONF" != "yes" ; then
2031 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2032 AC_SUBST(user_path)
2033fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002034
Damien Millera18bbd32002-05-13 10:48:57 +10002035# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002036AC_ARG_WITH(superuser-path,
2037 [ --with-superuser-path= Specify different path for super-user],
2038 [
2039 if test "x$withval" != "xno" ; then
2040 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2041 superuser_path=$withval
2042 fi
2043 ]
2044)
2045
2046
Damien Millera22ba012000-03-02 23:09:20 +11002047# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002048IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002049AC_ARG_WITH(ipv4-default,
2050 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2051 [
2052 if test "x$withval" != "xno" ; then
2053 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002054 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002055 fi
2056 ]
2057)
2058
Damien Miller61e50f12000-05-08 20:49:37 +10002059AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002060IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002061AC_ARG_WITH(4in6,
2062 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2063 [
2064 if test "x$withval" != "xno" ; then
2065 AC_MSG_RESULT(yes)
2066 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002067 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002068 else
2069 AC_MSG_RESULT(no)
2070 fi
2071 ],[
2072 if test "x$inet6_default_4in6" = "xyes"; then
2073 AC_MSG_RESULT([yes (default)])
2074 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002075 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002076 else
2077 AC_MSG_RESULT([no (default)])
2078 fi
2079 ]
2080)
2081
Damien Miller60396b02001-02-18 17:01:00 +11002082# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002083BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002084AC_ARG_WITH(bsd-auth,
2085 [ --with-bsd-auth Enable BSD auth support],
2086 [
2087 if test "x$withval" != "xno" ; then
2088 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002089 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002090 fi
2091 ]
2092)
2093
Damien Millera22ba012000-03-02 23:09:20 +11002094# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002095piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002096# make sure the directory exists
2097if test ! -d $piddir ; then
2098 piddir=`eval echo ${sysconfdir}`
2099 case $piddir in
2100 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2101 esac
2102fi
2103
Tim Rice88f2ab52002-03-17 12:17:34 -08002104AC_ARG_WITH(pid-dir,
2105 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2106 [
2107 if test "x$withval" != "xno" ; then
2108 piddir=$withval
2109 if test ! -d $piddir ; then
2110 AC_MSG_WARN([** no $piddir directory on this system **])
2111 fi
2112 fi
2113 ]
2114)
2115
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002116AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002117AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002118
andre2ff7b5d2000-06-03 14:57:40 +00002119dnl allow user to disable some login recording features
2120AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002121 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002122 [ AC_DEFINE(DISABLE_LASTLOG) ]
2123)
2124AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002125 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002126 [ AC_DEFINE(DISABLE_UTMP) ]
2127)
2128AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002129 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002130 [ AC_DEFINE(DISABLE_UTMPX) ]
2131)
2132AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002133 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002134 [ AC_DEFINE(DISABLE_WTMP) ]
2135)
2136AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002137 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002138 [ AC_DEFINE(DISABLE_WTMPX) ]
2139)
2140AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002141 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002142 [ AC_DEFINE(DISABLE_LOGIN) ]
2143)
2144AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002145 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002146 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2147)
2148AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002149 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002150 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2151)
2152AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002153 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002154 [
2155 if test "x$withval" = "xno" ; then
2156 AC_DEFINE(DISABLE_LASTLOG)
2157 else
2158 conf_lastlog_location=$withval
2159 fi
2160 ]
2161)
andre2ff7b5d2000-06-03 14:57:40 +00002162
2163dnl lastlog, [uw]tmpx? detection
2164dnl NOTE: set the paths in the platform section to avoid the
2165dnl need for command-line parameters
2166dnl lastlog and [uw]tmp are subject to a file search if all else fails
2167
2168dnl lastlog detection
2169dnl NOTE: the code itself will detect if lastlog is a directory
2170AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2171AC_TRY_COMPILE([
2172#include <sys/types.h>
2173#include <utmp.h>
2174#ifdef HAVE_LASTLOG_H
2175# include <lastlog.h>
2176#endif
Damien Miller2994e082000-06-04 15:51:47 +10002177#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002178# include <paths.h>
2179#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002180#ifdef HAVE_LOGIN_H
2181# include <login.h>
2182#endif
andre2ff7b5d2000-06-03 14:57:40 +00002183 ],
2184 [ char *lastlog = LASTLOG_FILE; ],
2185 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002186 [
2187 AC_MSG_RESULT(no)
2188 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2189 AC_TRY_COMPILE([
2190#include <sys/types.h>
2191#include <utmp.h>
2192#ifdef HAVE_LASTLOG_H
2193# include <lastlog.h>
2194#endif
2195#ifdef HAVE_PATHS_H
2196# include <paths.h>
2197#endif
2198 ],
2199 [ char *lastlog = _PATH_LASTLOG; ],
2200 [ AC_MSG_RESULT(yes) ],
2201 [
andree441aa32000-06-12 22:34:38 +00002202 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002203 system_lastlog_path=no
2204 ])
2205 ]
andre2ff7b5d2000-06-03 14:57:40 +00002206)
Damien Miller2994e082000-06-04 15:51:47 +10002207
andre2ff7b5d2000-06-03 14:57:40 +00002208if test -z "$conf_lastlog_location"; then
2209 if test x"$system_lastlog_path" = x"no" ; then
2210 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002211 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002212 conf_lastlog_location=$f
2213 fi
2214 done
2215 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002216 AC_MSG_WARN([** Cannot find lastlog **])
2217 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002218 fi
2219 fi
2220fi
2221
2222if test -n "$conf_lastlog_location"; then
2223 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2224fi
2225
2226dnl utmp detection
2227AC_MSG_CHECKING([if your system defines UTMP_FILE])
2228AC_TRY_COMPILE([
2229#include <sys/types.h>
2230#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002231#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002232# include <paths.h>
2233#endif
2234 ],
2235 [ char *utmp = UTMP_FILE; ],
2236 [ AC_MSG_RESULT(yes) ],
2237 [ AC_MSG_RESULT(no)
2238 system_utmp_path=no ]
2239)
2240if test -z "$conf_utmp_location"; then
2241 if test x"$system_utmp_path" = x"no" ; then
2242 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2243 if test -f $f ; then
2244 conf_utmp_location=$f
2245 fi
2246 done
2247 if test -z "$conf_utmp_location"; then
2248 AC_DEFINE(DISABLE_UTMP)
2249 fi
2250 fi
2251fi
2252if test -n "$conf_utmp_location"; then
2253 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2254fi
2255
2256dnl wtmp detection
2257AC_MSG_CHECKING([if your system defines WTMP_FILE])
2258AC_TRY_COMPILE([
2259#include <sys/types.h>
2260#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002261#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002262# include <paths.h>
2263#endif
2264 ],
2265 [ char *wtmp = WTMP_FILE; ],
2266 [ AC_MSG_RESULT(yes) ],
2267 [ AC_MSG_RESULT(no)
2268 system_wtmp_path=no ]
2269)
2270if test -z "$conf_wtmp_location"; then
2271 if test x"$system_wtmp_path" = x"no" ; then
2272 for f in /usr/adm/wtmp /var/log/wtmp; do
2273 if test -f $f ; then
2274 conf_wtmp_location=$f
2275 fi
2276 done
2277 if test -z "$conf_wtmp_location"; then
2278 AC_DEFINE(DISABLE_WTMP)
2279 fi
2280 fi
2281fi
2282if test -n "$conf_wtmp_location"; then
2283 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2284fi
2285
2286
2287dnl utmpx detection - I don't know any system so perverse as to require
2288dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2289dnl there, though.
2290AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2291AC_TRY_COMPILE([
2292#include <sys/types.h>
2293#include <utmp.h>
2294#ifdef HAVE_UTMPX_H
2295#include <utmpx.h>
2296#endif
Damien Miller2994e082000-06-04 15:51:47 +10002297#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002298# include <paths.h>
2299#endif
2300 ],
2301 [ char *utmpx = UTMPX_FILE; ],
2302 [ AC_MSG_RESULT(yes) ],
2303 [ AC_MSG_RESULT(no)
2304 system_utmpx_path=no ]
2305)
2306if test -z "$conf_utmpx_location"; then
2307 if test x"$system_utmpx_path" = x"no" ; then
2308 AC_DEFINE(DISABLE_UTMPX)
2309 fi
2310else
2311 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2312fi
2313
2314dnl wtmpx detection
2315AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2316AC_TRY_COMPILE([
2317#include <sys/types.h>
2318#include <utmp.h>
2319#ifdef HAVE_UTMPX_H
2320#include <utmpx.h>
2321#endif
Damien Miller2994e082000-06-04 15:51:47 +10002322#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002323# include <paths.h>
2324#endif
2325 ],
2326 [ char *wtmpx = WTMPX_FILE; ],
2327 [ AC_MSG_RESULT(yes) ],
2328 [ AC_MSG_RESULT(no)
2329 system_wtmpx_path=no ]
2330)
2331if test -z "$conf_wtmpx_location"; then
2332 if test x"$system_wtmpx_path" = x"no" ; then
2333 AC_DEFINE(DISABLE_WTMPX)
2334 fi
2335else
2336 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2337fi
2338
Damien Miller4018c192000-04-30 09:30:44 +10002339
Damien Miller29ea30d2000-03-17 10:54:15 +11002340if test ! -z "$blibpath" ; then
2341 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2342 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2343fi
2344
Tim Rice4cec93f2002-02-26 08:40:48 -08002345dnl remove pam and dl because they are in $LIBPAM
2346if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002347 LIBS=`echo $LIBS | sed 's/-lpam //'`
2348fi
2349if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2350 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002351fi
2352
Damien Millerbac2d8a2000-09-05 16:13:06 +11002353AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002354AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2355AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002356
Damien Miller7b22d652000-06-18 14:07:04 +10002357# Print summary of options
2358
Damien Miller7b22d652000-06-18 14:07:04 +10002359# Someone please show me a better way :)
2360A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2361B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2362C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2363D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002364E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002365F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002366G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002367H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2368I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2369J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002370
2371echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002372echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002373echo " User binaries: $B"
2374echo " System binaries: $C"
2375echo " Configuration files: $D"
2376echo " Askpass program: $E"
2377echo " Manual pages: $F"
2378echo " PID file: $G"
2379echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002380if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002381echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002382else
Damien Millerf58c6722002-05-13 13:15:42 +10002383echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002384fi
Damien Millera18bbd32002-05-13 10:48:57 +10002385if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002386echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002387fi
Damien Millerf58c6722002-05-13 13:15:42 +10002388echo " Manpage format: $MANTYPE"
2389echo " PAM support: ${PAM_MSG}"
2390echo " KerberosIV support: $KRB4_MSG"
2391echo " KerberosV support: $KRB5_MSG"
2392echo " Smartcard support: $SCARD_MSG"
2393echo " AFS support: $AFS_MSG"
2394echo " S/KEY support: $SKEY_MSG"
2395echo " TCP Wrappers support: $TCPW_MSG"
2396echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002397echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002398echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2399echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2400echo " BSD Auth support: $BSD_AUTH_MSG"
2401echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002402if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002403echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002404fi
2405
Damien Miller7b22d652000-06-18 14:07:04 +10002406echo ""
2407
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002408echo " Host: ${host}"
2409echo " Compiler: ${CC}"
2410echo " Compiler flags: ${CFLAGS}"
2411echo "Preprocessor flags: ${CPPFLAGS}"
2412echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002413echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002414
2415echo ""
2416
Damien Miller82cf0ce2000-12-20 13:34:48 +11002417if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002418 echo "PAM is enabled. You may need to install a PAM control file "
2419 echo "for sshd, otherwise password authentication may fail. "
2420 echo "Example PAM control files can be found in the contrib/ "
2421 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002422 echo ""
2423fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002424
2425if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002426 echo "sftp-server will be disabled. Your compiler does not "
2427 echo "support 64bit integers."
2428 echo ""
2429fi
2430
2431if test ! -z "$RAND_HELPER_CMDHASH" ; then
2432 echo "WARNING: you are using the builtin random number collection "
2433 echo "service. Please read WARNING.RNG and request that your OS "
2434 echo "vendor includes kernel-based random number collection in "
2435 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002436 echo ""
2437fi
Damien Miller60396b02001-02-18 17:01:00 +11002438