blob: 628adb392eb8d6c2fff7529bab50ef48fe190b28 [file] [log] [blame]
Tim Rice28bbb0c2002-05-27 17:37:32 -07001# $Id: configure.ac,v 1.64 2002/05/28 00:37:33 tim Exp $
Damien Millere9cf3572001-02-09 12:55:35 +11002
Tim Rice13aae5e2001-10-21 17:53:58 -07003AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +10005
6AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11007AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11008AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +11009AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100010
Damien Millera22ba012000-03-02 23:09:20 +110011# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +110012AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100013AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110014AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000015AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070016AC_PATH_PROGS(PERL, perl5 perl)
Damien Millere79334a1999-12-29 10:03:37 +110017AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100018AC_PATH_PROG(ENT, ent)
19AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110020AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller4864e8f2001-02-08 10:07:08 +110021AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070024AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110025
Damien Millere8bb4502001-09-25 16:39:35 +100026# System features
27AC_SYS_LARGEFILE
28
Damien Miller3f62aba2000-11-29 11:56:35 +110029if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
31fi
32
Damien Millerad833b32000-08-23 10:46:23 +100033# Use LOGIN_PROGRAM from environment if possible
34if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
36else
37 # Search for login
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
41 fi
42fi
43
Damien Miller166bd442000-03-16 10:48:25 +110044if test -z "$LD" ; then
45 LD=$CC
46fi
47AC_SUBST(LD)
48
Damien Miller166bd442000-03-16 10:48:25 +110049AC_C_INLINE
Damien Miller649d9992001-06-27 23:35:51 +100050if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110052fi
53
Damien Millera22ba012000-03-02 23:09:20 +110054# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110055case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110056*-*-aix*)
57 AFS_LIBS="-lld"
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +000058 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +110059 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100060 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Millerfa2bb692002-04-23 23:22:25 +100061 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
62 saved_LDFLAGS="$LDFLAGS"
63 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
64 AC_TRY_LINK([],
65 [],
66 [
67 AC_MSG_RESULT(yes)
68 blibpath="/usr/lib:/lib:/usr/local/lib"
69 ],
70 [ AC_MSG_RESULT(no) ]
71 )
72 LDFLAGS="$saved_LDFLAGS"
Damien Miller29ea30d2000-03-17 10:54:15 +110073 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100074 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110075 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +100076 AC_DEFINE(BROKEN_REALPATH)
andre60f3c982000-06-03 16:18:19 +000077 dnl AIX handles lastlog as part of its login message
78 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110079 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110080*-*-cygwin*)
Tim Ricefe1d1002001-11-26 17:19:43 -080081 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110082 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +000083 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +110084 AC_DEFINE(DISABLE_SHADOW)
85 AC_DEFINE(IPV4_DEFAULT)
86 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +000087 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Damien Millerbac2d8a2000-09-05 16:13:06 +110088 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +000089*-*-dgux*)
90 AC_DEFINE(IP_TOS_IS_BROKEN)
91 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +000092*-*-darwin*)
93 AC_DEFINE(BROKEN_GETADDRINFO)
94 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +000095*-*-hpux10.26)
96 if test -z "$GCC"; then
97 CFLAGS="$CFLAGS -Ae"
98 fi
99 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
100 IPADDR_IN_DISPLAY=yes
101 AC_DEFINE(HAVE_SECUREWARE)
102 AC_DEFINE(USE_PIPES)
103 AC_DEFINE(LOGIN_NO_ENDOPT)
104 AC_DEFINE(LOGIN_NEEDS_UTMPX)
105 AC_DEFINE(DISABLE_SHADOW)
106 AC_DEFINE(DISABLE_UTMP)
107 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
108 LIBS="$LIBS -lxnet -lsec -lsecpw"
109 disable_ptmx_check=yes
110 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100111*-*-hpux10*)
112 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000113 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100114 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000115 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100116 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000117 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000118 AC_DEFINE(LOGIN_NO_ENDOPT)
119 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100120 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100121 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000122 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves315f8b72001-06-28 00:24:41 +0000123 LIBS="$LIBS -lxnet -lsec"
Damien Miller76112de1999-12-21 11:18:08 +1100124 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000125*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000126 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100127 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100128 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100129 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000130 AC_DEFINE(LOGIN_NO_ENDOPT)
131 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller8a1e6a62000-09-16 15:55:52 +1100132 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +1100133 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +0000134 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000135 LIBS="$LIBS -lxnet -lsec"
Damien Miller1bead332000-04-30 00:47:29 +1000136 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100137*-*-irix5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000138 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000139 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100140 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000141 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000142 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller1808f382000-01-06 12:03:12 +1100143 ;;
144*-*-irix6*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000145 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000146 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100147 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000148 AC_DEFINE(WITH_IRIX_ARRAY)
149 AC_DEFINE(WITH_IRIX_PROJECT)
150 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000151 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000152 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerf1b9d112002-04-23 23:09:19 +1000153 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100154 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100155*-*-linux*)
156 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100157 check_for_libcrypt_later=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100158 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000159 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100160 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100161 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000162mips-sony-bsd|mips-sony-newsos4)
163 AC_DEFINE(HAVE_NEWS4)
164 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000165 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100166*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100167 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100168 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100169*-*-freebsd*)
170 check_for_libcrypt_later=1
171 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000172*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000173 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100174 conf_utmp_location=/etc/utmp
175 conf_wtmp_location=/usr/adm/wtmp
176 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000177 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000178 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000179 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100180 AC_DEFINE(BROKEN_SAVED_UIDS)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000181 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom321ae732000-12-31 15:00:23 +0000182 CFLAGS="$CFLAGS"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000183 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100184*-*-solaris*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Ben Lindstrom866488b2001-02-20 18:22:38 +0000186 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
Damien Millera22ba012000-03-02 23:09:20 +1100187 need_dash_r=1
Damien Miller82cf0ce2000-12-20 13:34:48 +1100188 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000189 AC_DEFINE(LOGIN_NEEDS_UTMPX)
190 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000191 AC_DEFINE(PAM_TTY_KLUDGE)
andre2ff7b5d2000-06-03 14:57:40 +0000192 # hardwire lastlog location (can't detect it on some versions)
193 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000194 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
195 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
196 if test "$sol2ver" -ge 8; then
197 AC_MSG_RESULT(yes)
198 AC_DEFINE(DISABLE_UTMP)
199 AC_DEFINE(DISABLE_WTMP)
200 else
201 AC_MSG_RESULT(no)
202 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100203 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000204*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000205 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000206 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100207 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000208 conf_utmp_location=/etc/utmp
209 conf_wtmp_location=/var/adm/wtmp
210 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000211 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000212 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000213*-ncr-sysv*)
214 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
215 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700216 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000217 AC_DEFINE(USE_PIPES)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000218 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000219*-sni-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000220 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Tim Riceffdf4aa2001-10-27 10:45:36 -0700221 # /usr/ucblib MUST NOT be searched on ReliantUNIX
222 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Millerfd9885e2001-01-10 08:16:53 +1100223 IPADDR_IN_DISPLAY=yes
224 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000225 AC_DEFINE(IP_TOS_IS_BROKEN)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700226 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
227 # Attention: always take care to bind libsocket and libnsl before libc,
228 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000229 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100230*-*-sysv4.2*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000231 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100232 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700233# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100234 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100235 ;;
236*-*-sysv5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000237 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100238 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Ricea4f7ae12001-09-17 14:34:33 -0700239# enable_suid_ssh=no
Damien Miller5dfe9762001-02-16 12:05:39 +1100240 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100241 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100242*-*-sysv*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000243 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millerdb819592000-03-14 13:44:01 +1100244 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller75b1d102000-01-07 14:01:41 +1100245 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100246*-*-sco3.2v4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000247 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
Damien Miller78315eb2000-09-29 23:01:36 +1100248 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Tim Rice13aae5e2001-10-21 17:53:58 -0700249 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100250 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100251 RANLIB=true
252 no_dev_ptmx=1
253 AC_DEFINE(BROKEN_SYS_TERMIO_H)
254 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000255 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000256 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100257 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller217f5672001-02-16 12:12:41 +1100258 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700259 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700260 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100261 ;;
262*-*-sco3.2v5*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
Damien Millera66626b2000-06-13 18:57:53 +1000264 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller5dfe9762001-02-16 12:05:39 +1100265 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000266 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100267 rsh_path="/usr/bin/rcmd"
Damien Miller5dfe9762001-02-16 12:05:39 +1100268 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000269 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000270 AC_DEFINE(DISABLE_SHADOW)
Damien Miller217f5672001-02-16 12:12:41 +1100271 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700272 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000273 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000274*-*-unicos*)
Tim Ricee991e3c2001-08-07 15:29:07 -0700275 no_libsocket=1
276 no_libnsl=1
Ben Lindstromd9e08242001-07-22 19:32:00 +0000277 AC_DEFINE(USE_PIPES)
Tim Ricee991e3c2001-08-07 15:29:07 -0700278 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib"
279 LIBS="$LIBS -lgen -lrsc"
280 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000281*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000282 AC_MSG_CHECKING(for Digital Unix SIA)
283 no_osfsia=""
284 AC_ARG_WITH(osfsia,
285 [ --with-osfsia Enable Digital Unix SIA],
286 [
287 if test "x$withval" = "xno" ; then
288 AC_MSG_RESULT(disabled)
289 no_osfsia=1
290 fi
291 ],
292 )
293 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000294 if test -f /etc/sia/matrix.conf; then
295 AC_MSG_RESULT(yes)
296 AC_DEFINE(HAVE_OSF_SIA)
297 AC_DEFINE(DISABLE_LOGIN)
298 LIBS="$LIBS -lsecurity -ldb -lm -laud"
299 else
300 AC_MSG_RESULT(no)
301 fi
302 fi
303 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000304
305*-*-nto-qnx)
306 AC_DEFINE(USE_PIPES)
307 AC_DEFINE(NO_X11_UNIX_SOCKETS)
308 AC_DEFINE(MISSING_NFDBITS)
309 AC_DEFINE(MISSING_HOWMANY)
310 AC_DEFINE(MISSING_FD_MASK)
311 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100312esac
313
Damien Millere37bfc12000-06-05 09:37:43 +1000314# Allow user to specify flags
315AC_ARG_WITH(cflags,
316 [ --with-cflags Specify additional flags to pass to compiler],
317 [
318 if test "x$withval" != "xno" ; then
319 CFLAGS="$CFLAGS $withval"
320 fi
321 ]
322)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000323AC_ARG_WITH(cppflags,
324 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
325 [
326 if test "x$withval" != "xno"; then
327 CPPFLAGS="$CPPFLAGS $withval"
328 fi
329 ]
330)
Damien Millere37bfc12000-06-05 09:37:43 +1000331AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000332 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000333 [
334 if test "x$withval" != "xno" ; then
335 LDFLAGS="$LDFLAGS $withval"
336 fi
337 ]
338)
339AC_ARG_WITH(libs,
340 [ --with-libs Specify additional libraries to link with],
341 [
342 if test "x$withval" != "xno" ; then
343 LIBS="$LIBS $withval"
344 fi
345 ]
346)
347
Tim Rice4cec93f2002-02-26 08:40:48 -0800348# Checks for header files.
349AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
350 getopt.h glob.h lastlog.h limits.h login.h \
351 login_cap.h maillock.h netdb.h netgroup.h \
Damien Millerf71d2a52002-05-13 15:14:08 +1000352 netinet/in_systm.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000353 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800354 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
Kevin Stevesb1184bb2002-04-07 18:12:03 +0000355 sys/mman.h sys/select.h sys/stat.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800356 sys/stropts.h sys/sysmacros.h sys/time.h \
Kevin Steves117b06d2002-03-30 17:55:21 +0000357 sys/un.h time.h ttyent.h usersec.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800358 util.h utime.h utmp.h utmpx.h)
359
Damien Millera22ba012000-03-02 23:09:20 +1100360# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700361AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
362AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000363
Damien Millerdf288022001-02-18 13:07:07 +1100364dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700365if test "x$with_tcp_wrappers" != "xno" ; then
366 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
367 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
368 fi
369fi
Damien Millerdf288022001-02-18 13:07:07 +1100370
Tim Rice13aae5e2001-10-21 17:53:58 -0700371AC_CHECK_FUNC(getspnam, ,
372 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice13aae5e2001-10-21 17:53:58 -0700373
Damien Miller150c8b52002-02-13 23:06:56 +1100374AC_ARG_WITH(rpath,
375 [ --without-rpath Disable auto-added -R linker paths],
376 [
377 if test "x$withval" = "xno" ; then
378 need_dash_r=""
379 fi
380 if test "x$withval" = "xyes" ; then
381 need_dash_r=1
382 fi
383 ]
384)
385
Tim Rice13aae5e2001-10-21 17:53:58 -0700386dnl zlib is required
387AC_ARG_WITH(zlib,
388 [ --with-zlib=PATH Use zlib in PATH],
389 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000390 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100391 AC_MSG_ERROR([*** zlib is required ***])
392 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700393 if test -d "$withval/lib"; then
394 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700395 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700396 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700397 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700398 fi
399 else
400 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700401 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700402 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700403 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700404 fi
405 fi
406 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700407 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700408 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700409 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700410 fi
411 ]
412)
413
Tim Rice17b93e52001-10-23 22:36:54 -0700414AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
Damien Miller6f9c3372000-10-25 10:06:04 +1100415
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000416dnl UnixWare 2.x
417AC_CHECK_FUNC(strcasecmp,
418 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
419)
420AC_CHECK_FUNC(utimes,
421 [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ]
422)
Damien Millerab18c411999-11-11 10:40:23 +1100423
Tim Ricee589a292001-11-03 11:09:32 -0800424dnl Checks for libutil functions
425AC_CHECK_HEADERS(libutil.h)
426AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
427AC_CHECK_FUNCS(logout updwtmp logwtmp)
428
Ben Lindstrom8697e082001-02-24 21:41:10 +0000429AC_FUNC_STRFTIME
430
Damien Miller3c027682001-03-14 11:39:45 +1100431# Check for ALTDIRFUNC glob() extension
432AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
433AC_EGREP_CPP(FOUNDIT,
434 [
435 #include <glob.h>
436 #ifdef GLOB_ALTDIRFUNC
437 FOUNDIT
438 #endif
439 ],
440 [
441 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
442 AC_MSG_RESULT(yes)
443 ],
444 [
445 AC_MSG_RESULT(no)
446 ]
447)
Damien Millerab18c411999-11-11 10:40:23 +1100448
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000449# Check for g.gl_matchc glob() extension
450AC_MSG_CHECKING(for gl_matchc field in glob_t)
451AC_EGREP_CPP(FOUNDIT,
452 [
453 #include <glob.h>
454 int main(void){glob_t g; g.gl_matchc = 1;}
455 ],
456 [
457 AC_DEFINE(GLOB_HAS_GL_MATCHC)
458 AC_MSG_RESULT(yes)
459 ],
460 [
461 AC_MSG_RESULT(no)
462 ]
463)
464
Damien Miller18bb4732001-03-28 14:35:30 +1000465AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
466AC_TRY_RUN(
467 [
468#include <sys/types.h>
469#include <dirent.h>
470int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
471 ],
472 [AC_MSG_RESULT(yes)],
473 [
474 AC_MSG_RESULT(no)
475 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
476 ]
477)
478
Damien Millerc547bf12001-02-16 10:18:12 +1100479# Check whether user wants S/Key support
480SKEY_MSG="no"
481AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700482 [ --with-skey[[=PATH]] Enable S/Key support
483 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100484 [
485 if test "x$withval" != "xno" ; then
486
487 if test "x$withval" != "xyes" ; then
488 CPPFLAGS="$CPPFLAGS -I${withval}/include"
489 LDFLAGS="$LDFLAGS -L${withval}/lib"
490 fi
491
492 AC_DEFINE(SKEY)
493 LIBS="-lskey $LIBS"
494 SKEY_MSG="yes"
495
Tim Rice4cec93f2002-02-26 08:40:48 -0800496 AC_MSG_CHECKING([for s/key support])
497 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100498 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800499#include <stdio.h>
500#include <skey.h>
501int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
502 ],
503 [AC_MSG_RESULT(yes)],
504 [
505 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100506 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
507 ])
508 fi
509 ]
510)
511
512# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700513TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100514AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700515 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
516 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100517 [
518 if test "x$withval" != "xno" ; then
519 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700520 saved_LDFLAGS="$LDFLAGS"
521 saved_CPPFLAGS="$CPPFLAGS"
522 if test -n "${withval}" -a "${withval}" != "yes"; then
523 if test -d "${withval}/lib"; then
524 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700525 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700526 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700527 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700528 fi
529 else
530 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700531 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700532 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700533 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700534 fi
535 fi
536 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700537 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700538 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700539 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700540 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700541 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800542 LIBWRAP="-lwrap"
543 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100544 AC_MSG_CHECKING(for libwrap)
545 AC_TRY_LINK(
546 [
547#include <tcpd.h>
548 int deny_severity = 0, allow_severity = 0;
549 ],
550 [hosts_access(0);],
551 [
552 AC_MSG_RESULT(yes)
553 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800554 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700555 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100556 ],
557 [
558 AC_MSG_ERROR([*** libwrap missing])
559 ]
560 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800561 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100562 fi
563 ]
564)
565
Damien Millerad833b32000-08-23 10:46:23 +1000566dnl Checks for library functions.
Ben Lindstromfdee8ef2002-04-06 23:52:02 +0000567AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
Tim Rice13aae5e2001-10-21 17:53:58 -0700568 clock fchmod fchown freeaddrinfo futimes gai_strerror \
569 getaddrinfo getcwd getgrouplist getnameinfo getopt \
570 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
571 inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller594a71b2002-04-23 20:22:59 +1000572 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
573 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
574 setenv seteuid setlogin setproctitle setresgid setreuid setrlimit \
Kevin Stevese0f2ca42002-04-10 23:17:05 +0000575 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Tim Rice4bd2a192002-05-07 19:51:31 -0700576 strlcat strlcpy strmode strsep sysconf tcgetpgrp truncate utimes \
Tim Rice13aae5e2001-10-21 17:53:58 -0700577 vhangup vsnprintf waitpid __b64_ntop _getpty)
578
579dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice17b93e52001-10-23 22:36:54 -0700580AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
Tim Rice13aae5e2001-10-21 17:53:58 -0700581 AC_CHECK_LIB(gen, dirname,[
582 AC_CACHE_CHECK([for broken dirname],
583 ac_cv_have_broken_dirname, [
Tim Rice17b93e52001-10-23 22:36:54 -0700584 save_LIBS="$LIBS"
585 LIBS="$LIBS -lgen"
Tim Rice13aae5e2001-10-21 17:53:58 -0700586 AC_TRY_RUN(
587 [
588#include <libgen.h>
589#include <string.h>
590
591int main(int argc, char **argv) {
592 char *s, buf[32];
593
594 strncpy(buf,"/etc", 32);
595 s = dirname(buf);
Tim Rice17b93e52001-10-23 22:36:54 -0700596 if (!s || strncmp(s, "/", 32) != 0) {
Tim Rice13aae5e2001-10-21 17:53:58 -0700597 exit(1);
598 } else {
599 exit(0);
600 }
601}
602 ],
603 [ ac_cv_have_broken_dirname="no" ],
604 [ ac_cv_have_broken_dirname="yes" ]
605 )
Tim Rice17b93e52001-10-23 22:36:54 -0700606 LIBS="$save_LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700607 ])
Tim Rice17b93e52001-10-23 22:36:54 -0700608 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700609 LIBS="$LIBS -lgen"
610 AC_DEFINE(HAVE_DIRNAME)
Tim Rice17b93e52001-10-23 22:36:54 -0700611 AC_CHECK_HEADERS(libgen.h)
Tim Rice13aae5e2001-10-21 17:53:58 -0700612 fi
613 ])
614])
615
Damien Millerad833b32000-08-23 10:46:23 +1000616dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000617AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000618dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000619AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000620AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000621dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000622AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000623AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100624
Damien Miller5fc85652000-07-09 23:53:07 +1000625AC_CHECK_FUNC(getuserattr,
626 [AC_DEFINE(HAVE_GETUSERATTR)],
627 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
628)
629
Damien Miller04f80141999-11-19 15:32:34 +1100630AC_CHECK_FUNC(daemon,
631 [AC_DEFINE(HAVE_DAEMON)],
632 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
633)
634
Damien Miller9fb07e42000-03-05 16:22:59 +1100635AC_CHECK_FUNC(getpagesize,
636 [AC_DEFINE(HAVE_GETPAGESIZE)],
637 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
638)
639
Damien Millercb170cb2000-07-01 16:52:55 +1000640# Check for broken snprintf
641if test "x$ac_cv_func_snprintf" = "xyes" ; then
642 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
643 AC_TRY_RUN(
644 [
645#include <stdio.h>
646int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
647 ],
648 [AC_MSG_RESULT(yes)],
649 [
650 AC_MSG_RESULT(no)
651 AC_DEFINE(BROKEN_SNPRINTF)
652 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
653 ]
654 )
655fi
656
Damien Miller606f8802000-09-16 15:39:56 +1100657AC_FUNC_GETPGRP
658
Damien Millera64b57a2001-01-17 10:44:13 +1100659# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +1000660PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100661AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +1100662 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +1100663 [
Damien Millera64b57a2001-01-17 10:44:13 +1100664 if test "x$withval" != "xno" ; then
665 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
666 AC_MSG_ERROR([PAM headers not found])
667 fi
668
669 AC_CHECK_LIB(dl, dlopen, , )
670 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
671 AC_CHECK_FUNCS(pam_getenvlist)
672
673 disable_shadow=yes
674 PAM_MSG="yes"
675
676 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -0800677 if test $ac_cv_lib_dl_dlopen = yes; then
678 LIBPAM="-lpam -ldl"
679 else
680 LIBPAM="-lpam"
681 fi
682 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +1100683 fi
684 ]
685)
Damien Millera22ba012000-03-02 23:09:20 +1100686
Damien Millera64b57a2001-01-17 10:44:13 +1100687# Check for older PAM
688if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100689 # Check PAM strerror arguments (old PAM)
690 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
691 AC_TRY_COMPILE(
692 [
Damien Miller81171112000-04-23 11:14:01 +1000693#include <stdlib.h>
694#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100695 ],
696 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
697 [AC_MSG_RESULT(no)],
698 [
699 AC_DEFINE(HAVE_OLD_PAM)
700 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000701 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100702 ]
Damien Millera64b57a2001-01-17 10:44:13 +1100703 )
Damien Millera22ba012000-03-02 23:09:20 +1100704fi
705
Tim Riceaef73712002-05-11 13:17:42 -0700706# Search for OpenSSL
707saved_CPPFLAGS="$CPPFLAGS"
708saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100709AC_ARG_WITH(ssl-dir,
710 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
711 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000712 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -0700713 if test -d "$withval/lib"; then
714 if test -n "${need_dash_r}"; then
715 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
716 else
717 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
718 fi
719 else
720 if test -n "${need_dash_r}"; then
721 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
722 else
723 LDFLAGS="-L${withval} ${LDFLAGS}"
724 fi
725 fi
726 if test -d "$withval/include"; then
727 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
728 else
729 CPPFLAGS="-I${withval} ${CPPFLAGS}"
730 fi
Damien Millera22ba012000-03-02 23:09:20 +1100731 fi
732 ]
733)
Tim Riceaef73712002-05-11 13:17:42 -0700734LIBS="$LIBS -lcrypto"
735AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +1000736 [
Tim Riceaef73712002-05-11 13:17:42 -0700737 dnl Check default openssl install dir
738 if test -n "${need_dash_r}"; then
739 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000740 else
Tim Riceaef73712002-05-11 13:17:42 -0700741 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +1000742 fi
Tim Riceaef73712002-05-11 13:17:42 -0700743 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
744 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
745 [
746 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
747 ]
748 )
749 ]
750)
751
Damien Millera22ba012000-03-02 23:09:20 +1100752
Damien Millerec932372002-01-22 22:16:03 +1100753# Sanity check OpenSSL headers
754AC_MSG_CHECKING([whether OpenSSL's headers match the library])
755AC_TRY_RUN(
756 [
757#include <string.h>
758#include <openssl/opensslv.h>
759int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
760 ],
761 [
762 AC_MSG_RESULT(yes)
763 ],
764 [
765 AC_MSG_RESULT(no)
766 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
767 ]
768)
769
Damien Millera64b57a2001-01-17 10:44:13 +1100770# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
771# version in OpenSSL. Skip this for PAM
772if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +1100773 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +1100774fi
775
Damien Miller6c21c512002-01-22 21:57:53 +1100776
777### Configure cryptographic random number support
778
779# Check wheter OpenSSL seeds itself
780AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
781AC_TRY_RUN(
782 [
783#include <string.h>
784#include <openssl/rand.h>
785int main(void) { return(RAND_status() == 1 ? 0 : 1); }
786 ],
787 [
788 OPENSSL_SEEDS_ITSELF=yes
789 AC_MSG_RESULT(yes)
790 ],
791 [
792 AC_MSG_RESULT(no)
793 # Default to use of the rand helper if OpenSSL doesn't
794 # seed itself
795 USE_RAND_HELPER=yes
796 ]
797)
798
799
800# Do we want to force the use of the rand helper?
801AC_ARG_WITH(rand-helper,
802 [ --with-rand-helper Use subprocess to gather strong randomness ],
803 [
804 if test "x$withval" = "xno" ; then
805 # Force use of OpenSSL's internal RNG, even if
806 # the previous test showed it to be unseeded.
807 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
808 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
809 OPENSSL_SEEDS_ITSELF=yes
810 USE_RAND_HELPER=""
811 fi
812 else
813 USE_RAND_HELPER=yes
814 fi
815 ],
816)
817
818# Which randomness source do we use?
819if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
820 # OpenSSL only
821 AC_DEFINE(OPENSSL_PRNG_ONLY)
822 RAND_MSG="OpenSSL internal ONLY"
823 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -0800824elif test ! -z "$USE_RAND_HELPER" ; then
825 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +1100826 RAND_MSG="ssh-rand-helper"
827 INSTALL_SSH_RAND_HELPER="yes"
828fi
829AC_SUBST(INSTALL_SSH_RAND_HELPER)
830
831### Configuration of ssh-rand-helper
832
833# PRNGD TCP socket
834AC_ARG_WITH(prngd-port,
835 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
836 [
Damien Millere996d722002-01-23 11:20:59 +1100837 case "$withval" in
838 no)
839 withval=""
840 ;;
841 [[0-9]]*)
842 ;;
843 *)
844 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
845 ;;
846 esac
847 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100848 PRNGD_PORT="$withval"
849 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
850 fi
851 ]
852)
853
854# PRNGD Unix domain socket
855AC_ARG_WITH(prngd-socket,
856 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
857 [
Damien Millere996d722002-01-23 11:20:59 +1100858 case "$withval" in
859 yes)
Damien Miller6c21c512002-01-22 21:57:53 +1100860 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +1100861 ;;
862 no)
863 withval=""
864 ;;
865 /*)
866 ;;
867 *)
868 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
869 ;;
870 esac
871
872 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100873 if test ! -z "$PRNGD_PORT" ; then
874 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
875 fi
Damien Miller6385ba02002-01-23 08:12:36 +1100876 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100877 AC_MSG_WARN(Entropy socket is not readable)
878 fi
879 PRNGD_SOCKET="$withval"
880 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
881 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800882 ],
883 [
884 # Check for existing socket only if we don't have a random device already
885 if test "$USE_RAND_HELPER" = yes ; then
886 AC_MSG_CHECKING(for PRNGD/EGD socket)
887 # Insert other locations here
888 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
889 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
890 PRNGD_SOCKET="$sock"
891 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
892 break;
893 fi
894 done
895 if test ! -z "$PRNGD_SOCKET" ; then
896 AC_MSG_RESULT($PRNGD_SOCKET)
897 else
898 AC_MSG_RESULT(not found)
899 fi
900 fi
Damien Miller6c21c512002-01-22 21:57:53 +1100901 ]
902)
903
904# Change default command timeout for hashing entropy source
905entropy_timeout=200
906AC_ARG_WITH(entropy-timeout,
907 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
908 [
909 if test "x$withval" != "xno" ; then
910 entropy_timeout=$withval
911 fi
912 ]
913)
Damien Miller6c21c512002-01-22 21:57:53 +1100914AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
915
Kevin Steves7ff91122002-04-07 19:22:54 +0000916ssh_privsep_user=sshd
917AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +0000918 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +0000919 [
920 if test -n "$withval"; then
921 ssh_privsep_user=$withval
922 fi
923 ]
924)
Kevin Steves4e0bb522002-04-07 19:44:14 +0000925AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$ssh_privsep_user")
Kevin Steves7ff91122002-04-07 19:22:54 +0000926
Tim Rice88f2ab52002-03-17 12:17:34 -0800927# We do this little dance with the search path to insure
928# that programs that we select for use by installed programs
929# (which may be run by the super-user) come from trusted
930# locations before they come from the user's private area.
931# This should help avoid accidentally configuring some
932# random version of a program in someone's personal bin.
933
934OPATH=$PATH
935PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -0700936test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -0800937test -d /sbin && PATH=$PATH:/sbin
938test -d /usr/sbin && PATH=$PATH:/usr/sbin
939PATH=$PATH:/etc:$OPATH
940
Damien Miller6c21c512002-01-22 21:57:53 +1100941# These programs are used by the command hashing source to gather entropy
942OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
943OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
944OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
945OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
946OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
947OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
948OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
949OSSH_PATH_ENTROPY_PROG(PROG_W, w)
950OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
951OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
952OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
953OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
954OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
955OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
956OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
957OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -0800958# restore PATH
959PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +1100960
961# Where does ssh-rand-helper get its randomness from?
962INSTALL_SSH_PRNG_CMDS=""
963if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
964 if test ! -z "$PRNGD_PORT" ; then
965 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
966 elif test ! -z "$PRNGD_SOCKET" ; then
967 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
968 else
969 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
970 RAND_HELPER_CMDHASH=yes
971 INSTALL_SSH_PRNG_CMDS="yes"
972 fi
973fi
974AC_SUBST(INSTALL_SSH_PRNG_CMDS)
975
976
Ben Lindstromb5628642000-10-18 00:02:25 +0000977# Cheap hack to ensure NEWS-OS libraries are arranged right.
978if test ! -z "$SONY" ; then
979 LIBS="$LIBS -liberty";
980fi
981
Damien Millera22ba012000-03-02 23:09:20 +1100982# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100983AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100984AC_CHECK_SIZEOF(short int, 2)
985AC_CHECK_SIZEOF(int, 4)
986AC_CHECK_SIZEOF(long int, 4)
987AC_CHECK_SIZEOF(long long int, 8)
988
Damien Millerfa2bb692002-04-23 23:22:25 +1000989# Sanity check long long for some platforms (AIX)
990if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
991 ac_cv_sizeof_long_long_int=0
992fi
993
Damien Millera22ba012000-03-02 23:09:20 +1100994# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100995AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
996 AC_TRY_COMPILE(
997 [ #include <sys/types.h> ],
998 [ u_int a; a = 1;],
999 [ ac_cv_have_u_int="yes" ],
1000 [ ac_cv_have_u_int="no" ]
1001 )
1002])
1003if test "x$ac_cv_have_u_int" = "xyes" ; then
1004 AC_DEFINE(HAVE_U_INT)
1005 have_u_int=1
1006fi
1007
Damien Miller61e50f12000-05-08 20:49:37 +10001008AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1009 AC_TRY_COMPILE(
1010 [ #include <sys/types.h> ],
1011 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1012 [ ac_cv_have_intxx_t="yes" ],
1013 [ ac_cv_have_intxx_t="no" ]
1014 )
1015])
1016if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1017 AC_DEFINE(HAVE_INTXX_T)
1018 have_intxx_t=1
1019fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001020
1021if (test -z "$have_intxx_t" && \
1022 test "x$ac_cv_header_stdint_h" = "xyes")
1023then
1024 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1025 AC_TRY_COMPILE(
1026 [ #include <stdint.h> ],
1027 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1028 [
1029 AC_DEFINE(HAVE_INTXX_T)
1030 AC_MSG_RESULT(yes)
1031 ],
1032 [ AC_MSG_RESULT(no) ]
1033 )
1034fi
1035
Damien Miller578783e2000-09-23 14:12:24 +11001036AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1037 AC_TRY_COMPILE(
1038 [ #include <sys/types.h> ],
1039 [ int64_t a; a = 1;],
1040 [ ac_cv_have_int64_t="yes" ],
1041 [ ac_cv_have_int64_t="no" ]
1042 )
1043])
1044if test "x$ac_cv_have_int64_t" = "xyes" ; then
1045 AC_DEFINE(HAVE_INT64_T)
1046 have_int64_t=1
1047fi
1048
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001049if test -z "$have_int64_t" ; then
1050 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1051 AC_TRY_COMPILE(
1052 [ #include <sys/socket.h> ],
1053 [ int64_t a; a = 1],
1054 [
1055 AC_DEFINE(HAVE_INT64_T)
1056 AC_MSG_RESULT(yes)
1057 ],
1058 [ AC_MSG_RESULT(no) ]
1059 )
1060fi
1061
Tim Rice4cec93f2002-02-26 08:40:48 -08001062if test -z "$have_int64_t" ; then
1063 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1064 AC_TRY_COMPILE(
1065 [ #include <sys/bitypes.h> ],
1066 [ int64_t a; a = 1],
1067 [
1068 AC_DEFINE(HAVE_INT64_T)
1069 AC_MSG_RESULT(yes)
1070 ],
1071 [ AC_MSG_RESULT(no) ]
1072 )
1073fi
1074
Damien Miller61e50f12000-05-08 20:49:37 +10001075AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1076 AC_TRY_COMPILE(
1077 [ #include <sys/types.h> ],
1078 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1079 [ ac_cv_have_u_intxx_t="yes" ],
1080 [ ac_cv_have_u_intxx_t="no" ]
1081 )
1082])
1083if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1084 AC_DEFINE(HAVE_U_INTXX_T)
1085 have_u_intxx_t=1
1086fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001087
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001088if test -z "$have_u_intxx_t" ; then
1089 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1090 AC_TRY_COMPILE(
1091 [ #include <sys/socket.h> ],
1092 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1093 [
1094 AC_DEFINE(HAVE_U_INTXX_T)
1095 AC_MSG_RESULT(yes)
1096 ],
1097 [ AC_MSG_RESULT(no) ]
1098 )
1099fi
1100
Damien Miller578783e2000-09-23 14:12:24 +11001101AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1102 AC_TRY_COMPILE(
1103 [ #include <sys/types.h> ],
1104 [ u_int64_t a; a = 1;],
1105 [ ac_cv_have_u_int64_t="yes" ],
1106 [ ac_cv_have_u_int64_t="no" ]
1107 )
1108])
1109if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1110 AC_DEFINE(HAVE_U_INT64_T)
1111 have_u_int64_t=1
1112fi
1113
Tim Rice4cec93f2002-02-26 08:40:48 -08001114if test -z "$have_u_int64_t" ; then
1115 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1116 AC_TRY_COMPILE(
1117 [ #include <sys/bitypes.h> ],
1118 [ u_int64_t a; a = 1],
1119 [
1120 AC_DEFINE(HAVE_U_INT64_T)
1121 AC_MSG_RESULT(yes)
1122 ],
1123 [ AC_MSG_RESULT(no) ]
1124 )
1125fi
1126
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001127if test -z "$have_u_intxx_t" ; then
1128 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1129 AC_TRY_COMPILE(
1130 [
1131#include <sys/types.h>
1132 ],
1133 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1134 [ ac_cv_have_uintxx_t="yes" ],
1135 [ ac_cv_have_uintxx_t="no" ]
1136 )
1137 ])
1138 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1139 AC_DEFINE(HAVE_UINTXX_T)
1140 fi
1141fi
1142
1143if test -z "$have_uintxx_t" ; then
1144 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1145 AC_TRY_COMPILE(
1146 [ #include <stdint.h> ],
1147 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1148 [
1149 AC_DEFINE(HAVE_UINTXX_T)
1150 AC_MSG_RESULT(yes)
1151 ],
1152 [ AC_MSG_RESULT(no) ]
1153 )
1154fi
1155
Damien Milleredb82922000-06-20 13:25:52 +10001156if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1157 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001158then
1159 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1160 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001161 [
1162#include <sys/bitypes.h>
1163 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001164 [
Damien Miller70494d12000-04-03 15:57:06 +10001165 int8_t a; int16_t b; int32_t c;
1166 u_int8_t e; u_int16_t f; u_int32_t g;
1167 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +11001168 ],
1169 [
1170 AC_DEFINE(HAVE_U_INTXX_T)
1171 AC_DEFINE(HAVE_INTXX_T)
1172 AC_MSG_RESULT(yes)
1173 ],
1174 [AC_MSG_RESULT(no)]
1175 )
1176fi
1177
Damien Miller58be7382001-09-15 21:31:54 +10001178
1179AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1180 AC_TRY_COMPILE(
1181 [
1182#include <sys/types.h>
1183 ],
1184 [ u_char foo; foo = 125; ],
1185 [ ac_cv_have_u_char="yes" ],
1186 [ ac_cv_have_u_char="no" ]
1187 )
1188])
1189if test "x$ac_cv_have_u_char" = "xyes" ; then
1190 AC_DEFINE(HAVE_U_CHAR)
1191fi
1192
Tim Rice13aae5e2001-10-21 17:53:58 -07001193TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001194
Tim Rice200a5c02002-02-26 22:12:34 -08001195AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001196
Damien Miller61e50f12000-05-08 20:49:37 +10001197AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1198 AC_TRY_COMPILE(
1199 [
1200#include <sys/types.h>
1201 ],
1202 [ size_t foo; foo = 1235; ],
1203 [ ac_cv_have_size_t="yes" ],
1204 [ ac_cv_have_size_t="no" ]
1205 )
1206])
1207if test "x$ac_cv_have_size_t" = "xyes" ; then
1208 AC_DEFINE(HAVE_SIZE_T)
1209fi
Damien Miller95058511999-12-29 10:36:45 +11001210
Damien Miller615f9392000-05-17 22:53:33 +10001211AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1212 AC_TRY_COMPILE(
1213 [
1214#include <sys/types.h>
1215 ],
1216 [ ssize_t foo; foo = 1235; ],
1217 [ ac_cv_have_ssize_t="yes" ],
1218 [ ac_cv_have_ssize_t="no" ]
1219 )
1220])
1221if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1222 AC_DEFINE(HAVE_SSIZE_T)
1223fi
1224
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001225AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1226 AC_TRY_COMPILE(
1227 [
1228#include <time.h>
1229 ],
1230 [ clock_t foo; foo = 1235; ],
1231 [ ac_cv_have_clock_t="yes" ],
1232 [ ac_cv_have_clock_t="no" ]
1233 )
1234])
1235if test "x$ac_cv_have_clock_t" = "xyes" ; then
1236 AC_DEFINE(HAVE_CLOCK_T)
1237fi
1238
Damien Millerb54b40e2000-06-23 08:23:34 +10001239AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1240 AC_TRY_COMPILE(
1241 [
1242#include <sys/types.h>
1243#include <sys/socket.h>
1244 ],
1245 [ sa_family_t foo; foo = 1235; ],
1246 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001247 [ AC_TRY_COMPILE(
1248 [
1249#include <sys/types.h>
1250#include <sys/socket.h>
1251#include <netinet/in.h>
1252 ],
1253 [ sa_family_t foo; foo = 1235; ],
1254 [ ac_cv_have_sa_family_t="yes" ],
1255
Damien Millerb54b40e2000-06-23 08:23:34 +10001256 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001257 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001258 )
1259])
1260if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1261 AC_DEFINE(HAVE_SA_FAMILY_T)
1262fi
1263
Damien Miller0f91b4e2000-06-18 15:43:25 +10001264AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1265 AC_TRY_COMPILE(
1266 [
1267#include <sys/types.h>
1268 ],
1269 [ pid_t foo; foo = 1235; ],
1270 [ ac_cv_have_pid_t="yes" ],
1271 [ ac_cv_have_pid_t="no" ]
1272 )
1273])
1274if test "x$ac_cv_have_pid_t" = "xyes" ; then
1275 AC_DEFINE(HAVE_PID_T)
1276fi
1277
1278AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1279 AC_TRY_COMPILE(
1280 [
1281#include <sys/types.h>
1282 ],
1283 [ mode_t foo; foo = 1235; ],
1284 [ ac_cv_have_mode_t="yes" ],
1285 [ ac_cv_have_mode_t="no" ]
1286 )
1287])
1288if test "x$ac_cv_have_mode_t" = "xyes" ; then
1289 AC_DEFINE(HAVE_MODE_T)
1290fi
1291
Damien Miller61e50f12000-05-08 20:49:37 +10001292
1293AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1294 AC_TRY_COMPILE(
1295 [
Damien Miller81171112000-04-23 11:14:01 +10001296#include <sys/types.h>
1297#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001298 ],
1299 [ struct sockaddr_storage s; ],
1300 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1301 [ ac_cv_have_struct_sockaddr_storage="no" ]
1302 )
1303])
1304if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1305 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1306fi
Damien Miller34132e52000-01-14 15:45:46 +11001307
Damien Miller61e50f12000-05-08 20:49:37 +10001308AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1309 AC_TRY_COMPILE(
1310 [
Damien Miller7b22d652000-06-18 14:07:04 +10001311#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001312#include <netinet/in.h>
1313 ],
1314 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1315 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1316 [ ac_cv_have_struct_sockaddr_in6="no" ]
1317 )
1318])
1319if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1320 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1321fi
Damien Miller34132e52000-01-14 15:45:46 +11001322
Damien Miller61e50f12000-05-08 20:49:37 +10001323AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1324 AC_TRY_COMPILE(
1325 [
Damien Miller7b22d652000-06-18 14:07:04 +10001326#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001327#include <netinet/in.h>
1328 ],
1329 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1330 [ ac_cv_have_struct_in6_addr="yes" ],
1331 [ ac_cv_have_struct_in6_addr="no" ]
1332 )
1333])
1334if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1335 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1336fi
Damien Miller34132e52000-01-14 15:45:46 +11001337
Damien Miller61e50f12000-05-08 20:49:37 +10001338AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1339 AC_TRY_COMPILE(
1340 [
Damien Miller81171112000-04-23 11:14:01 +10001341#include <sys/types.h>
1342#include <sys/socket.h>
1343#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001344 ],
1345 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1346 [ ac_cv_have_struct_addrinfo="yes" ],
1347 [ ac_cv_have_struct_addrinfo="no" ]
1348 )
1349])
1350if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1351 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1352fi
1353
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001354AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1355 AC_TRY_COMPILE(
1356 [ #include <sys/time.h> ],
1357 [ struct timeval tv; tv.tv_sec = 1;],
1358 [ ac_cv_have_struct_timeval="yes" ],
1359 [ ac_cv_have_struct_timeval="no" ]
1360 )
1361])
1362if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1363 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1364 have_struct_timeval=1
1365fi
1366
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001367# If we don't have int64_t then we can't compile sftp-server. So don't
1368# even attempt to do it.
1369if test "x$ac_cv_have_int64_t" = "xno" -a \
1370 "x$ac_cv_sizeof_long_int" != "x8" -a \
1371 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1372 NO_SFTP='#'
Tim Ricebee3f222001-03-11 17:32:12 -08001373else
1374dnl test snprintf (broken on SCO w/gcc)
1375 AC_TRY_RUN(
1376 [
1377#include <stdio.h>
1378#include <string.h>
1379#ifdef HAVE_SNPRINTF
1380main()
1381{
1382 char buf[50];
1383 char expected_out[50];
1384 int mazsize = 50 ;
1385#if (SIZEOF_LONG_INT == 8)
1386 long int num = 0x7fffffffffffffff;
1387#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001388 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001389#endif
1390 strcpy(expected_out, "9223372036854775807");
1391 snprintf(buf, mazsize, "%lld", num);
1392 if(strcmp(buf, expected_out) != 0)
1393 exit(1);
1394 exit(0);
1395}
1396#else
1397main() { exit(0); }
1398#endif
1399 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1400 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001401fi
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001402AC_SUBST(NO_SFTP)
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001403
Damien Miller78315eb2000-09-29 23:01:36 +11001404dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001405OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1406OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1407OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1408OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1409OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001410OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001411OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1412OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001413OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001414OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1415OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1416OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1417OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001418OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1419OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1420OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1421OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001422
1423AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001424
Damien Miller61e50f12000-05-08 20:49:37 +10001425AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1426 ac_cv_have_ss_family_in_struct_ss, [
1427 AC_TRY_COMPILE(
1428 [
Damien Miller81171112000-04-23 11:14:01 +10001429#include <sys/types.h>
1430#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001431 ],
1432 [ struct sockaddr_storage s; s.ss_family = 1; ],
1433 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1434 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1435 )
1436])
1437if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1438 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1439fi
1440
Damien Miller61e50f12000-05-08 20:49:37 +10001441AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1442 ac_cv_have___ss_family_in_struct_ss, [
1443 AC_TRY_COMPILE(
1444 [
Damien Miller81171112000-04-23 11:14:01 +10001445#include <sys/types.h>
1446#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001447 ],
1448 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1449 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1450 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1451 )
1452])
1453if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1454 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1455fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001456
Damien Millerad833b32000-08-23 10:46:23 +10001457AC_CACHE_CHECK([for pw_class field in struct passwd],
1458 ac_cv_have_pw_class_in_struct_passwd, [
1459 AC_TRY_COMPILE(
1460 [
Damien Millerad833b32000-08-23 10:46:23 +10001461#include <pwd.h>
1462 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001463 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001464 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1465 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1466 )
1467])
1468if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1469 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1470fi
1471
Kevin Steves82456952001-06-22 21:14:18 +00001472AC_CACHE_CHECK([for pw_expire field in struct passwd],
1473 ac_cv_have_pw_expire_in_struct_passwd, [
1474 AC_TRY_COMPILE(
1475 [
1476#include <pwd.h>
1477 ],
1478 [ struct passwd p; p.pw_expire = 0; ],
1479 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1480 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1481 )
1482])
1483if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1484 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1485fi
1486
1487AC_CACHE_CHECK([for pw_change field in struct passwd],
1488 ac_cv_have_pw_change_in_struct_passwd, [
1489 AC_TRY_COMPILE(
1490 [
1491#include <pwd.h>
1492 ],
1493 [ struct passwd p; p.pw_change = 0; ],
1494 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1495 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1496 )
1497])
1498if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1499 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1500fi
Damien Miller61e50f12000-05-08 20:49:37 +10001501
Tim Rice28bbb0c2002-05-27 17:37:32 -07001502dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001503AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1504 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001505 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001506 [
Tim Riceae49fe62002-04-12 10:26:21 -07001507#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001508#include <sys/socket.h>
1509#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001510int main() {
1511#ifdef msg_accrights
1512exit(1);
1513#endif
1514struct msghdr m;
1515m.msg_accrights = 0;
1516exit(0);
1517}
Kevin Steves939c9db2002-03-22 17:23:25 +00001518 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001519 [ ac_cv_have_accrights_in_msghdr="yes" ],
1520 [ ac_cv_have_accrights_in_msghdr="no" ]
1521 )
1522])
1523if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1524 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1525fi
1526
Kevin Stevesa44e0352002-04-07 16:18:03 +00001527AC_CACHE_CHECK([for msg_control field in struct msghdr],
1528 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001529 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001530 [
Tim Riceae49fe62002-04-12 10:26:21 -07001531#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00001532#include <sys/socket.h>
1533#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001534int main() {
1535#ifdef msg_control
1536exit(1);
1537#endif
1538struct msghdr m;
1539m.msg_control = 0;
1540exit(0);
1541}
Kevin Stevesa44e0352002-04-07 16:18:03 +00001542 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00001543 [ ac_cv_have_control_in_msghdr="yes" ],
1544 [ ac_cv_have_control_in_msghdr="no" ]
1545 )
1546])
1547if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1548 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1549fi
1550
Damien Miller61e50f12000-05-08 20:49:37 +10001551AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1552 AC_TRY_LINK([],
1553 [ extern char *__progname; printf("%s", __progname); ],
1554 [ ac_cv_libc_defines___progname="yes" ],
1555 [ ac_cv_libc_defines___progname="no" ]
1556 )
1557])
1558if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1559 AC_DEFINE(HAVE___PROGNAME)
1560fi
1561
Kevin Steves4846f4a2002-03-22 18:19:53 +00001562AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1563 AC_TRY_LINK([
1564#include <stdio.h>
1565],
1566 [ printf("%s", __FUNCTION__); ],
1567 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1568 [ ac_cv_cc_implements___FUNCTION__="no" ]
1569 )
1570])
1571if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1572 AC_DEFINE(HAVE___FUNCTION__)
1573fi
1574
1575AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1576 AC_TRY_LINK([
1577#include <stdio.h>
1578],
1579 [ printf("%s", __func__); ],
1580 [ ac_cv_cc_implements___func__="yes" ],
1581 [ ac_cv_cc_implements___func__="no" ]
1582 )
1583])
1584if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1585 AC_DEFINE(HAVE___func__)
1586fi
1587
Damien Miller4f8e6692001-07-14 13:22:53 +10001588AC_CACHE_CHECK([whether getopt has optreset support],
1589 ac_cv_have_getopt_optreset, [
1590 AC_TRY_LINK(
1591 [
1592#include <getopt.h>
1593 ],
1594 [ extern int optreset; optreset = 0; ],
1595 [ ac_cv_have_getopt_optreset="yes" ],
1596 [ ac_cv_have_getopt_optreset="no" ]
1597 )
1598])
1599if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1600 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1601fi
Damien Millera22ba012000-03-02 23:09:20 +11001602
Damien Millerecbb26d2000-07-15 14:59:14 +10001603AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1604 AC_TRY_LINK([],
1605 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1606 [ ac_cv_libc_defines_sys_errlist="yes" ],
1607 [ ac_cv_libc_defines_sys_errlist="no" ]
1608 )
1609])
1610if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1611 AC_DEFINE(HAVE_SYS_ERRLIST)
1612fi
1613
1614
Damien Miller11fa2cc2000-08-16 10:35:58 +10001615AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1616 AC_TRY_LINK([],
1617 [ extern int sys_nerr; printf("%i", sys_nerr);],
1618 [ ac_cv_libc_defines_sys_nerr="yes" ],
1619 [ ac_cv_libc_defines_sys_nerr="no" ]
1620 )
1621])
1622if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1623 AC_DEFINE(HAVE_SYS_NERR)
1624fi
1625
Damien Miller85de5802001-09-18 14:01:11 +10001626SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00001627
1628# Check whether user wants sectok support
1629AC_ARG_WITH(sectok,
1630 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10001631 [
1632 if test "x$withval" != "xno" ; then
1633 if test "x$withval" != "xyes" ; then
1634 CPPFLAGS="$CPPFLAGS -I${withval}"
1635 LDFLAGS="$LDFLAGS -L${withval}"
1636 if test ! -z "$need_dash_r" ; then
1637 LDFLAGS="$LDFLAGS -R${withval}"
1638 fi
1639 if test ! -z "$blibpath" ; then
1640 blibpath="$blibpath:${withval}"
1641 fi
1642 fi
1643 AC_CHECK_HEADERS(sectok.h)
1644 if test "$ac_cv_header_sectok_h" != yes; then
1645 AC_MSG_ERROR(Can't find sectok.h)
1646 fi
1647 AC_CHECK_LIB(sectok, sectok_open)
1648 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1649 AC_MSG_ERROR(Can't find libsectok)
1650 fi
1651 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00001652 AC_DEFINE(USE_SECTOK)
1653 SCARD_MSG="yes, using sectok"
1654 fi
1655 ]
1656)
1657
1658# Check whether user wants OpenSC support
1659AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10001660 AC_HELP_STRING([--with-opensc=PFX],
1661 [Enable smartcard support using OpenSC]),
1662 opensc_config_prefix="$withval", opensc_config_prefix="")
1663if test x$opensc_config_prefix != x ; then
1664 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1665 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1666 if test "$OPENSC_CONFIG" != "no"; then
1667 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1668 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1669 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1670 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1671 AC_DEFINE(SMARTCARD)
1672 AC_DEFINE(USE_OPENSC)
1673 SCARD_MSG="yes, using OpenSC"
1674 fi
1675fi
Damien Miller85de5802001-09-18 14:01:11 +10001676
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001677# Check whether user wants Kerberos 5 support
1678KRB5_MSG="no"
1679AC_ARG_WITH(kerberos5,
1680 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1681 [
1682 if test "x$withval" != "xno" ; then
1683 if test "x$withval" = "xyes" ; then
1684 KRB5ROOT="/usr/local"
1685 else
1686 KRB5ROOT=${withval}
1687 fi
1688 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1689 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1690 AC_DEFINE(KRB5)
1691 KRB5_MSG="yes"
1692 AC_MSG_CHECKING(whether we are using Heimdal)
1693 AC_TRY_COMPILE([ #include <krb5.h> ],
1694 [ char *tmp = heimdal_version; ],
1695 [ AC_MSG_RESULT(yes)
1696 AC_DEFINE(HEIMDAL)
1697 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1698 ],
1699 [ AC_MSG_RESULT(no)
1700 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1701 ]
1702 )
1703 if test ! -z "$need_dash_r" ; then
1704 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1705 fi
1706 if test ! -z "$blibpath" ; then
1707 blibpath="$blibpath:${KRB5ROOT}/lib"
1708 fi
1709 AC_CHECK_LIB(resolv, dn_expand, , )
1710
1711 KRB5=yes
1712 fi
1713 ]
1714)
1715# Check whether user wants Kerberos 4 support
Damien Millerc79bc0d2001-03-28 13:03:42 +10001716KRB4_MSG="no"
1717AC_ARG_WITH(kerberos4,
1718 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1719 [
1720 if test "x$withval" != "xno" ; then
Damien Millerc79bc0d2001-03-28 13:03:42 +10001721 if test "x$withval" != "xyes" ; then
1722 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1723 LDFLAGS="$LDFLAGS -L${withval}/lib"
1724 if test ! -z "$need_dash_r" ; then
1725 LDFLAGS="$LDFLAGS -R${withval}/lib"
1726 fi
1727 if test ! -z "$blibpath" ; then
1728 blibpath="$blibpath:${withval}/lib"
1729 fi
1730 else
1731 if test -d /usr/include/kerberosIV ; then
1732 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1733 fi
1734 fi
1735
1736 AC_CHECK_HEADERS(krb.h)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001737 if test "$ac_cv_header_krb_h" != yes; then
1738 AC_MSG_WARN([Cannot find krb.h, build may fail])
1739 fi
Damien Miller98344742001-03-28 14:37:06 +10001740 AC_CHECK_LIB(krb, main)
Damien Millerc79bc0d2001-03-28 13:03:42 +10001741 if test "$ac_cv_lib_krb_main" != yes; then
Damien Miller98344742001-03-28 14:37:06 +10001742 AC_CHECK_LIB(krb4, main)
1743 if test "$ac_cv_lib_krb4_main" != yes; then
1744 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1745 else
1746 KLIBS="-lkrb4"
1747 fi
1748 else
1749 KLIBS="-lkrb"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001750 fi
Damien Miller98344742001-03-28 14:37:06 +10001751 AC_CHECK_LIB(des, des_cbc_encrypt)
1752 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1753 AC_CHECK_LIB(des425, des_cbc_encrypt)
1754 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1755 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1756 else
1757 KLIBS="-ldes425"
1758 fi
1759 else
1760 KLIBS="-ldes"
1761 fi
Damien Millerc79bc0d2001-03-28 13:03:42 +10001762 AC_CHECK_LIB(resolv, dn_expand, , )
1763 KRB4=yes
1764 KRB4_MSG="yes"
1765 AC_DEFINE(KRB4)
1766 fi
1767 ]
1768)
1769
1770# Check whether user wants AFS support
1771AFS_MSG="no"
1772AC_ARG_WITH(afs,
1773 [ --with-afs=PATH Enable AFS support],
1774 [
1775 if test "x$withval" != "xno" ; then
1776
1777 if test "x$withval" != "xyes" ; then
1778 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1779 LDFLAGS="$LDFLAGS -L${withval}/lib"
1780 fi
1781
1782 if test -z "$KRB4" ; then
1783 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1784 fi
1785
1786 LIBS="-lkafs $LIBS"
1787 if test ! -z "$AFS_LIBS" ; then
1788 LIBS="$LIBS $AFS_LIBS"
1789 fi
1790 AC_DEFINE(AFS)
1791 AFS_MSG="yes"
1792 fi
1793 ]
1794)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10001795LIBS="$LIBS $KLIBS $K5LIBS"
Damien Millerc79bc0d2001-03-28 13:03:42 +10001796
Damien Millera22ba012000-03-02 23:09:20 +11001797# Looking for programs, paths and files
1798AC_ARG_WITH(rsh,
1799 [ --with-rsh=PATH Specify path to remote shell program ],
1800 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001801 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +10001802 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001803 fi
1804 ],
1805 [
1806 AC_PATH_PROG(rsh_path, rsh)
1807 ]
1808)
1809
Damien Millerf58c6722002-05-13 13:15:42 +10001810PRIVSEP_PATH=/var/empty
1811AC_ARG_WITH(privsep-path,
Damien Miller74cc5bb2002-05-22 11:02:15 +10001812 [ --with-privsep-path=xxx Path for privilege separation chroot ],
Damien Millerf58c6722002-05-13 13:15:42 +10001813 [
1814 if test "x$withval" != "$no" ; then
1815 PRIVSEP_PATH=$withval
1816 fi
1817 ]
1818)
1819AC_SUBST(PRIVSEP_PATH)
1820
Damien Millera22ba012000-03-02 23:09:20 +11001821AC_ARG_WITH(xauth,
1822 [ --with-xauth=PATH Specify path to xauth program ],
1823 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001824 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10001825 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11001826 fi
1827 ],
1828 [
Damien Miller78315eb2000-09-29 23:01:36 +11001829 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 +10001830 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11001831 xauth_path="/usr/openwin/bin/xauth"
1832 fi
1833 ]
1834)
1835
Damien Millera19cf472000-11-29 13:28:50 +11001836if test -z "$xauth_path" ; then
1837 XAUTH_PATH="undefined"
1838 AC_SUBST(XAUTH_PATH)
1839else
Damien Millera22ba012000-03-02 23:09:20 +11001840 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11001841 XAUTH_PATH=$xauth_path
1842 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11001843fi
1844if test ! -z "$rsh_path" ; then
1845 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1846fi
1847
1848# Check for mail directory (last resort if we cannot get it from headers)
1849if test ! -z "$MAIL" ; then
1850 maildir=`dirname $MAIL`
1851 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1852fi
1853
Damien Millera22ba012000-03-02 23:09:20 +11001854if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00001855 if test "x$disable_ptmx_check" != "xyes" ; then
1856 AC_CHECK_FILE("/dev/ptmx",
1857 [
1858 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1859 have_dev_ptmx=1
1860 ]
1861 )
1862 fi
Damien Millera22ba012000-03-02 23:09:20 +11001863fi
Damien Miller204ad072000-03-02 23:56:12 +11001864AC_CHECK_FILE("/dev/ptc",
1865 [
1866 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1867 have_dev_ptc=1
1868 ]
1869)
1870
Damien Millera22ba012000-03-02 23:09:20 +11001871# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00001872AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10001873 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11001874 [
Damien Miller897741e2001-04-16 10:41:46 +10001875 case "$withval" in
1876 man|cat|doc)
1877 MANTYPE=$withval
1878 ;;
1879 *)
1880 AC_MSG_ERROR(invalid man type: $withval)
1881 ;;
1882 esac
Damien Miller670a4b82000-01-22 13:53:11 +11001883 ]
1884)
Ben Lindstrombc709922001-04-18 18:04:21 +00001885if test -z "$MANTYPE"; then
Tim Rice07183b82001-04-25 21:40:28 -07001886 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
Ben Lindstrombc709922001-04-18 18:04:21 +00001887 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1888 MANTYPE=doc
1889 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1890 MANTYPE=man
1891 else
1892 MANTYPE=cat
1893 fi
1894fi
Damien Miller670a4b82000-01-22 13:53:11 +11001895AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00001896if test "$MANTYPE" = "doc"; then
1897 mansubdir=man;
1898else
1899 mansubdir=$MANTYPE;
1900fi
1901AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001902
Damien Millera22ba012000-03-02 23:09:20 +11001903# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001904MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001905AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001906 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001907 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001908 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001909 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001910 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001911 fi
1912 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001913)
1914
Damien Millera22ba012000-03-02 23:09:20 +11001915# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001916AC_ARG_WITH(shadow,
1917 [ --without-shadow Disable shadow password support],
1918 [
1919 if test "x$withval" = "xno" ; then
1920 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001921 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001922 fi
1923 ]
1924)
1925
Damien Miller1f335fb2000-06-26 11:31:33 +10001926if test -z "$disable_shadow" ; then
1927 AC_MSG_CHECKING([if the systems has expire shadow information])
1928 AC_TRY_COMPILE(
1929 [
1930#include <sys/types.h>
1931#include <shadow.h>
1932 struct spwd sp;
1933 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1934 [ sp_expire_available=yes ], []
1935 )
1936
1937 if test "x$sp_expire_available" = "xyes" ; then
1938 AC_MSG_RESULT(yes)
1939 AC_DEFINE(HAS_SHADOW_EXPIRE)
1940 else
1941 AC_MSG_RESULT(no)
1942 fi
1943fi
1944
Damien Millera22ba012000-03-02 23:09:20 +11001945# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001946if test ! -z "$IPADDR_IN_DISPLAY" ; then
1947 DISPLAY_HACK_MSG="yes"
1948 AC_DEFINE(IPADDR_IN_DISPLAY)
1949else
1950 DISPLAY_HACK_MSG="no"
1951 AC_ARG_WITH(ipaddr-display,
1952 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1953 [
1954 if test "x$withval" != "xno" ; then
1955 AC_DEFINE(IPADDR_IN_DISPLAY)
1956 DISPLAY_HACK_MSG="yes"
1957 fi
1958 ]
1959 )
1960fi
Damien Miller76112de1999-12-21 11:18:08 +11001961
Tim Rice43a1c132002-04-17 21:19:14 -07001962dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1963if test $ac_cv_func_login_getcapbool = "yes" -a \
1964 $ac_cv_header_login_cap_h = "yes" ; then
1965 USES_LOGIN_CONF=yes
1966fi
Damien Millera22ba012000-03-02 23:09:20 +11001967# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001968SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001969AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10001970 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11001971 [
Tim Rice43a1c132002-04-17 21:19:14 -07001972 if test "$USES_LOGIN_CONF" = "yes" ; then
1973 AC_MSG_WARN([
1974--with-default-path=PATH has no effect on this system.
1975Edit /etc/login.conf instead.])
1976 elif test "x$withval" != "xno" ; then
Tim Rice59ea0a02001-03-10 13:50:45 -08001977 user_path="$withval"
Damien Miller7b22d652000-06-18 14:07:04 +10001978 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001979 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08001980 ],
Tim Rice43a1c132002-04-17 21:19:14 -07001981 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1982 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1983 else
Tim Rice59ea0a02001-03-10 13:50:45 -08001984 AC_TRY_RUN(
1985 [
1986/* find out what STDPATH is */
1987#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08001988#ifdef HAVE_PATHS_H
1989# include <paths.h>
1990#endif
1991#ifndef _PATH_STDPATH
1992# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1993#endif
1994#include <sys/types.h>
1995#include <sys/stat.h>
1996#include <fcntl.h>
1997#define DATA "conftest.stdpath"
1998
1999main()
2000{
2001 FILE *fd;
2002 int rc;
2003
2004 fd = fopen(DATA,"w");
2005 if(fd == NULL)
2006 exit(1);
2007
2008 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2009 exit(1);
2010
2011 exit(0);
2012}
2013 ], [ user_path=`cat conftest.stdpath` ],
2014 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2015 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2016 )
2017# make sure $bindir is in USER_PATH so scp will work
2018 t_bindir=`eval echo ${bindir}`
2019 case $t_bindir in
2020 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2021 esac
2022 case $t_bindir in
2023 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2024 esac
2025 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2026 if test $? -ne 0 ; then
2027 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2028 if test $? -ne 0 ; then
2029 user_path=$user_path:$t_bindir
2030 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2031 fi
2032 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002033 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002034)
Tim Rice43a1c132002-04-17 21:19:14 -07002035if test "$USES_LOGIN_CONF" != "yes" ; then
2036 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2037 AC_SUBST(user_path)
2038fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002039
Damien Millera18bbd32002-05-13 10:48:57 +10002040# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002041AC_ARG_WITH(superuser-path,
2042 [ --with-superuser-path= Specify different path for super-user],
2043 [
2044 if test "x$withval" != "xno" ; then
2045 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2046 superuser_path=$withval
2047 fi
2048 ]
2049)
2050
2051
Damien Millera22ba012000-03-02 23:09:20 +11002052# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10002053IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11002054AC_ARG_WITH(ipv4-default,
2055 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2056 [
2057 if test "x$withval" != "xno" ; then
2058 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10002059 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11002060 fi
2061 ]
2062)
2063
Damien Miller61e50f12000-05-08 20:49:37 +10002064AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10002065IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002066AC_ARG_WITH(4in6,
2067 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2068 [
2069 if test "x$withval" != "xno" ; then
2070 AC_MSG_RESULT(yes)
2071 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10002072 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002073 else
2074 AC_MSG_RESULT(no)
2075 fi
2076 ],[
2077 if test "x$inet6_default_4in6" = "xyes"; then
2078 AC_MSG_RESULT([yes (default)])
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 (default)])
2083 fi
2084 ]
2085)
2086
Damien Miller60396b02001-02-18 17:01:00 +11002087# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002088BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002089AC_ARG_WITH(bsd-auth,
2090 [ --with-bsd-auth Enable BSD auth support],
2091 [
2092 if test "x$withval" != "xno" ; then
2093 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002094 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002095 fi
2096 ]
2097)
2098
Damien Miller78315eb2000-09-29 23:01:36 +11002099AC_MSG_CHECKING(whether to install ssh as suid root)
2100AC_ARG_ENABLE(suid-ssh,
2101[ --enable-suid-ssh Install ssh as suid root (default)
2102 --disable-suid-ssh Install ssh without suid bit],
2103[ case "$enableval" in
2104 no)
2105 AC_MSG_RESULT(no)
2106 SSHMODE=0711
2107 ;;
2108 *) AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002109 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002110 ;;
2111 esac ],
2112 AC_MSG_RESULT(yes)
Ben Lindstrom8e2aa5b2001-07-24 17:00:13 +00002113 SSHMODE=4711
Damien Miller78315eb2000-09-29 23:01:36 +11002114)
2115AC_SUBST(SSHMODE)
2116
2117
Damien Millera22ba012000-03-02 23:09:20 +11002118# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002119piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002120# make sure the directory exists
2121if test ! -d $piddir ; then
2122 piddir=`eval echo ${sysconfdir}`
2123 case $piddir in
2124 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2125 esac
2126fi
2127
Tim Rice88f2ab52002-03-17 12:17:34 -08002128AC_ARG_WITH(pid-dir,
2129 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2130 [
2131 if test "x$withval" != "xno" ; then
2132 piddir=$withval
2133 if test ! -d $piddir ; then
2134 AC_MSG_WARN([** no $piddir directory on this system **])
2135 fi
2136 fi
2137 ]
2138)
2139
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002140AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002141AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002142
andre2ff7b5d2000-06-03 14:57:40 +00002143dnl allow user to disable some login recording features
2144AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002145 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002146 [ AC_DEFINE(DISABLE_LASTLOG) ]
2147)
2148AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002149 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002150 [ AC_DEFINE(DISABLE_UTMP) ]
2151)
2152AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002153 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002154 [ AC_DEFINE(DISABLE_UTMPX) ]
2155)
2156AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002157 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002158 [ AC_DEFINE(DISABLE_WTMP) ]
2159)
2160AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002161 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002162 [ AC_DEFINE(DISABLE_WTMPX) ]
2163)
2164AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002165 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002166 [ AC_DEFINE(DISABLE_LOGIN) ]
2167)
2168AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002169 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002170 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2171)
2172AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002173 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00002174 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2175)
2176AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002177 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002178 [
2179 if test "x$withval" = "xno" ; then
2180 AC_DEFINE(DISABLE_LASTLOG)
2181 else
2182 conf_lastlog_location=$withval
2183 fi
2184 ]
2185)
andre2ff7b5d2000-06-03 14:57:40 +00002186
2187dnl lastlog, [uw]tmpx? detection
2188dnl NOTE: set the paths in the platform section to avoid the
2189dnl need for command-line parameters
2190dnl lastlog and [uw]tmp are subject to a file search if all else fails
2191
2192dnl lastlog detection
2193dnl NOTE: the code itself will detect if lastlog is a directory
2194AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2195AC_TRY_COMPILE([
2196#include <sys/types.h>
2197#include <utmp.h>
2198#ifdef HAVE_LASTLOG_H
2199# include <lastlog.h>
2200#endif
Damien Miller2994e082000-06-04 15:51:47 +10002201#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002202# include <paths.h>
2203#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002204#ifdef HAVE_LOGIN_H
2205# include <login.h>
2206#endif
andre2ff7b5d2000-06-03 14:57:40 +00002207 ],
2208 [ char *lastlog = LASTLOG_FILE; ],
2209 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002210 [
2211 AC_MSG_RESULT(no)
2212 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2213 AC_TRY_COMPILE([
2214#include <sys/types.h>
2215#include <utmp.h>
2216#ifdef HAVE_LASTLOG_H
2217# include <lastlog.h>
2218#endif
2219#ifdef HAVE_PATHS_H
2220# include <paths.h>
2221#endif
2222 ],
2223 [ char *lastlog = _PATH_LASTLOG; ],
2224 [ AC_MSG_RESULT(yes) ],
2225 [
andree441aa32000-06-12 22:34:38 +00002226 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002227 system_lastlog_path=no
2228 ])
2229 ]
andre2ff7b5d2000-06-03 14:57:40 +00002230)
Damien Miller2994e082000-06-04 15:51:47 +10002231
andre2ff7b5d2000-06-03 14:57:40 +00002232if test -z "$conf_lastlog_location"; then
2233 if test x"$system_lastlog_path" = x"no" ; then
2234 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002235 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002236 conf_lastlog_location=$f
2237 fi
2238 done
2239 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002240 AC_MSG_WARN([** Cannot find lastlog **])
2241 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002242 fi
2243 fi
2244fi
2245
2246if test -n "$conf_lastlog_location"; then
2247 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2248fi
2249
2250dnl utmp detection
2251AC_MSG_CHECKING([if your system defines UTMP_FILE])
2252AC_TRY_COMPILE([
2253#include <sys/types.h>
2254#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002255#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002256# include <paths.h>
2257#endif
2258 ],
2259 [ char *utmp = UTMP_FILE; ],
2260 [ AC_MSG_RESULT(yes) ],
2261 [ AC_MSG_RESULT(no)
2262 system_utmp_path=no ]
2263)
2264if test -z "$conf_utmp_location"; then
2265 if test x"$system_utmp_path" = x"no" ; then
2266 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2267 if test -f $f ; then
2268 conf_utmp_location=$f
2269 fi
2270 done
2271 if test -z "$conf_utmp_location"; then
2272 AC_DEFINE(DISABLE_UTMP)
2273 fi
2274 fi
2275fi
2276if test -n "$conf_utmp_location"; then
2277 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2278fi
2279
2280dnl wtmp detection
2281AC_MSG_CHECKING([if your system defines WTMP_FILE])
2282AC_TRY_COMPILE([
2283#include <sys/types.h>
2284#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002285#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002286# include <paths.h>
2287#endif
2288 ],
2289 [ char *wtmp = WTMP_FILE; ],
2290 [ AC_MSG_RESULT(yes) ],
2291 [ AC_MSG_RESULT(no)
2292 system_wtmp_path=no ]
2293)
2294if test -z "$conf_wtmp_location"; then
2295 if test x"$system_wtmp_path" = x"no" ; then
2296 for f in /usr/adm/wtmp /var/log/wtmp; do
2297 if test -f $f ; then
2298 conf_wtmp_location=$f
2299 fi
2300 done
2301 if test -z "$conf_wtmp_location"; then
2302 AC_DEFINE(DISABLE_WTMP)
2303 fi
2304 fi
2305fi
2306if test -n "$conf_wtmp_location"; then
2307 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2308fi
2309
2310
2311dnl utmpx detection - I don't know any system so perverse as to require
2312dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2313dnl there, though.
2314AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2315AC_TRY_COMPILE([
2316#include <sys/types.h>
2317#include <utmp.h>
2318#ifdef HAVE_UTMPX_H
2319#include <utmpx.h>
2320#endif
Damien Miller2994e082000-06-04 15:51:47 +10002321#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002322# include <paths.h>
2323#endif
2324 ],
2325 [ char *utmpx = UTMPX_FILE; ],
2326 [ AC_MSG_RESULT(yes) ],
2327 [ AC_MSG_RESULT(no)
2328 system_utmpx_path=no ]
2329)
2330if test -z "$conf_utmpx_location"; then
2331 if test x"$system_utmpx_path" = x"no" ; then
2332 AC_DEFINE(DISABLE_UTMPX)
2333 fi
2334else
2335 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2336fi
2337
2338dnl wtmpx detection
2339AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2340AC_TRY_COMPILE([
2341#include <sys/types.h>
2342#include <utmp.h>
2343#ifdef HAVE_UTMPX_H
2344#include <utmpx.h>
2345#endif
Damien Miller2994e082000-06-04 15:51:47 +10002346#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002347# include <paths.h>
2348#endif
2349 ],
2350 [ char *wtmpx = WTMPX_FILE; ],
2351 [ AC_MSG_RESULT(yes) ],
2352 [ AC_MSG_RESULT(no)
2353 system_wtmpx_path=no ]
2354)
2355if test -z "$conf_wtmpx_location"; then
2356 if test x"$system_wtmpx_path" = x"no" ; then
2357 AC_DEFINE(DISABLE_WTMPX)
2358 fi
2359else
2360 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2361fi
2362
Damien Miller4018c192000-04-30 09:30:44 +10002363
Damien Miller29ea30d2000-03-17 10:54:15 +11002364if test ! -z "$blibpath" ; then
2365 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2366 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2367fi
2368
Tim Rice4cec93f2002-02-26 08:40:48 -08002369dnl remove pam and dl because they are in $LIBPAM
2370if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002371 LIBS=`echo $LIBS | sed 's/-lpam //'`
2372fi
2373if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2374 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002375fi
2376
Damien Millerbac2d8a2000-09-05 16:13:06 +11002377AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002378AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2379AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002380
Damien Miller7b22d652000-06-18 14:07:04 +10002381# Print summary of options
2382
Damien Miller7b22d652000-06-18 14:07:04 +10002383# Someone please show me a better way :)
2384A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2385B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2386C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2387D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002388E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002389F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002390G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002391H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2392I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2393J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002394
2395echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002396echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002397echo " User binaries: $B"
2398echo " System binaries: $C"
2399echo " Configuration files: $D"
2400echo " Askpass program: $E"
2401echo " Manual pages: $F"
2402echo " PID file: $G"
2403echo " Privilege separation chroot path: $H"
Tim Rice43a1c132002-04-17 21:19:14 -07002404if test "$USES_LOGIN_CONF" = "yes" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002405echo " At runtime, sshd will use the path defined in /etc/login.conf"
Tim Rice43a1c132002-04-17 21:19:14 -07002406else
Damien Millerf58c6722002-05-13 13:15:42 +10002407echo " sshd default user PATH: $I"
Tim Rice43a1c132002-04-17 21:19:14 -07002408fi
Damien Millera18bbd32002-05-13 10:48:57 +10002409if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002410echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002411fi
Damien Millerf58c6722002-05-13 13:15:42 +10002412echo " Manpage format: $MANTYPE"
2413echo " PAM support: ${PAM_MSG}"
2414echo " KerberosIV support: $KRB4_MSG"
2415echo " KerberosV support: $KRB5_MSG"
2416echo " Smartcard support: $SCARD_MSG"
2417echo " AFS support: $AFS_MSG"
2418echo " S/KEY support: $SKEY_MSG"
2419echo " TCP Wrappers support: $TCPW_MSG"
2420echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002421echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002422echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2423echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2424echo " BSD Auth support: $BSD_AUTH_MSG"
2425echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002426if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002427echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002428fi
2429
Damien Miller7b22d652000-06-18 14:07:04 +10002430echo ""
2431
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002432echo " Host: ${host}"
2433echo " Compiler: ${CC}"
2434echo " Compiler flags: ${CFLAGS}"
2435echo "Preprocessor flags: ${CPPFLAGS}"
2436echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002437echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002438
2439echo ""
2440
Damien Miller82cf0ce2000-12-20 13:34:48 +11002441if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002442 echo "PAM is enabled. You may need to install a PAM control file "
2443 echo "for sshd, otherwise password authentication may fail. "
2444 echo "Example PAM control files can be found in the contrib/ "
2445 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002446 echo ""
2447fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002448
2449if test ! -z "$NO_SFTP"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002450 echo "sftp-server will be disabled. Your compiler does not "
2451 echo "support 64bit integers."
2452 echo ""
2453fi
2454
2455if test ! -z "$RAND_HELPER_CMDHASH" ; then
2456 echo "WARNING: you are using the builtin random number collection "
2457 echo "service. Please read WARNING.RNG and request that your OS "
2458 echo "vendor includes kernel-based random number collection in "
2459 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002460 echo ""
2461fi
Damien Miller60396b02001-02-18 17:01:00 +11002462