blob: ad5d5cde971a7c7ed0ac4e1682658cfb61d805bf [file] [log] [blame]
Tim Rice8eff3192002-06-25 15:35:15 -07001# $Id: configure.ac,v 1.72 2002/06/25 22:35:16 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien 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)
Tim Rice8eff3192002-06-25 15:35:15 -070089 AC_DEFINE(BROKEN_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +000090 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +110091 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000092*-*-dgux*)
93 AC_DEFINE(IP_TOS_IS_BROKEN)
94 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000095*-*-darwin*)
96 AC_DEFINE(BROKEN_GETADDRINFO)
97 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +000098*-*-hpux10.26)
99 if test -z "$GCC"; then
100 CFLAGS="$CFLAGS -Ae"
101 fi
102 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
103 IPADDR_IN_DISPLAY=yes
104 AC_DEFINE(HAVE_SECUREWARE)
105 AC_DEFINE(USE_PIPES)
106 AC_DEFINE(LOGIN_NO_ENDOPT)
107 AC_DEFINE(LOGIN_NEEDS_UTMPX)
108 AC_DEFINE(DISABLE_SHADOW)
109 AC_DEFINE(DISABLE_UTMP)
110 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
111 LIBS="$LIBS -lxnet -lsec -lsecpw"
112 disable_ptmx_check=yes
113 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100114*-*-hpux10*)
115 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000116 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100117 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000118 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100119 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000120 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000121 AC_DEFINE(LOGIN_NO_ENDOPT)
122 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100123 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100124 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000125 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +0000126 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +1100127 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000128*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000129 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100130 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100131 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100132 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000133 AC_DEFINE(LOGIN_NO_ENDOPT)
134 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100135 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100136 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000137 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000138 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000139 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100140*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000141 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000142 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100143 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000144 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000145 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100146 ;;
147*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000148 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000149 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100150 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000151 AC_DEFINE(WITH_IRIX_ARRAY)
152 AC_DEFINE(WITH_IRIX_PROJECT)
153 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000154 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000155 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000156 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100157 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100158*-*-linux*)
159 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100160 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100161 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000162 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100163 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100164 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000165mips-sony-bsd|mips-sony-newsos4)
166 AC_DEFINE(HAVE_NEWS4)
167 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000168 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100169*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100170 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100171 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100172*-*-freebsd*)
173 check_for_libcrypt_later=1
174 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000175*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000176 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100177 conf_utmp_location=/etc/utmp
178 conf_wtmp_location=/usr/adm/wtmp
179 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000180 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000181 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000182 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100183 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000185 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000186 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100187*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000189 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100190 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100191 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000192 AC_DEFINE(LOGIN_NEEDS_UTMPX)
193 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000194 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000195 # hardwire lastlog location (can't detect it on some versions)
196 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000197 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
198 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
199 if test "$sol2ver" -ge 8; then
200 AC_MSG_RESULT(yes)
201 AC_DEFINE(DISABLE_UTMP)
202 AC_DEFINE(DISABLE_WTMP)
203 else
204 AC_MSG_RESULT(no)
205 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100206 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000207*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000208 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000209 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100210 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000211 conf_utmp_location=/etc/utmp
212 conf_wtmp_location=/var/adm/wtmp
213 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000214 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000215 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000216*-ncr-sysv*)
217 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
218 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700219 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000220 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000221 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000222*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000223 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700224 # /usr/ucblib MUST NOT be searched on ReliantUNIX
225 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100226 IPADDR_IN_DISPLAY=yes
227 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000228 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700229 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
230 # Attention: always take care to bind libsocket and libnsl before libc,
231 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000232 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100233*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000234 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100235 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100236 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100237 ;;
238*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100240 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100241 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100242 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100243*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000244 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100245 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100246 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100247*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000248 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100249 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700250 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
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 Miller5dfe9762001-02-16 12:05:39 +1100267 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000268 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000269 AC_DEFINE(DISABLE_SHADOW)
Tim Rice8eff3192002-06-25 15:35:15 -0700270 AC_DEFINE(BROKEN_FD_PASSING)
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 Rice8eff3192002-06-25 15:35:15 -0700278 AC_DEFINE(BROKEN_FD_PASSING)
Tim Ricee991e3c2001-08-07 15:29:07 -0700279 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
280 LIBS="$LIBS -lgen -lrsc"
281 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000282*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000283 AC_MSG_CHECKING(for Digital Unix SIA)
284 no_osfsia=""
285 AC_ARG_WITH(osfsia,
286 [ --with-osfsia Enable Digital Unix SIA],
287 [
288 if test "x$withval" = "xno" ; then
289 AC_MSG_RESULT(disabled)
290 no_osfsia=1
291 fi
292 ],
293 )
294 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000295 if test -f /etc/sia/matrix.conf; then
296 AC_MSG_RESULT(yes)
297 AC_DEFINE(HAVE_OSF_SIA)
298 AC_DEFINE(DISABLE_LOGIN)
299 LIBS="$LIBS -lsecurity -ldb -lm -laud"
300 else
301 AC_MSG_RESULT(no)
302 fi
303 fi
304 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000305
306*-*-nto-qnx)
307 AC_DEFINE(USE_PIPES)
308 AC_DEFINE(NO_X11_UNIX_SOCKETS)
309 AC_DEFINE(MISSING_NFDBITS)
310 AC_DEFINE(MISSING_HOWMANY)
311 AC_DEFINE(MISSING_FD_MASK)
312 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100313esac
314
Damien Millere37bfc12000-06-05 09:37:43 +1000315# Allow user to specify flags
316AC_ARG_WITH(cflags,
317 [ --with-cflags Specify additional flags to pass to compiler],
318 [
319 if test "x$withval" != "xno" ; then
320 CFLAGS="$CFLAGS $withval"
321 fi
322 ]
323)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000324AC_ARG_WITH(cppflags,
325 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
326 [
327 if test "x$withval" != "xno"; then
328 CPPFLAGS="$CPPFLAGS $withval"
329 fi
330 ]
331)
Damien Millere37bfc12000-06-05 09:37:43 +1000332AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000333 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000334 [
335 if test "x$withval" != "xno" ; then
336 LDFLAGS="$LDFLAGS $withval"
337 fi
338 ]
339)
340AC_ARG_WITH(libs,
341 [ --with-libs Specify additional libraries to link with],
342 [
343 if test "x$withval" != "xno" ; then
344 LIBS="$LIBS $withval"
345 fi
346 ]
347)
348
Tim Rice4cec93f2002-02-26 08:40:48 -0800349# Checks for header files.
350AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
351 getopt.h glob.h lastlog.h limits.h login.h \
352 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000353 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000354 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800355 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000356 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800357 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000358 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800359 util.h utime.h utmp.h utmpx.h)
360
Damien Millera22ba012000-03-02 23:09:20 +1100361# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700362AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
363AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000364
Damien Millerdf288022001-02-18 13:07:07 +1100365dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700366if test "x$with_tcp_wrappers" != "xno" ; then
367 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
368 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
369 fi
370fi
Damien Millerdf288022001-02-18 13:07:07 +1100371
Tim Rice13aae5e2001-10-21 17:53:58 -0700372AC_CHECK_FUNC(getspnam, ,
373 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700374
Damien Miller150c8b52002-02-13 23:06:56 +1100375AC_ARG_WITH(rpath,
376 [ --without-rpath Disable auto-added -R linker paths],
377 [
378 if test "x$withval" = "xno" ; then
379 need_dash_r=""
380 fi
381 if test "x$withval" = "xyes" ; then
382 need_dash_r=1
383 fi
384 ]
385)
386
Tim Rice13aae5e2001-10-21 17:53:58 -0700387dnl zlib is required
388AC_ARG_WITH(zlib,
389 [ --with-zlib=PATH Use zlib in PATH],
390 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000391 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100392 AC_MSG_ERROR([*** zlib is required ***])
393 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700394 if test -d "$withval/lib"; then
395 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700396 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700397 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700398 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700399 fi
400 else
401 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700402 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700403 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700404 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700405 fi
406 fi
407 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700408 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700409 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700410 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700411 fi
412 ]
413)
414
Tim Rice17b93e52001-10-23 22:36:54 -0700415AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100416
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000417dnl UnixWare 2.x
418AC_CHECK_FUNC(strcasecmp,
419 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
420)
421AC_CHECK_FUNC(utimes,
422 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
423)
Damien Millerab18c411999-11-11 10:40:23 +1100424
Tim Ricee589a292001-11-03 11:09:32 -0800425dnl Checks for libutil functions
426AC_CHECK_HEADERS(libutil.h)
427AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
428AC_CHECK_FUNCS(logout updwtmp logwtmp)
429
Ben Lindstrom8697e082001-02-24 21:41:10 +0000430AC_FUNC_STRFTIME
431
Damien Miller3c027682001-03-14 11:39:45 +1100432# Check for ALTDIRFUNC glob() extension
433AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
434AC_EGREP_CPP(FOUNDIT,
435 [
436 #include <glob.h>
437 #ifdef GLOB_ALTDIRFUNC
438 FOUNDIT
439 #endif
440 ],
441 [
442 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
443 AC_MSG_RESULT(yes)
444 ],
445 [
446 AC_MSG_RESULT(no)
447 ]
448)
Damien Millerab18c411999-11-11 10:40:23 +1100449
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000450# Check for g.gl_matchc glob() extension
451AC_MSG_CHECKING(for gl_matchc field in glob_t)
452AC_EGREP_CPP(FOUNDIT,
453 [
454 #include <glob.h>
455 int main(void){glob_t g; g.gl_matchc = 1;}
456 ],
457 [
458 AC_DEFINE(GLOB_HAS_GL_MATCHC)
459 AC_MSG_RESULT(yes)
460 ],
461 [
462 AC_MSG_RESULT(no)
463 ]
464)
465
Damien Miller18bb4732001-03-28 14:35:30 +1000466AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
467AC_TRY_RUN(
468 [
469#include <sys/types.h>
470#include <dirent.h>
471int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
472 ],
473 [AC_MSG_RESULT(yes)],
474 [
475 AC_MSG_RESULT(no)
476 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
477 ]
478)
479
Damien Millerc547bf12001-02-16 10:18:12 +1100480# Check whether user wants S/Key support
481SKEY_MSG="no"
482AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700483 [ --with-skey[[=PATH]] Enable S/Key support
484 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100485 [
486 if test "x$withval" != "xno" ; then
487
488 if test "x$withval" != "xyes" ; then
489 CPPFLAGS="$CPPFLAGS -I${withval}/include"
490 LDFLAGS="$LDFLAGS -L${withval}/lib"
491 fi
492
493 AC_DEFINE(SKEY)
494 LIBS="-lskey $LIBS"
495 SKEY_MSG="yes"
496
Tim Rice4cec93f2002-02-26 08:40:48 -0800497 AC_MSG_CHECKING([for s/key support])
498 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100499 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800500#include <stdio.h>
501#include <skey.h>
502int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
503 ],
504 [AC_MSG_RESULT(yes)],
505 [
506 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100507 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
508 ])
509 fi
510 ]
511)
512
513# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700514TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100515AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700516 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
517 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100518 [
519 if test "x$withval" != "xno" ; then
520 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700521 saved_LDFLAGS="$LDFLAGS"
522 saved_CPPFLAGS="$CPPFLAGS"
523 if test -n "${withval}" -a "${withval}" != "yes"; then
524 if test -d "${withval}/lib"; then
525 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700526 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700527 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700528 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700529 fi
530 else
531 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700532 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700533 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700534 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700535 fi
536 fi
537 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700538 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700539 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700540 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700541 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700542 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800543 LIBWRAP="-lwrap"
544 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100545 AC_MSG_CHECKING(for libwrap)
546 AC_TRY_LINK(
547 [
548#include <tcpd.h>
549 int deny_severity = 0, allow_severity = 0;
550 ],
551 [hosts_access(0);],
552 [
553 AC_MSG_RESULT(yes)
554 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800555 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700556 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100557 ],
558 [
559 AC_MSG_ERROR([*** libwrap missing])
560 ]
561 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800562 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100563 fi
564 ]
565)
566
Damien Millerad833b32000-08-23 10:46:23 +1000567dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000568AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700569 clock fchmod fchown freeaddrinfo futimes gai_strerror \
570 getaddrinfo getcwd getgrouplist getnameinfo getopt \
571 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
572 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000573 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
574 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
Ben Lindstrom837461b2002-06-12 16:57:14 +0000575 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
Ben Lindstromf0bfa832002-06-21 00:01:18 +0000576 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
577 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
578 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
Tim Rice13aae5e2001-10-21 17:53:58 -0700579
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000580if test $ac_cv_func_mmap = yes ; then
581AC_MSG_CHECKING([for mmap anon shared])
582AC_TRY_RUN(
583 [
584#include <stdio.h>
585#include <sys/mman.h>
586#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
587#define MAP_ANON MAP_ANONYMOUS
588#endif
589main() { char *p;
590p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
591if (p == (char *)-1)
592 exit(1);
593exit(0);
594}
595 ],
596 [
597 AC_MSG_RESULT(yes)
598 AC_DEFINE(HAVE_MMAP_ANON_SHARED)
599 ],
600 [ AC_MSG_RESULT(no) ]
601)
602fi
603
Tim Rice13aae5e2001-10-21 17:53:58 -0700604dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700605AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700606 AC_CHECK_LIB(gen, dirname,[
607 AC_CACHE_CHECK([for broken dirname],
608 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700609 save_LIBS="$LIBS"
610 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700611 AC_TRY_RUN(
612 [
613#include <libgen.h>
614#include <string.h>
615
616int main(int argc, char **argv) {
617 char *s, buf[32];
618
619 strncpy(buf,"/etc", 32);
620 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700621 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700622 exit(1);
623 } else {
624 exit(0);
625 }
626}
627 ],
628 [ ac_cv_have_broken_dirname="no" ],
629 [ ac_cv_have_broken_dirname="yes" ]
630 )
Tim Rice17b93e52001-10-23 22:36:54 -0700631 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700632 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700633 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700634 LIBS="$LIBS -lgen"
635 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700636 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700637 fi
638 ])
639])
640
Damien Millerad833b32000-08-23 10:46:23 +1000641dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000642AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000643dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000644AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000645AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000646dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000647AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000648AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100649
Damien Miller04f80141999-11-19 15:32:34 +1100650AC_CHECK_FUNC(daemon,
651 [AC_DEFINE(HAVE_DAEMON)],
652 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
653)
654
Damien Miller9fb07e42000-03-05 16:22:59 +1100655AC_CHECK_FUNC(getpagesize,
656 [AC_DEFINE(HAVE_GETPAGESIZE)],
657 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
658)
659
Damien Millercb170cb2000-07-01 16:52:55 +1000660# Check for broken snprintf
661if test "x$ac_cv_func_snprintf" = "xyes" ; then
662 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
663 AC_TRY_RUN(
664 [
665#include <stdio.h>
666int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
667 ],
668 [AC_MSG_RESULT(yes)],
669 [
670 AC_MSG_RESULT(no)
671 AC_DEFINE(BROKEN_SNPRINTF)
672 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
673 ]
674 )
675fi
676
Damien Miller606f8802000-09-16 15:39:56 +1100677AC_FUNC_GETPGRP
678
Damien Millera64b57a2001-01-17 10:44:13 +1100679# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000680PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100681AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100682 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100683 [
Damien Millera64b57a2001-01-17 10:44:13 +1100684 if test "x$withval" != "xno" ; then
685 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
686 AC_MSG_ERROR([PAM headers not found])
687 fi
688
689 AC_CHECK_LIB(dl, dlopen, , )
690 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
691 AC_CHECK_FUNCS(pam_getenvlist)
692
693 disable_shadow=yes
694 PAM_MSG="yes"
695
696 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800697 if test $ac_cv_lib_dl_dlopen = yes; then
698 LIBPAM="-lpam -ldl"
699 else
700 LIBPAM="-lpam"
701 fi
702 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100703 fi
704 ]
705)
Damien Millera22ba012000-03-02 23:09:20 +1100706
Damien Millera64b57a2001-01-17 10:44:13 +1100707# Check for older PAM
708if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100709 # Check PAM strerror arguments (old PAM)
710 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
711 AC_TRY_COMPILE(
712 [
Damien Miller81171112000-04-23 11:14:01 +1000713#include <stdlib.h>
714#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100715 ],
716 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
717 [AC_MSG_RESULT(no)],
718 [
719 AC_DEFINE(HAVE_OLD_PAM)
720 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000721 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100722 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100723 )
Damien Millera22ba012000-03-02 23:09:20 +1100724fi
725
Tim Riceaef73712002-05-11 13:17:42 -0700726# Search for OpenSSL
727saved_CPPFLAGS="$CPPFLAGS"
728saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100729AC_ARG_WITH(ssl-dir,
730 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
731 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000732 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700733 if test -d "$withval/lib"; then
734 if test -n "${need_dash_r}"; then
735 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
736 else
737 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
738 fi
739 else
740 if test -n "${need_dash_r}"; then
741 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
742 else
743 LDFLAGS="-L${withval} ${LDFLAGS}"
744 fi
745 fi
746 if test -d "$withval/include"; then
747 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
748 else
749 CPPFLAGS="-I${withval} ${CPPFLAGS}"
750 fi
Damien Millera22ba012000-03-02 23:09:20 +1100751 fi
752 ]
753)
Tim Riceaef73712002-05-11 13:17:42 -0700754LIBS="$LIBS -lcrypto"
755AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000756 [
Tim Riceaef73712002-05-11 13:17:42 -0700757 dnl Check default openssl install dir
758 if test -n "${need_dash_r}"; then
759 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000760 else
Tim Riceaef73712002-05-11 13:17:42 -0700761 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000762 fi
Tim Riceaef73712002-05-11 13:17:42 -0700763 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
764 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
765 [
766 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
767 ]
768 )
769 ]
770)
771
Damien Millera22ba012000-03-02 23:09:20 +1100772
Damien Millerec932372002-01-22 22:16:03 +1100773# Sanity check OpenSSL headers
774AC_MSG_CHECKING([whether OpenSSL's headers match the library])
775AC_TRY_RUN(
776 [
777#include <string.h>
778#include <openssl/opensslv.h>
779int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
780 ],
781 [
782 AC_MSG_RESULT(yes)
783 ],
784 [
785 AC_MSG_RESULT(no)
786 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
787 ]
788)
789
Damien Millera64b57a2001-01-17 10:44:13 +1100790# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
791# version in OpenSSL. Skip this for PAM
792if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100793 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100794fi
795
Damien Miller6c21c512002-01-22 21:57:53 +1100796
797### Configure cryptographic random number support
798
799# Check wheter OpenSSL seeds itself
800AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
801AC_TRY_RUN(
802 [
803#include <string.h>
804#include <openssl/rand.h>
805int main(void) { return(RAND_status() == 1 ? 0 : 1); }
806 ],
807 [
808 OPENSSL_SEEDS_ITSELF=yes
809 AC_MSG_RESULT(yes)
810 ],
811 [
812 AC_MSG_RESULT(no)
813 # Default to use of the rand helper if OpenSSL doesn't
814 # seed itself
815 USE_RAND_HELPER=yes
816 ]
817)
818
819
820# Do we want to force the use of the rand helper?
821AC_ARG_WITH(rand-helper,
822 [ --with-rand-helper Use subprocess to gather strong randomness ],
823 [
824 if test "x$withval" = "xno" ; then
825 # Force use of OpenSSL's internal RNG, even if
826 # the previous test showed it to be unseeded.
827 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
828 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
829 OPENSSL_SEEDS_ITSELF=yes
830 USE_RAND_HELPER=""
831 fi
832 else
833 USE_RAND_HELPER=yes
834 fi
835 ],
836)
837
838# Which randomness source do we use?
839if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
840 # OpenSSL only
841 AC_DEFINE(OPENSSL_PRNG_ONLY)
842 RAND_MSG="OpenSSL internal ONLY"
843 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800844elif test ! -z "$USE_RAND_HELPER" ; then
845 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100846 RAND_MSG="ssh-rand-helper"
847 INSTALL_SSH_RAND_HELPER="yes"
848fi
849AC_SUBST(INSTALL_SSH_RAND_HELPER)
850
851### Configuration of ssh-rand-helper
852
853# PRNGD TCP socket
854AC_ARG_WITH(prngd-port,
855 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
856 [
Damien Millere996d722002-01-23 11:20:59 +1100857 case "$withval" in
858 no)
859 withval=""
860 ;;
861 [[0-9]]*)
862 ;;
863 *)
864 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
865 ;;
866 esac
867 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100868 PRNGD_PORT="$withval"
869 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
870 fi
871 ]
872)
873
874# PRNGD Unix domain socket
875AC_ARG_WITH(prngd-socket,
876 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
877 [
Damien Millere996d722002-01-23 11:20:59 +1100878 case "$withval" in
879 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100880 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100881 ;;
882 no)
883 withval=""
884 ;;
885 /*)
886 ;;
887 *)
888 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
889 ;;
890 esac
891
892 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100893 if test ! -z "$PRNGD_PORT" ; then
894 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
895 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100896 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100897 AC_MSG_WARN(Entropy socket is not readable)
898 fi
899 PRNGD_SOCKET="$withval"
900 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
901 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800902 ],
903 [
904 # Check for existing socket only if we don't have a random device already
905 if test "$USE_RAND_HELPER" = yes ; then
906 AC_MSG_CHECKING(for PRNGD/EGD socket)
907 # Insert other locations here
908 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
909 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
910 PRNGD_SOCKET="$sock"
911 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
912 break;
913 fi
914 done
915 if test ! -z "$PRNGD_SOCKET" ; then
916 AC_MSG_RESULT($PRNGD_SOCKET)
917 else
918 AC_MSG_RESULT(not found)
919 fi
920 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100921 ]
922)
923
924# Change default command timeout for hashing entropy source
925entropy_timeout=200
926AC_ARG_WITH(entropy-timeout,
927 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
928 [
929 if test "x$withval" != "xno" ; then
930 entropy_timeout=$withval
931 fi
932 ]
933)
Damien Miller6c21c512002-01-22 21:57:53 +1100934AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
935
Damien Millerd3f6ad22002-06-25 10:24:47 +1000936SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000937AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000938 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000939 [
940 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000941 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000942 fi
943 ]
944)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000945AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
946AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000947
Tim Rice88f2ab52002-03-17 12:17:34 -0800948# We do this little dance with the search path to insure
949# that programs that we select for use by installed programs
950# (which may be run by the super-user) come from trusted
951# locations before they come from the user's private area.
952# This should help avoid accidentally configuring some
953# random version of a program in someone's personal bin.
954
955OPATH=$PATH
956PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700957test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800958test -d /sbin && PATH=$PATH:/sbin
959test -d /usr/sbin && PATH=$PATH:/usr/sbin
960PATH=$PATH:/etc:$OPATH
961
Damien Miller6c21c512002-01-22 21:57:53 +1100962# These programs are used by the command hashing source to gather entropy
963OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
964OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
965OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
966OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
967OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
968OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
969OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
970OSSH_PATH_ENTROPY_PROG(PROG_W, w)
971OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
972OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
973OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
974OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
975OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
976OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
977OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
978OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800979# restore PATH
980PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100981
982# Where does ssh-rand-helper get its randomness from?
983INSTALL_SSH_PRNG_CMDS=""
984if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
985 if test ! -z "$PRNGD_PORT" ; then
986 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
987 elif test ! -z "$PRNGD_SOCKET" ; then
988 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
989 else
990 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
991 RAND_HELPER_CMDHASH=yes
992 INSTALL_SSH_PRNG_CMDS="yes"
993 fi
994fi
995AC_SUBST(INSTALL_SSH_PRNG_CMDS)
996
997
Ben Lindstromb5628642000-10-18 00:02:25 +0000998# Cheap hack to ensure NEWS-OS libraries are arranged right.
999if test ! -z "$SONY" ; then
1000 LIBS="$LIBS -liberty";
1001fi
1002
Damien Millera22ba012000-03-02 23:09:20 +11001003# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001004AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001005AC_CHECK_SIZEOF(short int, 2)
1006AC_CHECK_SIZEOF(int, 4)
1007AC_CHECK_SIZEOF(long int, 4)
1008AC_CHECK_SIZEOF(long long int, 8)
1009
Damien Millerfa2bb692002-04-23 23:22:25 +10001010# Sanity check long long for some platforms (AIX)
1011if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1012 ac_cv_sizeof_long_long_int=0
1013fi
1014
Damien Millera22ba012000-03-02 23:09:20 +11001015# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001016AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1017 AC_TRY_COMPILE(
1018 [ #include <sys/types.h> ],
1019 [ u_int a; a = 1;],
1020 [ ac_cv_have_u_int="yes" ],
1021 [ ac_cv_have_u_int="no" ]
1022 )
1023])
1024if test "x$ac_cv_have_u_int" = "xyes" ; then
1025 AC_DEFINE(HAVE_U_INT)
1026 have_u_int=1
1027fi
1028
Damien Miller61e50f12000-05-08 20:49:37 +10001029AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1030 AC_TRY_COMPILE(
1031 [ #include <sys/types.h> ],
1032 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1033 [ ac_cv_have_intxx_t="yes" ],
1034 [ ac_cv_have_intxx_t="no" ]
1035 )
1036])
1037if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1038 AC_DEFINE(HAVE_INTXX_T)
1039 have_intxx_t=1
1040fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001041
1042if (test -z "$have_intxx_t" && \
1043 test "x$ac_cv_header_stdint_h" = "xyes")
1044then
1045 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1046 AC_TRY_COMPILE(
1047 [ #include <stdint.h> ],
1048 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1049 [
1050 AC_DEFINE(HAVE_INTXX_T)
1051 AC_MSG_RESULT(yes)
1052 ],
1053 [ AC_MSG_RESULT(no) ]
1054 )
1055fi
1056
Damien Miller578783e2000-09-23 14:12:24 +11001057AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1058 AC_TRY_COMPILE(
1059 [ #include <sys/types.h> ],
1060 [ int64_t a; a = 1;],
1061 [ ac_cv_have_int64_t="yes" ],
1062 [ ac_cv_have_int64_t="no" ]
1063 )
1064])
1065if test "x$ac_cv_have_int64_t" = "xyes" ; then
1066 AC_DEFINE(HAVE_INT64_T)
1067 have_int64_t=1
1068fi
1069
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001070if test -z "$have_int64_t" ; then
1071 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1072 AC_TRY_COMPILE(
1073 [ #include <sys/socket.h> ],
1074 [ int64_t a; a = 1],
1075 [
1076 AC_DEFINE(HAVE_INT64_T)
1077 AC_MSG_RESULT(yes)
1078 ],
1079 [ AC_MSG_RESULT(no) ]
1080 )
1081fi
1082
Tim Rice4cec93f2002-02-26 08:40:48 -08001083if test -z "$have_int64_t" ; then
1084 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1085 AC_TRY_COMPILE(
1086 [ #include <sys/bitypes.h> ],
1087 [ int64_t a; a = 1],
1088 [
1089 AC_DEFINE(HAVE_INT64_T)
1090 AC_MSG_RESULT(yes)
1091 ],
1092 [ AC_MSG_RESULT(no) ]
1093 )
1094fi
1095
Damien Miller61e50f12000-05-08 20:49:37 +10001096AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1097 AC_TRY_COMPILE(
1098 [ #include <sys/types.h> ],
1099 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1100 [ ac_cv_have_u_intxx_t="yes" ],
1101 [ ac_cv_have_u_intxx_t="no" ]
1102 )
1103])
1104if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1105 AC_DEFINE(HAVE_U_INTXX_T)
1106 have_u_intxx_t=1
1107fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001108
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001109if test -z "$have_u_intxx_t" ; then
1110 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1111 AC_TRY_COMPILE(
1112 [ #include <sys/socket.h> ],
1113 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1114 [
1115 AC_DEFINE(HAVE_U_INTXX_T)
1116 AC_MSG_RESULT(yes)
1117 ],
1118 [ AC_MSG_RESULT(no) ]
1119 )
1120fi
1121
Damien Miller578783e2000-09-23 14:12:24 +11001122AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1123 AC_TRY_COMPILE(
1124 [ #include <sys/types.h> ],
1125 [ u_int64_t a; a = 1;],
1126 [ ac_cv_have_u_int64_t="yes" ],
1127 [ ac_cv_have_u_int64_t="no" ]
1128 )
1129])
1130if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1131 AC_DEFINE(HAVE_U_INT64_T)
1132 have_u_int64_t=1
1133fi
1134
Tim Rice4cec93f2002-02-26 08:40:48 -08001135if test -z "$have_u_int64_t" ; then
1136 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1137 AC_TRY_COMPILE(
1138 [ #include <sys/bitypes.h> ],
1139 [ u_int64_t a; a = 1],
1140 [
1141 AC_DEFINE(HAVE_U_INT64_T)
1142 AC_MSG_RESULT(yes)
1143 ],
1144 [ AC_MSG_RESULT(no) ]
1145 )
1146fi
1147
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001148if test -z "$have_u_intxx_t" ; then
1149 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1150 AC_TRY_COMPILE(
1151 [
1152#include <sys/types.h>
1153 ],
1154 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1155 [ ac_cv_have_uintxx_t="yes" ],
1156 [ ac_cv_have_uintxx_t="no" ]
1157 )
1158 ])
1159 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1160 AC_DEFINE(HAVE_UINTXX_T)
1161 fi
1162fi
1163
1164if test -z "$have_uintxx_t" ; then
1165 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1166 AC_TRY_COMPILE(
1167 [ #include <stdint.h> ],
1168 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1169 [
1170 AC_DEFINE(HAVE_UINTXX_T)
1171 AC_MSG_RESULT(yes)
1172 ],
1173 [ AC_MSG_RESULT(no) ]
1174 )
1175fi
1176
Damien Milleredb82922000-06-20 13:25:52 +10001177if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1178 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001179then
1180 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1181 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001182 [
1183#include <sys/bitypes.h>
1184 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001185 [
Damien Miller70494d12000-04-03 15:57:06 +10001186 int8_t a; int16_t b; int32_t c;
1187 u_int8_t e; u_int16_t f; u_int32_t g;
1188 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001189 ],
1190 [
1191 AC_DEFINE(HAVE_U_INTXX_T)
1192 AC_DEFINE(HAVE_INTXX_T)
1193 AC_MSG_RESULT(yes)
1194 ],
1195 [AC_MSG_RESULT(no)]
1196 )
1197fi
1198
Damien Miller58be7382001-09-15 21:31:54 +10001199
1200AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1201 AC_TRY_COMPILE(
1202 [
1203#include <sys/types.h>
1204 ],
1205 [ u_char foo; foo = 125; ],
1206 [ ac_cv_have_u_char="yes" ],
1207 [ ac_cv_have_u_char="no" ]
1208 )
1209])
1210if test "x$ac_cv_have_u_char" = "xyes" ; then
1211 AC_DEFINE(HAVE_U_CHAR)
1212fi
1213
Tim Rice13aae5e2001-10-21 17:53:58 -07001214TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001215
Tim Rice200a5c02002-02-26 22:12:34 -08001216AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001217
Damien Miller61e50f12000-05-08 20:49:37 +10001218AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1219 AC_TRY_COMPILE(
1220 [
1221#include <sys/types.h>
1222 ],
1223 [ size_t foo; foo = 1235; ],
1224 [ ac_cv_have_size_t="yes" ],
1225 [ ac_cv_have_size_t="no" ]
1226 )
1227])
1228if test "x$ac_cv_have_size_t" = "xyes" ; then
1229 AC_DEFINE(HAVE_SIZE_T)
1230fi
Damien Miller95058511999-12-29 10:36:45 +11001231
Damien Miller615f9392000-05-17 22:53:33 +10001232AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1233 AC_TRY_COMPILE(
1234 [
1235#include <sys/types.h>
1236 ],
1237 [ ssize_t foo; foo = 1235; ],
1238 [ ac_cv_have_ssize_t="yes" ],
1239 [ ac_cv_have_ssize_t="no" ]
1240 )
1241])
1242if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1243 AC_DEFINE(HAVE_SSIZE_T)
1244fi
1245
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001246AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1247 AC_TRY_COMPILE(
1248 [
1249#include <time.h>
1250 ],
1251 [ clock_t foo; foo = 1235; ],
1252 [ ac_cv_have_clock_t="yes" ],
1253 [ ac_cv_have_clock_t="no" ]
1254 )
1255])
1256if test "x$ac_cv_have_clock_t" = "xyes" ; then
1257 AC_DEFINE(HAVE_CLOCK_T)
1258fi
1259
Damien Millerb54b40e2000-06-23 08:23:34 +10001260AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1261 AC_TRY_COMPILE(
1262 [
1263#include <sys/types.h>
1264#include <sys/socket.h>
1265 ],
1266 [ sa_family_t foo; foo = 1235; ],
1267 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001268 [ AC_TRY_COMPILE(
1269 [
1270#include <sys/types.h>
1271#include <sys/socket.h>
1272#include <netinet/in.h>
1273 ],
1274 [ sa_family_t foo; foo = 1235; ],
1275 [ ac_cv_have_sa_family_t="yes" ],
1276
Damien Millerb54b40e2000-06-23 08:23:34 +10001277 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001278 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001279 )
1280])
1281if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1282 AC_DEFINE(HAVE_SA_FAMILY_T)
1283fi
1284
Damien Miller0f91b4e2000-06-18 15:43:25 +10001285AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1286 AC_TRY_COMPILE(
1287 [
1288#include <sys/types.h>
1289 ],
1290 [ pid_t foo; foo = 1235; ],
1291 [ ac_cv_have_pid_t="yes" ],
1292 [ ac_cv_have_pid_t="no" ]
1293 )
1294])
1295if test "x$ac_cv_have_pid_t" = "xyes" ; then
1296 AC_DEFINE(HAVE_PID_T)
1297fi
1298
1299AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1300 AC_TRY_COMPILE(
1301 [
1302#include <sys/types.h>
1303 ],
1304 [ mode_t foo; foo = 1235; ],
1305 [ ac_cv_have_mode_t="yes" ],
1306 [ ac_cv_have_mode_t="no" ]
1307 )
1308])
1309if test "x$ac_cv_have_mode_t" = "xyes" ; then
1310 AC_DEFINE(HAVE_MODE_T)
1311fi
1312
Damien Miller61e50f12000-05-08 20:49:37 +10001313
1314AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1315 AC_TRY_COMPILE(
1316 [
Damien Miller81171112000-04-23 11:14:01 +10001317#include <sys/types.h>
1318#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001319 ],
1320 [ struct sockaddr_storage s; ],
1321 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1322 [ ac_cv_have_struct_sockaddr_storage="no" ]
1323 )
1324])
1325if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1326 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1327fi
Damien Miller34132e52000-01-14 15:45:46 +11001328
Damien Miller61e50f12000-05-08 20:49:37 +10001329AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1330 AC_TRY_COMPILE(
1331 [
Damien Miller7b22d652000-06-18 14:07:04 +10001332#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001333#include <netinet/in.h>
1334 ],
1335 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1336 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1337 [ ac_cv_have_struct_sockaddr_in6="no" ]
1338 )
1339])
1340if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1341 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1342fi
Damien Miller34132e52000-01-14 15:45:46 +11001343
Damien Miller61e50f12000-05-08 20:49:37 +10001344AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1345 AC_TRY_COMPILE(
1346 [
Damien Miller7b22d652000-06-18 14:07:04 +10001347#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001348#include <netinet/in.h>
1349 ],
1350 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1351 [ ac_cv_have_struct_in6_addr="yes" ],
1352 [ ac_cv_have_struct_in6_addr="no" ]
1353 )
1354])
1355if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1356 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1357fi
Damien Miller34132e52000-01-14 15:45:46 +11001358
Damien Miller61e50f12000-05-08 20:49:37 +10001359AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1360 AC_TRY_COMPILE(
1361 [
Damien Miller81171112000-04-23 11:14:01 +10001362#include <sys/types.h>
1363#include <sys/socket.h>
1364#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001365 ],
1366 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1367 [ ac_cv_have_struct_addrinfo="yes" ],
1368 [ ac_cv_have_struct_addrinfo="no" ]
1369 )
1370])
1371if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1372 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1373fi
1374
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001375AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1376 AC_TRY_COMPILE(
1377 [ #include <sys/time.h> ],
1378 [ struct timeval tv; tv.tv_sec = 1;],
1379 [ ac_cv_have_struct_timeval="yes" ],
1380 [ ac_cv_have_struct_timeval="no" ]
1381 )
1382])
1383if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1384 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1385 have_struct_timeval=1
1386fi
1387
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001388# If we don't have int64_t then we can't compile sftp-server. So don't
1389# even attempt to do it.
1390if test "x$ac_cv_have_int64_t" = "xno" -a \
1391 "x$ac_cv_sizeof_long_int" != "x8" -a \
1392 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1393 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001394else
1395dnl test snprintf (broken on SCO w/gcc)
1396 AC_TRY_RUN(
1397 [
1398#include <stdio.h>
1399#include <string.h>
1400#ifdef HAVE_SNPRINTF
1401main()
1402{
1403 char buf[50];
1404 char expected_out[50];
1405 int mazsize = 50 ;
1406#if (SIZEOF_LONG_INT == 8)
1407 long int num = 0x7fffffffffffffff;
1408#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001409 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001410#endif
1411 strcpy(expected_out, "9223372036854775807");
1412 snprintf(buf, mazsize, "%lld", num);
1413 if(strcmp(buf, expected_out) != 0)
1414 exit(1);
1415 exit(0);
1416}
1417#else
1418main() { exit(0); }
1419#endif
1420 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1421 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001422fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001423AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001424
Damien Miller78315eb2000-09-29 23:01:36 +11001425dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001426OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1427OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1428OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1429OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1430OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001431OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001432OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1433OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001434OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001435OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1436OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1437OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1438OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001439OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1440OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1441OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1442OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001443
1444AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001445
Damien Miller61e50f12000-05-08 20:49:37 +10001446AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1447 ac_cv_have_ss_family_in_struct_ss, [
1448 AC_TRY_COMPILE(
1449 [
Damien Miller81171112000-04-23 11:14:01 +10001450#include <sys/types.h>
1451#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001452 ],
1453 [ struct sockaddr_storage s; s.ss_family = 1; ],
1454 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1455 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1456 )
1457])
1458if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1459 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1460fi
1461
Damien Miller61e50f12000-05-08 20:49:37 +10001462AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1463 ac_cv_have___ss_family_in_struct_ss, [
1464 AC_TRY_COMPILE(
1465 [
Damien Miller81171112000-04-23 11:14:01 +10001466#include <sys/types.h>
1467#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001468 ],
1469 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1470 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1471 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1472 )
1473])
1474if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1475 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1476fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001477
Damien Millerad833b32000-08-23 10:46:23 +10001478AC_CACHE_CHECK([for pw_class field in struct passwd],
1479 ac_cv_have_pw_class_in_struct_passwd, [
1480 AC_TRY_COMPILE(
1481 [
Damien Millerad833b32000-08-23 10:46:23 +10001482#include <pwd.h>
1483 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001484 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001485 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1486 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1487 )
1488])
1489if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1490 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1491fi
1492
Kevin Steves82456952001-06-22 21:14:18 +00001493AC_CACHE_CHECK([for pw_expire field in struct passwd],
1494 ac_cv_have_pw_expire_in_struct_passwd, [
1495 AC_TRY_COMPILE(
1496 [
1497#include <pwd.h>
1498 ],
1499 [ struct passwd p; p.pw_expire = 0; ],
1500 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1501 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1502 )
1503])
1504if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1505 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1506fi
1507
1508AC_CACHE_CHECK([for pw_change field in struct passwd],
1509 ac_cv_have_pw_change_in_struct_passwd, [
1510 AC_TRY_COMPILE(
1511 [
1512#include <pwd.h>
1513 ],
1514 [ struct passwd p; p.pw_change = 0; ],
1515 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1516 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1517 )
1518])
1519if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1520 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1521fi
Damien Miller61e50f12000-05-08 20:49:37 +10001522
Tim Rice28bbb0c2002-05-27 17:37:32 -07001523dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001524AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1525 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001526 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001527 [
Tim Riceae49fe62002-04-12 10:26:21 -07001528#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001529#include <sys/socket.h>
1530#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001531int main() {
1532#ifdef msg_accrights
1533exit(1);
1534#endif
1535struct msghdr m;
1536m.msg_accrights = 0;
1537exit(0);
1538}
Kevin Steves939c9db2002-03-22 17:23:25 +00001539 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001540 [ ac_cv_have_accrights_in_msghdr="yes" ],
1541 [ ac_cv_have_accrights_in_msghdr="no" ]
1542 )
1543])
1544if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1545 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1546fi
1547
Kevin Stevesa44e0352002-04-07 16:18:03 +00001548AC_CACHE_CHECK([for msg_control field in struct msghdr],
1549 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001550 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001551 [
Tim Riceae49fe62002-04-12 10:26:21 -07001552#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001553#include <sys/socket.h>
1554#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001555int main() {
1556#ifdef msg_control
1557exit(1);
1558#endif
1559struct msghdr m;
1560m.msg_control = 0;
1561exit(0);
1562}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001563 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001564 [ ac_cv_have_control_in_msghdr="yes" ],
1565 [ ac_cv_have_control_in_msghdr="no" ]
1566 )
1567])
1568if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1569 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1570fi
1571
Damien Miller61e50f12000-05-08 20:49:37 +10001572AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1573 AC_TRY_LINK([],
1574 [ extern char *__progname; printf("%s", __progname); ],
1575 [ ac_cv_libc_defines___progname="yes" ],
1576 [ ac_cv_libc_defines___progname="no" ]
1577 )
1578])
1579if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1580 AC_DEFINE(HAVE___PROGNAME)
1581fi
1582
Kevin Steves4846f4a2002-03-22 18:19:53 +00001583AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1584 AC_TRY_LINK([
1585#include <stdio.h>
1586],
1587 [ printf("%s", __FUNCTION__); ],
1588 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1589 [ ac_cv_cc_implements___FUNCTION__="no" ]
1590 )
1591])
1592if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1593 AC_DEFINE(HAVE___FUNCTION__)
1594fi
1595
1596AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1597 AC_TRY_LINK([
1598#include <stdio.h>
1599],
1600 [ printf("%s", __func__); ],
1601 [ ac_cv_cc_implements___func__="yes" ],
1602 [ ac_cv_cc_implements___func__="no" ]
1603 )
1604])
1605if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1606 AC_DEFINE(HAVE___func__)
1607fi
1608
Damien Miller4f8e6692001-07-14 13:22:53 +10001609AC_CACHE_CHECK([whether getopt has optreset support],
1610 ac_cv_have_getopt_optreset, [
1611 AC_TRY_LINK(
1612 [
1613#include <getopt.h>
1614 ],
1615 [ extern int optreset; optreset = 0; ],
1616 [ ac_cv_have_getopt_optreset="yes" ],
1617 [ ac_cv_have_getopt_optreset="no" ]
1618 )
1619])
1620if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1621 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1622fi
Damien Millera22ba012000-03-02 23:09:20 +11001623
Damien Millerecbb26d2000-07-15 14:59:14 +10001624AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1625 AC_TRY_LINK([],
1626 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1627 [ ac_cv_libc_defines_sys_errlist="yes" ],
1628 [ ac_cv_libc_defines_sys_errlist="no" ]
1629 )
1630])
1631if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1632 AC_DEFINE(HAVE_SYS_ERRLIST)
1633fi
1634
1635
Damien Miller11fa2cc2000-08-16 10:35:58 +10001636AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1637 AC_TRY_LINK([],
1638 [ extern int sys_nerr; printf("%i", sys_nerr);],
1639 [ ac_cv_libc_defines_sys_nerr="yes" ],
1640 [ ac_cv_libc_defines_sys_nerr="no" ]
1641 )
1642])
1643if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1644 AC_DEFINE(HAVE_SYS_NERR)
1645fi
1646
Damien Miller85de5802001-09-18 14:01:11 +10001647SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001648
1649# Check whether user wants sectok support
1650AC_ARG_WITH(sectok,
1651 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001652 [
1653 if test "x$withval" != "xno" ; then
1654 if test "x$withval" != "xyes" ; then
1655 CPPFLAGS="$CPPFLAGS -I${withval}"
1656 LDFLAGS="$LDFLAGS -L${withval}"
1657 if test ! -z "$need_dash_r" ; then
1658 LDFLAGS="$LDFLAGS -R${withval}"
1659 fi
1660 if test ! -z "$blibpath" ; then
1661 blibpath="$blibpath:${withval}"
1662 fi
1663 fi
1664 AC_CHECK_HEADERS(sectok.h)
1665 if test "$ac_cv_header_sectok_h" != yes; then
1666 AC_MSG_ERROR(Can't find sectok.h)
1667 fi
1668 AC_CHECK_LIB(sectok, sectok_open)
1669 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1670 AC_MSG_ERROR(Can't find libsectok)
1671 fi
1672 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001673 AC_DEFINE(USE_SECTOK)
1674 SCARD_MSG="yes, using sectok"
1675 fi
1676 ]
1677)
1678
1679# Check whether user wants OpenSC support
1680AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001681 AC_HELP_STRING([--with-opensc=PFX],
1682 [Enable smartcard support using OpenSC]),
1683 opensc_config_prefix="$withval", opensc_config_prefix="")
1684if test x$opensc_config_prefix != x ; then
1685 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1686 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1687 if test "$OPENSC_CONFIG" != "no"; then
1688 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1689 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1690 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1691 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1692 AC_DEFINE(SMARTCARD)
1693 AC_DEFINE(USE_OPENSC)
1694 SCARD_MSG="yes, using OpenSC"
1695 fi
1696fi
Damien Miller85de5802001-09-18 14:01:11 +10001697
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001698# Check whether user wants Kerberos 5 support
1699KRB5_MSG="no"
1700AC_ARG_WITH(kerberos5,
1701 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1702 [
1703 if test "x$withval" != "xno" ; then
1704 if test "x$withval" = "xyes" ; then
1705 KRB5ROOT="/usr/local"
1706 else
1707 KRB5ROOT=${withval}
1708 fi
1709 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1710 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1711 AC_DEFINE(KRB5)
1712 KRB5_MSG="yes"
1713 AC_MSG_CHECKING(whether we are using Heimdal)
1714 AC_TRY_COMPILE([ #include <krb5.h> ],
1715 [ char *tmp = heimdal_version; ],
1716 [ AC_MSG_RESULT(yes)
1717 AC_DEFINE(HEIMDAL)
1718 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1719 ],
1720 [ AC_MSG_RESULT(no)
1721 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1722 ]
1723 )
1724 if test ! -z "$need_dash_r" ; then
1725 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1726 fi
1727 if test ! -z "$blibpath" ; then
1728 blibpath="$blibpath:${KRB5ROOT}/lib"
1729 fi
1730 AC_CHECK_LIB(resolv, dn_expand, , )
1731
1732 KRB5=yes
1733 fi
1734 ]
1735)
1736# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001737KRB4_MSG="no"
1738AC_ARG_WITH(kerberos4,
1739 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1740 [
1741 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001742 if test "x$withval" != "xyes" ; then
1743 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1744 LDFLAGS="$LDFLAGS -L${withval}/lib"
1745 if test ! -z "$need_dash_r" ; then
1746 LDFLAGS="$LDFLAGS -R${withval}/lib"
1747 fi
1748 if test ! -z "$blibpath" ; then
1749 blibpath="$blibpath:${withval}/lib"
1750 fi
1751 else
1752 if test -d /usr/include/kerberosIV ; then
1753 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1754 fi
1755 fi
1756
1757 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001758 if test "$ac_cv_header_krb_h" != yes; then
1759 AC_MSG_WARN([Cannot find krb.h, build may fail])
1760 fi
Damien Miller98344742001-03-28 14:37:06 +10001761 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001762 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001763 AC_CHECK_LIB(krb4, main)
1764 if test "$ac_cv_lib_krb4_main" != yes; then
1765 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1766 else
1767 KLIBS="-lkrb4"
1768 fi
1769 else
1770 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001771 fi
Damien Miller98344742001-03-28 14:37:06 +10001772 AC_CHECK_LIB(des, des_cbc_encrypt)
1773 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1774 AC_CHECK_LIB(des425, des_cbc_encrypt)
1775 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1776 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1777 else
1778 KLIBS="-ldes425"
1779 fi
1780 else
1781 KLIBS="-ldes"
1782 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001783 AC_CHECK_LIB(resolv, dn_expand, , )
1784 KRB4=yes
1785 KRB4_MSG="yes"
1786 AC_DEFINE(KRB4)
1787 fi
1788 ]
1789)
1790
1791# Check whether user wants AFS support
1792AFS_MSG="no"
1793AC_ARG_WITH(afs,
1794 [ --with-afs=PATH Enable AFS support],
1795 [
1796 if test "x$withval" != "xno" ; then
1797
1798 if test "x$withval" != "xyes" ; then
1799 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1800 LDFLAGS="$LDFLAGS -L${withval}/lib"
1801 fi
1802
1803 if test -z "$KRB4" ; then
1804 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1805 fi
1806
1807 LIBS="-lkafs $LIBS"
1808 if test ! -z "$AFS_LIBS" ; then
1809 LIBS="$LIBS $AFS_LIBS"
1810 fi
1811 AC_DEFINE(AFS)
1812 AFS_MSG="yes"
1813 fi
1814 ]
1815)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001816LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001817
Damien Millera22ba012000-03-02 23:09:20 +11001818# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001819
Damien Millerf58c6722002-05-13 13:15:42 +10001820PRIVSEP_PATH=/var/empty
1821AC_ARG_WITH(privsep-path,
Damien Miller74cc5bb2002-05-22 11:02:15 +10001822 [ --with-privsep-path=xxx Path for privilege separation chroot ],
Damien Millerf58c6722002-05-13 13:15:42 +10001823 [
1824 if test "x$withval" != "$no" ; then
1825 PRIVSEP_PATH=$withval
1826 fi
1827 ]
1828)
1829AC_SUBST(PRIVSEP_PATH)
1830
Damien Millera22ba012000-03-02 23:09:20 +11001831AC_ARG_WITH(xauth,
1832 [ --with-xauth=PATH Specify path to xauth program ],
1833 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001834 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001835 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001836 fi
1837 ],
1838 [
Damien Miller78315eb2000-09-29 23:01:36 +11001839 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 +10001840 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001841 xauth_path="/usr/openwin/bin/xauth"
1842 fi
1843 ]
1844)
1845
Damien Millera19cf472000-11-29 13:28:50 +11001846if test -z "$xauth_path" ; then
1847 XAUTH_PATH="undefined"
1848 AC_SUBST(XAUTH_PATH)
1849else
Damien Millera22ba012000-03-02 23:09:20 +11001850 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001851 XAUTH_PATH=$xauth_path
1852 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001853fi
Damien Millera22ba012000-03-02 23:09:20 +11001854
1855# Check for mail directory (last resort if we cannot get it from headers)
1856if test ! -z "$MAIL" ; then
1857 maildir=`dirname $MAIL`
1858 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1859fi
1860
Damien Millera22ba012000-03-02 23:09:20 +11001861if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001862 if test "x$disable_ptmx_check" != "xyes" ; then
1863 AC_CHECK_FILE("/dev/ptmx",
1864 [
1865 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1866 have_dev_ptmx=1
1867 ]
1868 )
1869 fi
Damien Millera22ba012000-03-02 23:09:20 +11001870fi
Damien Miller204ad072000-03-02 23:56:12 +11001871AC_CHECK_FILE("/dev/ptc",
1872 [
1873 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1874 have_dev_ptc=1
1875 ]
1876)
1877
Damien Millera22ba012000-03-02 23:09:20 +11001878# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001879AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001880 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001881 [
Damien Miller897741e2001-04-16 10:41:46 +10001882 case "$withval" in
1883 man|cat|doc)
1884 MANTYPE=$withval
1885 ;;
1886 *)
1887 AC_MSG_ERROR(invalid man type: $withval)
1888 ;;
1889 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001890 ]
1891)
Ben Lindstrombc709922001-04-18 18:04:21 +00001892if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001893 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001894 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1895 MANTYPE=doc
1896 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1897 MANTYPE=man
1898 else
1899 MANTYPE=cat
1900 fi
1901fi
Damien Miller670a4b82000-01-22 13:53:11 +11001902AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001903if test "$MANTYPE" = "doc"; then
1904 mansubdir=man;
1905else
1906 mansubdir=$MANTYPE;
1907fi
1908AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001909
Damien Millera22ba012000-03-02 23:09:20 +11001910# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001911MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001912AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001913 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001914 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001915 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001916 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001917 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001918 fi
1919 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001920)
1921
Damien Millera22ba012000-03-02 23:09:20 +11001922# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001923AC_ARG_WITH(shadow,
1924 [ --without-shadow Disable shadow password support],
1925 [
1926 if test "x$withval" = "xno" ; then
1927 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001928 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001929 fi
1930 ]
1931)
1932
Damien Miller1f335fb2000-06-26 11:31:33 +10001933if test -z "$disable_shadow" ; then
1934 AC_MSG_CHECKING([if the systems has expire shadow information])
1935 AC_TRY_COMPILE(
1936 [
1937#include <sys/types.h>
1938#include <shadow.h>
1939 struct spwd sp;
1940 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1941 [ sp_expire_available=yes ], []
1942 )
1943
1944 if test "x$sp_expire_available" = "xyes" ; then
1945 AC_MSG_RESULT(yes)
1946 AC_DEFINE(HAS_SHADOW_EXPIRE)
1947 else
1948 AC_MSG_RESULT(no)
1949 fi
1950fi
1951
Damien Millera22ba012000-03-02 23:09:20 +11001952# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001953if test ! -z "$IPADDR_IN_DISPLAY" ; then
1954 DISPLAY_HACK_MSG="yes"
1955 AC_DEFINE(IPADDR_IN_DISPLAY)
1956else
1957 DISPLAY_HACK_MSG="no"
1958 AC_ARG_WITH(ipaddr-display,
1959 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1960 [
1961 if test "x$withval" != "xno" ; then
1962 AC_DEFINE(IPADDR_IN_DISPLAY)
1963 DISPLAY_HACK_MSG="yes"
1964 fi
1965 ]
1966 )
1967fi
Damien Miller76112de1999-12-21 11:18:08 +11001968
Tim Rice43a1c132002-04-17 21:19:14 -07001969dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1970if test $ac_cv_func_login_getcapbool = "yes" -a \
1971 $ac_cv_header_login_cap_h = "yes" ; then
1972 USES_LOGIN_CONF=yes
1973fi
Damien Millera22ba012000-03-02 23:09:20 +11001974# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001975SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001976AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001977 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001978 [
Tim Rice43a1c132002-04-17 21:19:14 -07001979 if test "$USES_LOGIN_CONF" = "yes" ; then
1980 AC_MSG_WARN([
1981--with-default-path=PATH has no effect on this system.
1982Edit /etc/login.conf instead.])
1983 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001984 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001985 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001986 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001987 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001988 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1989 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1990 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001991 AC_TRY_RUN(
1992 [
1993/* find out what STDPATH is */
1994#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001995#ifdef HAVE_PATHS_H
1996# include <paths.h>
1997#endif
1998#ifndef _PATH_STDPATH
1999# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2000#endif
2001#include <sys/types.h>
2002#include <sys/stat.h>
2003#include <fcntl.h>
2004#define DATA "conftest.stdpath"
2005
2006main()
2007{
2008 FILE *fd;
2009 int rc;
2010
2011 fd = fopen(DATA,"w");
2012 if(fd == NULL)
2013 exit(1);
2014
2015 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2016 exit(1);
2017
2018 exit(0);
2019}
2020 ], [ user_path=`cat conftest.stdpath` ],
2021 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2022 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2023 )
2024# make sure $bindir is in USER_PATH so scp will work
2025 t_bindir=`eval echo ${bindir}`
2026 case $t_bindir in
2027 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2028 esac
2029 case $t_bindir in
2030 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2031 esac
2032 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2033 if test $? -ne 0 ; then
2034 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2035 if test $? -ne 0 ; then
2036 user_path=$user_path:$t_bindir
2037 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2038 fi
2039 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002040 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002041)
Tim Rice43a1c132002-04-17 21:19:14 -07002042if test "$USES_LOGIN_CONF" != "yes" ; then
2043 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2044 AC_SUBST(user_path)
2045fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002046
Damien Millera18bbd32002-05-13 10:48:57 +10002047# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002048AC_ARG_WITH(superuser-path,
2049 [ --with-superuser-path= Specify different path for super-user],
2050 [
2051 if test "x$withval" != "xno" ; then
2052 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2053 superuser_path=$withval
2054 fi
2055 ]
2056)
2057
2058
Damien Millera22ba012000-03-02 23:09:20 +11002059# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002060IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002061AC_ARG_WITH(ipv4-default,
2062 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2063 [
2064 if test "x$withval" != "xno" ; then
2065 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002066 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002067 fi
2068 ]
2069)
2070
Damien Miller61e50f12000-05-08 20:49:37 +10002071AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002072IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002073AC_ARG_WITH(4in6,
2074 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2075 [
2076 if test "x$withval" != "xno" ; then
2077 AC_MSG_RESULT(yes)
2078 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002079 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002080 else
2081 AC_MSG_RESULT(no)
2082 fi
2083 ],[
2084 if test "x$inet6_default_4in6" = "xyes"; then
2085 AC_MSG_RESULT([yes (default)])
2086 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002087 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002088 else
2089 AC_MSG_RESULT([no (default)])
2090 fi
2091 ]
2092)
2093
Damien Miller60396b02001-02-18 17:01:00 +11002094# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002095BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002096AC_ARG_WITH(bsd-auth,
2097 [ --with-bsd-auth Enable BSD auth support],
2098 [
2099 if test "x$withval" != "xno" ; then
2100 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002101 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002102 fi
2103 ]
2104)
2105
Damien Millera22ba012000-03-02 23:09:20 +11002106# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002107piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002108# make sure the directory exists
2109if test ! -d $piddir ; then
2110 piddir=`eval echo ${sysconfdir}`
2111 case $piddir in
2112 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2113 esac
2114fi
2115
Tim Rice88f2ab52002-03-17 12:17:34 -08002116AC_ARG_WITH(pid-dir,
2117 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2118 [
2119 if test "x$withval" != "xno" ; then
2120 piddir=$withval
2121 if test ! -d $piddir ; then
2122 AC_MSG_WARN([** no $piddir directory on this system **])
2123 fi
2124 fi
2125 ]
2126)
2127
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002128AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002129AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002130
andre2ff7b5d2000-06-03 14:57:40 +00002131dnl allow user to disable some login recording features
2132AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002133 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002134 [ AC_DEFINE(DISABLE_LASTLOG) ]
2135)
2136AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002137 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002138 [ AC_DEFINE(DISABLE_UTMP) ]
2139)
2140AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002141 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002142 [ AC_DEFINE(DISABLE_UTMPX) ]
2143)
2144AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002145 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002146 [ AC_DEFINE(DISABLE_WTMP) ]
2147)
2148AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002149 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002150 [ AC_DEFINE(DISABLE_WTMPX) ]
2151)
2152AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002153 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002154 [ AC_DEFINE(DISABLE_LOGIN) ]
2155)
2156AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002157 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002158 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2159)
2160AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002161 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002162 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2163)
2164AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002165 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002166 [
2167 if test "x$withval" = "xno" ; then
2168 AC_DEFINE(DISABLE_LASTLOG)
2169 else
2170 conf_lastlog_location=$withval
2171 fi
2172 ]
2173)
andre2ff7b5d2000-06-03 14:57:40 +00002174
2175dnl lastlog, [uw]tmpx? detection
2176dnl NOTE: set the paths in the platform section to avoid the
2177dnl need for command-line parameters
2178dnl lastlog and [uw]tmp are subject to a file search if all else fails
2179
2180dnl lastlog detection
2181dnl NOTE: the code itself will detect if lastlog is a directory
2182AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2183AC_TRY_COMPILE([
2184#include <sys/types.h>
2185#include <utmp.h>
2186#ifdef HAVE_LASTLOG_H
2187# include <lastlog.h>
2188#endif
Damien Miller2994e082000-06-04 15:51:47 +10002189#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002190# include <paths.h>
2191#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002192#ifdef HAVE_LOGIN_H
2193# include <login.h>
2194#endif
andre2ff7b5d2000-06-03 14:57:40 +00002195 ],
2196 [ char *lastlog = LASTLOG_FILE; ],
2197 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002198 [
2199 AC_MSG_RESULT(no)
2200 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2201 AC_TRY_COMPILE([
2202#include <sys/types.h>
2203#include <utmp.h>
2204#ifdef HAVE_LASTLOG_H
2205# include <lastlog.h>
2206#endif
2207#ifdef HAVE_PATHS_H
2208# include <paths.h>
2209#endif
2210 ],
2211 [ char *lastlog = _PATH_LASTLOG; ],
2212 [ AC_MSG_RESULT(yes) ],
2213 [
andree441aa32000-06-12 22:34:38 +00002214 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002215 system_lastlog_path=no
2216 ])
2217 ]
andre2ff7b5d2000-06-03 14:57:40 +00002218)
Damien Miller2994e082000-06-04 15:51:47 +10002219
andre2ff7b5d2000-06-03 14:57:40 +00002220if test -z "$conf_lastlog_location"; then
2221 if test x"$system_lastlog_path" = x"no" ; then
2222 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002223 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002224 conf_lastlog_location=$f
2225 fi
2226 done
2227 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002228 AC_MSG_WARN([** Cannot find lastlog **])
2229 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002230 fi
2231 fi
2232fi
2233
2234if test -n "$conf_lastlog_location"; then
2235 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2236fi
2237
2238dnl utmp detection
2239AC_MSG_CHECKING([if your system defines UTMP_FILE])
2240AC_TRY_COMPILE([
2241#include <sys/types.h>
2242#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002243#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002244# include <paths.h>
2245#endif
2246 ],
2247 [ char *utmp = UTMP_FILE; ],
2248 [ AC_MSG_RESULT(yes) ],
2249 [ AC_MSG_RESULT(no)
2250 system_utmp_path=no ]
2251)
2252if test -z "$conf_utmp_location"; then
2253 if test x"$system_utmp_path" = x"no" ; then
2254 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2255 if test -f $f ; then
2256 conf_utmp_location=$f
2257 fi
2258 done
2259 if test -z "$conf_utmp_location"; then
2260 AC_DEFINE(DISABLE_UTMP)
2261 fi
2262 fi
2263fi
2264if test -n "$conf_utmp_location"; then
2265 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2266fi
2267
2268dnl wtmp detection
2269AC_MSG_CHECKING([if your system defines WTMP_FILE])
2270AC_TRY_COMPILE([
2271#include <sys/types.h>
2272#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002273#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002274# include <paths.h>
2275#endif
2276 ],
2277 [ char *wtmp = WTMP_FILE; ],
2278 [ AC_MSG_RESULT(yes) ],
2279 [ AC_MSG_RESULT(no)
2280 system_wtmp_path=no ]
2281)
2282if test -z "$conf_wtmp_location"; then
2283 if test x"$system_wtmp_path" = x"no" ; then
2284 for f in /usr/adm/wtmp /var/log/wtmp; do
2285 if test -f $f ; then
2286 conf_wtmp_location=$f
2287 fi
2288 done
2289 if test -z "$conf_wtmp_location"; then
2290 AC_DEFINE(DISABLE_WTMP)
2291 fi
2292 fi
2293fi
2294if test -n "$conf_wtmp_location"; then
2295 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2296fi
2297
2298
2299dnl utmpx detection - I don't know any system so perverse as to require
2300dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2301dnl there, though.
2302AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2303AC_TRY_COMPILE([
2304#include <sys/types.h>
2305#include <utmp.h>
2306#ifdef HAVE_UTMPX_H
2307#include <utmpx.h>
2308#endif
Damien Miller2994e082000-06-04 15:51:47 +10002309#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002310# include <paths.h>
2311#endif
2312 ],
2313 [ char *utmpx = UTMPX_FILE; ],
2314 [ AC_MSG_RESULT(yes) ],
2315 [ AC_MSG_RESULT(no)
2316 system_utmpx_path=no ]
2317)
2318if test -z "$conf_utmpx_location"; then
2319 if test x"$system_utmpx_path" = x"no" ; then
2320 AC_DEFINE(DISABLE_UTMPX)
2321 fi
2322else
2323 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2324fi
2325
2326dnl wtmpx detection
2327AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2328AC_TRY_COMPILE([
2329#include <sys/types.h>
2330#include <utmp.h>
2331#ifdef HAVE_UTMPX_H
2332#include <utmpx.h>
2333#endif
Damien Miller2994e082000-06-04 15:51:47 +10002334#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002335# include <paths.h>
2336#endif
2337 ],
2338 [ char *wtmpx = WTMPX_FILE; ],
2339 [ AC_MSG_RESULT(yes) ],
2340 [ AC_MSG_RESULT(no)
2341 system_wtmpx_path=no ]
2342)
2343if test -z "$conf_wtmpx_location"; then
2344 if test x"$system_wtmpx_path" = x"no" ; then
2345 AC_DEFINE(DISABLE_WTMPX)
2346 fi
2347else
2348 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2349fi
2350
Damien Miller4018c192000-04-30 09:30:44 +10002351
Damien Miller29ea30d2000-03-17 10:54:15 +11002352if test ! -z "$blibpath" ; then
2353 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2354 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2355fi
2356
Tim Rice4cec93f2002-02-26 08:40:48 -08002357dnl remove pam and dl because they are in $LIBPAM
2358if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002359 LIBS=`echo $LIBS | sed 's/-lpam //'`
2360fi
2361if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2362 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002363fi
2364
Damien Millerbac2d8a2000-09-05 16:13:06 +11002365AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002366AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2367AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002368
Damien Miller7b22d652000-06-18 14:07:04 +10002369# Print summary of options
2370
Damien Miller7b22d652000-06-18 14:07:04 +10002371# Someone please show me a better way :)
2372A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2373B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2374C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2375D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002376E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002377F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002378G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002379H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2380I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2381J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002382
2383echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002384echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002385echo " User binaries: $B"
2386echo " System binaries: $C"
2387echo " Configuration files: $D"
2388echo " Askpass program: $E"
2389echo " Manual pages: $F"
2390echo " PID file: $G"
2391echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002392if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002393echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002394else
Damien Millerf58c6722002-05-13 13:15:42 +10002395echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002396fi
Damien Millera18bbd32002-05-13 10:48:57 +10002397if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002398echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002399fi
Damien Millerf58c6722002-05-13 13:15:42 +10002400echo " Manpage format: $MANTYPE"
2401echo " PAM support: ${PAM_MSG}"
2402echo " KerberosIV support: $KRB4_MSG"
2403echo " KerberosV support: $KRB5_MSG"
2404echo " Smartcard support: $SCARD_MSG"
2405echo " AFS support: $AFS_MSG"
2406echo " S/KEY support: $SKEY_MSG"
2407echo " TCP Wrappers support: $TCPW_MSG"
2408echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002409echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002410echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2411echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2412echo " BSD Auth support: $BSD_AUTH_MSG"
2413echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002414if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002415echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002416fi
2417
Damien Miller7b22d652000-06-18 14:07:04 +10002418echo ""
2419
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002420echo " Host: ${host}"
2421echo " Compiler: ${CC}"
2422echo " Compiler flags: ${CFLAGS}"
2423echo "Preprocessor flags: ${CPPFLAGS}"
2424echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002425echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002426
2427echo ""
2428
Damien Miller82cf0ce2000-12-20 13:34:48 +11002429if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002430 echo "PAM is enabled. You may need to install a PAM control file "
2431 echo "for sshd, otherwise password authentication may fail. "
2432 echo "Example PAM control files can be found in the contrib/ "
2433 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002434 echo ""
2435fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002436
2437if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002438 echo "sftp-server will be disabled. Your compiler does not "
2439 echo "support 64bit integers."
2440 echo ""
2441fi
2442
2443if test ! -z "$RAND_HELPER_CMDHASH" ; then
2444 echo "WARNING: you are using the builtin random number collection "
2445 echo "service. Please read WARNING.RNG and request that your OS "
2446 echo "vendor includes kernel-based random number collection in "
2447 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002448 echo ""
2449fi
Damien Miller60396b02001-02-18 17:01:00 +11002450