blob: 7ef77e5b1942543c87045a21da0d1f893c5057e0 [file] [log] [blame]
Ben Lindstrom68e83112002-06-28 00:37:33 +00001# $Id: configure.ac,v 1.73 2002/06/28 00:37:33 mouring 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>
Ben Lindstrom68e83112002-06-28 00:37:33 +0000585#include <sys/types.h>
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +0000586#include <sys/mman.h>
587#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
588#define MAP_ANON MAP_ANONYMOUS
589#endif
590main() { char *p;
591p = (char *) mmap(NULL, 10, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED, -1, 0);
592if (p == (char *)-1)
593 exit(1);
594exit(0);
595}
596 ],
597 [
598 AC_MSG_RESULT(yes)
599 AC_DEFINE(HAVE_MMAP_ANON_SHARED)
600 ],
601 [ AC_MSG_RESULT(no) ]
602)
603fi
604
Tim Rice13aae5e2001-10-21 17:53:58 -0700605dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700606AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 AC_CHECK_LIB(gen, dirname,[
608 AC_CACHE_CHECK([for broken dirname],
609 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700610 save_LIBS="$LIBS"
611 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700612 AC_TRY_RUN(
613 [
614#include <libgen.h>
615#include <string.h>
616
617int main(int argc, char **argv) {
618 char *s, buf[32];
619
620 strncpy(buf,"/etc", 32);
621 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700622 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700623 exit(1);
624 } else {
625 exit(0);
626 }
627}
628 ],
629 [ ac_cv_have_broken_dirname="no" ],
630 [ ac_cv_have_broken_dirname="yes" ]
631 )
Tim Rice17b93e52001-10-23 22:36:54 -0700632 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700633 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700634 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700635 LIBS="$LIBS -lgen"
636 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700637 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700638 fi
639 ])
640])
641
Damien Millerad833b32000-08-23 10:46:23 +1000642dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000643AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000644dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000645AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000646AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000647dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000648AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000649AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100650
Damien Miller04f80141999-11-19 15:32:34 +1100651AC_CHECK_FUNC(daemon,
652 [AC_DEFINE(HAVE_DAEMON)],
653 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
654)
655
Damien Miller9fb07e42000-03-05 16:22:59 +1100656AC_CHECK_FUNC(getpagesize,
657 [AC_DEFINE(HAVE_GETPAGESIZE)],
658 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
659)
660
Damien Millercb170cb2000-07-01 16:52:55 +1000661# Check for broken snprintf
662if test "x$ac_cv_func_snprintf" = "xyes" ; then
663 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
664 AC_TRY_RUN(
665 [
666#include <stdio.h>
667int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
668 ],
669 [AC_MSG_RESULT(yes)],
670 [
671 AC_MSG_RESULT(no)
672 AC_DEFINE(BROKEN_SNPRINTF)
673 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
674 ]
675 )
676fi
677
Damien Miller606f8802000-09-16 15:39:56 +1100678AC_FUNC_GETPGRP
679
Damien Millera64b57a2001-01-17 10:44:13 +1100680# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000681PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100682AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100683 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100684 [
Damien Millera64b57a2001-01-17 10:44:13 +1100685 if test "x$withval" != "xno" ; then
686 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
687 AC_MSG_ERROR([PAM headers not found])
688 fi
689
690 AC_CHECK_LIB(dl, dlopen, , )
691 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
692 AC_CHECK_FUNCS(pam_getenvlist)
693
694 disable_shadow=yes
695 PAM_MSG="yes"
696
697 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800698 if test $ac_cv_lib_dl_dlopen = yes; then
699 LIBPAM="-lpam -ldl"
700 else
701 LIBPAM="-lpam"
702 fi
703 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100704 fi
705 ]
706)
Damien Millera22ba012000-03-02 23:09:20 +1100707
Damien Millera64b57a2001-01-17 10:44:13 +1100708# Check for older PAM
709if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100710 # Check PAM strerror arguments (old PAM)
711 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
712 AC_TRY_COMPILE(
713 [
Damien Miller81171112000-04-23 11:14:01 +1000714#include <stdlib.h>
715#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100716 ],
717 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
718 [AC_MSG_RESULT(no)],
719 [
720 AC_DEFINE(HAVE_OLD_PAM)
721 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000722 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100723 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100724 )
Damien Millera22ba012000-03-02 23:09:20 +1100725fi
726
Tim Riceaef73712002-05-11 13:17:42 -0700727# Search for OpenSSL
728saved_CPPFLAGS="$CPPFLAGS"
729saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100730AC_ARG_WITH(ssl-dir,
731 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
732 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000733 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700734 if test -d "$withval/lib"; then
735 if test -n "${need_dash_r}"; then
736 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
737 else
738 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
739 fi
740 else
741 if test -n "${need_dash_r}"; then
742 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
743 else
744 LDFLAGS="-L${withval} ${LDFLAGS}"
745 fi
746 fi
747 if test -d "$withval/include"; then
748 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
749 else
750 CPPFLAGS="-I${withval} ${CPPFLAGS}"
751 fi
Damien Millera22ba012000-03-02 23:09:20 +1100752 fi
753 ]
754)
Tim Riceaef73712002-05-11 13:17:42 -0700755LIBS="$LIBS -lcrypto"
756AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000757 [
Tim Riceaef73712002-05-11 13:17:42 -0700758 dnl Check default openssl install dir
759 if test -n "${need_dash_r}"; then
760 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000761 else
Tim Riceaef73712002-05-11 13:17:42 -0700762 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000763 fi
Tim Riceaef73712002-05-11 13:17:42 -0700764 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
765 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
766 [
767 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
768 ]
769 )
770 ]
771)
772
Damien Millera22ba012000-03-02 23:09:20 +1100773
Damien Millerec932372002-01-22 22:16:03 +1100774# Sanity check OpenSSL headers
775AC_MSG_CHECKING([whether OpenSSL's headers match the library])
776AC_TRY_RUN(
777 [
778#include <string.h>
779#include <openssl/opensslv.h>
780int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
781 ],
782 [
783 AC_MSG_RESULT(yes)
784 ],
785 [
786 AC_MSG_RESULT(no)
787 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
788 ]
789)
790
Damien Millera64b57a2001-01-17 10:44:13 +1100791# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
792# version in OpenSSL. Skip this for PAM
793if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100794 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100795fi
796
Damien Miller6c21c512002-01-22 21:57:53 +1100797
798### Configure cryptographic random number support
799
800# Check wheter OpenSSL seeds itself
801AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
802AC_TRY_RUN(
803 [
804#include <string.h>
805#include <openssl/rand.h>
806int main(void) { return(RAND_status() == 1 ? 0 : 1); }
807 ],
808 [
809 OPENSSL_SEEDS_ITSELF=yes
810 AC_MSG_RESULT(yes)
811 ],
812 [
813 AC_MSG_RESULT(no)
814 # Default to use of the rand helper if OpenSSL doesn't
815 # seed itself
816 USE_RAND_HELPER=yes
817 ]
818)
819
820
821# Do we want to force the use of the rand helper?
822AC_ARG_WITH(rand-helper,
823 [ --with-rand-helper Use subprocess to gather strong randomness ],
824 [
825 if test "x$withval" = "xno" ; then
826 # Force use of OpenSSL's internal RNG, even if
827 # the previous test showed it to be unseeded.
828 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
829 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
830 OPENSSL_SEEDS_ITSELF=yes
831 USE_RAND_HELPER=""
832 fi
833 else
834 USE_RAND_HELPER=yes
835 fi
836 ],
837)
838
839# Which randomness source do we use?
840if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
841 # OpenSSL only
842 AC_DEFINE(OPENSSL_PRNG_ONLY)
843 RAND_MSG="OpenSSL internal ONLY"
844 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800845elif test ! -z "$USE_RAND_HELPER" ; then
846 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100847 RAND_MSG="ssh-rand-helper"
848 INSTALL_SSH_RAND_HELPER="yes"
849fi
850AC_SUBST(INSTALL_SSH_RAND_HELPER)
851
852### Configuration of ssh-rand-helper
853
854# PRNGD TCP socket
855AC_ARG_WITH(prngd-port,
856 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
857 [
Damien Millere996d722002-01-23 11:20:59 +1100858 case "$withval" in
859 no)
860 withval=""
861 ;;
862 [[0-9]]*)
863 ;;
864 *)
865 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
866 ;;
867 esac
868 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100869 PRNGD_PORT="$withval"
870 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
871 fi
872 ]
873)
874
875# PRNGD Unix domain socket
876AC_ARG_WITH(prngd-socket,
877 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
878 [
Damien Millere996d722002-01-23 11:20:59 +1100879 case "$withval" in
880 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100881 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100882 ;;
883 no)
884 withval=""
885 ;;
886 /*)
887 ;;
888 *)
889 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
890 ;;
891 esac
892
893 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100894 if test ! -z "$PRNGD_PORT" ; then
895 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
896 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100897 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100898 AC_MSG_WARN(Entropy socket is not readable)
899 fi
900 PRNGD_SOCKET="$withval"
901 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
902 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800903 ],
904 [
905 # Check for existing socket only if we don't have a random device already
906 if test "$USE_RAND_HELPER" = yes ; then
907 AC_MSG_CHECKING(for PRNGD/EGD socket)
908 # Insert other locations here
909 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
910 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
911 PRNGD_SOCKET="$sock"
912 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
913 break;
914 fi
915 done
916 if test ! -z "$PRNGD_SOCKET" ; then
917 AC_MSG_RESULT($PRNGD_SOCKET)
918 else
919 AC_MSG_RESULT(not found)
920 fi
921 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100922 ]
923)
924
925# Change default command timeout for hashing entropy source
926entropy_timeout=200
927AC_ARG_WITH(entropy-timeout,
928 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
929 [
930 if test "x$withval" != "xno" ; then
931 entropy_timeout=$withval
932 fi
933 ]
934)
Damien Miller6c21c512002-01-22 21:57:53 +1100935AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
936
Damien Millerd3f6ad22002-06-25 10:24:47 +1000937SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +0000938AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000939 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000940 [
941 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +1000942 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +0000943 fi
944 ]
945)
Damien Millerd3f6ad22002-06-25 10:24:47 +1000946AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
947AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +0000948
Tim Rice88f2ab52002-03-17 12:17:34 -0800949# We do this little dance with the search path to insure
950# that programs that we select for use by installed programs
951# (which may be run by the super-user) come from trusted
952# locations before they come from the user's private area.
953# This should help avoid accidentally configuring some
954# random version of a program in someone's personal bin.
955
956OPATH=$PATH
957PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700958test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800959test -d /sbin && PATH=$PATH:/sbin
960test -d /usr/sbin && PATH=$PATH:/usr/sbin
961PATH=$PATH:/etc:$OPATH
962
Damien Miller6c21c512002-01-22 21:57:53 +1100963# These programs are used by the command hashing source to gather entropy
964OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
965OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
966OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
967OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
968OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
969OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
970OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
971OSSH_PATH_ENTROPY_PROG(PROG_W, w)
972OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
973OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
974OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
975OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
976OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
977OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
978OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
979OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800980# restore PATH
981PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100982
983# Where does ssh-rand-helper get its randomness from?
984INSTALL_SSH_PRNG_CMDS=""
985if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
986 if test ! -z "$PRNGD_PORT" ; then
987 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
988 elif test ! -z "$PRNGD_SOCKET" ; then
989 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
990 else
991 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
992 RAND_HELPER_CMDHASH=yes
993 INSTALL_SSH_PRNG_CMDS="yes"
994 fi
995fi
996AC_SUBST(INSTALL_SSH_PRNG_CMDS)
997
998
Ben Lindstromb5628642000-10-18 00:02:25 +0000999# Cheap hack to ensure NEWS-OS libraries are arranged right.
1000if test ! -z "$SONY" ; then
1001 LIBS="$LIBS -liberty";
1002fi
1003
Damien Millera22ba012000-03-02 23:09:20 +11001004# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001005AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001006AC_CHECK_SIZEOF(short int, 2)
1007AC_CHECK_SIZEOF(int, 4)
1008AC_CHECK_SIZEOF(long int, 4)
1009AC_CHECK_SIZEOF(long long int, 8)
1010
Damien Millerfa2bb692002-04-23 23:22:25 +10001011# Sanity check long long for some platforms (AIX)
1012if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1013 ac_cv_sizeof_long_long_int=0
1014fi
1015
Damien Millera22ba012000-03-02 23:09:20 +11001016# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001017AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1018 AC_TRY_COMPILE(
1019 [ #include <sys/types.h> ],
1020 [ u_int a; a = 1;],
1021 [ ac_cv_have_u_int="yes" ],
1022 [ ac_cv_have_u_int="no" ]
1023 )
1024])
1025if test "x$ac_cv_have_u_int" = "xyes" ; then
1026 AC_DEFINE(HAVE_U_INT)
1027 have_u_int=1
1028fi
1029
Damien Miller61e50f12000-05-08 20:49:37 +10001030AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1031 AC_TRY_COMPILE(
1032 [ #include <sys/types.h> ],
1033 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1034 [ ac_cv_have_intxx_t="yes" ],
1035 [ ac_cv_have_intxx_t="no" ]
1036 )
1037])
1038if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1039 AC_DEFINE(HAVE_INTXX_T)
1040 have_intxx_t=1
1041fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001042
1043if (test -z "$have_intxx_t" && \
1044 test "x$ac_cv_header_stdint_h" = "xyes")
1045then
1046 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1047 AC_TRY_COMPILE(
1048 [ #include <stdint.h> ],
1049 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1050 [
1051 AC_DEFINE(HAVE_INTXX_T)
1052 AC_MSG_RESULT(yes)
1053 ],
1054 [ AC_MSG_RESULT(no) ]
1055 )
1056fi
1057
Damien Miller578783e2000-09-23 14:12:24 +11001058AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1059 AC_TRY_COMPILE(
1060 [ #include <sys/types.h> ],
1061 [ int64_t a; a = 1;],
1062 [ ac_cv_have_int64_t="yes" ],
1063 [ ac_cv_have_int64_t="no" ]
1064 )
1065])
1066if test "x$ac_cv_have_int64_t" = "xyes" ; then
1067 AC_DEFINE(HAVE_INT64_T)
1068 have_int64_t=1
1069fi
1070
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001071if test -z "$have_int64_t" ; then
1072 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1073 AC_TRY_COMPILE(
1074 [ #include <sys/socket.h> ],
1075 [ int64_t a; a = 1],
1076 [
1077 AC_DEFINE(HAVE_INT64_T)
1078 AC_MSG_RESULT(yes)
1079 ],
1080 [ AC_MSG_RESULT(no) ]
1081 )
1082fi
1083
Tim Rice4cec93f2002-02-26 08:40:48 -08001084if test -z "$have_int64_t" ; then
1085 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1086 AC_TRY_COMPILE(
1087 [ #include <sys/bitypes.h> ],
1088 [ int64_t a; a = 1],
1089 [
1090 AC_DEFINE(HAVE_INT64_T)
1091 AC_MSG_RESULT(yes)
1092 ],
1093 [ AC_MSG_RESULT(no) ]
1094 )
1095fi
1096
Damien Miller61e50f12000-05-08 20:49:37 +10001097AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1098 AC_TRY_COMPILE(
1099 [ #include <sys/types.h> ],
1100 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1101 [ ac_cv_have_u_intxx_t="yes" ],
1102 [ ac_cv_have_u_intxx_t="no" ]
1103 )
1104])
1105if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1106 AC_DEFINE(HAVE_U_INTXX_T)
1107 have_u_intxx_t=1
1108fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001109
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001110if test -z "$have_u_intxx_t" ; then
1111 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1112 AC_TRY_COMPILE(
1113 [ #include <sys/socket.h> ],
1114 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1115 [
1116 AC_DEFINE(HAVE_U_INTXX_T)
1117 AC_MSG_RESULT(yes)
1118 ],
1119 [ AC_MSG_RESULT(no) ]
1120 )
1121fi
1122
Damien Miller578783e2000-09-23 14:12:24 +11001123AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1124 AC_TRY_COMPILE(
1125 [ #include <sys/types.h> ],
1126 [ u_int64_t a; a = 1;],
1127 [ ac_cv_have_u_int64_t="yes" ],
1128 [ ac_cv_have_u_int64_t="no" ]
1129 )
1130])
1131if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1132 AC_DEFINE(HAVE_U_INT64_T)
1133 have_u_int64_t=1
1134fi
1135
Tim Rice4cec93f2002-02-26 08:40:48 -08001136if test -z "$have_u_int64_t" ; then
1137 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1138 AC_TRY_COMPILE(
1139 [ #include <sys/bitypes.h> ],
1140 [ u_int64_t a; a = 1],
1141 [
1142 AC_DEFINE(HAVE_U_INT64_T)
1143 AC_MSG_RESULT(yes)
1144 ],
1145 [ AC_MSG_RESULT(no) ]
1146 )
1147fi
1148
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001149if test -z "$have_u_intxx_t" ; then
1150 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1151 AC_TRY_COMPILE(
1152 [
1153#include <sys/types.h>
1154 ],
1155 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1156 [ ac_cv_have_uintxx_t="yes" ],
1157 [ ac_cv_have_uintxx_t="no" ]
1158 )
1159 ])
1160 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1161 AC_DEFINE(HAVE_UINTXX_T)
1162 fi
1163fi
1164
1165if test -z "$have_uintxx_t" ; then
1166 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1167 AC_TRY_COMPILE(
1168 [ #include <stdint.h> ],
1169 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1170 [
1171 AC_DEFINE(HAVE_UINTXX_T)
1172 AC_MSG_RESULT(yes)
1173 ],
1174 [ AC_MSG_RESULT(no) ]
1175 )
1176fi
1177
Damien Milleredb82922000-06-20 13:25:52 +10001178if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1179 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001180then
1181 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1182 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001183 [
1184#include <sys/bitypes.h>
1185 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001186 [
Damien Miller70494d12000-04-03 15:57:06 +10001187 int8_t a; int16_t b; int32_t c;
1188 u_int8_t e; u_int16_t f; u_int32_t g;
1189 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001190 ],
1191 [
1192 AC_DEFINE(HAVE_U_INTXX_T)
1193 AC_DEFINE(HAVE_INTXX_T)
1194 AC_MSG_RESULT(yes)
1195 ],
1196 [AC_MSG_RESULT(no)]
1197 )
1198fi
1199
Damien Miller58be7382001-09-15 21:31:54 +10001200
1201AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1202 AC_TRY_COMPILE(
1203 [
1204#include <sys/types.h>
1205 ],
1206 [ u_char foo; foo = 125; ],
1207 [ ac_cv_have_u_char="yes" ],
1208 [ ac_cv_have_u_char="no" ]
1209 )
1210])
1211if test "x$ac_cv_have_u_char" = "xyes" ; then
1212 AC_DEFINE(HAVE_U_CHAR)
1213fi
1214
Tim Rice13aae5e2001-10-21 17:53:58 -07001215TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001216
Tim Rice200a5c02002-02-26 22:12:34 -08001217AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001218
Damien Miller61e50f12000-05-08 20:49:37 +10001219AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1220 AC_TRY_COMPILE(
1221 [
1222#include <sys/types.h>
1223 ],
1224 [ size_t foo; foo = 1235; ],
1225 [ ac_cv_have_size_t="yes" ],
1226 [ ac_cv_have_size_t="no" ]
1227 )
1228])
1229if test "x$ac_cv_have_size_t" = "xyes" ; then
1230 AC_DEFINE(HAVE_SIZE_T)
1231fi
Damien Miller95058511999-12-29 10:36:45 +11001232
Damien Miller615f9392000-05-17 22:53:33 +10001233AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1234 AC_TRY_COMPILE(
1235 [
1236#include <sys/types.h>
1237 ],
1238 [ ssize_t foo; foo = 1235; ],
1239 [ ac_cv_have_ssize_t="yes" ],
1240 [ ac_cv_have_ssize_t="no" ]
1241 )
1242])
1243if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1244 AC_DEFINE(HAVE_SSIZE_T)
1245fi
1246
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001247AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1248 AC_TRY_COMPILE(
1249 [
1250#include <time.h>
1251 ],
1252 [ clock_t foo; foo = 1235; ],
1253 [ ac_cv_have_clock_t="yes" ],
1254 [ ac_cv_have_clock_t="no" ]
1255 )
1256])
1257if test "x$ac_cv_have_clock_t" = "xyes" ; then
1258 AC_DEFINE(HAVE_CLOCK_T)
1259fi
1260
Damien Millerb54b40e2000-06-23 08:23:34 +10001261AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1262 AC_TRY_COMPILE(
1263 [
1264#include <sys/types.h>
1265#include <sys/socket.h>
1266 ],
1267 [ sa_family_t foo; foo = 1235; ],
1268 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001269 [ AC_TRY_COMPILE(
1270 [
1271#include <sys/types.h>
1272#include <sys/socket.h>
1273#include <netinet/in.h>
1274 ],
1275 [ sa_family_t foo; foo = 1235; ],
1276 [ ac_cv_have_sa_family_t="yes" ],
1277
Damien Millerb54b40e2000-06-23 08:23:34 +10001278 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001279 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001280 )
1281])
1282if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1283 AC_DEFINE(HAVE_SA_FAMILY_T)
1284fi
1285
Damien Miller0f91b4e2000-06-18 15:43:25 +10001286AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1287 AC_TRY_COMPILE(
1288 [
1289#include <sys/types.h>
1290 ],
1291 [ pid_t foo; foo = 1235; ],
1292 [ ac_cv_have_pid_t="yes" ],
1293 [ ac_cv_have_pid_t="no" ]
1294 )
1295])
1296if test "x$ac_cv_have_pid_t" = "xyes" ; then
1297 AC_DEFINE(HAVE_PID_T)
1298fi
1299
1300AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1301 AC_TRY_COMPILE(
1302 [
1303#include <sys/types.h>
1304 ],
1305 [ mode_t foo; foo = 1235; ],
1306 [ ac_cv_have_mode_t="yes" ],
1307 [ ac_cv_have_mode_t="no" ]
1308 )
1309])
1310if test "x$ac_cv_have_mode_t" = "xyes" ; then
1311 AC_DEFINE(HAVE_MODE_T)
1312fi
1313
Damien Miller61e50f12000-05-08 20:49:37 +10001314
1315AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1316 AC_TRY_COMPILE(
1317 [
Damien Miller81171112000-04-23 11:14:01 +10001318#include <sys/types.h>
1319#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001320 ],
1321 [ struct sockaddr_storage s; ],
1322 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1323 [ ac_cv_have_struct_sockaddr_storage="no" ]
1324 )
1325])
1326if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1327 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1328fi
Damien Miller34132e52000-01-14 15:45:46 +11001329
Damien Miller61e50f12000-05-08 20:49:37 +10001330AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1331 AC_TRY_COMPILE(
1332 [
Damien Miller7b22d652000-06-18 14:07:04 +10001333#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001334#include <netinet/in.h>
1335 ],
1336 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1337 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1338 [ ac_cv_have_struct_sockaddr_in6="no" ]
1339 )
1340])
1341if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1342 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1343fi
Damien Miller34132e52000-01-14 15:45:46 +11001344
Damien Miller61e50f12000-05-08 20:49:37 +10001345AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1346 AC_TRY_COMPILE(
1347 [
Damien Miller7b22d652000-06-18 14:07:04 +10001348#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001349#include <netinet/in.h>
1350 ],
1351 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1352 [ ac_cv_have_struct_in6_addr="yes" ],
1353 [ ac_cv_have_struct_in6_addr="no" ]
1354 )
1355])
1356if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1357 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1358fi
Damien Miller34132e52000-01-14 15:45:46 +11001359
Damien Miller61e50f12000-05-08 20:49:37 +10001360AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1361 AC_TRY_COMPILE(
1362 [
Damien Miller81171112000-04-23 11:14:01 +10001363#include <sys/types.h>
1364#include <sys/socket.h>
1365#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001366 ],
1367 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1368 [ ac_cv_have_struct_addrinfo="yes" ],
1369 [ ac_cv_have_struct_addrinfo="no" ]
1370 )
1371])
1372if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1373 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1374fi
1375
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001376AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1377 AC_TRY_COMPILE(
1378 [ #include <sys/time.h> ],
1379 [ struct timeval tv; tv.tv_sec = 1;],
1380 [ ac_cv_have_struct_timeval="yes" ],
1381 [ ac_cv_have_struct_timeval="no" ]
1382 )
1383])
1384if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1385 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1386 have_struct_timeval=1
1387fi
1388
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001389# If we don't have int64_t then we can't compile sftp-server. So don't
1390# even attempt to do it.
1391if test "x$ac_cv_have_int64_t" = "xno" -a \
1392 "x$ac_cv_sizeof_long_int" != "x8" -a \
1393 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1394 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001395else
1396dnl test snprintf (broken on SCO w/gcc)
1397 AC_TRY_RUN(
1398 [
1399#include <stdio.h>
1400#include <string.h>
1401#ifdef HAVE_SNPRINTF
1402main()
1403{
1404 char buf[50];
1405 char expected_out[50];
1406 int mazsize = 50 ;
1407#if (SIZEOF_LONG_INT == 8)
1408 long int num = 0x7fffffffffffffff;
1409#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001410 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001411#endif
1412 strcpy(expected_out, "9223372036854775807");
1413 snprintf(buf, mazsize, "%lld", num);
1414 if(strcmp(buf, expected_out) != 0)
1415 exit(1);
1416 exit(0);
1417}
1418#else
1419main() { exit(0); }
1420#endif
1421 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1422 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001423fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001424AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001425
Damien Miller78315eb2000-09-29 23:01:36 +11001426dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001427OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1428OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1429OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1430OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1431OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001432OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001433OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1434OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001435OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001436OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1437OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1438OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1439OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001440OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1441OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1442OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1443OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001444
1445AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001446
Damien Miller61e50f12000-05-08 20:49:37 +10001447AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1448 ac_cv_have_ss_family_in_struct_ss, [
1449 AC_TRY_COMPILE(
1450 [
Damien Miller81171112000-04-23 11:14:01 +10001451#include <sys/types.h>
1452#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001453 ],
1454 [ struct sockaddr_storage s; s.ss_family = 1; ],
1455 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1456 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1457 )
1458])
1459if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1460 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1461fi
1462
Damien Miller61e50f12000-05-08 20:49:37 +10001463AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1464 ac_cv_have___ss_family_in_struct_ss, [
1465 AC_TRY_COMPILE(
1466 [
Damien Miller81171112000-04-23 11:14:01 +10001467#include <sys/types.h>
1468#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001469 ],
1470 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1471 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1472 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1473 )
1474])
1475if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1476 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1477fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001478
Damien Millerad833b32000-08-23 10:46:23 +10001479AC_CACHE_CHECK([for pw_class field in struct passwd],
1480 ac_cv_have_pw_class_in_struct_passwd, [
1481 AC_TRY_COMPILE(
1482 [
Damien Millerad833b32000-08-23 10:46:23 +10001483#include <pwd.h>
1484 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001485 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001486 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1487 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1488 )
1489])
1490if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1491 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1492fi
1493
Kevin Steves82456952001-06-22 21:14:18 +00001494AC_CACHE_CHECK([for pw_expire field in struct passwd],
1495 ac_cv_have_pw_expire_in_struct_passwd, [
1496 AC_TRY_COMPILE(
1497 [
1498#include <pwd.h>
1499 ],
1500 [ struct passwd p; p.pw_expire = 0; ],
1501 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1502 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1503 )
1504])
1505if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1506 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1507fi
1508
1509AC_CACHE_CHECK([for pw_change field in struct passwd],
1510 ac_cv_have_pw_change_in_struct_passwd, [
1511 AC_TRY_COMPILE(
1512 [
1513#include <pwd.h>
1514 ],
1515 [ struct passwd p; p.pw_change = 0; ],
1516 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1517 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1518 )
1519])
1520if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1521 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1522fi
Damien Miller61e50f12000-05-08 20:49:37 +10001523
Tim Rice28bbb0c2002-05-27 17:37:32 -07001524dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001525AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1526 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001527 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001528 [
Tim Riceae49fe62002-04-12 10:26:21 -07001529#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001530#include <sys/socket.h>
1531#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001532int main() {
1533#ifdef msg_accrights
1534exit(1);
1535#endif
1536struct msghdr m;
1537m.msg_accrights = 0;
1538exit(0);
1539}
Kevin Steves939c9db2002-03-22 17:23:25 +00001540 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001541 [ ac_cv_have_accrights_in_msghdr="yes" ],
1542 [ ac_cv_have_accrights_in_msghdr="no" ]
1543 )
1544])
1545if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1546 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1547fi
1548
Kevin Stevesa44e0352002-04-07 16:18:03 +00001549AC_CACHE_CHECK([for msg_control field in struct msghdr],
1550 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001551 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001552 [
Tim Riceae49fe62002-04-12 10:26:21 -07001553#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001554#include <sys/socket.h>
1555#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001556int main() {
1557#ifdef msg_control
1558exit(1);
1559#endif
1560struct msghdr m;
1561m.msg_control = 0;
1562exit(0);
1563}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001564 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001565 [ ac_cv_have_control_in_msghdr="yes" ],
1566 [ ac_cv_have_control_in_msghdr="no" ]
1567 )
1568])
1569if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1570 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1571fi
1572
Damien Miller61e50f12000-05-08 20:49:37 +10001573AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1574 AC_TRY_LINK([],
1575 [ extern char *__progname; printf("%s", __progname); ],
1576 [ ac_cv_libc_defines___progname="yes" ],
1577 [ ac_cv_libc_defines___progname="no" ]
1578 )
1579])
1580if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1581 AC_DEFINE(HAVE___PROGNAME)
1582fi
1583
Kevin Steves4846f4a2002-03-22 18:19:53 +00001584AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1585 AC_TRY_LINK([
1586#include <stdio.h>
1587],
1588 [ printf("%s", __FUNCTION__); ],
1589 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1590 [ ac_cv_cc_implements___FUNCTION__="no" ]
1591 )
1592])
1593if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1594 AC_DEFINE(HAVE___FUNCTION__)
1595fi
1596
1597AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1598 AC_TRY_LINK([
1599#include <stdio.h>
1600],
1601 [ printf("%s", __func__); ],
1602 [ ac_cv_cc_implements___func__="yes" ],
1603 [ ac_cv_cc_implements___func__="no" ]
1604 )
1605])
1606if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1607 AC_DEFINE(HAVE___func__)
1608fi
1609
Damien Miller4f8e6692001-07-14 13:22:53 +10001610AC_CACHE_CHECK([whether getopt has optreset support],
1611 ac_cv_have_getopt_optreset, [
1612 AC_TRY_LINK(
1613 [
1614#include <getopt.h>
1615 ],
1616 [ extern int optreset; optreset = 0; ],
1617 [ ac_cv_have_getopt_optreset="yes" ],
1618 [ ac_cv_have_getopt_optreset="no" ]
1619 )
1620])
1621if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1622 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1623fi
Damien Millera22ba012000-03-02 23:09:20 +11001624
Damien Millerecbb26d2000-07-15 14:59:14 +10001625AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1626 AC_TRY_LINK([],
1627 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1628 [ ac_cv_libc_defines_sys_errlist="yes" ],
1629 [ ac_cv_libc_defines_sys_errlist="no" ]
1630 )
1631])
1632if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1633 AC_DEFINE(HAVE_SYS_ERRLIST)
1634fi
1635
1636
Damien Miller11fa2cc2000-08-16 10:35:58 +10001637AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1638 AC_TRY_LINK([],
1639 [ extern int sys_nerr; printf("%i", sys_nerr);],
1640 [ ac_cv_libc_defines_sys_nerr="yes" ],
1641 [ ac_cv_libc_defines_sys_nerr="no" ]
1642 )
1643])
1644if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1645 AC_DEFINE(HAVE_SYS_NERR)
1646fi
1647
Damien Miller85de5802001-09-18 14:01:11 +10001648SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001649
1650# Check whether user wants sectok support
1651AC_ARG_WITH(sectok,
1652 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001653 [
1654 if test "x$withval" != "xno" ; then
1655 if test "x$withval" != "xyes" ; then
1656 CPPFLAGS="$CPPFLAGS -I${withval}"
1657 LDFLAGS="$LDFLAGS -L${withval}"
1658 if test ! -z "$need_dash_r" ; then
1659 LDFLAGS="$LDFLAGS -R${withval}"
1660 fi
1661 if test ! -z "$blibpath" ; then
1662 blibpath="$blibpath:${withval}"
1663 fi
1664 fi
1665 AC_CHECK_HEADERS(sectok.h)
1666 if test "$ac_cv_header_sectok_h" != yes; then
1667 AC_MSG_ERROR(Can't find sectok.h)
1668 fi
1669 AC_CHECK_LIB(sectok, sectok_open)
1670 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1671 AC_MSG_ERROR(Can't find libsectok)
1672 fi
1673 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001674 AC_DEFINE(USE_SECTOK)
1675 SCARD_MSG="yes, using sectok"
1676 fi
1677 ]
1678)
1679
1680# Check whether user wants OpenSC support
1681AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001682 AC_HELP_STRING([--with-opensc=PFX],
1683 [Enable smartcard support using OpenSC]),
1684 opensc_config_prefix="$withval", opensc_config_prefix="")
1685if test x$opensc_config_prefix != x ; then
1686 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1687 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1688 if test "$OPENSC_CONFIG" != "no"; then
1689 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1690 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1691 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1692 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1693 AC_DEFINE(SMARTCARD)
1694 AC_DEFINE(USE_OPENSC)
1695 SCARD_MSG="yes, using OpenSC"
1696 fi
1697fi
Damien Miller85de5802001-09-18 14:01:11 +10001698
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001699# Check whether user wants Kerberos 5 support
1700KRB5_MSG="no"
1701AC_ARG_WITH(kerberos5,
1702 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1703 [
1704 if test "x$withval" != "xno" ; then
1705 if test "x$withval" = "xyes" ; then
1706 KRB5ROOT="/usr/local"
1707 else
1708 KRB5ROOT=${withval}
1709 fi
1710 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1711 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1712 AC_DEFINE(KRB5)
1713 KRB5_MSG="yes"
1714 AC_MSG_CHECKING(whether we are using Heimdal)
1715 AC_TRY_COMPILE([ #include <krb5.h> ],
1716 [ char *tmp = heimdal_version; ],
1717 [ AC_MSG_RESULT(yes)
1718 AC_DEFINE(HEIMDAL)
1719 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1720 ],
1721 [ AC_MSG_RESULT(no)
1722 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1723 ]
1724 )
1725 if test ! -z "$need_dash_r" ; then
1726 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1727 fi
1728 if test ! -z "$blibpath" ; then
1729 blibpath="$blibpath:${KRB5ROOT}/lib"
1730 fi
1731 AC_CHECK_LIB(resolv, dn_expand, , )
1732
1733 KRB5=yes
1734 fi
1735 ]
1736)
1737# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001738KRB4_MSG="no"
1739AC_ARG_WITH(kerberos4,
1740 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1741 [
1742 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001743 if test "x$withval" != "xyes" ; then
1744 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1745 LDFLAGS="$LDFLAGS -L${withval}/lib"
1746 if test ! -z "$need_dash_r" ; then
1747 LDFLAGS="$LDFLAGS -R${withval}/lib"
1748 fi
1749 if test ! -z "$blibpath" ; then
1750 blibpath="$blibpath:${withval}/lib"
1751 fi
1752 else
1753 if test -d /usr/include/kerberosIV ; then
1754 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1755 fi
1756 fi
1757
1758 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001759 if test "$ac_cv_header_krb_h" != yes; then
1760 AC_MSG_WARN([Cannot find krb.h, build may fail])
1761 fi
Damien Miller98344742001-03-28 14:37:06 +10001762 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001763 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001764 AC_CHECK_LIB(krb4, main)
1765 if test "$ac_cv_lib_krb4_main" != yes; then
1766 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1767 else
1768 KLIBS="-lkrb4"
1769 fi
1770 else
1771 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001772 fi
Damien Miller98344742001-03-28 14:37:06 +10001773 AC_CHECK_LIB(des, des_cbc_encrypt)
1774 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1775 AC_CHECK_LIB(des425, des_cbc_encrypt)
1776 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1777 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1778 else
1779 KLIBS="-ldes425"
1780 fi
1781 else
1782 KLIBS="-ldes"
1783 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001784 AC_CHECK_LIB(resolv, dn_expand, , )
1785 KRB4=yes
1786 KRB4_MSG="yes"
1787 AC_DEFINE(KRB4)
1788 fi
1789 ]
1790)
1791
1792# Check whether user wants AFS support
1793AFS_MSG="no"
1794AC_ARG_WITH(afs,
1795 [ --with-afs=PATH Enable AFS support],
1796 [
1797 if test "x$withval" != "xno" ; then
1798
1799 if test "x$withval" != "xyes" ; then
1800 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1801 LDFLAGS="$LDFLAGS -L${withval}/lib"
1802 fi
1803
1804 if test -z "$KRB4" ; then
1805 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1806 fi
1807
1808 LIBS="-lkafs $LIBS"
1809 if test ! -z "$AFS_LIBS" ; then
1810 LIBS="$LIBS $AFS_LIBS"
1811 fi
1812 AC_DEFINE(AFS)
1813 AFS_MSG="yes"
1814 fi
1815 ]
1816)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001817LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001818
Damien Millera22ba012000-03-02 23:09:20 +11001819# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11001820
Damien Millerf58c6722002-05-13 13:15:42 +10001821PRIVSEP_PATH=/var/empty
1822AC_ARG_WITH(privsep-path,
Damien Miller74cc5bb2002-05-22 11:02:15 +10001823 [ --with-privsep-path=xxx Path for privilege separation chroot ],
Damien Millerf58c6722002-05-13 13:15:42 +10001824 [
1825 if test "x$withval" != "$no" ; then
1826 PRIVSEP_PATH=$withval
1827 fi
1828 ]
1829)
1830AC_SUBST(PRIVSEP_PATH)
1831
Damien Millera22ba012000-03-02 23:09:20 +11001832AC_ARG_WITH(xauth,
1833 [ --with-xauth=PATH Specify path to xauth program ],
1834 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001835 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001836 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001837 fi
1838 ],
1839 [
Damien Miller78315eb2000-09-29 23:01:36 +11001840 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 +10001841 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001842 xauth_path="/usr/openwin/bin/xauth"
1843 fi
1844 ]
1845)
1846
Damien Millera19cf472000-11-29 13:28:50 +11001847if test -z "$xauth_path" ; then
1848 XAUTH_PATH="undefined"
1849 AC_SUBST(XAUTH_PATH)
1850else
Damien Millera22ba012000-03-02 23:09:20 +11001851 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001852 XAUTH_PATH=$xauth_path
1853 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001854fi
Damien Millera22ba012000-03-02 23:09:20 +11001855
1856# Check for mail directory (last resort if we cannot get it from headers)
1857if test ! -z "$MAIL" ; then
1858 maildir=`dirname $MAIL`
1859 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1860fi
1861
Damien Millera22ba012000-03-02 23:09:20 +11001862if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001863 if test "x$disable_ptmx_check" != "xyes" ; then
1864 AC_CHECK_FILE("/dev/ptmx",
1865 [
1866 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1867 have_dev_ptmx=1
1868 ]
1869 )
1870 fi
Damien Millera22ba012000-03-02 23:09:20 +11001871fi
Damien Miller204ad072000-03-02 23:56:12 +11001872AC_CHECK_FILE("/dev/ptc",
1873 [
1874 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1875 have_dev_ptc=1
1876 ]
1877)
1878
Damien Millera22ba012000-03-02 23:09:20 +11001879# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001880AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001881 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001882 [
Damien Miller897741e2001-04-16 10:41:46 +10001883 case "$withval" in
1884 man|cat|doc)
1885 MANTYPE=$withval
1886 ;;
1887 *)
1888 AC_MSG_ERROR(invalid man type: $withval)
1889 ;;
1890 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001891 ]
1892)
Ben Lindstrombc709922001-04-18 18:04:21 +00001893if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001894 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001895 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1896 MANTYPE=doc
1897 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1898 MANTYPE=man
1899 else
1900 MANTYPE=cat
1901 fi
1902fi
Damien Miller670a4b82000-01-22 13:53:11 +11001903AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001904if test "$MANTYPE" = "doc"; then
1905 mansubdir=man;
1906else
1907 mansubdir=$MANTYPE;
1908fi
1909AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001910
Damien Millera22ba012000-03-02 23:09:20 +11001911# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001912MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001913AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001914 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001915 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001916 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001917 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001918 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001919 fi
1920 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001921)
1922
Damien Millera22ba012000-03-02 23:09:20 +11001923# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001924AC_ARG_WITH(shadow,
1925 [ --without-shadow Disable shadow password support],
1926 [
1927 if test "x$withval" = "xno" ; then
1928 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001929 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001930 fi
1931 ]
1932)
1933
Damien Miller1f335fb2000-06-26 11:31:33 +10001934if test -z "$disable_shadow" ; then
1935 AC_MSG_CHECKING([if the systems has expire shadow information])
1936 AC_TRY_COMPILE(
1937 [
1938#include <sys/types.h>
1939#include <shadow.h>
1940 struct spwd sp;
1941 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1942 [ sp_expire_available=yes ], []
1943 )
1944
1945 if test "x$sp_expire_available" = "xyes" ; then
1946 AC_MSG_RESULT(yes)
1947 AC_DEFINE(HAS_SHADOW_EXPIRE)
1948 else
1949 AC_MSG_RESULT(no)
1950 fi
1951fi
1952
Damien Millera22ba012000-03-02 23:09:20 +11001953# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001954if test ! -z "$IPADDR_IN_DISPLAY" ; then
1955 DISPLAY_HACK_MSG="yes"
1956 AC_DEFINE(IPADDR_IN_DISPLAY)
1957else
1958 DISPLAY_HACK_MSG="no"
1959 AC_ARG_WITH(ipaddr-display,
1960 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1961 [
1962 if test "x$withval" != "xno" ; then
1963 AC_DEFINE(IPADDR_IN_DISPLAY)
1964 DISPLAY_HACK_MSG="yes"
1965 fi
1966 ]
1967 )
1968fi
Damien Miller76112de1999-12-21 11:18:08 +11001969
Tim Rice43a1c132002-04-17 21:19:14 -07001970dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1971if test $ac_cv_func_login_getcapbool = "yes" -a \
1972 $ac_cv_header_login_cap_h = "yes" ; then
1973 USES_LOGIN_CONF=yes
1974fi
Damien Millera22ba012000-03-02 23:09:20 +11001975# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001976SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001977AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001978 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001979 [
Tim Rice43a1c132002-04-17 21:19:14 -07001980 if test "$USES_LOGIN_CONF" = "yes" ; then
1981 AC_MSG_WARN([
1982--with-default-path=PATH has no effect on this system.
1983Edit /etc/login.conf instead.])
1984 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001985 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001986 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001987 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001988 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001989 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1990 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1991 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001992 AC_TRY_RUN(
1993 [
1994/* find out what STDPATH is */
1995#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001996#ifdef HAVE_PATHS_H
1997# include <paths.h>
1998#endif
1999#ifndef _PATH_STDPATH
2000# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2001#endif
2002#include <sys/types.h>
2003#include <sys/stat.h>
2004#include <fcntl.h>
2005#define DATA "conftest.stdpath"
2006
2007main()
2008{
2009 FILE *fd;
2010 int rc;
2011
2012 fd = fopen(DATA,"w");
2013 if(fd == NULL)
2014 exit(1);
2015
2016 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2017 exit(1);
2018
2019 exit(0);
2020}
2021 ], [ user_path=`cat conftest.stdpath` ],
2022 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2023 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2024 )
2025# make sure $bindir is in USER_PATH so scp will work
2026 t_bindir=`eval echo ${bindir}`
2027 case $t_bindir in
2028 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2029 esac
2030 case $t_bindir in
2031 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2032 esac
2033 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2034 if test $? -ne 0 ; then
2035 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2036 if test $? -ne 0 ; then
2037 user_path=$user_path:$t_bindir
2038 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2039 fi
2040 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002041 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002042)
Tim Rice43a1c132002-04-17 21:19:14 -07002043if test "$USES_LOGIN_CONF" != "yes" ; then
2044 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2045 AC_SUBST(user_path)
2046fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002047
Damien Millera18bbd32002-05-13 10:48:57 +10002048# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002049AC_ARG_WITH(superuser-path,
2050 [ --with-superuser-path= Specify different path for super-user],
2051 [
2052 if test "x$withval" != "xno" ; then
2053 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2054 superuser_path=$withval
2055 fi
2056 ]
2057)
2058
2059
Damien Millera22ba012000-03-02 23:09:20 +11002060# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002061IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002062AC_ARG_WITH(ipv4-default,
2063 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2064 [
2065 if test "x$withval" != "xno" ; then
2066 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002067 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002068 fi
2069 ]
2070)
2071
Damien Miller61e50f12000-05-08 20:49:37 +10002072AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002073IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002074AC_ARG_WITH(4in6,
2075 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2076 [
2077 if test "x$withval" != "xno" ; then
2078 AC_MSG_RESULT(yes)
2079 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002080 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002081 else
2082 AC_MSG_RESULT(no)
2083 fi
2084 ],[
2085 if test "x$inet6_default_4in6" = "xyes"; then
2086 AC_MSG_RESULT([yes (default)])
2087 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002088 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002089 else
2090 AC_MSG_RESULT([no (default)])
2091 fi
2092 ]
2093)
2094
Damien Miller60396b02001-02-18 17:01:00 +11002095# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002096BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002097AC_ARG_WITH(bsd-auth,
2098 [ --with-bsd-auth Enable BSD auth support],
2099 [
2100 if test "x$withval" != "xno" ; then
2101 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002102 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002103 fi
2104 ]
2105)
2106
Damien Millera22ba012000-03-02 23:09:20 +11002107# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002108piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002109# make sure the directory exists
2110if test ! -d $piddir ; then
2111 piddir=`eval echo ${sysconfdir}`
2112 case $piddir in
2113 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2114 esac
2115fi
2116
Tim Rice88f2ab52002-03-17 12:17:34 -08002117AC_ARG_WITH(pid-dir,
2118 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2119 [
2120 if test "x$withval" != "xno" ; then
2121 piddir=$withval
2122 if test ! -d $piddir ; then
2123 AC_MSG_WARN([** no $piddir directory on this system **])
2124 fi
2125 fi
2126 ]
2127)
2128
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002129AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002130AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002131
andre2ff7b5d2000-06-03 14:57:40 +00002132dnl allow user to disable some login recording features
2133AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002134 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002135 [ AC_DEFINE(DISABLE_LASTLOG) ]
2136)
2137AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002138 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002139 [ AC_DEFINE(DISABLE_UTMP) ]
2140)
2141AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002142 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002143 [ AC_DEFINE(DISABLE_UTMPX) ]
2144)
2145AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002146 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002147 [ AC_DEFINE(DISABLE_WTMP) ]
2148)
2149AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002150 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002151 [ AC_DEFINE(DISABLE_WTMPX) ]
2152)
2153AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002154 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002155 [ AC_DEFINE(DISABLE_LOGIN) ]
2156)
2157AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002158 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002159 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2160)
2161AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002162 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002163 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2164)
2165AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002166 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002167 [
2168 if test "x$withval" = "xno" ; then
2169 AC_DEFINE(DISABLE_LASTLOG)
2170 else
2171 conf_lastlog_location=$withval
2172 fi
2173 ]
2174)
andre2ff7b5d2000-06-03 14:57:40 +00002175
2176dnl lastlog, [uw]tmpx? detection
2177dnl NOTE: set the paths in the platform section to avoid the
2178dnl need for command-line parameters
2179dnl lastlog and [uw]tmp are subject to a file search if all else fails
2180
2181dnl lastlog detection
2182dnl NOTE: the code itself will detect if lastlog is a directory
2183AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2184AC_TRY_COMPILE([
2185#include <sys/types.h>
2186#include <utmp.h>
2187#ifdef HAVE_LASTLOG_H
2188# include <lastlog.h>
2189#endif
Damien Miller2994e082000-06-04 15:51:47 +10002190#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002191# include <paths.h>
2192#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002193#ifdef HAVE_LOGIN_H
2194# include <login.h>
2195#endif
andre2ff7b5d2000-06-03 14:57:40 +00002196 ],
2197 [ char *lastlog = LASTLOG_FILE; ],
2198 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002199 [
2200 AC_MSG_RESULT(no)
2201 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2202 AC_TRY_COMPILE([
2203#include <sys/types.h>
2204#include <utmp.h>
2205#ifdef HAVE_LASTLOG_H
2206# include <lastlog.h>
2207#endif
2208#ifdef HAVE_PATHS_H
2209# include <paths.h>
2210#endif
2211 ],
2212 [ char *lastlog = _PATH_LASTLOG; ],
2213 [ AC_MSG_RESULT(yes) ],
2214 [
andree441aa32000-06-12 22:34:38 +00002215 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002216 system_lastlog_path=no
2217 ])
2218 ]
andre2ff7b5d2000-06-03 14:57:40 +00002219)
Damien Miller2994e082000-06-04 15:51:47 +10002220
andre2ff7b5d2000-06-03 14:57:40 +00002221if test -z "$conf_lastlog_location"; then
2222 if test x"$system_lastlog_path" = x"no" ; then
2223 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002224 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002225 conf_lastlog_location=$f
2226 fi
2227 done
2228 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002229 AC_MSG_WARN([** Cannot find lastlog **])
2230 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002231 fi
2232 fi
2233fi
2234
2235if test -n "$conf_lastlog_location"; then
2236 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2237fi
2238
2239dnl utmp detection
2240AC_MSG_CHECKING([if your system defines UTMP_FILE])
2241AC_TRY_COMPILE([
2242#include <sys/types.h>
2243#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002244#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002245# include <paths.h>
2246#endif
2247 ],
2248 [ char *utmp = UTMP_FILE; ],
2249 [ AC_MSG_RESULT(yes) ],
2250 [ AC_MSG_RESULT(no)
2251 system_utmp_path=no ]
2252)
2253if test -z "$conf_utmp_location"; then
2254 if test x"$system_utmp_path" = x"no" ; then
2255 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2256 if test -f $f ; then
2257 conf_utmp_location=$f
2258 fi
2259 done
2260 if test -z "$conf_utmp_location"; then
2261 AC_DEFINE(DISABLE_UTMP)
2262 fi
2263 fi
2264fi
2265if test -n "$conf_utmp_location"; then
2266 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2267fi
2268
2269dnl wtmp detection
2270AC_MSG_CHECKING([if your system defines WTMP_FILE])
2271AC_TRY_COMPILE([
2272#include <sys/types.h>
2273#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002274#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002275# include <paths.h>
2276#endif
2277 ],
2278 [ char *wtmp = WTMP_FILE; ],
2279 [ AC_MSG_RESULT(yes) ],
2280 [ AC_MSG_RESULT(no)
2281 system_wtmp_path=no ]
2282)
2283if test -z "$conf_wtmp_location"; then
2284 if test x"$system_wtmp_path" = x"no" ; then
2285 for f in /usr/adm/wtmp /var/log/wtmp; do
2286 if test -f $f ; then
2287 conf_wtmp_location=$f
2288 fi
2289 done
2290 if test -z "$conf_wtmp_location"; then
2291 AC_DEFINE(DISABLE_WTMP)
2292 fi
2293 fi
2294fi
2295if test -n "$conf_wtmp_location"; then
2296 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2297fi
2298
2299
2300dnl utmpx detection - I don't know any system so perverse as to require
2301dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2302dnl there, though.
2303AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2304AC_TRY_COMPILE([
2305#include <sys/types.h>
2306#include <utmp.h>
2307#ifdef HAVE_UTMPX_H
2308#include <utmpx.h>
2309#endif
Damien Miller2994e082000-06-04 15:51:47 +10002310#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002311# include <paths.h>
2312#endif
2313 ],
2314 [ char *utmpx = UTMPX_FILE; ],
2315 [ AC_MSG_RESULT(yes) ],
2316 [ AC_MSG_RESULT(no)
2317 system_utmpx_path=no ]
2318)
2319if test -z "$conf_utmpx_location"; then
2320 if test x"$system_utmpx_path" = x"no" ; then
2321 AC_DEFINE(DISABLE_UTMPX)
2322 fi
2323else
2324 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2325fi
2326
2327dnl wtmpx detection
2328AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2329AC_TRY_COMPILE([
2330#include <sys/types.h>
2331#include <utmp.h>
2332#ifdef HAVE_UTMPX_H
2333#include <utmpx.h>
2334#endif
Damien Miller2994e082000-06-04 15:51:47 +10002335#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002336# include <paths.h>
2337#endif
2338 ],
2339 [ char *wtmpx = WTMPX_FILE; ],
2340 [ AC_MSG_RESULT(yes) ],
2341 [ AC_MSG_RESULT(no)
2342 system_wtmpx_path=no ]
2343)
2344if test -z "$conf_wtmpx_location"; then
2345 if test x"$system_wtmpx_path" = x"no" ; then
2346 AC_DEFINE(DISABLE_WTMPX)
2347 fi
2348else
2349 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2350fi
2351
Damien Miller4018c192000-04-30 09:30:44 +10002352
Damien Miller29ea30d2000-03-17 10:54:15 +11002353if test ! -z "$blibpath" ; then
2354 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2355 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2356fi
2357
Tim Rice4cec93f2002-02-26 08:40:48 -08002358dnl remove pam and dl because they are in $LIBPAM
2359if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002360 LIBS=`echo $LIBS | sed 's/-lpam //'`
2361fi
2362if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2363 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002364fi
2365
Damien Millerbac2d8a2000-09-05 16:13:06 +11002366AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002367AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2368AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002369
Damien Miller7b22d652000-06-18 14:07:04 +10002370# Print summary of options
2371
Damien Miller7b22d652000-06-18 14:07:04 +10002372# Someone please show me a better way :)
2373A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2374B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2375C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2376D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002377E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002378F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002379G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002380H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2381I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2382J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002383
2384echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002385echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002386echo " User binaries: $B"
2387echo " System binaries: $C"
2388echo " Configuration files: $D"
2389echo " Askpass program: $E"
2390echo " Manual pages: $F"
2391echo " PID file: $G"
2392echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002393if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002394echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002395else
Damien Millerf58c6722002-05-13 13:15:42 +10002396echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002397fi
Damien Millera18bbd32002-05-13 10:48:57 +10002398if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002399echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002400fi
Damien Millerf58c6722002-05-13 13:15:42 +10002401echo " Manpage format: $MANTYPE"
2402echo " PAM support: ${PAM_MSG}"
2403echo " KerberosIV support: $KRB4_MSG"
2404echo " KerberosV support: $KRB5_MSG"
2405echo " Smartcard support: $SCARD_MSG"
2406echo " AFS support: $AFS_MSG"
2407echo " S/KEY support: $SKEY_MSG"
2408echo " TCP Wrappers support: $TCPW_MSG"
2409echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002410echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002411echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2412echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2413echo " BSD Auth support: $BSD_AUTH_MSG"
2414echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002415if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002416echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002417fi
2418
Damien Miller7b22d652000-06-18 14:07:04 +10002419echo ""
2420
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002421echo " Host: ${host}"
2422echo " Compiler: ${CC}"
2423echo " Compiler flags: ${CFLAGS}"
2424echo "Preprocessor flags: ${CPPFLAGS}"
2425echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002426echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002427
2428echo ""
2429
Damien Miller82cf0ce2000-12-20 13:34:48 +11002430if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002431 echo "PAM is enabled. You may need to install a PAM control file "
2432 echo "for sshd, otherwise password authentication may fail. "
2433 echo "Example PAM control files can be found in the contrib/ "
2434 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002435 echo ""
2436fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002437
2438if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002439 echo "sftp-server will be disabled. Your compiler does not "
2440 echo "support 64bit integers."
2441 echo ""
2442fi
2443
2444if test ! -z "$RAND_HELPER_CMDHASH" ; then
2445 echo "WARNING: you are using the builtin random number collection "
2446 echo "service. Please read WARNING.RNG and request that your OS "
2447 echo "vendor includes kernel-based random number collection in "
2448 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002449 echo ""
2450fi
Damien Miller60396b02001-02-18 17:01:00 +11002451